akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

int main(void){
    ll a,b,c,d;
    string s,t;

    cin >> a >> b>> c;// >> d;
    //cin >> s >> t;
    if (a == b) cout << c << endl;
    if (c == b) cout << a << endl;
    if (c == a) cout << b << endl;


    return 0;
}

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

int main(){
  for(int i = 0; i < 20000; i++){
    int a, b;
    string op;
    cin >> a >> op >> b;
    if(op == "+"){
      cout << a + b << endl;
    }
    else if(op == "-"){
      cout << a - b << endl;
    }
    else if(op == "*"){
      cout << a * b << endl;
    }
    else if(op == "/"){
      cout << a / b << endl;
    }
    else if(op == "?"){
      break;
    }
  }
}



Measured memory_bytes: 3136
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
int my_builtin_popcount(ll x) { int c = 0; do { if (x & 1)c++; } while (x >>= 1); return c; }
#define N 500000
int n, q, t[N << 2], lev[N];
char s[N];
void update(int k)
{
	t[k] = t[k << 1] | t[k << 1 | 1];
}
void build(int l, int r, int k)
{
	if (l == r)
	{
		lev[l] = k;
		t[k] = 1 << (s[l] - 'a'); return;
	}
	int m = l + r >> 1;
	build(l, m, k << 1); build(m + 1, r, k << 1 | 1);
	update(k);
}
void fix(int x, char c)
{
	if (s[x] == c) return;
	s[x] = c;
	x = lev[x];
	t[x] = 1 << (c - 'a');
	while (x >>= 1) update(x);
}
int query(int l, int r, int k, int x, int y)
{
	if (r<x || l>y) return 0;
	if (l >= x && r <= y) return t[k];
	int m = l + r >> 1;
	return query(l, m, k << 1, x, y) | query(m + 1, r, k << 1 | 1, x, y);
}
int main()
{
	scanf("%d%s", &n, s + 1);
	build(1, n, 1);
	scanf("%d", &q);
	while (q--)
	{
		int opt; scanf("%d", &opt);
		if (opt == 1)
		{
			int x; char c;
			scanf("%d %c", &x, &c);
			fix(x, c);
		}
		else
		{
			int l, r; scanf("%d%d", &l, &r);
			printf("%d\n", my_builtin_popcount(query(1, n, 1, l, r)));
		}
	}
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int h,w,k;
  cin>>h>>w>>k;
  vector<string> st(h);
  for(int i=0;i<h;i++) cin>>st[i];

  vector<int> cnt(h,0);
  int s=1<<(h-1);
  int ans=h*w;
  for(int b=0;b<s;b++){
    int num=__builtin_popcount(b)+1;
    vector<vector<int>> cnt(num,vector<int>(w));
    for(int j=0;j<w;j++){
      int p=0;
      for(int i=0;i<h;i++){
        cnt[p][j]+=st[i][j]-'0';
        if((b>>i)&1) p++;
      }
    }
    {
      int flg=0;
      for(int i=0;i<num;i++)
        for(int j=0;j<w;j++)
          if(cnt[i][j]>k) flg=1;
      if(flg) continue;
    }

    int res=num-1;
    vector<int> sum(num,0);
    for(int j=0;j<w;j++){
      int flg=0;
      for(int i=0;i<num;i++){
        sum[i]+=cnt[i][j];
        flg|=sum[i]>k;
      }
      if(!flg) continue;

      res++;
      for(int i=0;i<num;i++)
         sum[i]=cnt[i][j];
    }
    chmin(ans,res);
  }

  cout<<ans<<newl;
  return 0;
}


Measured memory_bytes: 384
from typing import Any,Sequence
import  copy


def selectionSort(A:Sequence, N:int) -> None:

    for i in range(0, N - 1):
        minj = i
        for j in range(i + 1, N):
            if A[j][1] < A[minj][1]:
                minj = j

        A[i], A[minj] = A[minj], A[i]



def bubble_sort(A:Sequence, N:int) -> None:

    for i in range(N):
        for j in range(N - 1, i, -1):
            if A[j][1] < A[j -1][1]:

                A[j], A[j - 1] = A[j - 1], A[j]


def bool_isStable(C1:Sequence, C2:Sequence, N:int) -> bool:
    for i in range(N):
        if C1[i] != C2[i]:
            return False
    return  True


n = int(input())
B = list(map(str, input().split()))
C1 = n * []
C2 = n * []

C1 = copy.copy(B)
C2 = copy.copy(B)


bubble_sort(C1, n)
selectionSort(C2, n)


print(' '.join(map(str, C1)))
print('Stable')


print(' '.join(map(str, C2)))
if bool_isStable(C1, C2, n) == True:
    print('Stable')
else:
    print('Not stable')



Measured memory_bytes: 7168
N, M, Q = map(int, input().split())

dp = [[0 for col in range(N)] for row in range(N)]

for i in range(M):
    l, r = map(int, input().split())
    dp[l-1][r-1]+=1

for i in range(N):
    for j in range(N)[:-1]:
        dp[i][j+1] += dp[i][j]
        
for i in range(N)[:0:-1]:
    for j in range(N):
        dp[i-1][j] += dp[i][j]

results = []

for i in range(Q):
    l, r = map(int, input().split())
    results.append(dp[l-1][r-1])

for result in results:
    print(result)


Measured memory_bytes: 67160
use std::io;
use std::str::FromStr;

static INF: usize = 1_000_000_000_000_000;

fn input_tuple() -> (usize, usize, usize, usize) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<usize> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1], vec[2], vec[3])
}

use std::cmp::Ordering;
use std::collections::BinaryHeap;
use std::usize;

#[derive(Copy, Clone, Eq, PartialEq)]
struct State {
    cost: usize,
    position: usize,
}

impl Ord for State {
    fn cmp(&self, other: &State) -> Ordering {
        other.cost.cmp(&self.cost)
            // .then_with(|| self.position.cmp(&other.position))
    }
}

impl PartialOrd for State {
    fn partial_cmp(&self, other: &State) -> Option<Ordering> {
        Some(self.cmp(other))
    }
}

#[derive(Clone)]
struct Edge {
    node: usize,
    cost: usize,
}

// Dijkstra's shortest path algorithm.
// https://doc.rust-lang.org/std/collections/binary_heap/#examples
fn shortest_path(adj_list: &Vec<Vec<Edge>>, start: usize) -> Vec<usize> {
    let mut dist: Vec<usize> = (0..adj_list.len()).map(|_| usize::MAX).collect();

    let mut heap = BinaryHeap::new();

    dist[start] = 0;
    heap.push(State { cost: 0, position: start });

    while let Some(State { cost, position }) = heap.pop() {
        if cost > dist[position] { continue; }

        for edge in &adj_list[position] {
            let next = State { cost: cost + edge.cost, position: edge.node };

            if next.cost < dist[next.position] {
                heap.push(next);
                dist[next.position] = next.cost;
            }
        }
    }

    dist
}

fn main() {
    let (n, m, s, t) = input_tuple();
    let mut yen_edges: Vec<Vec<Edge>> = vec![Vec::new(); n];
    let mut snuke_edges: Vec<Vec<Edge>> = vec![Vec::new(); n];
    for _ in 0..m {
        let (u, v, a, b) = input_tuple();
        yen_edges[u - 1].push(Edge { node: v - 1, cost: a });
        yen_edges[v - 1].push( Edge { node: u - 1, cost: a});
        snuke_edges[u - 1].push(Edge { node: v - 1, cost: b});
        snuke_edges[v - 1].push(Edge { node: u - 1, cost: b});
    }

    let yen_dist: Vec<usize> = shortest_path(&yen_edges, s - 1);
    let snuke_dist: Vec<usize> = shortest_path(&snuke_edges, t - 1);
    // println!("{:?}", yen_dist);
    // println!("{:?}", snuke_dist);
    let mut shortest_paths: Vec<usize> = Vec::new();
    shortest_paths.push(INF);
    for i in (0..n).rev() {
        let cost = yen_dist[i] + snuke_dist[i];
        let last = *shortest_paths.last().unwrap();
        if cost < last {
            shortest_paths.push(cost);
        } else {
            shortest_paths.push(last);
        }
    }
    shortest_paths.remove(0);
    shortest_paths.reverse();
    for cost in shortest_paths {
        println!("{}", 1_000_000_000_000_000 - cost);
    }
}


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

#define ll long long
#define ld long double

void solve() {
	int n, count = 0;
	cin >> n;
	ll l[n];
	for (int i = 0; i < n; ++i) 
		cin >> l[i];
	sort(l, l + n);
	if (n < 3) {
		count = 0;
	} else {
		for (int i = 0; i < n - 2; ++i)	{
			for (int j = i + 1; j < n - 1; ++j) {
				if (l[i] + l[j] >= l[j+1]) {
					for (int k = j + 1; k < n; ++k) {
						if (l[i] + l[j] > l[k] && l[i] != l[j] && l[j] != l[k] && l[i] != l[k])
							count++;
					}
				}
			}
		}
	}
	cout << count << endl;
}

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

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m,c;
  int b[105],a[105][105];
  int ans=0,sum=0;
  cin>>n>>m>>c;
  for(int i=0;i<m;i++){
  cin>>b[i];
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin>>a[i][j];
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      sum+=b[j]*a[i][j];
    }
    if(sum+c>0) ans++;
    sum=0;
  }
  cout<<ans<<endl;
  return 0;
}
  


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int a,b,ans;
  scanf("%d %d",&a,&b);
  if (a > 11 && b > 11) {
    ans = 12;
  } else if (a > 11 || (a > 10 && b > 10)) {
    ans = 11;
  } else if (a > 10 || (a > 9 && b > 9)) {
    ans = 10;
  } else if (a > 9 || (a > 8 && b > 8)) {
    ans = 9;
  } else if (a > 8 || (a > 7 && b > 7)) {
    ans = 8;
  } else if (a > 7 || (a > 6 && b > 6)) {
    ans = 7;
  } else if (a > 6 || (a > 5 && b > 5)) {
    ans = 6;
  } else if (a > 5 || (a > 4 && b > 4)) {
    ans = 5;
  } else if (a > 4 || (a > 3 && b > 3)) {
    ans = 4;
  } else if (a > 3 || (a > 2 && b > 2)) {
    ans = 3;
  } else if (a > 2 || (a > 1 && b > 1)) {
    ans = 2;
  } else {
    ans = 1;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

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

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
const int MAX_N = (int)1e5 + 10;
int N,K;
vector<int> A;
vector<ll> sum,val;
int main() {
  cin >> N >> K;
  A.resize(N);
  sum.resize(N);
  val.resize(N);
  for (auto &val : A){
    cin >> val;
  }
  sum[0] = A[0];
  val[0] = max(0LL, (ll)A[0]);
  for (int i = 1; i < N; i++){
    sum[i] += sum[i - 1] + A[i];
    val[i] += val[i - 1] + max(0, A[i]);
  }
  ll res = 0;
  for (int i = 0; i < N; i++){
    if (i + K - 1 < N){
      ll cost = sum[i + K - 1];
      if (i - 1 >= 0){
        cost -= sum[i - 1];
      }
      //black
      ll left,right;
      left = right = 0;
      if (i - 1 >= 0){
        left = val[i - 1];
      }
      right = val[N - 1];
      right -= val[i + K - 1];
      res = max(res, cost + left + right);
      res = max(res, left + right);
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 2304
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String input ="";
		ArrayList<Integer> senkou = new ArrayList<Integer>();
		ArrayList<Integer> koukou = new ArrayList<Integer>();

		int counter = 0;

		while((input = br.readLine()) != null){
			counter++;
			if(counter % 2 == 1){
				senkou = spliter(input);
			}else{
				koukou = spliter(input);
				judge(senkou,koukou);
			}
		}


	}

	public static ArrayList<Integer> spliter(String input){
		String[] snum = input.split(" ");
		ArrayList<Integer> num = new ArrayList<Integer>();
		for(int i = 0;i < snum.length;i++){
			num.add(Integer.parseInt(snum[i]));
		}
		return num;

	}

	public static void judge(ArrayList<Integer> senkou,ArrayList<Integer> koukou){
		int hit = 0;
		int blow = 0;
		if(senkou.size() != koukou.size()) {System.out.println("?????£????????§???");}
		for(int i = 0;i < senkou.size();i++){
			if(senkou.get(i) == koukou.get(i)){ hit++; continue;}
			for(int j = 0;j < koukou.size();j++){
				if(senkou.get(i) == koukou.get(j)){blow++;break;}
			}
		}
		System.out.println(hit + " " + blow);
	}

}

Measured memory_bytes: 24512
n, k = map(int, input().split())
l = [0] * n

for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        l[a[j] - 1] += 1
        
count = 0        
for i in range(n):
    if l[i] == 0:
        count += 1
print(count)

Measured memory_bytes: 9064
def solve(n, l):
    results = [n]
    for i in range(20):
        s = list(("%0" + str(l) + "d") % n)
        s.sort()
        n = int("".join(s[::-1])) - int("".join(s))
        if n in results:
            break
        results.append(n)
    j = results.index(n)
    print(j, n, i - j + 1)

while True:
    n, l = map(int, input().split())
    if n == l == 0:
        break
    solve(n, l)



Measured memory_bytes: 5596
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
template<typename T> ll min(ll a, const T&& b) { return a < b ? a : b; }
template<typename T> ll min(const T&& a, ll b) { return a < b ? a : b; }
template<typename T> ll max(ll a, const T&& b) { return a > b ? a : b; }
template<typename T> ll max(const T&& a, ll b) { return a > b ? a : b; }
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

void solve() {
  ll a, b, c; cin >> a >> b >> c;
  if (a < b && b < c) cout << true << endl;
  else cout << false << endl;
}



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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    LL c;cin >> c;
    vector<LL> x(n), v(n), f(n+1, 0), g(n+1, 0);
    inc(i, 0, n) cin >> x[i] >> v[i];
    LL now = 0;
    inc(i, 0, n){
        now += v[i];
        f[i+1] = max(f[i], now-x[i]);
    }
    now = 0;
    dec(i, 0, n){
        now += v[i];
        g[i] = max(g[i+1], now-(c-x[i]));
    }

    LL ans = max({0LL, f[n], g[0]});
    now = 0;
    dec(i, 1, n){
        now += v[i];
        ans = max(ans, now-2LL*(c-x[i])+f[i]);
    }

    now = 0;
    inc(i, 0, n-1){
        now += v[i];
        ans = max(ans, now-2LL*x[i]+g[i+1]);
    }

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


Measured memory_bytes: 3456
#include <stdio.h>

char map[10][10];
int H,W;
int main(void)
{
  int i, j;
  int cnt = 0;
  scanf("%d %d\n", &H, &W);
  for(i = 0; i < H; i++) {
    scanf("%s", map[i]);
    for(j = 0; j < W; j++) {
      cnt += map[i][j]=='#'?1:0;
    }
  }
   if(cnt == H + W - 1) {
     printf("Possible\n");
   } else {
     printf("Impossible\n");
   }

}


Measured memory_bytes: 128
# undo が出来るゲームは全て2手だけ見ればよい
ops = ["+", "*", "-", "&", "^", "|"]
numbers = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]


def check(x):
    # +*
    op = 0
    for c in x:
        if c in ops:
            op += 1
            if op >= 2:
                return None
        else:
            op = 0
    # +...
    for op in ops:
        if x.startswith(op):
            return None
        if ("(" + op) in x:
            return None
    # 0がないか
    zero_ok = False
    for c in x:
        if not zero_ok and c == "0":
            return None
        if c in numbers:
            zero_ok = True
        else:
            zero_ok = False
    try:
        return int(eval(x))
    except:
        return None


def get_nexts(x):
    # 削除
    result = []
    for i in range(len(x)):
        y = x[:i] + x[i + 1:]
        val = check(y)
        if val != None:
            result.append((val, y))
    # 追加
    for i in range(len(x) + 1):
        add_list = numbers + ops
        for s in add_list:
            y = x[:i] + s + x[i:]
            val = check(y)
            if val != None:
                result.append((val, y))
    return result


def get_nexts_val(x):
    # 削除
    result = []
    for i in range(len(x)):
        y = x[:i] + x[i + 1:]
        val = check(y)
        if val != None:
            result.append(val)
    # 追加
    for i in range(len(x) + 1):
        add_list = numbers + ops
        for s in add_list:
            y = x[:i] + s + x[i:]
            val = check(y)
            if val != None:
                result.append(val)
    return result


while True:
    n, x = input().split(" ")
    n = int(n)
    if n == 0:
        quit()
    nexts = get_nexts(x)
    if n % 2 == 1:
        nexts.sort(key=lambda a: - a[0])
        print(nexts[0][0])
        continue
    minvals = []
    for (val, y) in nexts:
        nextss = get_nexts_val(y)
        nextss.sort()
        minvals.append(nextss[0])
    print(max(minvals))



Measured memory_bytes: 5620
#include<iostream> 
using namespace std; 
  
int main ()
{
   int a,b;
  char x;
  cin>>a>>x>>b;
  switch (x)
  {
    case '+':
     cout<<a+b;
    break;
    case '-':
       cout<<a-b;
    break;
  default :
  break;
  }
    return 0;
}

Measured memory_bytes: 256
#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 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;
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;
    cin >> n;
    vector<int> a;
    rep(i, n){ int tmp; cin >> tmp; a.push_back(tmp);}
    sort(a.begin(), a.end());

    ll sum = 0;
    int ans = 1;
    rep(i, n-1){
        sum += a[i];
        if (sum*2 >= a[i+1]){
            ans++;
        } else {
            ans = 1;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int a,b;
    double n,m, s;
    cin>>a>>b;
    n=a;
    m=b;
    s=n/m;
    cout<<fixed;
    cout<<setprecision(10)<<s<<endl;

    return 0;

}


Measured memory_bytes: 3780
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl; }}



signed main(){

    int N;
    vec cnt(10, 0);
    REP(i, 4){
        cin >> N;
        cnt[N]++;
    }
    ANS(cnt[1] == 1 && cnt[9] == 1 && cnt[7] == 1 && cnt[4] == 1);
    
    return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main(){
    int n, k;
    cin >> n >> k;
    V<int> a(n);
    rep(i,n) cin >> a[i];
    map<int, int> mp;
    rep(i,n) mp[a[i]]++;
    V<int> v;
    for(auto x : mp) v.push_back(x.se);
    sort(rall(v));
    int tot = 0;
    if(sz(v) < k) {
        cout << 0 << endl;
        return 0;
    }
    rep(i,k) tot += v[i];
    cout << n-tot << endl;
}

Measured memory_bytes: 14380
n,k=map(int,input().split())

mod=10**9+7

def power_func(a,n,mod):
  bi=str(format(n,"b"))
  res=1
  for i in range(len(bi)):
    res=(res*res)%mod
    if bi[i]=='1':
      res=(res*a)%mod
  return res

def cmb(a,b,mod):
  ans=1
  for i in range(a+1-b,a+1):
    ans*=i
    ans%=mod
  for k in range(1,b+1):
    ans*=power_func(k,mod-2,mod)
    ans%=mod
    
  return ans

x=cmb(n-k+1,1,mod)
y=1
g=n-k+1
h=k
print((x*y)%mod)
if k>1:
  
  for i in range(2,k+1):
    x*=(n-k+1-(i-1))%mod
    x*=power_func(i,mod-2,mod)
    
    y*=(k-(i-1))%mod
    y*=power_func(i-1,mod-2,mod)
    
    print((x*y)%mod)
    
  
  
  

Measured memory_bytes: 75104
#!/usr/bin/env pypy
from __future__ import division, print_function

import os
import sys
from __builtin__ import xrange as range
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase

import __pypy__


def main():
    s = input()
    if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
        print('Bad')
    else:
        print('Good')


# region fastio

BUFSIZE = 8192


class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 29036
//using namespace std;
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
   //std::set<int> nanka;
   //nanka.insert(irerukazu);
   //std::vecter<int> v(size)
   //v[0] = a;
    //std::sort(v.begin()v.end());

int main(){

    std::string a,b,s;
    std::cin >> a >> s >> b;
    std::cout << a[0] << s[0] << b[0] << std::endl;




    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
	int n,a[10000],i,min,max;
	long sum;
	scanf("%d",&n);
	scanf("%d",&a[0]);
	min=a[0];
	max=a[0];
	sum=a[0];
	for(i=1;i<n;i++){
		scanf("%d",&a[i]);
		if(max<a[i]){
			max=a[i];
			}
		if(min>a[i]){
			min=a[i];
			}
		sum=sum+a[i];
		}
				
	printf("%d %d %ld\n",min,max,sum);
	return 0;
}
 

Measured memory_bytes: 640
package main

import (
	"fmt"
)

func main() {
	var a, b, c, k int64

	fmt.Scan(&a, &b, &c, &k)

	if k <= a {
		fmt.Println(k)
	} else if k <= a+b {
		fmt.Println(a)
	} else {
		m := k - (a + b)
		fmt.Println(a - m)
	}

}

Measured memory_bytes: 1756
import java.util.*;

public class Main{
	public static void main(String args[]){
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt(), b = sc.nextInt();
      sc.close();
      String ans[] = {"Yes", "No"};
      int an = 0;
      if(a * b % 2 == 0)an = 1;
      System.out.println(ans[an]);
    }
}

Measured memory_bytes: 22740
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b=map(int, input().split())
    if a>0:
        print('Positive')
    elif a==0 or b==0:
        print('Zero')
    elif a<0 and b>0:
        print('Zero')
    elif b<0 and (b-a)%2==0:
        print('Negative')
    else:
        print('Positive')
resolve()

Measured memory_bytes: 3060
#include <algorithm>
#include <assert.h>
#include <iostream>
#include <string.h>
#include <memory.h>
#include <stdio.h>
#include <complex>
#include <cstdlib>
#include <sstream>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <vector>
#include <string>
#include <bitset>
#include <cstdio>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include<deque>
typedef long long ll;
using namespace std;
const int N = 5000+1;
bool dp[N][N];
int vis[N][N];
int arr[N];
int VIS;
int l, r, n, s, k;
bool calc(int idx, int sum) {
	if (sum >= l && sum <= r)
		return true;
	if (idx == n)
		return false;
	bool &ret = dp[idx][sum];
	if (vis[idx][sum] == VIS)
		return ret;
	vis[idx][sum] = VIS;
	ret = calc(idx + 1, sum);
	if (idx != s && sum + arr[idx] <= r)
		ret = ret || calc(idx + 1, sum + arr[idx]);
	return ret;
}
bool prv;
int prevValue;
bool can(int idx) {
	++VIS;
	s = idx;
	l = k - arr[idx];
	if (VIS > 1 && prevValue == arr[idx])
		return prv;
	prv = !calc(0, 0);
	prevValue = arr[idx];
	return prv;
}

int main() {
	
	//freopen("myfile.in", "r", stdin);
	scanf("%d%d", &n, &k);
	ll s = 0;
	for (int i = 0; i < n; ++i) {
		scanf("%d", arr + i);
		s += arr[i];
	}
	if (s < k) {
		printf("%d\n", n);
		return 0;
	}
	sort(arr, arr + n);
	r = k - 1;
	int l = 0, r = n - 1, ans = 0;
	while (r >= l) {
		int mid = (r + l) / 2;
		if (can(mid)) {
			ans = mid+1;
			l = mid + 1;
		}
		else
			r = mid - 1;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 122496
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>

using namespace std;  //このネームスペースを使う

int main(){
	int A;
	string s;
	cin >> A ;
    cin >> s;

    if(A >= 3200){
    	cout << s << endl;
    }
    else{
    	cout << "red" << endl;
    }
  
    return 0;
}



Measured memory_bytes: 256
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(1000000)

# INF = float('inf')
INF = int(1e10)

def input():
    return stdin.readline()[:-1]

def main():
    from builtins import int, map
    N, M = map(int, input().split())
    ans = (N * (N - 1) + M * (M - 1)) // 2
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
import numpy as np
import collections
N = int(input())
u = list(map(int,input().split()))
ans = 0
test=range(0,N,2)
u_one = np.array(u)[test]
c_one=collections.Counter(u_one)
test=range(1,N,2)
u_two = np.array(u)[test]
c_two = collections.Counter(u_two)
d_one = c_one.most_common()
d_two = c_two.most_common()

if(len(d_one)!=1 and len(d_two)!=1):
    if(d_one[0][0]!=d_two[0][0]):
        print(N-d_one[0][1]-d_two[0][1])
    else:
        print(min(N-d_one[1][1]-d_two[0][1], N-d_one[0][1]-d_two[1][1]))
else:
    if(len(d_one)==1 and len(d_two)==1):
        if(d_one[0][0]==d_two[0][0]):
            print(min(N-d_two[0][1],N-d_one[0][1]))
        else:
            print(N-d_one[0][1]-d_two[0][1])
    elif(len(d_two)==1):
        print(min(N-d_one[0][1]-d_two[0][1],N-d_one[1][1]-d_two[0][1]))
    elif(len(d_one)==1):
        print(min(N-d_one[0][1]-d_two[0][1],N-d_one[0][1]-d_two[1][1]))


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

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        g[x].push_back(y);
    }

    vector<double> d(n);
    for (int i = n - 2; i >= 0; i--) {
        double s = 0;
        for (int j : g[i]) {
            s += d[j] + 1;
        }
        s /= g[i].size();
        d[i] = s;
    }

    double res = d[0];

    for (int f = 0; f < n - 1; f++) {
        if (g[f].size() == 1) continue;
        vector<double> d(n);
        for (int i = n - 2; i >= 0; i--) {
            double s = 0;
            double mx = 0;
            for (int j : g[i]) {
                s += d[j] + 1;
                mx = max(mx, d[j] + 1);
            }
            if (i == f) {
                s = (s - mx) / (g[i].size() - 1);
            } else {
                s = s / g[i].size();
            }
            d[i] = s;
        }
        res = min(res, d[0]);
    }

    cout << setprecision(20) << res;

    return 0;
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"

#include <unordered_map>

//#include <iostream>//POJ
//#include <vector>
//#include <string>
//#include <iomanip>
//#include <math.h>
//#include <algorithm>
//#include <cstring>
using namespace std;
#define setc cin.tie(0);ios::sync_with_stdio(0)
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define repi_(i,a,b) for(int i=(a), i##_len=(b); i<=i##_len; ++i)
#define rep_(i,n) repi_(i,0,n)
#define repir(i,a,b) for(int i=(a)-1, i##_first=(b); i>=i##_first; --i)
#define repr(i,n) repir(i,n,0)
#define repir_(i,a,b) for(int i=(a), i##_first=(b); i>=i##_first; --i)
#define repr_(i,n) repir_(i,n,0)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
//template<typename T> T vpop(vector<T> *v) {
//	T res = v->back();
//	v->pop_back();
//	return res;
//}
//char vpop(string *v) {
//	char res = v->back();
//	v->pop_back();
//	return res;
//}
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define contain(q) !q.empty()
#define cont(q) !q.empty()
//#define qpop(q, a, b) a=q.back().first;b=q.back().second;q.pop()
//#define pqpop(p, a, b) a=q.top().first;b=q.top().second;q.pop()
#define el "\n"
#define sp " "
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#define POSSIBLE(c) coc(c, "POSSIBLE", "IMPOSSIBLE")
#define Possible(c) coc(c, "Possible", "Impossible")
#define possible(c) coc(c, "possible", "impossible")
#define inf INT_MAX
#define wildcard(T) numeric_limits<T>::min()

#define pb push_back
#define pq priority_queue
#define np next_permutation

#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
const unsigned int bf0 = (1 << 0);
const unsigned int bf1 = (1 << 1);
const unsigned int bf2 = (1 << 2);
const unsigned int bf3 = (1 << 3);
const unsigned int bf4 = (1 << 4);
const unsigned int bf5 = (1 << 5);
const unsigned int bf6 = (1 << 6);
const unsigned int bf7 = (1 << 7);

typedef long long lint;
typedef vector<int> ivec; typedef vector<string> svec;
typedef vector<lint> lvec;
typedef vector<vector<int>> ivvec;
typedef pair<int, int> P;

const int
dx8[8] = { 0,1,1,1,0,-1,-1,-1 },
dy8[8] = { 1,1,0,-1,-1,-1,0,1 },
dx4[4] = { 0,1,0,-1 },
dy4[4] = { 1,0,-1,0 };

template<class T>inline bool maxi(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool mini(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }


int main() {
	setc;

	int f[30]={};
	string in;cin>>in;
	rep(i, in.length()){
		++f[in[i]-'a'];
	}
	bool fl=1;
	rep(i, 30){
		if (f[i] % 2){
			fl=0;break;
		}
	}
	Yes(fl);
	gc();
}

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

struct UnionFind{
  vector<int> d;
  UnionFind(int n){
    d.resize(n,-1);
  }
  int find(int x){
    if(d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return;
  }
  int size(int x){return -d[find(x)];}
};

int main(){
  int n, m;
  cin >> n >> m;
  UnionFind uf(n);
  vector<int> pn(n);
  for(int i=0; i<n; ++i){
    cin >> pn[i];
    --pn[i];
  }
  int x, y;
  for(int i=0; i<m; ++i){
    cin >> x >> y;
    --x; --y;
    uf.unite(x,y);
  }
  int ans = 0;
  for(int i=0; i<n; ++i){
    if(uf.find(i) == uf.find(pn[i])) ++ans;
  }
  cout << ans << endl;
}


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

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

}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

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

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N, K = mi()
    ans = K
    for i in range(N-1):
        ans *= K-1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62044
#include <bits/stdc++.h>
#define ld long double
#define int long long
using namespace std;
const int N = 1e5 + 50;
const int mod = 1e9 + 7;
const int inf = 1e17;
int dx[] = {0, 1, -1, 0, -1, 1, 1, -1};
int dy[] = {1, 0, 0, -1, -1, 1, -1, 1};
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);	
	int n;
	cin >> n;
	int arr[n], mn = 1e17;
	for(int i = 0; i < n; i++){
		cin >> arr[i];
		mn = min(mn, arr[i]);
	}
	for(int i = 0; i < n; i++){
		arr[i] -= mn;
	}
	int ans = mn, z = 0;
	while(z != n){
		int mn = 1e17, p = -1; z = 0;
		for(int i = 0; i < n; i++){
			if(arr[i] == 0){
				z++;
				for(int j = p + 1; j < i; j++){
					arr[j] -= mn;
				}
				if(mn != (int)1e17){
					ans += mn;
				}
				p = i;
				mn = 1e17;
			}else{
				mn = min(mn, arr[i]);
			}
		}
		for(int i = p + 1; i < n; i++){
			arr[i] -= mn;
		}
		if(mn != (int)1e17){
			ans += mn;
		}
	}
	cout << ans;
}

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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

static const double pi = 3.141592653589793;

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

ll compare(ll left, ll right, ll A, ll B)
{
    return min(A*(right-left),B);
}

ll Ans(ll N, ll A, ll B, vector<ll> position)
{
    ll ans = 0;
    for(int i=0;i<N-1;i++)
    {
        ans += compare(position[i],position[i+1],A,B);
    }
    return ans;
}

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

    vector<ll> position(N);
    ALLIN1_NUMBER(position);

    OUT0(Ans(N,A,B,position));

    return 0;
}

Measured memory_bytes: 1792
<?php
fscanf(STDIN, "%d %d %d %d", $x1, $y1, $x2, $y2);

$dx = $x2 - $x1;
$dy = $y2 - $y1;

$x = $x2;
$y = $y2;

$answer = [];

for ($i = 0; $i < 2; $i++) {
	$tmp_dx = -$dy;
	$tmp_dy = $dx;

	$dx = $tmp_dx;
	$dy = $tmp_dy;

	$x += $dx;
	$y += $dy;

	$answer[] = $x;
	$answer[] = $y;
}

echo implode(" ", $answer);


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

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

	if(X<100){
		cout << 0 << endl;
		return 0;
	}

  int mx;
	mx = X / 100;
	
	int amari;
	amari = X - (mx * 100);

	int count = 0;
	while(amari != 0){
		if(amari>=5){
			count = amari / 5;
			amari = amari - count*5;
		} else {
			count += 1;
			amari = 0;
		}
	}

	if(mx >= count){
		cout << 1 << endl; 
	} else {
		cout << 0 << endl;
	}
}

Measured memory_bytes: 256
// cpp_range (generic range class, very small equivalent of boost::irange)
// (C) @cielavenir under Boost Software License.
// note: end position is exclusive.

#include <iterator>
template<typename T>
class range{
public:
	struct iterator{
		const T a,b;
		T p;
		const long long d; //because T might be unsigned.
		iterator(T _a,T _b,T _p,long long _d=1):a(_a),b(_b),p(_p),d(_d){}

	public:
		typedef T value_type;
		typedef T& reference;
		typedef T* pointer;
		typedef std::ptrdiff_t difference_type;
		typedef std::random_access_iterator_tag iterator_category;

		//copy
		iterator(const iterator &other):a(other.a),b(other.b),p(other.p),d(other.d){}
		iterator operator=(const iterator &other){return iterator(other.a,other.b,other.p,other.d);}

		//advance
		iterator& operator+=(T n){p+=n*d;return *this;}
		iterator& operator-=(T n){return *this+=(-n);}
		iterator& operator++(){return *this+=1;}
		iterator& operator--(){return *this-=1;}
		iterator operator+(T n) const{return iterator(a,b,p+n*d);}
		iterator operator-(T n) const{return *this+(-n);}

		//difference
		T operator-(const iterator& other) const{return p-other.p;}

		//equality
		bool operator==(const iterator& other) const{return a==other.a && b==other.b && d==other.d && p==other.p;}
		bool operator!=(const iterator& other) const{return !(*this==other);}

		//compare
		bool operator<(const iterator& other) const{return a==other.a && b==other.b && d==other.d && p*d<other.p*d;}
		bool operator>(const iterator& other) const{return a==other.a && b==other.b && d==other.d && p*d>other.p*d;}

		//reference
		const T& operator*() const{return p;}
	};

private:
	const T a,b;
	T siz;
	long long d;
public:
	range(T _a,T _b,long long _d=1):a(_a),b(_b){
		d=_d;
		if(d==0)d=1; //
		siz=( (d>0?(b-a):(a-b)) - 1)  / (d>0?d:-d);
	}

	T operator[](T n){return a+n*d;}
	iterator begin(){return iterator(a,a+d*siz,a,d);}
	iterator end(){return iterator(a,a+d*siz,a+d*(siz+1),d);}
	iterator rbegin(){return iterator(b-d*siz,b,b,-1*d);}
	iterator rend(){return iterator(b-d*siz,b,b-d*(siz+1),-1*d);}
	T size(){return siz+1;}
};

#include <vector>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cmath>

int main(){
	int a,b;
	for(;scanf("%d%d",&a,&b),a;){
		range<int>ra(0,a/2+2);
		std::vector<double>l(ra.size());
		std::transform(ra.begin(),ra.end(),l.begin(),[&](int i){return fabs(b-hypot(i,a-i));});
		printf("%f\n",*std::min_element(l.begin(),l.end()));
	}
}

Measured memory_bytes: 2672
// Iterative C++ program to print sums of all 
// possible subsets. 
#include<bits/stdc++.h> 
using namespace std; 


// Driver code 
int main() 
{ 
	int n, m, x;
	cin >> n >> m >> x;
	int arr[n];

	long long total = 1<<n; 
	int ans[n][m];
	int f;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<=m;j++)
		{
			cin >> f;
			if(!j)
				arr[i] = f;
			else
				ans[i][j-1]= f;	
					}
	}
	// Consider all numbers from 0 to 2^n - 1 
	int s[m];
	long long maxm = INT_MAX;
	for (long long i=0; i<total; i++) 
	{ 
		long long sum = 0; 

		// Consider binary reprsentation of 
		// current i to decide which elements 
		// to pick. 
		for(int y=0;y<m;y++)
			s[y]=0;
		for (int j=0; j<n; j++) 
		{
			if (i & (1<<j)) 
			{
				sum += arr[j]; 
				for(int r=0;r<m;r++)
				{
					s[r] += ans[j][r];
				}
			}
		}
		int count = 0;
			for(int h=0;h<m;h++)
			{
				if(s[h]>=x)
					count++;
			}
			if(count==m)
				maxm = min(maxm, sum);
		}
		// Print sum of picked elements. ]
		if(maxm==INT_MAX)
			cout << -1 << endl;
		else
		cout << maxm << endl;
	return 0; 
} 


Measured memory_bytes: 3624
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;

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

  double price = floor(n / 1.1);
  for (double price; price <= n; price++) {
    if (floor(price * 1.08) == n) {
      cout << price;
      break;
    }
    if (price == n) cout << ":(";
  }
  return 0;
}


Measured memory_bytes: 256
from sys import exit, setrecursionlimit, stderr, stdin
from functools import reduce
from itertools import *
from collections import defaultdict, Counter
from bisect import bisect
import functools

def input():
  return stdin.readline().strip()

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

N = read()
print(180 * (N-2))

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

#define ALL(v) (v).begin(),(v).end()

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




int main()
{
  int x, a ;
  cin >> x >> a ;
  if(x<a){
    cout <<"0"<<endl ;
  }
  else{
    cout <<"10"<<endl ;
  }
    return 0 ;
}

/*　吾輩はやれば出来る子である。 
　　　　∩∩ 
　　　（´･ω･） 
　　 ＿|　⊃／(＿＿_ 
　／　└-(＿＿＿_／ 
　￣￣￣￣￣￣￣ 
　やる気はまだない 

　　 ⊂⌒／ヽ-、＿_ 
　／⊂_/＿＿＿＿ ／ 
　￣￣￣￣￣￣￣　　*/

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define PER(i, a, b) for(int i = a; i >= b; i--)
#define LL long long
#define lowbit(x) x &(-x)

inline int read() {
    int x = 0, flag = 1;char ch = getchar();
    while(!isdigit(ch)) {
        if(ch == '-') flag = - 1;
        ch = getchar();
    }
    while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
    return x * flag;
}
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
int n, a[N];
LL ans, sum, f[N], g[N];

LL ksm(LL a, int b) {
    LL t = 1;
    while(b) {
        if(b & 1) t = t * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return t;
}
int main() {   
    n = read(); REP(i, 1, n) a[i] = read();
    sum = 1; REP(i, 2, n - 1) sum = sum * i % mod;
    REP(i, 1, n - 1) f[i] = sum * ksm(i, mod - 2) % mod;
    g[1] = f[1]; REP(i, 2, n) g[i] = g[i - 1] + f[i];
    //REP(i, 1, n - 1) cout << g[i] << endl;
    REP(i, 1, n - 1) {
        ans = (((a[i + 1] - a[i]) * g[i] % mod) + ans) % mod;
    }
    printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

ll n,m;
pair<ll,ll>b[52];
vector<ll>a[52];
bool ch[52];
void dep(ll now,ll dx,ll dy){
	if(now!=0&&a[now].size()==1){
		return ;
	}
	for(ll i=0;i<a[now].size();i++){
		ll next=a[now][i];
		if(ch[next]){
			continue;
		}
		if(next==dx&&now==dy){
			continue;
		}
		if(next==dy&&now==dx){
			continue;
		}
		ch[next]=true;
		dep(next,dx,dy);
	}
}
int main() {
	cin>>n>>m;
	for(ll i=0;i<m;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		a[x].push_back(y);
		a[y].push_back(x);
		b[i]=make_pair(x,y);
	}
	ll ans=0;
	for(ll i=0;i<m;i++){
		for(ll j=0;j<n;j++){
			ch[j]=false;
		}
		ll dx=b[i].first;
		ll dy=b[i].second;
		ch[0]=true;
		dep(0,dx,dy);
		for(ll j=0;j<n;j++){
			if(ch[j]!=true){
				ans++;
				break;
			}
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int L, R, min = 2019;
  scanf("%d %d", &L, &R);

  if (R-L >= 2019) {puts("0"); return 0;}
  for (int i = L; i <= L+2019 && i <= R; ++i) {
    for (int j = i+1; j <= L+2019 && j <= R; ++j) {
      int t = ((long long)i*j)%2019;
      if (min > t) min = t;
    }
  }
  printf("%d\n", min);
  return 0;
}


Measured memory_bytes: 128