akhauriyash/Code-Regression huggingface dataset:
/*
        karmany evadhikaras te
        ma phalesu kadacana 
        ma karma-phala-hetur bhur
        ma re sango'stv akarmani (B.G.-2.47)
 
Translation:
        Lord Krsna to Arjuna.
You have a right to perform your prescribed duty, 
but you are not entitled to the fruits of action. 
Never consider yourself the cause of the results of your activities, 
and never be attached to not doing your duty.    
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 200005;
const ll mod = 1e9+7;
#define ld long double
#define PI 3.14159265358979323846
const int X = 1000;

void flash()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(12);
}

//3. Structure or classes
//3. Ends here

//1. Data structures declaration here
//1. Ends here

//2. Extra Functions here
//2. Ends here


void solve();
int32_t main()
{
    flash();
    int t;
    t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

void solve()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n,greater<int>());
    int cnt=0;
    ll sum=0;
    for(int i=0,j=0;i<n;i++){
        if(i==0)continue;
        if(i%2==0)j++;
        sum+=a[j];
        //cout<<a[j]<<" ";
    }
    cout<<sum;
}

Measured memory_bytes: 4440
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <map>
#include <set>
#define LL long long
#define mp make_pair

using namespace std;

const int maxn=5000010;
const int oo=1000000000;
const int modulo=1000000007;

LL q, h, s, d;
LL n;

void input(){
	cin >> q >> h >> s >> d >> n;
}

void init(){
	if (h > q * 2) h = q * 2;
	if (s > h * 2) s = h * 2;
	if (d > s * 2) d = s * 2;
}

void solve(){
	if (n % 2 == 1) cout << (n / 2) * d + s; else cout << (n / 2) * d;
}

void output(){

}

int main(){
// 	freopen("test.inp", "r", stdin);
//	freopen("test.out", "w", stdout);
	std::ios::sync_with_stdio(false);
	input();
	init();
	solve();
	output();

	return(0);
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int n;
    cin >> n;
    double t, a;
    cin >> t >> a;
    double h[n];
    rep(i, n) cin >> h[i];
    rep(i, n) h[i] = t - h[i] * 0.006;
    double ans = 1e7;
    int p = 0;
    rep(i, n)
    {
        if (abs(h[i] - a) < ans)
        {
            p = i + 1;
            ans = abs(h[i] - a);
        }
    }

    OP(p);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

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

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n,m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--;b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<int> d(n,-1);
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int now = q.front();
        q.pop();
        for(auto next:g[now]){
            if(d[next] == -1){
                d[next] = now;
                q.push(next);
            }
        }
    }
    cout << "Yes" << endl;
    rep(i,n-1)cout << d[i+1] + 1 << endl;
}

Measured memory_bytes: 10116
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
 
using namespace std;

bool bc[200001];
int a[100001];


void solve(){
	ll a,b;
	cin>>a>>b;
	cout<<a*b/__gcd(a,b);
}


int main()
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//cout<<fixed<<setprecision(12);
	
	int t =1; 
	//cin>>t;

	for(int i=1; i<=t; i++){
		solve();
		cout<<"\n";
	}
	return 0;

}

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

using namespace std;

int a[505][505];

void solve(int l, int r, int c){
	if(l==r){
		return;
	}
	int mid=(l+r)>>1;
	solve(l,mid,c+1);
	solve(mid+1,r,c+1);
	for(int i=l;i<=mid;i++){
		for(int j=mid+1;j<=r;j++){
			a[i][j]=c;
		}
	}
}

int main(){
	int n; cin >> n;
	solve(0,n-1,1);
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1408
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    # from collections import deque
    # from collections import Counter
    # import math
    # import random
    input = stdin.readline


    a, b, c, k = map(int, input().split())
    if k <= a:
        print(k)
    elif k <= a+b:
        print(a)
    else:
        print(a-(k-(a+b)))

Measured memory_bytes: 9204
import math
import fractions

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans

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 = 10 ** 9 + 7
N = 10 ** 6 + 2
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)
'''


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

x1,y1,x2,y2 = list(map(int, input().split()))


p = 10 ** 9 + 7
N = 2 * 10 ** 6 + 2
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)

def cmb2(a,b,p):
    return cmb(a+b+2,a+1,p)
    
print((cmb2(x2,y2,p) - cmb2(x1-1,y2,p) -cmb2(x2,y1-1,p) + cmb2(x1-1,y1-1,p))%p)
#print(cmb2(x2,y2,p), cmb2(x1-1,y2,p) ,cmb2(x2,y1-1,p) ,cmb2(x1-1,y1-1,p))




Measured memory_bytes: 144256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define NIL -1
typedef long long ll;
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll MOD = 1000000007;


void solve() {

    int n;
    string s, t, result;
    cin >> n;
    cin >> s >> t;
    result = "";
    rep(i, n){
        result = result + s[i] + t[i];
    }
    cout << result << endl;
    return;
}

int main() {
    solve();
    return 0;

}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
    Scanner scn = new Scanner(System.in);
      
    int N = scn.nextInt();
	double[] x = new double[N];
    String[] u = new String[N];
    double btc_rate=380000.0;
    double sum = 0;
      
    for(int i=0;i<N;i++){
    x[i]=scn.nextDouble();
    u[i]=scn.next();
     // System.out.print("i,"+i+","+u[i]);
    
    if(u[i].equals("BTC")){
    sum+=(x[i]*btc_rate);
    }else{
    sum+=x[i];
    }
    }
      System.out.print(sum);
    }
}
    

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

int main() {
	int n,q; cin >> n >> q;
	string s; cin >> s;
	vector<int> v(n + 1);
	v[0] = 0;
	for (int m = 1; m < n; ++m) {
		v[m] = v[m - 1];
		string sub = s.substr(m - 1,2);
		if (sub == "AC") v[m] += 1;
	}
	v[n] = v[n - 1];
	for (int i = 0; i < q; ++i) {
		int l,r; cin >> l >> r;
		cout <<  v[r - 1] - v[l - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
const ll MOD = 998244353;

vector<pair<ll, ll>> rec[2048];
vector<ll> seg[2048];

ll W[1048576], V[1048576];

pair<ll, ll> mem[1024];

ll fvar, fu, sz;

ll rmq(int s, int t, int k = 1, int l = 0, int r = sz / 2 - 1) {
	if (t < l || r < s)
		return 0;
	if (s <= l && r <= t) 
		return seg[fu][k];

	ll lv = rmq(s, t, k * 2, l, (l + r) / 2);
	ll rv = rmq(s, t, k * 2 + 1, (l + r) / 2 + 1, r);
	return max(lv, rv);
}

void root(int v, int var) {
	if (v < 1024) {
		fvar = var, fu = v;
		return;
	}
	for (int i = 0;i < var;i++) {
		mem[var + i] = { mem[i].first + W[v],mem[i].second + V[v] };
	}
	root(v / 2, var * 2);
}

int main() {
	ll N;
	cin >> N;
	for (int i = 1;i <= N;i++) {
		cin >> V[i] >> W[i];
	}
	//1024までの頂点は自分より上を持つ
	ll rs;
	rec[0] = { { 0,0 } };
	for (int i = 1;i < 1024;i++) {
		for (auto j : rec[i / 2]) {
			rec[i].push_back({ j.first + W[i], j.second + V[i] });
			rec[i].push_back(j);
		}
	}

	for (int i = 1;i < 1024;i++) {
		sort(all(rec[i]));
		rs = rec[i].size();
		seg[i] = vector<ll>(rs * 2, 0);
		for (int j = 0;j < rs;j++) {
			seg[i][rs + j] = rec[i][j].second;
		}
		for (int j = rs - 1;j > 0;j--) {
			seg[i][j] = max(seg[i][j * 2], seg[i][j * 2 + 1]);
		}
	}
	//それぞれについてセグ木のテーブル所持

	ll Q, v, L;
	ll mx, rr;
	cin >> Q;
	pair<ll, ll> ser;
	for (int i = 0;i < Q;i++) {
		cin >> v >> L;
		mem[0] = { 0,0 };
		root(v, 1);
		mx = 0;
		for (int k = 0;k < fvar;k++) {
			if (mem[k].first > L)continue;
			ser = { L - mem[k].first + 1,-100 };
			auto it = lower_bound(all(rec[fu]), ser);
			if (it == rec[fu].begin()) {
				mx = max(mx, mem[k].second);
				continue;
			}
			it--;
			rr = (int)(it - rec[fu].begin());

			sz = seg[fu].size();

			mx = max(mx, rmq(0, rr) + mem[k].second);
		}
		cout << mx << "\n";
	}
}

Measured memory_bytes: 29700
input = [input() for i in range(2)]
N = int(input[0])
string = input[1].split()
s = list(string[0])
t = list(string[1])

if(len(s) != N or len(t) != N):
  raise ValueError('the length of the string input is not valid')
  
res = []
for index in range(N):
  res.append(s[index])
  res.append(t[index])
  
print(''.join(res))  

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size();

    if (s == "zyxwvutsrqponmlkjihgfedcba") {
        cout << -1 << endl;
        return 0;
    }

    int p[26] = {};
    for (int i = 0; i < n; i++) {
        p[s[i] - 'a']++;
    }

    int k = -1;
    for (int j = 0; j < 26; j++) {
        if (p[j] == 0) {
            k = j;
            break;
        }
    }

    if (k < 0) {
        for (int i = n - 1; i > 0; i--) {
            if (s[i - 1] < s[i]) {
                int p[26] = {};
                for (int i1 = 0; i1 < i - 1; i1++) {
                    p[s[i1] - 'a']++;
                }
                for (int j = 0; j < 26; j++) {
                    if (p[j] == 0 && j > s[i - 1] - 'a') {
                        k = j;
                        break;
                    }
                }
                s[i - 1] = k + 'a';
                s.resize(i);
                break;
            }
        }
    //} else if (s.back() - 'a' < k) {
    //    s.back() = k + 'a';
    } else {
        s.push_back(k + 'a');
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i < int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()

int main(){
	string s;
	cin >> s;
	replace(s.begin(),s.end(),',',' ');
	cout << s << endl;
	return 0;
}


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

int main() {
  int h,w;
  cin >>h>>w;
  vector<vector<char>> a(h+2,vector<char>(w+2,'#'));
  for(int i=1;i<h+1;i++){ //j<w+2だと入力がh文字だけなのでずれてしまう
    for(int j=1;j<w+1;j++){
      cin>>a[i][j];
     
    }
  }
  for(int i=0;i<h+2;i++){
    for(int j=0;j<w+2;j++){
   if(j==w+1)cout<<a[i][j]<<endl;
      else cout<<a[i][j];
    }
  }
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>  // ver2.2.5
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define COUNT(a,i) upper_bound(ALL(a),i)-lower_bound(ALL(a),i)
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Pii pair<int,int>
#define VPii vector<Pii>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define itos to_string
#define stoi stoll
#define FI first
#define SE second
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define _ <<' '<<
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vin(a) rep(iI,0,a.size())cin>>a[iI]
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lY,0,a.size()){Vout(a[lY]);}
#define VPout(a) rep(lX,0,a.size())cout<<a[lX].FI<<' '<<a[lX].SE<<endl
#define Verr(a) rep(iZ,0,a.size()-1)cerr<<a[iZ]<<' ';cerr<<a.back()<<endl
#define VVerr(a) rep(iY,0,a.size()){Verr(a[iY]);}
#define VPerr(a) rep(iX,0,a.size())cerr<<a[iX].FI<<' '<<a[iX].SE<<endl
#define INF 3000000000000000000  //  3.0*10^18(MAXの1/3くらい)
#define MAX LLONG_MAX
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
void press(auto &v){v.erase(unique(ALL(v)),v.end());}  //  圧縮
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}



signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int n,k;
  cin >> n >> k;
  Vi a(n),b(n),c(n);
  rep(i,0,n) cin >> a[i] >> b[i] >> c[i];
  
  Vi s1(n),s2(n),s3(n),s4(n),s5(n),s6(n),s7(n),s8(n);
  
  rep(i,0,n){
    s1[i] = 0+a[i]+b[i]+c[i];
    s2[i] = 0-a[i]+b[i]+c[i];
    s3[i] = 0+a[i]-b[i]+c[i];
    s4[i] = 0+a[i]+b[i]-c[i];
    s5[i] = 0-a[i]+b[i]-c[i];
    s6[i] = 0-a[i]-b[i]+c[i];
    s7[i] = 0+a[i]-b[i]-c[i];
    s8[i] = 0-a[i]-b[i]-c[i];
  }
  
  sortr(ALL(s1));
  sortr(ALL(s2));
  sortr(ALL(s3));
  sortr(ALL(s4));
  sortr(ALL(s5));
  sortr(ALL(s6));
  sortr(ALL(s7));
  sortr(ALL(s8));
  
  int q1=0;
  int q2=0;
  int q3=0;
  int q4=0;
  int q5=0;
  int q6=0;
  int q7=0;
  int q8=0;
  
  rep(i,0,k){
    q1 += s1[i];
    q2 += s2[i];
    q3 += s3[i];
    q4 += s4[i];
    q5 += s5[i];
    q6 += s6[i];
    q7 += s7[i];
    q8 += s8[i];
  }
  
  cout << max({q1,q2,q3,q4,q5,q6,q7,q8}) << endl;
  return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<bits/stdc++.h>
// iteration and input/output stream
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define printarr(x) rep(i,0,x.size()) cout<<x[i]<<" "; cout<<endl;

#define si(x) int x; scanf("%d", &x)
#define sll(x) ll x; scanf("%lld", &x)
#define pi(x) printf("%d", x)
#define pll(x) printf("%lld", x)
#define nl prinf("\n")
#define tr(cont,it) \
for(decltype(cont.begin()) it = cont.begin(); it!= cont.end() ; it++)

#define tc() int tcase; cin >> tcase ; rep(tc,1,tcase+1)
//STL shortcuts
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define F first
#define S second
#define MP make_pair

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

using namespace std;

typedef long long int ll; // 64 bit integer
typedef unsigned long long int  ull; // 64 bit unsigned integer
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<int,ll> pill;

inline void smax(int &x , int y) { x = max(x , y) ; }
inline void smin(int &x , int y) { x = min(x , y) ; }

#define MOD 1000000007
#define inf 4000000000000000000LL
#define SYNC std::ios::sync_with_stdio(false);  cin.tie(NULL);
#define N 100000
ll gcd(ll a,ll b){ return ((b==0)? a:gcd(b,a%b) ); }


int main()
{
    SYNC
    string s;
    cin>>s;
    ll cnt= 0,ans= 0;
    rep(i,0,s.size())
    {
        if(s[i]=='B')
            cnt++;
        else
            ans+= cnt;
    }
    cout<<ans;
}


Measured memory_bytes: 720
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){
	int x,a,b;
	cin>>x>>a>>b;
	cout << (x-a)%b << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
#define w1 first
#define w2 second
#define ls (x<<1)
#define rs (x<<1|1)
#define pb push_back
#define mid ((l+r)>>1)
#define SZ(x) ((x).size())
#define All(x) (x).begin(),(x).end()
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)])
template<class T>void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
int power(int x,int k,int p){int res=1;for(;k;k>>=1,x=1ll*x*x%p)if(k&1)res=1ll*res*x%p;return res;}
const int maxn=2e5+5;
int n;
int a[maxn],b[maxn];
bool check(int x){
	rep(i,1,2*n-1)
		if(a[i]>=x)b[i]=1;
		else b[i]=0;
	int d1=0,d2=0;
	per(i,n-1,1)if(b[i]&&b[i+1]){
		d1=n-i;
		break;
	}else if((!b[i])&&(!b[i+1])){
		d1=-(n-i);
		break;
	}
	rep(i,n+1,2*n-1)if(b[i]&&b[i-1]){
		d2=i-n;
		break;
	}else if((!b[i])&&(!b[i-1])){
		d2=-(i-n);
		break;
	}
	if(!d1&&!d2)return b[1];
	if(!d1||!d2)return d1+d2<0?0:1;
	if(d1>0&&d2>0)return 1;
	if(d1<0&&d2<0)return 0;
	return d1+d2<0?1:0;
}
int main(){
	read(n);
	rep(i,1,2*n-1)read(a[i]);
	int l=1,r=2*n-1,ans=1;
	while(l<=r){
		if(check(mid))ans=mid,l=mid+1;
		else r=mid-1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		if(S.charAt(0)==S.charAt(1)) {
			if(S.charAt(2)==S.charAt(3) && S.charAt(0)!=S.charAt(2)) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		if(S.charAt(0)==S.charAt(2)) {
			if(S.charAt(1)==S.charAt(3) && S.charAt(1)!=S.charAt(2)) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		if(S.charAt(0)==S.charAt(3)) {
			if(S.charAt(2)==S.charAt(1) && S.charAt(0)!=S.charAt(2)) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		System.out.println("No");
	}
	
}

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

int main()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        if (i % 3 == 0) {
            cout << " " << i;
            continue;
        }
        int x = i;
        while (x) {
            if (x % 10 == 3) {
                cout << " " << i;
                break;
            }
            x /= 10;
        }
    }
    cout << endl;
}



Measured memory_bytes: 3092
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;


    void solve()
    {
        var s = cin.next.ToArray();
        s[3] = '8';
        WriteLine(new string(s));
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 13396
#include <stdio.h>

int main(void)
{
    int n, x;
    int i;

    scanf("%d %d", &n, &x);

    i = x - n + 1;

    while (1)
    {
        printf("%d", i);
        i++;
        if (i > x + n - 1)
        {
            break;
        }
        printf(" ");
    }

    printf("\n");

    return 0;
}


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

using namespace std;
using ll = long long;
#define int ll

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

const ll LLINF = (1LL<<60);

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }

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

  while(true) {
    int n;
    cin >> n;
    if(!n) break;
    string s, t;
    cin >> s >> t;

    int ans = LLINF;
    function<void(int,int,string)> dfs = [&](int idx, int cost, string str) {
      if(idx == n || str == t) { chmin(ans, cost); return; }
      // idx番目をstr[idx]->t[idx]にもっていくのにかかるコスト
      int diff = (t[idx]-str[idx]+10)%10;
      // [idx, i] を回転させる
      FOR(i, idx, str.size()) {
        str[i] = ((str[i]-'0') + diff)%10 + '0';
        dfs(idx+1, cost+(diff==0?0:1), str);
      }
    };

    dfs(0, 0, s);
    cout << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 3240
a, b = (int(i) for i in input().split())  
sum=a+b
dif=a-b
mul=a*b
 
 
if sum > dif:
    if mul>sum:
        print('{}'.format(mul))
    else:
        print('{}'.format(sum))
else:
    if mul>dif:
        print('{}'.format(mul))
    else:
        print('{}'.format(dif))
 


Measured memory_bytes: 2940
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
 
public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		int ans = gcd(a[0],a[1]);
		for(int i = 2; i < n; i++) {
			ans = gcd(ans,a[i]);
		}
		System.out.println(ans);
	 }
	 private static int gcd(int m, int n) {
		 if(m<n) return gcd(n,m);
		 if(n==0)return m;
		 return gcd(n,m%n);
	 }
}

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

int main() {
  long long n,m,k;
  cin >> n >> m >> k;
  vector<long long> a(n,0);
  vector<long long> b(m,0);
  vector<long long> suma(n,0);
  vector<long long> sumb(m,0);
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(i==0) suma[i]=a[i];
    else suma[i]=suma[i-1]+a[i];
  }
  for(int i=0;i<m;i++){
    cin >> b[i];
    if(i==0) sumb[i]=b[i];
    else sumb[i]=sumb[i-1]+b[i];
  }
  long long j=m-1,ans=0;
  long long l=sumb[m-1];
  for(int i=-1;i<n;i++){
    if(suma[i]>k) continue;
    if(i==-1){
      while(true){
        if(l<=k) break;
        l-=b[j];
        j--;
        if(j==-1) break;
      }
    }
    else{
      while(true){
        if(l<=k-suma[i]) break;
        l-=b[j];
        j--;
        if(j==-1) break;
      }
    }
    ans=max(ans,j+i+2);
  }
  cout << ans << endl;
}


Measured memory_bytes: 9540
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	int N,M;
	cin>>N>>M;
	vector<bool> a(N),b(N);
	rep(i,M){
		int x,y;
		cin>>x>>y;
		x--,y--;
		if(x>y) swap(x,y);
		if(x==0) a[y] = 1;
		if(y==N-1) b[x] = 1;
	}
	bool ok = 0;
	rep(i,N) if(a[i]&&b[i]) ok = 1;
	cout<<"IMPOSSIBLE"+ok*2<<endl;
}


Measured memory_bytes: 256
n = int(input())
graph = [list(map(int, input().split())) for i in range(n)]

v_color = ["WHITE"] * (n+1) # WHITE:????¨???????GRAY:?¨??????????BLACK:??¢?´¢??????
d = [0] * (n+1)
f = [0] * (n+1)
stack = []
time = 0
def DFS(u):
    global time
    stack.append(u)

    while stack != []:
        u = stack[-1]
        time += 1
        
        v_color[u] = "GRAY"
        if d[u] == 0:
            d[u] = time
        
        for Next in graph[u-1][2:]:
            if v_color[Next] == "WHITE":
                stack.append(Next)
                break
        
        else:
            v_color[u] = "BLACK"
            f[u] = time +1
            stack.pop()
        
for i in range(1,n+1):
    if v_color[i] == "WHITE":
        DFS(i)
        time += 1
    
for i in range(1,n+1):
    print(i,d[i],f[i])
    

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

int a[100];

int main(void){
    // Here your code !
    int n, k;
    scanf("%d %d", &n, &k);
    for (int i = 0; i < n; ++i) {
      scanf("%d", &a[i]);
    }

    sort(a, a+n);

    int ans = 0;
    for (int i = 0; i < k; ++i) ans += a[n-1-i];
    printf("%d", ans);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long dp[1500000];
 long long a[20];
bool b=true;
 long long gcd( long long  a, long long  b){
	if(b==0){
		return a;
	}else{
		return gcd(b,a%b);
	}
}




int main(){
	dp[0]={1};
	 long long n,p,s,c,u;
	cin>>n;
	 long long k=1 << n;
	//cout<<k<<endl;
	 long long ans=0;
	for( long long i=0;i<n;i++){
		cin>>a[i];
	}
	for( long long i=1;i<k;i++){
		for( long long j=n-1;j>=0;j--){
			//u=i >> j;
			//cout<<u<<" j"<<j<<endl;
			if(((i >> j) & 1)==1){
				p=j;
				s=i-(1 << j);
				//cout<<"p"<<p<<" s"<<s<<endl;
				break;
			}
			
		}
		//cout<<s<<endl;

		if(a[p]>dp[s]){
			c=gcd(a[p],dp[s]);
			dp[i]=(a[p]*dp[s])/c;
			for( long long j=n-1;j>=0;j--){
				if(((i >> j) & 1)!=1){
					if(dp[i]%a[j]==0){
						b=false;
					}
				}
			}
			//cout<<"a[p]"<<a[p]<<" dp[s] "<<dp[s]<<" c "<<c<<endl;
		}else{
			c=gcd(dp[s],a[p]);
			dp[i]=(a[p]*dp[s])/c;
			for( long long j=n-1;j>=0;j--){
				if(((i >> j) & 1)!=1){
					if(dp[i]%a[j]==0){
						b=false;
					}
				}
			}
		}
		if(b){
			ans++;
		}
		b=true;
		//cout<<"a[p]"<<a[p]<<" dp[s] "<<dp[s]<<" c "<<c<<endl;
		//cout<<"i"<<i<<" ans "<<ans<<endl;
	}
	cout<<ans<<endl;
}
	
				
				
			
	


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

int gc(int a, int b) {
  while(max(a, b) % min(a, b) != 0) {
    if (a >= b) {
      a = a % b;
    }
    else {
      b = b % a;
    }
  }
  return min(a, b);
}

int gcd(int a, int b, int c) {
  return gc(a, gc(b, c));
}

int main() {
  int K;
  cin >> K;
  long ans = 0;
  for (int i = 1; i <= K; i++) {
    for (int j = i; j <= K; j++) {
      for (int k = j; k <= K; k++) {
        if (i == j && j == k) {
          ans += i;
        }
        else if (i == j) {
          ans += 3 * gc(i, k);
        }
        else if (j == k) {
          ans += 3 * gc(i, k);
        }
        else if (k == i) {
          ans += 3 * gc(i, j);
        }
        else {
          ans += 6 * gcd(i, j, k);
        }
      }
    }
  }
  cout << ans;
}

Measured memory_bytes: 3632
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <string>
#include <cstring>
#include <math.h>
using namespace std;


int main() {
   int n;
 
   cin >> n;
  
   double a[n];
  
  double sum = 0;
  for(int i = 0;i<n;i++){
     
    cin >> a[i];
    
    sum = sum + 1/a[i];

   }
  
  
  cout << 1/sum << endl;
   
  return 0;
}

Measured memory_bytes: 3792
//   PIGMEISTER™   //

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define sidha(i,x,n) for(ll i=(ll)(x);i<(ll)(n);i++)
#define ulta(i,x,n) for(ll i=(ll)(x);i>=(ll)(n);i--)
#define mi map<ll,ll>
#define vi vector<ll>
#define si set<ll>
#define pi pair<ll,ll>
#define vp vector<pair<ll,ll>>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sab(a) a.begin(),a.end()
#define bas(a) a.rbegin(),a.rend()
#define modinv(x) powah(x,mod-2)
#define ncr(n,r) (((fact[n]*modinv(fact[n-r]))%mod*modinv(fact[r]))%mod)
#define factorial fact.pb(1);sidha(i,1,MAX)fact.pb((fact[i-1]*i)%mod)
#define test ll t;cin>>t;while(t--)
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
//#define mod (ll)1000000007
#define mod (ll)998244353
#define MAX 500005
ll powah(ll, ll);

int main()
{
    jaldi;

    ll n, m;
    cin >> n >> m;
    cout << (n*(n-1))/2 + (m*(m-1))/2 << endl;
    
    return 0;
}

ll powah(ll x, ll y) { 
    ll res = 1;
    x = x % mod;
    while (y > 0) { 
        if (y & 1) 
            res = (res*x) % mod; 
        y = y>>1;
        x = (x*x) % mod; 
    } 
    return res; 
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  bool SOSU[10001];
  int l=sqrt(10000);
  memset(SOSU,false,sizeof(SOSU));
  SOSU[0]=SOSU[1]=true;
  for(int i=2;i<=l;i++){
    if(SOSU[i]==false){
      for(int j=2;i*j<=10000;j++){
	SOSU[i*j]=true;
      }
    }
  }
  long long n,sum;
  while(cin >> n){
    sum=0;
    for(int i=1;i<=n;i++){
      if(SOSU[i]==false&&SOSU[n-i+1]==false){
	sum++;
      }
    }
    cout << sum << endl;
  }
}

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

using namespace std;
using ll = long long;
using ld = long double;

namespace NyaGadget
{	// DFSライブラリ

	struct DFSedge
	{
		ll vertex;	// 頂点
		DFSedge(ll v) { vertex = v; }
	};

	template <class TE = DFSedge> struct DFS
	{
		using Graph = vector<vector<TE>>;
		Graph graph;

		DFS(ll size) { graph.resize(size); }
		vector<TE>& operator [](int n) { return graph[n]; }

		/**
		@brief 辺を追加する関数
		@note
		 頂点v1とv2を結ぶ辺を追加する。
		**/
		void CreateEdge(ll v1, ll v2)
		{	// 後戻りも出来るようにv1→v2とv2→v1の両方の辺を追加する
			graph[v1].push_back(DFSedge(v2));
			graph[v2].push_back(DFSedge(v1));
		}
	};

}

#define all(collection) (collection).begin(), (collection).end()  // begin to end
#define ceil(a, b) ceil((ld) a / (ld) b);                         // div ceiling
#define each(e, collection) for(auto& e: collection)              // for each
#define rep(i, begin, end) for (ll i = begin; i < end; i++)       // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)      // repeat reverse
#define size(collection) ((ll) (collection).size())               // collection size

using namespace NyaGadget;

/**
@brief 深さ優先探索
@param r 根
@param v 頂点
@param dfs 処理するDFSグラフ
@param memo 前処理したメモ(加算するべきカウンタの値)
@param ans 出力する答えを格納する配列
@note
 DFSで全てのノードを処理する。
**/
void Solve(ll r, ll v, DFS<>& dfs, vector<ll>& memo, vector<ll>& ans)
{
	if (r != -1)
		ans[v] = ans[r] + memo[v];

	each(e, dfs[v])
	{	// 後戻りしないようにする
		if (e.vertex == r)
			continue;

		Solve(v, e.vertex, dfs, memo, ans);
	}
}

int main(void)
{
	ll n, q; cin >> n >> q;

	ll u, v;
	DFS<> dfs(n);
	rep(i, 0, n - 1)
	{
		cin >> u >> v;
		--u; --v;
		dfs.CreateEdge(u, v);
	}

	vector<ll> p(q), x(q);
	rep(i, 0, q)
	{
		cin >> p[i] >> x[i];
		p[i]--;
	}

	// 頂点xで加算するべきカウンタの値をメモしておく。
	vector<ll> memo(n);
	rep(i, 0, q)
		memo[p[i]] += x[i];

	vector<ll> ans(n);
	ans[0] = memo[0];
	Solve(-1, 0, dfs, memo, ans);

	each (e, ans)
		cout << e << " ";

	return 0;
}


Measured memory_bytes: 35200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    ll arr[n+2];
    ll sum=0;
    ll mod=1e9+7LL;
    ll res=0;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        sum +=arr[i];
    }
    for(int i=0;i<n;i++)
    {
        sum -= arr[i];
        ll tmp=((sum%mod)*(arr[i]%mod))%mod;
        res += tmp;
        res=res%mod;
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 5212
//
// Created by Hideaki Imamura on 2019-07-09.
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

    for (ll i = 0; i < k; ++i) {
        if (s[i] != '1') {
            cout << s[i] << endl;
            return 0;
        }
    }
    cout << '1' << endl;

    return 0;
}

Measured memory_bytes: 256
/**
 *     author: qodjf
 *     created: 04.21.2020 00:39:18
 */
#include <bits/stdc++.h>
using namespace std;

string to_string(string s) { return '"' + s + '"'; }

string to_string(const char *s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) 42
#endif

#define mst(x, a) memset(x, a, sizeof(x))

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9 + 7;

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

int main() {
  int N, K, C;
  cin >> N >> K >> C;
  string s;
  cin >> s;
  vector<int> dpleft(N + C + 10, 0), dpright(N + C + 10, 0);
  for (int i = 0; i < N; i++) {
    if (s[i] == 'x') {
      dpleft[i + C + 1] = dpleft[i + C];
    } else {
      dpleft[i + C + 1] = max(dpleft[i + C], 1 + dpleft[i]);
    }
  }
  for (int i = N - 1; i >= 0; i--) {
    if (s[i] == 'x') {
      dpright[i] = dpright[i + 1];
    } else {
      dpright[i] = max(dpright[i + 1], 1 + dpright[i + C + 1]);
    }
  }
  dbg(dpleft, dpright);

  vector<bool> ans(N, true);
  if (C == 0) {
    for (int i = 0; i < N; i++) {
      if (dpleft[i] + dpright[i + 1] >= K) {
        ans[i] = false;
      }
    }
  } else {
    int rightmost = 0;
    for (int rb = 1; rb <= N + C; rb++) {
      if (dpleft[rb] + dpright[rb] >= K) {
        for (int j = max(rb - C, rightmost); j < min(N, rb); j++) {
          ans[j] = false;
        }
        rightmost = rb;
      }
    }
  }

  for (int i = 0; i < N; i++) {
    if (s[i] == 'o' && ans[i]) {
      cout << i + 1 << endl;
    }
  }
}


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

int main() {
  int N, A;
  cin >> N >> A;
  int X;
  X = N % 500;
    if ( X <= A) {   
      cout << "Yes" << endl;
    }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3620
S = list(reversed(input().strip()))

MOD = int(pow(10, 9) + 7)

powers = [1 for i in range(len(S))]
for i in range(1, len(S)):
    powers[i] = (10 * powers[i - 1]) % 13

dp = [[0 for i in range(13)] for j in range(len(S))]

for i, char in enumerate(S):
    def compute(num):
        if i == 0:
            # Base case
            dp[0][num] += 1
        else:
            for o in range(13):
                dp[i][(o + num * powers[i]) % 13] += dp[i - 1][o]
                dp[i][(o + num * powers[i]) % 13] %= MOD
                
    if char == "?":
        for j in range(10):
            compute(j)
    else:
        compute(int(char))

print(dp[-1][5])


Measured memory_bytes: 72368
import sys

a,b,k=map(int,input().split())

if a<=k:
  k=k-a
  a=0
elif a>k:
  a=a-k
  print(a,b)
  sys.exit()
  
if b<=k:
  b=0
else:
  b=b-k
print(a,b)

Measured memory_bytes: 3060
#include<stdio.h>
int main(void){
  int n,i;
  int dept=100000;
  int x;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    dept *= 1.05;
    if(dept%1000!=0){
      dept = ((dept/1000)+1)*1000;
    }
  }
  printf("%d\n",dept);
  return(0);
}

Measured memory_bytes: 1848
#include <bits/stdc++.h>
using namespace std;
#define testing 1
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << endl
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<endl
#define dbv(v) cerr << #v << ":"; for (auto i : v) cerr << i << ' '; cerr << endl
#define dbvp(v) cerr << #v << ":"; for (auto i : v) cerr << "{"  << i.f << ',' << i.s << "} "; cerr << endl
#define dba(a,ss,ee) cerr << #a << ":"; FOR(i,ss,ee) cerr << a[i] << ' '; cerr << endl
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define inf (int)1e9
#define oo (ll)1e18
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "hi\n";
typedef pair <int, int> pi;
typedef pair <ll,ll> pl;
typedef pair <pi, int> pii;
typedef tuple<int,int,int> ti3;
string lts(ll x) {stringstream s; s << x; return s.str(); }
ll stl(string x) {stringstream s(x); ll temp; s >> temp; return temp; }
string cts(char x) {string s(1,x); return s;}
const int MOD = 1e9 + 7;
template <typename T> void maxself(T& a, T b) {
	a = max(a, b);
}
template <typename T> void minself(T& a, T b) {
	a = min(a, b);
}
#define MAXN 
#if !testing
	#define cerr if(0)cout
#endif

int32_t main() {
	IAMSPEED
	// set testing to 0 when submitting to judge
	int n; cin >> n;
	int ans = 0;
	string str; cin >> str;
	FOR(i,2,str.size()-1) {
		if (str[i] == 'C' && str[i-1] == 'B' && str[i-2] == 'A')++ans;
	}
	cout << ans;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#define max(x,y)(x>y?x:y)
#define min(x,y)(x>y?y:x)
#define MOD (int)1e9+7
int dx4[]={1,0,-1,0};
int dy4[]={0,-1,0,1};
typedef long long int ll;
typedef unsigned long long int ull;
ll gcd(ll x,ll y){if(!y)return x;return gcd(y,x%y);}
ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
void swap(ll *x,ll *y){ll tmp=*x;*x=*y;*y=tmp;}
int asc_cmp(const void* X,const void* Y){ll x=*(int*)X,y=*(int*)Y;if(x<y)return -1;else if(x==y)return 0;else return 1;}
int desc_cmp(const void* X,const void* Y){ll x=*(int*)X,y=*(int*)Y;if(x<y)return 1;else if(x==y)return 0;else return -1;}
typedef struct pair_{
    int x;
    int y;
}pair_t;

int main(){
    int n,m;scanf("%d %d",&n,&m);
    int a[200];
    for(int i=0;i<n;i++){
        a[i]=2;
    }
    for(int i=n;i<n+m;i++){
        a[i]=1;
    }
    int ans=0;
    for(int i=0;i<n+m-1;i++){
        for(int j=i+1;j<n+m;j++){
            if((a[i]+a[j])%2==0){
                ans++;
            }
        }
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define double long double
using namespace std;

const ll inf = 1000000000000000000;
typedef pair<ll, ll> para;
ll n, k, p[5005], c[5005], nmy, sum, np, tec, ans, tecans;
vector< vector<ll> > myvec;
bool used[5005];
void dfs(ll v, ll ind) {
    used[v] = true;
    myvec[ind].push_back(c[v]);
    if (!used[p[v]])
        dfs(p[v], ind);
}
ll window(ll sz, vector<ll> &top) {
    ll nt = (ll)top.size();
    if (sz == n) {
        ll sum = 0;
        for (ll i = 0; i < nt; ++i)
            sum += top[i];
        return sum;
    }
    ll mux = -inf;
    ll sum = 0, ind;
    for (ll i = 0; i < sz; ++i)
        sum += top[i];
    for (ll i = 0; i < nt; ++i) {
        mux = max(mux, sum);
        sum -= top[i];
        ind = i + sz;
        ind %= nt;
        sum += top[ind];
    }
    return mux;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for (ll i = 1; i <= n; ++i)
        cin >> p[i];
    for (ll i = 1; i <= n; ++i)
        cin >> c[i];
    for (ll i = 1; i <= n; ++i)
        if (!used[p[i]]) {
            myvec.push_back(vector<ll>());
            dfs(p[i], (ll)myvec.size() - 1);
        }
    ans = -inf;
    nmy = (ll)myvec.size();
    for (ll i = 0; i < nmy; ++i) {
        np = (ll)myvec[i].size();
        sum = window(np, myvec[i]);
        for (ll j = 1; j <= min(np, k); ++j) {
            tec = window(j, myvec[i]);
            tecans = 0;
            if (sum > 0) {
                if ((k % np) >= j)
                    tecans += (k / np) * sum;
                else
                    tecans += (k / np - 1) * sum;
            }
            //tecans += (k / np) * sum;
            //if (j < np)
            tecans += tec;
            //cout << tecans << endl;
            ans = max(ans, tecans);
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3844
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;

int main() {
	string s;
	cin >> s;
	bool flag;
	int a[500]={},w=0;
	for(int j=1;j < s.length()/2;j++){
		flag=true;
		for(int i=0;i < j;i++){
			if(s[i]!=s[i+j]){ flag=false; break; }
		}
		if(flag) a[w++]=j*2;
	}
	cout<<a[w-1]<<endl;
	return 0;
}

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


int main()
{
	string s;
	int a;
	cin >> s;
	a = 0;
	if (s[0] == '1')
	{
		a++;
	}
	if (s[1] == '1')
	{
		a++;
	}
	if (s[2] == '1')
	{
		a++;
	}
		cout << a << endl;

	
}


Measured memory_bytes: 256
using System;

namespace ConsoleApp18
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            string[] array = line.Split(' ');
            
            int a = int.Parse(array[0]);
            int b = int.Parse(array[1]);

            if (a >= 13)
            {
                Console.WriteLine(b);
            }else if(a>=6 && a <= 12)
            {
                Console.WriteLine(b / 2);
            }
            else
            {
                Console.WriteLine(0);
            }
        }
    }
}

Measured memory_bytes: 27344
n, x = map(int, input().split())

pate, slice = [1], [1]
for _ in range(n + 1):
    pate.append(2 * pate[-1] + 1)
    slice.append(2 * slice[-1] + 3)

ans = 0
while n > 0 and x > 0:
    if x >= slice[n - 1] + 2:
        ans += pate[n - 1] + 1
        x -= slice[n - 1] + 2
    elif x < slice[n - 1] + 2:
        x -= 1
    n -= 1
print(ans + (x > 0))


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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 998244353;




int main() {

	ll n;
	cin >> n;
	VLL a(n + 1);
	REP(i, n + 1)cin >> a[i];
	VLL b(n + 1, INFL);
	if (n == 0) {
		if (a[0] == 1)cout << 1 << endl;
		else cout << -1 << endl;
		return 0;
	}
	if (n != 0 && a[0] != 0) {
		cout << -1 << endl;
		return 0;
	}
	
	b[0] = 1;
	FOR(i, 1, n + 1) {
		b[i] = b[i - 1] * 2 - a[i];
		if (b[i] > 1e15) {
			b[i] = INFL;
			continue;
		}
		else if (b[i] < 0) {
			cout << -1 << endl;
			return 0;
		}
	}
	reverse(ALL(a));
	reverse(ALL(b));
	ll ans = 0;
	ll cur = 0;

	REP(i, n + 1) {
		cur = min(cur, b[i]);
		cur += a[i];
		ans += cur;
	}
	cout << ans << endl;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
    a[i] /=400;
  }
  
  sort(a.begin(),a.end());
  int count =1;
  int pro=0;
  rep2(i,1,n){
    if(a[i]!=a[i-1]&&a[i]<8){
      count++;
    }
    else if(a[i]>7){
      pro++;
    }
  }
  
  cout << count << " " << count+pro << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

main(){
    int n,m,X,Y,xMax=-100,yMin=100;
    scanf("%d%d%d%d",&n,&m,&X,&Y);
    int x[n],y[m];
    for (int i = 0; i < n; ++i) {
        scanf("%d",&x[i]);
        if(xMax<x[i])xMax=x[i];
    }
    for (int i = 0; i < m; ++i)  {
        scanf("%d",&y[i]);
        if(yMin>y[i])yMin=y[i];
    }

    if(xMax>=yMin || xMax==Y){
        printf("War");
        return 0;
    }
    for (int i = xMax; i <= yMin; ++i) {
        if(X<i && i<=Y){
            printf("No War");
            return 0;
        }
    }
    printf("War");
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        String s = stdIn.next();
        String ss = s.toUpperCase();
        //boolean flag = true;
        
        if(s.equals(ss)){
            System.out.println("A");
        }else{
            System.out.println("a");
        }
    }
}


Measured memory_bytes: 35680