akhauriyash/Code-Regression huggingface dataset:
use std::io::{ stdin, stdout, BufRead, Write };
use std::ops::{ Add, Sub, Mul };

const SP : u8 = b' ';
const LF : u8 = b'\n';

#[inline(always)]
fn atoui<T>(s: &[u8]) -> T
  where T: Add<Output=T> +
           Sub<Output=T> +
           Mul<Output=T> +
           Default +
           From<u8>
{
  let mut n = T::default();
  if s.len() == 0 {
    return n;
  }

  let mut i = 0;
  if s[i] == b'+' {
    i += 1;
  }

  for b in &s[i..] {
    n = (n * T::from(10)) + T::from(b - b'0');
  }

  n
}

fn main() {
  let stdin  = stdin();
  let mut stdin  = stdin.lock();

  let mut buf = Vec::with_capacity(500 * 2);
  let len = stdin.read_until(SP, &mut buf).unwrap();
  buf.truncate(len - 1);
  let h = atoui::<usize>(&buf);

  buf.clear();
  let len = stdin.read_until(LF, &mut buf).unwrap();
  buf.truncate(len - 1);
  let w = atoui::<usize>(&buf);

  let mut ans = Vec::with_capacity(h * w - 1);
  let mut n   = 0;

  let mut odd = 0;
  let mut x   = 0;
  let mut y   = 0;

  for i in 0..h {
    buf.clear();
    stdin.read_until(LF, &mut buf).unwrap();

    if i % 2 == 0 {
      for j in 0..w {
        if odd != 0 {
          writeln!(&mut ans, "{} {} {} {}", y + 1, x + 1, i + 1, j + 1).unwrap();
          n += 1;
        }
        odd ^= buf[j * 2] & 1;
        y = i;
        x = j;
      }
    } else {
      for mut j in 0..w {
        j = w - 1 - j;

        if odd != 0 {
          writeln!(&mut ans, "{} {} {} {}", y + 1, x + 1, i + 1, j + 1).unwrap();
          n += 1;
        }
        odd ^= buf[j * 2] & 1;
        y = i;
        x = j;
      }
    }
  }

  let stdout = stdout();
  let mut stdout = stdout.lock();
  writeln!(&mut stdout, "{}", n).unwrap();
  stdout.write(&ans).unwrap();
  stdout.flush().unwrap();
}


Measured memory_bytes: 8188
#include <bits/stdc++.h>
     
    using namespace std;
     
    int main() {
      int numbers_4;
     cin>>numbers_4;

     int d=numbers_4/1000;
     int c=(numbers_4%1000)/100;
     int b=(numbers_4%100)/10;
     int a=numbers_4%10;

     if((a==b && b==c) || (b==c && c==d))
                 cout <<"Yes";
      else 
       			 cout << "No";
      
    }

Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());

        var c = new int[n - 1];
        var s = new int[n - 1];
        var f = new int[n - 1];

        for (int i = 0; i < n - 1; i++)
        {
            var csf = Console.ReadLine().Split(' ');
            c[i] = int.Parse(csf[0]);
            s[i] = int.Parse(csf[1]);
            f[i] = int.Parse(csf[2]);
        }

        for (int i = 0; i < n; i++)
        {
            var x = 0;
            for (int j = i; j < n - 1; j++)
            {
                x = Math.Max(ceil(x, f[j]), s[j]) + c[j];
            }
            Console.WriteLine(x);
        }
    }

    static int ceil(int x, int y)
    {
        if (0 < x % y)
        {
            return (x / y + 1) * y;
        }
        else
        {
            return x;
        }
    }
}


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

using namespace std;

bool isSeki(int m, int d){
    int d10 = d / 10;
    int d1 = d % 10;
    
    if (d1 < 2) return false;
    if (d10 < 2) return false;
    
    if (d1 * d10 == m) return true;
    else return false;
}

int main(void){
    int m, d;
    cin >> m >> d;
    
    int ans = 0;
    
    for (int i = 1; i <= m; i++){
        for (int j = 1; j <= d; j++){
            if (isSeki(i,j)) ans++;
        }
    }
    cout << ans << endl;
}


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

#define LINE_BUF_SIZE 1024

int main(){

    long long int A,B,K;
    long long int i,j;
    char line[LINE_BUF_SIZE];

    fgets(line,sizeof(line),stdin);
    sscanf(line,"%lld %lld %lld", &A,&B,&K);

    for(i=A;i<A+K;i++){
        printf("%lld\n",i);
        j = i;
        if(i == B) return 0;
    }

    if(((B-A) / 2) >= K){  /*Kの範囲が重ならない*/
    for(i=B-K+1;i<=B;i++){
        printf("%lld\n",i);
    }
    }

    else{
    for(i=j+1;i<=B;i++){
        printf("%lld\n",i);
        if(i == B) return 0;
    }
    }

    return 0;

}

Measured memory_bytes: 128
#include <algorithm>
#include <cstdio>
#include <cstring>

const int N = 305;

char s[N][N];
int n;

bool check(int A) {
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      if (s[(i + A) % n][j] != s[(j + A) % n][i])
        return false;
  return true;
}

int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
    scanf("%s", s[i]);
  int ans = 0;
  for (int i = 0; i < n; ++i)
    if (check(i)) ans += n;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
# encoding:utf-8

import copy
import numpy as np
import random

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

h = []
for i in range(n):
    h.append(int(input()))

h.sort()
# print(h)
max_tree = []
min_tree = []
ans = 10**9
for i in range(n-k+1):
    ans = min(h[i+k-1]-h[i],ans)

print(ans)


Measured memory_bytes: 24196
#include <algorithm>
#include <map>
#include <iostream>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iterator>
#include <array>
#include <iomanip>
typedef long long int ll;
using namespace std;
#define maxN 200005
#define mod 1000000007
#define pi 3.14159265358979323846264338327950

void solve()
{
    string a, b;
    cin >> a >> b;
    for (int i = 0; i < a.length(); i++)
    {
        if (a[i] != b[i])
        {
            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";
}

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

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<class T> void re(T& x) { cin >> x; }
template<typename T> 
void remdup(vector<T>& v) {												
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "/home/o_o/MyCodes/pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  

void solve(){
	int n; re(n) ;
	vi v(n) ;re(v);
	remdup(v);
	if(sz(v) == n ) cout << "YES\n";
	else cout << "NO\n";
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 4788
//Program.cpp
//Author : Aaryan Srivastava 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#define pb push_back
#define popb pop_back
#define ull unsigned long long  
#define beg begin
#define mp make_pair
#define pii pair<int, int>
#define piii pair<pii,int>
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define ff first
#define ss second 
#define fill(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
using ll = long long;
#define int ll
const int N = 1e5 + 5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace std;
#ifdef AaryanS
#define mycout cout
#define mycerr cerr 
#endif

#ifndef AaryanS
#define mycout if(false) cout
#define mycerr if(false) cerr
#define AaryanS 0 
#endif

template <typename T> void max_self(T &a, T b) {a = max(a,b) ;}
#define debug(x) mycerr << #x << " "  << x << endl ;

void solve()
{
	
	int n,m ;
	cin >> n >> m ;
	string s[n+1] ;
	repA(i,0,n-1){
		cin >> s[i] ;
	}
	vector<vector<int>> dp(n+1,vector<int>(m+1,0)) ;
	dp[1][1] = 1 ;
	repA(i,2,n)
		dp[i][1] = (s[i-1][1-1] == '.' && dp[i-1][1] != 0) ;
	repA(i,2,m)
		dp[1][i] = (s[1-1][i-1] == '.' && dp[1][i-1] != 0 ) ;
	
	repA(i,2,n){
		repA(j,2,m){
			if(i <= 1 || j <= 1){
				mycout << dp[i][j] << " " ; 
				continue ;
			}
			if(s[i-1][j-1] == '.')
				dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod ;
			else
				dp[i][j] = 0LL ;
			mycout << dp[i][j] << " " ; 
		}
		cout << endl ;
	}	
	cout << dp[n][m] ;
}   

     
int32_t main(int32_t argc, char *argv[])
{
    double t1 = clock() ;
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, tt = 0;
   // cin >> TC ;
    while(tt++ < TC)
    {
        //cout << "Case " << t << ":\n" ;
        solve();
    }
    mycerr << "Time : " << 1000 *(clock() - t1)/CLOCKS_PER_SEC << " ms\n" ;
    return 0;
}

Measured memory_bytes: 9216
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define print(x) cout<<(x)<<endl
#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007


int N, M;
int k[20];
int s[20][20];
int p[20];
int onoff[20];

int bits;

void make_bits() {
	int bt = 1;
	for (int i = 0; i < N; i++) {
		bt *= 2;
	}
	bits = bt;
	return;
}

int main(){
	cin >> N>>M;
	for (int i = 0; i < M; i++) {
		int iptk;
		cin >> iptk; k[i] = iptk;
		for (int j = 0; j < iptk; j++) {
			int ipts;
			cin >> ipts; s[i][j] = ipts;
		}
	}
	for (int i = 0; i < M; i++) {
		int iptp; cin >> iptp; p[i] = iptp;
	}
	make_bits();

	int score = 0;
	bool flag = false;
	for (int i = 0; i < bits; i++) {
		flag = true;
		// gen onoff
		for (int j = 0; j < N; j++) {
			if ((i >> j) & 1)onoff[j] = 1;
			else onoff[j] = 0;
		}
		// count
		for (int t = 0; t < M; t++) {
			// on kt
			int sum = 0;
			for (int l = 0; l < k[t]; l++) {
				sum += onoff[s[t][l]-1];
			}
			if (sum % 2 != p[t]) {
				flag = false;
				break;
			}
		}
		if (flag)score++;
	}
	print(score);







	return 0;
}

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

int n, N[100][100];
int d[100];

void bfs(int s) {
    queue<int> q;
    q.push(s);
    for (int i = 0; i < n; i++) d[i] = (1 << 21);
    d[s] = 0;
    int u;
    while(!q.empty()) {
        u = q.front();
        q.pop();
        for (int v = 0; v < n; v++) {
            if (N[u][v] == 0) continue;
            if (d[v] != (1 << 21)) continue;
            d[v] = d[u] + 1;
            q.push(v);
        }
    }
    for (int i = 0; i < n; i++) {
        cout << i + 1 << " " << ( (d[i] == (1 << 21)) ? (-1) : d[i]) << endl;
    }
}

int main() {
    int u, k, v;
    
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0 ; j < n; j++) {
            N[i][j] = 0;
        }
    }
    
    for (int i = 0; i < n; i++) {
        cin >> u >> k;
        if (k != 0) {
            for (int j = 0; j < k; j++) {
                cin >> v;
                N[u-1][v-1] = 1;
            }
        }
    }
    bfs(0);
    
    return 0;
}


Measured memory_bytes: 3132
def LI(): return map(int,input().split())
def I() :return int(input())

h,w,k=LI()
lst=[]
cnt=0
for i in range(h):
    lst+=[list(input())]
    for j in range(w):
        if lst[i][j]=="#":
            cnt+=1
black=0
ans=0
for rows in range(1<<h):
    for cols in range(1<<w):
        black=0
        for i in range(h):
            if (rows>>i)&1:continue
            for j in range(w):
                if (cols>>j)&1:continue
                elif lst[i][j]=="#":
                    black +=1
                    # print(i,j)

        if black ==k:
            ans+=1
print(ans)

Measured memory_bytes: 9224
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;

int arr[n];
for(int i=0;i<n;i++)
    cin>>arr[i];

    sort(arr,arr+n);


    //if(n==k)
       // cout<<arr[0];

	int res = 0;
	for (int i=0; i<k; i++)
        res += arr[i];


	cout<<res<<endl;;

return 0;

}


Measured memory_bytes: 3612
// ABC073_B
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define REPN(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0LL)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)

typedef long long ll;

const ll MOD7 = 1000000007;  // 1 000 000 007
const ll MOD9 = 1000000009;  // 1 000 000 009

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

    // input
    ll N, l, r, res = 0;
    cin >> N;
    REP(i, N) {
        cin >> l >> r;
        res += r - l + 1;
    }
    
    cout << res << "\n";
    
    
    return 0;
}


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

using namespace std;

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

const int N = 2010;
int minn[N];
int a[N];

int main () {
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
	freopen((problemname + ".in").c_str(), "r", stdin);
//	freopen((problemname + ".out").c_str(), "w", stdout);
#endif
	int n, x;
	cin >> n >> x;
	forn(i, n) {
		cin >> a[i];	
	}
	ll ans = 0;
	forn(i, n) {
		minn[i] = a[i];
		ans += a[i];
	}	
	for (int kol = 1; kol < n; ++kol) {
		ll res = 0;
		forn(j, n) {
			umn(minn[j], a[(j - kol + n) % n]);
			res += minn[j];
		}
		umn(ans, res + 1ll * kol * x);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
public:
    static const int MAXN=1e5+10;
    int N,M;
    vector<pair<ll,ll> >task;
    priority_queue<ll>pq;
    void solve(){
        ios::sync_with_stdio(false);
        cin.tie(0);
        cin>>N>>M;
        for(int u=0;u<N;u++){
            ll a,b;
            cin>>a>>b;
            task.push_back({a,b});
        }
        sort(task.begin(),task.end());
        ll sum=0;
        int head=0;
        for(int t=1;t<=M;t++){
            for(int u=head;u<N;u++){
                if(task[u].first==t){
                    pq.push(task[u].second);
                    head++;
                }
                else break;
            }
            if(!pq.empty()){
                sum+=pq.top();
                pq.pop();
            }
        }
        cout<<sum;
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}

Measured memory_bytes: 3696
#include <stdio.h>

int r,g,b,n;

int main()
{
	long long ans = 0;
	scanf("%d %d %d %d", &r, &g, &b, &n);

	for (int i = 0;i <= n; i += r)
	{
		for (int j = 0; j + i <= n; j += g)
		{
			int temp = n - i - j;
			if (temp % b == 0)
				ans++;
		}
	}

	printf("%lld", ans);

	return 0;
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1e9+7;

signed main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(auto& x : a)
        cin >> x;
    vector<int> dp(k + 1, -1);
    for(int i = 0; i < a[0]; ++i){
        // lose
        dp[i] = 0;
    }
    for(int i = a[0]; i <= k; ++i){
        dp[i] = 0;
        for(auto& x : a)
            if(i - x >= 0 && dp[i - x] == 0)
                dp[i] = 1;
    }
    cout << (dp[k] ? "First" : "Second") << endl;
}


Measured memory_bytes: 640
sum = 0
amari_min = 10
for i in range(5):
    tmp = int(input())
    amari = tmp % 10
    if amari == 0:
        a = tmp / 10
    else:
        a = int(tmp / 10) + 1
    sum += a
    if amari != 0:
        if amari_min > amari:
            amari_min = amari

sum *= 10
print(int(sum - 10 + amari_min))


Measured memory_bytes: 2940
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define BigInt      __int128
#define endl        '\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define sim         template < class c
#define ris         return * this
#define dor         > debug & operator <<
#define eni(x)      sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {

using namespace std;

sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug 
{
	~debug() 
	{ 
		cerr<<endl; 
	}
	eni(!=) cerr << boolalpha << i; ris; }
	eni(==) ris << range(begin(i), end(i)); }
	sim, class b dor(pair < b, c > d) 
	{
		ris << "(" << d.first << ", " << d.second << ")";
	}
	sim dor(rge<c> d) 
	{
	  	*this << "[";
	  	for (auto it = d.b; it != d.e; ++it)
	    	*this << ", " + 2 * (it == d.b) << *it;
	  	ris << "]";
	}
};
#define fuck(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int n, m, k;
		cin >> n >> m >> k;
		vi a(n), b(m);
		ll int maxi = 0;
		for(ll int i = 0; i < n; i++)
		{
			cin >> a[i];
			if(i > 0) a[i] += a[i - 1];
			if(a[i] <= k) maxi = max(maxi, i + 1);
		}
		for(ll int i = 0; i < m; i++)
		{
			cin >> b[i];
			if(i > 0) b[i] += b[i - 1];
			if(b[i] <= k) maxi = max(maxi, i + 1);
		}
		for(ll int i = 0; i < n; i++)
		{
			ll int left = k - a[i];
			if(left >= b[m - 1])
			{
				maxi = max(maxi, 1 + i + m);
				continue;
			}
			if(left >= 0)
			{
				ll int idx = upper_bound(all(b), left) - b.begin();
				maxi = max(maxi, 1 + i + idx);
			}
		}
		cout << maxi << endl;
	}
	return 0;
}

Measured memory_bytes: 6340
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
	static void Main(string[] args)
	{			
		//文字列を読み込む
		long H = long.Parse(Console.ReadLine());
		
		int counter = 0;
		
		while(H/2 != 0){
				H /= 2;
				counter += 1;
		}
		
		long answer = 1;
		
		for(int i=0; i<counter+1; i++){
				answer *= 2;
		}
		
		answer --;
		
		Console.WriteLine(answer);
		}
	}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	queue<ll> q;
	
	for (int i = 1; i < 10; ++i)
		q.push(i);
	
	long k; std::cin >> k;
	ll x;
	while (k--) {
		x = q.front();
		q.pop();
		if (x % 10 != 0)
			q.emplace(10 * x + x % 10 - 1);
		
		q.emplace(10 * x + x % 10);
		
		if (x % 10 != 9)
			q.emplace(10 * x + x % 10 + 1);
	}
	
	std::cout << x;
}

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

int main() {
    int n, p;
    cin >> n;
    int cnt = 0;
    for (int i = 0;i < n;i++) {
        cin >> p;
        if (p != i+1) cnt++;
    }

    if (cnt == 0 || cnt == 2) cout << "YES" << endl;
    else cout << "NO" << endl;
}



Measured memory_bytes: 256
import sys

N,M=map(int,input().split())
LRD=[list(map(int,input().split())) for i in range(M)]

#UnionFind

Group=[(i,0) for i in range(N+1)]#グループ分け.Group[i]=jのときiとjは同じグループ
 
def find(x):#x→(x,d):xよりd右にある、と帰る.
    ANS=0
    while Group[x][0] != x:
        ANS+=Group[x][1]
        x=Group[x][0]
        
    return (x,ANS)

def Union(x,y,d):#xとyが同じグループになるよう更新
    if x>y:
        x,y,d=y,x,-d
    if find(x)[0]!=find(y)[0]:
        reach=min(find(x)[0],find(y)[0])

        if find(x)[0]!=reach:
            #if find(y)[1]-d-find(x)[1]<0:
            #    print("w",find(y)[1]-d-find(x)[1])
            #    return False
            
            Group[find(x)[0]]=(reach,find(y)[1]-d-find(x)[1])


        else:
            #if find(x)[1]+d-find(y)[1]<0:
            #    print("q",find(y)[1]-d-find(x)[1])
            #    return False
            
            Group[find(y)[0]]=(reach,find(x)[1]+d-find(y)[1])



    else:
        if find(x)[1]+d != find(y)[1]:
            #print(x,y,find(x),find(y),d)
            return False

    Group[y]=(x,d)
    return True

for l,r,d in LRD:
    #print(Group)
    if Union(l,r,d)==False:
        print("No")
        sys.exit()

print("Yes")


Measured memory_bytes: 63212
import java.util.Arrays;
import java.util.Scanner;
 
class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		char[] ss = s.toCharArray();
		char[] ts = t.toCharArray();
		Arrays.sort(ss);
		Arrays.sort(ts);
		char[] rts = new char[ts.length];
		for(int i = 0;i < ts.length;i++){
			rts[i] = ts[ts.length-1-i];
		}
		String ns = new String(ss);
		String nt = new String(rts);
		if(ns.compareTo(nt)<0){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};
 
typedef struct node * NodePointer;
 
NodePointer nil;
 
NodePointer listSearch(int key){
  NodePointer x;
  for(x = nil->next;x!=nil;x=x->next){
  if(x->key==key)return x;
  }
  return NULL;
}
 
void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}
 
void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}
 
void deleteNode(NodePointer t){
 
 
  t->next->prev=t->prev;
  t->prev->next=t->next;
 
  free(t);
}
 
void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}
 
void deleteLast(){
  NodePointer t = nil->prev;
  if (t==nil)return;
  deleteNode(t);
}
 
void delete(int key){
  NodePointer t=listSearch(key);
  if(t==NULL)return;
  deleteNode(t);
}
 
 
void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
 
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
 
 
}
 
int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
    if ( com[6] == 'F' ) deleteFirst();
    else if ( com[6] == 'L' ) deleteLast();
      } else {
    delete(key); nd++;
      }
      size--;
    }
  }
 
  printList();
  return 0;
}

Measured memory_bytes: 31784
#pragma GCC optimize(2)
#include<bits/stdc++.h>
typedef long long ll;
const int maxn=1e6+5;
const ll mod=1000000007;
using namespace std;
ll n,m;
ll num[maxn];
ll pos[maxn];//记录num[i] 出现的次数
ll dp[maxn];
int main()
{
    scanf("%lld",&n);
    for(int i=1;i<=n;i++)
        scanf("%lld",&num[i]);
    ll ans=1;
    ll zero=3;
    for(int i=1;i<=n;i++)
    {
        if(num[i]==0)
        {
            ans*=zero;
            zero--;
        }
        else
            ans=(ans%mod*(pos[num[i]-1]-pos[num[i]])%mod)%mod;
        pos[num[i]]++;
    }
    printf("%lld\n",ans%mod);
    return 0;
}

/**

**/



Measured memory_bytes: 8448
#include <iostream>
#include <cstdio>
#include <map>

using namespace std;

typedef long long ll;

ll n;
ll a[200005];
map<pair<ll, ll>, ll> ma;

ll f(ll p, ll q)
{
    if(p <= 0 && q == 0) return 0;
    if(q == 0) return 0;
    if(p <= 0) return -4e18;
    ll t = (p + 1) / 2;
    if(q > t) return -4e18;
    if(ma[{p, q}]) return ma[{p, q}];
    ll re = -4e18;
    re = max(re, f(p - 2, q - 1));
    re = max(re, f(p - 3, q - 1));
    re = max(re, f(p - 4, q - 1));
    re += a[p];
    re = max(re, f(p - 1, q));
    return ma[{p, q}] = re;
}

int main()
{
    scanf("%lld", &n);
    for(ll i = 1; i <= n; i++)
    {
        scanf("%lld", &a[i]);
    }
    cout<<f(n, n / 2)<<endl;
    return 0;
}


Measured memory_bytes: 34868
import java.util.Scanner;

public class Main
{ //202 is the modular multiplicative inverse of 2019.
	static int mod(int x)
	{
		int an = x%2019;
		while(an<0)an+=2019;
		return an;
	}

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		
		int n = s.length();
		int[] a = new int[n];
		
		for(int i = 0; i < n; i++)
		{
			a[i] = s.charAt(i) - '0';
		}
		
		long[] avail = new long[2019];
		
		int backtransmul = 1;
		int backtransadd = 0;
		long score = 0;
		int curval = 0;
		for(int i = 0; i < n; i++)
		{
			curval = mod(curval*10 + a[i]);
			int cura = mod((0 * backtransmul) - backtransadd);
			avail[cura]++;
			
			backtransmul = mod(backtransmul*202);
			backtransadd = mod(backtransadd + backtransmul*a[i]);
			
			int curc = mod((0 * backtransmul) - backtransadd);
			score += avail[curc];
		}
		
		System.out.println(score);
	}

}


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

const ll p = 1e9+7;
const ll c = 2005;
const int MAXN = 2e5+5;

ll n, dp[4100][4100];
ll a[MAXN], b[MAXN], ans;
ll fact[8100], invfact[8100];

ll exp(ll x, ll k) {
    if (k == 0)
        return 1;
    if (k%2 == 1)
        return x*exp(x, k-1)%p;
    ll y = exp(x, k/2);
    return y*y%p;
}

ll inv(ll x) { return exp(x, p-2); }

void init() {
    fact[0] = invfact[0] = 1;
    for (int i = 1; i < 8100; ++i) {
        fact[i] = i*fact[i-1]%p;
        invfact[i] = inv(fact[i]);
    }
}

ll comb(ll x, ll y) {
    if (x < y || x < 0 || y < 0)
        return 0;
    return fact[x]*invfact[y]%p*invfact[x-y]%p;
}

int main() {
    init();
    cin >> n;

    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
        dp[-a[i]+c][-b[i]+c]++;
    }
    
    for (int i = 1; i < 4100; ++i)
        for (int j = 1; j < 4100; ++j)
            dp[i][j] = (1LL*dp[i][j] + dp[i-1][j] + dp[i][j-1])%p;

    ll ans = 0;

    for (int i = 0; i < n; ++i) {
        ans = (ans + dp[a[i]+c][b[i]+c])%p;
    }

    for (int i = 0; i < n; ++i)
        ans = (ans + p - comb(2*a[i]+2*b[i], 2*a[i]))%p;

    cout << ans*(p+1)/2%p << endl;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll X[10][10];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll ans = 0;
    memset(X, 0, sizeof(X));
    REP(i, N) {
        ll A = i + 1;
        ll s = A % 10;
        ll p = A % 10;
        while (A > 0) {
            p = A % 10;
            A /= 10;
        }
        X[p][s]++;
    }
    REP(i, N) {
        ll A = i + 1;
        ll s = A % 10;
        ll p = A % 10;
        while (A > 0) {
            p = A % 10;
            A /= 10;
        }
        ans += X[s][p];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val (N, K) = readInputLine().split(" ").map { it.toLong() }
    val AArr = readInputLine().split(" ").map { it.toLong() }

    val minus = mutableListOf<Long>()
    val zero = mutableListOf<Long>()
    val plus = mutableListOf<Long>()

    for (A in AArr) {
        when {
            A == 0L -> zero.add(A)
            A < 0L -> minus.add(A)
            else -> plus.add(A)
        }
    }

    val minusNum = minus.size.toLong() * plus.size.toLong()
    val zeroNum = minus.size.toLong() * zero.size.toLong() + plus.size.toLong() * zero.size.toLong() + zero.size.toLong() * (zero.size.toLong() - 1L) / 2L

    when {
        K <= minusNum -> {
            var l = (-1e18).toLong() - 1L
            var r = -1L

            minus.sort()

            while (r - l > 1L) {
                val mid = (l + r) / 2L
                var cnt = 0L
                plus.forEach { cnt += (upperBound(minus, (mid - it + 1L) / it)).toLong() }

                if (cnt >= K) {
                    r = mid
                } else {
                    l = mid
                }
            }

            println(r)
            return
        }
        K <= zeroNum -> {
            println(0)
        }
        else -> {
            val K = K - minusNum - zeroNum
            val minus = minus.map { it * -1L }.toMutableList()

            minus.sort()
            plus.sort()

            var l = -1L
            var r = 1e18.toLong()

            while (r - l > 1L) {
                val mid = (l + r) / 2L

                var cnt = plus.foldIndexed(0L, {
                    index: Int, acc: Long, l: Long ->
                    val tmp = upperBound(plus, mid / l).toLong()
                    acc + tmp + if (index < tmp) -1L else 0L
                })

                cnt += minus.foldIndexed(0L, {
                    index: Int, acc: Long, l: Long ->
                    val tmp = upperBound(minus, mid / l).toLong()
                    acc + tmp + if (index < tmp) -1L else 0L
                })

                if (cnt / 2L >= K) {
                    r = mid
                } else {
                    l = mid
                }
            }

            println(r)
        }
    }
}

fun readInputLine(): String {
    return readLine()!!
}

fun <T: Comparable<T>> upperBound(list: List<T>, value: T): Int {
    return Collections.binarySearch(list, value, { x, y -> if (x > y) 1 else -1}).inv()
}


Measured memory_bytes: 135708
k = int(input())
sunuke_list = [1,2,3,4,5,6,7,8]
def s(n):
    n_charlist = list(str(n))
    return sum(list(map(int, n_charlist)))
def combine_int(i,n):
    i_charlist = list(str(i))
    n_charlist = ['9'] * n
    ret_charlist = i_charlist + n_charlist
    ret_str = ''.join(ret_charlist)
    return int(ret_str)
for n in range(1,14):
    if n >= 12:
        i = n-2
    else:
        i = n-1
    while((i+1)/(s(i)+9*n) <= (i+2)/(s(i+1)+9*n)):
        sunuke_list.append(combine_int(i,n))
        i += 1
for i in range(k):
    print(sunuke_list[i])


Measured memory_bytes: 3188
n = int(input())
p = map(int, input().split())

cnt = 0
#print(n)
p = list(p)
for i in range(1,n-1):
    a = p[i-1]
    b = p[i]
    c = p[i+1]
    ans = [a, b, c]
    #print(ans)
    ans.pop(ans.index(min(ans)))
    if b == min(ans):
        cnt+=1

print(cnt)

    

Measured memory_bytes: 38256
#include <stdio.h>
#define H 500001
void maxHeapify(int);
void buildMaxHeap(void);
int left(int);
int right(int);
int key[H];
int i,n;
int main(){
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&key[i]);
}
  buildMaxHeap();
 for(i=1;i<=n;i++){
    printf(" %d",key[i]);
 }
 printf("\n");
 return 0;
}
  void maxHeapify(int i){
    int L,R,temp;
    int largest=0;
    L=left(i);
    R=right(i);
    if(L<=n && key[L]>key[i]) largest=L;
    else largest=i;
    if(R<=n && key[R]>key[largest]) largest=R;
       if(largest!=i){
	 temp=key[i];
	 key[i]=key[largest];
	 key[largest]=temp;
      	 maxHeapify(largest);
       }
  }
void buildMaxHeap(void){
  for(i=n/2;i>=1;i--){
    maxHeapify(i);
  }
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}

Measured memory_bytes: 2552
#include <stdio.h>
#include <string.h>

int main(){
  char s[105];  scanf("%s", s);
  int len = strlen(s);
  char key[] = "keyence";
  
  int ans = (strcmp(s, "keyence")==0 ? 1 : 0);

  for(int i=0; i<=len; i++)
    for(int j=i; j<=len; j++){
      char t[105];
      int tlen = 0;
      for(int l=0; l<len; l++){
	if(l>=i && l<j)  continue;
	t[tlen++] = s[l];
      }
      
      int flag = (tlen==7 ? 1 : 0);
      for(int k=0; k<tlen; k++)
	if(t[k] != key[k])  flag = 0;
      if(flag){
	ans = 1;
	break;
      }
    }
  
  printf("%s\n", (ans ? "YES" : "NO"));

  return 0;
}


Measured memory_bytes: 1660
#include <iostream>
#include <map>
#include <vector>
 
using namespace std;
 
int main( void )
{
  /* ボール数入力 */
  long n;
  cin >> n;
  
  /* ボールの番号と番号の数を入力 */
  map<long, long> mpNum;
  vector<long>    v(n);
  for ( int i = 0; i < n; i++ ) {
    cin >> v[i];
    mpNum[v[i]]++;
  }
  
  /* コンビネーション計算 */
  long	combi = 0;
  for ( auto itr = mpNum.begin(); itr != mpNum.end(); itr++ ) {
    combi += ((itr->second * (itr->second - 1)) >> 1);
  }

  /* 方法の数計算 */
  for ( int i = 0; i < n; i++ ) {
    cout << (combi - mpNum[v[i]] + 1) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 11008
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int ans=0,n;
int main(){
	cin>>n>>s;
	for(int i=0;i<s.size()-2;i++){
		if(s.substr(i,3)=="ABC")  ans++;
	}
	printf("%d",ans);
	return 0;
}


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

int solve(int n) {
	for (int i = 1; i < 11; i++) {
		if(1000*i-n>0) {
			return 1000*i-n;
			break;
		}
		else if(1000*i-n == 0 ){
			return 1000*i-n;
			break;
		}
	}	
}

int main() {
	int n, c0=0, c1=0, c2=0, c3=0;
	string s;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s;
		if(s[0]=='A') c0++;
		else if(s[0]=='W') c1++;
		else if(s[0]=='T') c2++;
		else c3++;
	}
	cout << "AC x " << c0 << endl;
	cout << "WA x " << c1 << endl;
	cout << "TLE x " << c2 << endl;
	cout << "RE x " << c3 << endl;
}


Measured memory_bytes: 3632
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

struct UFTree(T)
{
    struct Node
    {
        T parent;
        T rank = 1;
    }

    ///
    T min_size, max_size;

    ///
    this(T n)
    {
        nodes.length = n;
        sizes.length = n;
        foreach (i, ref node; nodes) {
            node = Node(i.to!T);
            sizes[i] = 1;
        }

        min_sizes.length = n + 1;
        min_sizes[1] = n;
        min_size = 1;
        max_size = 1;
    }

    ///
    bool unite(T a, T b)
    {
        a = root(a);
        b = root(b);

        if (a == b) return false;

        auto a_size = sizes[a];
        auto b_size = sizes[b];
        --min_sizes[a_size];
        --min_sizes[b_size];
        ++min_sizes[a_size + b_size];
        foreach (nxt_size; min(a_size, b_size)..min_sizes.length) if (min_sizes[nxt_size] != 0) {
            min_size = nxt_size.to!T;
            break;
        }
        max_size = max(max_size, a_size + b_size);

        if (nodes[a].rank < nodes[b].rank) {
            sizes[a] += sizes[b];
            nodes[b].parent = a;
        } else {
            sizes[b] += sizes[a];
            nodes[a].parent = b;
            if (nodes[a].rank == nodes[b].rank) ++nodes[b].rank;
        }

        return true;
    }

    ///
    bool is_same(T a, T b)
    {
        return root(a) == root(b);
    }

    ///
    T size(T i)
    {
        return sizes[root(i)];
    }

private:
    Node[] nodes;
    T[] sizes;
    T[] min_sizes;

    T root(T i)
    {
        if (nodes[i].parent == i) return i;

        return nodes[i].parent = root(nodes[i].parent);
    }
}

///
UFTree!T uftree(T)(T n)
{
    return UFTree!T(n);
}

void main()
{
    auto nmk = readln.split.to!(int[]);
    auto N = nmk[0];
    auto M = nmk[1];
    auto K = nmk[2];

    auto fs = uftree(N);
    auto fc = new int[](N);

    foreach (_; 0..M) {
        auto ab = readln.split.to!(int[]);
        auto A = ab[0]-1;
        auto B = ab[1]-1;
        fs.unite(A, B);
        --fc[A];
        --fc[B];
    }
    foreach (i; 0..N) {
        fc[i] += fs.size(i) - 1;
    }
    foreach (_; 0..K) {
        auto cd = readln.split.to!(int[]);
        auto C = cd[0]-1;
        auto D = cd[1]-1;
        if (fs.is_same(C, D)) {
            --fc[C];
            --fc[D];
        }
    }

    writeln(fc.to!(string[]).join(" "));
}

Measured memory_bytes: 9852
#include <iostream>
#include <cmath>

using namespace std;

bool isPrime(int a) {
    if (a == 2) {
        return true;
    }
    if (a % 2 == 0) {
        return false;
    }
    for (int i = 3; i <= (int)sqrt(a); i = i + 2) {
        if (a % i == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    int n;
    cin >> n;
    int c = 0;
    while(n--) {
        int a;
        cin >> a;
        if (isPrime(a)) {
            c++;
        }
    }
    cout << c << endl;

    return 0;
}


Measured memory_bytes: 3104
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    int N; cin >> N;
    string s;
    while(N != 0) {
        int d = N % (-2);
        if (d < 0) d += 2;
        s += to_string(d);
        N = (N-d) / (-2); 
    }

    reverse(s.begin(), s.end());
    if(s == "") s = "0";
    cout << s << '\n';
}

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

    solve();

    return 0;
}

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

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

	map<int, int> output;

	int r_cnt = 0, l_cnt = 0, r_pos, l_pos;
	for (int i = 0; i < s.size(); i ++) {
		if (s[i] == 'R') {
			if (l_cnt > 0) {
				// 集計
				int r = 0;
				if (r_cnt % 2 == 0) {
					r += r_cnt/2;
				} else {
					r += r_cnt/2+1;
				}
				r += l_cnt/2;
				int l = r_cnt + l_cnt - r;

				fflush(stdout);
				output[r_pos] = r;
				output[l_pos] = l;
				r_cnt = 1;
				l_cnt = 0;
			} else {
				r_cnt ++;
			}
		} else {
			if (l_cnt == 0) {
				r_pos = i-1;
				l_pos = i;
			}
			l_cnt ++;
		}
	}
	if (l_cnt > 0) {
		// 集計
		int r;
		if (r_cnt % 2 == 0) {
			r += r_cnt/2;
		} else {
			r += r_cnt/2+1;
		}
		r += l_cnt/2;
		int l = r_cnt + l_cnt - r;
		output[r_pos] = r;
		output[l_pos] = l;
		r_cnt = 1;
		l_cnt = 0;
	}

	string output_s;
	bool first = true;
	int prev = -1;
	map<int, int>::iterator itr;
	for (itr = output.begin(); itr != output.end(); itr ++) {
		if (!first) {
			cout << " ";
		} else {
			first = false;
		}
		int pos = itr->first;
		int val = itr->second;
		for (int i = prev + 1; i < pos; i ++) {
			cout << "0 ";
		}
		cout << val;
		prev = pos;
	}
	for (int i = prev + 1; i < s.size(); i ++) {
		cout << " 0";
	}
	cout << endl;
	return 0;
}


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

int main(){ 
  Int K, X;
  cin >> K >> X;
  
  if (K * 500 >= X) cout << "Yes" << endl;
  else cout << "No" << endl;

}

Measured memory_bytes: 256
N = input()
count = 0
if len(N)%2 == 1:
  X = len(N) -1
  for i in range(int(X/2)):
    if N[i] != N[-(i+1)]:
      count += 1
if len(N) % 2 == 0:
  X = (len(N))/2
  for i in range(int(X)):
    if N[i] != N[-(i+1)]:
      count += 1
    
  
print(count)


Measured memory_bytes: 3060
// Copyright 2020 yaito3014
#include <bits/stdc++.h>
using namespace std;

int main() {
	cin.tie(nullptr); ios::sync_with_stdio(false);
	int N, M, S;
	cin >> N >> M >> S;
	vector<deque<tuple<int, int, int>>> graph(N);
	int A_max = 0;
	for(int i = 0; i < M; ++i) {
		int U, V, A, B;
		cin >> U >> V >> A >> B, --U, --V;
		A_max = max(A_max, A);
		graph[U].emplace_back(V, B, A);
		graph[V].emplace_back(U, B, A);
	}
	const int Max = A_max * (N - 1);
	for(int i = 0; i < N; ++i) {
		int C, D;
		cin >> C >> D;
		graph[i].emplace_back(i, D, -C);
	}
	vector<vector<long long>>
		costs(N, vector<long long>(Max + 1, INT64_MAX));
	// T: (cost, coins, node)
	using T = tuple<long long, int, int>;
	priority_queue<T, vector<T>, greater<>> que;
	que.emplace(0, S, 0);
	while(!que.empty()) {
		auto [cost_sum, coins, node] = que.top();
		que.pop();
		for(const auto& [to, cost, pay] : graph[node]) {
			if(coins >= pay && cost_sum + cost < costs[to][min(Max, coins - pay)]) {
				costs[to][min(Max, coins - pay)] = cost_sum + cost;
				que.emplace(cost_sum + cost, min(Max, coins - pay), to);
			}
		}
	}
	for(int i = 1; i < N; ++i)
		cout << *min_element(begin(costs[i]), end(costs[i])) << '\n';
}


Measured memory_bytes: 6200
#include<stdio.h>

int main(void){


int a, b, c, x;


    scanf("%d %d %d",&a,&b,&c);


    if(a>b){


        x=a; a=b; b=x;


    }


    if(a>c){


        x=a; a=c; c=x;


    }


    if(b>c){


        x=b; b=c; c=x;


    }


    printf("%d %d %d\n",a,b,c);


    return 0;



}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

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

int main() {

  for (int n; cin >> n, cin;) {
    int ans = 0;
    rep(a,10) rep(b,10) rep(c,10) rep(d,10) if (a+b+c+d == n) ++ans;
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
# include <bits/stdc++.h>
# define pb push_back
# define int long long
using namespace std;
void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
#define Cin(Type, ...) Type __VA_ARGS__; _cin(__VA_ARGS__)
#define Cinv(Type, xs, n) vector<Type> xs(n); rep(i, n) cin >> xs[i]
#define Cinv2(Type, xs, ys, n) vector<Type> xs(n), ys(n); rep(i, n) cin >> xs[i] >> ys[i]
#define Cinv3(Type, xs, ys, zs, n) vector<Type> xs(n), ys(n), zs(n); rep(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinvv(Type, xs, h, w) vector<vector<Type>> xs(h, vector<int>(w)); rep(i, h) rep(j, w) cin >> xs[i][j]
void Print() { cout << endl; }
template <class Head, class... Tail> void Print(Head&& head, Tail&&... tail) { cout << head; if (sizeof...(tail) != 0) cout << " "; Print(forward<Tail>(tail)...); }
template <class Type> void Print(vector<Type> &vec) { for (auto& a : vec) { cout << a; if (&a != &vec.back()) cout << " "; } cout << endl; }
template <class Type> void Print(vector<vector<Type>> &df) { for (auto& vec : df) { Print(vec); } }
void Debug() { cerr << endl; }
template <class Head, class... Tail> void Debug(Head&& head, Tail&&... tail) { cerr << head; if (sizeof...(tail) != 0) cerr << " "; Debug(forward<Tail>(tail)...); }
template <class Type> void Debug(vector<Type> &vec) { for (auto& a : vec) { cerr << a; if (&a != &vec.back()) cerr << " "; } cerr << endl; }
template <class Type> void Debug(vector<vector<Type>> &df) { for (auto& vec : df) { Debug(vec); } }
vector<int> range(int n) {
    vector<int> ar(max((int)0, n));
    iota(ar.begin(), ar.end(), 0);
    return ar;
}

signed main() {
    Cin(int, n); // 頂点数
    vector<vector<int>> G(n);
    for (auto i : range(n)) {
        Cin(int, u, k);
        u--;
        for (auto j : range(k)) {
            Cin(int, v);
            v--;
            G[u].pb(v);
        }
    }

    vector<int> dist(n, -1);
    queue<int> que;
    que.push(0);
    dist[0] = 0;
    while (!que.empty()) {
        int now = que.front(); que.pop();
        for (auto nxt : G[now]) {
            if (dist[nxt] != -1) continue;
            dist[nxt] = dist[now] + 1;
            que.push(nxt);
        }
    }

    for (auto i : range(n)) {
        cout << i+1 << " " << dist[i] << "\n";
    }

    return 0;
}



Measured memory_bytes: 3164