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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int F(int x){
  static int mem[300010];
  if(mem[x])return mem[x];
  int ret = 0;
  while(x){
    ret += x%10;
    x /= 10;
  }
  return mem[x] = ret;
}

int main(){
  int n; cin >> n;
  int ans = 1001001001;
  for(int i = 1; i < n; ++i){
    int a = i;
    int b = n - a;
    ChangeMin(ans, F(a)+F(b));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3560
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var NK = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (N, K) = (NK[0], NK[1]);
        var p = ReadLine().Split(' ').Select(s => double.Parse(s)).ToArray();

        var expectedValues = p.Select(x => (x + 1.0) / 2.0).ToArray();

        var expectedSum = expectedValues.Take(K).Sum();
        var maxExpectedSum = expectedSum;

        for (int i = K; i < N; i++)
        {
            expectedSum -= expectedValues[i - K];
            expectedSum += expectedValues[i];
            maxExpectedSum = Math.Max(maxExpectedSum, expectedSum);
        }

        WriteLine(maxExpectedSum);
    }
}


Measured memory_bytes: 43640
import java.lang.Math.sqrt

fun main(args: Array<String>) = yorukatsu16e()

fun yorukatsu16e() {
    val n = readLine()!!.toLong()

    val divisors = divisors(n) - 1

    val answer = divisors.count {
        var currN = n
        while (currN % it == 0L) currN /= it
        currN % it == 1L
    } + (divisors(n - 1) - 1).size

    println(answer)
}

private fun divisors(n: Long): Set<Long> {
    val divisors = mutableSetOf<Long>()
    for (i in 1..sqrt(n.toDouble()).toLong()) if (n % i == 0L) divisors.addAll(listOf(i, n / i))
    return divisors
}


Measured memory_bytes: 38164
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        AtCoder problem = new AtCoder(sc);
        problem.solve(out);

        out.flush();
    }

}

class AtCoder {

    int N;

    AtCoder(FastScanner sc) {
        N = sc.nextInt();
    }

    void solve(PrintWriter out) {
        int dsum = digitSum(Integer.toString(N));
        out.println(N % dsum == 0 ? "Yes" : "No");
    }

    int digitSum(String str) {
        int sum = 0;
        for (int i = 0; i < str.length(); i++) {
            sum += Integer.parseInt(str.substring(i, i + 1));
        }
        return sum;
    }
}

class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 21204
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;

int main()
{
    string A, B;
    cin >> A >> B;
    if (A.size() > B.size())
    {
        cout << "GREATER" << endl;
    }
    else if (A.size() < B.size())
    {
        cout << "LESS" << endl;
    }
    else
    {
        if (A > B)
        {
            cout << "GREATER" << endl;
        }
        else if (A < B)
        {
            cout << "LESS" << endl;
        }
        else
        {
            cout << "EQUAL" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef queue<int, int> qii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;

#define PI 3.14159265359
#define rep(i,a) for(int i=0;i<a;i++)

//int型を受け取ってその桁数を返す
int check_digits(int n, int m) {
	int digits = 0;
	while (n != 0) {
		n /= m;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum = 0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


//入力された文字列が回文か判断してboolを返す
bool is_kaibun(string s) {
	string s_r(s.rbegin(), s.rend());
	return (s == s_r);
}


void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }


//提出言語もしっかり確認して…
//問題文を落ち着いて読む！
//型に注意！！
//出力例もちゃんと全部見る！！！！！
int main() {
	int r;
	cin >> r;
	cout << r * 2 * PI << endl;


	system("pause");
	return 0;
}


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

int main(void){
	int N;
	int A=0,B=0,ans=0;
	scanf("%d",&N);
	int sw;
	int n;
	int i = 0;
	int x = N;
	while(x > 9){
		x = x/10;
		i++;
	}// N = 10^i + x
	int a=i;A=1;
	for(i=0;i<a;i++){
		A = A*10;
		if(A==N) A=A/10;
	}
	B = N-A;
	ans = 1;//A
	int b=B;
	int c=B;
	while(b>9){
		i=0;
		while(b>9){
			b = b/10;
			i++;
		}
		ans+=b;
//		printf("%d\n",ans);
		c = c-b*pow(10,i);
		b=c;
		if(c==0){break;}
	}
	if(c != 0){	ans+=c;	}
	
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    int n,m;
    cin >> n >> m;
    vint s(m),c(m);
    rep(i,m){
        cin >> s[i] >> c[i];
    }
    vint num(n,10);
    rep(i,m){
        if(num[s[i]-1]!=10&&num[s[i]-1]!=c[i] || s[i] == 1&& c[i] ==0 && n!=1) {
            cout << "-1" << endl;
            return 0;
        }
        num[s[i]-1] = c[i];
    }
    if(num[0]==10&&n!=1){
        num[0] = 1;
    }
    rep(i,n){
        if(num[i]==10) num[i]=0;
        cout << num[i];
    }
    cout << endl;
    return 0;
}


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

// modint: mod 計算を int を扱うように扱える構造体
// https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a#8-modint
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream &operator >> (istream &is, const Fp<MOD>& a) noexcept {
        long long t;
        is >> t;
        a = Fp<MOD>(t);
        return (is);
    }
    // 指数関数 O(logN)
    friend constexpr Fp<MOD> mpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = mpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
    
};

const int MOD = 1000000007;
using mint = Fp<MOD>;

mint modpow(long long x, long long n){
    mint ret = x;
    return mpow(ret,n);
}

mint binomial(long long n, long long k){
    if(k < 0 || n < k) return 0;
    mint ret = 1;
    for(long long i = 1; i <= k; ++i) {
        mint tmp = i;
        ret *= n--;
        ret /= tmp;
    }
    return ret;
}

int main(){
    int n, a, b;  cin >> n >> a >> b;
    mint ans = modpow(2,n) - 1 - binomial(n,a) - binomial(n,b);
    cout << ans << endl;
    

    // cout << ans << endl;
}


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

#define ll long long
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vll vector<ll>
#define vvll vector<vll>
#define pb push_back
template<typename T, typename U>
static inline void amin(T &x, U y){
    if(x>y)
        x = y;
}
template<typename T, typename U>
static inline void amax(T &x, U y){
    if(x<y)
        x = y;
}
#define rep(i,n) for(int i = 0; i < n; ++i)
#define irep(i,k,n) for(int i = k; i <= n; ++i)
#define irepr(i,k,n) for(int i = k; i >= n; --i)

const ll mod = 1e9+7;
int fact[9];
int main(){
    fact[0] = 1;
    for(int i = 1; i <= 8; ++i)
        fact[i] = i*fact[i-1];
    int n;
    cin>> n;
    int p[n], q[n];
    int a = 0, b = 0;
    vi vis(9,0);
    rep(i, n){
        cin>> p[i];
        vis[p[i]] = 1;
        int lt = 0;
        for(int j = 1; j <= n; ++j){
            if(vis[j] == 0 && j < p[i]){
                lt++;
            }
        }
            a += fact[n-1-i]*lt;

    }
    vis.assign(9, 0);
    rep(i, n)
    {
        cin>> q[i];
        vis[q[i]] = 1;
        int lt = 0;
        for(int j = 1; j <= n; ++j){
            if(vis[j] == 0 && j < q[i]){
                lt++;
            }
        }
            b += fact[n-1-i]*lt;

    }
    cout << abs(a-b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k;
    cin>>k;
    string s;
    cin>>s;
    if(s.size()<=k)
        cout<<s<<endl;
    else
    {
        for(int i=0;i<k;i++)
        {
            cout<<s[i];
        }
        cout<<"..."<<endl;
    }
}


Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC087_A();
        }

        static void ABC087_A()
        {
            var X = int.Parse(Console.ReadLine());
            var A = int.Parse(Console.ReadLine());
            var B = int.Parse(Console.ReadLine());
            Console.WriteLine((X - A) % B);
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using   namespace      std;
typedef long long      LL;
typedef vector<int>    VI;
typedef pair<int,int>  PII;

int main(){

	int n;
	cin>> n;
	int cnt = 0, x;
	
	for(int i = 1; i<= n; i++){
		cin>> x;
		if(i != x)	cnt++;
	}

	if(cnt > 2)	cout<< "NO"<< endl;
	else 		cout<< "YES"<< endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner as = new Scanner(System.in);
		int[] a = new int[3];
		while(true) {
			for(int i=0;i<3;i++) {
				a[i] = Integer.parseInt(as.next());
			}
			if(a[0] + a[1] + a[2] == 0) {
				break;
			}
			int sum = 0;
			int x = 0;
			for(int i=0;i<a[0];i++) {
				int c = Integer.parseInt(as.next());
				sum += c;
				if(i == a[1] - 1) {
					x = c;
				}
			}
			if(x == 0) {
				System.out.println(0);
			}else {
				System.out.println(sum * (100 - a[2]) / x);
			}
		}
	}
}


Measured memory_bytes: 35300
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using Graph = vector<vector<pair<int, int>>>;

vector<long long> dist;
void dfs(const Graph &g, int u, int par, long long d) {
    dist[u] = d;
    for (auto &p: g[u]) if (p.first != par) {
        dfs(g, p.first, u, d + p.second);
    }
}

int main() {
    int n; cin >> n;
    Graph g(n);
    for (int i = 0; i < n - 1; i++) {
        int a, b, c; cin >> a >> b >> c; a--, b--;
        g[a].emplace_back(b, c);
        g[b].emplace_back(a, c);
    }
    int q, k; cin >> q >> k; k--;
    dist.resize(n);
    dfs(g, k, -1, 0);
    while (q--) {
        int x, y; cin >> x >> y; x--, y--;
        cout << dist[x] + dist[y] << endl;
    }
    return 0;
}

Measured memory_bytes: 14336
#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;
	cout<<(s=="ABA"||s=="ABB"||s=="BAA"||s=="AAB"||s=="BBA"||s=="BAB"?"Yes":"No")<<endl;
	return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
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)*}
    };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident $($r:tt)*) => {
        let mut $var = $iter.next().unwrap().parse::<usize>().unwrap();
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, $var:ident $($r:tt)*) => {
        let $var = $iter.next().unwrap().parse::<usize>().unwrap();
        input_inner!{$iter $($r)*}
    };
}
#[allow(unused_macros)]
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>().unwrap()
    };
}
#[allow(unused_macros)]
macro_rules! outbuf {
    ($var:ident) => {
        use std::io::{stdout, BufWriter, Write};
        let stdout = stdout();
        let mut $var = BufWriter::new(stdout.lock());
    };
}
fn main() {
    input! {n, a: [[usize; n]; n]};
    // outbuf! {out};
    let mut ans = 0;
    for i in 0..(n-1) {
        for j in (i+1)..n {
            let mut c = 0;
            for k in 0..n {
                if k == i || k == j { continue };
                if a[i][j] > a[i][k] + a[k][j] {
                    println!("-1");
                    return;
                }
                if a[i][j] == a[i][k] + a[k][j] {
                    c += 1;
                }
            }
            if c == 0 {
                ans += a[i][j];
            }
        }
    }
    println!("{}", ans);
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int n;
int a[111111];

int main(){
	cin.sync_with_stdio(false);
  cin>>n;
  rep(i,n)cin>>a[i];
  int pre=a[0];
  int res=1,state=-1;
  repl(i,1,n){
    if(state==0){ // inc
      if(pre>a[i]){
        state=-1;
        res++;
        pre=a[i];
        continue;
      }
      maxch(pre,a[i]);
    }else if(state==1){ // dec 
      if(pre<a[i]){
        state=-1;
        res++;
        pre=a[i];
        continue;
      }
      minch(pre,a[i]);
    }else{
      if(pre<a[i])state=0;
      else if(pre>a[i])state=1;
      pre=a[i];
    }
  }
  cout<<res<<endl;
	return 0;
}


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

int main() {
    int N, L;
    cin >> N >> L;
    string S[N];
    
    for(int i = 0; i < N; i++) {
        cin >> S[i];
    }
    
    sort(S, S+N);

    for(int i = 0; i < N; i++) {
        cout << S[i];
    } 
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>
#include <queue>
#define _USE_MATH_DEFINES
#include <math.h>

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

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
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;
}

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a){
	
	if(a[index]>key){
		return true;
	}
	
	return false;
}

ll bin_search(ll key, vector<ll> &a){
	
	ll l=-1;
	ll r=a.size();

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}

/*
//深さ優先探索
void dfs(vector<vector<ll>> &gra,vector<bool> &seen, ll v){

	seen[v]=true;

	for(auto next : gra[v]){
		if(seen[next]){
			continue;
		}

		dfs(gra,seen,next);
	}
	
}
*/
const ll MOD=1000000007;

ll min(ll a, ll b){
	if(a>=b){
		return b;
	}
	else{
		return a;
	}
}

void solve(){

	ll ans=0;
	ll n;
	cin>>n;
	if(n%1000==0){
		cout<<0<<endl;
	}
	else{
		ans=1000-n%1000;
		cout<<ans<<endl;
	}
}


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



Measured memory_bytes: 3624
import math

n,d=map(int,input().split())
x=[list(map(int,input().split()))for _ in range(n)]
ans=count=0

for i in range(n-1):
  for j in range(n-1-i):
    for k in range(d):
      count+=(x[i][k]-x[j+i+1][k])**2
    if math.sqrt(count).is_integer():
      ans+=1
    count=0

print(ans)

Measured memory_bytes: 3064
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#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 ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int n,a[100005],b[100005],t[200005];
pair<int,int> p[100005];
ll k;
void add(int x){while(x<=n*2+1)++t[x],x+=(x&-x);}
int sum(int x){
    int s=0;
    while(x)s+=t[x],x-=(x&-x);
    return s;
}
bool ok(int x){
    x=p[x].first;
    for(int i=1;i<=n;++i){
        if(a[i]<x)b[i]=1;
        else b[i]=-1;
    }
    memset(t,0,sizeof(t));
    ll ans=0;
    int o=n+1;
    add(o);
    for(int i=1;i<=n;++i){
        o+=b[i];
        add(o);
        ans+=1ll*sum(o-1);
    }
    return ans<k;
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i)scanf("%d",a+i),p[i]=mp(a[i],i);
    sort(p+1,p+n+1);
    k=(1ll+n)*n/2ll;
    k=k/2ll+1ll;
    int l=1,r=n+1;
    while(r-l>1){
        int m=(l+r)>>1;
        if(ok(m))l=m;
        else r=m;
    }
    printf("%d\n",p[l].first);
//	system("pause");
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

int main() {
  string s;
  cin >> s;
  int ans = 1000;
  rep(i, s.length() - 2) {
    string str = string();
    str += s[i];
    str += s[i + 1];
    str += s[i + 2];
    int num = atoi(str.c_str());
    if (abs(num - 753) < ans) {
      ans = abs(num - 753);
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX (ll)(1e5 + 4)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(1e18 + 3)
#define PI (double)(3.14159265)

using namespace std;
using ll = long long;
using ld = long double;

int main () {
	ll t1, t2, a1, a2, b1, b2;
	cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
	ll s = (a1 - b1) * t1, ss = (a2 - b2) * t2;
	if (s + ss == 0) {
		cout << "infinity\n";
		return 0;
	}
	if (((s < 0 && ss > 0) || (ss < 0 && s > 0)) && abs (ss) > abs (s)) {
		ss = abs (ss), s = abs (s);
		ll d = abs (ss) - abs (s);
		cout << 2 * (s / d) + ((s % d) > 0) << "\n";
	}
	else {
		cout << "0\n";
	}
}


Measured memory_bytes: 256
# プロ幼稚園に通う 2 人の子供がキャンディーの取り合いをしています。
# 3 個のキャンディーパックがあり、
# それぞれのパックにはキャンディーが a , b , c 個入っています。
# えび先生はこの 3 個のパックを、
# キャンディーの個数が等しくなるように 2 人に分けようとしています。
# そのような分け方が可能かどうかを判定してください。
# ただし、キャンディーをパックから取り出すことはできず、
# それぞれのパックをそのままどちらかの子供にあげる必要があります。

# 1 <= a, b, c <= 100

# 3個のキャンディーパックのそれぞれ入っているキャンディーの個数を取得
input = gets.chomp.split
a = input[0].to_i
b = input[1].to_i
c = input[2].to_i

if (a + b == c) || (a + c == b) || (a == b + c)
  puts "Yes"
else
  puts "No"
end

# # 1人目の子供に1個目のキャンディーパックを、
# # 2人目の子供に2個目のキャンディーパックを渡す
# div1 = a
# div2 = b

# # 持っているキャンディーの個数の少ない子供に、
# # 3個目のキャンディーパックを渡す
# if div1 > div2
#   div2 += c
# else
#   div1 += c
# end

# # 結果を格納するための変数を宣言
# result = String.new

# # 2人の子供の持っているキャンディーの個数が等しいか判定
# if div1 == div2
#   result = "Yes"
# else
#   result = "No"
# end

# # 結果を出力
# puts result

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
const double PI=3.14159265358979323846;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    double A,B,X; cin >> A >> B >> X;
    if(X <= A*A*B/2.0){ //半分以下
        double y = 2.0*X / A / B;
        cout << atan(B/y)*180/PI << endl;
    }else{ //半分以上
        double rX = A*A*B-X;
        double y = 2.0*rX / A /A;
        cout << atan(y/A)*180/PI << endl;

    }

}


Measured memory_bytes: 640
def main():
    if A.count(0) >= 1:
        print(0)
        return
    ans = 1
    for a in A:
        ans *= a
        if ans > L:
            print(-1)
            return
    print(ans)


if __name__ == "__main__":
    N = int(input())
    A = [int(a) for a in input().split()]
    L = 10**18
    main()


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

using namespace std;

int main()
{
    string s;
    cin >> s;
    
    int len = s.size();
    int count = len - 2;

    cout << s.substr(0, 1) << count << s.substr(len - 1, 1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main(){
  string str;
  int c_joi,c_ioi;
  
  while(cin>>str){
    c_joi=0;c_ioi=0;
  
    while((int)str.size()>=3){
      if(str.find("JOI")==string::npos&&str.find("IOI")==string::npos) break;
    
      if((str.find("JOI")<str.find("IOI"))&&str.find("JOI")!=string::npos){
        c_joi++;
        str = str.substr(str.find("JOI")+2);
      }
      else if((str.find("IOI")<str.find("JOI"))&&str.find("IOI")!=string::npos){
        c_ioi++;
        str = str.substr(str.find("IOI")+2);
      }
    }
    printf("%d\n%d\n",c_joi,c_ioi);
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=105;
int W,n;
int w[4][maxn],v[4][maxn],len[4]={0};
long long ans=0;
void dfs(long long curw,long long curv,int depth[4],int start){
    if(curw>W)return;
    if(curv>ans)ans=curv;
    for(int i=start;i<4;i++){
        if(depth[i]<len[i]){
            depth[i]++;
            dfs(curw+w[0][0]+i,curv+v[i][depth[i]-1],depth,i);
            depth[i]--;
        }
    }
}
bool Cmp(int a,int b){return a>b;}
int main(){
    cin>>n>>W;
    cin>>w[0][0]>>v[0][0];
    len[0]++;
    for(int i=1;i<n;i++){
        int w0,v0;
        cin>>w0>>v0;
        v[w0-w[0][0]][len[w0-w[0][0]]++]=v0;
        w[w0-w[0][0]][len[w0-w[0][0]]++]=w0;
        len[w0-w[0][0]]++;
    }
    for(int i=0;i<4;i++)sort(v[i],v[i]+len[i],Cmp);
    int depth[4]={0,0,0,0};
    dfs(0,0,depth,0);
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin);

	int n;
	vector<int> arr;
	int tot = 0;

	scanf("%d", &n);

	for (int i = 0; i < n; i++)
	{
		int input;

		scanf("%d", &input);

		arr.push_back(input);

		tot ^= input;
	}

	for (int i = 0; i < n; i++)
	{
		printf("%d ", tot^arr[i]);
	}

	printf("\n");

	return 0;
}

Measured memory_bytes: 3744
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int n,pos;
vector<int> pre,in,post;
void rec(int l,int r){
 if(l>=r)return;
 int root=pre[pos++];
 int m=distance(in.begin(),find(in.begin(),in.end(),root));
 rec(l,m);
 rec(m+1,r);
 post.push_back(root);
}
void solve(){
 pos=0;
 rec(0,pre.size());
 for(int i=0;i<n;i++){
  if(i)cout<<" ";
  cout<<post[i];
 }
 cout<<endl;
}
int main(){
 int k;
 cin>>n;
 for(int i=0;i<n;i++){
  cin>>k;
  pre.push_back(k);
 }
 for(int i=0;i<n;i++){
  cin>>k;
  in.push_back(k);
 }
 solve();
 return 0;
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define forA(i,a,n,x) for(auto i=a;i<n;i+=x)
#define forD(i,a,n,x) for(auto i=n-1;i>=0;i-=x)
#define ranit(it,n) for(auto it:n)
#define testCases ll t;cin>>t;while(t--)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007

vll stone(100003,0); vll dp(100003,-1); ll x,k;

ll calc(ll n)
{
	if(n==0)return 0;ll ans=mod;
	forA(i,1,k+1,1)
	{
		if((n-i)<0)break;
		if(dp[n-i]!=-1)x=dp[n-i];
		else {x=calc(n-i);}
		ans = min(ans,x+abs(stone[n-i]-stone[n]));
	}
	dp[n]=ans;
	return dp[n];
}

int main()
{
	ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
	ll n; cin>>n>>k;forA(i,0,n,1)cin>>stone[i];
	dp[0]=0;
	//forA(i,0,n,1)cout<<dp[i]<<" ";
	cout<<calc(n-1);
	return 0;
}

Measured memory_bytes: 12700
#include<bits/stdc++.h>
#define REP(i,c) for(int i=0;i<(c);i++)
using namespace std;
int main(){
  string s;
  cin >> s;
  int size = s.size();
  vector<int> data((size + 1),0);
  REP(i, size)
  {
    if(s.at(i)=='<'){
      data.at(i + 1) = max(data.at(i + 1), data.at(i) + 1);
    }
  }
  for(int j = size; j > 0; j--)
  {
    if (s.at(j-1) == '>')
    {
      //cout << data.at(j - 1) << " " << data.at(j) + 1 << endl;
      data.at(j-1) = max(data.at(j-1), data.at(j) + 1);
    }


  }
  long long int ans = 0;
  REP(i, size + 1)
  {
    ans += data.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 2820
A, B = map(int, input().split())


def F(N):
    """
    0,1,2,..,Nの排他的論理和
    """
    if N < 2:
        return N
    if N % 4 == 3:
        return 0
    if N % 4 == 1:
        return 1
    if N % 4 == 0:
        return N
    if N % 4 == 2:
        return N + 1

#x = [i for i in range(21)]
# for i in range(20):
#    x[i + 1] ^= x[i]
# for i, j in enumerate(x):
#    print(i, j)


if A == 0:
    print(F(B))
else:
    print(F(B) ^ F(A-1))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;

int N,M;
vector< vector<int> > edge;
int done[200000] = {0};
int dist[200000] = {0};

void bfs( int s ) {
    
    queue<int> q;
    
    done[s] = 1;
    
    for ( int i = 0; i < edge[s].size(); i++ ) {
        q.push( edge[s][i] );
        dist[edge[s][i]] = 1;
        done[edge[s][i]] = 1;
    }
    
    while( !q.empty() ) {
        
        int next = q.front();
        q.pop();
        
        for ( int i = 0; i < edge[next].size(); i++ ) {
            
            if ( !done[edge[next][i]] ) {
                q.push( edge[next][i] );
                dist[edge[next][i]] = dist[next]+1;
                done[edge[next][i]] = 1;
            }
            
        }
        
        
    }
    
    
}

int main() {
    
    bool ans;
    cin >> N >> M;
    
    edge.resize(N);
    
    for ( int i = 0; i < M; i++ ) {
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    
    

    fill( dist, dist+10, 0 );
    fill( done, done+10, 0 );
    
    
    bfs( 0 );
    
    ans = (dist[N-1] == 2);
    
    cout << (ans ? "POSSIBLE" : "IMPOSSIBLE" ) << endl;;
    
    return 0;
}

Measured memory_bytes: 13936
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define INF (1 << 30)
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
const long long mod = 1e9+7;

using namespace std;
using ll = __int64_t;
using ull = unsigned long long;

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

bool comp(const pair<int, ll>& p1, const pair<int, ll>& p2){
    return p1.second > p2.second;
}

void solve(){
    string s;
    cin >> s;
    for(int i = 1; i < s.length(); i++){
        if(s[i-1] == s[i]){
            cout << "Bad" << endl;
            return;
        }
    }
    cout << "Good" << endl;
}

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

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

const int max_K = 100000+10;

Int N,K;
Int dp[max_K];

Int mod_pow(Int x, Int r) {
    if(r == 0)
        return 1;

    Int ans = mod_pow(x*x%MOD,r>>1);
    if(r&1)
        ans = (ans*x)%MOD;
    
    return ans%MOD;
}

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

    Int ans = 0;
    for(Int d = K;d >= 1;d--) {
        Int n2 = 0;
        Int x = K/d;
        Int num = mod_pow(x,N);
        
        dp[d] = num;
        
        for(Int i = 2;i*d <= K;i++) {
            dp[d] = (MOD + dp[d] - dp[i*d])%MOD;
        }

        ans += d*dp[d]%MOD;
        ans %= MOD;
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3960
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, m;
  in2(n, m);
  out((n + m) % 24);
  memi;
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<int, int> pii;
const int inf=1010001000;
const ll  INF=1001000100010001000;
const int mod=(int)1e9+7;

int main(){
    int n;
    cin>>n;
    vector<int>v(n);
    map<int,int>m0,m1;
    rep(i,0,n){
        cin>>v.at(i);
        if(i%2==0){
            m0[v.at(i)]++;
        }
        else{
            m1[v.at(i)]++;
        }
    }
    int mm0=0,mm0n=0,c0=0;
    int mm0t;
    for(auto p:m0){
        int t=p.first;
        int s=p.second;
        //cout<<t<<' '<<s<<endl;
        c0+=s;
        mm0=max(mm0,s);
        if(s==mm0)mm0t=t;
    }
    for(auto p:m0){
        int t=p.first;
        int s=p.second;
        if(mm0t==t)continue;
        mm0n=max(mm0n,s);
    }
    int mm1=0,mm1n=0,c1=0;
    int mm1t;
    for(auto p:m1){
        int t=p.first;
        int s=p.second;
        //cout<<t<<' '<<s<<endl;
        c1+=s;
        mm1=max(mm1,s);
        if(s==mm1)mm1t=t;
    }
    for(auto p:m1){
        int t=p.first;
        int s=p.second;
        if(mm1t==t)continue;
        mm1n=max(mm1n,s);
    }
    //cout<<mm0<<' '<<mm0n<<' '<<mm1<<' '<<mm1n<<endl;
    //cout<<c0<<' '<<c1<<endl;
    if(mm0t!=mm1t){
        cout<<c0-mm0+c1-mm1<<endl;
        return 0;
    }
    else{
        int ans;
        if(mm0n==0 and mm1n==0)ans=n/2;
        else ans=min(c0-mm0n+c1-mm1,c0-mm0+c1-mm1n);
        cout<<ans<<endl;
    }
return 0;
}

Measured memory_bytes: 5376
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
		}
		
		int min = a[0];
		
		for (int i = 0; i < a.length-1; i++) {
			min = gcp(min,a[i+1]);
		}
		System.out.println(min);
		
		sc.close();
	}
	
	public static int gcp (int a, int b) {
		int temp;
		while ((temp = a%b) != 0) {
			a = b;
			b = temp;
		}
		return  b;
	}
	
}

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

#define ull unsigned long long
#define ll long long
#define null NULL
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define ff first
#define ss second

int main (){
	IOS
	int n ;
	cin >> n ;
	string st ;
	set <string> s ;
	for(int i = 1;i<=n;i++){
		cin >> st ;
		s.insert(st) ;
	}
	cout << s.size() ;
	return 0 ;
}
		

Measured memory_bytes: 19256
N = int(input())

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

count = 0

def judge(L):
    global count
    for i in range(N):
        if L[i]%2 == 0:
            L[i] = L[i]/2
        elif L[i]%2 != 0:
            return count
    count += 1
    judge(L)

judge(A)

print("{}".format(count))

Measured memory_bytes: 3060
#include<algorithm>
#include<cmath>
#include<climits>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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

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

	int N = S.size();

	int cnt = 0;
	int cntS = 0;

	rep(i, N)
	{
		if (S[i] == 'S')
		{
			cntS++;
		}
		else
		{
			if (cntS > 0)
			{
				cnt++;
				cntS--;
			}
		}
	}

	cout << N - 2 * cnt << endl;

	return 0;
}

Measured memory_bytes: 640
import sys
sys.setrecursionlimit(10**6)

N = int(input())
nodes = [[[], -1] for _ in range(N + 1)]

for i in range(N - 1):
    u, v, w = [int(_) for _ in input().split()]
    nodes[u - 1][0].append((v - 1, w))
    nodes[v - 1][0].append((u - 1, w))


def f(i, c):
    if nodes[i][1] >= 0: return
    nodes[i][1] = c
    for n in nodes[i][0]:
        f(n[0], (c + (n[1] % 2)) % 2)

# print(nodes)
f(0, 0)
for i in range(N):
    print(nodes[i][1])


Measured memory_bytes: 87448
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    public static void Main()
    {
        int[] d = new int[4];
        for (int i = 0; i < 3; i++) {
            int A = NextInt();
            int B = NextInt();
            d[A - 1]++;
            d[B - 1]++;
        }
        if (d.Any(v => v > 2)) Console.WriteLine("NO");
        else Console.WriteLine("YES");
    }
}

public class Input
{
    private static Queue<string> queue = new Queue<string>();
    private static void Confirm() { if (queue.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) queue.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(queue.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(queue.Dequeue()); }
    public static string NextString() { Confirm(); return queue.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(queue.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b,c,d;cin>>a>>b>>c>>d;
    while(a>0 && c>0)
    {
        c-=b;
        if(c<=0)
        {
            cout<<"Yes\n";
            goto here;
        }
        a-=d;
    }
    cout<<"No\n";
    here:;
    return 0;



}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	string s; cin >> s;
	for (int i = 0; i < s.length();i++)
		s[i] = (s[i] - 'A' + 23) % 26 + 'A';
	cout << s << endl;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
 
#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
 
int main(void)
{
    int h,w,k;
    cin>>h>>w>>k;
    char c[10][10];
    rep(i,0,h){
        rep(j,0,w){
            cin>>c[i][j];
        }
    }
 
    int ans=0;
    for(int i=0;i<(1<<h);i++){
        for(int j=0;j<(1<<w);j++){
            int cnt=0;
            rep(a,0,h){
                rep(b,0,w){
                    if(i&(1<<a) || j&(1<<b) )continue;
                    if(c[a][b]=='#')cnt++;
                }
            }
            if(cnt==k)ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>

using namespace std;

int main(void) {
	int r,g,b;
	cin >> r >> g >> b;
	r = r*100;
	g = g*10;
	if ((r+g+b)%4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 256