akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VL vector<LL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e9;
const LL INF = 1e9;

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    /*
    int t,n;
    cin>>t;
    loop(t1,1,t+1)
    {
        int a[n];
        loop(i,0,n) cin>>a[i];
    }
    */

    LL a,b,c,k;
    cin>>a>>b>>c>>k;

    LL ans = 0;
    ans += min(a,k);
    k -= min(a,k);
    k -= min(b,k);
    ans -= min(c,k);

    cout<<ans<<'\n';
    /*
    if(f) cout<<"Yes"<<'\n';
    else cout<<"No"<<'\n';
    */

    return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
long long n, a, b, x, y;
int main() {
	scanf("%lld%lld%lld", &n, &a, &b);
	if ((b - a) % 2 == 0) {
		printf("%lld\n", (b - a) / 2);
		return 0;
	}
	x = b + a - 1;
	y = 2 * n - a - b + 1;
	if (x > y)x = y;
	printf("%lld\n", x / 2);
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp9
{   
    class Program
    {
        public static void Main(string[] args) {
            while (true)
            {
                string[] sss = Console.ReadLine().Split(' ');
                int a = int.Parse(sss[0]); int b = int.Parse(sss[2]);
                if (sss[1] =="?") { break; }
           else     if (sss[1] == "+") { Console.WriteLine(a+b); }
            else    if (sss[1] == "-") { Console.WriteLine(a - b); }
            else    if (sss[1] == "*") { Console.WriteLine(a * b); }
                else { Console.WriteLine(a / b); }

            }
        }
    }
}

Measured memory_bytes: 9188
a,b,x=map(int,input().split())
if a%x!=0:
  a+=x-a%x

if a==b and a==0:
  print(1)
elif a==b and a==x:
  print(1)
elif a>=b:
  print(0)
else:
  print(b//x-a//x+1)

Measured memory_bytes: 9148
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize, k: usize);

    let mut kakuritsu: f64 = 0.0;
    for i in 1..n + 1 {
        let mut buff = i;
        let mut count = 0;
        loop {
            if buff >= k {
                break;
            }
            buff *= 2;
            count += 1;
        }

        kakuritsu += 1.0 / (1 << count) as f64;
    }

    println!("{}", kakuritsu / n as f64);
}


Measured memory_bytes: 2144
import sys

def main():

    # sys.stdin = open('input148d.txt')

    n = int(input())
    a = list(map(int, input().split()))

    i = 1
    r = 0
    for j in range(n):
        if a[j] == i:
            i += 1
        else:
            r += 1

   
    if r == n:
        print(-1)
    else:
        print(r)
            
if __name__ == '__main__':
    main()


Measured memory_bytes: 26268
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
#define all(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define TDARRAY(int,a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
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;}

int n,m,l;


int main() {
    cin >> n >> m;
    l = n-1+m;
    vector<int> a(l);
    vector<int> b(l);
    vector<vector<int>> eo(n);
    vector<vector<int>> ei(n);
    REP(i,l){
        int _a,_b;
        cin >> _a >> _b;
        a[i] = _a-1;
        b[i] = _b-1;
        ei[b[i]].push_back(a[i]);
        eo[a[i]].push_back(b[i]);
    }
    vector<int> is(n);
    REP(i,n){
        is[i]=ei[i].size();
    }
    int r = 0;
    while(ei[r].size()){
        r = ei[r][0];
    }
    vector<int> res(n);
    res[r]=-1;
    queue<P> q;
    REP(i,eo[r].size()){
        q.push(make_pair(r,eo[r][i]));
    }
    while(q.size()){
        P e = q.front();q.pop();
        if(is[e.second]==1){
            res[e.second]=e.first;
            REP(i,eo[e.second].size()){
                q.push(make_pair(e.second,eo[e.second][i]));
            }
        }else{
            is[e.second]--;
        }
        
    }
    REP(i,n){
        put(res[i]+1);
    }
    return 0;
}




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

using namespace std;

int a, b, c, d, e, mn;
int A=1000000005, B=100000000005, C=100000005, D=100000005, E=1000000005;

int main () {
	cin >> a >> b >> c >> d >> e;
	if(a % 10 != 0) {
		A = a % 10;
	}
	if(b % 10 != 0) {
		B = b % 10;
	}
	if(c % 10 != 0) {
		C = c % 10;
	}
	if(d % 10 != 0) {
		D = d % 10;
	}
	if(e % 10 != 0) {
		E = e % 10;
	}
	mn = min(A, min(B, min(C, min(D, E))));
	if(mn == A) {
		cout << a + (b + 9) / 10 * 10 + (c + 9) / 10 * 10 + (d + 9) / 10 * 10 + (e + 9) / 10 * 10;
	}
	else if(mn == B) {
		cout << b + (a + 9) / 10 * 10 + (c + 9) / 10 * 10 + (d + 9) / 10 * 10 + (e + 9) / 10 * 10;
	}
	else if(mn == C) {
		cout << c + (b + 9) / 10 * 10 + (a + 9) / 10 * 10 + (d + 9) / 10 * 10 + (e + 9) / 10 * 10;
	}
	else if(mn == D) {
		cout << d + (b + 9) / 10 * 10 + (c + 9) / 10 * 10 + (a + 9) / 10 * 10 + (e + 9) / 10 * 10;
	}
	else if(mn == e) {
		cout << e + (b + 9) / 10 * 10 + (c + 9) / 10 * 10 + (d + 9) / 10 * 10 + (a + 9) / 10 * 10;
	}
	return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll D,N,M;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	
	cin>>N>>M>>D;
	double a;
	if(D==0) {
		a=N;
	}
	else if(D*2<=N-1) {
		a=N+(N-2*D);
	}
	else {
		a=2*(N-1-D+1);
	}
	a*=(M-1);
	double b=N*N;
	_P("%.12lf\n",a/b);
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 384
/**
 *    author:  morato
 *    created: 13.09.2020 09:01:10
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int64_t a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max({a * c, b * d, a * d, c * b}) << '\n';
  return 0;
}

Measured memory_bytes: 3652
#include<cstdio>
using namespace std;
int n,k,h,i,ans=0;
int main()
{
	scanf("%d %d",&n,&k);
	for(i=1;i<=n;i++) 
	{
		scanf("%d",&h);
		if(h>=k) ans++;
	}	
	printf("%d",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long double
#define PB push_back
#define MP make_pair
#define ff first
#define ss second
#define pri 1000000007
using namespace std;
void run(){
	ll n,k;
	cin>>n>>k;
	ll p=0;
	for(ll j=1;j<=n;j++)
	{
	   if(j>=k){p+=1/n;continue;}
		ll f=k/j;
		ll c=log2(f);
		int e=ceil(c);
		ll a=pow(2,e);
		a*=n;
		p+=1/(a);
	
		
	}
	cout<<setprecision(12)<<fixed<<p<<endl;
	
}
int main() {
	ll t=1;
	//cin>>t;
	for(ll j=0;j<t;j++)run();
	// your code goes here
	return 0;
}

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

struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> using iodef_rng_t = typename enable_if<decltype(declval<C>().begin(), true_type{})::value && !is_same<C, string>::value>::type;
template<class C, class = iodef_rng_t<C>> istream& operator>>(istream& in, C& c) { for (auto& v : c) { in >> v; } return in; }
template<class C, class = iodef_rng_t<C>> ostream& operator<<(ostream& out, const C& c) { int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
template<class T> void trace_(const char* s, const T& v) { cerr << s << "=" << v; }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { for (; *s != ','; ++s) { cerr << *s; } cerr << "=" << v << ","; trace_(++s, vs...); }
#define TRACE(...) (cerr << "\033[2m\033[33m", trace_(#__VA_ARGS__, __VA_ARGS__), cerr << "\033[0m\n")
#else
#define TRACE(...)
#endif

int main() {
    string s;
    cin >> s;
    if (s == "AAA" || s == "BBB") puts("No");
    else puts("Yes");
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int n[5];
    int n2[5];
    for(int i=0;i<5;i++){
        scanf("%d",&n[i]);
        if(n[i]%10==0){
            n2[i]=n[i];
        }else{
            n2[i] = n[i]+(10-n[i]%10);
        }
        //printf("%d\n",n2[i]);
    }
    int sum = 0;
    int min = 10000000;
    for(int i=0;i<5;i++){
        sum = n[i];
        for(int j=0;j<5;j++){
            if(i!=j){
                sum += n2[j];
            }
        }
        if(sum<min){
            min = sum;
        }
    }
    printf("%d",min);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;

// typedef
typedef long long ll;
typedef unsigned long ul;
// #define int long long

// macro
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // 値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)  // 直後の要素をパディング
#define space_pad(num) setfill(' ') << std::right << setw(num)  // 直後の要素をパディング

// func declaration
template <class T> void print2DVec(vector< vector<T> >&);
template <class T> void calcVec(vector<T>&, int, char);
int char_to_int(const char);

// const
const int INF = 10000000;

/*MEMO
・辞書順
abc < abcd, atcoder < atlas
・イテレータ
std::vector<int>::iterator とタイプするのは面倒なので、
 通常は型推論の auto を使用する。
 auto iter = max_element(ALL(vec));
・2次元配列
vector<vector<int>> vec = {{1, 2, 3}, {4, 5, 6}}
・20×10の配列
vector<vector<int>> vec(20, vector<int>(10, 0));
・(n, m)の多次元配列
vector< vector<int> > vec(n, vector<int>(m, 0))  // 0で初期化
*/

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

    // input
    int N, X;
    cin >> N >> X;
    vector<int> vec(N);
    REP(i, N) cin >> vec.at(i);
    
    // calculation
    int sum = SUM(vec), min = *MIN(vec), rest = X - sum;
    cout << N + rest/min << "\n";
    
    return 0;
}


// function
template <class T> void print2DVec(vector< vector<T> >& vec) {
    REP(i, vec.size()) {
        REP(j, vec.front().size()) {
            cout << vec.at(i).at(j);
        }
        cout << endl;
    }
}

template <class T> void calcVec(vector<T> &vec, int num, char ch) {
    // vec全体への演算
    switch (ch) {
        case '+':
            REP(i, vec.size()) vec.at(i) += num; break;
        case '-':
            REP(i, vec.size()) vec.at(i) -= num; break;
        case '*':
            REP(i, vec.size()) vec.at(i) *= num; break;
        case '/':
            REP(i, vec.size()) vec.at(i) /= num; break;
        case '%':
            REP(i, vec.size()) vec.at(i) %= num; break;
        default:
            cout << "Incorrect Operator" << endl;
    }
}

int char_to_int(const char c) {
    if('0' <= c && c <= '9') return (c - '0');
    return -1;
}


Measured memory_bytes: 256
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
// #define MOD  998244353
#define ll long long
const double PI = atan(1.0) * 4;
// const ll INF = (int)1e9 ;
const int di[4] = { -1, 0, 1, 0} ;
const int dj[4] = {0, -1, 0, 1} ;
const ll INF = (ll)2e18 + 50;
const int maximum  = numeric_limits<int>::min();
const int minimum  = numeric_limits<int>::max();
// const int N = 1e5 + 5 ;
const ll mod = 1e9 + 7 ;

ll power(ll a , ll e) {
	ll res = 1LL ;
	while (e > 0) {
		if (e % 2 == 1) res = res * a;
		a =  a * a  ;
		e /= 2 ;
	}
	return res ;
}
bool isBalanced(const string &exp)
{
	// Initialising Variables
	bool flag = true;
	int count = 0;

	// Traversing the Expression
	for (int i = 0; i < exp.length(); i++) {

		if (exp[i] == '(') {
			count++;
		}
		else {
			count--;
		}
		if (count < 0) {
			flag = false;
			break;
		}
	}
	if (count != 0) {
		flag = false;
	}

	return flag;
}

int gcd(int a, int b , int &x , int &y) {
	if (b == 0) {
		x = 1 ;
		y = 0 ;
		return a ;
	}
	int x1 , y1 ;
	int d = gcd(b , a % b , x1 , y1) ;
	x = y1 ;
	y = x1 - y1 * (a / b) ;
	return d ;

}







int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// int t ;
	// cin >> t ;
	// while (t--) {
	int l , r , d ;
	cin >> l >> r >> d ;
	int ans = 0 ;
	for (int i = 1 ; i <= 1000 ; i++) {
		if (d * i >= l && d * i <= r) ans++ ;
	}
	cout << ans << "\n";










	// }

	return 0 ;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);

void solve(){
    ll k; cin >> k;
    queue<ll> que;
    
    for(ll i=1; i<=9; i++){
        que.push(i);
    }

    ll cnt = 0;
    while(true){
        ll q = que.front();
        que.pop();
        cnt++;
        if(cnt == k){
            cout << q << endl;
            break;
        }
        ll resid = q%10;
        if(resid == 0){
            que.push(10*q+resid);
            que.push(10*q+resid+1);
        }
        else if(resid == 9){
            que.push(10*q+resid-1);
            que.push(10*q+resid);
        }
        else{
            que.push(10*q+resid-1);
            que.push(10*q+resid);
            que.push(10*q+resid+1);
        }

    }
}

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

Measured memory_bytes: 1792
import sys
import heapq

input = sys.stdin.readline


def main():
    N = int(input())
    nb = [[] for _ in range(N)]
    for i in range(N - 1):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        nb[a].append((c, b))
        nb[b].append((c, a))
    for x in nb:
        x.sort()

    Q, K = map(int, input().split())
    K -= 1

    dist = [None] * N
    h = [(0, K, -1)]
    while h:
        d0, node, parent = heapq.heappop(h)
        dist[node] = d0
        for d1, child in nb[node]:
            if child != parent:
                heapq.heappush(h, (d0 + d1, child, node))

    for i in range(Q):
        x, y = map(int, input().split())
        # print(f"{x}->K = {dist[x]}, K->{y} = {dist[y]}")
        print(dist[x - 1] + dist[y - 1])


if __name__ == "__main__":
    main()


Measured memory_bytes: 84180
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
#include <vector>
//#include <unordered_map>
//#include <string>
typedef long long LL;
//typedef long double LD;
using namespace std;

#define MOD 1000000007

LL mod_pow(LL x, LL n){
    LL ans = 1;
    while(n>0){
        if((n&1)==1){
            ans = ans * x % MOD;
        }
        x = x * x % MOD;
        n >>= 1;
    }
    return ans;
}

LL comb_s(LL n, LL r){
    LL tmp_n=1;
    LL tmp_d=1;
    LL ans;
    for(int i=1; i<=r; i++){
        tmp_n=(tmp_n*(n+1-i))%MOD;
        tmp_d=(tmp_d*i)%MOD;
        ans=tmp_n*mod_pow(tmp_d,MOD-2);
    }

    return ans;    
}

int main() {
    LL n;
    LL n_tmp;
    LL a;
    LL b;
    LL ans=1;

    cin >> n >> a >> b;
    ans=mod_pow(2,n);
    ans--;
    LL tmp_nd;
    tmp_nd=comb_s(n,a);
    ans=(ans-tmp_nd)%MOD;
    while(ans<0){
        ans+=MOD;
    }
    //cout << ans << " " << tmp_ans << endl;

    tmp_nd=comb_s(n,b);
    ans=(ans-tmp_nd)%MOD;
    //cout << ans << " " << tmp_ans << endl;
    while(ans<0){
        ans+=MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int a[1000006];
int main(){
	string s;
	cin >> s;
	int n = s.length(), m = 0;
	for (int i = 0; i < n; ++ i)
		if (s[i] == 'B')
			a[++ m] = i + 1;
	long long ans = 0;
	for (int i = 1; i <= m; ++ i)
		ans += n - a[i] - (m - i);
	cout << ans << endl;
}


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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	int x;
	cin >> x;
	if(x < 1200) puts("ABC");
	else puts("ARC");
	
	return 0;
}


Measured memory_bytes: 256
//************************
//*  Date: 2018.8.25     *
//*  Problem:            *
//*  Author: xuziyuan    * 
//************************

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,i;

int main()
{
	cin>>n>>i;
	cout<<n-i+1<<endl;
	rt0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<random>
using namespace std;
int main() {

  string ss, t;
  cin >> ss >> t;
  vector<string> ans;
  string s = ss;
  for(int i=0; i<s.size(); i++){
    s = ss;
    bool f = true;
    for(int j=0; j<t.size(); j++){
      if( i + j > s.size() ){ f = false; break;}
      if( s[i+j] == '?' || s[i+j] == t[j] ){
        s[i+j] = t[j];
        continue;
      }else{
        f = false;
      }
    }
    if( f ){
      for(int j=0; j<s.size(); j++){
        if( s[j] == '?' ) s[j] = 'a';
      }
      ans.push_back(s);
    }
  }

  if( ans.size() == 0 ){
    cout << "UNRESTORABLE" << endl;
  }else{
    sort(ans.begin(), ans.end());
    cout << ans[0] << endl;
  }


  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
int a[100],b[100],c[100];

int main(){
	for (int i = 1; i < 100; i++)
		a[i] = b[i] = c[i] = 10000;
	for (int i = 0; i <= 50; i++){
		if(i%2==0)
			a[i] = (i/10) * (380 * 5 * 4 / 5) + 380 * ((i%10)/ 2);
		if(i%3==0)
			b[i] = (i/12) * (550 * 4 * 85/ 100) + 550 * ((i%12)/3);
		if(i%5==0)
			c[i] = (i/15) * (850 * 3 * 88/ 100) + 850 * ((i%15)/5);
	}
	int n;
	while(cin>>n,n){
		n /= 100;
		int ans = (int)1e8;
		for (int i = 0; i <= n; i++){
			for (int j = 0; j <= n-i; j++){
				ans = min(ans,a[i]+b[j]+c[n-i-j]);
			}
		}
		cout << ans << endl;
	}

    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                           \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
  cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int X, Y;
  cin >> X >> Y;
  bool isok = !(Y & 1);
  isok &= 2 * X <= Y && Y <= 4 * X;
  cout << (isok ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3636
import java.util.*;

public class Main {


    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();

        int dp[] = new int[n+2];
        boolean stairs[] = new boolean[n+1];
        dp[0] = 0;
        dp[1] = 1;


        int a[] = new int[m];

        for (int i=0; i<m; i++){
            a[i] = sc.nextInt();
            stairs[a[i]] = true;
        }

        for (int j=0; j<n; j++) {
            if (stairs[j+1]) {
                dp[j]=0;
                continue;
            }
            else{
                dp[j + 2] = (dp[j + 1] + dp[j]) % 1000000007;
            }
        }

        System.out.println(dp[n+1]);

    }
}



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

using namespace std;
using ll = long long;

#pragma region Macros
#define FOR(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) FOR(i, 0, n)

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

template <class T> string join(const T &v, const string delim = ",")
{
    if (v.empty())
        return "";

    ostringstream res;
    res << v[0];
    for (int i = 1; i < v.size(); i++)
    {
        res << delim << v[i];
    }
    return res.str();
}

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << ":" << #x << " = " << (x) << endl;
#else
#define dbg
#endif

#pragma endregion Macros

int main()
{
    //cout << fixed << setprecision(10);
    int N,M;
    cin >> N >> M;
    vector<ll> a(N), b(N);
    vector<ll> c(M), d(M);

    rep(i, N) cin >> a[i] >> b[i];
    rep(i, M) cin >> c[i] >> d[i];

    rep(i,N){
        ll dist = 100100100100100;
        int n;
        rep(j, M) {
            if(chmin(dist, abs(a[i]-c[j]) + abs(b[i]-d[j]))){
                n = j;
            }
        }
        cout << (n + 1) << endl;
    }
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
 
int main()
{
  int y, m, d;
  char c1, c2;
  cin >> y >> c1 >> m >> c2 >> d;
  cout << (m <= 4 ? "Heisei" : "TBD") << endl;
   
}

Measured memory_bytes: 256
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseFloat(x::SubString{String}) = parse(Float64, x)
parseFloat(x::Char) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    x=parseInt(readline())
    ans=parseInt(ceil(x/11))*2
    if ans÷2*11-5>=x
        ans-=1
    end
    println(ans)
end
main()

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

int main() {
  string s;
  getline(cin, s);
  for (int i=0;i<s.size();i++) {
    if (s[i] >= 'a' && s[i] <= 'z')
      s[i] += 'A' - 'a';
    else if (s[i] >= 'A' && s[i] <= 'Z')
      s[i] -= 'A' - 'a';
  }
  cout << s << endl;
}



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

/************* Using *************/
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using graph_t = vector<vector<ll>>;

/*********** Constants ***********/
const auto INF  = static_cast<int>(1e10);
const auto INFL = static_cast<ll>(1e18);
const auto MOD  = static_cast<ll>(1e9 + 7);
const auto NIL  = nullptr;

/*********** Variables ***********/
ll N, ANS;
vector<ll> A, B;

/************* Utils *************/

/*********** Functions ***********/
bool init() {
    cin >> N;
    A.resize(N + 1); B.resize(N);
    for (auto &a : A) cin >> a;
    for (auto &b : B) cin >> b;
    ANS = 0;
    return true;
}

void solve() {
    for (ll i = 0; i < N; i++) {
        if (i % 2 == 0) {
            ll j = i / 2;
            if (A[j] >= B[j]) {
                ANS += B[j];
            }
            else {
                B[j] -= A[j];
                ANS += A[j];
                if (A[j + 1] >= B[j]) {
                    A[j + 1] -= B[j];
                    ANS += B[j];
                }
                else {
                    ANS += A[j + 1];
                    A[j + 1] = 0;
                }
            }
        }
        else {
            ll j = N - (i + 1) / 2;
            if (A[j + 1] >= B[j]) {
                ANS += B[j];
            }
            else {
                B[j] -= A[j + 1];
                ANS += A[j + 1];
                if (A[j] >= B[j]) {
                    A[j] -= B[j];
                    ANS += B[j];
                }
                else {
                    ANS += A[j];
                    A[j] = 0;
                }
            }
        }
    }
}

void output() {
    cout << ANS << endl;
}

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
LL p = 1000000007ll;

int main(void)
{
  LL n;
  cin >> n;
  vector<LL> h(n);
  for(LL&x:h) cin >> x;
  for(LL i = n-1;i>0;--i) {
    if(h[i]==h[i-1]-1) --h[i-1];
    if(h[i]<h[i-1]-1) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

using namespace std;

// MACROS

#define ll long long
#define ull unsigned long long
#define ld long double

#define vi vector<int>
#define vll vector<ll>
#define vld vector<ld>
#define u_s unordered_set

#define pii pair<int,int>
#define pll pair<ll,ll>

#define FOR(i, n) for (ll (i) = 0; i < n; i++)
#define FORN(i, a, b) for (ll (i) = a; i < b; i++)
#define FORE(i, l) for (auto (i) : l)

#define pb push_back
#define pob pop_back
#define emp emplace
#define fi first
#define se second

#define all(n) (n).begin(), (n).end()
#define in(n) cin >> (n);
#define debug(n) cout << #n << ": " << n << '\n';

// FUNCTIONS

template< typename T >
inline T gcd(T a, T b) { if (b) return gcd(b, a % b); return a; }

template< typename T >
inline T ext_gcd(T a, T b, T & x, T & y) { if (a == 0) { x = 0; y = 1; return b; } T x1, y1; T g = ext_gcd(b % a, a, x1, y1); x = y1 - (b / a) * x1; y = x1; return g; }

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);	
    char c;
    cin >> c;
    cout << (char)((c - 'a' + 1) % 26 + 'a') << '\n';
    //cout << setprecision(15);
    
}



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


using ll = long long;
const int Mod = 1e9+7;
const int L = 2e5+10;
ll fac[L];
int H, W, A, B;


void exgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0) {x = 1, y = 0; return;}
    exgcd(b, a % b, y, x);
    y -= a / b * x;
}


ll invmod(ll a, ll m) {
    ll x, y;
    exgcd(a, m, x, y);
    return (x % m + m) % m;
}


ll binomial(int n, int m)
{
    if (n < m) return 0;
    return fac[n] * invmod(fac[m], Mod) % Mod * invmod(fac[n - m], Mod) % Mod;
}


void init()
{
    fac[0] = 1;
    for (int i = 1; i < L; i++) fac[i] = fac[i - 1] * i % Mod;
}


void solve()
{
    ll ans = binomial(W-1+H-1, W-1);
    for (int x = 1; x <= A; x++) {
        ans -= binomial(H-x+B-1, B-1) * binomial(W-B-1+x-1, x-1) % Mod;
        if (ans < 0) ans += Mod;
    }
    cout << ans << endl;
}


int main()
{
    cin >> H >> W >> A >> B;
    init();
    solve();
    return 0;
}


Measured memory_bytes: 1792
use proconio::input;
use proconio::marker::{Bytes, Chars};

// x ** n % mods を求める
pub fn mod_pow(x: i64, n: i64, mods: i64) -> i64 {
    if n == 0 {
        return 1;
    }
    let mut res = mod_pow(x * x % mods, n / 2, mods);
    if n % 2 == 1 {
        res = res * x % mods;
    }
    return res;
}

// (1/n) % mods を求める
pub fn mod_inv(n: i64, mods: i64) -> i64 {
    return mod_pow(n, mods-2, mods);
}

// nCk % mods を求める
pub fn mod_comb(n: i64, k: i64, mods: i64) -> i64 {
    let sum1 = (n-k+1..n+1).fold(1, |ac, x| ac * x % mods);
    let sum2 = (1..k+1).fold(1, |ac, x| ac * x % mods);
    return sum1 * mod_inv(sum2, mods) % mods;
}

// nCk の組み合わせを列挙する
pub fn combination(n: usize, k: usize) -> Vec<Vec<usize>> {
    let mut ans = Vec::new();
    if k == 1 {
        for i in 1..n+1 {
            let mut tmp = Vec::new();
            tmp.push(i);
            ans.push(tmp);
        }
    }
    else {
        for iter in combination(n-1, k-1) {
            let max = iter.iter().max().unwrap();
            for j in *max+1..n+1 {
                let mut tmp = iter.clone();
                tmp.push(j);
                ans.push(tmp);
            }
        }
    }
    ans
}


fn main() {
    input!{
        n: usize,
        d: i64,
    }
    let d2 = d*d;
    let mut ans = 0;
    for _ in 0..n {
        input!{
            x: i64,
            y: i64,
        }
        if x*x + y*y <= d2 {
            ans += 1;
        }
    }
    println!("{}",ans);
}


Measured memory_bytes: 4960
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
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;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c; cin >> a >> b >> c;
  vector<int> v({a, b, c});
  sort(all(v), greater<int>());
  int ans = 0;
  if((v[0]-v[1])%2==0 && (v[0]-v[2])%2==0) {
    ans = (v[0]-v[1])/2 + (v[0]-v[2])/2;
  } else if((v[0]-v[1])%2==0){
    ans = (v[0]+1-v[2])/2 + (v[0]-v[1])/2 + 1;
  } else if((v[0]-v[2])%2==0){
    ans = (v[0]+1-v[1])/2 + (v[0]-v[2])/2 + 1;
  } else {
    ans = (v[0]-v[1])/2 + (v[0]-v[2])/2 + 1;
  }
  cout << ans << endk;
  return 0;
}


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

int main() {
  int n, x; std::cin >> n >> x;
  std::vector<int> m;
  
  for (size_t i; i < n; i++) {
    int m_i; std::cin >> m_i;
    m.push_back(m_i);
  }
  
  int remain_powder = x - std::accumulate(m.begin(), m.end(), 0);
  int count = n;
  count += remain_powder / *std::min_element(m.begin(), m.end());
  
  printf("%d\n", count);
  
  return 0;
}

/*

n, x = map(int, input().split())
m = [int(input()) for i in range(n)]

# 少なくとも一個は各種類のドーナツを作る
powder = x - sum(m)
count = n

# 残りのpowderを使用して、材料費が一番安いドーナツを一種類だけ大量に作る
count += powder // min(m)

print(count)

*/


Measured memory_bytes: 256
a,b = list(map(int,input().split()))
all_ = []

for i in range(a):
    usr = int(input())
    all_.append(usr)
else:
    num_a = a
    res_a = b - sum(all_)
    minimum = min(all_)
    num_b = res_a / minimum
    print(int(num_a + num_b))


Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
int main(){
    int sx, sy, gx, gy; cin >> sx >> sy >> gx >> gy;
    int dx=gx-sx, dy=gy-sy;
    cout << string(dx, 'R') << string(dy, 'U');
    cout << string(dx, 'L') << string(dy, 'D');
    cout << 'D' << string(dx+1, 'R') << string(dy+1, 'U') << 'L';
    cout << 'U' << string(dx+1, 'L') << string(dy+1, 'D') << 'R' << endl;
    return 0;
}


Measured memory_bytes: 256
from sys import stdin

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)


n, *t = map(int, stdin.read().split())

a = t[0]
for i in range(1, n):
    b = t[i]
    a = lcm(a, b)

print(a)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;cin>>N;
    vector<string> S(N);
    for (int i = 0; i < N; i++)
    {
        cin>>S[i];
    }
    sort(S.begin(),S.end());
    long long cnt=1;
    for (int i = 0; i < N-1; i++)
    {
        if(S[i]!=S[i+1])cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 9608
#include	<stdio.h>

int main(int argc, char** argv){
	int i, n, money = 100000;

	scanf("%d", &n);
	
	for(i = 0; i < n; i++){
		money *= 1.05;
		if(money % 1000)	money+= 1000;

		money /= 1000;
		money *= 1000;
	}
	
	printf("%d\n", money);
	return 0;
}

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

int main() {
    vector<int> c(2);
    cin >> c.at(0) >> c.at(1);
    int k;
    cin >> k;
    int turn = 0;
    for(int i = 0; i < k; i++)
    {
        if (c.at(turn) % 2 == 1) c.at(turn)--;
        c.at(turn) /= 2;

        c.at(turn ^ 1) += c.at(turn);
        turn ^= 1;
    }
    cout << c.at(0) << " " << c.at(1) << endl;
}

Measured memory_bytes: 256
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]

def sol():
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d = A[i][k] + A[k][j]
                if d < A[i][j]:
                    return - 1

    ret = 0
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(N):
                if k == i or k == j:
                    continue
                if A[i][k] + A[k][j] == A[i][j]:
                    break
            else:
                ret += A[i][j]

    return ret

print(sol())


Measured memory_bytes: 43356
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<int, vector<int>, greater<int> > gpq; //逆順priority_queue

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

bool is_month(int x){
    return 1<=x && x<=12;
}

int main(){
    int N;
    cin>>N;
    int A=N/100,B=N%100;
    if(is_month(A)&&is_month(B)){
        cout<<"AMBIGUOUS"<<endl;
    }else if(is_month(A)){
        cout<<"MMYY"<<endl;
    }else if(is_month(B)){
        cout<<"YYMM"<<endl;
    }else{
        cout<<"NA"<<endl;
    }
}


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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acos(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

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

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	ld a, b, c;
	cin >> a >> b >> c;
	cout << (a + b + sqrtl(4 * a * b) < c ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int64_t N, M;
  cin >> N >> M;

  int64_t dum = max((M - N * 2) / 4, int64_t(0));
  N += dum;
  M -= dum * 2;

  cout << min(N, M / 2) << endl;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
int a,b,c,x,ans;
int main()
{
	cin>>a>>b>>c>>x;
	for(int i=0;i<=a;i++)
	{
		for(int j=0;j<=b;j++)
		{
			for(int k=0;k<=c;k++)
			{
				if(500*i+100*j+50*k==x) ans++;
			}
		}
	}
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 256
from collections import deque
n,m=map(int,input().split())
g=[[] for i in range(3*n)]
for i in range(m):
    a,b=map(int,input().split())
    g[3*(a-1)].append(3*(b-1)+1)
    g[3*(a-1)+1].append(3*(b-1)+2)
    g[3*(a-1)+2].append(3*(b-1))
s,t=map(int,input().split())
s-=1
t-=1
s*=3
t*=3
q=deque([[s,0]])
v=[0]*(3*n)
while q:
    p=q.popleft()
    v[p[0]]=1
    for j3 in g[p[0]]:
        if j3==t:
            print((p[1]+1)//3)
            exit()
        if v[j3]==0:
            v[j3]=1
            q.append([j3,p[1]+1])
print(-1)


Measured memory_bytes: 84388
class WordCount
  def sentence(array)
    result = array.each_with_object(Hash.new(0)) { |w, h| h[w] += 1 }
    mode_word = result.max_by { |_, v| v }[0].to_s
    max_length_word = result.max_by { |k, _| k.length }[0].to_s
    [mode_word, max_length_word]
  end
end

mode, max_length = WordCount.new.sentence(STDIN.gets.split)
printf "%s %s\n", mode, max_length

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int k;
	string s;
	cin >>s >>k;
	int n =sz(s);
	set<string> st;
	rep2(i, 1, 6) rep(j, n-i+1) st.insert(s.substr(j, i));
	cout << *(next(st.begin(), k-1)) <<"\n";
	return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int n;
    cin >> n;
    vector<int> v(n),c(n);
    for(int i=0;i<n;++i)cin >> v[i];
    for(int j=0;j<n;++j)cin >> c[j];
    ll ans = 0;
    for(int i=0;i<n;++i)
    {
        if(v[i]>c[i])ans+=(v[i]-c[i]);
    }

    cout << ans;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N float64
	fmt.Scan(&N)
	now := 0.0
	count := 0
	for {
		now += N
		count++
		if now == 360.0 {
			fmt.Println(count)
			return
		}
		if now >= 360.0 {
			now -= 360.0
		}
	}
}


Measured memory_bytes: 1772
#include<cstdio>
#include<cstring>
#define maxn 100005
int n,r1,r2,s1[maxn],s2[maxn],ans[maxn],st[maxn],tp;
bool vis[maxn];
struct node { int v; node *nxt; } edge[maxn*16],*head[3][maxn],*ncnt;
void addedge(int u,int v,int d)
{
	ncnt++;
	ncnt->v=v,ncnt->nxt=head[d][u];
	head[d][u]=ncnt;
}
void dfs(int d,int u)
{
	for(node *p=head[d][u];p;p=p->nxt) dfs(d,p->v);
	if(!s1[u]) st[++tp]=u;
	while(tp>1) { addedge(st[tp],st[tp-1],2); addedge(st[tp-1],st[tp],2); tp-=2; }
}
void dfs2(int u,int c)
{
	ans[u]=c,vis[u]=true;
	for(node *p=head[2][u];p;p=p->nxt)
	{
		int v=p->v;
		if(!vis[v]) dfs2(v,-c);
	}
}
int main()
{
	ncnt=&edge[0];
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int fa;
		scanf("%d",&fa);
		if(fa>0) { addedge(fa,i,0); s1[fa]^=1; }
		else r1=i;
	}
	for(int i=1;i<=n;i++)
	{
		int fa;
		scanf("%d",&fa);
		if(fa>0) { addedge(fa,i,1); s2[fa]^=1; }
		else r2=i;
	}
	for(int i=1;i<=n;i++)
		if(s1[i]!=s2[i]) { printf("IMPOSSIBLE\n"); return 0; }
	printf("POSSIBLE\n");
	dfs(0,r1); 
	tp=0;
	dfs(1,r2);
	for(int i=1;i<=n;i++)
		if(!vis[i]) dfs2(i,1);
	for(int i=1;i<=n;i++) printf("%d ",s1[i]?0:ans[i]);
}

Measured memory_bytes: 13440
#include <bits/stdc++.h>
#define PI acos(-1)

using namespace std;

int main()
{
    int n;

    scanf("%d", &n);

    switch(n % 10) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            puts("hon");
            break;

        case 0:
        case 1:
        case 6:
        case 8:
            puts("pon");
            break;

        case 3:
            puts("bon");
            break;
    }

    return 0;
}


Measured memory_bytes: 3756
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{ mut a_vec: [isize;3] }

    a_vec.sort();

    println!("{}", (a_vec[0] - a_vec[1]).abs() + (a_vec[1] - a_vec[2]).abs());
}


Measured memory_bytes: 2160
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int x = stdIn.nextInt();
		int y[] = new int[x];
		for(int i=0; i < x; i++){
			y[i] = stdIn.nextInt();
		}
		stdIn.close();
		for(int i=x-1; i >= 0; i--){
			if(i != 0) {
				System.out.print(y[i] + " ");
			} else {
				System.out.println(y[i]);
			}
		}

	}
}



Measured memory_bytes: 26176
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

int main() {
    int a,b;
    top = 0;
    char s[100];
    
    while(1) {
        if (scanf("%s", s)==EOF) {
            break;
        }
        if( s[0] == '+') {
            a = pop();
            b = pop();
            push(a + b);
        }
        else if( s[0] == '-') {
            b = pop();
            a = pop();
            push(a - b);
        }
        else if( s[0] == '*') {
            a = pop();
            b = pop();
            push(a * b);
        }
        else {
            push(atoi(s));
        }
    }
    
    printf("%d\n", pop());
    
    return 0;
}

void push(int x) {
    S[++top] = x;
}

int pop() {
    top--;
    return S[top+1];
}


Measured memory_bytes: 2104
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;

struct edge {
        int a, b, cost;
};

bool comp(const edge& e1, const edge& e2) {
        return e1.cost < e2.cost;
}

struct UnionFind {
        int n;
        vector<int> parent;
        vector<int> rank;
        vector<int> num;
        int find(int x) {
                if (parent[x] == x) return  x;
                return parent[x] = find(parent[x]);
        }
        UnionFind(int n_) {
                n = n_;
                parent.resize(n);
                for (int i = 0; i < n; i ++) parent[i] = i;
                rank.assign(n, 0);
                num.assign(n, 1);
        }
        void unite(int x, int y) {
                if ((x = find(x)) != (y = find(y))) {
                        if (rank[x] < rank[y]) {
                                parent[x] = y;
                                num[y] += num[x];
                        } else {
                                parent[y] = x;
                                if (rank[x] == rank[y]) rank[x] ++;
                                num[x] += num[y];
                        }
                        n --;
                }
        }
        bool same(int x, int y) { return find(x) == find(y); }
        int get() { return n; }
        int get(int x) { return num[find(x)]; }
};

int main() {
        int n, m;
        scanf("%d%d", &n, &m);
        vector<edge> es;
        for (int i = 0; i < m; i ++) {
                int a, b, c;
                scanf("%d%d%d", &a, &b, &c);
                a --, b --;
                es.push_back({a, b, c});
        }
        sort(es.begin(), es.end(), comp);
        UnionFind uf(n);
        int mi = 0;
        vector<int> candidate;
        for (int i = 0; i < es.size(); i ++) {
                edge e = es[i];
                if (!uf.same(e.a, e.b)) {
                        uf.unite(e.a, e.b);
                        mi += e.cost;
                        candidate.push_back(i);
                }
        }
        int ans = 0, sum = 0;
        for (int i = 0; i < candidate.size(); i ++) {
                UnionFind uf2(n);
                int mi2 = 0;
                for (int j = 0; j < es.size(); j ++) {
                        if (candidate[i] == j) continue;
                        edge e = es[j];
                        if (!uf2.same(e.a, e.b)) {
                                uf2.unite(e.a, e.b);
                                mi2 += e.cost;
                        }
                }
                if (mi != mi2) {
                        ans ++;
                        sum += es[candidate[i]].cost;
                }
        }
        printf("%d %d\n", ans, sum);
        return 0;
}

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

const ll N=2e5+5;
const ll S=4*N;

// 1-indexing in BIT

ll bit[N];
ll a[N], h[N];
ll n;
ll ans;

ll get(ll x)
{
	ll res=0;
	while(x>0)
	{
		res=max(res, bit[x]);
		x-=(x&-x);
	}
	return res;
}

void upd(ll x, ll y=1)
{
	while(x<=n)
	{
		bit[x]=max(bit[x], y);
		x+=(x&-x);
	}
}

void solve()
{
	cin>>n;
	for(ll i=1; i<=n; i++) cin>>h[i];
	for(ll i=1; i<=n; i++) cin>>a[i];
	for(ll i=1; i<=n; i++)
	{
		ll cur=get(h[i])+a[i];
		ans=max(ans, cur);
		upd(h[i],cur); 
	}
	cout<<ans<<endl; 
}
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);  
	ll T = 1;
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


Measured memory_bytes: 4992
import java.io.*;
import java.util.*;
import java.lang.*;


public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int N = sc.nextInt();
        int[] A = new int[N];
        int[] B = new int[N];
        for(int n=0; n<N; n++){
            A[n]=sc.nextInt();
            B[n]=sc.nextInt();
        }

        //dp[n][h]:n種類の魔法で, hのダメージを与えるのに必要な最小魔力

        long[][] dp = new long[N+1][21000];
        for(int n=0; n<=N; n++)for(int h=0; h<21000; h++) dp[n][h]=5000000000000000L;


        for(int n=0; n<=N; n++) for(int h=0; h<21000; h++){
            if(h==0) dp[n][h]=0;
            if(n>0) dp[n][h] = Math.min(dp[n][h], dp[n-1][h]);
            if(n>0 && h-A[n-1]>=0){
                dp[n][h] = Math.min(dp[n][h], B[n-1]+dp[n-1][h-A[n-1]]);
                dp[n][h] = Math.min(dp[n][h], B[n-1]+dp[n][h-A[n-1]]);
            }
        }

        long ans = 5000000000000000L;
        for(int h=H; h<21000; h++){
            ans = Math.min(ans, dp[N][h]);
        }
        System.out.println(ans);
    }
}


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

int main()
{
    int a, b;
    cin >> a >> b;
    int add = a + b;
    int sub = a - b;
    int mul = a * b;
    int ans = max(max(add, sub), mul);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N,M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
counts = [1]*N

for i in AB:
  if H[i[0]-1] <= H[i[1]-1]:
    counts[i[0]-1] -= 1
  if H[i[0]-1] >= H[i[1]-1]:
    counts[i[1]-1] -= 1
print(counts.count(1))

Measured memory_bytes: 31964