akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <iterator>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <functional>
using namespace std;

int main() {
    int x;
    cin >> x;
    if(x == 7 | x == 5 | x == 3) cout << "YES" << endl;
    else cout << "NO" << endl;
}


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

using namespace std;
int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<float> v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	
	sort(v.begin(), v.end());
	while (v.size() >= 2) {
		float value = (v[0] + v[1]) / 2.0f;
		v.erase(v.begin() + 1);
		v.erase(v.begin());
		v.insert(v.begin(), value);
	}
	
	cout << v[0] << endl;
}

Measured memory_bytes: 256
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

using ll = long long;
using ld = long double;
using ull = unsigned long long;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

#ifdef BZ
#define TEST
#endif

const int L = 128;
const int Q = 850;
int qq;

string ANS = "Atcod3rIsGreat";

int lev(const std::string& first, const std::string& second) {
	std::vector<std::vector<int>> dp(first.size() + 1, std::vector<int>(second.size() + 1));
	for (size_t i = 0; i <= first.size(); ++i) {
		for (size_t j = 0; j <= second.size(); ++j) {
			dp[i][j] = first.size() + second.size() + 1;
		}
	}

	dp[0][0] = 0;
	int first_len = first.size();
	int second_len = second.size();

	auto upd = [](int* what, int with) { *what = std::min(*what, with); };

	for (int first_pos = 0; first_pos <= first_len; ++first_pos) {
		for (int second_pos = 0; second_pos <= second_len; ++second_pos) {
			if (first_pos < first_len) {
				upd(&dp[first_pos + 1][second_pos], dp[first_pos][second_pos] + 1);
			}
			if (second_pos < second_len) {
				upd(&dp[first_pos][second_pos + 1], dp[first_pos][second_pos] + 1);
			}
			if (first_pos < first_len && second_pos < second_len) {
				if (first[first_pos] == second[second_pos]) {
					upd(&dp[first_pos + 1][second_pos + 1], dp[first_pos][second_pos]);
				} else {
					upd(&dp[first_pos + 1][second_pos + 1], dp[first_pos][second_pos] + 1);
				}
			}
		}
	}
	return dp[first_len][second_len];
}


int ask(string s) {
	++qq;
	assert(qq <= Q);
	cout << "? " << s << "\n";
	cout.flush();
#ifndef TEST
	int x;
	cin >> x;
	return x;
#else
	return lev(s, ANS);
#endif
}

void answer(string s) {
	cout << "! " << s << "\n";
	cout.flush();
	exit(0);
}

string ch;
int cnt[100];
int len;

string run(int l, int r) {
	if (l + 1 == r) {
		return string(cnt[l], ch[l]);
	}

	int m = (l + r) >> 1;
	auto sl = run(l, m);
	auto sr = run(m, r);
	int now = 0;
	for (char c : sr) {
		while (now < sl.size() && ask(sl.substr(0, now) + c + sl.substr(now)) != len - sl.size() - 1) {
			++now;
		}
		sl = sl.substr(0, now) + c + sl.substr(now);
		now += 1;
	}

	return sl;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cout.setf(ios::fixed), cout.precision(20);
	for (char c = 'a'; c <= 'z'; ++c) {
		ch += c;
	}
	for (char c = 'A'; c <= 'Z'; ++c) {
		ch += c;
	}
	for (char c = '0'; c <= '9'; ++c) {
		ch += c;
	}

	for (int i = 0; i < ch.size(); ++i) {
		int x = ask(string(L, ch[i]));
		cnt[i] = L - x;
		len += cnt[i];
	}

	answer(run(0, ch.size()));
	return 0;
}




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

using namespace std;

#define pb push_back
#define mp make_pair
#define F first
#define S second

#define fo(i, n) for(int i = 1; i <= n; ++i)
#define rep(i, a, b) for(int (i) = (a); (i) < (b); ++(i))

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 200200;
const int mod = 1e9 + 7;
const ll INF = 1e18;
ll res;

inline vector<pll> calc2(ll a, ll b)
{
	ll st=max(a/2-1,0ll);
	ll en=min(a/2+1,a);
	vector<pll> ret;
	for(ll x=st;x<=en;++x)
		ret.pb(mp(x*b,(a-x)*b));
	return ret;
}

inline ll calc(ll a, ll b)
{
	ll st=max(a/3-1, 0ll);
	ll en=min(a/3+1, a);
	for(ll x=st;x<=en;++x)
	{
		ll s1=x*b;
		vector<pll> q1=calc2(a-x, b);
		vector<pll> q2=calc2(b,a-x);
		for(auto y: q1)
		{
			ll s2=y.F, s3=y.S;
			ll mx=max(s1,max(s2,s3));
			ll mn=min(s1,min(s2,s3));
			res = min(res, mx - mn);
		}
		for(auto y: q2)
		{
			ll s2=y.F, s3=y.S;
			ll mx=max(s1,max(s2,s3));
			ll mn=min(s1,min(s2,s3));
			res = min(res, mx - mn);
		}
	}
}

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

	ll a,b;
	cin>>a>>b;
	res=1e18;
	calc(a, b);
	calc(b, a);
	cout << res;
	return 0;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
     
#define int  long long
#define endl '\n'
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 25 + 1;

void solve(){
  int a, b;
  cin >> a >> b;
  if (2 * b >= a) cout << 0 << endl;
  else cout << a - 2 * b << endl;
}

int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();	
}


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

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> &str {
    input!{
        source = src,
        h: usize,
        n: usize,
        an: [usize; n]
    }

    let sum: usize = an.iter().sum();
    return if sum >= h {
        "Yes"
    } else {
        "No"
    };
}


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

using namespace std;

#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define LL long long
#define ULL unsigned long long
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<LL,int>
#define PLL pair<LL,LL>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<LL,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();
    int i,k,n;
    LL a[200005];
    cin >> n >> k;
    for(i=1;i<=n;i++)cin >> a[i];
    for(i=k+1;i<=n;i++)
    {
        if(a[i] > a[i-k])cout << "Yes\n";
        else cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 5132
from functools import lru_cache

N, A = map(int, input().split())
X = tuple(int(x) for x in input().split())

# 平均を出すのに選んだ個数が必要
@lru_cache(maxsize=None)
def rec(i, a, k):
    """
    :param i: int
        数列の長さ
    :param a: int
        総和
    :param k: int
        選ぶ個数
    :return: int
        通り数
        Number of patterns
    """
    if k == 0:
        if a == 0:
            return 1
        else:
            return 0

    ret = 0
    if i - 1 >= k:
        ret = rec(i - 1, a, k)
    if X[i - 1] <= a and i - 1 >= k - 1:
        ret += rec(i - 1, a - X[i - 1], k - 1)
    return ret


i = len(X)
m = (rec(i, k * A, k) for k in range(1, N + 1))
print(sum(m))

Measured memory_bytes: 79148
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)

using ll = long long;
using ull = unsigned long long;
constexpr ll mod = 1e9 + 7;
using namespace std;

int main() {

	int N, M; cin >> N >> M;
	priority_queue<int> q;
	rep(i, N) {
		int A; cin >> A;
		q.push(A);
	}
	rep(i, M) {
		int A = q.top(); q.pop();
		q.push(A / 2);
	}
	ll ans = 0;
	while (!q.empty()) {
		ans += q.top(); q.pop();
	}

	cout << ans;

	return 0;

}

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

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

	ll ans = 0;
	ll now_time = 0;
	ll now_a, now_b; // 読んだ本の数
	now_a = 0, now_b = 0;
	if (k>=a[0]) {
		// 机Aの本を読めるだけ読む
		rep(i,n) {
			if (now_time+a[i]<=k) {
				now_a++;
				now_time += a[i];
			}
			else break;
		}

		// 机Bの本を読めるだけ読む
		rep(i,m) {
			if (now_time+b[i]<=k) {
				now_b++;
				now_time += b[i];
			}
			else break;
		}

		// 読んだ本の数をカウント
		ans = now_a + now_b;

		// 机Aの本を1冊読まないことにして、机Ｂの本をできるだけ読む、を繰り返す
		while (now_a>=1) {
			now_time -= a[now_a-1];
			now_a--;
			while (now_b<=m-1 && now_time+b[now_b]<=k) {
				now_time += b[now_b];
				now_b++;
			}
			ans = max(now_a+now_b, ans);
		}
	} 
	else {
		rep(i,m) {
			if (now_time+b[i]<=k) {
				ans++;
				now_time += b[i];
			}
			else break;
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 6408
from queue import Queue


if __name__ == "__main__":
    q: Queue = Queue()
    process_num, quantum = map(lambda x: int(x), input().split(" "))
    total_time = 0

    for _ in range(process_num):
        process, time_str = input().split(" ")
        time = int(time_str)
        q.put([process, time])

    while not q.empty():
        process_name, process_time = q.get()
        if process_time <= quantum:
            total_time += process_time
            print(f"{process_name} {total_time}")
        else:
            total_time += quantum
            process_time -= quantum
            q.put([process_name, process_time])



Measured memory_bytes: 14176
h,w = map(int,input().split())
s = [input() for _ in range(h)]
yoko = []
tate = []
for i in range(h):
    l = []
    k = s[i][0]
    m = 1
    for j in range(1,w):
        if s[i][j]!=k:
            if k=='.':
                l += [m]*m
            else:
                l += [0]*m
            m = 1
            k = s[i][j]
        else:
            m += 1
    if k=='.':
        l += [m]*m
    else:
        l += [0]*m
    yoko.append(l)

for i in range(w):
    l = []
    k = s[0][i]
    m = 1
    for j in range(1,h):
        if s[j][i]!=k:
            if k=='.':
                l += [m]*m
            else:
                l += [0]*m
            m = 1
            k = s[j][i]
        else:
            m += 1
    if k=='.':
        l += [m]*m
    else:
        l += [0]*m
    tate.append(l)
ans = 0
for i in range(h):
    for j in range(w):
        if yoko[i][j] and tate[j][i]:
            ans = max(ans,yoko[i][j]+tate[j][i]-1)
print(ans)

Measured memory_bytes: 127576
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

int main() {
    int s, w;
    cin >> s >> w;
    if(w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int x1, x2, x3, x4, y1, y2, y3, y4;
  cin >> x1 >> y1 >> x2 >> y2;
  x3 = -y2 + y1 + x2;
  y3 = x2 - x1 + y2;
  x4 = -y2 + y1 + x1;
  y4 = x2 - x1 + y1;
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define ins insert
#define sz(x) (long long)x.size()
typedef long long ll;
typedef long double ld;
const int N = 1e5 + 5;
const ld pi = 3.141592653;
const ll MOD = 1e9 + 7;
const ll mod = 998244353;
const ll INF = __LONG_LONG_MAX__;

using namespace std;

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

int main()
{
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int T = 1;
        //cin>>T;
        while(T--)
        {
                ll s, i, j;
                cin>>s;
                vector<ll> dp(2005, 0);
                dp[0] = 1; dp[1] = dp[2] = 0;
                for(i = 3; i<=s; i++){
                        for(j = 3; j<=i; j++) dp[i] = (dp[i] + dp[i - j])%MOD;
                }
                cout<<dp[s];
        }
        return 0;
}

Measured memory_bytes: 3652
Table = %W(E N W S)

Man = Struct.new(:x, :y, :dir, :next_x, :next_y) do
  def next
    dx, dy = [[1, 0], [0, -1], [-1, 0], [0, 1]][self.dir]
    self.next_x, self.next_y = self.x + dx, self.y + dy
  end
  
  def move(field)
    field[self.y][self.x] = "."
    self.x, self.y = self.next_x, self.next_y
    self.next
    if field[self.y][self.x] == "X"
      return [self, true]
    else
      field[self.y][self.x] = Table[self.dir]
      return [self, false]
    end
  end
  
  def turn(field)
    [-1, 0, 1, 2].each do |step|
      next_dir = (self.dir + step) % 4
      dx, dy = [[1, 0], [0, -1], [-1, 0], [0, 1]][next_dir]
      type = field[self.y + dy][self.x + dx]
      if type == "." || type == "X"
        self.dir = next_dir
        field[self.y][self.x] = Table[next_dir]
        self.next
        return
      end
    end
  end
end

def passage(persons, field)
  h = Hash.new([])
  persons.each do |man|
    next_type = field[man.next_y][man.next_x]
    next unless next_type == "." || next_type == "X"
    h[[man.next_x, man.next_y]] += [man]
  end
  h.values
end


loop do
  w, h = gets.split.map(&:to_i)
  break if (w + h).zero?
  
  field = h.times.map {gets.chomp.chars}
  
  persons = []
  field.each_with_index do |row, y|
    row.each_with_index do |po, x|
      idx = Table.index(po)
      persons << Man.new(x, y, idx) if idx
    end
  end
  persons.each(&:next)
  
  t = 1
  loop do
    persons.each {|man| man.turn(field)}
    
    passage(persons, field).each do |ary|
      man, flag = if ary.size == 1
        ary[0].move(field)
      else
        ary.sort_by {|man0| (man0.dir + 2) % 4}[0].move(field)
      end
      persons.delete(man) if flag
    end
    
    break if t > 180
    break if persons.empty?
    t += 1
  end
  
  puts (t > 180) ? "NA" : t
end


Measured memory_bytes: 6904
/*
 * template.cpp
 *
 *  Created on: 2016/10/30
 *      Author: LitMc
 */
#define MYDEBUG
#include <iostream>
#include <vector>

#ifdef MYDEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif
#define LL long long
#define ULL unsigned long long
#define eps 1e-14
using std::max;
using std::min;
using std::swap;
using std::cout;
using std::cin;
using std::ostream;
using std::vector;
using std::endl;

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last)
      out << ",";
  }
  out << "]";
  return out;
}

class Main {
public:
  void sample() {
    cout << "-------------this is sample program.----------------" << endl;
  }
  void ABC047_A(){
	  int a,b,c;
	  cin >> a >> b >> c;
	  if(a==(b+c)) printf("Yes");
	  else if(b==(c+a)) printf("Yes");
	  else if(c==(a+b)) printf("Yes");
	  else printf("No");
  }
  
  void ABC047_B(){
	  int W,H,N;
	  cin >> W >> H >> N;
	  vector<vector<int> > rect();
	  
	  for(int i=0; i<N; ++i){
		  
	  }
  }
  
  void ABC046_A(){
	  int n,k,x,y;
	  cin >> n >> k >> x >> y;
	  int ans;
	  if(n<=k){
		ans = n*x;
	  }else{
		ans = k*x + (n-k)*y;
	  }
	  cout << ans << endl;
  }
};

int main() {
	Main m;
	m.ABC046_A();
}


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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define PI (acos(-1.0))
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    int n;
    cin >> n;

    vector<int> a(n + 1);

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

    map<int, int> m;
    bool ans = false;
    int index = 1;

    while(true){
        if(index == 2){
            ans = true;
            break;
        }

        m[index]++;

        if(m[index] == 2){
            break;
        }

        index = a[index];
    }

    if(ans){
        cout << m.size() << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 5376
#include<iostream>
using namespace std;
int main(){
    int x, s2, n, arr[4][13] = {{},{},{},{}};
    cin >> x;
    char s, suit[] = {'S', 'H', 'C', 'D'};
    for(int i = 0; i < x; i++){
        cin >> s >> n;
        switch(s){
            case 'S': s2 = 0; break;
            case 'H': s2 = 1; break;
            case 'C': s2 = 2; break;
            default: s2 = 3;
        }
        arr[s2][n-1] = 1;
    }

    for(int i = 0; i < 4; i++)
        for(int j = 0; j < 13; j++)
            if(arr[i][j] == 0)
                cout << suit[i] << " " << (j + 1) << endl;
    return 0;
}


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int long long
const int N=100010;
using namespace std;

int n,a[N],ans;
signed main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++)
        if(a[i]==a[i-1])
			ans++;
    if(ans%2==1)ans++;
    cout<<n-ans<<"\n";
	return 0;
}

Measured memory_bytes: 1024
import sys
N, Y = list(map(int, input().split()))

for i in range(N+1):
  for j in range(N+1):
    z = N - i - j
    if i+j+z > N or z < 0:
      continue

    if 10000*i + 5000*j + 1000*z == Y:
      print("{0} {1} {2}".format(i,j,z))
      sys.exit()

print("-1 -1 -1")

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define rep(i, N) for(i = 0; i < N; i++)
#define ll long long

int main() {
  ll A, B, C, K;
  cin >> A >> B >> C >> K;

  ll ktmp = K;
  ll ans = 0;
  if(ktmp - A > 0) {
    ans += A;
    ktmp -= A;
  } else {
    cout << K;
    return 0;
  }

  if(ktmp - B > 0) {
    ktmp -= B;
  } else {
    cout << ans;
    return 0;
  }

  ans -= ktmp;
  cout << ans;

  return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>

int main(void){
    int i,n;
    int a[100];
    
    scanf("%d",&n);
    
    for(i=0; i<n; i++){
        scanf("%d",&a[i]);
    }
    
    for(i=n-1; i>=1; i--){
        printf("%d ",a[i]);
    }
    printf("%d",a[i]);
    printf("\n");
    return 0;
}

Measured memory_bytes: 600
#include <stdio.h>

int main()
{
	int r, g, b, n;

	scanf("%d %d %d", &r, &g, &b);

	n = 0;
	n = 100 * r + 10 * g + b;

	if (n % 4 == 0)
		printf("YES\n");
	else
		printf("NO\n");

	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

/**
 * 
 */

/**
 * @author kawakami
 *
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner as = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		
		int n = 0;
		int itikoumae = 0;
		int nikoumae = 0;
		int fibo = 0;
		
		n = Integer.parseInt(as.next());
		
		for(int i=1;i<=n;i++){
			
			if(i == 1){
				
				fibo = 1;
				itikoumae = 1;
				nikoumae = 1;
				
			}
			else{
				
				fibo = itikoumae + nikoumae;
				nikoumae = itikoumae;
				itikoumae = fibo;
				
			}
			         
		}
		
		sb.append(String.valueOf(fibo));
		System.out.println(sb);

	}

}

Measured memory_bytes: 26024
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define endl "\n"
#define int long long
#define pb push_back
#define getMat(v, n, m, val) vector<vector<int>> v(n,vector<int>(m, val))
#define lb lower_bound
#define ub upper_bound
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define ar array
using namespace std;
const int mod = 1e9+7;
const int mxN = 1e5+5;

int p[mxN];

int find(int x){
    return (x^p[x])?(p[x]=find(p[x])):x;
}

int join(int x, int y){
    if((x=find(x))==(y=find(y))){
        return 0;
    }

    p[x] = y;
    return 1;
}

int32_t main(){
    fastio;
    int n, m;
    cin >> n >> m;
    for(int i=1; i<=n; i++) p[i] = i;

    for(int i=0; i<m; i++){
        int u, v; cin >> u >> v;
        join(u,v);
    }
    
    unordered_set<int> s;
    int g = 0, maxi = 0;
    for(int i=1; i<=n; i++){
        p[i] = find(i);
        s.insert(p[i]);
    }
    cout << sz(s)-1 << endl;
    return 0;
}

Measured memory_bytes: 7388
n, m = map(int, input().split())
hasAC = [False] * n #AC or WAの配列を用意
wa = [0] * n #waの回数を格納
a = 0
b = 0

for _ in range(m):
    p, s = map(str, input().split())

    p = int(p) - 1
    if s == 'AC':    
        hasAC[p] = True
    else:
        if not hasAC[p]:
            wa[p] += 1

for i in range(n):
    if hasAC[i]:
        a += 1
        b += wa[i]

print(a, b)

Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define ll long long
ll matrix [250][250]= {LLONG_MAX/10};
int r;
int arr[210];
int rnd()
{
    return rand()%r;
}
using namespace std;
void floyd()
{
    for (int k=0; k<250; k++)
    {
        for (int i=0; i<250; i++)
        {
            for (int j=0; j<250; j++)
            {
                matrix[i][j]=min(matrix[i][j], matrix[i][k]+matrix[k][j]);
            }
        }
    }
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    int n,m;
    cin>>n>>m>>r;
    for (int i=0; i<r; i++)
    {
        cin>>arr[i];
    }

    int from=0, to=0, l=0;
    ll inf = 922337203685477580;
    for (int i =0; i<250; i++)
        for (int j =0; j<250; j++)
        {
            matrix[i][j]=inf;
            matrix[i][i]=0;
        }
    for (int i =0; i<m; i++)
    {
        cin>>from>>to>>l;
        matrix[from][to]=l;
        matrix[to][from]=l;
    }
    ll ans=inf;
    floyd();
    sort(arr,arr+r);
    do
    {
        ll sum=0;
        for(int i=0; i<r-1; i++)
        {
            sum+=matrix[arr[i]][arr[i+1]];
        }
        ans=min(ans,sum);
    }
    while(next_permutation(arr,arr+r));
    cout<<ans;
    return 0;
}


Measured memory_bytes: 768
S = input()

N = len(S)
RL = []
LR = [-1]
ans = [0 for _ in range(N)]

for i in range(N-1):
    if S[i] == 'R' and S[i+1] == 'L':
        RL.append(i)
    elif S[i] == 'L' and S[i+1] == 'R':
        LR.append(i)
LR.append(N-1)
#print(RL, LR)

num = []
for i in range(len(LR)-1):
    num.append(LR[i+1] - LR[i])
#print(num)

for i in range(len(RL)):
    if num[i] % 2 == 0:
        ans[RL[i]] = num[i] // 2
        ans[RL[i]+1] = num[i] // 2
    else:
        if (LR[i+1] - RL[i]) % 2 == 0:
            ans[RL[i]] = num[i] // 2 + 1
            ans[RL[i]+1] = num[i] // 2
        else:
            ans[RL[i]] = num[i] // 2
            ans[RL[i]+1] = num[i] // 2 + 1

print(' '.join(map(str, ans)))

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

int main() {
  #define rep(i, n) for(int i = 0; i < (int)(n); i++)

  int N;
  cin>>N;
  vector<vector<int64_t>> b(N,vector<int64_t>(60));
  int64_t a;
  rep(i,N){
    cin>>a;
    rep(j,60){
      b[i][j]=a%2;
      a=a/2;
    }
  }
  int64_t s=0,t=0, u=1,v=0;
  int64_t p=1000000007;
  rep(j,60){
    rep(i,N){
      if(b[i][j]==1){
        s++;
      }
    }
    t+=(((N-s)*s)%p)*u;
    t=t%p;
    s=0;
    u=(u*2)%p;
  }
  cout<<t;
}

Measured memory_bytes: 152576
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int train[] = new int[1000];
    int counter = 0;
    while (sc.hasNext()) {
      int command = sc.nextInt();
      if (command == 0) {
        counter--;
        System.out.println(train[counter]);
        train[counter] = 0;
      }
      else {
        train[counter] = command;
        counter++;
      }
    }
  }
}

Measured memory_bytes: 12000
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	for (;;) {
		int N; cin >> N;
		if (N == 0) break;
		vector< vector<bool> > a(N, vector<bool>(N));
		for (int i = 0; i < N; i++) {
			int M; cin >> M;
			while (M--) {
				int p; cin >> p; p--;
				a[i][p] = true;
			}
		}
		vector<bool> b(N);
		int K; cin >> K;
		while (K--) {
			int l; cin >> l; l--;
			b[l] = true;
		}
		vector<int> v;
		for (int i = 0; i < N; i++) {
			bool flag = true;
			for (int j = 0; j < N; j++)
				if (!a[i][j] && b[j]) flag = false;
			if (flag) v.push_back(i);
		}
		cout << (v.size() == 1 ? v[0] + 1 : -1) << endl;
	}
}

Measured memory_bytes: 1232
#include <stdio.h>
#include <assert.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <assert.h>
using namespace std;
typedef int ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
const ll UNDEF = -1;
const ll INF=1e9;
template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return a > b ? a = b, true : false; }
const ll MAXN=2004;
vector<ll> g[MAXN];
ll dp[2][MAXN];
ll n;
ll dfs(ll x, ll p, ll chance, ll depth, ll lim) {
	if (dp[chance][x]!=UNDEF) return dp[chance][x];
	ll ans=(depth>lim+chance)?1:0;
	for (auto &w:g[x]) {
		if (w==p) continue;
		ans+=dfs(w,x,chance,depth+1,lim);
	}
	dp[chance][x]=ans;
	return ans;
}
int main() {
	ios_base::sync_with_stdio(false);
	ll best=INF;
	ll k; scanf("%d %d",&n,&k);
	for (ll i=0;i<n-1;i++) {
		ll a,b; scanf("%d %d",&a,&b); a--;b--;
		g[a].PB(b); g[b].PB(a);
	}
	for (ll x=0;x<n;x++) {
		ll lim=k/2;
		ll cand=0;
		for (ll c=0;c<2;c++) for (ll x=0;x<n;x++) dp[c][x]=UNDEF;
		if (k%2) {
			ll woof=0;
			for (auto &w:g[x]) {
				woof+=dfs(w,x,0,1,lim);
			}
			ll bestminus=0;
			for (auto &w:g[x]) {
				chkmin(bestminus,dfs(w,x,1,1,lim)-dfs(w,x,0,1,lim));
			}
			cand=woof+bestminus;
		}
		else {
			cand=dfs(x,-1,0,0,lim);
		}
		chkmin(best,cand);
	}
	printf("%d\n",best);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


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

    vector<P> bat(m);


    int itr_f = 1;
    int itr_l = n;
    int sw = 0;
    rep(i, m){
        bat[i].first = itr_f;
        bat[i].second = itr_l-sw;
        itr_f++;
        itr_l--;
        if(itr_l-itr_f <= n/2 && n%2 == 0){
            sw = 1;
        }
    }

    rep(i, m){
        cout << bat[i].first << " " << bat[i].second << endl;
    }


}



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

int main(void) {
  int n;
  cin >> n;
  
  vector<int> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  
  int maxN = -1, maxI = -1;
  for(int i = 0; i < n; i++) {
    if(maxN < a[i]) {
      maxN = a[i];
      maxI = i;
    }
  }
  
  for(int i = 0; i < n; i++) {
    if(i != maxI) {
      cout << maxN << endl;
    } else {
      a[maxI] = -1;
      cout << *max_element(a.begin(), a.end()) << endl;
    }
  }
  
  
  return 0;
}

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

int main() {
	// your code goes here
	int n, k;
	cin >> n >> k;
	int arr[n];
	for(int i = 0; i < n; ++i) {
	    cin >> arr[i];
	}
	long long dp[n];
	dp[0] = 0;
	for(int i = 1; i < n; ++i) {
	    dp[i] = INT_MAX;
	    for(int j = 1; j <= k; ++j) {
	        if(i-j >= 0)
	            dp[i] = min(dp[i], abs(arr[i] - arr[i-j]) + dp[i-j]);
	    }
	}
	//cout << endl;
	cout << dp[n-1] << endl;
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Rep(i, N) for(int i = 0; i < N; i++)
#define Reps(i, x, N) for(int i = x; i < N; i++)

typedef pair<int, int> Pi;
#define fi first
#define se second

const int LLINF = 1LL << 60;

signed main()
{
  int H, W, N;
  
  while(cin >> N, N) {
    
    int sum[505][505] = {0};
    cin >> W >> H;
    
    int x, y;
    Rep(i, N) {
      cin >> x >> y;
      sum[y][x] = 1;
    }
    Reps(i, 1, H + 1) {
      Reps(j, 1, W + 1) {
	sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + sum[i][j];
      }
    }
    
    int maxv = -LLINF;
    int S, T;
    cin >> S >> T;
    
    Reps(i, T, H + 1) {
      Reps(j, S, W + 1) {
	maxv = max(maxv, sum[i][j] - sum[i - T][j] - sum[i][j - S] + sum[i - T][j - S]);
      }
    }
    
    cout << maxv << endl;
  }
  return 0;
}

Measured memory_bytes: 5088
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


class Levenshtein:
    def init_array(self, str1, str2):
        distance = []
        for i in range(len(str1)+1):
            distance.append([0] * (len(str2) + 1))
            distance[i][0] = i
        for j in range(len(str2)+1):
            distance[0][j] = j
        return distance

    def edit_dist(self, str1, str2, distance):
        dist = [0] * 3
        for i in range(1, len(str1)+1):
            for j in range(1, len(str2)+1):
                dist[0] = distance[i-1][j-1] if str1[i-1] == str2[j-1] else distance[i-1][j-1] + 1
                dist[1] = distance[i][j-1] + 1
                dist[2] = distance[i-1][j] + 1
                distance[i][j] = min(dist)
        return distance[i][j]

    def __init__(self, str1, str2):
        self.str1 = str1
        self.str2 = str2
        Levenshtein.distance = self.init_array(str1, str2)
        Levenshtein.dist = self.edit_dist(str1, str2, Levenshtein.distance)


def main():
    s1 = INPUT()
    s2 = INPUT()

    leven = Levenshtein(s1, s2)
    print(leven.dist)


if __name__ == '__main__':
    main()


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

int main() {
    vector<int> a = {
        1, 1, 1, 2, 1, 2,
        1, 5, 2, 2, 1, 5,
        1, 2, 1, 14, 1, 5,
        1, 5, 2, 2, 1, 15,
        2, 2, 5, 4, 1, 4, 1, 51
        };
    int k;
    cin >> k;
    cout << a.at(k-1) << endl;
}

Measured memory_bytes: 256
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,m;
  cin>>n>>m;
  if(n>m){
    rep(i,n) cout<<m;
  }else{
    rep(i,m) cout<<n;
  }
  cout<<endl;
}

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

int p[222222];

int main(void)
{
	int n, a, i;

	scanf("%d" ,&n);
	for (i = 1; i <= n; i++)
	{
		scanf("%d" ,&a);
		p[a] = i;
	}

	int change = 1, ans = 1;
	for (i = 1; i <= n; i++)
		if (p[i] < p[i + 1])
			change++;
		else
		{
			ans = max(ans, change);
			change = 1;
		}

	printf("%d" ,n - ans);
	return 0;
}

Measured memory_bytes: 896
import itertools

n, m, r = map(int, input().split())
R = list(map(int, input().split()))

DP = [[10**10 for _ in range(n+1)] for _ in range(n+1)]
for i in range(1,n+1):
    DP[i][i] = 0

for _ in range(m):
    a, b, c = map(int, input().split())
    DP[a][b] = c
    DP[b][a] = c

for k in range(1,n+1):
    for i in range(1,n+1):
        for j in range(1,n+1):
            DP[i][j] = min(DP[i][j], DP[i][k]+DP[k][j])

ans = 10**10
for permutation in itertools.permutations(R, r):
    dist = 0
    for i in range(r-1):
        dist += DP[permutation[i]][permutation[i+1]]
    ans = min(ans, dist)

print(ans)

Measured memory_bytes: 47960
import java.util.*;
import java.awt.geom.*;
import java.awt.geom.Line2D.Double;

import static java.lang.Math.*;
public class Main {
	final Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		new Main().init();
	}
	void init(){
		new AOJ1157();
	}
	
	class AOJ1157{
		AOJ1157(){
			while(sc.hasNext()){
				int n=sc.nextInt();
				if(n==0)	break;
				solve(n);
			}
		}
		void solve(int n){
			Line2D.Double l=new Line2D.Double(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());
			double ans=100000;
			for(int i=0; i<n; ++i){
				int x1=sc.nextInt(),y1=sc.nextInt(),x2=sc.nextInt(),y2=sc.nextInt(),h=sc.nextInt();
				if(x1<=l.getX1()&&l.getX1()<=x2 && x1<=l.getX2()&&l.getX2()<=x2 && y1<=l.getY1()&&l.getY1()<=y2 && y1<=l.getY2()&&l.getY2()<=y2)	ans=0;
				if(ans<=0)	continue;
				Line2D.Double[] rec=new Line2D.Double[4];
				rec[0]=new Line2D.Double(x1,y1,x2,y1);
				rec[1]=new Line2D.Double(x1,y1,x1,y2);
				rec[2]=new Line2D.Double(x2,y2,x2,y1);
				rec[3]=new Line2D.Double(x2,y2,x1,y2);
				double d = 100000;
				for(int j=0; j<4; ++j)	d=min(d,segSegDist(rec[j], l));
				ans=min(ans, (d==0? 0: (d<=h? d: ((d*d+h*h)/(2*h))) ));
//				System.out.println("d:"+d+" h:"+h+" r:"+ ((d*d+h*h)/2*h)+" ans:"+ans);
			}
			System.out.println(ans);
		}
		double segSegDist(Line2D l1,Line2D l2){
			return l1.intersectsLine(l2)? 0 :Math.min(Math.min(l1.ptSegDist(l2.getP1()), l1.ptSegDist(l2.getP2())) , Math.min(l2.ptSegDist(l1.getP1()), l2.ptSegDist(l1.getP2())));
		}
		String lineToStr(Line2D l){
			return "Line2D "+l.getP1()+"-"+l.getP2();
		}
	}
}

Measured memory_bytes: 44680
#include <iostream>
#define rep(S, L) for (int i = S; i < L; ++i)
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  if (b % a == 0) {
    cout << a + b << endl;
  } else {
    cout << b - a << endl;
  }
  return 0;
}


Measured memory_bytes: 3152
n = gets.chomp.to_i
#a,b = gets.chomp.split().map(&:to_i)


six = []
yen = 6
while yen <= 100000
  six.push yen
  yen *= 6
end

nine = []
yen = 9
while yen <= 100000
  nine.push yen
  yen *= 9
end

six.sort!
six.reverse!
nine.sort!
nine.reverse!

sixsize = six.size
ninesize = nine.size

ans = Float::INFINITY
q = [[n, 0, 0, 0]]
until q.empty?
  n, sixc, ninec, count = q.pop
  # p [n, sixc, ninec, count]
  if n < 6
    ans = [ans, count + n].min
    next
  end
  while sixc < sixsize && six[sixc] > n
    sixc += 1
  end
  while  ninec < ninesize && nine[ninec] > n
    ninec += 1
  end

  q.push [n - six[sixc], sixc, ninec, count + 1] if sixc < sixsize
  q.push [n - nine[ninec], sixc, ninec, count + 1] if ninec < ninesize
end

puts ans


Measured memory_bytes: 1916
#include<stdio.h>
int partition(int a[],int p,int r){
  int x,i,j,v;
  x=a[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(a[j]<=x){
      i++;
      v=a[i];
      a[i]=a[j];
      a[j]=v;
    }
  }
  v=a[i+1];
  a[i+1]=a[r];
  a[r]=v;
  return i+1;
}

int main(){
  int i,n,a[100000],p;

  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&a[i]);
  p=partition(a,0,n-1);
  for(i=0;i<n-1;i++){
    if(i==p)printf("[%d] ",a[i]);
    else printf("%d ",a[i]);
  }
  if(n-1==p)printf("[%d]\n",a[n-1]);
  else printf("%d\n",a[n-1]);
  return 0;
}



Measured memory_bytes: 2188
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<ll> v(n+1);
    FOR(i,1,n+1){
      cin>>v[i];
      v[i] += v[i-1];
    }


    ll dif = 1e9;
    FOR(i,0,n+1){
      dif = min(dif, abs((v[i] - v[0]) - (v[n] - v[i])));
    }
    cout<<dif<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<cstdlib>
#include<algorithm>

using namespace std;

struct point {
  int x,y,index;
};

//struct neighbor{
//  point 
//};

const int MAX_E = 400001;
struct edge{ int u, v, cost; };
edge es[MAX_E];
int V, E; // 頂点数と辺数

//--------Union-Find木------------
vector<int> par; // 親
vector<int> rnk; // 深さ

// Union-Find木の初期化
void init_union_find(int n) {
  par  = vector<int>(n);
  rnk = vector<int>(n);
  for (int i = 0; i < n; i++) {
    par[i] = i;
    rnk[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 (rnk[x] < rnk[y]) {
    par[x] = y;
  } else {
    par[y] = x;
    if (rnk[x] == rnk[y]) rnk[x]++;
  }
}

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

//----------クラスカル法------------
bool comp(const edge& e1, const edge& e2) {
  return e1.cost < e2.cost;
}
int kruskal() {
  sort(es, es + E, comp); // edge.costの小さい順
  init_union_find(V); // Union-Findの初期化
  int res = 0;
  for (int i = 0; i < E; i++) {
    edge e = es[i];
    if (!same(e.u, e.v)) {
      unite(e.u, e.v);
      res += e.cost;
    }
  }
  return res;
}


bool compareX(const point &a, const point &b){
  return a.x < b.x;
}

bool compareY(const point &a, const point &b){
  return a.y < b.y;
}

int main(){
  int N;
  cin>>N;
  vector<point> data(N);
  for(int i=0;i<N;i++){
    cin>>data[i].x>>data[i].y;
    data[i].index=i;
  }
  vector<point> dataX,dataY;
  copy(data.begin(),data.end(),back_inserter(dataX));
  copy(data.begin(),data.end(),back_inserter(dataY));

  sort(dataX.begin(),dataX.end(),compareX);
  sort(dataY.begin(),dataY.end(),compareY);

  //vector<Edge> edges;
  //struct edge{ int u, v, cost; };
  //  int x,y,index;
  V = N;E = 0;
  for(int i=0;i<dataX.size()-1;i++){
    es[E].u=dataX[i].index;
    es[E].v=dataX[i+1].index;
    es[E].cost=min(abs(dataX[i].x-dataX[i+1].x),abs(dataX[i].y-dataX[i+1].y));
    E++;
  }
  for(int i=0;i<dataY.size()-1;i++){
    es[E].u=dataY[i].index;
    es[E].v=dataY[i+1].index;
    es[E].cost=min(abs(dataY[i].x-dataY[i+1].x),abs(dataY[i].y-dataY[i+1].y));
    E++;
  }
  int cost = kruskal();
  cout << cost <<endl;
  return 0;
  
}


Measured memory_bytes: 8564
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

vector<ll> prime(int n)
{
    vector<bool> num;
    vector<ll> p;

    for (int i = 0; i <= n + 10; i++)
        num.push_back(true);

    FOR(i, 2, n)
    {
        if (!num[i])
            continue;

        p.push_back(i);

        for (int j = i * 2; j <= n; j += i)
        {
            num[j] = false;
        }
    }

    return p;
}

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

    ll n;
    cin >> n;

    ll res = 0;

    for (ll i = 1; i <= sqrt(n); i++)
    {
        if (n % i)
            continue;

        ll k = i;
        ll m1 = n / k;
        ll m = m1 - 1;

        if (k < m)
            res += m;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IL inline
#define _ 3005
#define ll long long
using namespace std ;

IL int gi(){
    int data = 0 , m = 1; char ch = 0;
    while(ch!='-' && (ch<'0'||ch>'9')) ch = getchar();
    if(ch == '-'){m = 0 ; ch = getchar() ; }
    while(ch >= '0' && ch <= '9'){data = (data<<1) + (data<<3) + (ch^48) ; ch = getchar(); }
    return (m) ? data : -data ; 
}

#define mod 1000000007
IL int Pow(int ts , int js) {
	int al = 1 ;
	while(js) {
		if(js & 1) al = 1ll * al * ts % mod ; js >>= 1 ;
		ts = 1ll * ts * ts % mod ; 
	}return al ;
}
int n , Q , A[_] , f[_][_] , Ans , inv2 ; 

int main() {
	n = gi() ; Q = gi() ;
	for(int i = 1; i <= n; i ++) A[i] = gi() ;
	for(int i = 1; i <= n; i ++)
		for(int j = 1; j <= n; j ++) f[i][j] = (A[i] > A[j]) ;
	int x , y ; inv2 = (mod + 1) >> 1 ; 
	for(int sq = 1 ; sq <= Q; sq ++) {
		x = gi() ; y = gi() ;
		for(int i = 1; i <= n; i ++) if(i != x && i != y) f[x][i] = f[y][i] = 1ll * (f[x][i] + f[y][i]) * inv2 % mod ;
		for(int i = 1; i <= n; i ++) if(i != x && i != y) f[i][x] = f[i][y] = 1ll * (f[i][x] + f[i][y]) * inv2 % mod ;
		int sum = f[x][y] + f[y][x] ;
		f[x][y] = f[y][x] = 1ll * sum * inv2 % mod ;
	}
	Ans = 0 ;
	for(int i = 1; i <= n; i ++)
		for(int j = i + 1; j <= n; j ++) Ans = (Ans + f[i][j]) % mod ;
	printf("%lld\n" , 1ll * Ans * Pow(2 , Q) % mod) ;
	return 0 ;
}


Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll ara[144];
int main()
{
    ll k;cin>>k;
    ll q=k/50;
    ll mod=k%50;
    cout<<50<<endl;
    for(int i=0;i<50;i++)
    {
        ara[i]=49+q;
    }
    for(int i=0;i<mod;i++)
    {
        ara[i]++;
    }
    for(ll i=mod;i<50;i++)
    {
        ara[i]-=mod;
    }
    cout<<ara[0];
    for(int i=1;i<50;i++)cout<<" "<<ara[i];
    cout<<endl;
}


Measured memory_bytes: 256
//#pragma GCC target ("avx2")
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long

using namespace std;
using namespace __gnu_pbds;

template <class T> using ordered_set =
tree<T, null_type, less<T>,
rb_tree_tag, tree_order_statistics_node_update>;

const int N = (int)(1e6 + 5);
const int M = (int)(1e9 + 7);
const int INF = (int)(1e18 + 9);
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};

signed main() {
  ios_base :: sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector <int> a(n);
  for (int i = 0; i < n; ++i)
    cin >> a[i];
  vector <int> pref(n);
  pref[0] = a[0];
  for (int i = 1; i < n; ++i)
    pref[i] = pref[i - 1] + a[i];
  map <int, int> have;
  int ret = 0;
  for (int i = 0; i < n; ++i) {
    ret += have[pref[i]];
    ret += (pref[i] == 0);
    ++have[pref[i]];
  }
  cout << ret;
  return 0;
}


Measured memory_bytes: 15872
#include <iostream>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define rng(a) a.begin(),a.end()
typedef long long ll;

using namespace std;

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

ll lcm(ll c, ll d){
    return c*d/gcd(max(c,d),min(c,d));
}

int main() {
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll Cd,Dd,CDd,CDl;
    Cd = b/c-(a-1)/c;
    Dd = b/d-(a-1)/d;
    CDl = lcm(c,d);
    CDd = b/CDl - (a-1)/CDl;
    ll ans;
    ans = (b-a+1) - (Cd+Dd-CDd);
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
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; }
ll mod = 1e9+7;


int main(){
   ll a,b,k; cin >> a >> b >> k;
   if(a<=k){
        if(b>(k-a)){
            b -= (k-a);
        }else{
            b = 0;
        }
       a = 0;
   }else{
        a -= k;
   }
   cout << a << " " << b << endl;
}

Measured memory_bytes: 256