akhauriyash/Code-Regression huggingface dataset:
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const int maxn = 1e5 + 7;

char s[maxn];
deque<char>dq;

int main() {
    string s;
    while(cin >> s) {
        if(s[0] == s[1] && s[0] == s[2]) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    return 0;
}


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

int main(void) {
	int a, b;
	cin >> a >> b;
	if ((a + b) % 2 == 0) {//奇数だったら
      cout << (a + b) / 2;//勝手に切り上げされる
    } else {//偶数だったら
      cout << (a + b) / 2 + 1;//切り上げされるように1を足す
	}
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#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 <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
using namespace std;
#define eps 0.000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 65536*16
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a, b) << " " << max(0, a+b-n) << endl;
	return 0;
}

Measured memory_bytes: 256
M='   ';char*s,T['   '],*r=T;U['dd`'];i;k;main(n){for(;gets(r+1);k=0)for(--n;*++r&=31;)U[r-T]=k|=!!n<<*r;for(;s>T||(s=r,i++-2);k=U[k]=U[k-=~-~*s*M]?:*s?s-T:0)n+=__builtin_popcount(U[--s-T]&(U[k+M]^=!s[-1]<<*s));printf("%d",n);}

Measured memory_bytes: 135040
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}

use input::*;

fn main() {
    let n: usize;
    input!(n);
    let mut x = 1;
    let mut y = 1;

    for _ in 0..n {
        let (a, b): (usize, usize);
        input!(a, b);
        let n;

        let mut i = x / a;
        let mut j = y / b;
        if x % a != 0 {
            i += 1;
        }
        if y % b != 0 {
            j += 1;
        }

        n = std::cmp::max(i, j);

        x = n * a;
        y = n * b;
    }
    p(x + y);
}


Measured memory_bytes: 4352
n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
ans = a[0]
idx = 1
flag = False
for i in range(n-2):
    ans += a[idx]
    if flag:
        idx += 1
        flag = False
    else:
        flag = True
print(ans)


Measured memory_bytes: 31356
#include <iostream>
#include<utility>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<cfloat>
#include<functional>
#include<string>
#include<numeric>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<cctype>
#include<iterator>
#include <stdio.h>
#include <string.h>
#include <sstream>
// #include <bits/stdc++.h>
//#include<conio.h>
#define ReadFile freopen("input.txt","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
#define MEGA_MIND ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define M_PI 3.14159265358979323846
#define mod 1000000007
#define endl "\n"
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;


const int N = 5e5 + 6, inf = 2e9;
int n;
int arr[N], dp[N];
int main()
{
	MEGA_MIND

	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
	}
	dp[0] = 0;
	dp[1] = abs(arr[1] - arr[0]);
	for (int i = 2; i < n; i++)
	{
		dp[i] = min(abs(arr[i - 1] - arr[i]) + dp[i - 1], abs(arr[i - 2] - arr[i]) + dp[i - 2]);
	}
	cout << dp[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
  int i,j;
  string s;
  cin>>s;
  i=0,j=s.size()-1;
  while(s.at(i)!='A')i++;
  while(s.at(j)!='Z')j--;
  cout<<j-i+1<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
  long long A, B, C, D;
  cin >> A >> B >> C >> D;
  long long ABC = B / C - A / C;
  if(A % C == 0) ABC++;
  long long ABD = B / D - A / D;
  if(A % D == 0) ABD++;
  long long L, S, R, X;
  if(C < D){
    L = D;
    S = C;
  }
  else{
    L = C;
  	S = D;
  }

  R = L % S;
  while(R != 0){
   L = S;
    S = R;
    R = L % S;
  }
  X = D * C / S;
  long long ABCD = B / X - A / X;
  if(A % X == 0) ABCD++;
  cout << B - A + 1 - ABC - ABD + ABCD;

  
  
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"regexp"
)

func main() {
	var S string
	fmt.Scan(&S)
	r := regexp.MustCompile(`^(eraser|erase|dreamer|dream)+$`)
	if r.MatchString(S) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

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

using namespace std;

#define MOD 1000000007
typedef long long int ll;

int main(){


	ios_base::sync_with_stdio(false);
	cin.tie(0);

	string a;
	cin>>a;
	if(a[(int)a.size()-1]=='s'){
		a.push_back('e');
		a.push_back('s');
	}
	else{
		a.push_back('s');
	}
	cout<<a<<endl;

        
	

	return 0;
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b;
	cin >> a >> b;
	if ((a + b) % 2 == 0) cout << (a + b) / 2 << endl;
	else cout << (a + b) / 2 + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<array>

int main(){

    std::array<int, 3> ar;

    for(auto&& e : ar){
        std::cin >> e;
    }

    std::sort(ar.begin(), ar.end());

    std::printf("%d %d %d\n", ar[0], ar[1], ar[2]);

    return 0;
}



Measured memory_bytes: 3264
#include<algorithm>
#include<iostream>
#include<climits>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<queue>
#include<set>
#include<map>
#define ll long long
using namespace std;
//{{{ read()
inline int read(){
	register int x=0,f=1;
	register char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')	f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')	x=x*10+(ch^48),ch=getchar();
	return x*f;
}
const int N=1005;
char s[N][N];
int n,m,a[N][N];
struct P{
	int x,y,z;
	P (int xx=0,int yy=0,int zz=0){
		x=xx,y=yy,z=zz;
	}
	bool operator < (const P k) const{
		return z>k.z;
	}
};
priority_queue<P> que;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)	scanf("%s",s[i]+1);
	memset(a,27,sizeof(a));
	a[1][1]=(s[1][1]=='#');
	que.push(P(1,1,a[1][1]));
	while(!que.empty()){
		P k=que.top();	que.pop();
		int x=k.x,y=k.y,z=k.z;
		if(z!=a[x][y])	continue;
		if(x<n){
			int k=z+(s[x+1][y]=='#'&&s[x][y]=='.');
			if(k<a[x+1][y])	a[x+1][y]=k,que.push(P(x+1,y,k));
		}
		if(y<m){
			int k=z+(s[x][y+1]=='#'&&s[x][y]=='.');
			if(k<a[x][y+1])	a[x][y+1]=k,que.push(P(x,y+1,k));
		}
	}
	cout<<a[n][m]<<endl;
	return 0;
}

Measured memory_bytes: 7800
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt(), S = cin.getStr();
    let W = new Array(N + 1); W[0] = 0;
    for (let n = 0; n < N; n++)
        W[n + 1] = W[n] + (S.charAt(n) == '#' ? 1 : 0);
    let ans = Number.MAX_SAFE_INTEGER;
    for (let n = 0; n <= N; n++)
        ans = Math.min(ans, W[n] + N - n - (W[N] - W[n]));
    console.log(ans);
}
class Inputer{constructor(t){this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 11452
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    int n,c,k;
    cin >> n >> c >> k;
    int t[n];
    for(int i = 0; i < n; i++){
        cin >> t[i];
    }
    sort(t,t+n);
    //tmpにはそのバスの最小時間、numにはバスの人数、ansはバスの数を表す。
    int tmp = t[0];
    int num = 1;
    int ans = 0;
    for(int i = 1;i < n; i++){
        //人数に余裕がある場合は条件を満たすか確認
        if(num < c){
            //最小値+k以下であれば乗せられる
            if(t[i] <= tmp+k){
                num++;
            }else{
                ans++;
                num = 1;
                tmp = t[i];
            }
        }else if (num == c){
            ans++;
            num = 1;
            tmp = t[i];
        }
    } 
    ans++;
    cout << ans << endl;

    return 0;
}




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

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;

#define pb push_back

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	vector<int> s(n);
	for (int& x : s) cin >> x;
	int ans = 0;
	for (int i = 0; i < n - 2; i++)
		for (int j = i + 1; j < n - 1; j++)
			for (int k = j + 1; k < n; k++)
				if (s[i] != s[j] && s[j] != s[k] && s[i] != s[k] && s[i] + s[j] > s[k] && s[i] + s[k] > s[j] && s[j] + s[k] > s[i])
					ans++;
	cout << ans;
   return 0;
}

Measured memory_bytes: 3648
N, M = map(int, input().split())
edges = [[] for _ in range(N)]
ans = 0

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

changed = True
sumi = []
count = 0
while changed:
    changed = False
    for i in range(len(edges)):
        if len(edges[i]) == 1 and i not in sumi:
            edges[edges[i][0]].remove(i)
            sumi.append(i)
            changed = True
            count += 1
print(count)

Measured memory_bytes: 3064
n,x=map(int,input().split())
def func(n,x):
  if n==1:
    return 'BPPPB'[:min(x,5)].count('P')
  else:
    ret=0
    a=2**n+3*(2**n-1)
    if x>=a-n:
      return 2**(n+1)-1
    elif x>a//2:
      return func(n-1,x)+1+func(n-1,x-a//2-1)
    else:
      return func(n-1,x-1)
print(func(n,x))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const ll MOD2=998244353;
const double PI=acos(-1);
const ll INF=1e15;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  string s;
  cin >> s;
  ll n=s.size();
  ll l=-1,r=-1;
  rep(i,n-1){
    if(s[i]==s[i+1]){
      l=i+1;r=i+2;
    }
  }
  rep(i,n-2){
    if(s[i]==s[i+2]){
      l=i+1;
      r=i+3;
    }
  }
  cout << l << " " << r << endl;
}


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

using namespace std;

void ans(const char* s) {
	printf("%s\n", s);
	exit(0);
}

int main() {
	int n;
	ignore = scanf("%d", &n);
	
	map<int, int> cnt;
	for (int i = 0, x; i < n; i++) {
		ignore = scanf("%d", &x);
		cnt[x]++;
	}
	
	vector<int> a;
	for (auto p : cnt) a.push_back(p.first);
	
	sort(a.begin(), a.end());
	
	if (a.size() > 3) ans("No");
	
	if (a.size() == 1) {
		if (a[0] == 0) ans("Yes");
		else ans("No");
	}
	else if (a.size() == 2) {
		if (a[0] == 0 && cnt[a[1]] == 2 * cnt[0]) ans("Yes");
		else ans("No");
	}
	else {
		if ((a[0] ^ a[1] ^ a[2]) == 0 && cnt[a[0]] == cnt[a[1]] && cnt[a[0]] == cnt[a[2]]) ans("Yes");
		else ans("No");
	}
	
	return 0;
}


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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

int main(int argc, char* argv[]) {
  ll n, k;
  cin >> n >> k;

  ll edge_max = (n * (n - 1)) / 2;

  if (edge_max - (n - 1) < k) {
    put(-1);
    return 0;
  }

  ll m = edge_max - k;

  put(m);
  rep(i, 0, n - 1) { cout << i + 1 << " " << n << endl; }
  m -= n - 1;
  rep(i, 0, n - 1) rep(j, i + 1, n - 1) {
    if (m == 0) break;
    cout << i + 1 << " " << j + 1 << endl;
    m--;
  }
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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;
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n, m;
    cin >> n >> m;
    vpair p(m);
    int a, b;
    rep(i, m) {
        cin >> a >> b;
        if (a < b) swap(a, b);
        p[i].fi = a;
        p[i].se = b;
    }
    sort(all(p));
    int r = p[0].fi;
    int ans = 1;
    srep(i, m, 1) {
        if (p[i].se >= r) {
            ans++;
            r = p[i].fi;
        }
    }

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

Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll N;
	scan(N);
	ll now=N;
	rep1(i,N){
		if(i*(i+1)/2>=N){
			brep1(j,i){
				if(now>=j){
					now-=j;
					prin(j);
				}
			}
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
//Author - Rahil Malhotra
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int n,m,k;
int arr[200005];
int brr[200005];
int cumsum[200005];
int32_t main()
{
    IOS;
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++)
        cin>>arr[i];
    for(int i=1;i<=m;i++)
    {
        cin>>brr[i];
        cumsum[i]=brr[i]+cumsum[i-1];
    }
    int time=0;
    int maxans=0;
    for(int i=0;i<=n;i++)
    {
        time+=arr[i];
        int left=k-time;
        if(left<0)
            break;
        int low=0;
        int high=m;
        while(low<high)
        {
            int mid=(low+high+1)/2;
            if(cumsum[mid]>left)
                high=mid-1;
            else
                low=mid;
        }
        maxans=max(maxans,i+low);
    }
    cout<<maxans;
}

Measured memory_bytes: 8336
#include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
  int r;
  while(b>0){
    r=a%b;
    a=b;
    b=r;
  }
  return a;
} 
int main() {
  int n;
  cin >> n;
  int i,j,k;
  int sum=0;
  for(i=1;i<n+1;i++){
    for(j=1;j<n+1;j++){
      for(k=1;k<n+1;k++){
        sum+=gcd(j,gcd(i,k));
        
      }
    }
  }
  cout << sum;
}
        
  
        
  


Measured memory_bytes: 3588
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 922337203685477580LL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}



//head



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string u;
  cin >> u;
  int k = 0;
  rep(i, u.size()) {
    k += u[i]-'0';
    k %= 9;
  }

  cout << (k?"No":"Yes") << endl;
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

typedef std::vector<std::vector<int>> graph;

int dp[100000] = {};

int dfs(int s, const graph &g)
{
  if (dp[s] != INF)
  {
    return dp[s];
  }
  if (g[s].size() == 0)
  {
    dp[s] = 0;
    return dp[s];
  }

  int ans = 0;
  for (auto v : g[s])
  {
    ans = max(ans, dfs(v, g) + 1);
  }
  dp[s] = ans;
  return dp[s];
}

int main()
{
  int n, m;
  cin >> n >> m;
  vector<bool> isS(n, true);

  graph g(n);
  REP(i, n)
  {
    dp[i] = INF;
  }
  REP(i, m)
  {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    isS[y] = false;
    g[x].push_back(y);
  }

  int ans = 0;
  REP(i, n)
  {
    if (isS[i])
    {
      ans = max(ans, dfs(i, g));
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 10752
#include<iostream>
using namespace std;
int main() {
	char c;
	cin >> c;

	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
		cout << "vowel" << endl;
	else
		cout << "consonant" << endl;
	return 0;
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
struct Edge { int from; int to; ll weight; };
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef pair<ll, int> P;

vector<ll> dijkstra(const Graph &g, int src) {
	vector<ll> d(g.size(), INF*INF);
	d[src] = 0;
	//vector<int> prev(g.size());
	priority_queue<P, vector<P>, greater<P>> q;
	q.push({ 0, src });
	while (!q.empty()) {
		auto p = q.top(); q.pop();
		ll v = p.second;
		if (p.first > d[v]) continue;
		for (int i = 0; i < g[v].size(); ++i) {
			Edge e = g[v][i];
			if (d[e.to] > d[v] + e.weight) {
				d[e.to] = d[v] + e.weight;
				q.push({ d[e.to],e.to });
				//prev[e.to] = v;
			}
		}
	}
	return d;

}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m, s, t;
	cin >> n >> m >> s >> t;
	s--; t--;
	Graph g1(n), g2(n);
	REP(i, m) {
		int v, w, a, b;
		cin >> v >> w >> a >> b;
		v--; w--;
		g1[v].push_back(Edge{ v,w,a });
		g1[w].push_back(Edge{ w,v,a });
		g2[v].push_back(Edge{ v,w,b });
		g2[w].push_back(Edge{ w,v,b });
	}
	vl d1 = dijkstra(g1, s), d2 = dijkstra(g2, t);
	vl ans(n);
	ll tmp = 0;
	ll co = 1000000000000000ll;
	RREP(i, n) {
		tmp = max(tmp, co - d1[i] - d2[i]);
		ans[i] = tmp;
	}
	REP(i, n)cout << ans[i] << endl;
}

Measured memory_bytes: 19016
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    Main m = new Main(sc);
    m.show(m.solve());
  }

  Scanner sc;
  int N;
  int x;
  int[] a;
  int max;

  // 標準入力用のコンストラクタ
  public Main(Scanner sc) {
    this.sc = sc;
    N = sc.nextInt();
    x = sc.nextInt();
    a = new int[N];
    for (int i = 0; i < N; ++i){
        a[i] = sc.nextInt();
    }
  }

  // 判定処理
  int solve() {
      Arrays.sort(a);
      int count = 0;
      boolean over = false; //xより多くキャンディを渡さないと喜ばせられない子供がいるか
      
      for (int i = 0; i < N; ++i){
        if (a[i] <= x){   //a[i]がxより大きいと、そのi番目の子供を喜ばせることはできない
            ++count;
            x -= a[i];
        } else {
           over = true;
           break;   //昇順にソートされているため、オーバーした子供がいる時点で終了
        }
      }
      
      if (x > 0 && over == false){  //キャンディが余り、かつオーバーした子供がいない場合(全員喜ばせることができる)→2回以上配れる子供が発生するため1減らす
        count--;
      }
      
      max = count;
      return max;
  }

  // 回答の表示
  void show(int max) {
        System.out.println(max);
  }
    
}

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

#define loop(i,n) for(int i=1;i<=n;i++)
int n;
int taro[202];
int hana[202];

int has(int* a){
  loop(i,n*2)if(a[i])return 1;
  return 0;
}
int count(int* a){
  int c=0;
  loop(i,n*2)if(a[i])c++;
  return c;
}

int solve(){
  int temp;
  loop(i,n*2)taro[i]=0,hana[i]=1;
  loop(i,n)cin>>temp,taro[temp]=1,hana[temp]=0;
  int taro_turn=0;
  while(has(taro)&&has(hana)){
    taro_turn^=1;
    for(int i=1;i<=n*2;i++){
      if(taro_turn){
        while(i<=n*2&&!taro[i])i++;
        if(i<=n*2){
          taro[i]=0;
          taro_turn=0;
        }else break;
      }else{
        while(i<=n*2&&!hana[i])i++;
        if(i<=n*2){
          hana[i]=0;
          taro_turn=1;
        }else break;
      }
    }
  }
  cout<<count(hana)<<endl;
  cout<<count(taro)<<endl;
  return 0;
}

int main(){
  cin>>n;
  while(n){
    solve();
    cin>>n;
  }
  return 0;
}

Measured memory_bytes: 3104
using System;
using System.Linq;

namespace ABC105A
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            int[] ints = ConsoleInput.IntArray();
            int N = ints[0];
            int K = ints[1];
            Console.WriteLine(N % K == 0 ? 0:1);
        }
    }
    
    internal static class ConsoleInput
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }

        public static int[] IntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] LongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] DoubleArray()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
    }
}

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

int main(){
  string s;
  int count=0;
  cin >> s;
  for(int i=2;i<4;i++){
    if(s.at(i-1)==s.at(i) && s.at(i-2)==s.at(i-1)){
      count++;
      break;
    }
  }
  if(count>=1){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define REP(i, n) for(int i=1;i<=n;i++)
typedef long long ll;

int main() {
	ll r, g, b, n;
	cin >> r >> g >> b >> n;
	ll count = 0;
	for (int i = 0; i <= 3000; ++i) {
		for (int j = 0; j <= 3000; ++j) {
			ll N = n - i*r- j*g;
			if(N >= 0 && N % b == 0) count++;
		}
	}
	cout << count << endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);

		char[] c = sc.next().toCharArray();
		for (int i = 0; i < 4; i++) {
			System.out.print(c[i]);
		}
		System.out.print(" ");
		for (int i = 4; i < 12; i++) {
			System.out.print(c[i]);
		}
		System.out.println();
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


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

using ll = long long;
using namespace std;

int main() {
    ll n;cin >> n;
    vector<int> v;
    map<int, int> mp;
    for(int i = 0;i < n;i++){
        int d;cin >> d;
        v.push_back(d);
        mp[d]++;
    }
    mp[0]++;
    vector<int> fff(12);
    int ans = 0;
    auto check = [&](){
        vector<int> vf(24);
        for(auto a : mp){
            if(a.first == 0 || a.first == 12){
                if(a.second >= 2){
                    return;
                }else{
                    vf[a.first] = 1;
                }
            }else{
                if(a.second >= 3){
                    return;
                }else if(a.second == 2){
                    vf[a.first] = 1;
                    vf[24 - a.first] = 1;
                }else{
                    if(fff[a.first] == 0){
                        vf[24 - a.first] = 1;
                    }else{
                        vf[a.first] = 1;
                    }
                }
            }
        }
        int ss = 1e9;
        for(int i = 0;i < vf.size()-1;i++){
            for(int j = i + 1;j < vf.size();j++){
                if(vf[i] == 1 && vf[j] == 1)ss = min(min(24 - (j - i), j - i), ss);
            }
        }
        ans = max(ans, ss);
    };

    function<void(int)> f = [&](int i){
        if(i == fff.size()){
            check();
            return;
        }
        fff[i] = 0;f(i + 1);
        fff[i] = 1;f(i + 1);
    };
    f(0);
    check();
    cout<<ans<<endl;
}


Measured memory_bytes: 3632
/*
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int mint; //*/
#include <bits/stdc++.h>
#define  rep(i,n) for(li i=0;i<(n);i++)
#define  red(i,n) for(li i=(n)-1;i>=0;i--)
#define  all(a) begin(a),end(a)
#define  pb(a) push_back(a)
using namespace std;
typedef long int li;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<string> vs;
 
int main()
{
    li x,a,b;
    cin>>x>>a>>b;
    if (b<=a) cout<<"delicious\n";
    else if(a+x<b) cout<<"dangerous\n";
    else cout<<"safe\n";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int n, k;
    cin>>n>>k;
    int a[n];
    int dp[n];
    f(i, n) cin>>a[i], dp[i] = INT_MAX;
    dp[0] = 0;
    for(int i = 1; i < n; i++){
        for(int j = i - 1; j >= max(i - k, 0); j--) dp[i] = min(dp[i], dp[j] + abs(a[j] - a[i]));
    }
    cout<<dp[n - 1];
    return 0;
}

Measured memory_bytes: 1152
// God put a smile upon your face <3

#include <bits/stdc++.h>

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

ll freq[200005];

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    while(cin >> n)
    {
		memset(freq,0,sizeof freq);

		for(ll i = 1; i < n; i++)
		{
			cin >> input;
			freq[input]++;
		}

		for(ll i = 1; i <= n; i++) cout << freq[i] << endl;
    }


}





Measured memory_bytes: 5128
n = int(input())
eff = [0]*360
days = [list(map(int, input().split())) for i in range(n)]

for m, d, v, s in days:
    # [a, b)
    a = (m-1)*30 + d - 1
    b = a + v
    for i in range(a, b):
        eff[i%360] = max(eff[i%360], s)
    for i in range(b, a+360):
        eff[i%360] = max(eff[i%360], s - min(i - b + 1, 360 + a - i))
print(min(eff))

Measured memory_bytes: 7796
import numpy as np

n = int(input())
ans = ""

ind = 0
while (True):
    if n == 0:
        break
    else:
        if n % (-2)**(ind+1) == 0:
            ans += "0"
        else:
            ans += "1"
            n -= (-2)**(ind)
    # print(n)
    # print(ans)
    ind += 1


ans = ans[::-1]
if not ans :
    ans = "0"
print(ans)


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

int main() {
  string s; cin >> s;
  int n = s.size();
  vector<ll> a(n+1);

  for (int i=0; i<n; i++) {
    if (s[i] == '<') {
      a[i+1] = max(a[i+1], a[i]+1);
    }
  }

  for (int i=n-1; i>=0; i--) {
    if (s[i] == '>') {
      a[i] = max(a[i], a[i+1]+1);
    }
  }

  ll ans = 0;
  for (auto ai : a) {
    ans += ai;
  }
  cout << ans << endl;
}

Measured memory_bytes: 7680
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i=1,i##_len=(n); i<=i##_len; ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for(int i=(s);i<(t);++i)
#define rng(obj) (obj).begin(), (obj).end()
#define maxs(x,y) (x=max((x),(y)))
#define mins(x,y) (x=min((x),(y)))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x=max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T>>
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vp = vector<P>;
template <class T> inline istream& operator>>(istream&i,v(T)&v)
{ rep(j,sz(v))i>>v[j];return i;}
template <class T> string join(const v(T)&v)
{ stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template <class T> inline ostream& operator<<(ostream&o,const v(T)&v)
{ if(sz(v))o<<join(v); return o;}
template <class T1,class T2> inline istream& operator>>(istream&i ,pair<T1,T2>&v)
{ return i>>v.fi>>v.se;}
template <class T1,class T2> inline ostream& operator<<(ostream&o ,pair<T1,T2>&v)
{ return o<<v.fi<<","<<v.se;}
template <class T> inline ll suma(const v(T)& a) 
{ ll res(0); for(auto&& x:a) res += x; return res;}
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double eps = 1e-10;
const int MX = 200005;
//----------------------------------------------------------------

#define fileio ifstream fio; if(argc>=2){fio.open(argv[1]); std::cin.rdbuf(fio.rdbuf());}
#define fastio ios_base::sync_with_stdio(false);
#define MOD 1000000007
//----------------------------------------------------------------
void Main(){
  int n;
  cin>>n;
  vi a(n+2,0);
  rep(i,n){
    cin>>a[i+1];
  };
  n+=2;
  vi r(n,0);
  vi l(n,0);
  vi m(n,0);
  rep(i,n-1){
    l[i+1] = l[i] + abs(a[i+1]-a[i]);
  }
  drep(i,n-1){
    r[i] = r[i+1] + abs(a[i+1]-a[i]);
  }
  rep(i,n-2){
    m[i+1] = abs(a[i+2]-a[i]);
  }
  srep(i,1,n-1){
    cout<<(l[i-1]+r[i+1]+m[i])<<endl;
  }
} int main(int argc,char* argv[]){ 
    fastio; fileio; Main();}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b+c>=22) cout<<"bust"<<endl;
    else cout<<"win"<<endl;
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;

void main() {
    string str = readln.chomp;
    int[char] count;
    for(int i=0; i<str.length; i++) {
        count[str[i]]++;
    }
    int odd = 0;
    char key;
    foreach(char k, int v; count) {
        if (v%2 != 0) {
            odd++;
            key = k;
        }
    }
    if (odd > 1) {
        writeln(0);
    } else {
        count[key]--;
        long x = 0;
        long y = 1;
        foreach(int v; count.values) {
            x += v/2;
            y *= fact(v/2);
        }
        writeln(fact(x)/y);
    }
}
long factorial(long n) {
    if (n==0) return 1;
    return n*factorial(n-1);
}
alias memoize!factorial fact;

Measured memory_bytes: 2528
#python3
from collections import deque

def main():
    Qa = deque(input())
    Qb = deque(input())
    Qc = deque(input()) 

    reserve = deque()
    reserve.append('a')

    while len(reserve) != 0:
        v = reserve.popleft()
        if  v == 'a':
            if len(Qa) == 0:
                print('A')
                break
            else:
                reserve.append(Qa.popleft())
        elif v == 'b':
            if len(Qb) == 0:
                print('B')
                break
            else:
                reserve.append(Qb.popleft())
        elif v == 'c': 
            if len(Qc) == 0:
                print('C')
                break
            else:
                reserve.append(Qc.popleft())
    

main()


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                             \
  cerr << __LINE__ << ": " << #x << " = {";          \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) { \
    cerr << ((hoge) ? "," : "") << x[hoge];          \
  }                                                  \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, X, T;
  cin >> N >> X >> T;
  cout << ((N - 1) / X + 1) * T << endl;
  return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i, s, e) for(int i = s; i < e; i++)
#define rrep(i, s, e) for(int i = s; i > (s)-(e); i--)
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;



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


  int n;
  cin >> n;

  if (n/10 == 9 || n%10 == 9) pr("Yes");
  else pr("No");


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a;
string x,y;
int main(){
    cin>>x>>y;
    x+=y;
    for(int i=0;i<x.length();++i){
        a=a*10+x[i]-'0';
    }
    for(int i=0;i*i<=a;++i){
        if(i*i==a){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
B = [0] * len(A)
C = [0] * len(A)
mod = 10 ** 9 + 7
counter = 0
for i in range(N):
    B[i] = sum([A[i] > A[j] for j in range(0, N)])  # Aの中でAi>Ajとなる個数
    C[i] = sum([A[i] > A[j] for j in range(i, N)])  # Aの中でAi 以降で　Ai>Ajとなる個数

for i in range(N):
    c = (C[i] * K)%mod + ((K - 1) * K * B[i] // 2)%mod

    counter = (counter + c) % mod
print(int(counter))


Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int N,M,K,t[100];
string s[100],X;

int main() {
	cout<<setprecision(10);
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>s[i]>>t[i];
	}
	cin>>X;
	long long int res=0;
	bool key=false;
	for(int i=0;i<N;i++){
		if(key){res+=t[i];}
		if(s[i]==X){key=true;}
	}
	cout<<res<<endl;

} 


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

int A, B;
int a_count, b_count;
int masu[100][100];
int main() {
	cin >> A >> B;
	cout << 100 << ' ' << 100 << endl;
	for(int i=0; i<50; i++) {
		for(int j=0; j<100; j++) {
			masu[i][j] = 0;
		}
	}
	for(int i=50; i<100; i++) {
		for(int j=0; j<100; j++) {
			masu[i][j] = 1;
		}
	}
	for(int i=0; i<100; i=i+2) {
		for(int j=0; j<100; j=j+2) {
			if(a_count != A - 1) {
				masu[i][j] = 1;
				a_count++;
			}
		}
	}
	for(int i=99; i>=0; i=i-2) {
		for(int j=0; j<100; j=j+2) {
			if(b_count != B - 1) {
				masu[i][j] = 0;
				b_count++;
			}
		}
	}
	for(int i=0; i<100; i++) {
		for(int j=0; j<100; j++) {
			if(masu[i][j] == 0)
				cout << '#';
			else 
				cout << '.';
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
n=input()
v=map(int,raw_input().split())

v0=[v[i] for i in range(n) if i%2==0]
v1=[v[i] for i in range(n) if i%2==1]
    
import collections
c0=collections.Counter(v0)
c1=collections.Counter(v1)

if c0.most_common()[0][0]!=c1.most_common()[0][0]:
    print n-c0.most_common()[0][1]-c1.most_common()[0][1]
else:
    if c0.most_common()[0][1]==n/2 and c1.most_common()[0][1]==n/2:
        print n/2
    elif c0.most_common()[0][1]==n/2:
        print n-c0.most_common()[0][1]-c1.most_common()[1][1]
    elif c1.most_common()[0][1]==n/2:
        print n-c0.most_common()[1][1]-c1.most_common()[0][1]
    else:            
        print min(n-c0.most_common()[1][1]-c1.most_common()[0][1]\
                  ,n-c0.most_common()[0][1]-c1.most_common()[1][1])


Measured memory_bytes: 21944
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl '\n'
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define debug1(a) cout<<#a<<" "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<" "#c<<" "<<(c)<<endl;
typedef long double ld;
void solve()
{
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll maxval = LLONG_MIN;
	maxval = max(maxval, a * c);
	maxval = max(maxval, a * d);
	maxval = max(maxval, b * c);
	maxval = max(maxval, b * d);
	cout << maxval << endl;



}
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	int t;
	t = 1;
	while (t--)
	{
		solve();
	}
}

Measured memory_bytes: 3632
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <cmath>

using namespace std;


int main()
{
   int x=0;
   int mx=0;
   int n;
   char a;
   cin>>n;
   for(int i=0;i<n;i++)
   {
       cin>>a;
       if(a=='I') x+=1;
       else if(a=='D') x-=1;
    if(x>mx)
        mx=x;
   }
   cout<<mx;
     return 0;
}


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

int main(){
    int n,k;
    cin>>n>>k;
    int curr=1;
    for (int i=0 ; i<n ; i++){
        if(curr<=k){
            curr*=2;
        }
        else{
            curr+=k;
        }
    }
    cout<<curr<<"\n";
    return 0;
}


Measured memory_bytes: 256
while True:
    try:
        xa1,ya1,xa2,ya2,xb1,yb1,xb2,yb2 = map(float,input().split())
        if xb2 < xa1 or xa2 < xb1:
            print("NO")
        elif yb1 > ya2 or ya1 > yb2:
            print("NO")
        else:
            print("YES")
    except EOFError:
        break

Measured memory_bytes: 7280
n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]
ans = [[0 for _ in range(l)] for _ in range(n)]
for i in range(n) :
    for j in range(l) :
        for k in range(m) :
            ans[i][j] += a[i][k] * b[k][j]
    print(*ans[i], sep = ' ')


Measured memory_bytes: 7048
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <map>
#include <string>
#include <math.h>
using namespace std;


int main() {

    int i=0;
    int H,A;
    cin >> H >> A;
    while(H>0){
        H=H-A;
        i++;
    }
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    string s, t, u;
    ll a, b;
    cin >> s >> t >> a >> b >>u;

    if(s==u)a--;
    else b--;
    cout << a << " " << b << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout << fixed << setprecision(10);
    solve();
    // stopBBB
        return 0;
}

Measured memory_bytes: 256