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

#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 ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... Args> void rd(Args&... args) {((cin >> args), ...);}
template<typename... Args> void write(Args... args) { ((cout << args << " "), ...); cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int ans=0;
    ll x;
    cin>>x;
    ll n=100;
    while(n<x){
        n=n*1.01;
        ans++;
    }
    cout<<ans;
    return 0;
}



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

const ll MX = 1e18;
const long double PI = acos(-1);

int main()
{
    string s,t; cin >> s >> t;
    int ans = 0;
    rep(i,s.length())
    {
        if(s[i] != t[i])
            ++ans;
    }
    pri(ans);
    return 0;
}


Measured memory_bytes: 3852
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1e9+7LL;

int main() {
    int A, B; cin >> A >> B;
    cout << A*B << endl;
}

Measured memory_bytes: 3636
#include <atcoder/all>
#include <cstdio>

using namespace std;
using namespace atcoder;

int main() {
  int n, q;
  cin >> n >> q;
  dsu d(n);
  for (int i = 0; i < q; i++) {
    int t, u, v;
    cin >> t >> u >> v;
    if (t == 0) {
      d.merge(u, v);
    } else {
      if (d.same(u, v)) {
        cout << 1 << endl;
      } else {
        cout << 0 << endl;
      }
    }
  }
  return 0;
}

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

def factrization(m):
    temp = m
    ans = 0
    for i in range(2, int(n**0.5) + 1):
        if temp % i == 0:
            cnt = 0
            e = 1
            while temp % i == 0:
                cnt += 1
                temp //= i
                if cnt == e:
                    e += 1
                    cnt = 0
                    ans += 1

    if temp != 1:
        ans += 1

    return ans

print(factrization(n))

Measured memory_bytes: 9388
package main

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

func isqrt(n int) int {
	if n < 0 {
		panic("isqrt argument must be nonnegative")
	}

	if n <= 1 {
		return n
	}

	ok := 0
	ng := 3037000500 // 3037000499 * 3037000499 < math.MaxInt64 < 3037000500 * 3037000500
	if n < ng {
		ng = n
	}
	for ng-ok > 1 {
		m := ok + (ng-ok)/2
		if m*m <= n {
			ok = m
		} else {
			ng = m
		}
	}
	return ok
}

func makeDivisorList(n int) []int {
	result := make([]int, 0)
	for i := 1; i <= isqrt(n); i++ {
		if n%i == 0 {
			result = append(result, i, n/i)
		}
	}
	return result
}

func calcMinOps(r []int, d int) int {
	i, j := 0, len(r)
	for i < j && r[i] == 0 {
		i++
	}
	i--
	a, b := 0, 0
	for j-i != 1 {
		if a <= b {
			i++
			a += r[i]
		} else {
			j--
			b += d - r[j]
		}
	}
	return a
}

func main() {
	defer flush()

	N := readInt()
	K := readInt()

	A := make([]int, N)
	c := 0
	for i := 0; i < N; i++ {
		A[i] = readInt()
		c += A[i]
	}
	r := make([]int, N)

	divisors := makeDivisorList(c)
	sort.Sort(sort.Reverse(sort.IntSlice(divisors)))
	for _, d := range divisors {
		for i := 0; i < N; i++ {
			r[i] = A[i] % d
		}
		sort.Ints(r)
		if calcMinOps(r, d) <= K {
			println(d)
			break
		}
	}
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}

var stdoutWriter = bufio.NewWriter(os.Stdout)

func flush() {
	stdoutWriter.Flush()
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdoutWriter, args...)
}


Measured memory_bytes: 1984
#include <iostream>

using namespace std;

int main()
{
    int a,b,cnt=1,ans[20010];
    char op;
    for (int i=1; ; i++)
    {
        cin>>a>>op>>b;
        if (op=='?') break;
        if (op=='+') ans[i]=a+b;
        if (op=='-') ans[i]=a-b;
        if (op=='*') ans[i]=a*b;
        if (op=='/') ans[i]=a/b;
        cnt++;
    }
    for (int i=1; i<cnt; i++) cout<<ans[i]<<'\n';
    return 0;
}



Measured memory_bytes: 3120
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def s_list(): return list(input())
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def num__grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]#NumberGrid
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def grid(n): return [s_list() for _ in range(n)]

n = i()
solve = (1 + (1 + 8 * n) ** 0.5) / 2
if int(solve) != solve:
    print("No")
else:
    print("Yes")
    k = int(solve)
    ansli = [[] for _ in range(k)]

    cnt = 1
    dec = 0
    i = 1
    while i <= n:
        if cnt <= k - 1 - dec:
            ansli[dec].append(i)
            cnt += 1
            i += 1
        else:
            cnt = 1
            dec += 1

    cnt = 1
    up = 1
    i = 1
    while i <= n:
        if cnt <= k - 1:
            ansli[cnt].append(i)
            cnt += 1
            i += 1
        else:
            up += 1
            cnt = up

    print(k)
    for i in range(k):
        print(len(ansli[i]), " ".join(map(str, ansli[i])))

Measured memory_bytes: 14664
#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
  int k,m,n,i;
  int flag=1;
  scanf("%d",&k);
  scanf("%d %d",&m,&n);
  for(i=m;i<=n;i++)
  {
      if(i%k==0)
      {
        flag=0;
        break;
      }
  }
  if(flag==0) printf("OK");
  if(flag==1) printf("NG");
}


Measured memory_bytes: 1736
N = int(input())
K = int(input())

def c(n,k):
	if k == 0:
		return 1
	elif k == 1:
		return n
	elif k == 2:
		return n*(n-1)//2
	else:
		return n*(n-1)*(n-2)//6
def f(N, K):
	if N == 0 and K > 0:
		return 0

	if K == 0:
		return 1
	digit = len(str(N))
	ret = 0
	if digit > K:
		ret += c(digit-1, K) * (9 ** K)
	a = 10**(digit-1)
	d = N // a
	ret += (d-1) * c(digit-1, K-1) * (9 ** (K-1))
	ret += f(N - d*a, K-1)

	return ret

print(f(N,K))

Measured memory_bytes: 3064
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (n, m, k) = (v[0], v[1], v[2]);
    let big_int = 1000_000_000 + 7;
    let fact7 = ModFactorial::new(n * m, big_int);
    let fact7 = fact7.fact;
    let inv_fact7 = (0..fact7.len())
        .map(|x| mod_inverse(fact7[x as usize], big_int))
        .collect::<Vec<_>>();
    let binom = ModBinominal::new(n * m - 2, big_int, &fact7, &inv_fact7).bin;

    let big_int = 1000_000_000 + 7;
    let mut coef = 0;
    for i in 1..n {
        coef += i * (n - i);
        coef %= big_int;
    }
    coef *= m;
    coef %= big_int;
    coef *= m;
    coef %= big_int;
    coef *= binom[(k - 2) as usize];
    coef %= big_int;

    let mut coef1 = 0;
    for i in 1..m {
        coef1 += i * (m - i);
        coef1 %= big_int;
    }
    coef1 *= n;
    coef1 %= big_int;
    coef1 *= n;
    coef1 %= big_int;
    coef1 *= binom[(k - 2) as usize];
    coef1 %= big_int;
    println!("{:?}", (coef + coef1) % big_int);
}

fn extgcd(a: i64, b: i64, x: &mut i64, y: &mut i64) -> i64 {
    let mut d = a;
    if b == 0 {
        *x = 1;
        *y = 0;
    } else {
        d = extgcd(b, a % b, y, x);
        *y -= (a / b) * (*x);
    }
    return d;
}

fn mod_inverse(a: i64, m: i64) -> i64 {
    let mut x: i64 = 0;
    let mut y: i64 = 0;
    extgcd(a, m, &mut x, &mut y);
    (m + x % m) % m
}

struct ModFactorial {
    fact: Vec<i64>,
}

// returns n! under mod m
impl ModFactorial {
    fn new(n: i64, m: i64) -> ModFactorial {
        let mut fact = vec![1; n as usize + 1];
        for i in 2..fact.len() {
            fact[i] = (i as i64 * fact[i - 1]) % m;
        }
        ModFactorial { fact: fact }
    }
}

// returns bin[i] = nCi under mod m
struct ModBinominal {
    bin: Vec<i64>,
}

impl ModBinominal {
    fn new(n: i64, m: i64, fact: &Vec<i64>, inv_fact: &Vec<i64>) -> ModBinominal {
        let mut bin = vec![1; n as usize + 1];
        if n == 0 {
            return ModBinominal { bin: bin };
        }
        for i in 1..n + 1 {
            let a2 = inv_fact[i as usize] % m;
            let a3 = inv_fact[(n - i) as usize] % m;
            bin[i as usize] = fact[n as usize] * ((a2 * a3) % m) % m;
        }
        ModBinominal { bin: bin }
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 10492
//#pragma GCC optimize(2)
// Happy TLE and WA every day!
// by: zxb the vegetable chicken
#include<bits/stdc++.h>
#define mp              make_pair
#define rep(i,n)        for(int i = 0; i < n; i++)
#define foreach(i,c)    for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define BINF            0x7fffffff
#define INF             0x3f3f3f3f
#define LINF            4557430888798830399
#define pb              push_back
#define F               first
#define S               second
#define Time            clock()/CLOCKS_PER_SEC
//#define usingFiles
using namespace std;

typedef unsigned int ui;
typedef pair<int, int> pii;
typedef long long ll;

inline bool Read(int& x){
	x = 0;
	int c;
	int sign = 1;
	while( (c = getchar()) < '0' || c > '9' ) if(c == '-') sign = -1;
	x = c ^ '0';
	while( (c = getchar()) >= '0' && c <= '9' ) x = (x<<3) + (x<<1) + (c ^ '0');
	x *= sign;
	return 1;
}

inline bool Write(int x){
	if(x >= 10) Write(x / 10);
	putchar(x % 10 + '0');
	return 1;
}

const int rp = 666666;
const bool debug = 1;
const bool I_good_vegetable_a = 1;

int n, k;
int a[110];
bool dp[100100];

signed main(){
	ios::sync_with_stdio(false);
	#ifdef usingFiles
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	memset(dp, 0, sizeof(dp));
	cin >> n >> k;
	rep(i, n){
		cin >> a[i];
		dp[a[i]] = 1;
	}
	rep(i, k + 1){
		for(int j = 0; j < n && a[j] < i; j++){
			if(!dp[i - a[j]]){
				dp[i] = 1;
				break;
			}
		}
	}
	if(dp[k]) cout << "First\n";
	else cout << "Second\n";
	return 0;
}

Measured memory_bytes: 384
while true
  n, p = gets.split(" ").map(&:to_i)
  s = p
  break if n == 0 && p == 0

  i = 0
  h = Hash.new(0)
  while true
    if p > 0
      p -= 1
      h[i] += 1
      if h[i] == s
        puts i
        break
      end
    else
      if h[i] > 0
        p = h[i]
        h[i] = 0
      end
    end
    i = (i == n-1) ? 0 : i+1
  end
end

Measured memory_bytes: 8736
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;
#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  
typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

ll mul_inv(ll a, ll b = MOD) {
	ll t1 = a, t2 = b, t3;
	ll v1 = 1, v2 = 0, v3;
	while (t2 != 1) {
		ll x = t1 / t2;
		t3 = t1 - x * t2;
		v3 = v1 - x * v2;
		t1 = t2, t2 = t3;
		v1 = v2, v2 = v3;
	}
	return (v2 + b) % b;
}
ll F[100050];
ll Finv[100050];
ll Co(int a, int b) {
	ll rv = F[a] * Finv[a - b] % MOD;
	return rv * Finv[b] % MOD;
}

ll in[100050];
int main() {
	int N, K, i, j;
	scanf("%d %d", &N, &K);

	F[0] = 1;
	for (i = 1; i <= N; i++) F[i] = F[i - 1] * i % MOD;
	for (i = 0; i <= N; i++) Finv[i] = mul_inv(F[i]);

	for (i = 1; i <= N; i++) scanf("%lld", &in[i]);
	sort(in + 1, in + N + 1);
	
	ll ans = 0;
	for (i = K; i <= N; i++) {
		ans = (ans + in[i] * Co(i - 1, K - 1)) % MOD;
		ans = (ans - in[N - i + 1] * Co(i - 1, K - 1)) % MOD;
	}
	return !printf("%lld\n", (ans + MOD) % MOD);
}

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

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

  ll H; cin >> H;
  ll n = 0;
  while (H >= 1) {
    H = H >> 1;
    n++;
  }
  ll ans = ((ll)1 << n) - 1;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var x, a, b int
	fmt.Scan(&x, &a, &b)
	if x + a - b < 0 {
		fmt.Println("dangerous")
	} else if a - b >= 0 {
		fmt.Println("delicious")
	} else {
		fmt.Println("safe")
	}
}

Measured memory_bytes: 512
//After remove a stone, to play optimal we need to move the piece to adjacent vertex which has less stones than current vertex.

#include <bits/stdc++.h>

using namespace std;

const int N = 3e3 + 5;

vector <int> g[N];
int n, a[N], ans[N];
bool visited[N];

void dfs (int u) {
    ans[u] = 0;
    visited[u] = true;

    for (int v: g[u]) {
        if (a[v] >= a[u]) continue;
        if (!visited[v]) dfs(v);
        if (ans[v]) ans[u] = 1; //if there exist an adjacent vertex have lose state then current vertex have win state. Change ans[u] = 1 then simply apply ans[u] = 1 - ans[u] after.
    }

    ans[u] = 1 - ans[u];
}

void input(){
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n - 1; i++) {
        int u, v;
        scanf("%d %d", &u, &v);
        g[u].push_back(v);
        g[v].push_back(u);
    }

    memset(visited, 0, sizeof(visited));
}

void solve(){
    for (int i = 1; i <= n; i++) if (!visited[i]) dfs(i);
    for (int i = 1; i <= n; i++) if (!ans[i]) printf("%d ", i);
}

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


Measured memory_bytes: 512
n = gets.to_i
rs = readlines.take(n).map(&:to_i)

_, max_profit = rs.drop(1).reduce([rs[0], -(10 ** 9)]) do |(min_r, max_profit), r|
  max_profit = [max_profit, r - min_r].max
  min_r = r if r < min_r
  [min_r, max_profit]
end

puts max_profit

Measured memory_bytes: 25672
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))
#define SORT(a,num,cmp) qsort((a),(num),sizeof(*(a)),cmp)

int cmp_int (const void *a, const void *b) {
  i32 d = *(i32 *)a - *(i32 *)b;
  return d == 0 ? 0 : d < 0 ? -1 : 1;
}

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i32 *d = ALLOC (n, i32);
  for (i32 i = 0; i < n; ++i) {
    scanf ("%" SCNi32, d + i);
  }
  SORT (d, n, cmp_int);
  i32 ans = d[n / 2] - d[n / 2 - 1];
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run();
  return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define mp make_pair
#define st first
#define nd second

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using pll = pair<ll, ll>;

void buff() { ios::sync_with_stdio( false ); cin.tie( nullptr ); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}
// End of template code!
int main() 
{
    buff();
    int k; string s;
    cin >> k >> s;
    bool p = (sz(s) > k); 
    while(sz(s) > k) s.pop_back();
    cout << s;
    if(p) cout << "...";
    cout << '\n';
    return 0;
}



Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
 
int binary(int);
int s[100000],n;

int main(){
  int t,q,count=0;
  cin>>n;
  for(int i=0;i<n;i++)cin>>s[i];
  cin>>q;
  for(int i=0;i<q;i++){
    cin>>t;
    if(binary(t)==1)count++;
  }
  cout<<count<<endl;
  return 0;
}
 
int binary(int key){
  int l=0,r=n,m;
  while(l<r){
    m=(l+r)/2;
    if(key==s[m])return 1;
    else if(key>s[m])l=m+1;
    else r=m;
  }
  return 0;
}



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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
std::string S;
std::set<P> s1;

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

  std::cin >> N >> S;

  for(auto &c : S){
      int n = c - '0';

      std::set<P> s2;

      s2.emplace(n, 1);

      for(auto &p : s1){
          int m, c;
          std::tie(m, c) = p;

          if(c < 3){
              s2.emplace(m * 10 + n, c + 1);
          }
      }

      s1.insert(s2.begin(), s2.end());
  }

  int res = 0;
  for(auto &p : s1){
      int c;
      std::tie(std::ignore, c) = p;

      if(c == 3){
          res += 1;
      }
  }

  std::cout << res << std::endl;
}


Measured memory_bytes: 384
def find_gcd(a, b):
    '''
    a >= b
    '''
    if a % b == 0:
        return b
    else:
        return find_gcd(b, a % b)


li = list(map(int, input().split()))

a = max(li)
b = min(li)

div = find_gcd(a, b)
print(div)



Measured memory_bytes: 5604
using System;

namespace AtCoder
{
  class Practice
  {
    static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');
        Array.Sort(input);
        int min = int.Parse(input[0]);
        int mid = int.Parse(input[1]);
        int max = int.Parse(input[2]);
        int b = max-mid;
        int c = mid-min;
        if(b == c){
            Console.WriteLine("0");
        }else{
            Console.WriteLine("{0}",Math.Abs(b+c));
        }
    }
  }
}

Measured memory_bytes: 13408
#include<stdio.h>
#include<stdlib.h>
     
int main(void){
	char a[40][101]={};
	int A,B,i,j;

	scanf("%d %d",&A,&B);
	A--;
	B--;

	for(i=0;i<20;i++){
		for(j=0;j<100;j++){
			a[i][j]='#';
		}
	}
	for(i=20;i<40;i++){
		for(j=0;j<100;j++){
			a[i][j]='.';
		}
	}
	i=0;
	j=0;
	while(A>0){
		a[i][j]='.';
		A--;
		j+=2;
		if(j==100){
			j=0;
			i+=2;
		}
	}
	i=39;
	j=0;
	while(B>0){
		a[i][j]='#';
		B--;
		j+=2;
		if(j==100){
			j=0;
			i-=2;
		}
	}

	printf("40 100\n");
	for(i=0;i<40;i++){
		printf("%s\n",a[i]);
	}

}


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

int main()
{
    int n;
    while(cin >> n,n!=1){
        int sat=0;
        vector<int> vsat;
        vsat.push_back(1);
        if(!(n%6)){
            vsat.push_back(6);
        }
        for(int m=1;sat<=n;m++){
            sat=7*m+1;
            if(!(n%sat)){
                for(int i=0;i<vsat.size();i++){
                    if(i!=0&&!(sat%vsat[i])) break;
                    if(i==vsat.size()-1) vsat.push_back(sat);
                }
            }
            sat=7*m+6;
            if(!(n%sat)){
                for(int i=0;i<vsat.size();i++){
                    if(i!=0&&!(sat%vsat[i])) break;
                    if(i==vsat.size()-1) vsat.push_back(sat);
                }
            }
        }
        
        cout<<n<<":";
        for(int i=1;i<vsat.size();i++){
         cout << " " << vsat[i];
        }
        cout << endl;
    }
}

Measured memory_bytes: 3004
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define last Last
const int N=1e5+10;
int n,Low[N];
struct node{
	int x,y;
};
vector<node>g;
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
#define gc getchar
inline int read()
{
	int ret=0,f=0;char c=gc();
	while(!isdigit(c)){if(c=='-')f=1;c=gc();}
	while(isdigit(c)){ret=ret*10+c-48;c=gc();}
	if(f)return -ret;return ret;
}
signed main()
{
	Low[0]=-1;
	for(int i=1;i<=100001;i++)Low[i]=Low[i/2]+1;
	n=read();
	if(n==1){puts("No");return 0;}
	if((1<<Low[n])==n){puts("No");return 0;}
	puts("Yes");
	int m=2;
	for(int i=m;i<n;i+=2)
	{
		g.push_back((node){1,i});
		g.push_back((node){i,i+1});
		g.push_back((node){1,n+i+1});
		g.push_back((node){n+i+1,n+i});
	}
	g.push_back((node){3,n+1});
	if(n%2==0)
	{
		g.push_back((node){n,(1<<Low[n])});
		g.push_back((node){(n+n-(1<<Low[n]))^1,n+n});
	}
	for(int i=0;i<g.size();i++)printf("%d %d\n",g[i].x,g[i].y);
	return 0;
}

Measured memory_bytes: 4464
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

struct Edge
{
    int to;
    int cost;
};
vector<Edge> edges[2'500];
int64_t dist[2'500];

const int64_t INF = 1'000'000'000;

int main()
{
    int n, m, p;
    cin >> n >> m >> p;
    for (int i = 0; i < m; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        Edge e;
        e.to = b;
        e.cost = -(c - p);
        edges[a].push_back(e);
    }

    for (int i = 0; i < n; i++)
    {
        dist[i] = INF;
    }
    dist[0] = 0;

    for (int i = 0; i < n - 1; i++)
    {
        for (int j = 0; j < n; j++)
        {
            for (const auto &e : edges[j])
            {
                dist[e.to] = min(dist[e.to], dist[j] + (int64_t)e.cost);
            }
        }
    }

    int64_t cand = dist[n - 1];
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            for (const auto &e : edges[j])
            {
                dist[e.to] = min(dist[e.to], dist[j] + (int64_t)e.cost);
            }
        }
    }

    if (cand > dist[n - 1])
    {
        cout << -1 << endl;
        return 0;
    }

    cout << max(0L, -cand) << endl;

    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

void solve(long long N, std::vector<long long> A){
    ll ans = 0;
    REP(i, N-1){
        if(A[i+1]>= A[i]) continue;
        ll tmp = A[i] - A[i+1];
        ans += tmp;
        A[i+1] += tmp;
    }
    cout<<ans<<endl;
}
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4468
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
int n;
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
    cin>>n;
    cout<<n/3;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
def prime_factorize(num): # 整数に対し素因数分解
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor

n = int(input())
data = prime_factorize(n)
ans = 0
for i in data:
    x = data[i]
    j = 1
    while j <= x:
        x -= j
        j += 1
        ans += 1
print(ans)

Measured memory_bytes: 63196
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};

#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)

#define mp make_pair
#define fi first
#define se second

#define bit(n) (1LL<<(n))

void Main()
{
  string s,t;
  cin >> s >> t;

  vector<vector<i64>> dp(s.size(),vector<i64>(26,-1));
  string ss = s+s;
  rep(i,26){
    i64 nxt = -1;
    rrep(ii,ss.size()-1,-1){
      if(ii<nxt) dp[ii%s.size()][i] = nxt-ii;
      if(ss[ii]-'a'==i) nxt = ii;
    }
  }
  
  vector<i64> start(26,-1);
  rep(i,26){
    rep(ii,s.size()){
      if(s[ii]-'a'==i){
        start[i] = ii;
        break;
      }
    }
  }

  if(start[t[0]-'a'] == -1){
    cout << -1 << endl;
    return;
  }

  i64 ans = 1 + start[t[0]-'a'];
  i64 cur = start[t[0]-'a'];

  rep(i,1,t.size()){
    if(dp[cur][t[i]-'a']==-1){
      cout << -1 << endl;
      return;
    }
    ans += dp[cur][t[i]-'a'];
    cur += dp[cur][t[i]-'a'];
    cur %= s.size();
  }

  cout << ans << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}


Measured memory_bytes: 24912
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
typedef long long LL;
#define ms(a,b) memset(a,b,sizeof(a))
# define eps 1e-8

double spd=0.0;
double ans=0.0;
double t[105],v[105];
double ev[105];

int main()
{
    int N;
    cin>>N;
    int n=sqrt(N);
    cout<<n*n;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
int main(){
	int N;
	int A[114514]={};
	int in;
	int ca=0;
	int ans=0;
	cin >> N;
	REP(i,N){
	    cin >> A[i];
	}
	sort(A,A+N);
	in=0;
	REP(i,N){
	    if(A[i]==in){
	        ca++;
	    }else{
	        ans+=(ca%2);
	        ca=1;
	    }
	    in = A[i];
	    //cout << ans << endl;
	}
	cout << ans+(ca%2) << endl;
	return 0;
}

Measured memory_bytes: 640
import sys
sys.setrecursionlimit(100000)
nnn = int(input())

a = [-2 for i in range(nnn)]
a[0] = 0

def m():
	return map(int,input().split())


def oon(x,n,nn,k):
	global a
	for i in range(len(x[n])):
		if x[n][i][0] != nn and a[nn] != -2:
			p = (k + x[n][i][1]) % 2
			if p == 0:
				a[x[n][i][0]] = 0
			else:
				a[x[n][i][0]] = 1
			oon(x,x[n][i][0],n,p)



b = [[] for i in range(nnn)]

for i in range(nnn-1):
	z,x,c = m();
	b[z-1].append([x-1,c])
	b[x-1].append([z-1,c])

oon(b,0,0,0)

for i in range(nnn):
	print(a[i])


Measured memory_bytes: 84828
using System;

namespace AtCoderBeginnerContest148
{
	class Program
	{
		static void Main(string[] args)
		{
			var number = int.Parse(Console.ReadLine());
			var strings = Console.ReadLine().Split(' ');
			for(var i = 0;i < number; i++)
			{
				Console.Write(strings[0][i]);
				Console.Write(strings[1][i]);
			}
		}
	}
}


Measured memory_bytes: 13140
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define nn '\n'
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n';
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    double ans = 0;
    REP(i,n){
        double a; cin >> a;
        ans += 1.0/a;
    }
    out(1.0/ans);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << endl;
#else
#define DBG(X)
#define endl '\n'
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const ll mod = 1e9 + 7;
const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }

const int MAX_V = (int)1e5 + 77;

vector<int> g[MAX_V];
int n, m, d[MAX_V];
bool met[MAX_V];
set<pii> dir_edges;

inline void invert(int v, int u)
{
	//cout << "inverting " << v + 1 << " -- " << u + 1 << endl;

	pii ed1 = {v, u}, ed2 = {u, v};

	if(dir_edges.count(ed1))
	{
		dir_edges.erase(ed1);
		dir_edges.insert(ed2);

		//--d[ed1.first];
		//++d[ed2.first];
	}
	else
	{
		dir_edges.erase(ed2);
		dir_edges.insert(ed1);

		//--d[ed2.first];
		//++d[ed1.first];
	}
}

int dfs(int v)
{
	met[v] = true;
	int cnt = 0;

	for(auto& u: g[v])
	{
		if(met[u])
			continue;

		int subtree = dfs(u);

		if(subtree & 1)
			invert(v, u);

		cnt += subtree;
	}

	return cnt + (d[v] & 1);
}

void solve()
{
	cin >> n >> m;

	for(int i = 0; i < m; ++i)
	{
		int v, u;
		cin >> v >> u;
		--v, --u;

		dir_edges.emplace(v, u);
		++d[v];

		g[v].push_back(u);
		g[u].push_back(v);
	}

	if(m & 1)
	{
		cout << NIL << endl;
		return;
	}

	dfs(0);

	for(auto& ed: dir_edges)
		cout << ed.first + 1 << " " << ed.second + 1 << endl;
}

int main()
{
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 21376
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

 
struct Unionfind{
    vector<int> parents;
    int n;
    Unionfind(int n):n(n),parents(n,-1){ }

    int find(int x){
        if(parents[x] < 0) return x;
        else return parents[x] = find(parents[x]);
    }

    void unite(int x,int y){
        x = find(x);
        y = find(y);

        if(x==y) return;
        if(parents[x] > parents[y]) swap(x,y);
        parents[x] += parents[y];
        parents[y] = x;
    }  

   int size(int x){
       return -parents[find(x)];
   }

   bool same(int x,int y){
       return find(x)==find(y);
   }

   vector<int> members(int x){
       int root = find(x);
       vector<int> member;
       for(int i=0;i<n;i++){
           if(find(i)==root ){
               member.push_back(i);
           }
       }
      return member;
  }

  int group_cnt(){
      int c = 0;
      rep(i,n){
          if(parents[i] < 0) ++c;
      }
      return c;
  }
};

int main(){
    int n,m;
    cin >> n >> m;
    Unionfind uf(n);
    vector<vector<int>> L(m,vector<int>());
    rep(i,n){
        int k;
        cin >> k;
        rep(j,k){
            int p;
            cin >> p;
            --p;
            L[p].push_back(i);
        }
    }
    rep(i,m){
        rep(j,L[i].size()-1){
            uf.unite(L[i][j],L[i][j+1]);
        }
    }
    if(uf.group_cnt()==1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 7392
#include <stdio.h>

int H[500001],n;
void maxHeapify(int);
int main(){
  int i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&H[i]);
  }

  for(i = n/2;i >= 1; i--){
    maxHeapify(i);
  }
  
  for(i=1;i<=n;i++){
    printf(" %d",H[i]);
  }
  printf("\n");
  return 0;
}

void maxHeapify(int i){
  int l,r,hand,largest;
  l = i*2;
  r = i*2+1;
  if((l <= n) && (H[l] > H[i])){
    largest = l;
  }else{
    largest = i;
  }
    if((r <= n) && (H[r] > H[largest])){
    largest = r;
  }

  if(largest != i){
    hand = H[i];
    H[i] = H[largest];
    H[largest] = hand;
    
    maxHeapify(largest);
  }
}



Measured memory_bytes: 3636
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> k;
  cin >> a >> b;
  rrep(i, a, b + 1) {
    if (i % k == 0) {
      Cout("OK");
      return 0;
    }
  }
  Cout("NG");
  return 0;
}

Measured memory_bytes: 3652
N = int(input())
A = list(map(int, input().split()))

ans = abs(A[0])
for i in range(N - 1):
    ans += abs(A[i] - A[i + 1])
ans += abs(A[N - 1])

print(ans - abs(A[0]) - abs(A[0] - A[1]) + abs(A[1]))

for i in range(1, N - 1):
    print(ans - abs(A[i - 1] - A[i]) - abs(A[i] - A[i + 1]) + abs(A[i - 1] - A[i + 1]))

print(ans - abs(A[N - 1]) - abs(A[N - 1] - A[N - 2]) + abs(A[N - 2]))


Measured memory_bytes: 14048
#include <bits/stdc++.h>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main(){
  int D;
  ll G;
  cin >> D >> G;
  int p[D], c[D];
  rep(i,  D){cin >> p[i] >> c[i];}
  int a[D];
  rep(i, D){a[i] = i;}
  ll ans = pow(10, 6);
  do{
    ll G_temp = G;
    ll ans_temp = 0;
    rep(i,D){
      if (G_temp < p[a[i]]*(a[i]+1)*100){
        ans_temp += (G_temp+(a[i]+1)*100-1)/((a[i]+1)*100);
        break;
      }else{
        G_temp -=  (p[a[i]]*(a[i]+1)*100+c[a[i]]);
        if (G_temp<=0){
          ans_temp += p[a[i]];
          break;
        }
        else{ans_temp += p[a[i]];}
      }
    }
    ans = min(ans, ans_temp);
  }while(next_permutation(a, a+D));
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<queue>
#include<bitset>

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)

using namespace std;

typedef long long int lli;
typedef vector<int> vi;

int main() {
	string s;
	lli i, j, k, n, l, m, bc, wc;

	cin >> s;

	k = s.length();
	
	m = 0;
	j = 0;
	rep(i, k) {
		if (s[i] == 'W') {
			m += i - j;
			j++;
		}
	}

	cout << m;

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
string s, t;
int n, m;
long long dp[3005][3005];
int main(){
  cin >> s >> t;
  n = s.size();
  m = t.size();
  for(int i=0; i<n; i++){
    for(int j=0; j<m; j++){
      if(s[i]==t[j]) dp[i+1][j+1] = max({dp[i][j]+1, dp[i+1][j], dp[i][j+1]});
      else dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
    }
  }
  n--;
  m--;
  stack<char> st;
  st.push('\n');
  while(n>=0 && m>=0){
    if(s[n]==t[m]){
      st.push(s[n]);
      n--;
      m--;
    }
    else if(dp[n][m+1]==dp[n+1][m+1]) n--;
    else m--;
  }
  while(!st.empty()){cout << st.top(); st.pop();}
}

Measured memory_bytes: 74048
package main

import (
	"fmt"
)

func main() {
	var a, b, x int
	fmt.Scan(&a, &b, &x)
	switch {
	case a == 0:
		fmt.Println((b / x) + 1)
	default:
		fmt.Println((b / x) - ((a - 1) / x))
	}
}


Measured memory_bytes: 512
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] num = new int[N + 1];
		for(int i = 1;i <= N;i ++) {
			num[i] = 0;
			int x = i;
			for(int k = 0;;k ++) {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			}
		}
		int maxidx = 1,max = num[1];
		for(int i = 2;i < N + 1;i ++) {
			if(max < num[i]) {
				maxidx = i;
				max = num[i];
			}
		}
		System.out.println(maxidx);
	}
}

Measured memory_bytes: 21972
#include <bits/stdc++.h> 
#define rep(i, n) for(int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> h(n);
  cin>>h[0];
  rep(i,n){cin>>h[i];}
  int k=1;
  rep(i,n){vector<int> d(n);
    for(int j=0;j<=i;j++){
      d[j]=h[j];}
           sort(all(d));
           if(d[n-1]==h[i]){k++;}}
  cout<<k<<endl;
}

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

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

    int L = 0, R = 0;
    for(int i = 0; i < N; i++){
        if(S[i] == 'E')
            R++;
    }
    if(S[0] == 'E')
        R--;
    int ans = R;
    for(int i = 1; i < N; i++){
        if(S[i - 1] == 'W')
            L++;
        if(S[i] == 'E')
            R--;
        int cnt = L + R;
        ans = min(ans, cnt);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 900
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>

using namespace std;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; 
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()

#define equal equalll
#define less lesss
const int N = 111;
const long long INF = 1e9 + 19;
typedef long long ll;

int n;
int a[N];

void read() {
    if (scanf("%d", &n) != 1) exit(0);
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);
}

void solve() {
    sort(a, a + n);
    int mx = a[n - 1];
    map<int,int> q;
    for (int i = 0; i < n; i++)
        q[a[i]]++;
    int mn;
    if (mx % 2 == 1) {
        mn = (mx + 1) / 2;
        for (int i = mn; i <= mx; i++)
            q[i] -= 2;
    } 
    else {
        mn = mx / 2;
        q[mn]--;
        for (int i = mn + 1; i <= mx; i++)
            q[i] -= 2;
    }
    bool fail = 0;
    for (auto x: q)
        if (x.sc != 0) {
            if (!(mn < x.fr && x.fr <= mx))
                fail = 1;
            if (x.sc < 0)
                fail = 1;
        }
     
    if (!fail)
        puts("Possible");
    else
        puts("Impossible");

}

void stress() {

}

int main(){
#ifdef MY_DEBUG
    freopen("in", "r", stdin);
    //freopen("out", "w", stdout);
#endif
    if (1) {
        for (int tt = 0; ; tt++) {
            read();
            solve();
        }
    }
    else {
        stress();
    }

    return 0;
}


Measured memory_bytes: 384