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

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define all(x) x.begin(),x.end()


const int INF=INT_MAX;
const ld PI=3.1415926535897932384626433;
const ld E=2.71828183;
const int MOD=1e9+7;

vi bfs(vector<vi>adj,int src){
    //adjacency list, not-weighted, possibly directed ,src is 1-indexed, adj[0].size()=0!!!
    //for n vertices, adj.size()=n+1. (constructed via push_back() ).

    queue<int>q;
    q.push(src);
    vi dst(adj.size(),INF);
    dst[src]=0;
    while(!q.empty()){
        int c=q.front();
        q.pop();
        for(int nbr:adj[c]){
            if(dst[nbr]==INF){
                dst[nbr]=dst[c]+1;
                q.push(nbr);
            }
        }
    }
    return dst;
}
vi bfsParents(vector<vi>adj,int src){
    vi parents=vi(adj.size(),INF);
    parents[src]=-1;
    queue<int>q;
    q.push(src);
    vi dst(adj.size(),INF);
    dst[src]=0;
    while(!q.empty()){
        int c=q.front();
        q.pop();
        for(int nbr:adj[c]){
            if(dst[nbr]==INF){
                parents[nbr]=c;
                dst[nbr]=dst[c]+1;
                q.push(nbr);
            }
        }
    }
    return parents;
}
vi shortestPath(vector<vi>adj,int src,int dst){
    vi bfsParetns=bfsParents(adj,src);
    vi ans;
    while(src!=dst){
        if(bfsParetns[src]==INF)
            return {};
        ans.push_back(src);
        src=bfsParetns[src];
    }
    return ans;
}
int powMod(int base,int exp,int mod){
    //(base^exp) %mod
    int ans=1;
    for(int i=0; i<exp; i++)
        ans=((ans%mod)*(base%mod))%mod;
    return ans;
}
vi divisorsOf(int n){
    //vector of divisors of n (inc. 1 , excl.n)
    vi ans;
    for(int i=1; i*i<=n; i++){
        if(n%i==0)
            ans.push_back(i);
        if(i*i!=n && i!=1)
            ans.push_back(n/i);
    }
    return ans;
}
int gcd(int a,int b){
    if(a%b==0)
        return b;
    else
        return gcd(b,a%b);
}

ld log (ld a,ld b){return log(b)/log(a);}
void solve();
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
  //  cin >> t;
    while(t--)
        solve();
    return 0;
}

void solve () {
    for(int i=0; i<5; i++){
        int x;
        cin >> x;
        if(x==0)
            cout << i+1 << "\n";
    }
}

Measured memory_bytes: 3564
import java.util.*;

class Main {
    class BinaryHeap {
        private long[] heap;
        private int size;

        public BinaryHeap(int capacity) {
            this.heap = new long[capacity];
            this.size = 0;
        }

        public void insert(long key) {
            this.heap[this.size] = key;
            this.size++;
        }

        public void dumpKeys() {
            for (int i = 0; i < this.size; i++) {
                System.out.printf(" %d", this.heap[i]);
            }
            System.out.print("\n");
        }

        public void buildMaxHeap() {
            for (int i = this.size / 2; i >= 0; i--) {
                this.maxHeapify(i);
            }
        }

        private void maxHeapify(int i) {
            int largest = i;

            int l = this.leftIndexOf(i);
            if (l < this.size && this.heap[l] > this.heap[largest]) {
                largest = l;
            }

            int r = this.rightIndexOf(i);
            if (r < this.size && this.heap[r] > this.heap[largest]) {
                largest = r;
            }

            if (largest != i) {
                long tmp = this.heap[i];
                this.heap[i] = this.heap[largest];
                this.heap[largest] = tmp;
                this.maxHeapify(largest);
            }
        }

        private int parentIndexOf(int i) {
            return ((i + 1) / 2) - 1;
        }

        public int leftIndexOf(int i) {
            return ((i + 1) * 2) - 1;
        }

        public int rightIndexOf(int i) {
            return (i + 1) * 2;
        }
    }
    public static void main(String[] args) {
        new Main().main();
    }

    public void main() {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        String[] line = scanner.nextLine().split(" ", n);

        BinaryHeap heap = new BinaryHeap(n);
        for (int i = 0; i < n; i++) {
            long key = Long.parseLong(line[i]);
            heap.insert(key);
        }

        heap.buildMaxHeap();
        heap.dumpKeys();
    }
}



Measured memory_bytes: 247260
import heapq
n=int(input())
a=list(map(int, input().split()))
l=[]
for i in range(-100,101):
    s=0
    for j in range(n):
        s+=(a[j]-i)**2
    heapq.heappush(l,s)
s=heapq.heappop(l)
print(s)

Measured memory_bytes: 39408
#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 long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int a,b,c,d;
    cin>>a>>b>>c>>d;

    if(d-b==1)cout << 0 << endl;
    else cout << 1 << endl;








}


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

using namespace std;

int main() {
    int N, K, Q;
    cin >> N >> K >> Q;
    
    vector<int> points(N, 0);
    
    for (int idx = 0; idx < Q; idx++) {
        int tmp;
        cin >> tmp;
        points[tmp - 1] += 1;
    }
    
    for (int idx = 0; idx < points.size(); idx++) {
        int calced = K + (points[idx] - Q);
        if (calced > 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 1024
import java.util.Scanner;

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

        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        long sum = 0;
        long[] a = new long[n];

        for(int i = 0; i < n; i++){
            a[i] = s.nextInt();
        }

        long min = a[0];
        long max = a[0];
        for(long val : a) {
            min = Math.min(min, val);
            max = Math.max(max ,val);
        }
        for(int i = 0; i < n; i++ ){
            sum += a[i];
        }
        System.out.println(min + " " + max + " " + sum);
    }
}



Measured memory_bytes: 42152
//snukeさんまるこぴ
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n; ll k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  vector<int> s;
  vector<int> ord(n+1,-1);
  int c = 1, l = 0;
  {
    int v = 1;
    while (ord[v] == -1) {
      ord[v] = s.size();
      s.push_back(v);
      v = a[v-1];
    }
    c = s.size() - ord[v];
    l = ord[v];
  }

  if (k < l) cout << s[k] << endl;
  else {
    k -= l;
    k %= c;
    cout << s[l+k] << endl;
  }
  return 0;
}


Measured memory_bytes: 5888
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
int n,m,x,a,ans;
bool b[100010];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>x;
		while(x--){
			cin>>a;
			b[a]=1;
		}
	}
	for(int i=1;i<=n;i++)if(b[i]==0)ans++;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3660
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> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let size: Vec<usize> = read_vec::<usize>();
    let mut hw: Vec<Vec<char>> = Vec::with_capacity(size[0]);
    for _i in 0..size[0] {
        let s = read::<String>();
        hw.push(s.chars().collect::<Vec<char>>());
    }
    let count = process(hw, size[0], size[1]);
    println!("{}", count);
}

type Masu = (usize, usize);

fn process(mut hw: Vec<Vec<char>>, h: usize, w: usize) -> u32 {
    let mut count: u32 = 0;
    let mut num_of_b: usize = 0;

    // Get b0
    let mut b0: Vec<Masu> = Vec::new();
    for i in 0..h {
        for j in 0..w {
            if hw[i][j] == '#' {
                b0.push((i, j));
            }
        }
    }
    num_of_b += b0.len();
    if num_of_b == h * w {
        return count;
    }

    // Iteration
    let mut b1: Vec<Masu> = Vec::new();
    loop {
        for m in b0 {
            let tansaku: Vec<(i32, i32)> = vec![(-1, 0), (0, -1), (0, 1), (1, 0)];
            for t in tansaku {
                let x: i32 = (m.0 as i32) + t.0;
                let y: i32 = (m.1 as i32) + t.1;
                if x < 0 || y < 0 || x >= (h as i32) || y >= (w as i32) {
                    continue;
                }
                let x: usize = x as usize;
                let y: usize = y as usize;
                if hw[x][y] == '.' {
                    hw[x][y] = '#';
                    b1.push((x, y));
                }
            }
        }
        num_of_b += b1.len();
        count += 1;
        if num_of_b == h * w {
            return count;
        }

        b0 = b1;
        b1 = Vec::new();
    }
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



i64 n;
void solve(){
	cin >> n;
	
	for(i64 i = 1; i <= 1000; i++){
		for(i64 j = -1000; j <= 1000; j++){
			if(n == i*i*i*i*i-j*j*j*j*j){
				cout << i << " " << j << endl;
				return;
			}
		}
	}
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3648
from heapq import heappush, heappop, heapreplace

INF = 10 ** 9 + 5

N, K, *TD = map(int, open(0).read().split())

E = [[] for _ in range(N)]
for t, d in zip(*[iter(TD)] * 2):
    E[t - 1].append(d)

for e in E:
    if e:
        e.sort(reverse=True)
    else:
        e.append(-INF)
E.sort(key=lambda x: -x[0])

cur = 0
Q = []
for ei in E[:K]:
    cur += ei[0]
    for eij in ei[1:]:
        heappush(Q, -eij)

for ei in E[K:]:
    for eij in ei:
        heappush(Q, -eij)

res = cur + K * K
for x in reversed(range(1, K)):
    v, w = E[x][0], -Q[0]
    if v < w:
        heappop(Q)
        cur += w
        heappush(Q, -v)
        cur -= v

    res = max(res, cur + x * x)

print(res)


Measured memory_bytes: 32964
use std::cmp;

use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let w = read::<u32>();
  let h = read::<u32>();
  let x = read::<u32>();
  let y = read::<u32>();

  let way = if x * 2 == w && y * 2 == h { '1' } else { '0' };
  println!("{} {}", (w as f64 * h as f64) / 2.0, way);
}

Measured memory_bytes: 4352
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: usize,
        a: [usize; n],
    }
    let mut cnt = [0; 3];
    for a in a {
        cnt[a - 1] += 1;
    }
    let mut dp = vec![vec![vec![0.0; cnt[0] + cnt[1] + cnt[2] + 1]; cnt[1] + cnt[2] + 1]; cnt[2] + 1];
    let p = 1.0 / (n as f64);
    for i in 0..(cnt[2] + 1) {
        for j in 0..(cnt[1] + cnt[2] - i + 1) {
            for k in 0..(cnt[0] + cnt[1] + cnt[2] - i - j + 1) {
                if i == 0 && j == 0 && k == 0 {
                    continue;
                }
                let mut sum = 1.0;
                if i > 0 {
                    sum += (i as f64) * p * dp[i - 1][j + 1][k];
                }
                if j > 0 {
                    sum += (j as f64) * p * dp[i][j - 1][k + 1];
                }
                if k > 0 {
                    sum += (k as f64) * p * dp[i][j][k - 1];
                }
                dp[i][j][k] = sum / (((i + j + k) as f64) * p);
            }
        }
    }
    let ans = dp[cnt[2]][cnt[1]][cnt[0]];
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 237820
import java.util.Comparator;
import java.util.Scanner;

/* static int java.util.Arrays.binarySearch(int[] a, int key); */


public class Main {
    Scanner sc = new Scanner(System.in);
    int n, k;
    public void run(){
        n = sc.nextInt();
        k = sc.nextInt();
        solve();
    }
    public void solve(){
        int i = 0;
        int ans = 0;

        while(i < n){
            int flag = 0;
            ans++;
            for(int j = 0; j < k-1; j++){
                if(i < n) {
                    int a = sc.nextInt();
                    i++;

                    if (a == 1) {
                        flag = 1;
                    }
                }
                else{
                    break;
                }
            }
            if(flag == 1 && i < n){
                sc.nextInt();
                i++;
            }
        }
        System.out.println(ans);
    }

    public static void main(String[] args){
        new Main().run();
    }

    static class Pair {
        int first,second;
        public Pair(int a,int b) {
            this.first = a;
            this.second = b;
        }
    }
    static class Edge{
        int to, cost;
        public Edge(int a, int b){
            this.to = a;
            this.cost = b;
        }
    }
    class MyComparator implements Comparator {
        @Override
        public int compare (Object arg0, Object arg1) {
            int x = ((Pair)arg0).first;
            int y = ((Pair)arg1).first;

            if (x < y) {
                return 1;
            } else if (x > y) {
                return -1;
            } else{
                return 0;
            }
        }
    }
    static class UnionFind{
        int par[];
        int rank[];

        //n要素で初期化
        public UnionFind(int maxn){
            par = new int[maxn];
            rank = new int[maxn];

            for(int i = 0; i < maxn; i++){
                par[i] = i;
                rank[i] = 0;
            }
        }

        //木の根を求める
        int find(int x){
            if(par[x] == x){
                return x;
            }
            else {
                return par[x] = find(par[x]);
            }
        }

        // xとyの属する集合を併合
        void unite (int x, int y){
            x = find(x);
            y = find(y);
            if(x == y){
                return;
            }

            if(rank[x] < rank[y]){
                par[x] = y;
            }
            else{
                par[y] = x;
                if(rank[x] == rank[y]) rank[x]++;
            }
        }

        // xとyが同じ集合に属するか否か
        boolean same(int x, int y){
            return find(x) == find(y);
        }
    }

}

Measured memory_bytes: 47012
import itertools
n = int(input())
ps = tuple(map(int, input().split()))
qs = tuple(map(int, input().split()))

perm = list(sorted(itertools.permutations(range(1, n + 1))))
for i in range(len(perm)):
    p = perm[i]
    if p == ps:
        a = i
    if p == qs:
        b = i

print(abs(a - b))


Measured memory_bytes: 45424
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int N; cin >> N;
    string S; cin >> S;
    int ans = 0;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            for (int k = 0; k < 10; k++) {
                int cnt = 0;
                for (int l = 0; l < N; l++) {
                    if (cnt == 2 && S[l] == '0' + k) { cnt++; break; }
                    if (cnt == 1 && S[l] == '0' + j) cnt++;
                    if (cnt == 0 && S[l] == '0' + i) cnt++;
                }
                if (cnt == 3) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
array = list(map(int, input().split()))
count = 0

for i in range(n):
    flag = 0
    minj = i
    for j in range(i, n):
        if array[j] < array[minj]:
            flag = 1
            minj = j

    if flag == 1:
        count += 1
    array[minj], array[i] = array[i], array[minj]


print(*array)
print(count)



Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;

// int main() {
//     ll n; cin >> n;
//     vector<ll> a(n);
//     rep(i, n) cin >> a[i];
//     sort(all(a));
//     if(a[0] == 0) {
//         cout << 0 << endl;
//         return 0;
//     }
//     ll ans = 1;
//     rep(i, n) {
//         if((ll)pow(10, 18) / ans < a[i]) {
//             cout << -1 << endl;
//             return 0;
//         }
//         ans *= a[i];
//     }
//     cout << ans << endl;
// }



int main() {
    int n; cin >> n;
    vector<ll> a(n); rep(i, n) cin >> a[i];
    sort(all(a));
    if(a[0] == 0) {
        cout << 0 << endl;
        return 0;
    }
    ll now = 1;
    rep(i, n) {
        if((ll)pow(10, 18) / a[i] < now) {
            cout << -1 << endl;
            return 0;
        }
        now *= a[i];
    }
    cout << now << endl;
}

Measured memory_bytes: 4064
#include <stdio.h>
#define P(s) printf(s "\n");

int main(void) {
	int m, f, r, sum;
	
	while (1) {
		scanf("%d %d %d", &m, &f, &r);
		if (m + f + r == -3) {
			break;
		}
		sum = m + f;
		if ((m == -1)|(f == -1)|(sum < 30)) {
			P("F");
		} else if (sum >= 80) {
			P("A")
		} else if (sum >= 65) {
			P("B")
		} else if ((sum >= 50)|(r >= 50)) {
			P("C")
		} else {
			P("D")
		}
	}

	return 0;
}

Measured memory_bytes: 584
N = int(input())
S = list(input())

change = S[1:].count('E')
min_ = change

for i in range(1, N):
    if S[i-1] == 'W':
        change += 1
    if S[i] == 'E':
        change -= 1
    if change < min_:
        min_ = change
print(min_)
        
    



Measured memory_bytes: 8140
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define oo 666666666

ll F[2000001];
ll invF[2000001];
ll M = 1e9+7;

ll powm(ll a, ll n, ll M)
{
    if(n==0)return 1;
    if(n&1)return a*powm(a,n-1,M)%M;
    return powm(a*a%M,n/2,M);
}

ll inv(ll x)
{
    if(invF[x]!=0)return invF[x];
    return invF[x]=powm(F[x],M-2,M);
}

ll C(int n, int k)
{
    if(k>n)return 0;
    return ((F[n]*inv(k)%M)*inv(n-k))%M;
}

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    F[0]=invF[0]=1;
    for(int i=1; i<=2000000; i++)
        F[i]=(F[i-1]*i)%M;//,invF[i]=powm(F[i],M-2,M);

    int H,W,m;
    cin>>H>>W>>m;
    vector<array<int,2>>A(m);
    for(auto&a:A)
        cin>>a[0]>>a[1];

    sort(A.begin(),A.end());
    ll ats = C(H+W-2,W-1);
    vector<ll>ways(m); //ways to reach blocked cell [i][j],
    //without visiting any blocked cell [i][j] thats before this one

    for(int i=0; i<m; i++)
    {
        ll x = A[i][0];
        ll y = A[i][1];

        ways[i] = C(x+y-2,x-1);
        for(int j=0; j<i; j++)
        {
            ll x2 = A[j][0];
            ll y2 = A[j][1];
            if(y2 > y)continue;
            ways[i] -= ways[j]*C((x-x2)+(y-y2),(x-x2));//number of paths that are already counted
            ways[i]%=M;
            if(ways[i] < 0)ways[i]+=M;
        }
        ats = (ats - ways[i]*C(H-x+W-y,H-x))%M;
        if(ats<0)ats+=M;
    }

    cout<<ats;
}


Measured memory_bytes: 18048
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back 
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define ld long double
#define F first 
#define S second
#define int long long int
signed main() 
{ 
    fast;
    int n;
    cin>>n;
    if(n%2 == 1)
    {
        cout<<0;
        return 0;
    }
    int ans = 0;
    while(n)
    {
        ans+=(n/10);
        n = n/5;
    }
    cout<<ans;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define reg register
#define maxn 200005
inline ll read()
{
	reg ll x=0,w=0;reg char ch=getchar();
	while(!isdigit(ch))w|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w?-x:x;
}
int n;
ll a[maxn],k;
inline ll tran(ll x,ll y)
{
	if(x<0)
	{
		x=-x,y=-y;
		return (x-1)/y+1;
	}
	return x/y;
}
inline ll calc(ll x)
{
	reg int i;reg ll res=0,tmp;
	for(i=1;i<n;++i)
	{
		if(a[i]<0)
		{
			tmp=a+1+n-lower_bound(a+i+1,a+1+n,tran(x,a[i]));
			res+=tmp;
		}
		else if(a[i]>0)
		{
			tmp=upper_bound(a+i+1,a+1+n,x/a[i])-a-i-1;
			res+=tmp;
		}
		else 
		{
			if(x>=0)res+=n-i;
		}
	}
	return res;
}
int main()
{
	n=read();k=read();reg int i;
	for(i=1;i<=n;++i)a[i]=read();
	sort(a+1,a+1+n);
	reg ll mid,l=-1e18,r=1e18;--l; 
	while(l<r-1)
	{
		mid=(l+r)>>1;
		if(calc(mid)>=k)r=mid;
		else l=mid;
	}
	printf("%lld\n",r);
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <bitset>
#include <iomanip>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

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

    for (int i = 0; i < 3; i++) {
        if (s[i] != t[2-i]) {
            cout << "NO" << endl;
            return (0);
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int K;
long long ans;
int main(){
	cin>>K;
	for(int i=1;i<=K;i++)
		for(int j=1;j<=K;j++)
			for(int k=1;k<=K;k++)
				ans+=__gcd(i,__gcd(j,k));
	cout<<ans;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int n;
	cin >> n;
	string str;
	cin >> str;

	int ans = 0;
	for (int i = 0; i < n-1; ++i)
	{
		int flag[26] = {0};
		int ct = 0;
		for (int j = 0; j <= i; ++j)
			flag[str[j]-'a'] = 1;
		for (int j = i+1; j < n; ++j)
			if (flag[str[j]-'a'] == 1)
			{
				++ct;
				flag[str[j]-'a'] = 0;
			}
		if (ct > ans)
			ans = ct;
	}

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

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

int main(){
    int n, k;
    cin >> n >> k;
    ll ans = k;
    for(int i = 1; i < n; i++)
    {
        ans *= k-1;
    }
    cout << ans << endl;
    
    return 0;
}

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

#define ll long long
#define ld long double

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define repA(i,A)   for(auto i:A)

#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)	A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V> 
#define Vpll vector<pll>

#define endl "\n"

const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

const ll N = 100005;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 	ll n;
 	cin>>n;
 	cout<<n*(n-1)/2<<endl;   
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[26];
int main(){
	string s;
	
	cin >> s;
	
	string L = "abcdefghijklmnopqrstuvwxyz";
	
	
	for(int i = 0; i < 26; i ++){
		for(int j = 0; j < s.size(); j ++){
			if(s[j] == L[i]){
				a[i] ++;
			}
		}
	}
	
	for(int i = 0; i < 26; i ++){
		if(a[i] % 2 != 0){
			cout << "No";
			return 0;
		}
	}
	
	cout << "Yes";
	return 0;
}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string S;
	cin >> S;
	int n = S.size();
	int flaga = 1,flagc = 0;
	for (int i = 0;i<n;i++){
		if (i == 0){
			if (S[i] != 'A'){
				break;
			}
		}
		else if (i >= 2 && i < n - 1){
			if (S[i] == 'C'){
				if (flagc == 0){
					flagc = 1;
				}
				else{
					flagc = 0;
					break;
				}
			}
			else {
				if (S[i] >= 'A' && S[i] <= 'Z'){
					flaga = 0;
				}
			}
		}
		else {
				if (S[i] >= 'A' && S[i] <= 'Z'){
					flaga = 0;
				}
			}
	}
	if (flaga == 1 && flagc == 1){
		cout <<"AC" << endl;
	}
	else{
		cout << "WA" << endl;
	}
	return 0;
}

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

int h,w,ans[70][70];
char s[70][70];

int main()
{
	ios::sync_with_stdio(false);
	cin>>h>>w;
	for(int i=1;i<=h;i++){
		cin>>(s[i]+1);
	}
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(s[i][j]=='.'){
				ans[i][j]+=(s[i-1][j-1]=='#');
				ans[i][j]+=(s[i-1][j]=='#');
				ans[i][j]+=(s[i-1][j+1]=='#');
				ans[i][j]+=(s[i][j-1]=='#');
				ans[i][j]+=(s[i][j+1]=='#');
				ans[i][j]+=(s[i+1][j-1]=='#');
				ans[i][j]+=(s[i+1][j]=='#');
				ans[i][j]+=(s[i+1][j+1]=='#');
				printf("%d",ans[i][j]);
			}else putchar('#');
		}
		putchar('\n');
	}
	return 0;
}

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

#define rep(i,n) for(auto i=0;i<(n);i++)

using namespace std;


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    string s;
    cin >> s;
    
    if(s.size() < 26){
        rep(i, 26){
            if(s.find('a'+i) == string::npos){
                cout << s + (char)('a'+i) << endl;
                return 0;
            }
        }
    }

    for(int i = s.size()-1; 0 <= i; i--){
        for(char x = s[i]+1; x <= 'z'; x++){
            if(s.substr(0, i).find(x) == string::npos){
                cout << s.substr(0, i) + x << endl;
                return 0;
            }
        }
    }
   
    cout << -1 << endl;

    return 0;
}



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

int main()
{
  ll n;
  cin >> n;
  ll ans = 0;
  ll x = 100;
  while(n > x){
    x = x + x / 100;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  long long n; cin >> n;
  for (long long i = 1; i <= 3500; i++) {
    for (long long j = 1; j <= 3500; j++) {
      if (4*i*j-n*i-n*j <= 0) continue;
      if ((i*j*n) % (4*i*j-n*i-n*j) == 0) {
        cout << i << " " << j << " " << i*j*n / (4*i*j-n*i-n*j) << endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int D,ans;
long long pw[20];
void DFS(int tot,int pos,long long res,long long ti){
	//cerr<<tot<<" "<<pos<<" "<<res<<endl;
	if(pw[pos+1]<=res||-pw[pos+1]>=res) return;
	if(pos<=tot/2){
		if(pos*2==tot) ti*=10;
		if(res==0) ans+=ti;
		return;
	}
	for(int i=-9;i<=9;i++){
		DFS(tot,pos-1,res+i*(pw[pos]-pw[tot-pos]),ti*(10-abs(i)-(pos==tot&&i<=0? 1:0)));
	}
}
int main(){
	cin>>D;pw[0]=1;
	for(int i=1;i<=19;i++) pw[i]=pw[i-1]*10;
	for(int i=0;i<=18;i++)
		DFS(i,i,D,1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;

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

int main(){
  ll n; cin >> n;
  V<string> s(n); for(int i=0; i<n; i++) cin >> s.at(i);

  ll ans = 0; bool is_rev = true;
  for (ll b=0; b<n; b++) {
    is_rev = true;
    for (ll i=0; i<n; i++) {
      for (ll j=0; j<n; j++) {
        if (s.at((n + j-b) % n).at(i) != s.at((n + i-b) % n).at(j)) {
          is_rev = false;
          break;
        }
      }
      if (!is_rev) break;
    }
    if (is_rev) ans += 1;
  }
  cout << ans * n << endl;
  return 0;
}


Measured memory_bytes: 512
from collections import Counter
from sys import exit
N = int(input())
D = Counter(map(int, input().split()))
M = int(input())
T = tuple(map(int, input().split()))
for t in T:
  if D.get(t):
    D[t] -= 1
  else:
    print("NO")
    exit()
print("YES")

Measured memory_bytes: 50476
/*  ex5_4 ACGT
    pandacodeb  */

#include <stdio.h>
#define SIZE 11

int main(void){
    char name[SIZE];
    char *ptr;
    int max = 0, length;

    //input name
    scanf("%s", name);

    ptr = name;
    while (*ptr != '\0'){
        length = 0;
        //find length for each ACGT subsequence
        while (*ptr == 'A' || *ptr == 'C' || *ptr == 'G' || *ptr == 'T'){
            ptr++;
            length++;
        }

        //update new max value (if have to)
        if (length > max)
            max = length;

        //move to next index
        ptr++;
    }

    //print out length of the longest ACGT subsequence
    printf("%d\n", max);
    return 0;
}

Measured memory_bytes: 1604
#include <bits/stdc++.h>
#define inf INFINITY
#define file freopen( "input.txt" , "r" , stdin) ; freopen( "output.txt" , "w" , stdout) ;
#define Gamed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define _3102_ main()
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
const int N = 1e5 + 100;
const ll MX = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-9 ;

ll n, tot,  w[N] , v[N] , dp[150][N]  ;

void show(){
	for ( int i = 0 ; i <= n ; i ++ ){
		for ( int j = 0 ; j <= tot ; j ++){
			cout << dp[i][j] << " " ;
		}
		cout << endl;
	}
}

int _3102_{
	Gamed
	cin >> n >> tot ;
	for ( int i = 1 ; i <= n ; i ++){
		cin >> w[i] >> v[i] ;
	}
	for ( int i = 0 ; i <= n ; i ++){
		dp[i][0] = 0 ;
	}
	for ( int i = 0 ; i <= tot ; i ++){
		dp[0][i] = 0 ;
	}
	for ( int i = 1 ; i <= n ; i ++){
		for ( int j = 1 ; j <= tot ; j ++){
			dp[i][j] = dp[i-1][j] ;		// leave
			if ( w[i] <= j){
				dp[i][j] = max ( dp[i-1][j] , dp[i-1][j-w[i]] + v[i]) ;		// maximize between taking and leaving 
			}
		}
	}
	cout << dp[n][tot] << endl ;
	return 0;
}


Measured memory_bytes: 82624
Row = int(input())
List = []
for i in range (Row):
  List.append(int(input()))
List.sort(reverse = True)
mid = 0
for i in range(Row):
  mid += List[i]
sumList = [mid]* (Row+1)
for i in range(Row):
  sumList[i] = sumList[i]-List[i]
  if sumList[i] % 10 == 0:
    sumList[i]=0
if sumList[Row] % 10 == 0:
  sumList[Row] = 0
res = max(sumList)
print(res)

Measured memory_bytes: 9064
function main(lines) {
    const input = lines.split('\n')
    const setS = new Set(input[1].split(' ').map(Number))
    const setT = new Set(input[3].split(' ').map(Number))
    const S = Array.from(setS).sort(function(a,b){return a-b})
    const T = Array.from(setT).sort(function(a,b){return a-b})

    let count=0
    for(let i=0; i<S.length; i++){
        if(binarySearch(S[i])) count++
    }

    console.log(count)
    
    function binarySearch(key){
        let left = 0
        let right = T.length
        while(left<right){
            let mid = Math.floor((left+right)/2)
            if(key === T[mid]){
                return true;
            } else if(key>T[mid]){
                left = mid + 1;
            } else if(key<T[mid]){
                right = mid;
            }
        }
        
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));




Measured memory_bytes: 40604
function main(input) {
    const args = input.split(' ');
    const a = parseInt(args[0], 10);
    const b = parseInt(args[1], 10);
  
  	if (a * b % 2 === 0) {
      console.log('Even');
    } else {
      console.log('Odd');
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s; cin>>s;
	if (s.size()==3) 
		reverse (s.begin(),s.end());
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
void rev(char *s) {
	int l = strlen(s), i;
	for (i = 0; i<l / 2; i++) {
		char t = s[i];
		s[i] = s[l - 1 - i];
		s[l - 1 - i] = t;
	}
}
char T[4][8] = { "dream","dreamer","erase","eraser" };
int main() {
	int i , c=0, l;
	char s[100001];
	for (i = 0; i<4; i++)rev(T[i]);
	scanf("%s",& s);
	l = strlen(s);
	rev(s);
	for (; c<l;) {
		int k = -1;
		for (i = 0; i<4; i++) {
			if (strncmp(s + c, T[i], strlen(T[i]))==0) {
				k = strlen(T[i]);
				break;
			}
		}
		if (k<0) {
			puts("NO");
			return 0;
		}
		c += k;
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : HelloWorld.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

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

	if(X<A){
		cout<<"0"<<endl;
	}else{
		cout<<"10"<<endl;
	}

	return 0;
}


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

int main() {
  int a, b, c;
  cin >> a >> b	>> c;
  int sum = 0;

  for(int i = 0;; i++) {
    if(sum%60 <= c && c <= (sum%60+a)) {
      cout << sum/60*60 + c << endl;
      break;
    }
    sum	+= a + b;
    if(sum % 60 == 0) {
      cout << "-1" << endl;
      break;
    }
  }

  return 0;
}



Measured memory_bytes: 3124
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>

using namespace std;
int main() {
	string s;
	vector<int> a(26,0);
	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		a[s[i] - 'a']++;
	}
	for (int i = 0; i < 26;i++) {
		if (a[i] > 1) {
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << endl;
	return 0;
}



Measured memory_bytes: 256
package main

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

func height(level int) int {
	if level == 0 {
		return 1
	} else {
		return 3 + 2*height(level-1)
	}
}

func all(level int) int {
	if level == 0 {
		return 1
	} else {
		return 1 + 2*all(level-1)
	}
}

func calc(level, x int) int {

	if x == 0 {
		return 0
	}

	if level == 0 {
		return 1
	}

	if x <= (1 + height(level-1)) {
		return calc(level-1, x-1)
	}

	return all(level-1) + 1 + calc(level-1, x-height(level-1)-2)
}

func parse() (int, int) {

	stdin := bufio.NewScanner(os.Stdin)
	stdin.Split(bufio.ScanWords)

	stdin.Scan()
	n, _ := strconv.Atoi(stdin.Text())
	stdin.Scan()
	x, _ := strconv.Atoi(stdin.Text())

	return n, x
}

func main() {
	n, x := parse()
	fmt.Println(calc(n, x))
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main()
    {
        Scanner cin = new Scanner();
        var N = cin.Long();

        long sqrt = (long)Math.Sqrt(N);
        long x = 0;
        for(int i = 1; i <= sqrt; i++)
        {
            if (N % i == 0) x = i;
        }
        Console.WriteLine(Math.Max(x.ToString().Length, (N / x).ToString().Length));
        Console.ReadLine();
    }

}

class Scanner //標準入力
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Long() + add;
        }
        return Array;
    }

    public double Double()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Double() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define ll long long
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define endl "\n"
#define PI 3.141592653589
using namespace std;

bool sortbysec(const pair<ll,ll> &a, 
              const pair<ll,ll> &b) 
{ 
    return (a.second < b.second); 
} 

ll maxSubArraySum(ll a[], ll size) 
{ 
    ll max_so_far = INT_MIN, max_ending_here = 0; 
  
    for (ll i = 0; i < size; i++) 
    { 
        max_ending_here = max_ending_here + a[i]; 
        if (max_so_far < max_ending_here) 
            max_so_far = max_ending_here; 
  
        if (max_ending_here < 0) 
            max_ending_here = 0; 
    } 
    return max_so_far; 
} 

ll findSubarraySum(ll arr[], ll n, ll sum = 0) 
{
    unordered_map<ll, ll> prevSum;
    ll res = 0;
    ll currsum = 0;
    for (ll i = 0; i < n; i++)
    {
        currsum += arr[i];
        if (currsum == sum) res++;
        if (prevSum.find(currsum - sum) != prevSum.end()) res += (prevSum[currsum - sum]);
        prevSum[currsum]++;
    }
    return res; 
} 
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
  
ll powmp(ll x, ll y, ll p) 
{ 
    ll res = 1;     x = x % p;   
    while (y > 0) 
    {  
        if (y & 1)  res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    double a,b,h,m;cin>>a>>b>>h>>m;
    //minute hand
    double m_angle=m*6;
    double mx=b*cos(PI*m_angle/180);
    double my=b*sin(PI*m_angle/180);
    //hour hand
    double h_angle=0.5*(h*60+m);
    double hx=a*cos(PI*h_angle/180);
    double hy=a*sin(PI*h_angle/180);
    double ans = sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my));
    printf("%0.12lf\n",ans);
}


Measured memory_bytes: 4124
#include <bits/stdc++.h>
#define Mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x, y) memset(x, y, sizeof(x))
#define Maxn 1000000 + 10
using namespace std;
int n;
int h;
int result = 0;
int main()
{
    cin >> n >> h;
    while (n--)
    {
        int x;
        cin >> x;
        if (x >= h)
            result++;
    }
    cout << result << endl;
}


Measured memory_bytes: 256
N,T=map(int,input().split())
A=list(map(int,input().split()))
x=10**9
d=0
ans=0
for a in A:
    if a<x:
        x=a
    elif a-x>d:
        d=a-x
        ans=1
    elif a-x==d:
        ans+=1
print(ans)

Measured memory_bytes: 14252
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ret = [0] * n
for i in range(n):
    ret[i] = b[i] - a[i]
ret = sorted(ret)

cnt = 0
for i, val in enumerate(ret):
    if val < 0:
        cnt += abs(val)
        ret[i] = 0
    elif val % 2 == 1:
        cnt += 1
        ret[i] += 1

for i, val in enumerate(ret):
    cnt -= val // 2
if cnt <= 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 41328
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    int i;
    for(i = 0;i < n;++i){
        cin >> h.at(i);
    }
    vector <int> c(n);
    int temp1,temp2;
    c.at(0) = 0;
    temp1 = h.at(1)-h.at(0);
    if(temp1 < 0){temp1 *= -1;}
    c.at(1) = temp1;
    for(i = 2;i < n;++i){
        temp1 = (int)abs(h.at(i)-h.at(i-1));
        temp2 = (int)abs(h.at(i)-h.at(i-2));
        if(temp1 + c.at(i-1) > temp2 + c.at(i-2)){
            c.at(i) = c.at(i-2)+temp2;
        }else{
            c.at(i) = c.at(i-1)+temp1;
        }
    }
    cout << c.at(n-1) << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
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;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;
using namespace atcoder;

ll f(ll a,ll b){return max(a,b);}
ll e(){return -1LL;};
ll z;
bool b(ll a){return a<z;}

void solve(){
	int n,q;
	cin>>n>>q;
	vector<ll>a(n);
	rep(i,n)cin>>a[i];
	segtree<ll,f,e>tree(a);
	while(q--){
		int t,x,y;
		cin>>t>>x>>y;
		if(t==1){
			x--;
			tree.set(x,y);
		}
		else if(t==2){
			x--;
			cout<<tree.prod(x,y)<<"\n";
		}
		else{
			x--;
			z=y;
			int id=tree.max_right<b>(x);
			cout<<id+1<<"\n";
		}
	}
}


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


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

int main(){
    double r; cin >> r;
    cout << 2*PI*r << "\n";
}

Measured memory_bytes: 3788
#include <stdio.h>

int change(int i, int j) {
    if(i>j) {
    	return 1;
    } else {
    	return 0;
    }
}


int main() {
    int getdata = 0;

    int allData[10];
    int tmpdata;



    int i;
    for(i = 0; i<10; i++) {
        scanf("%d", &getdata);
        allData[i] = getdata;
    }
    for(i = 0; i<10; i++) {
    	if(change(allData[i], allData[0])) {
    		tmpdata = allData[0];
    		allData[0] = allData[i];
    		allData[i] = tmpdata;
    	}
    }
    for(i = 1; i<10; i++) {
    	if(change(allData[i], allData[1])) {
    		tmpdata = allData[1];
    		allData[1] = allData[i];
    		allData[i] = tmpdata;
    	}
    }
    for(i = 2; i<10; i++) {
    	if(change(allData[i], allData[2])) {
    		tmpdata = allData[2];
    		allData[2] = allData[i];
    		allData[i] = tmpdata;
    	}
    }

    printf("%d\n", allData[0]);
    printf("%d\n", allData[1]);
    printf("%d\n", allData[2]);

    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <complex>
using namespace std;

int main() {
    int h,w;
    cin >> h >> w;
    char a[110][110] = {};
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> a[i][j];
        }
    }

    char b[110][110] = {};
    for(int i = 0; i < h + 2; i++){
        for(int j = 0; j < w + 2; j++){
            b[i][j] = '#';
        }
    }

    for(int i = 0; i < h ; i++){
        for(int j = 0; j < w ; j++){
                b[i + 1][j + 1] = a[i][j];
        }
    }

    for(int i = 0; i < h + 2; i++){
        for(int j = 0; j < w + 2; j++){
            cout << b[i][j];
        }
        cout << endl;
    }
}


Measured memory_bytes: 256