akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		int X_total, A_cake, B_Donuts;
		X_total = scan.nextInt();
		A_cake = scan.nextInt();
		B_Donuts = scan.nextInt();

		int money = X_total - A_cake;

		System.out.println(money % B_Donuts);

	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


Measured memory_bytes: 27056
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>

using namespace std;

int h,w;
char field[101][101];
bool passed[101][101];
const int dy[]={-1,0,0,1};
const int dx[]={0,-1,1,0};
queue<pair<int,int> > *prv;
queue<pair<int,int> > *nxt;
bool ok;

void dfs(int y,int x){
    if(y==h-1||y==0||x==0||x==w-1){
        ok=true;
        return;
    }
    for(int i = 0; i < 4; i++){
        int ny=y+dy[i];
        int nx=x+dx[i];
        if(ny>=0&&nx>=0&&ny<h&&nx<w&&!passed[ny][nx]){
            passed[ny][nx]=true;
            // ツ堀ツづ按づァnxtツづ英ushツつオツづ終ツ猟ケ
            if(field[y][x]!='#'&&field[ny][nx]=='#')
                nxt->push(make_pair(ny,nx));
            else
                dfs(ny,nx);
            if(ok)return;
        }
    }
}
int main(){
    prv=new queue<pair<int,int> >();
    nxt=new queue<pair<int,int> >();
    while(cin>>w>>h&&!(h==0&&w==0)){
        ok=false;
        memset(passed,0,sizeof(passed));
        int sy,sx;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                cin>>field[i][j];
                if(field[i][j]=='&'){
                    sy=i,sx=j;
                    field[i][j]='.';
                }
            }
        }
        prv->push(make_pair(sy,sx));
        int cnt=0;
        while(prv->size()){
            while(prv->size()){
                pair<int,int> &p=prv->front();
                passed[p.first][p.second]=true;
                dfs(p.first,p.second);
                prv->pop();
                if(ok)break;
            }
            if(ok)break;
            swap(prv,nxt);
            cnt++;
        }
        cout<<cnt<<endl;
        while(prv->size())prv->pop();
        while(nxt->size())nxt->pop();
    }
    delete nxt;
    delete prv;

    return 0;
}

Measured memory_bytes: 0
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N, X;
ll arr[105];
ll moves[105];

int main() {
	scanf("%lld %lld", &N, &X);
	for(int i = 0; i < N; i++) {
		scanf("%lld", &arr[i]);
	}
	moves[0] = 0;
	ll cnt = 0;
	for(int i = 1; i <= N; i++) {
		moves[i] = moves[i - 1] + arr[i - 1];
	}
	for(int i = 0; i <= N; i++) {
		// cout << moves[i] << " ";
		if(moves[i] <= X) {
			cnt++;
		}
	}
	printf("%lld\n", cnt);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
use std::str::FromStr;
use std::collections::{HashMap,HashSet,VecDeque,BinaryHeap};
use std::cmp::{max,min,Ordering};
use std::io::Read;

fn main() {

    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();

    let N = buf_it.next().unwrap().parse::<usize>().unwrap();
    let mut A = (0..N).map(|_| buf_it.next().unwrap().parse::<isize>().unwrap()).collect::<Vec<_>>();

    println!("{}",A.iter().map(|&a| format!("{}",a)).collect::<Vec<_>>().join(" "));
    for i in 1..N{
        let v = A[i];
        let mut j = (i-1) as isize;
        while j >= 0 && A[j as usize]>v{
            A[(j+1) as usize] = A[j as usize];
            j -= 1;
        }
        A[(j+1) as usize] = v;
        println!("{}",A.iter().map(|&a| format!("{}",a)).collect::<Vec<_>>().join(" "));
    }

}


Measured memory_bytes: 5056
#include <iostream>
#include <stdlib.h>
#include <stdio.h>      /* printf */
#include <math.h>       /* pow */
#include <vector>
#include <stack>
#include <algorithm>
#include <string>
#include <climits>

typedef std::vector<int> liste;
typedef liste::const_iterator iter;

void print_array(liste list) {
    for(int i = 0; i < list.size(); ++i){
        if(i>0) std::cout << " ";
        std::cout << list[i];
    }
    std::cout << std::endl;
}

bool solve(int i,int m,liste& list) {
    if(m==0) {
        return true;
    }
    if(i>=list.size()) {
        return false;
    }
    bool res = (solve(i+1,m,list)||solve(i+1,m-list[i],list));
    return res;
} 
    
int main(void){
        
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    int value;
    liste list,question;
    int n;
    std::cin >> n;
    for(int i=0; i<n; i++) {
        std::cin >> value;
        list.push_back(value);
    } 
    std::cin >> n;
    for(int i=0; i<n; i++) {
        std::cin >> value;
        question.push_back(value);
    } 

    for(int i=0; i<question.size(); i++) {
        if(solve(0,question[i],list)) {
            std::cout << "yes" << std::endl;            
        } else {
            std::cout << "no" << std::endl;            
        }
    } 
    
    return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    vector<int> a(5);
    rep(i,0,5) cin>>a[i];
    int k; cin>>k;
    bool f=false;
    if(a[4]-a[0]>k) f=true;
    if(f) cout<<":("<<endl;
    if(!f) cout<<"Yay!"<<endl;
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())

def divisor(c):
    i = 1
    table = []
    while i * i <= c:
        if c%i == 0:
            table.append(i)
            table.append(c//i)
        i += 1
    table = list(set(table))
    return table
    
x=divisor(c)
x=sorted(x)


x=[i for i in x if a <= i < b+1]
print(len(x))


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n,m;
    cin >> n >> m;
    vector<bool> broken(n+1, false);
    REP(i,m){
        int32 a;
        cin >> a;
        broken[a] = true;
    }
    int32 dp[n+1];
    dp[0] = 1;
    dp[1] = broken[1]?0:1;
    FOR(i,2,n+1){
        if(broken[i]){
            dp[i] = 0;
        }else{
            dp[i] = (dp[i-1] + dp[i-2]) % MOD;
        }
    }
    ANS(dp[n]);
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;
const int mod = 1e9+7,N=2e5+5;
typedef long long ll;

long long a[N],f[N],c[N];

int main(){
	int n;
	cin>>n;
	f[0]=1;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		if(a[i]==a[i-1]){
            f[i]=f[i-1];
            continue;
		}
		f[i]=(f[i-1]+c[a[i]])%mod;
		(c[a[i]]+=f[i-1])%=mod;
	}
	cout<<f[n];
	return 0;
}


Measured memory_bytes: 4992
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            string[] strs = line.Split(' ');
            int A = int.Parse(strs[0]);
            int B = int.Parse(strs[1]);
            int C = int.Parse(strs[2]);
            int D = int.Parse(strs[3]);
            while(true)
            {
                C -= B;
                if (C <= 0)
                {
                    Console.WriteLine("Yes");
                    break;
                }
                A -= D;
                if (A <= 0)
                {
                    Console.WriteLine("No");
                    break;
                }
            }

        }
    }
}


Measured memory_bytes: 27452
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <array>
#include <functional>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <sstream>
#include <stack>

int main()
{
	//std::cout << std::fixed << std::setprecision(15);

	int n;
	std::cin >> n;

	std::vector<long long> p;
	for (size_t i = 0; i < n; ++i)
	{
		long long l;
		std::cin >> l;
		p.push_back(l);
	}

	int number = 0;
	long long min = std::numeric_limits<long long>::max();
	for (size_t i = 0; i < n; ++i)
	{
		if (p.at(i) <= min)
		{
			min = p.at(i);
			number++;
		}
	}

	std::cout << number << std::endl;

	return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef pair<int,int> pii;
typedef pair<long long, int> pli;

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

ll mod = 1000000007;

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

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

  int n;
  cin >> n;
  vi a(n);
  rep(i,n)cin >> a[i];

  int al = a[0];
  for(int i = 1;i < n;i++)al = al ^ a[i];

  rep(i,n){
    cout << (al ^ a[i]) << " ";
  }
  cout << endl;
}

Measured memory_bytes: 3984
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let s = next()
    for(let i = 0; i<s.length; i++){
        if((i+1) % 2 == 0){
            if(!"LUD".includes(s[i])){
                console.log("No")
                return
            }
        } else{
            if(!"RUD".includes(s[i])){
                console.log("No")
                return
            }
        } 
    }
    console.log("Yes")
}
Main()


Measured memory_bytes: 30600
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int ,int> P;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	string S;
	cin >> S;
	int N = S.size();
	rep(i,0,N){
		if (i%2==0)
			cout << S[i];
	}
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Measured memory_bytes: 512
n, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

count = 0
previous = 0

for i in a:
    if i + previous > x: 
        excess = i + previous - x
        count += excess
        previous = x - previous
    else: # if not exceeding x.
        previous = i

print(count)



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

using namespace std;
typedef long long ll;

map<int,int> counter(const vector<int> &v){
    map<int,int> cnt;
    for(int i=0;i<v.size();i++){
        cnt[v[i]] += 1;
    }
    return cnt;
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }

    int ans = 0;
    map<int,int> mp = counter(a);
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        if(itr->second > itr->first){
            ans += itr->second - itr->first;
        }else if(itr->second < itr->first){
            ans += itr->second;
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 5120
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;
const int maxn = 1e5+10;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

long long G[maxn];
char c[27];
int a[27];
int main(){
	int k,m,n;
	n=read();
	for(register int i=1;i<=n;i++){
		scanf("%s",c+1);
		m=strlen(c+1);
		for(register int j=1;j<=m;j++){
			a[c[j]-'a'+1]++;
		}
		for(register int j=1;j<=26;j++){
			//cout<<j<<" "<<a[j]<<endl;
			for(register int k=1;k<=a[j];k++)
				G[i]=(G[i]*131+j)%9928471983741247;
		}
		memset(a,0,sizeof(a));
		//cout<<G[i]<<" ";
	}
	sort(G+1,G+n+1);
	long long  sum=0,ans=0;
	for(register int i=1;i<=n;i++){
		//cout<<G[i]<<endl;
		if(G[i]!=G[i-1])sum=1;
		else sum++;
		ans+=sum-1;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
ios::sync_with_stdio(false);cin.tie(0);
    ll N,X,M;
    cin>>N>>X>>M;
    vint loop;
    vector<int> seen(M+1,-1);
    int beforeLoop = 0; //ループが始まるまでの長さ
    ll now = X; //最初
    while(seen[now] == -1)
    {
        seen[now] = 0;
        now = (now*now)%M;
        beforeLoop++;
    } 
    ll loopStart = now; //ループが始まる場所
    int loopLength = 0; //ループの長さ(周期)
    do
    {
        seen[now] = loopLength+1;
        now = (now*now)%M;
        loopLength++;
    } while (now != loopStart);
    ll ans = 0;
    ll rem = (N-beforeLoop+loopLength) % loopLength;
    ll div = (N-beforeLoop+loopLength) / loopLength;
    for (size_t i = 0; i <= M; i++)
    {
        if(seen[i]==-1)
        continue;

        if(seen[i]==0)
        {
            ans += i;
        }
        else{
            ans += div*i;
            if(seen[i] <= rem)
            ans += i;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3720
#include<bits/stdc++.h>
//#define int long long
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

template<typename T>
void say(vector<T> s, char r) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << r << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("yes");
	else say("no");
}

void Yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

void YN(bool b) {
	if (b)say("YES");
	else say("NO");
}

template<typename T>
void maxi(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void mini(T& a, T b) {
	a = min(a, b);
}

void exact_say(double x) {
	cout << setprecision(numeric_limits<double>::max_digits10) << x << endl;
}

template<typename T>
vector<vector<T>> fill_vector(int h, int w, T val) {
	vector<vector<T>> ret;
	vector<T> v(w, val);
	rep(h)ret.push_back(v);
	return ret;
}

template<typename T>
T max(vector<T> v) {
	T ret = v[0];
	Rep(1, v.size())maxi(ret, v[i]);
	return ret;
}

template<typename T>
T min(vector<T> v) {
	T ret = v[0];
	Rep(1, v.size())mini(ret, v[i]);
	return ret;
}

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

signed main() {
	makei(a);
	makei(b);
	say(gcd(max(a, b), min(a, b)));
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007
#define endl "\n"
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;



int32_t main(){
    ios::sync_with_stdio(false);
    double r;
    cin>>r;
    double pi=3.14;
    double ans=2*pi*r;
    cout<<(ans)<<"\n";

    return 0;
}

Measured memory_bytes: 3808
/**
 	Template created by Danel Batyrbek
 	All rights are reserved 2017 (lol)
*/

#include <bits/stdc++.h>

#define speed_up ios_base :: sync_with_stdio(0);cin.tie(0)
#define fr first
#define sc second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define debug(x) cerr << x << '\n';
#define YES "YES"
#define NO "NO"
#define skip continue
#define left(x) x << 1
#define rght(x) x << 1 | 1
#define forn(x, y, z) for(int x = y; x <= z; ++ x)
#define for1(x, y, z) for(int x = y; x >= z; -- x)
#define fname ""
using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef double ld;

const int N = 1e5 + 10;
const int mod = 1e9 + 7;
const int N3 = 1e3 + 10;
const int INF = 2e9 + 10;
const ll LINF = 2e18;

string s;
stack <char> st;

int main(){
#ifndef DEBUG
	if(fname != ""){
	freopen(fname".in", "r", stdin);
	freopen(fname".out", "w", stdout);
	}
#endif
	cin >> s;
	int n = s.size();
	forn(i, 0, n - 1){
		if(st.size() && s[i] == 'T' && st.top() == 'S'){
			st.pop();
		} else {
			st.push(s[i]);
		}
	}
	cout << st.size();
	return 0;
}

Measured memory_bytes: 644
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main() {
	long long n, x;
	cin >> n >> x;
	long long top = 1000000;
	REP(i, n) {
		long long a;
		cin >> a;
		top = min(top, a);
		x -= a;
	}
	long long ans = n;
	cout << ans + x / top << endl;
	return 0;
}


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

int main()
{
	int N;
	scanf("%d", &N);
	using vi = std::vector<int64_t>;
	using vvi = std::vector<vi>;
	vvi table(10, vi(10));
	for (int i{1}; i <= N; i++)
	{
		int top{i};
		while (top >= 10) top /= 10;
		table[i % 10][top]++;
	}
	int64_t ans{};
	for (int i{}; i < 10; i++)
		for (int j{}; j < 10; j++)
			ans += table[i][j] * table[j][i];
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            c[i] = sc.nextInt();
        }
        int[][] dp = new int[n][3];
        dp[0][0] = a[0];
        dp[0][1] = b[0];
        dp[0][2] = c[0];
        for (int i = 1; i < n; i++) {
            dp[i][0] = Math.max(dp[i - 1][1], dp[i - 1][2]) + a[i];
            dp[i][1] = Math.max(dp[i - 1][2], dp[i - 1][0]) + b[i];
            dp[i][2] = Math.max(dp[i - 1][0], dp[i - 1][1]) + c[i];
        }
        System.out.println(Math.max(dp[n - 1][0], Math.max(dp[n - 1][1], dp[n - 1][2])));
    }

}


Measured memory_bytes: 61152
def resolver(N, A):
    A.sort(reverse=True)
    ans = 0
    for i, _ in enumerate(A):
        if i == 0:
            continue
        elif i == 1:
            ans += A[0]
        else:
            j = (i // 2) 
            ans += A[j]
    
    return ans



def _resolver(N, A):
    A.sort(reverse=True)
    circle = []
    ans = 0

    for a in A:
        if len(circle) == 0:
            circle.append(a)
        elif len(circle) == 1:
            ans += circle[0]
            circle.append(a)
        else:
            idx = max(range(len(circle)), key=lambda i: min(circle[i-1], circle[i]))
            ans += min(circle[idx-1], circle[idx])
            circle.insert(idx, a)

    return ans

def main():

    N = int(input())
    A = list(map(int, input().split()))
    ans = resolver(N, A)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 31448
#include<cstdio>
using namespace std;
int main(){
	int ma=0,mi=2e9,N;
	scanf("%d",&N);
	for(int i=1,haha;i<=N;i++){
		scanf("%d",&haha);
		if(mi>haha)	mi=haha;
		if(ma<haha)	ma=haha;
	}
	printf("%d",ma-mi);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

class Main {
    private static int rec(String src, String dst, String[][] ab) {
        int result = -1;
        if (src.equals(dst)) {
            result = 0;
        } else if (src.length() >= dst.length()) {
            result = -1;
        } else {
            for (int i = 0; i < ab.length; i++) {
                if (src.indexOf(ab[i][0]) != -1) {
                    int r = rec(src.replaceAll(ab[i][0], ab[i][1]), dst, ab);
                    if (r != -1) {
                        r++;
                    }
                    if (result < 0 || (r > 0 && r < result)) {
                        result = r;
                    }
                }
            }
        }
        return result;
    }

    private static void solve() {
        final Scanner scanner = new Scanner(System.in);
        while (true) {
            final int n = scanner.nextInt();
            if (n == 0) {
                break;
            }
            String[][] ab = new String[n][2];
            for (int i = 0; i < n; i++) {
                ab[i][0] = scanner.next();
                ab[i][1] = scanner.next();
            }
            final String src = scanner.next();
            final String dst = scanner.next();
            System.out.println(rec(src, dst, ab));
        }
    }

    public static void main(String... args) {
        solve();
    }
}

Measured memory_bytes: 13000
#include<stdio.h>

int main()
{
    int n,count=0;
    scanf("%d",&n);
    int p[n];
    for(int i=0;i<n;i++)
    {
        scanf("%d",&p[i]);
    }
    for(int i=1;i<n-1;i++)
    {
        if(((p[i-1]<p[i])&&(p[i]<p[i+1]))||((p[i-1]>p[i])&&(p[i]>p[i+1])))
        {
            count++;
        }
    }
    printf("%d\n",count);

    return 0;
}



Measured memory_bytes: 1724
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {

    int a,b,c; cin >>a>>b>>c;

    if (a+b == c || a+c==b || b+c==a)  {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    } 

    return 0;
}





Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.math;
import std.conv;
import std.string;

T readNum(T)(){
  return readStr.to!T;
}

T[] readNums(T)(){
  return readStr.split.to!(T[]);
}

string readStr(){
  return readln.chomp;
}

void main(){
  auto n = readNum!int;
  auto d = readNums!int;
  int ret;

  sort(d);

  ret = d[n/2] - d[n/2-1];
  writeln(ret);
}


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

using i64 = int64_t;

int main(){
    int n;
    cin >> n;
    vector<vector<int>> tree(n+1, vector<int>());
    for(int i=0;i<n-1;++i){
        int a, b;
        cin >> a >> b;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    vector<int> ans(n+1, -1);
    vector<vector<int>> group(2, vector<int>());
    queue<pair<int, int>> que;
    vector<bool> visited(n+1);
    visited[1] = true;
    que.emplace(1, 0);
    while(!que.empty()){
        auto cur = que.front(); que.pop();
        group[cur.second%2].push_back(cur.first);
        for(auto to: tree[cur.first]){
            if(visited[to])continue;
            que.emplace(to, cur.second+1);
            visited[to] = true;
        }
    }
    if(min(group[0].size(), group[1].size()) <= n/3){
        vector<bool> used(n+1);
        int idx = (group[0].size() < group[1].size() ? 0 : 1);
        for(int i=0,k=3;i<group[idx].size()&&k<=n;++i,k+=3){
            ans[group[idx][i]] = k;
            used[k] = true;
        }
        int m = 1;
        for(int i=1;i<=n;++i){
            if(ans[i] != -1)continue;
            while(used[m])m++;
            ans[i] = m;
            used[m] = true;
        }
    }else{
        int m = 1;
        for(auto e: group[0]){
            ans[e] = m;
            m += 3;
            if(m > n)break;
        }
        m = 2;
        for(auto e: group[1]){
            ans[e] = m;
            m += 3;
            if(m > n)break;
        }
        m = 3;
        for(int i=1;i<=n;++i){
            if(ans[i] != -1)continue;
            ans[i] = m;
            m += 3;
        }
    }

    cerr << group[0].size() << " " << group[1].size() << endl;

    for(int i=1;i<=n;++i){
        if(i > 1)cout << " ";
        cout << ans[i];
    }
    cout << endl;

    return 0;
}

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

int main() {
    int n[4];
    cin >> n[0] >> n[1] >> n[2] >> n[3];
    sort(n, n+4);
    if (n[0]==1 && n[1]==4 && n[2]==7 && n[3]==9)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 3600
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, X, T = getlist()
	ans = T * ((N - 1) // X + 1)
	print(ans) 

if __name__ == '__main__':
	main()

Measured memory_bytes: 64876
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
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;}
const int vx[4]={0,1,0,-1},vy[4]={1,0,-1,0};
using namespace std;

int main(){
  ll A,B;
  cin>>A>>B;
  
  if((A>=0&&B<=0)||(A<=0&&B>=0)) cout<<"Zero"<<endl;
  else{
    if(A>0&&B>0) cout<<"Positive"<<endl;
    else if(abs(A-B)%2==1) cout<<"Positive"<<endl;
    else cout<<"Negative"<<endl;
  }
}

Measured memory_bytes: 256
S = input()
T = input()
S_dic = [-1 for _ in range(26)]
T_dic = [-1 for _ in range(26)]

alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
            "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
            "w", "x", "y", "z"]

for i in range(len(S)):
    s = S[i]
    t = T[i]
    si = alphabet.index(s)
    ti = alphabet.index(t)

    if S_dic[si] == -1:
        S_dic[si] = ti
    elif S_dic[si] != ti:
        print("No")
        exit()

    if T_dic[ti] == -1:
        T_dic[ti] = si
    elif T_dic[ti] != si:
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 3632
#include<iostream>
#include<vector>

using namespace std;

int main(){
    int a, b;
    cin >> a >>b;
    int N;
    cin >> N;

    int c = 0;
    if(a > b){
        c = b;
    }else{
        c = a;
    }
    
    vector<int> g;
    int cou = 0;

    for(int i = 1; i <= c; i++){
        if(a % i == 0 && b % i == 0){
            g.push_back(i);
            cou++;
        }
    }

    cout << g[cou - N] << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
using namespace std;

int main() {
    int N;
    cin >> N;
    bool y=false;
    for (int i = 0; i < N; i++) {
        char s;
        cin >> s;
        if (s == 'Y')y = true;
    }

    cout << ((y) ? "Four":"Three") << endl;

    return 0;
}

Measured memory_bytes: 384
N=int(input())
A=[0 for i in range(N)]
A=input().split()
for i in range(N):
    A[i]=(int)(A[i])
for i in range(N):
    v=A[i]
    j = i-1
    while j>=0 and A[j]>v:
        A[j+1]=A[j]
        j=j-1
        A[j+1]=v
    for k in range(N):
        if k<N-1:
            print(A[k],end=" ")
        if k==N-1:
            print(A[k])


Measured memory_bytes: 5984
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N, M = map(int, input().split())

result1 = 0
result2 = 0

if N > 1:
    result1 = combinations_count(N, 2)

if M > 1:
    result2 = combinations_count(M, 2)

print(result1 + result2)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define foro(i, n) for(i=0; i<n; i++)
#define forl(i, n) for(i=1; i<=n; i++)
#define x first
#define y second
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 1e18 + 1;

int main()
{
	int i, j, k, l, tmp;
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	map<string, int> mp;
	int n, mx=0;
	cin >> n;
	vector<string> sol;
	string str;
	while(n--){
		cin >> str;
		if(mp.find(str)==mp.end())
			mp[str] = 1;
		else{
			mp[str]++;
		}
		if(mx <= mp[str]){
			if(mx < mp[str]){
				mx = mp[str];
				sol.clear();
			}
			sol.pb(str);
		}
	}
	sort(sol.begin(), sol.end());
	for(auto e: sol)
		cout << e << endl;
}


Measured memory_bytes: 25456
#include<iostream>
#include<complex>
using namespace std;
typedef complex<double> Point;

int main() {
    int n;
    double x0, y0, x1, y1, x2, y2, x3, y3;
    cin >> n;
    while (n--)
    {
        cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >>y3;
        Point z0(x1 - x0, y1 - y0); 
        Point z1(x3 - x2, -y3 + y2);
        Point z2(-y3 + y2, -x3 + x2);
        if (!(z0 * z1).imag()) cout << "2\n";
        else if (!(z0 * z2).imag()) cout << "1\n";
        else cout << "0\n";
    }
    return 0;
}


Measured memory_bytes: 3224
/* Bismillahir Rahmanir Rahim */

#include <bits/stdc++.h>

#define rep(i, n)	for(int i=0;i<n;i++)
#define repn(i, n)	for(int i=1;i<=n;i++)
#define set(i, n)	memset(i, n, sizeof(i))

#define pb	push_back

using namespace std;

vector<int>solve(long long n){
	if(n == 1){
		vector<int>emp;
		return emp;
	}
	if(n % 2LL == 0){
		vector<int>ret = solve(n/2LL);
		ret.pb(ret.size() + 1);
		return ret;
	}
	vector<int>ret = solve(n-1LL);
	reverse(ret.begin(), ret.end());
	ret.pb(ret.size() + 1);
	reverse(ret.begin(), ret.end());
	return ret;
}

int main(){
	long long n;
	cin >> n;
	vector<int>ret = solve(n+1);
	cout << 2 * ret.size() << endl;
	for(auto u : ret) cout << u << ' ';
	repn(i, ret.size()) cout << i << ' ';
	cout << endl;
	return 0;
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline()


n, q = map(int, input().split())

edge = [[] for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    edge[a-1].append(b)
    edge[b-1].append(a)

cnt = [0 for _ in range(n)]
for i in range(q):
    p, x = map(int, input().split())
    cnt[p-1] += x


def dfs(now, bef):
    for nxt in edge[now-1]:
        if nxt != bef:
            cnt[nxt-1] += cnt[now-1]
            dfs(nxt, now)


dfs(1, -1)
print(*cnt)


Measured memory_bytes: 230964
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
using namespace std;
int main(){
    int N,M; cin >> N >> M;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    vector<int> B(M);
    vector<int> C(M);
    rep(i,M) cin >> B[i] >> C[i];
    ll ans = 0;

    pair<int,int> D[N+M];
    rep(i,N){
        D[i].first = A[i];
        D[i].second = 1;
    }
    FOR(i,N,N+M){
        D[i].first = C[i-N];
        D[i].second = B[i-N];
    }
    sort(D, D+N+M);

    int count = 0;
    int i = N+M-1;
    while(count < N){
        int tmp = 0;
        while(tmp < D[i].second){
            ans += D[i].first;
            tmp++;
            count++;
            if(count >= N) break;
        }
        i--;
    }

    cout << ans <<endl;
}


Measured memory_bytes: 2944
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll N, K, Q;
    cin >> N >> K >> Q;

    vector<ll> points(N, K);

    for (ll i = 0; i < Q; i++) {
        ll A;
        cin >> A;
        points[A - 1]++;
    }

    for (ll i = 0; i < N; i++) {
        cout << (points[i] > Q ? "Yes" : "No") << endl;
    }
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int k=0, u=0, p=0, c=0;
        String s=sc.next();
        for(int i=0; i<s.length(); i++) {
        	if(s.charAt(i)=='K')
        		k++;
        	if(s.charAt(i)=='U')
        		u++;
        	if(s.charAt(i)=='P')
        		p++;
        	if(s.charAt(i)=='C')
        		c++;
        }
        System.out.println(Math.min(Math.min(k, u),Math.min(p, c)));
    }
}



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

int main(){
    string s,t;
    cin >> s >> t;
    
    int ans = 0;
    rep(i,s.size()) {
        if(s.at(i) != t.at(i)) ans++;
    }
    cout << ans << endl;
}

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

int main(){
    int n; long long k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<int> f(n);
    for (int i = 0; i < n; i++) cin >> f[i];
    sort(a.begin(), a.end(), greater<int>());
    sort(f.begin(), f.end());
    long long ok = 1e12;
    long long ng = - 1;
    while (abs(ok - ng) > 1){
        long long mid = (ok + ng) / 2;
        long long p = k;
        for (int i = 0; i < n; i++){
            if ((long long)a[i] * f[i] > mid){
                p -= ((long long)a[i] * f[i] - mid + f[i] - 1) / f[i];
            }
        }
        if (p >= 0) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}

Measured memory_bytes: 1792
from collections import deque

n, *a = map(int, open(0).read().split())
b = deque()
for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.appendleft(a[i])

if n % 2 == 0:
    for i in range(n):
        print(b[i], end=' ')
else:
    for i in reversed(range(n)):
        print(b[i], end=' ')

Measured memory_bytes: 25948
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

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

	string s1, s2;
	rep(i, sz(s)) {
		if (i % 2 == 0) {
			s1 += "0";
			s2 += "1";
		}
		else if (i % 2 == 1) {
			s1 += "1";
			s2 += "0";
		}
	}

	int c1 = 0, c2 = 0;
	rep(i, sz(s)) {
		if (s[i] != s1[i])c1++;
		if (s[i] != s2[i])c2++;
	}
	cout << min(c1, c2) << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
 
int main() {

int a,b,c;cin>>a>>b>>c;
  
  int count=0;
  REP(i,1,9999999){if(a%i==0&&b%i==0){count++;}
  }
  int j=1,k=0;
  vector<int>d(count);
  while(k<count){ 
    if(a%j==0&&b%j==0){k++;d.at(k-1)=j;} j++;}
  
  cout<<d.at(count-c)<<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;
 
int main(){
    char in[120];
    pair<pair<string,int>,int> p[110];
    int n;cin>>n;
    for(int i=0;i<n;++i){
        string s;int a;
        cin>>s>>a;
        p[i]=make_pair(make_pair(s,-a),i);
    }
    sort(p,p+n);
    rep(i,n)cout<<p[i].second+1<<endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *
INF = 10**10

S = input()
N = len(S)
s1 = [S[i] for i in range(0, N, 2)]
s2 = [S[i] for i in range(1, N, 2)]
if 'L' in s1 or 'R' in s2:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 38384
#include<stdio.h>
 
int main(){
  int a[10];
  int i,j,temp;
  for(i=0;i<10;i++)
    scanf("%d",&a[i]);
  for(i=0;i<10;i++){
    for(j=i+1;j<10;j++)
      if(a[j]>a[i]){
    temp = a[i];
    a[i] = a[j];
    a[j] = temp;
      }
  }
  for(i=0;i<3;i++)
    printf("%d\n",a[i]);
 
  return 0;
}

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

using namespace std;
typedef long long ll;

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

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

int main() {
    ll n;
    cin >> n;
    
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    
    multiset<ll> s;

    for (ll i = 0; i < n; ++i) {
        ll now = a[i];
        auto itr = s.lower_bound(now);
        if (itr != s.begin()) s.erase(--itr);
        s.insert(now);
    }
    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 5760
/*||>>>> Praveen Ojha <<<<>>>> 09 August 2019 <<<<>>>> 21:09:20 <<<<||*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#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__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
//Read Problems Carefully & Check for corner cases N=0,1 ?
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

int32_t main(){__
    int n;
    cin>>n;
    vi a(n);
    int mini=0;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n;i++){
        a[i]--;
        if(a[i]<mini)
            a[i]++;
        mini=a[i];
    }
    bool flag=true;
    debug()<< imie(a);
    for(int i=1;i<n;i++){
        if(a[i]<a[i-1])
        {
            flag=false;
            break;
        }
    }
    if(flag)
        cout<<"Yes\n";
    else
        cout<<"No\n";
return 0;
}

Measured memory_bytes: 1024