akhauriyash/Code-Regression huggingface dataset:
//use itertools::Itertools;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

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! 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:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize,
        k: usize,
        a: [usize;n]
    }

    let mut k_bit = vec![0; 60];
    for b in 0..60 {
        k_bit[b] = k >> b & 1;
    }

    let mut a_sum_bit = vec![0; 60];
    for i in 0..n {
        let a_i = a[i];
        for b in 0..60 {
            a_sum_bit[b] += a_i >> b & 1;
        }
    }

    // まずx=kの場合のf(x)を見る
    let mut ans = 0;
    for i in 0..60 {
        let base = 1 << i;
        ans += if k_bit[i] == 1 {
            (a.len() - a_sum_bit[i]) * base
        } else {
            a_sum_bit[i] * base
        }
    }

    for i in 0..60 {
        let mut tmp_ans = 0;

        // kのi+1ビット目が1なら、そのビットを0にする代わりに下位のビットは全て0か1のより大きい方として良い
        if k_bit[i] == 1 {
            for j in 0..60 {
                let base = 1 << j;
                let bit_j_0 = a_sum_bit[j] * base;
                let bit_j_1 = (a.len() - a_sum_bit[j]) * base;
                if j < i {
                    tmp_ans += cmp::max(bit_j_0, bit_j_1);
                } else if j == i {
                    tmp_ans += bit_j_0;
                } else {
                    tmp_ans += if k_bit[j] == 0 { bit_j_0 } else { bit_j_1 };
                }
            }
        }

        ans = cmp::max(tmp_ans, ans);
    }

    println!("{}", ans);
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 8572
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
from itertools import accumulate
def resolve():
    N, T = lr()
    ab = []
    a0b = [0]
    for i in range(N):
        a, b = lr()
        if a >= 1:
            ab.append([a, b])
        else:
            a0b.append(b+1)
    ab = sorted(ab, key=lambda x: x[0]/(x[1]+1))[::-1]
    a0b = sorted(a0b)
    dp = [T+1]*30
    dp[0] = 0
    for a, b in ab:
        for i in range(28, -1, -1):
            t = (a+1)*(dp[i]+1)+b
            if t < dp[i+1]:
                dp[i+1] = t
    ans = 0
    acc = list(accumulate(a0b))
    num = len(acc)-1
    for i in range(30):
        t = dp[i]
        if t > T+0.5:
            break
        while num > 0 and t+acc[num] > T+0.5:
            num -= 1
        ans = max(ans, i+num)
    print(ans)
resolve()

Measured memory_bytes: 44916
N = int(input())
li = []

for i in range(N):
    li.append(int(input()))

new_li = sorted(li, reverse=True)

M = new_li[0]
m = new_li[1]

for i in range(N):
    if li[i] != M:
        print(M)
    elif li[i] == M:
        print(m)


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

using namespace std;

int main(void){

    int n;
    cin >> n;
    vector<char> s(n);
    for(int i=0; i<n; i++) cin >> s[i];

    vector<int> e_counts(n);
    int sum = 0;
    for(int i=0; i<n; i++) {
        if(s[i] == 'E') sum++;
        e_counts[i] = sum;
//        cout << e_counts[i];
    }
//    cout << endl;
    
    int min = 100000000;
    for(int i=0; i<n; i++) {
        int l_e, l_w, r_e, r_w;
        if(i==0) {
            l_e = 0;
            l_w = 0;
            if(s[0] == 'E') {
                r_e = e_counts[n-1] - 1;
                r_w = n - e_counts[n-1];
            }
            else {
                r_e = e_counts[n-1];
                r_w = n - e_counts[n-1] - 1;
            }
        }
        else if(i==n-1) {
            r_e = 0;
            r_w = 0;
            if(s[n-1] == 'E') {
                l_e = e_counts[n-1] - 1;
                l_w = n - e_counts[n-1];
            }
            else {
                l_e = e_counts[n-1];
                l_w = n - e_counts[n-1] - 1;
            }
        }
        else {
            if(s[i] == 'E') {
                l_e = e_counts[i] - 1;
                l_w = i - e_counts[i-1];
                r_e = e_counts[n-1] - e_counts[i];
                r_w = n - i - r_e - 1;
            }
            else {
                l_e = e_counts[i];
                l_w = i - e_counts[i-1];
                r_e = e_counts[n-1] - e_counts[i];
                r_w = n - (i+1) - r_e;
            }
        }

        if(l_w+r_e<min) min = l_w+r_e;
//        cout << l_e << " " << l_w << " " << r_e << " " << r_w << " " << min << endl;
    }

    cout << min << endl;

    return 0;
    
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n;
    cin>>n;
    if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9)
        cout<<"hon";
    else if(n%10==0||n%10==1||n%10==6||n%10==8)
        cout<<"pon";
    else cout<<"bon";
    return 0;
}

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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

void solve(){
   int n;
   cin >> n;
   n %= 10;
   if(n == 3)  cout << "bon";
   else if(n == 0 || n == 1 || n == 6 || n == 8)   cout << "pon";
   else  cout << "hon";
}

int32_t main(){
   fast;
   int t = 1;
//   cin >> t;
   while(t--)  solve();   
}

Measured memory_bytes: 3604
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node {
  int key;
  struct node *next, *prev;
}Node;

void init(void);
void insert(int);
void deleteNode(Node *);
void deleteFirst(void);
void deleteLast(void);
void deleteKey(int);
Node * listSearch(int);

Node *nil;

Node* listSearch(int key){
  Node *cur=nil->next;
  while(cur!=nil&&cur->key!=key){
    cur=cur->next;
  }
  return cur;
}

void init(void) { 
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  Node *cur=nil->next;
  int isf=0;
  
  while(1){
    if(cur==nil) break;
    if(isf++>0) printf(" ");
    printf("%d",cur->key);
    cur=cur->next;
  }
  printf("\n");
}

void insert(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

void deleteNode(Node *t) {
  if(t==nil) return;
  t->prev->next=t->next;
  t->next->prev=t->prev;
  free(t);
}

void deleteFirst(void) {
  deleteNode(nil->next);
}

void deleteLast(void) {
  deleteNode(nil->prev);
}

void deleteKey(int key){
  deleteNode(listSearch(key));
}

int main()
{
  int n,i,key,size=0,np=0,nd=0;
  char command[20];

  scanf("%d",&n);

  init();
  
  for(i=0;i<n;i++){
    scanf("%s %d",command,&key);
    if(strcmp(command,"insert")==0){
      insert(key);
      np++;
      size++;
    }else if(strcmp(command,"deleteFirst")==0){
      deleteFirst();
      size--;
    }else if(strcmp(command,"deleteLast")==0){
      deleteLast();
      size--;
    }else{
      deleteKey(key);
      nd++;
      size--;
    }
  }
  
  printList();

  return 0;
}

Measured memory_bytes: 33824
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	public static readonly long MOD = 1000000007;

	public static void Main()
	{
		long N = GetLong();
		long K = GetLong();
		long R = N - K;

		var mct = new ModCombTable((int)N, MOD);
		var sb = new StringBuilder();
		for(long i = 1; i <= K; i++)
		{
			long combBlue = mct.ModComb(K - 1, i - 1);
			long combRed = mct.ModComb(R + 1, i);
			long comb = (combBlue * combRed) % MOD;
			sb.AppendFormat($"{comb}\n");
		}

		Console.Write(sb);
	}
}


public class ModCombTable
{
	private long[] f = null;
	private long[] fInv = null;
	private long mod;

	public ModCombTable(int N, long m)
	{
		mod = m;

		// calc factorial
		f = new long[N+1];
		f[0] = 1;
		for(int i = 1; i <= N; i++)
			f[i] = (f[i-1] * i) % mod;

		// calc factorial inverse
		fInv = new long[N+1];
		fInv[N] = ModInv(f[N]);
		for(int i = N; i > 0; i--)
			fInv[i-1] = (fInv[i] * i) % mod;
	}

	public long ModComb(long n, long k)
	{
		if(n < 0 || k < 0 || n < k)
			return 0;

		return (((f[n] * fInv[k]) % mod) * fInv[n-k]) % mod;
	}

	public long ModInv(long x)
	{
		return ModPow(x, mod - 2);
	}

	public long ModPow(long x, long n)
	{
		long res = 1;
		while(n > 0)
		{
			if((n & 1) == 1)
				res = (res * x) % mod;
			x = (x * x) % mod;
			n >>= 1;
		}
		return res;
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}





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

#define REP(i,n) for(int i=0;i<(n);++i)

using namespace std;

typedef int Data;

struct Treap {
  Data value;
  int pri;
  Treap *left;
  Treap *right;
  int cnt;
  int minv;
  Treap(Data v)
      : value(v), pri(rand()),
      left(nullptr), right(nullptr),
      cnt(1), minv(v) {}
};

int count(Treap *t) { return !t ? 0 : t->cnt; }
int minv(Treap *t) { return !t ? 1000000000 : t->minv; }

Treap *update(Treap *t) {
  t->cnt = count(t->left) + count(t->right) + 1;
  t->minv = min(min(minv(t->left),minv(t->right)),t->value);
  return t;
}

Treap *merge(Treap *l, Treap *r){
  if(!l || !r) return !l ? r : l;

  if(l->pri > r->pri){
    l->right = merge(l->right, r);
    return update(l);
  } else {
    r->left = merge(l, r->left);
    return update(r);
  }
}

pair<Treap*, Treap*> split(Treap *t, int k) {
  if(!t) return make_pair(nullptr, nullptr);

  if(k <= count(t->left)) {
    auto s = split(t->left, k);
    t->left = s.second;
    return make_pair(s.first, update(t));
  } else {
    auto s = split(t->right, k - count(t->left) - 1);
    t->right = s.first;
    return make_pair(update(t), s.second);
  }
}

Treap *insert(Treap *t, int k, Data v) {
  auto s = split(t, k);
  return merge(s.first, merge(new Treap(v), s.second));
}

Treap *erase(Treap *t, int k) {
  auto s1 = split(t, k);
  auto s2 = split(s1.second, 1);
  free(s2.first);
  return merge(s1.first, s2.second);
}

int main() {
  srand(0);
  Treap *root = nullptr;
  int n,q;
  cin>>n>>q;
  REP(i,n){
    int a;
    cin>>a;
    root = insert(root, i, a);
  }
  REP(i,q){
    int x,y,z;
    cin>>x>>y>>z;
    switch(x){
      case 0: {
        auto b = split(root, z+1);
        auto f = split(b.first, y);
        auto s = split(f.second, z-y);
        Treap *ns = merge(s.second, s.first);
        Treap *nf = merge(f.first, ns);
        root = merge(nf, b.second);
      } break;
      case 1: {
        auto b = split(root, z+1);
        auto f = split(b.first, y);
        cout << f.second->minv << endl;
        Treap *nf = merge(f.first, f.second);
        root = merge(nf, b.second);
      } break;
      case 2: {
        root = erase(root, y);
        root = insert(root, y, z);
      } break;
    }
  }
  return 0;
}

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

int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  int count=1;
  char prev=s[0];
  for(int i=1;i<n;i++){
    if(s[i]!=prev){
      prev=s[i];
      count+=1;
    }
  }
  cout<<count;
}


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

const int INF = 1e9 + 5;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, K;
	cin >> n >> K;
	int h[n], dp[n];
	for (int i = 0; i < n; i++) {
		cin >> h[i];
		dp[i] = INF;
	}
	dp[0] = 0;
	for (int i = 0; i < n; i++) {
		for (int k = 1; k <= K; k++) {
			int j = i + k;
			if (j == n) break;
			dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]));
		}
	}
	cout << dp[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
int main(void){
    int n,m,i,j,max;
    scanf("%d %d",&n,&m);
    int a[n],b[m],count[n];
    for(i=0;i<n;i++) count[i]=0;
    for(i=0;i<n;i++) scanf("%d",&a[i]);
    for(i=0;i<m;i++) scanf("%d",&b[i]);
 
    for(i=0;i<m;i++){
        for(j=0;;j++){
            if (b[i]>=a[j]) {
                count[j]++;
                break;
            }
        }
    }
    max=1;
    for(i=0;i<n-1;i++){
        if (count[max-1]<count[i+1]) max=i+2;
    }
    printf("%d\n",max);
    return 0;
}

Measured memory_bytes: 608
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<map>
#include<tuple>
#include<algorithm>

using namespace std;

#define REP(i, n) for(int i=0;i<(int)n;i++)
#define REPS(i, n) for(int i=1;i<=(int)n;i++)
#define RREP(i, n) for(int i=n-1;i>=0;i--)
#define RREPS(i, n) for(int i=n;i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define pb push_back
#define eb emplace_back
#define endl '\n'
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
enum DIR { LEFT, RIGHT, FRONT, BACK, BOTTOM, TOP };
int rotm[4][6]={
	{5,4,2,3,0,1},
	{0,1,5,4,2,3},
	{0,1,4,5,3,2},
	{4,5,2,3,1,0}
};

struct Dice{
	vi d, x;
	Dice(vi d):d(d), x(6){
		
	}
	
	inline int &operator[](int i){
		return d[i];
	}
	
	inline void rot(int k){
		REP(i, 6) x[rotm[k][i]] = d[i];
		swap(d, x);
	}
	
	inline int check(){
		if(d[BOTTOM] == -1) return 0;
		const int A = d[BOTTOM] + d[TOP];
		const int B = d[LEFT] + d[RIGHT];
		const int C = d[FRONT] + d[BACK];
		if(A > B + C) return 0;
		if(B > A+C+1) return 0;
		if(C > A+B+1) return 0;
		return 1;
	}
	
};
int n;
string db = "ENSW";
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	while(1){
		vi t(6);
		REP(i, 6) cin >> t[i];
		sort(ALL(t));
		if(t[5] == 0) break;
		int n = accumulate(ALL(t), 0);
		string ans(n, 'Z');
		do{
			Dice dice(t);
			string tmp;
			int f = 0;
			REP(itr, n){
				REP(i, 4){
					dice.rot(i);
					dice[BOTTOM] --;
					if(dice.check()){
						tmp.pb(db[i]);
						break;
					}
					dice[BOTTOM] ++;
					dice.rot(3-i);
				}
				if(tmp.size() != itr+1 || !f && ans[itr] < tmp[itr]) break;
				f |= ans[itr] > tmp[itr];
			}
			if(tmp.size() == n) ans = min(ans, tmp);
		}while(next_permutation(ALL(t)));
		int p, q;
		cin >> p >> q; p--;
		if(ans[0] == 'Z') cout << "impossible" << endl;
		else cout << ans.substr(p, q-p) << endl;
	}
}

Measured memory_bytes: 1360
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
ll M = 1000000007;

int main(){
  int N;
  cin >> N;
  ll ans = 1;
  for(int i=0;i<N;i++){
  	ans *= (i+1);
  	ans = ans%M;
  }
  cout << ans <<endl;

  return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<string>
#include<queue>
#include<vector>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)//初期値a,i<bの範囲でループ
#define REP(i,n) FOR(i,0,n)//初期値0,i<nの範囲でループ
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;

int n;
ll a[200400];
ll x;
ll c;
ll ans=1000000000000000000LL;
int main(){
    cin>>n;
    REP(i,n){
        cin>>a[i];
        x+=a[i];
    }
    REP(i,n-1){
        c+=a[i];
        ans=min(ans,abs(x-2*c));
    }
    cout<<ans;

    
    

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <array>
#include <queue>
#include <map>
#include <stack>
#include <cstdint>
#include <unordered_set>
typedef long long int llint;

bool primecheck(int a){
  for(int i=2; i*i<a; i++){
    if(a%i==0) return false;
  }
  return true;
}
int main(void){

  int x;
  std::cin >> x;
  while(!primecheck(x)){
    x++;
  }
  std::cout << x << std::endl;

  return 0;
}


Measured memory_bytes: 384
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
vector<T> make_vec(size_t s, T val) { return vector<T>(s, val); }
template<class... Size>
auto make_vec(size_t s, Size... tail) {
	return vector<decltype(make_vec(tail...))>(s, make_vec(tail...));
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, W;
	cin >> N >> W;

	vector<int> w(N), v(N);
	for (int i = 0; i < N; i++) cin >> v[i] >> w[i];

	auto dp = make_vec(N + 1, W + 1, 0);
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= W; j++) {
			if (j - w[i] >= 0) dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - w[i]] + v[i]);
			else dp[i + 1][j] = dp[i][j];
		}
	}
	DMP(dp);

	cout << dp[N][W] << "\n";

	return 0;
}


Measured memory_bytes: 6832
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
	double a, n[10] = {};

	while (cin >> a)
	{
		n[0] = a;
		double sum = n[0];
		for (int i = 1; i < 10; i++)
		{
			if (i % 2 == 1) n[i] = n[i - 1] * 2;
			else  n[i] = n[i - 1] / 3.0; 
			sum += n[i];
	//		cout << n[i] << " ";
		}
		//cout << endl;
		printf("%.6f\n", sum);
	}
	return 0;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll d,n; cin>>d>>n;
  ll ans=1;
  rep(i,d) ans*=100;
  if(n==100) ans*=101;
  else ans*=n;
  cout<<ans<<endl;
}

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

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

typedef long long ll;
typedef pair<int, int> P;

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

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

    for (int i = 1; i <= N; ++i) {
        int X = i * 1.08;
        if (X == N) {
            cout << i << endl;
            return 0;
        }
    }

    puts(":(");
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int N = Integer.parseInt(stdin.next());
		int H[] = new int[N];
		int max = 0;
		int cnt = 0;
		
		for(int i=0;i<N;i++) {
			H[i] = Integer.parseInt(stdin.next());
		}
		
		for(int i=0;i<N-1;i++) {
			if(H[i] >= H[i+1]) {
				cnt+=1;
			}
			else if(H[i] < H[i+1]) {
				if(max < cnt) {
					max=cnt;
				}
				cnt=0;
			}
		}
		if(max<cnt) {
			max = cnt;
		}
		System.out.println(max);
		
		out.flush();
	}

}


Measured memory_bytes: 47588
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int h,w,i,j,k,b;
	int c[11][11]={};
	int c2[11][11]={};
	int mg[11]={};
	int mg2[11]={};
	int a[202][202]={};
	int mp=0;
	cin>>h>>w;
	FOR(i,0,10)FOR(j,0,10){
		cin>>c[i][j];
		mg[i]=114514;
	}
	//int min=10000,x=0,y=0;
	FORQ(j,0,9)mg2[j]=114514;
	mg[1]=0;
	mg2[1]=0;
	//FORQ(i,2,9){
		int min=10000,x=0,y=0;
		x=1;y=2;
		while(1){
			min=10000;
			FORQ(j,0,9){
				if(mg2[x]+c[j][x]<mg2[j])mg2[j]=mg2[x]+c[j][x];
			}
			y=x;
			FORQ(j,0,9){
				if(mg[j]!=0&&mg2[j]<min){
					min=mg2[j];
					y=j;
					//cout<<j<<endl;
				}
				
			}
			
			if(x==y)break;
			else {
				mg[y]=0;
				x=y;
			}
		}
	//}
	
	//FOR(j,0,10)cout<<j<<":"<<mg2[j]<<" ";
	
	FORQ(i,1,h)FORQ(j,1,w){
		//A in
		cin>>b;
		if(b!=-1)mp+=mg2[b];
	}
	cout<<mp<<endl;
	
	
    return 0;
}

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

int main()
{
    int n,k,i,ara[100005],cnt=0;
    scanf("%d %d",&n,&k);
     for(i=0;i<n;i++){
        scanf("%d",&ara[i]);
    }
    for(i=0;i<n;i++)
    {
        if(ara[i]>=k)
            cnt++;
    }

    printf("%d",cnt);

}


Measured memory_bytes: 640
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

A, B, C = map(int, input().split())
print(A + B + C - max(A, B, C))



Measured memory_bytes: 38256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<iomanip>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)	
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<string> vs;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
Def inf = sizeof(Def) == sizeof(ll) ? 2e18 : 1e9+10;
int main(){
	int n,m;
	while(cin>>m>>n,n){
		vvi H(n-1,vi(m));
		vvi W(n,vi(m-1));
		rep(i,n-1){
			rep(j,m-1)cin>>W[i][j];
			rep(j,m)cin>>H[i][j];
		}
		rep(i,m-1)cin>>W[n-1][i];
		
		vvi dp(n,vi(m,inf));
		dp[0][0]=1;
		queue<pii>q;
		q.push({0,0});
		while(!q.empty()){
			pii t=q.front();
//			cout<<t.first<<" "<<t.second<<endl;
			q.pop();
			rep(i,4){
				int x=t.first+dx[i];
				int y=t.second+dy[i];
				if(x<0||y<0||x>=n||y>=m)continue;
				if(i==0&&W[t.first][t.second])continue;
				if(i==1&&H[t.first][t.second])continue;
				if(i==2&&W[t.first][t.second-1])continue;
				if(i==3&&H[t.first-1][t.second])continue;
				if(dp[x][y]>dp[t.first][t.second]+1){
					dp[x][y]=dp[t.first][t.second]+1;
					q.push({x,y});
				}
			}
		}
		if(dp[n-1][m-1]==inf)dp[n-1][m-1]=0;
		cout<<dp[n-1][m-1]<<endl;
	}
}











Measured memory_bytes: 3136
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

ll GCD(ll a, ll b) { if(b==0) return a; else return GCD(b, a%b); }
ll LCM(ll a, ll b) { return a/GCD(a,b)*b; }

class AWhiteCells {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int H,W,h,w;in>>H>>W>>h>>w;
	    out<<H*W-h*W-H*w+h*w<<endl;

	}
};


int main() {
	AWhiteCells solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
int main () {
  int X, Y;
  cin>>X>>Y;
  string a="No";
  for (int i=0; i<X+1; i++){
    if (4*i+2*(X-i)==Y)
      a="Yes";
  }
  cout<<a<<endl;
}
    

Measured memory_bytes: 3624
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int main(void){
	int n, i;
	char s[300000];
	int a[300001];
	scanf("%d%s", &n, s);
	a[0]=0;
	for(i=1; i<=n; i++){
		a[i]=a[i-1]+(s[i-1]=='E');
	}
	int ans=n;
	for(i=1; i<=n; i++){
		int now=i-1-a[i-1]+a[n]-a[i];
		if(now<ans) ans=now;
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const int maxn=1e5+5;
const int MOD=1e9+7;
int a[maxn];
ll f[maxn];
int first[maxn];
ll ans1[maxn];
int cmp(int a,int b)
{
    return a>b;
}
string s;
map<ll,int> mp;
int main()
{
    cin>>s;
    int ans=0;
    int flag=0;
    int cou=0;
    for(int i=0;i<s.size();i++){
        if(flag==0){
            if(s[i]=='R'){
                flag=1;
                cou=1;
            }
        }
        else{
            if(s[i]=='R'){
                cou++;
            }
            else{
                flag=0;
                ans=max(ans,cou);
                cou=0;
            }

        }
    }
    ans=max(cou,ans);
    cout<<ans<<endl;

}




Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

int n, m, k;

template<class T>
T pow(T x, T n) {
	T res = 1;
	while (n > 0) {
		if (n & 1) res = res * x;
		x = x * x;
		n >>= 1;
	}
	return res;
}

ll dfs(int now_v,int cnt) {
	if (cnt == n) return max(now_v - k, 1);
	ll res = 0;
	REP(i, 1, m + 1) res += dfs(now_v + i, cnt + 1);
	return res;
}

signed main() {
	while (cin >> n >> m >> k) {
		if (n == 0) break;
		printf("%.20lf\n", (double)dfs(0, 0) / pow(m, n));
	}
	return 0;
}

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

int main()
{
  int n, x, cnt;

  while(cin >> n >> x) {
    if(n==0 && x==0) {
      break;
    }
    cnt = 0;
    for(int i = 1; i <= n; i++) {
      for(int j = i + 1; j <= n; j++) {
        for(int k = j + 1; k <= n; k++) {
          if ( i+j+k == x ) {
            cnt++;
         }
        }
      }
    }
    cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 3088
package main

import "fmt"

func main() {

	var N, D int
	fmt.Scan(&N , &D)
	
	
	var x int = N / (2 * D + 1)
	if( x * (2 * D + 1) < N ){
		x++
	}
	
	fmt.Println(x)
	
}


Measured memory_bytes: 512
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
now = a[0]
for i in range(1,n):
    now ^= a[i]
for i in range(n):
    print(now^a[i])

Measured memory_bytes: 32632
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // ABC154A - Remaining Balls

        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();

        int a = sc.nextInt();
        int b = sc.nextInt();

        String u = sc.next();

        if (u.equals(s)) {
            --a;
        } else {
            --b;
        }

        System.out.println(a + " " + b);
    }
}

Measured memory_bytes: 21716
import sys

n=int(input())
v=[int(x) for x in input().rstrip().split()]
  
dic1={}
dic2={}
if v.count(v[0])==n:
  print(n//2)
else:
  for i in range(n):

    if i%2==0:
      if v[i] in dic1:
        dic1[v[i]]+=1
      else:
        dic1[v[i]]=1

    else:
      if v[i] in dic2:
        dic2[v[i]]+=1
      else:
        dic2[v[i]]=1

  dic1=sorted(dic1.items(),key=lambda x:x[1],reverse=True)
  dic2=sorted(dic2.items(),key=lambda x:x[1],reverse=True)

  if dic1[0][0]==dic2[0][0]:
    print(min(n-(dic1[0][1]+dic2[1][1]),n-(dic1[1][1]+dic2[0][1])))
  else:
    print(n-(dic1[0][1]+dic2[0][1]))





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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> plli;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>=0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const int mod = 1e9 + 7;
const ll INF = 1<<30;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    int n,k;
    cin >> n >> k;
    vi a(n);
    rep(i,n) scanf("%d",&a[i]);
    vvi ldp(n,vi(k,0));
    vvi rdp(n,vi(k,0));
    rep(i,n){
        ldp[i][0]=1;rdp[i][0]=1;
        if (a[i]<k) ldp[i][a[i]]=1;
        if (a[n-1-i]<k) rdp[i][a[n-1-i]]=1;
    }
    rep2(i,1,n)rep(j,k){
            if (j-a[i]>=0) ldp[i][j]=ldp[i-1][j-a[i]]||ldp[i-1][j];
            else ldp[i][j]=ldp[i-1][j];
            if (j-a[n-1-i]>=0) rdp[i][j]=rdp[i-1][j-a[n-1-i]]||rdp[i-1][j];
            else rdp[i][j]=rdp[i-1][j];
    }
    rep(i,n)rep2(j,1,k){
        rdp[i][j]+=rdp[i][j-1];
    }
    int cnt=0;
    int lnum=0;
    rep(i,n){
        if (k-a[i]<=0){
            cnt+=1;
            continue;
        }
        rep(j,k){
            if (i==0) lnum=0;
            else if (i==n-1){
                if (ldp[i-1][j] && a[i]+j>=k){
                    cnt+=1;
                    break;
                }
                continue;
            }
            else{
                if (ldp[i-1][j]) lnum=j;
                else continue;
            }
            if (k-a[i]-lnum<=0){
                cnt+=1;
                break;
            }
            if (rdp[n-2-i][k-1-lnum]-rdp[n-2-i][k-a[i]-lnum-1]){
                cnt+=1;
                break;
            }
        }
    }
    cout << n-cnt << endl;
    return 0;
}

Measured memory_bytes: 195968
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;


#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pii pair<int,int>
#define pf push_front
#define mp make_pair
#define vi vector<int>
#define vip vector<pair<int,int> >
#define ff first
#define ss second
#define int long long
#define mod 1000000007
#define BIG 998244353
#define s(t) scanf("%lld",&t)
#define p(t) printf("%lld\n",t)
#define mii map<int,int>
#define MSET(table,i) memset(table, i, sizeof(table))
#define endl '\n'
#define tc int t;cin>>t;while(t--)
#define pi  3.1415926358
#define bits(x) __builtin_popcountll(x)
#define minimum(a,n) min_element(a,a+n)-a
#define maximum(a,n) max_element(a,a+n)-a
#define pqbig priority_queue<int>
#define pqsmall priority_queue<pii,vector<pii>,greater<pii> >
#define all(v) v.begin(),v.end()
#define sitr set<int>:: iterator
#define spitr set<pii>:: iterator
#define mitr map<int,int>:: iterator

int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}


typedef tree<pii, null_type, less<pii>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;


#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

const int N=2e5+5;
int parent[N];
int high[N];

void init()
{
	for(int i=1;i<N;i++)
		parent[i]=i;
}

int root(int x)
{
	if(parent[x]==x)
		return x;
	return parent[x]=root(parent[x]);
}

void merge(int x,int y)
{
	int rx=root(x);
	int ry=root(y);

	if(rx==ry)
		return;
	parent[rx]=ry;
}

int32_t main()
{
	fast;
	int n,m;cin>>n>>m;
	init();
	for(int i=1;i<=m;i++)
	{
		int x,y;cin>>x>>y;
		merge(x,y);
	}

	for(int i=1;i<=n;i++)
		high[root(i)]++;

	int ans=*max_element(high,high+N);
	cout<<ans<<endl;
}


Measured memory_bytes: 11312
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
#define PP(p) cout<<(p)<<" ";
#define pb push_back
#define mp make_pair
#define INF 1e18

typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef pair<int, int> pi;
//int dy[8]={1,1,1,0,-1,-1,-1,0};
//int dx[8]={-1,0,1,1,1,0,-1,-1};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};

#define MAX 100001
int n,q;
int data[MAX+1];
void add(int i,int v){
  while(i<=n){
    data[i]+=v;
    i+=i&-i;
  }
}
int sum(int i){
  int res=0;
  while(i>0){
    res+=data[i];
    i-=i&-i;
  }
  return res;
}
void input(){
	cin>>n>>q;

	rep(i,q){
		int c,x,y;
		cin>>c>>x>>y;
		if(c){P(sum(y)-sum(x-1));}
		else add(x,y);
	}
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	input();
	return 0;
}

Measured memory_bytes: 3896
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    string c1, c2;
    cin >> c1 >> c2;
    bool ans = true;
    rep(i, 3) {
        if (c1[i] != c2[2 - i]) {
            ans = false;
        }
    }
    if (ans) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void prime_map(map<ll, ll> &m, ll num) {

    if (num == 1) {
        return;
    }
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }
    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }

        return;
    }
    prime_map(m, num);
    return;
}


Measured memory_bytes: 256
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


def dfs(s, mx, n):
    l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k']
    if len(s) == n:
        print(s)
        return
    for i in range(mx+2):
        t = s
        t += l[i]
        dfs(t, max(mx, i), n)


def main():
    n = int(input())
    dfs('', -1, n)


main()


Measured memory_bytes: 60632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);

const int N = 2e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
int tc;

int main()
{
    FIO
    int n; cin>>n;
    vector<ll> vec(n);
    for(auto &it : vec)
        cin>>it;
    sort(vec.begin(), vec.end());
    ll ans = 0;
    for(int i = 0 ; i<n ; i++)
    {
        for(int j = i+1 ; j < n; j ++ )
        {
            for(int k = j+1 ; k < n ; k++)
            {
                if(vec[i] != vec[j] && vec[i] != vec[k] && vec[j]!= vec[k] && vec[i] + vec[j] > vec[k])
                    ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long  l;
typedef pair<int,int> pl;
const ll INF=100000000000000001;
const double PI=3.141592653589;


int main(){
  int n; cin>>n;
  vector<int> d(n);
  rep(i,n){
    cin>>d[i];
  }

  sort(d.begin(),d.end());
  int k=d[n/2]-d[n/2-1];

  cout<<k<<endl;

  return 0;
}


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

int main(){
  int M, D;
  cin >> M >> D;
  int count = 0;
  for(int m = 1; m <= M; m++){
    for(int d = 1; d <= D; d++){
      int d1, d10;
      d1 = d%10;
      d10 = (d/10) % 10;
      if((m == d1*d10)&&(d1>=2)&&(d10>=2)) count++;
    }
  }
  cout << count;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define vi vector<int>
#define lvi vector<long long>
#define pi pair<int,int>
#define lpi pair<long long ,long long>
#define mp make_pair
#define pb push_back
#define ll long long 
#define N 100005
#define faltu ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007
#define mod1 1000000000000000007
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>multiordered_set;
ll int pw(ll int a, ll int b,ll md) {
    if (b == 0) return 1;
    ll int t = pw(a, b / 2,md);
    if (b % 2 == 0) return (t * t)%mod;
    else return ((t * t)%mod * a)%mod;
}
vector<int> pm;
void prm(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
              prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p]) pm.push_back(p);
}
bool cmp(const pair<ll int,ll int> &a,const pair<ll int,ll int> &b)
{
    if(a.first==b.first)return a.second<b.second;
    return a.first<b.first;
}
ll int gcd(ll int a,ll int b)
{
    if(!a)return b;
    return gcd(b%a,a);
}
bool isPrime(int n) 
{ 
    if (n <= 1) 
        return false; 
    for (int i = 2; i < n; i++) 
        if (n % i == 0) 
            return false; 
    return true; 
} 
map<int,int>pa;
int find(int i){
    if(pa[i]==i)return i;
    return pa[i]=find(pa[i]);
}     
void join(int i,int j){
    int a=find(i);
    int b=find(j);
    if(b>=a)pa[b]=a;
    else pa[a]=b;
}               
int ddx[]={-1,-1,-1,0,1,1,1,0};
int ddy[]={-1,0,1,1,1,0,-1,-1};
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int main()
{
    faltu;
    int t=1;
    //cin>>t;
    while(t--)
    {
        int n,cnt=0;
        cin>>n;
        string s;
        cin>>s;
        for(int i=0;i<n;)
        {
            cnt++;
            int j=i;
            while(s[i]==s[j])j++;
            i=j;
        }
        cout<<cnt<<endl;
    }
}

Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
int main(){
	int l,r,d;
	cin >> l >> r >> d;
	int ans = 0;
	for(int i = l;i <= r;++i){
		if(i % d == 0){
			ans += 1;
		}
	}
	cout << ans;
	return 0;
}

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

int addtax(int n,int p){
    return n*(100+p)/100;
}

int remtax(int n,int p){
    int ans = n*100/(100+p);
    if(addtax(ans,p)!=n)ans++;
    return (addtax(ans,p)==n ? ans : 0);
}

int main(void)
{
    int x,y,a,b,s;
    int max_sy;
    while(cin>>x>>y>>s,x|y|s){
        for(a=max_sy=1;;++a){
            b = remtax(s-addtax(a,x),x);
            if(!b)continue;
            if(a>b)break;
            max_sy = max(max_sy , addtax(a,y)+addtax(b,y));
        }
        cout<<max_sy<<endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <stdlib.h>
using namespace std;
long n,k,i,j,h[100001],b[100001];
long tmp;
int main()
{
    //freopen("frog2.inp","r",stdin);
    cin >> n >> k;
    for (i=1;i<=n;i++)
    {
        cin >> h[i];
    }
    b[1]=h[1];
    for (i=2;i<=n;i++)
    {
        tmp=999999999;
        for (j=1;j<=k;j++)
        {
            if (i>j)
            {
               tmp=min(b[i-j]+abs(h[i]-h[i-j]),tmp);
            }
            else
            {
                break;
            }
        }
        b[i]=tmp;
    }
    cout << b[n]-b[1];
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int N = sc.nextInt();
		String[] S = new String[N];
		for (int i = 0; i < N; i++) {
			S[i] = sc.next();
		}

		int count = 0;
		int ba = 0;
		int startsWithB = 0;
		int endsWithA = 0;
		for (String s : S) {
			char[] chars = s.toCharArray();
			boolean sb = chars[0] == 'B';
			boolean ea = chars[chars.length - 1] == 'A';

			if (sb && ea) {
				ba += 1;
			} else if (sb) {
				startsWithB += 1;
			} else if (ea) {
				endsWithA += 1;
			}

			for (int j = 1; j < chars.length; j++) {
				if (chars[j - 1] == 'A' && chars[j] == 'B') {
					count += 1;
				}
			}
		}
		count += Math.max(ba - 1, 0);
		if (endsWithA > 0 && startsWithB > 0 && ba > 0) {
			count += 2;
			endsWithA -= 1;
			startsWithB -= 1;
		} else {
			count += Math.abs(endsWithA - startsWithB) > 0 ? Math.min(ba, 1) : 0;
		}
		count += Math.min(endsWithA, startsWithB);
		System.out.println(count);
	}
}


class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

Measured memory_bytes: 31748
a=list(map(int,input().split()))
K = a[0]
A = a[1]
B = a[2]
if B - A <= 2:
    print(str(K + 1))
else:
    ans = A
    if (K + 1 - A) % 2 == 1:
        ans += 1
    print(str(ans + int((K + 1 - A)/2) * (B - A)))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

void test_case(){
	int x,a; cin >> x >> a;
	if(x < a)
		cout<<"0\n";
	else
		cout<<"10\n";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 3656