akhauriyash/Code-Regression huggingface dataset:
// reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::Ordering;
#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

impl<T: Copy> Copy for Rev<T> {}

use std::collections::BinaryHeap;

type V = usize;

#[derive(Clone)]
struct E {
    to: V,
    w: i64,
}

type G = Vec<Vec<E>>;

fn dijkstra(g: &G, v: V) -> Vec<i64> {
    let mut d = vec![std::i64::MAX / 32; g.len()];
    let mut q = BinaryHeap::new();
    q.push((0, v));
    while let Some((w, v)) = q.pop() {
        if w >= d[v] {
            continue;
        }
        d[v] = w;
        for e in g[v].iter() {
            let td = d[v] + e.w;
            if td < d[e.to] {
                q.push((td, e.to));
            }
        }
    }

    d
}

fn main() {
    input! {
        n: usize,
        uvw: [(usize1, usize1, i64); n-1]
    }

    let mut g = vec![Vec::<E>::new(); n];

    for (u, v, w) in uvw {
        g[u].push(E { to: v, w: w });
        g[v].push(E { to: u, w: w });
    }

    let d = dijkstra(&g, 0);
    let mut ans = vec![-1; n];
    ans[0] = 0;
    for t in 1..n {
        if d[t] % 2 == 0 {
            ans[t] = 0;
        } else {
            ans[t] = 1;
        }
    }

    for x in ans {
        println!("{}", x);
    }
}


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

using namespace std;

char s[500000];
int w[500000], e[500000];

int main () {
        int n;

        scanf("%d", &n);

        scanf(" %s", s);

        w[0] = (s[0] == 'W' ? 1 : 0);
        for(int i = 1; i < n; i++) {
                w[i] = w[i - 1] + (s[i] == 'W' ? 1 : 0);
        }
        e[n - 1] = (s[n - 1] == 'E' ? 1 : 0);
        for(int i = n - 2; i > 0; i--) {
                e[i] = e[i + 1] + (s[i] == 'E' ? 1 : 0);
        }
        int resp = 1e9;

        for (int i = 1; i < n - 1; i++) {
                resp = min(resp, w[i - 1] + e[i + 1]);
        }
        resp = min(resp, w[n - 2]);
        resp = min(resp, e[1]);
 
        printf("%d\n", resp);

        return 0;
}


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

int main(){
    int n,sum=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i],sum^=a[i];
    for(int i=0;i<n;i++) cout<<(sum^a[i])<<" ";
  	return 0;
}


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

using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;

	vector < int >L(M);
	vector < int >R(M);

	for (int i = 0; i < M; i++) {
		cin >> L[i] >> R[i];
	}

	cout << max(*min_element(R.begin(), R.end()) -
		    *max_element(L.begin(), L.end()) + 1, 0) << endl;

	return 0;
}


Measured memory_bytes: 1024
void main() {
	auto S = rs;
	int i = S[0..2].to!int;
	int j = S[2..$].to!int;
	bool YYMM = j <= 12 && 1 <= j;
	bool MMYY = i <= 12 && 1 <= i;
	if(YYMM && MMYY) writeln("AMBIGUOUS");
	else if(YYMM) writeln("YYMM");
	else if(MMYY) writeln("MMYY");
	else writeln("NA"); 
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
 
long long int INF = 2e18;
const ll fact_table = 1200008;
double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←

#define endl "\n"
#ifdef ENJAPMA
    #undef endl
#endif
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
 
const ll mod = 998244353ll;
// const ll mod = 1000000007ll;
  
ll mypow(ll number1,ll number2, ll mod){
    if(number2 == 0){
        return 1ll;
    }else{
        ll number3 = mypow(number1,number2 / 2, mod);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5]; 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/
bool multicase = false;

ll n,m,num,a,b,c,d,e,h,q;
ll w, k;

void solve(){
    cin >> n >> a >> b;
    if(b / n - (a - 1) / n >= 1){
        p("OK");
    }else{
        p("NG");
    }
    return;
}


int main(){
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if(multicase){
        cin >> q;
    }else{
        q = 1; 
    }
    while(q--){
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}
















Measured memory_bytes: 3656
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

void solve() {
	int t; cin >> t;
	rep(aa, t) {
		vector<int> c;
		int r;
		while (cin >> r, r) {
			c.push_back(r);
		}
		vector<int> rooms,dist;
		vector<vector<int>> g(100);
		queue<int> q[100];
		int loc = -1; int cur = -1;
		vector<int> path;
		rep(i, c.size()) {
			if (c[i] > 0) {
				cur++; loc++;
				if (!path.empty()) {
					int las = path.back();
					g[las].push_back(cur);
					g[cur].push_back(las);
				}
				rooms.push_back(c[i]);
				dist.push_back(cur);
				q[loc].push(cur);
				path.push_back(cur);
			}
			else {
				int id = c[i] + loc;
				while (!q[id].empty()) {
					int idd = q[id].front();
					if (g[idd].size() == rooms[idd])q[id].pop();
					else break;
				}
				int idd = q[id].front();
				g[idd].push_back(path.back());
				g[path.back()].push_back(idd);
			}
			while (!path.empty()&&g[path.back()].size() == rooms[path.back()]) {
				path.pop_back(); loc--;
			}
		}
		rep(i, cur+1) {
			sort(g[i].begin(), g[i].end());
			cout << i + 1;
			rep(j, g[i].size()) {
				cout << " " << g[i][j] + 1;
			}
			cout << endl;
		}
	}
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 3212
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
using ll = long long;

int h[100010];

int dp[100010];
int main()
{
    int N; cin >> N;
    for(int i=0; i<100010; ++i) dp[i]=1e9;
    
    for(int i=0; i<N; ++i) cin >> h[i];
    
    dp[0]=0;
    
    for(int i=0; i<N; ++i){
        if(i>0)dp[i] = min(dp[i], dp[i-1]+ abs(h[i]-h[i-1]));
        if(i>1)dp[i] = min(dp[i], dp[i-2] + abs(h[i]-h[i-2]));
    }
    cout << dp[N-1] << endl;
    return 0;
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/


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

int main() {
  int K; cin >> K;
  int A, B; cin >> A >> B;
  string ans = "NG";
  for (int i=A; i<=B; i++) {
    if (i % K == 0) {
      ans = "OK";
    }
  }

  cout << ans << endl;

  return 0;
}


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

int selectionSort(int A[], int N) {
    int i, j, minj, sw = 0;
    for ( i = 0; i < N - 1; i++ ) {
        minj = i;
        for ( j = i; j < N; j++ ) {
            if ( A[j] < A[minj]) {
                minj = j;
            }
        }
        if ( i != minj ) {
            swap(A[i], A[minj]);
            sw++;
        }
    }
    return sw;
}

main() {
    int A[100], N, i, sw;

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

    sw = selectionSort(A, N);

    for ( i = 0; i < N; i++ ) {
        if ( i != 0 ) printf(" ");
        printf("%d", A[i]);
    }
    printf("\n");
    printf("%d\n", sw);

}

Measured memory_bytes: 3188
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main(args: Array<String>) {
    val (W, H, x, y) = readIntList()

    val ansMulti = if (2 * x == W && 2 * y == H) {
        1
    } else {
        0
    }

    println("${W.toDouble() * H.toDouble() / 2.0F} $ansMulti")
}



Measured memory_bytes: 36004
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ios::sync_with_stdio(0);  //fast input and output
    cin.tie(0);
    ll a,b;
    cin>>a>>b;
    if(a*500>=b)
        cout<<"Yes";
    else
        cout<<"No";


    return 0;
   }


Measured memory_bytes: 256
#include<stdio.h>



int main() {


	int a, b;

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



	if (a > b)printf("%d", 2 * a - 1);
	if(a<b) printf("%d", 2 * b - 1);
	if (a == b)printf("%d", 2 * a);

	return 0;
}


Measured memory_bytes: 128
/**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
                         **/
#include<bits/stdc++.h>
using namespace std;
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define f1 '\n'
#define vi vector<int>
#define sz size
#define rep(i,x,y) for(int i=(x);i<(y);i++)
#define rep2(i,x,y) for(int i=(x);i>(y);i--)
typedef pair<int,int> ii;
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 1e5+1;
const int mod = 1000000009;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 10000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Template ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if(!e)return 1;
    if(e&1) return qpow(b,e-1)*b;
    int pwur=qpow(b,e>>1);
    return pwur*pwur;
}

/// My Code -------------------------------------------------

int a[3]={10000,5000,1000};

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int a,b;
    cin>>a>>b;
    int cnt=0;
    int num=b;
    while(num>0){
        cnt++;
        num/=10;
    }
    a=a*qpow(10,cnt)+b;
    bool fl=0;
    for(int i=1;i<=1000;i++){
        if(i*i==a)fl=1;
    }
    cout<<((fl)?"Yes":"No");


    return 0;
}


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

using namespace std;

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

#define REP(k, n) for (ll k = 0; k < (ll)(n); ++k)
#define REPREV(k, n) for (ll k = (ll)(n)-1; k >= 0; --k)
#define FOR(k, a, b) for (ll k = (ll)(a); k < (ll)(b); ++k)
#define FORREV(k, a, b) for (ll k = (ll)(b)-1; k >= (ll)(a); --k)
#define FOREACH(e, v) for (auto& e : v)

#define TGET(t, i) get<i>(t)
#define TSET(t, i, a) get<i>(t) = a
// MinHeap - priority_queue<ll, vll, greater<ll>> pq;

#define EVEN(n) ((n)&1) == 0
#define ODD(n) ((n)&1) == 1

#define SORT(v) sort(v.begin(), v.end())
#define SORTREV(v) sort(v.rbegin(), v.rend())
#define SHUFFLE(v) random_shuffle(v.begin(), v.end())
//srand(unsigned(time(0)));

#define REMOVEAT(v, i) v.erase(v.begin() + i)
#define REVERSE(v) reverse(v.begin(), v.end())

ll MOD(ll x, ll m) {
    ll r = x % m;
    if (r < 0) {
        r += m;
    }
    return r;
}

ostream& operator<<(ostream& str, const pll& p) {
    str << p.first << " " << p.second;
    return str;
}

template <typename T>
void join(T& arr, string sep) {
    bool first = true;
    for (auto t : arr) {
        if (first) {
            first = false;
            cout << t;
        } else {
            cout << sep << t;
        }
    }
    cout << "\n";
}

#define POS "POSSIBLE"
#define IMPOS "IMPOSSIBLE"

// #define INF LLONG_MAX
// #define MINF LLONG_MIN
#define INF 9e18
#define MINF -INF

void solve() {
    ll n;
    cin >> n;
    vvll g(n);
    REP(i, n - 1) {
        ll u, v;
        cin >> u >> v;
        u--;
        v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    ll res = 0;
    REP(u, n) {
        SORT(g[u]);
    }

    ll cont = 0;
    REP(u, n) {
        ll i = u + 1;
        cont += i;
        FOREACH(v, g[u]) {
            if (v >= u)
                break;
            cont -= v+1;
        }
        res += cont;
    }

    // cout << fixed << setprecision(6);
    cout << res << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt = 1;
    // cin >> tt;
    for (int t = 1; t <= tt; t++) {
        // cout << "Case #" << t << ": ";
        solve();
    }
    //cin.rdbuf()->in_avail()
    return 0;
}

Measured memory_bytes: 15800
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define moder 1000000007
using namespace std;
int mypow(int a,int b){
	if(b==0)return 1;
	if(b%2)return mypow(a,b-1)*a%moder;
	return mypow(a,b/2)*mypow(a,b/2)%moder;
}
int kaijo(int n){
	int ans=1;
	for(int i=1;i<=n;i++){
		ans*=i;
		ans%=moder;
	}
	return ans;
}
int n,a[100010],b[100010],nkai;
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	nkai=kaijo(n);
	for(int i=1;i<=n;i++){
		b[i]=mypow(i,moder-2);
		b[i]*=nkai;
		b[i]%=moder;
		b[i]+=b[i-1];
		b[i]%=moder;
	}
	int ans=0;
	rep(i,n){
		ans+=a[i]*b[n-i]+a[i]*b[i+1]-a[i]*b[1];
		ans%=moder;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(int i = 0; i < (int)n; i++)
using namespace std;

int main(){
  int n;
  cin >> n;
  int cnt[100000] = {};
  REP(i,n){
    int a;
    cin >> a;
    if(a>0) cnt[a-1]++;
    cnt[a]++;
    if(a<100000-1) cnt[a+1]++;
  }
  int ans = 0;
  REP(i,100000){
    if(cnt[i]>ans) ans = cnt[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
package main

import (
	"fmt"
)

func main() {
	var n int
	var a[101] int
	count := 0

	for i:=1; i<100; i++ {
		a[i] = 0
	}

	fmt.Scanf("%d", &n)
	for i:=0; i<n; i++ {
		var x int
		fmt.Scanf("%d", &x)
		if a[x] == 0 {
			count++
		}
		a[x]++
	}

	fmt.Print(count)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair <int, int> pii;
typedef pair <pii, int> ppiii;

const int INF = 2147483647;
int n, m, t1, t2, t3, d[105][105];

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) d[i][j] = INF;
	for (int i = 0; i < m; i++) {
		cin >> t1 >> t2 >> t3;
		d[t1][t2] = t3;
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < n; k++) {
				if (j == k) d[j][k] = 0;
				if (d[j][i] == INF || d[i][k] == INF) continue;
				if (d[j][i] + d[i][k] < d[j][k]) {
					d[j][k] = d[j][i] + d[i][k];
				}
			}
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < n; k++) {
				if (j == k) d[j][k] = 0;
				if (d[j][i] == INF || d[i][k] == INF) continue;
				if (d[j][i] + d[i][k] < d[j][k]) {
					cout << "NEGATIVE CYCLE" << endl;
					return 0;
				}
			}
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (d[i][j] == INF) cout << "INF";
			else cout << d[i][j];
			if (j < n - 1) cout << ' ';
		}
		cout << endl;
	}
}



Measured memory_bytes: 3140
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<functional>
using namespace std;
#define INF 1e15
#define MOD 1000000007
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
typedef long long ll;
#define END system("PAUSE");return 0
int n, m, c, b[25], a[25][25];
signed main() {
	cin >> n >> m >> c;
	int ans = 0;
	rep(i, m)cin >> b[i];
	rep(i, n) {
		int cnt = 0;
		rep(j, m) {
			cin >> a[i][j];
			cnt += a[i][j] * b[j];
		}
		cnt += c;
		if (cnt > 0)ans++;
	}
	cout << ans << endl;
	END;
}


Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
#define l long long
#define pis acos(-1)
int main()
{
    l n,m,a,b,i,j,sum = 0,mx = LONG_LONG_MIN,mn = LONG_LONG_MAX;
    string str;
    vector<l>v;
    map<l,l>mp;
    set<l>s;
    cin>>n>>m;
    for(i = 0;i <= n;i++)
    {
        for(j = 0;j <= n;j++)
        {
            if(i+j==n)
            {
                if(i*2+j*4==m)
                {
                    sum=1;
                    break;
                }
            }
        }
        if(sum==1)
            break;
    }
    if(sum==1)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


Measured memory_bytes: 3624
S = input()

N = len(S)

output_lst = [0]*N

Ridge_Valley_Ridge_pare_lst = []
R1 = -1
R2 = -1
V = -1
for i in range(N-1):
    if R1 == -1:
        R1 = i        
    if S[i] == "R" and S[i+1] == "L":
        V = i
    if S[i] == "L" and S[i+1] == "R":
        R2 = i

    if i == N - 2:
        R2 = N - 1
    
    if R1 != -1 and R2 != -1 and V != -1:   #   1セットの地形ができたら
        Ridge_Valley_Ridge_pare_lst.append((R1, V, R2))
        R1, R2, V = -1, -1, -1

for R1, V, R2 in Ridge_Valley_Ridge_pare_lst:
    for i in range(R1, V+1):
        if (V + 1 - i) % 2 == 0:
            output_lst[V+1] += 1
        else:
            output_lst[V] += 1
    for i in range(V+1, R2+1):
        if (i - V) % 2 == 0:
            output_lst[V] += 1
        else:
            output_lst[V+1] += 1
    
#    print()

output_str = ""
for i in range(N):
    output_str += str(output_lst[i]) + " "

print(output_str)

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

using ll = long long;

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

    vector<ll> a(n), d(n);

    ll sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];

        sum += a[i];
    }

    if (sum % (n * (n + 1) / 2) != 0) {
        cout << "NO" << endl;
        return 0;
    }

    ll k = sum / (n * (n + 1) / 2);

    for (int i = 0; i < n; i++) {
        // 負の数
        d[i] = (a[i] - a[(i + 1) % n]) + k;
    }

    // k回{d_i}にnを引くことで0にしたい
    ll rem = k;
    for (int i = 0; i < n; i++) {
        if (d[i] % n != 0) {
            cout << "NO" << endl;
            return 0;
        }

        rem -= abs(d[i]) / n;
    }
    if (rem == 0) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <string>

#if defined SUBLIME
#  define ISTREAM ss
#else
#  define ISTREAM cin
#endif


using namespace std;
int main()
{
	string a;
	#if defined SUBLIME
		string str = "1 + 2 1 * 2 1 - 2 1 / 2 0 ? 0";
		stringstream ss;
		ss << str;
	#endif
	while(true)
	{
		int a, b, ans;
		string op;
		ISTREAM >> a >> op >> b;
		if(op == "?")
		{
			break;
		}
		else if(op == "+")
		{
			ans = a + b;
		}
		else if(op == "-")
		{
			ans = a - b;
		}
		else if(op == "*")
		{
			ans = a * b;
		}
		else
		{
			ans = a / b;
		}
		cout << ans << endl;
	}
}

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

  for (int i = 0; i < N; ++i)
  {
    string S;
    cin >> S;
    if (S == "Y")
    {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}

Measured memory_bytes: 3552
n,k=map(int,input().split())
d=input().split()
while 1:
    t=0
    p=list(str(n))
    q=len(p)
    for c in range(q):
        if t==1:
            break
        for b in range(k):
            if p[c]==d[b]:
                n=n+1
                t=1
                break
    if t==0:
        break
print(n)

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

  private void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int heapSize = Integer.parseInt(br.readLine());
      String[] keys = br.readLine().split(" ");
      int[] heap = new int[heapSize+1];
      for(int i=1; i<=heapSize; i++)
        heap[i] = Integer.parseInt( keys[i-1] );

      StringBuilder buf = new StringBuilder();
      for(int i=1; i<=heapSize; i++){
        buf.append("node " + i + ": key = " + heap[i] + ", ");
        if( i != 1 ) buf.append("parent key = " + heap[i/2] + ", ");
        if( i*2 <= heapSize) {
          buf.append("left key = " + heap[i*2] + ", ");
          if( i*2+1 <= heapSize) {
            buf.append("right key = " + heap[i*2+1] + ", ");
          }
        }
        buf.append("\n");
      }

      System.out.print(buf);
    } catch(IOException e) {
      System.out.println("IOException!");
    }
  }
}


Measured memory_bytes: 24200
#include<iostream>
using namespace std; 
int main (){
int A,B;
scanf("%d%d",&A,&B);
if (A>=0&&A<=23&&B>=0&&B<=23){

if (A+B>24)
cout<<(A+B)%24;
else if (A+B==24)
cout<<"0";
else 
cout<<A+B;
}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; i++){
    cin >> d.at(i);
  }
  long long int ans = 0;
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      ans += d.at(i) * d.at(j);
    }
    ans -= d.at(i) * d.at(i);
  }
  ans /= 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
//problem link: 


#include<bits/stdc++.h>

#define PI 3.1415926535897932384626
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,a,b) for(i=a;i<b;i++)
#define ll long long
#define pb push_back
#define popb pop_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define ini(a) memset(a,-1,sizeof(a))
#define M (long long)(1e9+7)

#define chk(a) cout << endl << #a << " : " << a << endl
#define chk2(a,b) cout << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cout << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cout << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;


using namespace std;

typedef pair<int, int>	pi;
typedef pair<int,pi>    pii;
typedef pair<ll, ll>	pl;
typedef pair<ll,pl>     pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pi>		vpi;
typedef vector<pii>     vpii;
typedef vector<pl>		vpl;
typedef vector<pll>     vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;

//========================================================================



void solve(){

	int n;
	cin>>n;
	ll a[n];
	ll dp[n];
	ll h[n];
	int i;
	fo(i,n){cin>>a[i];h[i]=a[i];}
	dp[0]=0;
	for(i=1;i<n;i++){
		if(a[i]<h[i-1]){
			h[i]=a[i]+abs(a[i]-h[i-1]);
			dp[i]=dp[i-1]+abs(a[i]-h[i-1]);
		}else{
			dp[i]=dp[i-1];
		}
	}
	cout<<dp[n-1]<<endl;

}



int main(){

#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
return 0;
}

Measured memory_bytes: 8304
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL;
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main (){ 
    int n,k;
    while(cin>>n>>k&&n&&k){
        vector<int> v(k);
        int zero=0;
        rep(i,0,k)cin>>v[i];

        Sort(v);
        if(v[0]==0){
            zero=1;
            v.erase(v.begin());
        }
        int left=0;
        int ans=0;
        rep(right,0,k-zero){
            while(v[right]-v[left]>right-left+zero){
                left++;
            }
            ans=max(ans,right-left+1);
            //cout<<ans<<" "<<v[left]<<" "<<v[right]<<endl;
        }
        cout<<ans+zero<<endl;
    }
    return 0;
}


/*
3 3 3 4 4
3 3 4 4 4
3 3 3 3 3

*/



Measured memory_bytes: 3104
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
res = 1


def resolve():
    def dfs(v, p, c):
        global res
        res = (res * c) % mod
        c = k - 1 if p == -1 else k - 2
        for u in edge[v]:
            if u != p:
                dfs(u, v, c)
                c -= 1

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

    dfs(0, -1, k)
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 110860
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include <random>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    cin>>n;
    vector<pair<double,double>> xy(n);
    double ans=0.0;
    rep(i,n){
        cin>>xy[i].fi>>xy[i].sc;
    }
    sort(all(xy));
    do{
        double b=0;
        rep(i,n-1){
            // cout<<xy[i].fi<<" "<<xy[i].sc<<" ";
            double a=sqrt(pow((xy[i].fi-xy[i+1].fi),2)+pow((xy[i].sc-xy[i+1].sc),2));
            ans+=a;
            b+=a;
        }
        // cout<<b<<"#";
        // cout<<ans<<endl;
    }while(next_permutation(xy.begin(),xy.end()));
    ll a=1;
    rep2(i,1,n+1){
        a*=i;
    }
    // cout<<a<<endl;
    cout<<(double)(ans/(double)a)<<endl;
    return 0;
}


Measured memory_bytes: 256
// ABEY SAALE
// QUESTION KHUD KR SOLUTION KYU DEKH RHA H
 
//MAAF KIJIYEGA ME GUSSE ME IDHAR UDHAR NIKAL JATA HU

// Author : Ritik Patel
// Institution: Pandit Deendayal Petroleum University
 
#include <bits/stdc++.h>
using namespace std;

#define FAST ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define sz(a) int((a).size())
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 
#define what_is(x) cout << #x << " is: " << x << endl;

template<typename T> T fast_power(T x,T y,T m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
template<typename T>
T extgcd(T a, T b, T &x, T &y) {  //when a and b are coprimes(or gcd(a,b)==1) in ax+by = t*gcd(a,b);
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  T p = b / a;
  T g = extgcd(b - p * a, a, y, x);
  x -= p * y;
  return g;
}

typedef long long ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

/******************* MAIN PROGRAM ***************/

int get(char &s){
	if( s == 'r') return 0;
	if( s == 's') return 1;
	if( s == 'p') return 2;
}

int attack(int i){
	if( i == 1) return 0;
	if( i == 2) return 1;
	if( i == 0) return 2;
}

int main(){
	FAST
	int n, k;
	cin >> n >> k;
	vi sample(3);
	for ( int i = 0; i < 3; ++i){
		cin >> sample[i]; //r,s,p;
	}
	ll ans = 0;
	string s; cin >> s;
	int prev = -1;
	for ( int i = 0; i < k; ++i){
		prev = -1;
		for( int j = i; j < sz(s); j +=k ){
			int def = get(s[j]);
			int att1 = attack(def);
			if( prev != att1 ){
				ans += sample[att1];
				prev = att1;
			} else {
				prev = -1;
			}
		}
	}
	cout << ans << '\n';



	
	return 0;
}


Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	th := io.NextInt()
	io.Println(th/30, th%30*2)
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}



Measured memory_bytes: 1116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long maximum;
long long mod = 1000000007;
const int INF = 1001001001;
vector<vector<int>> dp;

int main(){
 int x,y;
  cin >> x >> y;
 int money = 0;
 if(x==3){
   money += 100000;
 }else if(x==2){
   money += 200000;
 }else if(x==1){
   money += 300000;
 }
 if(y==3){
   money += 100000;
 }else if(y==2){
   money += 200000;
 }else if(y==1){
   money += 300000;
 }
 if(x==1&&y==1){
   money += 400000;
 }
 cout << money <<endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
S = [0]

mod = 10**9 + 7

for i in range(N-1):
  S.append(S[-1] + A[-1-i])

S.reverse()

ans = 0

for i in range(N-1):
  ans += A[i] * S[i] % mod
  ans %= mod

print(ans)

Measured memory_bytes: 31748
use std::fmt::Debug;
use std::str::FromStr;
use std::io::*;
use std::cmp::*;

fn main() {
    let i = stdin();
    solve(&mut i.lock(), &mut stdout());
}

fn solve(i: &mut BufRead, o: &mut Write) {
    let n = read::<usize>(i);
    let mut l = read_vec::<usize>(i);
    l.sort();
    let mut s = 0;
    for i in 0..n {
        s += min(l[2 * i], l[2 * i + 1]);
    }

    writeln!(o, "{}", s).unwrap();
}

fn read_line(i: &mut BufRead) -> String {
    let mut line = String::new();
    i.read_line(&mut line).unwrap();
    line.trim().to_string()
}
fn read<T: FromStr>(i: &mut BufRead) -> T
where
    T::Err: Debug,
{
    read_line(i).parse().unwrap()
}
fn read_vec<T: FromStr>(i: &mut BufRead) -> Vec<T>
where
    T::Err: Debug,
{
    read_line(i)
        .split(' ')
        .map(|x| x.parse().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>

using namespace std;

const int INF = (1 << 20);

int main ( void )
{
	int n, m, l, k, a, h;
	int graph[100][100];
	bool flg[100];
	
	while (cin >> n >> m >> l >> k >> a >> h,
		n | m | l | k | a | h )
	{
		for ( int i = 0; i < n; ++i )
		{
			for ( int j = 0; j < n; ++j )
			{
				graph[i][j] = INF;
			}
			graph[i][i] = 0;
			flg[i] = false;
		}
		
		flg[a] = flg[h] = true;
		for ( int i = 0, x; i < l; ++i )
		{
			cin >> x;
			flg[x] = true;
		}
		
		for ( int i = 0, f, t, c; i < k; ++i )
		{
			cin >> f >> t >> c;
			graph[f][t] = graph[t][f] = c;
		}
		
		for ( int z = 0; z < n; ++z )
			for ( int x = 0; x < n; ++x )
				for ( int y = 0; y < n; ++y )
					graph[x][y] = min(graph[x][y], graph[x][z] + graph[z][y]);
					
		for ( int i = 0; i < n; ++i )
			for ( int j = 0; j < n; ++j )
			{
				if ( !flg[i] || !flg[j] )
				{
					graph[i][j] = INF;
				}
				else if ( graph[i][j] > m )
				{
					graph[i][j] = INF;
				}
			}
			
		for ( int z = 0; z < n; ++z )
			for ( int x = 0; x < n; ++x )
				for ( int y = 0; y < n; ++y )
					graph[x][y] = min(graph[x][y], graph[x][z] + graph[z][y]);
					
		if ( graph[a][h] == INF )
			cout << "Help!" << endl;
		else
			cout << graph[a][h] + max(0, graph[a][h] - m) << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try( BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      String str = br.readLine();
      StringBuilder transStr = new StringBuilder(str);
      StringBuilder order = new StringBuilder();
      StringBuilder revese = new StringBuilder();
      int q = Integer.parseInt(br.readLine());
      int[] spaces = new int[]{0,0,0};
      int start = 0;
      int end   = 0;

      for ( int i = 0; i < q; i++ ) {

        order.append(br.readLine());
        spaces[0] = order.indexOf(" ");
        spaces[1] = order.indexOf(" ",spaces[0]+1);

        switch(order.substring(0,spaces[0])) {
          case "print" :
            start = Integer.parseInt(order.substring(spaces[0]+1,spaces[1]));
            end   = Integer.parseInt(order.substring(spaces[1]+1))+1;
            System.out.println(transStr.substring(start,end));
            break;
          case "reverse" :
            start = Integer.parseInt(order.substring(spaces[0]+1,spaces[1]));
            end   = Integer.parseInt(order.substring(spaces[1]+1))+1;
            revese.append(transStr.substring(start, end))
                  .reverse();
            transStr.replace(start, end, revese.toString());
            revese.setLength(0);
            break;
          case "replace" :
            spaces[2] = order.indexOf(" ",spaces[1]+1);
            start = Integer.parseInt(order.substring(spaces[0]+1,spaces[1]));
            end   = Integer.parseInt(order.substring(spaces[1]+1,spaces[2]))+1;
            transStr.replace(start, end, order.substring(spaces[2]+1));
            break;
          default :
            break;
        }

        order.setLength(0);
      }
    }
  }
}


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

int main(){
	int n;
	cin>>n;
	int a[n];
	for(int i=0; i<n; i++){
		cin>>a[i];
	}
	int f,count=0;
	do{
		f=0;
		for(int i=0; i<n; i++){
			if(a[i]%2==0){
				a[i]=a[i]/2;
			}else{
				f=1;
				break;
			}
		}
		if(f==0){
			count++;
		}
	}while(f==0);
	cout<<count<<endl;
	
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from bisect import bisect
    n=int(input())
    A=[-int(input()) for _ in range(n)]
    B=[]
    for a in A:
        i=bisect(B,a)
        if(i==len(B)): B.append(a)
        else: B[i]=a
    print(len(B))
resolve()

Measured memory_bytes: 48092
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int,int,int> T;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
#define mp make_pair
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;
using Ki = vector<vector<int>>;
using vec = vector<int>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    int n;
    string s;
    cin>>n>>s;
    int cnt=0;
    rep(i,n-2){
        if(s.substr(i,3)=="ABC") cnt++;
    }
    cout<<cnt<<endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

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

  if(x>=30) cout << "Yes" << endl;
  else  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD (int) (1e9+7)
#define INF (int) 2e9

int main(){
    int n;
    cin >> n;
    int a[n];
    rep(i, n){
        cin >> a[i];
    }

    int l[n], r[n];
    l[0]=a[0];
    r[n-1]=a[n-1];

    // l[i]: a[i]までのgcd
    for (int i = 0; i < n-1; i++) {
        l[i+1] = __gcd(l[i], a[i+1]);
    }
    // rep(i, n){
    //     cout << l[i] << " ";
    // }

    /// r[i]: a[i]までのgcd
    for (int i = n - 1; i >= 1; i--) {
        r[i-1] = __gcd(r[i], a[i-1]);
    }
    
    int ans = l[n-1];
    rep(i, n){
        if(i==0){
            ans = max(ans, r[1]);
        }else if(i==n-1){
            ans = max(ans, l[n-2]);
        } else {
            ans = max(ans, __gcd(l[i-1], r[i+1]));
        }
    }

    cout << ans << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  double L;
  cin >> L;

  double a = L / 3.0;
  double ans = pow(a, 3);
  cout << ans << endl;
}

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    string s;
    int n;
    cin >> s >> n;
    for(int i = 0; i < s.size(); i += n)
        cout << s[i];
}


Measured memory_bytes: 256