akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)
func main() {
	inf := 10000000001
	scan_init()
	x := scanInt()
	y := scanInt()
	a := scanInt()
	b := scanInt()
	c := scanInt()
	p := make([]int,a)
	q := make([]int,b)
	r := make([]int,c)
	for i:= 0; i<a; i++ {
		p[i] = scanInt()
	}
	for i:= 0; i<b; i++ {
		q[i] = scanInt()
	}
	for i:= 0; i<c; i++ {
		r[i] = scanInt()
	}
	sort.Ints(p)
	sort.Ints(q)
	sort.Ints(r)
	maxA := p[len(p)-x:]
	maxB := q[len(q)-y:]
	a_i := 0
	b_i := 0
	n := len(r)
	for i:=n-1; i>=0; i-- {
		value := r[i]
		aValue := inf
		bValue := inf
		if a_i<len(maxA) {
			aValue = maxA[a_i]
		}
		if b_i<len(maxB) {
			bValue = maxB[b_i]
		}
		if aValue < bValue {
			// aの方が小さい
			if value > aValue {
				// aよりcの方が大きければ
				maxA[a_i] = value
			}
			a_i++
		} else {
			if value > bValue {
				maxB[b_i] = value
			}
			b_i++
		}
	}
	sum := 0
	for i:= 0; i<len(maxA); i++ {
		sum += maxA[i]
	}
	for i:= 0; i<len(maxB); i++ {
		sum += maxB[i]
	}
	fmt.Println(sum)
}
//func pop(slice []interface{}) (interface{}, []interface{}) {
//	n := len(slice)
//	value := slice[n-1]
//	popSlice := slice[0:n-2]
//	return value, popSlice
//}
var sc = bufio.NewScanner(os.Stdin)
func scan_init () {
	sc.Split(bufio.ScanWords)
}
func scanInt () int{
sc.Scan()
	i,_ := strconv.Atoi(sc.Text())
	return i
}
//func scan () string{
//  sc.Scan()
//	return sc.Text()
//}

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en 


constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

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

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

void Main(){
    int n;
    cin >> n;
    int ans;
    ans = modpow(10, n, MOD);
    ans -= modpow(9, n, MOD);
    ans -= modpow(9, n, MOD);
    ans += modpow(8, n, MOD);
    ans %= MOD;
    if (ans < 0) {
        ans += MOD;
    }
    cout << ans << endl;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}



Measured memory_bytes: 3632
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
def tenmul (n):
    if n % 10 == 0:
        return n
    else:
        return n + 10 - n%10

a2 = tenmul(a)
b2 = tenmul(b)
c2 = tenmul(c)
d2 = tenmul(d)
e2 = tenmul(e)
list = [a,b,c,d,e]
list2 = [a2,b2,c2,d2,e2]

result = sum(list2)
for i in range(5):
    M = sum(list2)
    result = min(M-list2[i]+list[i],result)
print(result)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >=0; --i)
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<int,int>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(200005);

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

  int tmp;
  int cnt = 0;
  ll ans = 0;
  rep(i, n){
    cin >> tmp;
    if(tmp==(i+1)) cnt++;
    else {
      ans += (cnt+1) / 2;
      cnt = 0;
    }
  }
  ans += (cnt+1) / 2;
  cnt = 0;

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


Measured memory_bytes: 3328
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
    int n;
    cin >> n; //how many toppings
    int Mon_pizza, Mon_topping; //cost (money)
    cin >> Mon_pizza >> Mon_topping;
    int Cal_pizza; //calorie
    cin >> Cal_pizza;
    int Cal_topping[100];
    for (int i = 0; i < n; i++) {
        cin >> Cal_topping[i];
    }
    sort(Cal_topping, Cal_topping + n);
    int cosper = Cal_pizza / Mon_pizza; //cost performance
    int Sum_Cal = Cal_pizza, Sum_Mon = Mon_pizza;
    for (int i = n - 1; i >= 0; i--) {
        Sum_Cal += Cal_topping[i];
        Sum_Mon += Mon_topping;
        if (Sum_Cal / Sum_Mon > cosper) {
            cosper = Sum_Cal / Sum_Mon;
        }
    }
    cout << cosper << endl;
}



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

using namespace std;



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

    vector<vector<int>> D(9, vector<int>(9, 0));

    for (int i=1; i<=N; i++) {

        if (i % 10 == 0) continue;

        int a, b;
        if (i / 10 == 0) {
            a = i-1;
            b = i-1;
            D[a][b] += 1;
        } else {
            b = (i % 10) -1;
            int ic = i;
            while (9 < ic) {
                ic = ic / 10;
            }
            a = ic - 1;
            D[a][b] += 1;
        }
    }

    long long res = 0;

    for (int i=0; i<9; i++) {
        for (int j=0; j<9; j++) {
            res += D[i][j] * D[j][i];
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) = abc159d()

fun abc159d() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map { it.toLong() }

    val groupBy = aList.groupBy { it }.mapValues { it.value.size.toLong() }

    val allMap = groupBy.mapValues { (it.value - 1) * it.value / 2 }

    val allSum = allMap.map { it.value }.sum()

    val minusMap = groupBy.mapValues { (it.value - 2) * (it.value - 1) / 2 }

    val answer = aList.map { allSum - allMap[it]!! + minusMap[it]!! }.joinToString(System.lineSeparator())

    println(answer)
}


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

bool solve(const int N, const int M, vector<int> operations)
{
    auto stage_counts = vector<int>(M+1);
    stage_counts[0] = N;

    auto stage_labels = vector<int>(M);
    auto stages = vector<int>(M, -1);
    auto max_stage = 0;

    reverse(begin(operations), end(operations));

    for (const auto op : operations)
    {
        if (stages[op] == -1)
        {
            stages[op] = max_stage;
            stage_labels[max_stage] = op;
            max_stage++;
        }

        const auto s = stages[op];
        if (stage_counts[s] != 0)
        {
            stage_counts[s]--;
            stage_counts[s+1]++;
        }
    }

    auto permutation = vector<int>();
    auto used = vector<bool>(M);
    for (auto i = 0; i < M; i++)
    {
        if (stage_counts[i] != 0)
        {
            for (auto j = 0; j < M; j++) if (!used[j])
                permutation.push_back(j);
            break;
        }
        permutation.push_back(stage_labels[i]);
        used[stage_labels[i]] = true;
    }

    for (auto i = 0; i < max_stage; i++)
        if (permutation[i] != stage_labels[i]) return false;
    return true;
}

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

    int Q; cin >> Q;

    auto operations = vector<int>(Q);
    for (auto& x : operations)
    {
        cin >> x;
        x--;
    }

    cout << (solve(N, M, move(operations)) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 2432
l,r=map(int,input().split())
if r-l+1>=2019:
  print(0)
  exit()
else:
  l=l%2019
  r=r%2019
  
  if l>=r:
    print(0)
    exit()
ans=10000000
for i in range(l,r+1):
  for j in range(i+1,r+1):
    ans=min(ans,(i*j)%2019)
print(ans)

Measured memory_bytes: 40812
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	l := getNextUint64(scanner)
	r := getNextUint64(scanner)

	ans := count(l, r)

	fmt.Fprintln(writer, ans)

	writer.Flush()
}

func solve(l, r uint64) uint64 {
	mod := uint64(1e9 + 7)
	var ans uint64
	for x := l; x <= r; x++ {
		for y := l; y <= x; y++ {
			if x%y == x^y {
				ans++
				ans %= mod
			}
		}
	}
	return ans
}

func count(l, r uint64) int {
	var dp [65][2][2][2]int

	// dp[桁数][下がLより大きいか][上がR未満か][1の位置が同じかどうか]
	dp[0][0][0][0] = 1
	for i := 0; i < 64; i++ {
		lb := int((l >> uint(63-i)) & 1)
		rb := int((r >> uint(63-i)) & 1)

		for ii := 0; ii < 2; ii++ {
			for iii := 0; iii < 2; iii++ {
				for iiii := 0; iiii < 2; iiii++ {
					for x := 0; x < 2; x++ {
						for y := 0; y < 2; y++ {
							aii, aiii, aiiii := ii, iii, iiii
							if x == 1 && y == 0 {
								continue
							}
							if ii == 0 {
								if lb == 0 && x == 1 {
									aii = 1
								}

								if lb == 1 && x == 0 {
									continue
								}
							}
							if iii == 0 {
								if rb == 1 && y == 0 {
									aiii = 1
								}
								if rb == 0 && y == 1 {
									continue
								}
							}
							if iiii == 0 {
								if x&y == 1 {
									aiiii = 1
								}
								if x != y {
									continue
								}
							}
							dp[i+1][aii][aiii][aiiii] = mint(dp[i+1][aii][aiii][aiiii] + dp[i][ii][iii][iiii])
						}
					}
				}
			}
		}

	}

	ans := 0

	for ii := 0; ii < 2; ii++ {
		for iii := 0; iii < 2; iii++ {
			for iiii := 0; iiii < 2; iiii++ {
				ans = mint(ans + dp[64][ii][iii][iiii])
			}
		}
	}
	return ans
}

func mint(a int) int {
	mod := a % int(1e9+7)
	if mod < 0 {
		mod += int(1e9 + 7)
	}
	return mod
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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

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

int main()
{
  ll x;
  cin >> x;
  for (ll i = 1000; i >= 0; i--)
  {
    for (ll j = -1000; j <= 1000; j++)
    {
      if (i * i * i * i * i - j * j * j * j * j == x)
      {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  return 0;
}

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

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

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

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

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

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

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

  ($next:expr, bytes) => {
    read_value!($next, String).into_bytes()
  };

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

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


fn main() {
  input!{
    n: usize,
    m: usize,
  }

  let ans = if n == m { "Yes" } else { "No" };

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

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
const int mod = 1000000007;
const int MX = 110000;
// a^n mod を計算する
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 f[MX],fi[MX];
int nCm(int x,int y){
    
    if(x < y)return 0;
    return ((f[x]*fi[y])%mod)*fi[x-y]%mod;
}
//#########################################
signed main(){
    int n;cin >> n;
    int a[n+1];
    rep(i,110000){
        f[i] = 1;
        fi[i] = 1;
    }
    for(int i = 1;i < MX;i++){
        f[i] = (f[i-1]*i)%mod;
    }
    fi[MX-1] = modpow(f[MX-1],mod-2,mod);
    for(int i = MX-2;i >= 1;i--){
        fi[i] = (fi[i+1]*(i+1))%mod;
    }

    rep(i,n+1){
        cin >> a[i];
        a[i]--;
    }

    vector<int> vis(n+1);
    int r;
    rep(i,n+1){
        if(vis[a[i]]){
            r = i;
            break;
        }
        vis[a[i]] = 1;
    }
    int i;
    for( i = 0;i < n+1 && a[i] != a[r];i++);
    int M = r-i-1;
    int L = i;
    int R = n-r;
    //trace(M,L,R);
    for(int k = 1;k <= n+1;k++){
        int ans = nCm(n+1,k);
        //trace(ans,L+R);
        ans -= nCm(L+R,k-1);
        //trace(nCm(L+R,k-1));

        ans = (ans%mod+mod)%mod;

        cout << ans << endl;
    }
    



    return 0;
}

Measured memory_bytes: 4480
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int H, W;
    string tmp;
    vector<string> a;

    cin >> H >> W;
    for (int count = 0; count < H; count++)
    {
        cin >> tmp;
        a.push_back(tmp);
    }

    for (int count = 0; count < W + 2; count++)
    {
        cout << "#";
    }
    cout << endl;
    for (int count = 0; count < a.size(); count++)
    {
        cout << "#" + a.at(count) + "#" << endl;
    }
    for (int count = 0; count < W + 2; count++)
    {
        cout << "#";
    }
    cout << endl;
}

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

int main()
{
	while (true){
		double n;
		cin >> n;
		if (n < 0) break;
		bool j[12];
		memset(j, false, sizeof j);

		for (int i = 0; i < 12; i++){
			if (n >= (double)128 / (1 << i)){
				j[i] = true;
				n -= (double)128 / (1 << i);
			}
		}
		if (!n){
			for (int i = 0; i < 12; i++){
				if (i == 8) cout << ".";
				cout << j[i];
			}
			cout << endl;
		}
		else cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
#include<iostream>
#include<math.h>

using namespace std;

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

    if(abs(m-n)>1){
        cout << "0" << endl;
        return 0;
    }
    if(m>n){
        int tmp = m;
        m = n;
        n = tmp;
    }

    unsigned long long ans = 1;
    for(int i=2;i<=n;i++){
        ans *= i;
        ans %= 1000000007;
    }
    for(int i=2;i<=m;i++){
        ans *= i;
        ans %= 1000000007;
    }

    if(m==n){
        ans *=2;
        ans %= 1000000007;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define space " "
#define MOD (long long) 1000000007
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename T> void __f(const char* variable_name, T&& value){cout << variable_name << ": " << value << endl;}
template <typename T1, typename... T2> void __f(const char* names, T1&& arg1, T2&&... args){const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << ": " << arg1 << " |";__f(comma + 1, args...);}

const ll N = 5e5 + 5;
ll *v;
ll n;

void solve(){
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll t = 1;
    // cout << "\n\nBLAH BLAH BLAH\n\n";
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

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

template <typename T>
T gcd(T a, T b) {
  while (b) {
    T tmp = b;
    b = a % b;
    a =  tmp;
  }
  return a;
}

int main() {
  int64_t n;
  cin >> n;
  vector<int64_t> as(n);
  for (auto &a : as) {
    cin >> a;
  }
  int64_t g = as[0];
  for (auto &a : as) {
    g = gcd(g, a);
  }
  cout << g << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
int counter = 0;
int gcd(int a, int b) {
	if (b == 0) return a;
	counter++;
	return gcd(b, a % b);
}


ll F[50];


int main() {
	ll N, red = 0;
	cin >> N;
	bool color[8];
	rep(i, 8) {
		color[i] = false;
	}
	rep(i, N) {
		ll a;
		cin >> a;

		if (a >= 3200)red++;
		else {
			color[a / 400] = true;
		}
	}
	ll count = 0;
	rep(i, 8) {
		if (color[i])count++;
	}

	cout << max(ll(1), count) << " " << min(ll(9999), count + red) << endl;
}


Measured memory_bytes: 3596
#!/usr/bin/env python
"""AtCoder Beginner Contest 167: C - Skill Up
https://atcoder.jp/contests/abc167/tasks/abc167_c
"""

N, M, X = 0, 0, 0
BOOKS = []


def calc_price(book_combinations):
    price = 0
    understandings = [0] * M
    for i in range(len(book_combinations)):
        if book_combinations[i]:
            price += BOOKS[i][0]
            for j in range(len(BOOKS[i][1:])):
                understandings[j] += BOOKS[i][j + 1]
    for u in understandings:
        if u < X:  # couldn't understand
            return -1
    return price


def main():
    global N, M, X, BOOKS
    N, M, X = list(map(int, input().split()))
    BOOKS = [list(map(int, input().split())) for i in range(N)]

    ans = float('inf')
    for i in range(1, 2 ** N):  # => 1: at least one book should be buy
        price = calc_price([(i >> j) & 1 for j in range(N)])
        if 0 < price and price < ans:
            ans = price
    if ans == float('inf'):
        ans = -1
    print(ans)


if __name__ == '__main__':
    main()


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

int main(){
    
    int a, b, t;
    while(1){
        cin >> a >> b;
        if(a==0){
            if(b==0){
                break;
            }
        }
        if(a>b){
            t=a;
            a=b;
            b=t;
        }
        cout << a << " " << b <<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3092
#include<iostream>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;

  int a=1,b;

  for(int i=1;i<=n;i++){
    a*=2;
    if(a>k){
      b=i;
      break;
    }
    if(i==n)b=n;
  }

  cout << a+(n-b)*k << endl;

}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int min = Integer.MAX_VALUE;
        for (int i = n, t = 1; i >= 0; i--, t *= 2) {
            min = Math.min(min, t + i * k);
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 21716
#include <string.h>
#include <stdio.h>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define MAX(a, b) (a>b)?a:b
#define MIN(a, b) (a<b)?a:b
int main() {
    int w, h, n, x1 = 0, x2 = 0, y1 = 0, y2 = 0;
    scanf("%d %d %d", &w, &h, &n);
    x2 = w; y2 = h;
    REP(i, 0, n) {
        int xi, yi, a;
        scanf("%d %d %d", &xi, &yi, &a);
        switch(a) {
            case 1:
                x1 = MAX(x1, xi); break;
            case 2:
                x2 = MIN(x2, xi); break;
            case 3:
                y1 = MAX(y1, yi); break;
            case 4:
                y2 = MIN(y2, yi); break;
        }
    }
    if (x2 > x1 && y2 > y1)
        printf("%d\n", (x2-x1)*(y2-y1));
    else
        puts("0");
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(_i,_a,_n) for(int _i=_a;_i<=_n;++_i)
#define PER(_i,_a,_n) for(int _i=_n;_i>=_a;--_i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(_a) ({REP(_i,1,n) cout<<_a[_i]<<',';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



#ifdef __APPLE__
const int N = 1e2+50;
#else
const int N = 1e6+50;
#endif

int main() {
	ll a,b,c;
	cin>>a>>b>>c;
	ll ans = 0;
	ll t = min(a,c);
	c -= t, ans += t;
	t = min(b,c);
	c -= t, b -= t, ans += 2*t;
	ans += b;
	if (c) ++ans;
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int H,W,i,j;
    while(1){
        scanf("%d %d",&H,&W);
        if(H==0&&W==0){
            break;
        }
        for(i=1; i<=H; i++){
            for(j=1; j<=W; j++){
                if(i%2==1&&j%2==1)printf("#");
                if(i%2==1&&j%2==0)printf(".");
                if(i%2==0&&j%2==1)printf(".");
                if(i%2==0&&j%2==0)printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
    cin>>s;
    string str=s;
    reverse(s.begin(),s.end());
    for(int i=0;i<s.size();++i){
        s[i]=='b'? s[i]='d':
		s[i]=='d'? s[i]='b':
        s[i]=='p'? s[i]='q':
        s[i]=='q'? s[i]='p': i+=0;
    }
    s==str?cout<<"Yes"<<endl:cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int dy[] = {-1,0,1,0}, dx[] = {0,-1,0,1};
int n, used[8][8], p[8][8], res;

void dfs(int sum, int y, int x, int rest){
  //  printf("%d %d %d %d\n", sum, y, x, rest);
  if(res) return;

  if(sum == 0 && rest == 0){
    res = 1;
    return;
  }
  if(sum == 0){
    rep(i, n) rep(j, n){
      if(used[i][j]) continue;
      if(p[i][j]<0){
	used[i][j] = 1;
	dfs(-p[i][j], i, j, rest-1);
	used[i][j] = 0;
	return;
      }
    }
  }else{
    rep(d, 4){
      int ny = y + dy[d], nx = x + dx[d];
      if(ny < 0 || nx < 0 || ny >= n || nx >= n || used[ny][nx] || p[ny][nx] < 0 || p[ny][nx] > sum) continue;
      //      printf("next %d %d %d %d\n", ny, nx, used[ny][nx], p[ny][nx]);
      used[ny][nx] = 1;
      dfs(sum - p[ny][nx], ny, nx, rest-1);
      used[ny][nx] = 0;
    }
  }
}

int main(){
  while(scanf("%d", &n) && n){
    res = 0;
    memset(used, 0, sizeof(used));
    rep(i, n) rep(j, n) scanf("%d", &p[i][j]);

    dfs(0, 0, 0, n*n);
    puts(res?"YES":"NO");
  }
  return 0;
}

Measured memory_bytes: 1168
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j, k;

  scanf("%d", &n);


  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  scanf("%hu", &A[1]);

  k = A[1];

  for(i = 2; i <= n; i++){
    scanf("%hu", &A[i]);
    if(A[i] > k){
      k = A[i];
    }
  }

  for(i = 0; i <= k; i++){
    C[i] = 0;
  }

  for(j = 1; j <= n; j++){
    C[A[j]] = C[A[j]] + 1;
  }

  for(i = 1; i <= k; i++){
    C[i] = C[i] + C[i-1];
  }

  for(j = n; j >= 1; j--){
    B[C[A[j]]] = A[j];
    C[A[j]] = C[A[j]] - 1;
  }

  printf("%u", B[1]);
  for(i = 2; i <= n; i++){
    printf(" %u", B[i]);
  }
  printf("\n");
  
  return 0;
}



Measured memory_bytes: 9540
#include <stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int p, int r) {
  int x, i, j, t;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++) {
    if(A[j] <= x) {
      i++;
      t=A[i]; A[i]=A[j]; A[j]=t;
    }
  }
  t=A[i+1]; A[i+1]=A[r]; A[r]=t;
  return i+1;
}

int main(void) {
  int i, q;

  scanf("%d", &n);
  for(i=0; i<n; i++) scanf("%d",&A[i]);
  q = partition(0,n-1);

  for(i=0; i<n; i++) {
    if(i) printf(" ");
    if(i==q) printf("[");
    printf("%d",A[i]);
    if(i==q) printf("]");
  }
  printf("\n");

  return 0;
}

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

  int max = 0;
  for(int i=0; i<n; i++){
    if(a[i]>max){
      max = a[i];
    }
  }
  int min = 1000000000;
  for(int i=0; i<n; i++){
    if(a[i]<min){
      min = a[i];
    }
  }
  cout << max-min << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
    long long N, A, B;
    cin >> N >> A >> B;
    if ((B-A)%2 == 0) {
        cout << (B-A)/2 << endl;
    }
    else {
        long long ans = LLONG_MAX;
        long long k = N-B;
        long long a = A+k, b = B+k;
        a++, k++;
        ans = min(ans, k+(b-a)/2);
        k = A-1;
        a = A-k, b = B-k;
        b--, k++;
        ans = min(ans, k+(b-a)/2);
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n;
		int[] s;
		int sum;
		double m;
		double a2;
		double a;

		while(true){
			n = sc.nextInt();
			s = new int[n];
			if(n == 0)
				break;
			sum = 0;
			m = 0;
			a = 0;
			a2 = 0;
			for(int i=0; i<n; i++){
				s[i] = sc.nextInt();
				sum += s[i];
			}
			m = (double)sum/n;
			for(int i=0; i<n; i++){
				a2 += Math.pow((s[i]-m),2.0);
			}
			a2 = a2/n;
			a = Math.sqrt(a2);
			System.out.printf("%.8f\n",a);

		}
	}
}

Measured memory_bytes: 31392
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>

string S;
int main(){
    cin>>S;
    for(int i=0;i<S.size();i++){
        cout<<'x';
    }
    return 0;
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
}

int ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b;
int x, y;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{ cin>> a >> b;
if(a%b==0)pr(0);
else pr(1);

}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define pb push_back
#define fastcin() ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(), (x).end()
#define heap priority_queue
using namespace std;
typedef pair<int, int> ii;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int a[100], n; 

vector<int> pv, nv; 
vector<ii> ans; 

signed main()
{
	cin >> n;  
	int pos = 0, neg = 0; 
	for(int i = 1; i <= n; i++) {
		cin >> a[i]; 
		if(a[i] < 0) neg += -a[i], nv.pb(i); 
		else pos += a[i], pv.pb(i); 
	}
	bool posok = 1; 
	for(int i = 1; i <= n; i++) 
		if(a[i] < 0 and pos + a[i] < 0) {
			posok = 0; 
			break; 
		}
	if(posok) {
		for(int i = 0; i < (int)pv.size() - 1; i++) 
			ans.pb({pv[i], pv[(int)pv.size() - 1]}); 
		for(int i = 0; i < (int)nv.size(); i++) 
			ans.pb({pv[(int)pv.size() - 1], nv[i]}); 
		for(int i = 2; i <= n; i++) 
			ans.pb({i-1, i});
	}	
	else {
		for(int i = 0; i < (int)nv.size() - 1; i++) 
			ans.pb({nv[i], nv[(int)nv.size() - 1]}); 
		for(int i = 0; i < (int)pv.size(); i++) 
			ans.pb({nv[(int)nv.size() - 1], pv[i]}); 		
		for(int i = n - 1; i; i--) 
			ans.pb({i+1, i}); 
	}
	cout << ans.size() << '\n'; 
	for(auto x : ans) 
		cout << x.fi << ' ' << x.se << '\n'; 
} 


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

int main() {
  string s, t;
  cin >> s;
  int x = s.size();
  int a = x - 2;
  
  t = s.at(0);
  cout << t;
  cout << a;
  t = s.at(x - 1);
  cout << t << endl;
}


Measured memory_bytes: 3556
<?php
//ITP1_2_B
$stdin = explode(' ',trim(fgets(STDIN)));
$a = intval($stdin[0]);
$b = intval($stdin[1]);
$c = intval($stdin[2]);
if($a<$b && $b<$c){
	echo "Yes";
}else{
	echo "No";
}
?>

Measured memory_bytes: 15188
import math
ans = 0
k = int(input())
for a in range(1, k + 1):
    for b in range(1, k + 1):
        x = math.gcd(a, b)
        for c in range(1, k + 1):
            y = math.gcd(x, c)
            ans += y
print(ans)


Measured memory_bytes: 67588
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Set<String> dictionary = new HashSet<String>();
		try(Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			for(int i=0;i<n;i++) {
				String com = sc.next();
				String str = sc.next();
				if(com.equals("insert")) {
					dictionary.add(str);
				}
				else {
					if(dictionary.contains(str))
						System.out.println("yes");
					else 
						System.out.println("no");
				}
			}
		}
	}
}




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

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

    int n;
    cin >> n;
    pair<pair<string, int>, int> p[n];
    for (int i = 0; i < n; ++i){
        string city;
        int score;
        cin >> city >> score;

        p[i] = make_pair(make_pair(city, -score), i);
    }
    sort(p, p+n);

    for (int i = 0; i < n; ++i) cout << p[i].second + 1 << endl;
}


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

const int INF = 1000000000;
int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    set<int> st;
    st.insert(a);
    st.insert(b);
    st.insert(c);
    cout << st.size() << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define poly vector<ll>
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
     if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=505;
int a[N][N];
void solve(int l,int r,int dep){
	if(l==r)return;
	int mid=(l+r)>>1;
	For(i,l,mid)For(j,mid+1,r)a[i][j]=dep;
	solve(l,mid,dep+1); solve(mid+1,r,dep+1);
}
int main(){
	int n=read();
	solve(1,n,1);
	For(i,1,n-1){
		For(j,i+1,n)wri(a[i][j]); puts("");
	}
}

Measured memory_bytes: 1408
#include <iostream>
#include <sstream>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int h[2000001],hsize=1;
void insert(int key){
  int i=hsize;
  hsize++;
  h[i]=key;
  while(i>1&&h[i/2]<h[i]){
    swap(h[i/2],h[i]);
    i/=2;
  }
}
void maxheapify(int i){
  int l=i*2;
  int r=l+1,lrg;
  if(l<=hsize&&h[l]>h[i])lrg=l;
    else lrg =i;
  if(r<=hsize&&h[r]>h[lrg])lrg =r;
  if(lrg!=i){
    swap(h[i],h[lrg]);
    maxheapify(lrg);
  }
}
void extract(){
  cout<<h[1]<<endl;
  h[1]=h[--hsize];
  maxheapify(1);
}


int main(){
  string str;
  int k;
  while(cin>>str){
  if(str=="insert"){
    cin>>k;
    //cout<<h[1]<<":"<<h[2]<<":"<<h[3]<<endl;
    insert(k);
    //cout<<h[1]<<":"<<h[2]<<":"<<h[3]<<endl<<endl;
  }
  else if(str=="extract"){
    extract();
  }
  else break;
  }


  return 0;
}



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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j;
  string s;
  ll k;
  cin >> s >> k;
  ll count1 = 0;
  char c;
  for(i = 0; i < s.size() && s[i] == '1'; i++)
    count1++;
  c = s[i];
  //cout << count1 spa c spa endl;
  if(k <= count1)
    cout << '1' << endl;
  else
    cout << c << endl;
    

  return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[allow(unused_macros)]
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }

// ref: https://github.com/hatoo/competitive-rust-snippets/blob/master/src/binary_search.rs
// ref: https://qiita.com/hamko/items/794a92c456164dcc04ad
#[allow(dead_code)]
pub trait BinarySearch<T> {
    /// the first element which does not compare less than val
    fn lower_bound(&self, x: &T) -> usize;
    /// the first element which compares grater than val
    fn upper_bound(&self, x: &T) -> usize;
}

#[allow(dead_code)]
impl <T: Ord> BinarySearch<T> for [T] {
    fn lower_bound(&self, x: &T) -> usize {
        let mut ng = -1;
        let mut ok = self.len() as i32;
        while ok - ng > 1 {
            let mid = (ng + ok) / 2;
            if self[mid as usize] >= *x {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        ok as usize
    }

    fn upper_bound(&self, x: &T) -> usize {
        let mut ng = -1;
        let mut ok = self.len() as i32;
        while ok - ng > 1 {
            let mid = (ng + ok) / 2;
            if self[mid as usize] > *x {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        ok as usize
    }
}

fn main() {
    input! {
        n: usize,
        a_: [i32; n],
        b: [i32; n],
        c_: [i32; n],
    }
    let mut a = a_.clone();
    a.sort();
    let mut c = c_.clone();
    c.sort();

    let mut ret = 0;
    for i in 0..b.len() {
        ret += a.lower_bound(&b[i]) * (n - c.upper_bound(&b[i]));
    }

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


Measured memory_bytes: 4272
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 998244353;
using Graph = vector<vector<int>>;
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    COMinit();
    int N,M,K;
    cin>>N>>M>>K;
    int ans=0;
    int sum=M;
    rep(i,N-K-1){
        sum*=M-1;
        sum%=MOD;
    }
    for(int i=K;i>=0;i--){
        
        int c=COM(N-1,i);
        c%=MOD;
        ans+=(sum*c)%MOD;
        ans%=MOD;
        sum*=M-1;
        sum%=MOD;
    }
    
    cout << ans << endl;



}


Measured memory_bytes: 15608
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	data = input[0].split('');
	isStrong = true;
	for(i=0;i<data.length;i++){
	    if(data[i]!==data[data.length-i-1]){
	        isStrong = false;
	    }
	}
	for(i=0;i<(data.length-1)/2;i++){
	    if(data[i]!==data[(data.length-1)/2-i-1]){
	        isStrong = false;
	    }
	}

	console.log(isStrong?'Yes':'No');
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int n, m = 0, t = 0;
int h[100000];

int main()
{
	cin >> n;

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

	for (int i = 1; i < n; i++) {
		if (h[i - 1] >= h[i])
			t++;
		else {
			m = max(m, t);
			t = 0;
		}
	}

	m = max(m, t);

	cout << m << endl;

	return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long k = sc.nextLong();
		long sum = 0;
		int[] members = new int[n];
		for (int i = 0; i < n; i++) {
		    members[i] = sc.nextInt();
		    sum += members[i];
		}
		if (sum <= k) {
		    System.out.println(0);
		    return;
		}
		Arrays.sort(members);
		int[] foods = new int[n];
		for (int i = 0; i < n; i++) {
		    foods[i] = sc.nextInt();
		}
		Arrays.sort(foods);
		long left = 0;
		long right = Long.MAX_VALUE / 10;
		while(right - left > 1) {
		    long m = (left + right) / 2;
		    long total = 0;
		    for (int i = 0; i < n; i++) {
		        total += Math.max(members[n - i - 1] - m / foods[i], 0);
		    }
		    if (total <= k) {
		        right = m;
		    } else {
		        left = m;
		    }
		}
		System.out.println(right);
    }
}


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

#define pi 3.14159265358

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n, m, i, u, v;
	cin >> n >> m;
	vector<vector<ll>> vp(n+1);
	for(i=0; i<m; ++i){
		cin >> u >> v;
		vp[u].push_back(v);
		vp[v].push_back(u);
	}
	queue<ll> q;
	vector<bool> visited(n+1, false);
	vector<int> p(n+1, -1);
	q.push(1);
	visited[1] = true;
	
	while(!q.empty()){
		ll front = q.front();
		//cout << front <<"\n";
		q.pop();
		for(auto it: vp[front]){
			if(visited[it] == false){
				visited[it] = true;
				//cout << it << " ";
				p[it] = front;
				q.push(it);
			}
		}
		//cout << "\n";
	}
	cout << "Yes\n";
	for(i=2; i<=n; ++i)
		cout << p[i] <<"\n";
	return 0;
}


Measured memory_bytes: 12588
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int h,w;
    cin >> h >> w;
for(int i=0;i<w+2;i++) cout << '#';
cout << endl;
string ans;
for(int i=0;i<h;i++){
cin >> ans;
cout<<'#'<<ans<<'#'<<endl;
} 
    for(int i=0;i<w+2;i++) cout << '#';
cout << endl;
    return 0;
}


Measured memory_bytes: 256
def minimumChar(S1, S2): 
    n, m = len(S1), len(S2) 
    ans = len(t) 
    for i in range(m - n + 1): 
        minRemovedChar = 0
        for j in range(n): 
            if (S1[j] != S2[i + j]): 
                minRemovedChar += 1
        ans = min(minRemovedChar, ans) 
    return ans 
s = list(input())
t = list(input())
print(minimumChar(t,s))

# s = list(input())
# t = list(input())
# ans,i = len(t),0
# while i < len(s):
#     res,k = 0,i
#     if i+len(t) >= len(s):
#         break
#     for j,cc in enumerate(t):
#         if s[k] != t[j]:
#             res += 1
#         k += 1
#     ans = min(ans,res)
#     i += 1
# print(ans)

Measured memory_bytes: 8908
#include <bits/stdc++.h>
#define INF 1000000000
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;

ll T[101];

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

int main(void){
	int N; cin >> N;
	for(int i = 0; i < N; i++) cin >> T[i];

	ll res = T[0];
	ll a;

	for(int i = 1; i < N; i++){
		a = gcd(res, T[i]);
		res = res / a * T[i];
	}

	cout << res << '\n';

	return 0;
}


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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define LOOP(i, N) for (int i = 1; i <= (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define RLOOP(i, N) for (int i =(int)N; i > 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define pb push_back

typedef long long ll;

typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
//cout<<"Yes"<<endl;
//cout<<"No"<<endl;

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  int x,y;
  cin>>x>>y;
  for(int i=0;i<=x;i++){
    int sum=i*2+(x-i)*4;
    if(sum==y){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3672