akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

#define PI (2*acos(0.0))
#define eps 1e-9
#define pb push_back
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define show(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi] << " "; cout << endl;
#define showpair(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi].first << " " << v[fi].second << endl;
#define ff first
#define ss second
#define fu cout << "lol" << endl;
#define precision(n) cout << fixed << setprecision(n);
#define lb lower_bound
#define up upper_bound
#define vscan for(i = 0;i<n;i++){cin>>in; v.pb(in);}
#define all(a) a.begin(), a.end()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mem(a,val) memset(a,val,sizeof(a))
#define loop(i,n) for(i = 0; i < n; i++)
#define TC ull T; cin>>T; while(T--)
#define IN(x) {scanf("%d",&x);}
#define LL(x) {scanf("%lld",&x);}
#define CC(x) {scanf("%c",&x);}
#define pfl(x) printf("%d\n",x)
#define pfll(x) printf("%lld\n",x)
#define newl puts("")
#define space printf(" ")
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL);


int main()
{
    int i = 0, j = 0, cs = 0, in;
    int n, x, t; cin>>n>>x>>t;
    int ans = ceil(n/(double)x)*t;
     cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3592
n,m,k=map(int,open(0).read().split())
p=998244353
'''
c=[1]*(k+1)
for i in range(1,k+1):
  c[i]=c[i-1]*(n-i)//i
  c[i-1]%=mod
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 998244353
N = n  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
ans=0
for i in range(k+1):
  ans+=m*pow(m-1,n-1-i,p)*cmb(n-1,i, p)
  ans%=p
print(ans)

Measured memory_bytes: 112544
#include<cstdio>
inline int in();
inline void wr(int);
int main(int argc,char**argv){
	register int x=in(),y=in(),z=in();
	x^=y^=x^=y;
	x^=z^=x^=z;
	wr(x),putchar(' '),wr(y),putchar(' '),
	wr(z),putchar('\n');
}
inline int in(){
	register char c=getchar();
	register int x=0,f=1;
	for(;c<'0'||c>'9';c=getchar())
		if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=getchar())
		x=(x<<1)+(x<<3)+(c&15);
	return x*f;
}
inline void wr(int x){
	if(x<0)putchar('-'),x=-x;
	if(x/10)wr(x/10);
	putchar(x%10+'0');
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(v) v.begin(), v.end()
#define mod 1000000007
#define inf 100000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<lli>
#define vii vector<int>
#define is indexed_set
#define eps 0.000001
#define endl '\n'
#define mo 998244353
 
using namespace std ;

typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

#define N 400000+5


int main () 
{
/////////////////////////////////////
    
    fastio;  

    lli n,k;
    cin>>n>>k;

    if(k > (n-1)*(n-2)/2)
    {
        cout<<-1;
        return 0;
    }

    vector<pll> ans;

    lli curr = (n-1)*(n-2)/2 ;

    loopl(i,2,n+1)
    ans.pb({1,i});

    loopl(i,2,n+1)
    {
        loopl(j,i+1,n+1)
        {
            if(k < curr)
            {
                ans.pb({i,j});
                curr--;
            }

            else if(k == curr)
                break;
        }
    }

    cout<<ans.size()<<endl;
    for(auto x:ans)
        cout<<x.ff<<" "<<x.ss<<endl;

}

Measured memory_bytes: 512
#include<cstdio>
#include<queue>
#include<algorithm>
#define INF 1000000
using namespace std;
typedef pair<int,int> P;
int h,w,n,ans=0;
bool map[1002][1002];
int x[10],y[10];
int dx[4]={0,1,0,-1};
int dy[4]={-1,0,1,0};
int main(){
    scanf("%d %d %d",&h,&w,&n);
    fill(map[0],map[0]+1002*1002,false);
    for(int i=1;i<=h;i++){
        getchar();
        for(int j=1;j<=w;j++){
            char c=getchar();
            if(c!='X'){
                map[i][j]=true;
                if(c=='S'){
                    x[0]=i;
                    y[0]=j;
                }else if(c!='.'){
                    x[c-48]=i;
                    y[c-48]=j;
                }
            }
        }
    }
    for(int i=0;i<n;i++){
        int d[1002][1002];
        fill(d[0],d[0]+1002*1002,INF);
        queue<P> q;
        d[x[i]][y[i]]=0;
        q.push(P(x[i],y[i]));
        while(!q.empty()){
            P p=q.front();
            int sx=p.first;
            int sy=p.second;
            q.pop();
            if(sx==x[i+1]&&sy==y[i+1]) break;
            for(int j=0;j<4;j++){
                if(map[sx+dx[j]][sy+dy[j]]&&d[sx+dx[j]][sy+dy[j]]==INF){
                    d[sx+dx[j]][sy+dy[j]]=d[sx][sy]+1;
                    q.push(P(sx+dx[j],sy+dy[j]));
                }
            }
        }
        ans+=d[x[i+1]][y[i+1]];
    }
    printf("%d\n",ans);
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector <int> res(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    ++res[a - 1];
    ++res[b - 1];
  }
  rep(i, n) {
    cout << res[i] << endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 200000
using namespace std;
typedef long long LL;
struct node
{
	int tag,col;
}tree[MAXN*4];
int N;
LL K;
LL s[MAXN+5];
LL a[MAXN+5];
int b[MAXN+5];
LL l[MAXN+5],r[MAXN+5];
LL lsh[MAXN+5],lcnt;
LL f[MAXN+5];
void PushDown(int i)
{
	if(tree[i].tag==0)
		return;
	tree[i*2].tag=tree[i].tag;
	tree[i*2].col=tree[i].tag;
	tree[i*2+1].tag=tree[i].tag;
	tree[i*2+1].col=tree[i].tag;
	tree[i].tag=0;
}
int Query(int i,int l,int r,int k)
{
	if(l==r)
		return tree[i].col;
	int mid=(l+r)/2;
	PushDown(i);
	if(k<=mid)
		return Query(i*2,l,mid,k);
	else
		return Query(i*2+1,mid+1,r,k);
}
void Insert(int i,int l,int r,int ql,int qr,int val)
{
	if(qr<l||ql>r)
		return;
	PushDown(i);
	if(ql<=l&&r<=qr)
	{
		tree[i].tag=val;
		tree[i].col=val;
		return;
	}
	int mid=(l+r)/2;
	Insert(i*2,l,mid,ql,qr,val);
	Insert(i*2+1,mid+1,r,ql,qr,val);
}
LL Ask(int k)
{
	int pos=Query(1,1,lcnt,k);
	if(pos!=0)
		return f[pos]+(lsh[l[pos]]-lsh[k]+K)%K;
	return 0;
}
int main()
{
	scanf("%d %lld",&N,&K);
	for(int i=1;i<=N;i++)
	{
		scanf("%lld %d",&a[i],&b[i]);
		s[i]=s[i-1]+a[i];
		if(b[i]==2)
			l[i]=0,r[i]=K-1LL;
		else
			l[i]=(K-2LL*s[i-1]%K)%K,r[i]=(K-2LL*s[i]%K)%K;
		if(b[i]==1&&a[i]*2LL>K)
		{
			printf("-1\n");
			return 0;
		}
		lsh[++lcnt]=l[i],lsh[++lcnt]=r[i];
	}
	sort(lsh+1,lsh+1+lcnt);
	lcnt=unique(lsh+1,lsh+1+lcnt)-lsh-1;
	for(int i=1;i<=N;i++)
	{
		l[i]=lower_bound(lsh+1,lsh+1+lcnt,l[i])-lsh;
		r[i]=lower_bound(lsh+1,lsh+1+lcnt,r[i])-lsh;
	}
	for(int i=N;i>=1;i--)
	{
		f[i]=Ask(l[i]);
		if(l[i]>r[i])
			Insert(1,1,lcnt,r[i]+1,l[i]-1,i);
		else
			Insert(1,1,lcnt,1,l[i]-1,i),Insert(1,1,lcnt,r[i]+1,lcnt,i);
	}
	LL ans=f[1];
	for(int i=1;i<=lcnt;i++)
		ans=min(ans,Ask(i));
	printf("%lld\n",ans+2LL*s[N]);
	return 0;
}

Measured memory_bytes: 13696
#include <iostream>
#include <string>
#include <map>
#include <stdio.h>
#include <cmath>

using namespace std;

int main()
{
    int r,g,b;
    cin >> r >> g >> b;
    int rhandred = r * 100;
    int gten = g * 10;
    int res = rhandred + gten + b;
    if(res % 4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>

using namespace std;
 
#define  GODSPEED       ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define  f              first                 
#define  s              second
#define  newl           cout<<"\n";
#define  pb             push_back  
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";newl;
#define  deb1(a)        cout<<a<<"\n";
#define  deb2(a,b)      cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());
#define  all(a)         a.begin(),a.end()           
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   N     =  1e6+5;
const ll   mod   =  1e9;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;

ll test = 1, n, k, a[N];

bool ch(ll x){
	ll ct = 0;
	for(int i = 0; i < n; i++){
		ct += a[i]/x-1;
		if(a[i]%x) ct++;
	}
	return ct <= k;
}

void bs(){
	ll l = 1, r = 1e9, ans;
	while(l <= r){
		ll mid = (l+r)/2;
		if(ch(mid)){
			r = mid - 1;
			ans = mid;
		} else l = mid + 1;
	}
	deb1(ans)
}

void solve(){
	cin >> n >> k;
	for(int i = 0; i < n; i++) cin >> a[i];
	bs();
}

int main(){
	GODSPEED;
	//cin>>test;
	for(int i = 1; i <= test; i++){
		solve();
	}
	#ifndef ONLINE_JUDGE
	cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
	#endif
}

Measured memory_bytes: 5116
//
//  main.cpp
//  programs
//
//  Created by Arunesh Sarker on 18/11/19.
//  Copyright © 2019 Arunesh Sarker. All rights reserved.
//

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <cstdlib>
using namespace std;
vector<string> st;
typedef unsigned long long ll;
#define mod 1000000007
     
  // Function to return LCM of two numbers
int fact(int n)
{
    // single line to find factorial
    return (n==1 || n==0) ? 1: n * fact(n - 1);
}
 ll gcd(ll a, ll b)
 {
     if (a == 0)
         return b;
     return gcd(b % a, a);
 }
   
 // Function to find gcd of array of
 // numbers
 ll findGCD(ll arr[], ll n)
 {
     ll result = arr[0];
     for (ll i = 1; i < n; i++)
     {
         result = gcd(arr[i], result);
   
         if(result == 1)
         {
            return 1;
         }
     }
     return result;
 }
ll findlcm(ll arr[], ll n)
{
    // Initialize result
    ll ans = arr[0];
  
    // ans contains LCM of arr[0], ..arr[i]
    // after i'th iteration,
    for (ll i = 1; i < n; i++)
        ans = (((arr[i] * ans)) /
                (gcd(arr[i], ans)));
  
    return ans;
}
bool check(ll n)
{
    while(n>0)
    {
        ll t=n%10;
        if(t!=9)
            return false;
        n/=10;
    }
    return true;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    int h,n;
    cin>>h>>n;
    int a[n];
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if(sum>=h)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}


Measured memory_bytes: 640
from itertools import product
def calc_appropriate_op(a, b, c, d):
  """
  calc op1, op2, op3 that satisfies 'a(op1)b(op2)c(op3)d = 7'
  Args:
    a, b, c, d (str)
  Returns:
    list (str) 
  """
  for pattern in product(['+', '-'], repeat=3):
    if eval(a+pattern[0]+b+pattern[1]+c+pattern[2]+d) == 7:
      return pattern
  



s = input()
a, b, c, d = s
op_list = calc_appropriate_op(a, b, c, d)
print("{}{}{}{}{}{}{}=7".format(a, op_list[0], b, op_list[1], c, op_list[2], d))


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

using namespace std;

int N, K;
int custo[100000];
int pd[100000];

int mam(int i){
    int aux = 1000000000;

    if (i == N - 1){
        return 0;
    }

    if (pd[i] == -1){
        for (int j = 1; j <= K && i < N - j; j++){
            
                aux = min(aux, abs(custo[i] - custo[i + j]) + mam(i + j));
            }
        return pd[i] = aux;
    }

    return pd[i];
}

int main(){
    scanf("%d %d", &N, &K);

    memset(pd, -1, sizeof(int) * N);

    for (int i = 0; i < N; i++){
        scanf("%d", &custo[i]);
    }

    printf("%d\n", mam(0));

    return 0;
}

Measured memory_bytes: 7680
fn main() {
    let std_in = std::io::stdin();
    let mut br = std::io::BufReader::new(std_in.lock());

    let s = rs(&mut br);
    let f = s[0].to_digit(10).unwrap() * 10 + s[1].to_digit(10).unwrap();
    let b = s[2].to_digit(10).unwrap() * 10 + s[3].to_digit(10).unwrap();
    let fb = f > 0 && f < 13;
    let bb = b > 0 && b < 13;
    if fb && bb {
        println!("AMBIGUOUS");
    } else if fb {
        println!("MMYY");
    } else if bb {
        println!("YYMM");
    } else {
        println!("NA");
    }
}


//////////////////////////////////////////////////////////////////////////////////
use std::io::{BufReader, BufRead, StdinLock};

#[allow(dead_code)]
fn rs(br: &mut BufReader<StdinLock>) -> Vec<char> {
    let mut buf = String::new();
    br.read_line(&mut buf).ok();
    buf.trim().chars().collect()
}

#[allow(dead_code)]
fn rn<T: std::str::FromStr>(br: &mut BufReader<StdinLock>) -> T {
    let mut buf = String::new();
    br.read_line(&mut buf).ok();
    buf.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn rvs(br: &mut BufReader<StdinLock>) -> Vec<Vec<char>> {
    let mut buf = String::new();
    br.read_line(&mut buf).ok();
    buf.trim().split_whitespace().map(|e| e.chars().collect()).collect()
}

#[allow(dead_code)]
fn rvn<T: std::str::FromStr>(br: &mut BufReader<StdinLock>) -> Vec<T> {
    let mut buf = String::new();
    br.read_line(&mut buf).ok();
    buf.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}



Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main ()         
{
  long long int x,y,a,b;cin>>x>>y;
  b=max(x,y);a=min(x,y);
  if (a<=b) {
      for (long long int i=0;i<b;i++) cout<<a;
      cout<<endl;
  }






}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
using namespace std;
int main(){
	int a,b,e=0,f=100000;
	cin>>a>>b;
	int c[b],d[b];
	for(int i=0;i<b;i++){
		cin>>c[i]>>d[i];
		e=max(c[i],e);
		f=min(d[i],f);
	}
	if(f-e+1>a)
		cout<<a<<endl;
	else if(f-e>=0)
		cout<<f-e+1<<endl;
	else
		cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 1024
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');

var n = +lines.shift();

for (var i = 0; i < n; i++) {
	var nums = lines[i].split(' ').sort(function(a,b){return a-b;});
	var a = nums[0];
	var b = nums[1];
	var c = nums[2];

	if (c * c == a * a + b * b)
		console.log('YES');
	else
		console.log('NO');
}

Measured memory_bytes: 10560
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define loop(i) for(int i = 0;true; i++)
#define all(x) (x).begin(), (x).end()
#define yn(f) (f?"yes":"no")
#define YN(f) (f?"YES":"NO")
#define Yn(f) (f?"Yes":"No")
#define mn 1000000007
int main() {
	int N;
	cin >> N;
	vi A(N + 1);
	vi B(N);
	ll total = 0;
	
	rep(i, 0, N + 1)cin >> A[i];
	rep(i, 0, N + 1)total+= A[i];
	rep(i, 0, N)cin >> B[i];
	for (int i = N; i>=1; i--)
	{
		int num = B[i-1];
		if (A[i]<num) {
			num -= A[i];
			A[i] = 0;
		}
		else {
			A[i] -= num;
			num = 0;
		}
		if (A[i-1] < num) {
			num -= A[i-1];
			A[i-1] = 0;
		}
		else {
			A[i-1] -= num;
			num = 0;
		}
	}
	ll total2 = 0;
	rep(i, 0, N + 1)total2 += A[i];
	cout << (total-total2) << endl;
};


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

void solve(std::string S)
{
  std::vector<long long> score(S.size(), 0);
  // score[1] = 0;
  int accum_r = 1;
  int anchor_place= 0;
  for (int i = 1; i < S.size(); i++)
  {
    if(S[i] == 'R'&&S[i-1]=='R'){
      accum_r++;
      score[i] = 0;
    }
    else if(S[i-1]=='R'&&S[i]=='L')
    {
      score[i]+=accum_r/2+1;
      score[i-1]+=accum_r/2+accum_r%2;
      anchor_place = i;
    }
    else if(S[i]=='L'&&S[i-1]=='L')
    {
      int diff = i-anchor_place;
      if(diff%2==1)
      {
        score[anchor_place-1]++;
      }
      else
      {
        score[anchor_place]++;
      }
    }
    else if(S[i-1]=='L'&&S[i]=='R')
    {
      accum_r =1;
      score[i]=0;
    }
  }
  for(const auto& s: score)
  {
    std::cout << s << std::endl;
  }
}

int main(void)
{
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    int n,k;cin >> n >> k;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
        a[i]--;
    }
    vector<int> vis(n),travel = {0};
    while(1){
        travel.push_back(a[travel.back()]);
        if(vis[travel.back()])break;
        vis[travel.back()] = 1;
        
    }
    // trace(travel);
    int i = 0;
    for(;i < travel.size() && travel[i] != travel.back();i++);
    int T = (int)travel.size() - i-1;
    // trace(T);
    if(k < i){
        cout << travel[k]+1 << endl;
        return 0;
    }
    k -= i;
    k %= T;
    
    cout << travel[i+k]+1 << endl;


    return 0;
}

Measured memory_bytes: 8492
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll x, y;
  cin >> x >> y;
  cout << (abs(x-y) < 2 ? "Brown\n" : "Alice\n");
  return 0;
}

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

using namespace std;

const int MAXN = 200100;

int arr[MAXN];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n, i;
	long long sol = 0;
	
	cin>>n;
	
	for (i = 0; i < n; ++i)
	{
		cin>>arr[i];
		arr[i] -= i + 1;
	}
	
	sort(arr, arr + n);
	
	for (i = 0; i < n; ++i)
	{
		sol += abs(arr[i] - arr[n / 2]);
	}
	
	cout<<sol<<'\n';
}


Measured memory_bytes: 1024
for _ in range(int(input())):
    _= int(input())
    upv=dov=0
    h= list(map(int, input().split()))
    for i in range(len(h)-1):
        upv= max(upv, h[i+1]-h[i])
        dov= max(dov, h[i]-h[i+1])
    print(upv, dov)

Measured memory_bytes: 7544
#include<bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define ll long long int
const int mod=1e9+7;
ll fact(ll n){return (n==1 || n==0) ? 1: n * fact(n - 1);  } 
ll cal(ll p,double r,ll t){
    return (ll)(p * (pow((1 + r / 100), t))); 
}
int main(){
  ll p=100;
  double r= 1;
  ll t=0; 
  ll x;
  cin>>x;
  while(p<x){
      p*=1.01;
      t++;
  }
  cout<<t;
}

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

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

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vii vector<vi>

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

int main(){
	 //cin.tie(0);
	//ios::sync_with_stdio(false);
	//std::cout << std::fixed;
	//std::cout << std::setprecision(12);
	//std::cout << std::defaultfloat;
	int a;
	string s;
	cin>>a>>s;
	if(a>=3200){
		cout<<s;
	}else{
		cout<<"red";
	}

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a,b,x,digit;
  while(scanf("%d %d",&a,&b) != EOF){
    x = a + b;
    digit = 1;
    while(x/10>0){
      x = x/10;
      digit++;
    }
    printf("%d\n",digit);
  }
  return 0;
}



Measured memory_bytes: 2048
program jsc2019qualb
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64):: n,k,i,j,fst,ots
    integer(int64),parameter:: md=1000000007
    integer(int64), allocatable:: a(:)
    
    read*, n,k
    allocate(a(n))
    read*, a(:)
    fst=0; ots=0
    do i=1,n
        do j=1,n
            if (a(i) > a(j)) then
                if (i < j) fst=fst+1
                ots=ots+1
            end if
        end do
    end do
    
    print'(i0)', mod(mod(fst*k,md) + mod(mod(k*(k-1)/2,md)*ots,md),md)
end program jsc2019qualb

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
print(*A)

def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i-1
        while j>= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(*A)

insertionSort(A, N)

Measured memory_bytes: 8024
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) x*=i;
    return x;
}

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

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



int main(){
    ll n;
    cin>>n;
    vector<ll> t(n),x(n),y(n);
    rep(i,n) cin>>t[i]>>x[i]>>y[i];
    if((t[0]%2==0 && (x[0]+y[0])%2!=0) || (t[0]%2!=0 && (x[0]+y[0])%2==0) || t[0]<x[0]+y[0]){
        cout<<"No"<<endl;
        return 0;
    }
    rep(i,n-1){
        ll dist=abs(x[i+1]-x[i]+y[i+1]-y[i]),time=t[i+1]-t[i];
        if((time%2==0 && dist%2!=0) || (time%2!=0 && dist%2==0) || time<dist){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


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

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

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976
const double PI = 3.1415926535897932;

vector<int> Zalgo(const string &S) {
    int N = (int)S.size();
    vector<int> res(N);
    res[0] = N;
    int i = 1, j = 0;
    while (i < N) {
        while (i+j < N && S[j] == S[i+j]) ++j;
        res[i] = j;
        if (j == 0) {++i; continue;}
        int k = 1;
        while (i+k < N && k+res[k] < j) res[i+k] = res[k], ++k;
        i += k, j -= k;
    }
    return res;
}

int main()
{
    int n; cin >> n;
    string s; cin >> s;
    int ans = 0;
    rep(i,n){
        string t = s.substr(i);
        auto vec = Zalgo(t);
        rep(j,vec.size()){
            if(j >= vec[j]) ans = max(ans,vec[j]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#define first x
#define second y
#include <bits/stdc++.h>

using namespace std;

enum {MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009};
typedef unsigned short ushort;typedef unsigned int uint;typedef long long ll;typedef unsigned long long ull;
#ifndef CrafterKolyan
#define endl '\n'
#endif

signed main() {
#ifndef CrafterKolyan
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    int a, b;
    cin >> a >> b;
    cout << (max(a, b) < 9 ? "Yay!" : ":(") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

using ul = unsigned long long;
ul a, b;
int main() {
  cin >> a >> b;
  if (a==b) {cout << a << endl; return 0; }
  
  lli y, m=(b-a)%4;
  if (a%2==0) {
    if (m==0) y = b;
    if (m==1) y = 1;
    if (m==2) y = b^1;
    if (m==3) y = 0;
  } else {
    if (m==0) y = a;
    if (m==1) y = a^b;
    if (m==2) y = a-1;
    if (m==3) y = (a^b)-1;
  }
  cout << y << '\n';
  /*
  lli y = a;
  for (lli x=a+1; x<=b; ++x) {
    y ^= x;
    cout << y << '\t' << (x^a) << endl;
  }
  */
  return 0;
}



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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  LL N, K;
  cin >> N >> K;

  LL ans = 1e18;
  REP(b,1<<N){
	LL tmp = 1;
	REP(j,N)
	  if(b>>j&1) tmp *= 2;
	  else tmp += K;
	mini(ans, tmp);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
alist=[a,b,c,d,e]
num=0
import math
for i in range(5):
  num+=math.ceil(alist[i]/10)*10
num2=10
for i in range(5):
  if alist[i]%10!=0:
    num2=min(num2,alist[i]%10)
print(num-10+num2)

Measured memory_bytes: 9084
#include <iostream>
#include<string>

using namespace std;

int main()
{
	int h,w,i,j;
    string ss;

    while (1)
    {
        cin >> h >> w;
        if (w == 0 && h == 0){
            break;
        }
        for (i = 0; i < h; i ++){
            for (j = 0; j < w; j++) cout << "#";
            cout << endl;
        }
        cout << endl;
    }
    return 0;


}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
  string S;
  ll K;
  cin>>S;
  cin>>K;

  FOR(i,0,K-1){

    if(S[i]!='1'){
      cout<<S[i]<<endl;
      return 0;
    }

  }

  cout<<'1'<<endl;
  return 0;
}
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000

int main(){
    
	int N;
	cin>>N;
	
	if(N==3){
		cout<<"2 5 63"<<endl;
		return 0;
	}
	
	vector<int> V;
	for(int i=1;i<=30000;i++){
		if(i%2==0||i%3==0){
			V.push_back(i);
		}
	}
	
	int sum = 0;
	int now = 0;
	
	for(int i=0;i<N-2;i++){
		if(i!=0)cout<<' ';
		cout<<V[i];
		sum += V[i];
	}
	
	for(int i=N-2;i<V.size();i++){
		for(int j=i+1;j<V.size();j++){
			if((sum+V[i]+V[j])%6==0){
				cout<<' '<<V[i]<<' '<<V[j]<<endl;
				return 0;
			}
		}
	}
	
    return 0;
}



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

using namespace std;

int main()
{
    /*istringstream iss;

    string value = "32 40 50 30 60";
    int arr[5];
    iss.str (value); //what does this do???
    for (int i = 0; i < 5; i++)
    {
        int val;
        iss >> val;
        iss>>arr[i];


        cout << i << "-> " << val <<typeid(val).name()<<endl;
    }
    for(int i=0;i<5;i++){
        cout<<arr[i]<<" ";
    }*/
    int r;
    cin>>r;
    cout<<2*3.1416*r<<endl;

    return 0;
}


Measured memory_bytes: 3784
n = int(input())
a, b, c = [], [], []
for i in range(n):
    h = input().split(" ")
    a.append(int(h[0]))
    b.append(int(h[1]))
    c.append(int(h[2]))
sum_a, sum_b, sum_c = [a[0]], [b[0]], [c[0]]
for i in range(1, n):
    sum_a.append(a[i] + max(sum_b[i - 1], sum_c[i - 1]))
    sum_b.append(b[i] + max(sum_c[i - 1], sum_a[i - 1]))
    sum_c.append(c[i] + max(sum_a[i - 1], sum_b[i - 1]))
print(max(sum_a[n - 1], sum_b[n - 1], sum_c[n - 1]))

Measured memory_bytes: 26856
N,A = map(int,input().split())
X = list(map(int,input().split()))
ans = 0

def make_array(dims,fill):
    if len(dims) == 1:
        return [fill]*dims[0]
    ret = []
    nxt = dims[1:]
    for i in range(dims[0]):
        ret.append(make_array(nxt,fill))
    return ret
S = sum(X)+1
dp = make_array([N+2,N+2,S],0)
dp[0][0][0] = 1
for i in range(N):
    for j in range(N):
        for s in range(S-X[i]):
            dp[i+1][j+1][s+X[i]] += dp[i][j][s]
            dp[i+1][j][s] += dp[i][j][s]
ans = 0
for j in range(1,N+1):
    for s in range(1,S+1):
        if j*A == s:
            ans += dp[-2][j][s]
print(ans)

Measured memory_bytes: 94812
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int mod = 1e9+7;

int main() {
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());
  if (s < t) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0; 
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

int main() {
	int N, M, K;
	cin >> N >> M >> K;
	for (int i = 0; i <= N; i++)
		for (int j = 0; j <= M; j++) {
			int b = i * M;
			b -= 2 * j * i;
			b += j * N;
			if (b == K) {
				puts("Yes");
				return 0;
			}
		}
	puts("No");
	return 0;
}


Measured memory_bytes: 256
import sys
N = int(input())
arr = []

for i in range(N):
    arr.append(list(map(int, input().split())))

if N == 1:
    print(1)
    sys.exit()

d = {}

for i in range(N):
    for j in range(N):
        if i != j:
            x = arr[i][0] - arr[j][0]
            y = arr[i][1] - arr[j][1]
            if (x, y) in list(d.keys()):
                d[(x, y)] += 1
            else:
                d[(x, y)] = 1

print(N - max(list(d.values())))

Measured memory_bytes: 41112
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <assert.h>
using namespace std;
// string s1 = "1000000000";
// long v1 = 1000000000;
bool get(){
    string str;
    cin >> str;
    return str=="Y";
}
bool ask(string str){
    cout << "? " << str << endl;
    return get();
    // cout << "ASK " << str << " " << ((stol(str)<=v1) == (str<=s1)) << endl;
    // return (stol(str)<=v1) == (str<=s1);
}
bool ret(string str){
    cout << "! " << str << endl;
}

int main() {
    
    std::ios::sync_with_stdio(false);
    long asks = 0;
    vector<string> nums;
    for(long i = 0; i<10; i++){
        string str = to_string(i);
        nums.push_back(str);
    }
    string prefix = "";
    while(true){
        string post = "00";
        if(prefix.length()==0){
            post = "10";
        }
        asks++;
        assert(asks<=64);
        
        if(!ask(prefix+post)){
            long low = 1;
                if(prefix.length()>0){
                    low = 0;
                }
                long high = 9;
                while(low<high){
                    long mid = (low+high)/2;
                    asks++;
                    assert(asks<=64);
                    if(ask(prefix + to_string(mid) + to_string(mid))){
                        high = mid;
                    }
                    else{
                        low = mid+1;
                    }
                }
                prefix += to_string(low);
                break;
        }
        else{
            bool askedFirst = false;
            bool firstRes = false;
            long low = 1;
            if(prefix.length()>0){
                low = 0;
            }
            asks++;
            assert(asks<=64);
            string x = prefix+to_string(low);
            while(x.length()<15){
                x = x+"0";
            }
            if(ask(x)){
                asks++;
                assert(asks<=64);
                askedFirst = true;
                firstRes = false;
                if(ask(prefix+"5")){
                    prefix += to_string(low);
                    break;
                }
                else{
                    prefix += to_string(low);
                    continue;
                }
            }
            long high = 9;
            while(low<high){
                long mid = (low+high+1)/2;
                if(askedFirst){
                    askedFirst = false;
                    if(firstRes){
                        low = mid;
                    }
                    else{
                        high = mid-1;
                    }
                    continue;
                }
                asks++;
                assert(asks<=64);
                if(ask(prefix+to_string(mid))){
                    low = mid;
                }
                else{
                    high = mid-1;
                }
            }
            prefix += to_string(low);
        }
    }
    ret(prefix);
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<int>>;


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll modinv(ll a, ll m){
    ll b = m, u = 1, v = 0;
    while(b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if(u < 0) u += m;
    cout << u << endl;
    return u;
}

 
int main() {
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    string ans = "No";
    REP(i, k+1){
        REP(j, k-i+1){
            REP(l,k-i-j+1){
                int a_x = pow(2,i) * a;
                int b_x = pow(2,j) * b;
                int c_x = pow(2,l) * c;
                if(b_x > a_x && c_x > b_x){
                    ans = "Yes";
                }
            }
        }
    }

    cout << ans << endl;
    
}





Measured memory_bytes: 4100
/* Author : Prasuk Jain */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define int              long long int
#define ull              unsigned long long
#define ld               long double
#define ull              unsigned long long
#define fo(i, n)         for(int i=0; i<n; i++)
#define FOR(i, a, b)     for(int i=a; i<b; i++)
#define rfor(i, n)       for(int i=n-1; i>=0; i--)
#define RFOR(i, a, b)    for(int i=b-1; i>=a; i--)
#define tr(it, v)        for(auto it=a.begin(); it!=a.end(); it++)
#define vi               vector<int>
#define mp               make_pair
#define pb(x)            push_back(x)
#define pii              pair<int,int>
#define vi               vector<int>
#define mii              map<int,int>
#define pqb              priority_queue<int>
#define PI 3.1415926535897932384626
#define pqs              priority_queue<int,vi,greater<int>>
#define hcf(x, y)        __gcd(x, y)
#define lcm(x, y)        boost::math::lcm(x,y)
#define setpre(x, y)     fixed << setprecision(y) << x
#define setbits(x)       __builtin_popcountll(x)
#define zerolead(x)      __builtin_clzll(x)
#define zerotrail(x)     __builtin_ctzll(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
const int  mod = 1e+7;
const int inf = 1e18;
bool isprime(int a){if(a <=1)return false;for(int i=2;i*i<=a;i++)
{if(a%i==0)return false;}return true;}

//*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!//

void coderprasukj(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int32_t main() {
    //coderprasukj();
    double t;
    cin >> t;
    cout << 2*PI*t << "\n";
    
    return 0;
}



Measured memory_bytes: 3788
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args){
		
		//
		String keyword= "";
		String sentence= "";
		int answer = 0;
		
		//標準入力
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			//入力文字
			keyword = sc.next();
			break;
		}
		
		//英文を取ってくる
		while(sc.hasNextLine()){
			//
			sentence = sc.next();
			
			if(sentence.equals("END_OF_TEXT"))
				break;
				
			
			//表示
			utility ut = new utility();
			answer += ut.mate_string(keyword,sentence);
			
		}
		
		System.out.println(answer);
		
	}
}

class utility{
	
	//キーワードと検索単語を渡して、キーワードと検索単語を同じ(小文字と大文字関係なし)だった場合は1を返す
	public int mate_string(String keyword,String sentence){
		//
		if(keyword.equals((sentence.toLowerCase()))){
			//一致しているときは1
			return 1;
		}
		
		//一致していないときは0
		return 0;
	}
}

Measured memory_bytes: 19880
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#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 repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b-1);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  ll res=1e9;
  vector<pair<ll,ll>>ab(n);
  rep(i,n)cin>>ab[i].first;
  rep(i,n)cin>>ab[i].second;
  rep(i,n){
    if(i%2)swap(ab[i].first,ab[i].second);
  }
  rep(i,1ll<<n){
    bitset<18>bit=i;
    if(__builtin_popcount(i)!=(n+1)/2)continue;
    vector<pair<ll,ll>>odd,even;
    ll cnt=0;
    rep(j,n){
      if(bit[j])even.push_back({ab[j].first,j});
      else odd.push_back({ab[j].second,j});
    }
    sort(all(even));
    sort(all(odd));
    vector<pair<ll,ll>>c(n);
    rep(j,n){
      if(j%2){
        c[j]=odd[j/2];
      }
      else {
        c[j]=even[j/2];
      }
      //cout<<"even"<<even[j/2].second<<endl;
    }
    ll f=1;
    rep(j,n-1){
      if(c[j+1].first<c[j].first)f=0;
    }
    rep(j,n){
      repi(k,j+1,n){
        if(c[j].second>c[k].second)cnt++;
      }
    }

    //cout<<i<<endl;


    if(f)chmin(res,cnt);
  }
  if(res==1e9)res=-1;

  cout<<res<<endl;
  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
int main() {
    string X="ACGT";
    string Y="TGCA";
    int i;
    char b;
    cin>>b;
    for(i=0;i<4;i++){
        if(X[i]==b){
            cout << Y[i] << endl;
        }
    }

    //std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
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 T > using matrix = vector< vector< T > >;

//FUNCTION  

int euclidean_gcd(int a, int b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}


void solve(void)
{
  int N,K;
  cin>>N>>K;
  
  int f;
  cin>>f;
  int GCD = f;
  int MAX = f;
  for (int i = 0; i < N-1; i++)
  {
    int A;
    cin>>A;
    chmax(MAX,A);
    GCD = euclidean_gcd(GCD,A);
  }
  if(K%GCD == 0 && K <= MAX)
  {
    cout<<"POSSIBLE"<<endl;
  }
  else
  {
    cout<<"IMPOSSIBLE"<<endl;
  }
  
  

  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 256