akhauriyash/Code-Regression huggingface dataset:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    a, b = map(int, input().split())

    res = [["."] * 100 for _ in range(100)]
    for h in range(50, 100):
        for w in range(100):
            res[h][w] = "#"

    for h in range(0, 100, 2):
        for w in range(0, 100, 2):
            if b == 1:
                break
            res[h][w] = "#"
            b -= 1
        else:
            continue
        break

    for h in reversed(range(0, 100, 2)):
        for w in range(0, 100, 2):
            if a == 1:
                break
            res[h][w] = "."
            a -= 1
        else:
            continue
        break

    print(100, 100)
    for i in res:
        print("".join(i))


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9256
#include <stdio.h>
int main(void)
{
    int n,m=0;
    
    scanf("%d",&n);
    int i=1;
    while((i<=n)&&(i<10)){
        m++; i++;
    }
    i=100;
    while((i<=n)&&(i<1000)){
        m++; i++;
    }
    i=10000;
    while((i<=n)&&(i<100000)){
        m++; i++;
    }
    printf("%d\n",m);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=5005;
string ch[maxn*6];
char s[maxn];
int n,k,cnt;
int main(){
    scanf("%s%d",s,&k),n=strlen(s);
    for(int i=0,T;i<n;i++){
        ch[++cnt]=s[i];
        T=min(k,n-i);
        for(int j=1;j<T;j++,cnt++) ch[cnt+1]=ch[cnt]+s[i+j];
    }
     
    sort(ch+1,ch+cnt+1);
    unique(ch+1,ch+cnt+1);
    cout<<ch[k]<<endl;
    return 0;
}

Measured memory_bytes: 1664
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();

		int N = fs.nextInt();
		int M = fs.nextInt();

		int[] price = new int[(int) Math.pow(2, N)];
		int[] priceSum = new int[(int) Math.pow(2, N)];

		boolean[] keyExist = new boolean[N];
		for (int i = 1; i <= M; i++) {
			int a = fs.nextInt();
			int b = fs.nextInt();
			int mask = 0;
			for (int j = 1; j <= b; j++) {
				int c = fs.nextInt() - 1;
				keyExist[c] = true;
				mask |= 1 << c;
			}
			if (price[mask] == 0) {
				price[mask] = a;
				priceSum[mask] = price[mask];
			} else {
				price[mask] = Math.min(a, price[mask]);
				priceSum[mask] = price[mask];
			}
//			System.out.println("mask:" + mask + ", price:" + price[mask]);
		}

		boolean flag = keyExist[0];
		for (int i = 1; i < N; i++) {
			flag = flag && keyExist[i];
		}
		if (!flag) {
			System.out.println(-1);
			return;
		}


		for (int x = 1; x < (int) Math.pow(2, N); x++) {
			for (int y = 1; y < (int) Math.pow(2, N); y++) {
				if(price[y] == 0) continue;
				if(priceSum[x] == 0) continue;
				if(priceSum[x | y] == 0) {
					priceSum[x | y] = priceSum[x] + price[y];
				}else {
					priceSum[x | y] = Math.min(priceSum[x] + price[y], priceSum[x | y]);
				}
			}
		}

		System.out.println(priceSum[(int) Math.pow(2, N) - 1]);

	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 23124
N,K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
fact_l=[1]*(N+10)
mod = 10**9+7
for i in range(2,N+1):
  fact_l[i]=(fact_l[i-1]*i)%mod
  
fact_inv_l = [1]*(N+10)
for i in range(2,N+1):
  fact_inv_l[i]=pow(fact_l[i],mod-2,mod)
ans = 0
for i in range(1,N-K+2):
  b = N-i
  c = K-1
  ans -= A[i-1]*fact_l[b]%mod*fact_inv_l[b-c]%mod*fact_inv_l[c]%mod
  ans += A[-i]*fact_l[b]%mod*fact_inv_l[b-c]%mod*fact_inv_l[c]%mod
    
print(ans%mod)

Measured memory_bytes: 63344
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
#include<functional>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define erep(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
const int mod = 1e9+7;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
  int n, i;
  cin >> n >> i;
  cout << n - i + 1 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
using LL = long long;

int main() {
	int N;
	cin >> N;
	vector<LL> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	LL ans = 0;
	for (int i = 1; i < N; i++) {
		if (A[i] < A[i - 1]) {
			ans += A[i-1] - A[i];
			A[i] = A[i - 1];
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4756
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;

void a()
{
    int A,B;
    cin >>A>>B;
    if(abs(A-B)%2==0)
    {
        cout<<(A+B)/2;

    }
    else
    {
        cout<<"IMPOSSIBLE";
    }
    return;
    
}
int main()
{
    a();
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	const int b[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
	int w, i, j, t, a[10];
	while (cin >> w)
	{
		if (cin.eof()) return 0;
		for (i = 9, j = 0, t = 0; i >= 0; i--)
		{
			if (w >= t + b[i])
			{
				a[j] = b[i];
				t += a[j];
				if (w == t + b[i])
					break;
				j++;
			}
		}
		for (i = j - 1; i > 0; i--)
			cout << a[i] << " ";
		cout << a[0] << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <chrono>

#define ll long long

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

    std::vector<int> A(N);
    int sum = 0;
    for(int i=0; i < N; i++) {
        std::cin >> A[i];
        sum += A[i];
    }

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

    bool is_select = true;
    int border = sum / (4 * M);
    for(int i=0; i < M; i++) {
        if(sum % (4*M) == 0) {
            if(border > A[N-1-i]) {
                is_select = false;
                break;
            }
        }
        else {
            if(border >= A[N-1-i]) {
                is_select = false;
                break;
            }
        }
    }

    if(is_select) {
        std::cout << "Yes" << std::endl;
    }
    else {
        std::cout << "No" << std::endl;
    }
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
int N, A, B, H[101010];
//---------------------------------------------------------------------------------------------------
bool check(ll x) {
    ll c = 0;
    rep(i, 0, N) {
        ll h = 1LL * H[i] - 1LL * x * B;
        if (h <= 0) continue;
        c += h / A;
        if (h % A) c++;
    }
    return c <= x;
}
//---------------------------------------------------------------------------------------------------
int main() {
    cin >> N >> A >> B;
    A -= B;
    rep(i, 0, N) cin >> H[i];
    int ng = 0, ok = 1010101010;
    while (ng + 1 != ok) {
        int x = (ng + ok) / 2;
        if (check(x)) ok = x;
        else ng = x;
    }
    cout << ok << endl;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, M;
    cin >> N >> M;
    cout << (1900 * M + 100 * (N - M)) * (1LL << M) << endl;
    return 0;
}


Measured memory_bytes: 256
AC="AC"
WA="WA"
TLE="TLE"
RE="RE"
n=int(input())
l=[str(input()) for i in range(n)]
a=(l.count(AC))
w=(l.count(WA))
t=(l.count(TLE))
r=(l.count(RE))
print(f"AC x {a}")
print(f"WA x {w}")
print(f"TLE x {t}")
print(f"RE x {r}")

Measured memory_bytes: 16112
#include <iostream>
using namespace std;
int main(void){
    int n, x, i;
    i = 1;
    cin >> n;
    while(i <= n){
        x = i;
        if(x % 3 == 0){
            cout << " " << i;
        }
        else{
            while(x){
                if(x % 10 == 3){
                cout << " " << i;
                break;
                }
                x /= 10;
            }
        }
        i++;
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3068
#include <iostream>
#include <string>
#include <sstream>
#include <set>
#include <numeric>

using namespace std;

long long calc(string S, int plus_mask)
{
	const int n = S.length() - 1;
	int pos = 1;
	for (int i = 0; i < n; ++i) {
		if (plus_mask & (1 << i)) {
			S.insert(pos, 1, ' ');
			pos += 2;
		}
		else {
			pos += 1;
		}
	}
	
	long long ans = 0;
	istringstream iss(S);
	for (long long term; iss >> term;) {
		ans += term;
	}
	return ans;
}

long long solve(const string &S)
{
	const int n = S.length() - 1;

	set<long long> answers;
	long long ans = 0;
	for (int i = 0; i < (1 << n); ++i) {
		ans += calc(S, i);
	}
	return ans;
}

int main()
{
	string S;
	cin >> S;
	cout << solve(S) << endl;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (n, x, y) = (v[0], v[1] - 1, v[2] - 1);
    let mut edges = vec![vec![]; n];
    for i in 0..n - 1 {
        edges[i].push(Edge { to: i + 1, cost: 1 });
        edges[i + 1].push(Edge { to: i, cost: 1 });
    }
    edges[x].push(Edge { to: y, cost: 1 });
    edges[y].push(Edge { to: x, cost: 1 });

    let mut answers = vec![0; n];
    for i in 0..n {
        let costs = solve(&edges, i);
        for cost in costs {
            answers[cost as usize] += 1;
        }
    }
    for &ans in answers.iter().skip(1) {
        println!("{}", ans / 2);
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

use std::cmp::Ordering;
use std::collections::BinaryHeap;
const INF: i64 = 100000_00000_00000;

#[derive(PartialEq, Debug)]
struct MinInt {
    value: i64,
}

impl Eq for MinInt {}

impl PartialOrd for MinInt {
    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
        other.value.partial_cmp(&self.value)
    }
}

impl Ord for MinInt {
    fn cmp(&self, other: &MinInt) -> Ordering {
        other.value.cmp(&self.value)
    }
}

fn make_pair(x: i64, y: usize) -> (MinInt, usize) {
    (MinInt { value: x }, y)
}

#[derive(Debug, Clone)]
struct Edge {
    to: usize,
    cost: i64,
}

fn solve(edges: &Vec<Vec<Edge>>, start_idx: usize) -> Vec<i64> {
    let num_apexes = edges.len();
    let mut d = vec![INF; num_apexes];
    d[start_idx] = 0;
    let mut que = BinaryHeap::new();
    que.push(make_pair(0, start_idx));

    while let Some((u, v)) = que.pop() {
        if d[v] < u.value {
            continue;
        }
        for e in &edges[v] {
            if d[v] != INF && d[e.to] > d[v] + e.cost {
                d[e.to] = d[v] + e.cost;
                que.push(make_pair(d[e.to], e.to));
            }
        }
    }
    d
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll s, w;
    cin >> s >> w;
    if (w >= s) {
        cout << "unsafe" << endl;
    } else {
        cout << "safe" << endl;
    }
    return 0;
}



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

int main() {
    int n;
    cin>>n;
    vector<int>a(n,0),b(n,0);
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    int f=0;
    for(int i=2;i<n;i++){
        if(a[i]==b[i] && a[i-1]==b[i-1] && a[i-2]==b[i-2]){
            f=1;
            break;
        }
    }
    if(f==1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3628
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353 
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
	int n;string s; cin>>n>>s;
	bool bd=0;
	if(n%2==1)bd=1;
	else{
		rep(i,n/2){
			if(s[i] != s[i+n/2]) bd=1;
		}
	}
	puts(bd?"No":"Yes");
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>

#define	mp			make_pair
#define	rep(i,n)	for(int i=0;i<n;i++)

using namespace std;

typedef	vector<int>		vi;
typedef	pair<int,int>	pii;

class UnionFind{
	vi a;
	int root(int x){ return ~a[x]?a[x]=root(a[x]):x; }
public:
	UnionFind(int n):a(n,-1){}
	bool find(int x,int y){ return root(x)==root(y); }
	bool unite(int x,int y){ return find(x,y)?0:(a[root(y)]=root(x),1); }
};

int main(){
	for(int m,n;scanf("%d%d",&n,&m),n;){
		pair<int,pii> packet[20000];
		rep(i,m)	scanf("%d%d%d",&packet[i].first,&packet[i].second.first,&packet[i].second.second);
		sort(packet,packet+m);

		int ans=1;
		UnionFind link(n+1);
		rep(i,m){
			int src=packet[i].second.first,dst=packet[i].second.second;
			if(link.find(1,src))	ans+=link.unite(src,dst);
		}
		printf("%d\n",ans);
	}

	return 0;
}

Measured memory_bytes: 1128
#include <algorithm>
#include <cctype>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

int main(void) {
    int a, b;
    cin >> a >> b;
    cout << ((a + b) % 24) << endl;
    return 0;
}


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

using namespace std;

#define lli long long unsigned int
#define REP(i,n) for(int i=0;i<n;i++)
#define DEBUG 0

int main(){

	lli n;
	cin>>n;
	lli ans = n/11*2;
	if( 1<= n%11&& n%11 <= 6){
		ans++;
	}
	else if (n%11==0){}
	else{
		ans+=2;
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#define int long long
using namespace std;
signed main() {
	string s; cin >> s;
	int p = 0, ans = 0;
	for (int i = 0; i < s.size(); i++) {
		p += (s[i] == 'R' ? 1 : -1);
		if (p == 4) { ans++; p = 0; }
		if (p == -4)p = 0;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3216
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{   
    set<char> st;
    int N; cin>>N;
    REP(i,N){
        char c; cin>>c;
        st.insert(c);
    }
    if(st.size()==3)
        cout<<"Three"<<endl;
    else
        cout<<"Four"<<endl;
}


Measured memory_bytes: 256
n=int(input())
x=list(map(int,input().split()))
for i in range(n):
  x[i] = [x[i], i]
x.sort(key=lambda x:x[0])
for i in range(n):
  if i < n//2:
    x[i] += [x[n//2][0]]
  else:
    x[i] += [x[n//2-1][0]]
# x[i] = [value, init_index, b_i]
x.sort(key=lambda x:x[1])
for i in range(n):
  print(x[i][2])

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

using namespace std;
typedef long long ll;
const ll INF = 1e10;
const ll MOD = 1e9 + 7;

int main(){
    int A, B; cin >> A >> B;
    cout << max(A + B, max(A - B, A * B)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int N;
int left[26], right[26];

void preorder(int x) {
  printf(" %d", x);
  if(left[x] != -1) preorder(left[x]);
  if(right[x] != -1) preorder(right[x]);
}
void inorder(int x) {
  if(left[x] != -1) inorder(left[x]);
  printf(" %d", x);
  if(right[x] != -1) inorder(right[x]);
}
void postorder(int x) {
  if(left[x] != -1) postorder(left[x]);
  if(right[x] != -1) postorder(right[x]);
  printf(" %d", x);
}

int main() {
  int i,j;
  int isRoot[26];
  scanf("%d", &N);
  for(i = 0; i < N; ++i) {
    left[i] = right[i] = -1;
    isRoot[i] = 1;
  }

  for(i = 0; i < N; ++i) {
    int id  ;
    scanf("%d", &id);
    scanf("%d %d", left+id, right+id);
    if(left[id] != -1) isRoot[left[id]] = 0;
    if(right[id] != -1) isRoot[right[id]] = 0;
  }
  for(i = 0; i < N; ++i) {
    if(isRoot[i]) {
      printf("Preorder\n");
      preorder(i); printf("\n");
      printf("Inorder\n");
      inorder(i); printf("\n");
      printf("Postorder\n");
      postorder(i); printf("\n");
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    unsigned long long a[3];
    cin >> a[0] >> a[1] >> a[2];

    if (a[2] <= a[0] + a[1])
    {
        Yes(0);
        return 0;
    }

    unsigned long long tmp = a[2] - a[0];
    tmp -= a[1];

    unsigned long long right = tmp * tmp;
    unsigned long long left = 4 * a[0] * a[1];

    if (left < right)
    {
        Yes(1);
    }
    else
    {
        Yes(0);
    }
}

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


int main(void){
 int K;
 cin >> K;
 if(K%2 == 0){
  cout << (K/2) * (K/2) << endl;
 }else{
  cout << (K/2) * (K/2 + 1) << endl;
 }
}


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

#define ok puts("ok");

using namespace std;

const int N = (int)1e5 + 7;

string s;
int n, siz = 1;
int p[N];

main() {      
	cin >> s;
	s = " " + s;
	n = s.size() - 1;
	if (s.back() == '1') {
		cout << -1;
		return 0;
	}
	for (int i = 1; i < n; i++) {
		if (s[i] != s[n - i]) {
			cout << -1;
			return 0;
		}
	}
	if (s[1] != '1') {
		cout << -1;
		return 0;
	}
	int cur = 1;
	for (int i = 1; i <= n; i++) {
		p[i] = 1;
	}
	int lst = -1;
	for (int i = n / 2; i >= 1; i--) {
		if (s[i] == '1') {
			int asd = cur;							
			for (int j = 1; j <= lst - i - 1; j++) {
				p[++cur] = asd;
			}                  
			p[++cur] = asd;
			lst = i;
		}
	}
	for (int i = 2; i <= n; i++) {
		printf("%d %d\n", i, p[i]);
	}
}

Measured memory_bytes: 1788
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;


int main() {
    ll n,ans=0;
    cin>>n;
    if(n%2!=0)
    {
        cout<<0<<endl;
        return 0;
    }
    n/=2;
    while(n>0)
    {
        ans+=n/=5;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
S = input()
T = input()

lens = len(S) - len(T) + 1

for i in reversed(range(lens)) :
    flag = True
    for j in range(len(T)) :
        if S[i+j] != T[j] and S[i+j] != "?":
            flag = False
    if flag == True :
        ans = S[:i] + T + S[i+len(T):]
        print(ans.replace("?", "a"))
        exit()

print("UNRESTORABLE")


Measured memory_bytes: 3060
n = gets.to_i
as = gets.split.map(&:to_i)

ss = Array.new(n + 1, 0)
min = 2020202020
total = as.inject(:+)

as.each_with_index do |a, i|
  sl = ss[i + 1] = ss[i] + a
  sr = total - sl

  min = (sl - sr).abs if (sl - sr).abs <= min
end

puts min


Measured memory_bytes: 17668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	string s;
	cin>>s;
	ll ans = 1;
	for(ll i=1;i<n;i++)
	{
		if (s[i]!=s[i-1])
			ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Program
{
    public class ABC124A
    {
        static public void Main(string[] args)
        {
            var A = NextInt;
            var B = NextInt;

            if (A == B) Console.WriteLine(A + B);
            else Console.WriteLine(Math.Max(A, B) * 2 - 1);
        }

        static class Console_
        {
            private static Queue<string> param = new Queue<string>();
            public static string NextString()
            {
                if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item);
                return param.Dequeue();
            }
        }
        static int NextInt => int.Parse(Console_.NextString());
        static int[] NextIntArray(int N)
        {
            var ret = new int[N];
            for (int i = 0; i < N; ++i) ret[i] = NextInt;
            return ret;
        }
        static long NextLong => long.Parse(Console_.NextString());
        static long[] NextLongArray(int N)
        {
            var ret = new long[N];
            for (int i = 0; i < N; ++i) ret[i] = NextLong;
            return ret;
        }
        static string NextString => Console_.NextString();
        static void Rep(int count, Action<int> func)
        {
            for (int i = 0; i < count; ++i) func(i);
        }
        static void Rep(int count, Action func)
        {
            for (int i = 0; i < count; ++i) func();
        }
        static void Foreach<T>(IEnumerable<T> list, Action<T> func)
        {
            foreach (var item in list) func(item);
        }
        static void Foreach<T>(IEnumerable<T> list, Action<T, int> func)
        {
            int idx = -1;
            foreach (var item in list) func(item, ++idx);
        }
        static IEnumerable<long> Prime(long x)
        {
            if (x < 2) yield break;
            yield return 2;
            var halfx = x / 2;
            var table = new bool[halfx + 1];
            var max = (long)(Math.Sqrt(x) / 2);
            for (long i = 1; i <= max; ++i)
            {
                if (table[i]) continue;
                var add = 2 * i + 1;
                yield return add;
                for (long j = 2 * i * (i + 1); j <= halfx; j += add) table[j] = true;
            }
            for (long i = max + 1; i <= halfx; ++i) if (!table[i]) yield return 2 * i + 1;
        }
        static IEnumerable<long> Divisor(long x)
        {
            if (x < 1) yield break;
            var max = (long)Math.Sqrt(x);
            for (long i = 1; i < max; ++i)
            {
                if (x % i != 0) continue;
                yield return i;
                if (i != x / i) yield return x / i;
            }
        }
        static long GCD(long a, long b)
        {
            long tmpa = a, tmpb = b;
            while (tmpb > 0) { var tmp = tmpb; tmpb = tmpa % tmpb; tmpa = tmp; }
            return tmpa;
        }
    }
}


Measured memory_bytes: 13396
d,g = map(int,input().split())
p = [list(map(int,input().split())) for i in range(d)]
ans = float('inf')
for i in range(2**d):
  solved = 0
  point = 0
  luck = -1
  for j in range(d):
    if i >> j & 1:
      # pi問題をすべてといた場合の得点を加算
      point += 100 * (j+1) * p[j][0] + p[j][1]
      solved += p[j][0]
    #elif luck < 0:
    else:
      luck = j
  #全問とかないようにするため
  k = 0
  # 不完全解答するのは最も配点が高い大問1第のみ
  while k < p[luck][0] and point < g:
    point += 100 * (luck + 1)
    k += 1
    solved += 1
  if point >= g and solved < ans:
    ans = solved
print(ans)


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
int main()
{
  fast_io;
  int a, b;
  cin >> a >> b;
  
  if ((a == 1 && b == 2) || (a == 2 && b == 1))
    cout << 3 << endl;
  else if ((a == 1 && b == 3) || (a == 3 && b == 1))
    cout << 2 << endl;
  else if ((a == 2 && b == 3) || (a == 3 && b == 2))
    cout << 1 << endl;
  
  return 0;
}

Measured memory_bytes: 3176
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;
constexpr Int INF = INT_MAX;
constexpr Int mod = 1e9 + 7;

//a, a + 1, a + 2, ... , b - 1, bの総和を求める関数(a <= b)。計算量はO(1)
Int Sum(Int a, Int b) {
	if (b < a)return 0;
	if ((b - a + 1) % 2 == 0)return (a + b) * (b - a + 1) / 2;
	else return (a + b) * ((b - a + 1) / 2) + (a + b) / 2;
}

void calc() {

	Int N, K; std::cin >> N >> K;
	Int sum = 0;
	for (Int s = K; s <= N + 1; ++s) {
		Int min = Sum(0, s - 1);
		Int max = Sum(N - s + 1, N);
		sum += (max - min + 1);
		sum %= mod;
	}
	std::cout << sum;

}


int main() {

	calc();

	return 0;
}

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{

    internal class Solution
    {
        public void Run()
        {
            while(true)
            {
                var line = Console.ReadLine();
                if (line == null) break;

                var vals = line.Split(' ').Select(int.Parse).ToArray();
                int A = vals[0];
                int B = vals[1];
                Console.WriteLine("{0} {1}", Util.GCD(A, B), Util.LCM(A, B));
            }

        }
    }

    // libs ----------
    class Util
    {
        public static int GCD(int a, int b)
        {
            return b == 0 ? a : GCD(b, a % b);
        }

        public static int LCM(int a, int b)
        {
            return a / GCD(a, b) * b;
        }
    }

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}


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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define FOR(i,m,n) for(int i=(m) ; i<(n) ; i++)
#define FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

typedef long long ll;
typedef unsigned long long ull;

const int INF = 999999999;

int main(){
   int x,a,b;cin>>x>>a>>b;
   cout << (min(abs(x-a),abs(x-b))==abs(x-a)?"A":"B");
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;


int main() {
  int S,h,m,s;
  cin >> S;
  s = S % 60;
  m = (S / 60) % 60;
  h = S / 3600;
  cout << h << ":" << m << ":" << s << endl;
  return 0;
}



Measured memory_bytes: 3092
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e18;
const ll mod=1e9+7;


int main(){
    ll n;
    cin >> n;
    vector<pll> divcnt(n);
    vector<pll> two,five;
    vector<ll> b(18);
    vector<vector<ll>> sum(50);
    ll v=1;
    rep(i,18){
        b[i]=v;
        v*=10;
    }
    rep(i,n){
        string s;
        cin >> s;
        ll p=s.length();
        ll cnt=0;
        string t="";
        bool good=false;
        rep(j,p){
            if(s[j]=='.'){
                good=true;
                continue;
            }
            else{
                t+=s[j];
            }
            if(good){
                cnt++;
            }
        }
        ll val=0;
        rep(j,10-cnt){
            t+='0';
        }
        ll u=t.length();
        //cout << t << endl;
        rep(j,u){
            val+=(ll)(t[j]-'0')*b[u-1-j];
        }
        //cout << val << endl;
        ll cnt1=0,cnt2=0;
        while(val%2==0){
            cnt1++;
            val/=2;
        }
        while(val%5==0){
            cnt2++;
            val/=5;
        }
        //cout << val << endl;
        two.push_back({cnt1,i});
        five.push_back({cnt2,i});
        divcnt[i].fi=cnt1;
        divcnt[i].se=cnt2;
        sum[cnt2].push_back(cnt1);
    }
    
    rep(i,20){
        sort(sum[i].begin(),sum[i].end());
    }
    sort(two.begin(),two.end());
    sort(five.begin(),five.end());
    ll ans=0;
    rep(i,n){
        ll x=divcnt[i].fi;
        ll y=divcnt[i].se;
        ll tot=0;
        for(ll j=20-y;j<50;j++){
            if(sum[j].size()==0) continue;
            auto it=lower_bound(sum[j].begin(),sum[j].end(),20-x)-sum[j].begin();
            tot+=sum[j].size()-it;
        }
        if(2*x>=20 && 2*y>=20) tot--;
        ans+=tot;
    }
    ans/=2;
    cout << ans << endl;
    return 0;
}

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

using namespace std;

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

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

const int MAX_N=114514;
ll fact[MAX_N], fact_inv[MAX_N];

ll power(ll a, ll b){
	ll res=1;
	while(b>0){
		if(b&1){
			res=res*a%MOD;
		}
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

ll comb(ll n, ll r){
	return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}

void init_comb(int n){
	fact[0]=1;
	REP(i, n){
		fact[i+1]=fact[i]*(i+1)%MOD;
	}
	fact_inv[n]=power(fact[n], MOD-2);
	FORR(i, 0, n){
		fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
	}
	return;
}

// 素因数分解
vector<pii> prime_factor(int n){
	vector<pii> res;
	for(int i=2; i*i<=n; ++i){
		if(n%i!=0){
			continue;
		}
		int num=0;
		while(n%i==0){
			++num;
			n/=i;
		}
		res.push_back(pii(i, num));
	}
	if(n!=1){
		res.push_back(pii(n, 1));
	}
	return res;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin>>n>>m;
	vector<pii> f=prime_factor(m);
	init_comb(n+30);
	ll ans=1;
	for(auto i : f){
		ans=(ans*comb((i.second+n-1), n-1))%MOD;
	}
	cout<<ans<<'\n';
	return 0;
}


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

int main() {
  int n,ans;
  cin >> n;
  ans = 0;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  for(int i=0;i<n;i++){
    if(i%2 == 1)
      continue;
    if(vec.at(i)%2 == 1){
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 3624
import sys
sys.setrecursionlimit(10**9)
f=lambda:map(int,sys.stdin.readline().split())
n,st,sa=f()
g=[set() for _ in range(n)]
for _ in range(n-1):
  a,b=f()
  g[a-1].add(b-1)
  g[b-1].add(a-1)
def dfs(l,v,p=-1,d=0):
  l[v]=d
  for c in g[v]:
    if c!=p: dfs(l,c,v,d+1)
lt=[0]*n
dfs(lt,st-1)
la=[0]*n
dfs(la,sa-1)
print(max(la[i] for i in range(n) if lt[i]<la[i])-1)

Measured memory_bytes: 129420
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }
const ll MOD = 1000 * 1000 * 1000 + 7;
int main() {
  string L; cin>>L;
  ll ans = 1;
  ll rem = 1LL;
  REP(i, L.length()) {
    ans = ans * 3LL;
    if(L[i] == '1') {
      rem = (rem * 2LL) % MOD;
    } else {
      ans -= (rem * 2LL);
    }
    ans = (ans + 2LL * MOD) % MOD;
    //    cout << i << "," << L[i] << "," << ans << "," << rem << endl;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(2e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

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


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String input = ""; // 入力された(H,W)を一時敵に保持しておくための変数
		String[] inputdata = new String[2]; // inputの変数を配列に保持しておくための変数
		// int H = Integer.parseInt(data[0]);
		// int W = Integer.parseInt(data[1]);
		int Max = 10000;
		int n = 0; // 入力されたデータ(H, W)の組数をカウントするための変数
		int[][] HW_data = new int[Max][2];
		boolean judge = true;
		String output = "#";

		out: for (int i = 0; i < HW_data.length; i++) {

			input = sc.nextLine();
			inputdata = input.split(" ");
			HW_data[i][0] = Integer.parseInt(inputdata[0]);
			HW_data[i][1] = Integer.parseInt(inputdata[1]);

			if ((HW_data[i][0] == 0) && (HW_data[i][1] == 0)) {
				break out;
			}

			if ((HW_data[i][0] < 1 || HW_data[i][0] > 300)
					|| (HW_data[i][1] < 1 || HW_data[i][1] > 300)) {
				judge = false;
				break out;
			}

			n++;

		}
		if (judge == true) {
			for (int i = 0; i < n; i++) {
				for (int j = 1; j <= HW_data[i][0]; j++) {
					for (int k = 1; k <= HW_data[i][1]; k++) {
						System.out.print(output);
					}
					System.out.println();
				}
				System.out.println();
			}
		}

	}

}



Measured memory_bytes: 35524
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <cmath>
#include <numeric>
#include <functional>
#include <stack>
#include <iomanip>
#include <map>
#include <cstdio>

int main() {
	long long a, b;

	std::cin >> a >> b;

	std::cout << a * (a - 1) / 2 + b * (b - 1) / 2 << std::endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a, b, c, d , e ,f ;
	float x, y;
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=-1){
		x = (float)(c * e - b * f) / (a * e - b * d);
		y = (float)(-d * c + a * f) / (a * e - b * d);
		//x += 0.0005;
		//y += 0.0005;
		if (x <= 0 && x > -0.0005) x = 0;
		if (y <= 0 && y > -0.0005) y = 0;
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

Measured memory_bytes: 632
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int main(){
    int h,a;
  int ans=0;
    scanf("%d %d",&h,&a);
  if(h%a==0)
    ans=h/a;
  else
    ans=h/a+1;
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define endl "\n"    
typedef long long ll;
#define double long long
//#define int unsigned long long

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin>>n;
    int arr[n+10];
    for(int i=1;i<=n;i++)
    cin>>arr[i];
    int cnt=0;
    int max1=0;
    for(int i=1;i<n;i++)
    {
        if(arr[i]>=arr[i+1])
        {
            ++cnt;
        }
        else
        {
            cnt=0;
        }
        max1=max(max1,cnt);
    }
    cout<<max1;

}    

Measured memory_bytes: 640
#include<stdio.h>
#define MAX 100001
#define INI 2000000000

 struct Card{
           char gara;
           int value;
           };

 int merge(struct Card card1[],int n,int left,int right,int mid){
          int i,n1,n2,j,k;
          struct Card L[MAX/2+2],R[MAX/2+2];
          n1=(mid-left);
          n2=(right-mid);
          for(i=0;i<n1;i++){L[i]=card1[left+i];}
          for(j=0;j<n2;j++){R[j]=card1[mid+j];}
          L[n1].value=INI;
          R[n2].value=INI;
          
          i=0;j=0;
          for(k=left;k<right;k++){
                      if(L[i].value<=R[j].value){card1[k]=L[i];i++;}
                      else {card1[k]=R[j];j++;}
                      }
          }
          

 int mergesort(struct Card card1[],int n,int left,int right){
          int mid;
          if(right-left>1){
                    mid=(left+right)/2;
                    mergesort(card1,n,left,mid);
                    mergesort(card1,n,mid,right);
                    merge(card1,n,left,right,mid);
                    }
           }

 int part(struct Card card2[],int n,int left,int right){
      struct Card tmp,key;
      key=card2[right];
      int i,j;
      
      i=left-1;
      for(j=left;j<right;j++){
               if(card2[j].value<=key.value){
                                i++;
                                tmp=card2[i];card2[i]=card2[j];card2[j]=tmp;
                                }
               }
       i++;
       tmp=card2[i];card2[i]=card2[right];card2[right]=tmp;
       return i;
       }
   

 int quick(struct Card card2[],int n,int left,int right){
      int q;
      if(left<right){
          q=part(card2,n,left,right);
          quick(card2,n,left,q-1);
          quick(card2,n,q+1,right);
          }
       }

 int main(){
        int n,v,flag=1,i;
        struct Card card1[MAX];
        struct Card card2[MAX];
        char c[10];
        scanf("%d",&n);
        for(i=0;i<n;i++){
                  scanf("%s%d",&c,&v);
                  card2[i].gara=card1[i].gara=c[0];
                  card2[i].value=card1[i].value=v;
                  }

        mergesort(card1,n,0,n);
        quick(card2,n,0,n-1);

        for(i=0;i<n;i++){
                  if(card1[i].gara!=card2[i].gara)flag=0;
                  }
        if(flag==1){printf("Stable\n");}
        else {printf("Not stable\n");}

        for(i=0;i<n;i++){printf("%c %d\n",card2[i].gara,card2[i].value);}
        return 0;
        }






Measured memory_bytes: 4056
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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

int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



P func(int n){
  int a=n%10,b;
  while(n){
    b = n;
    n/=10;
  }
  return P(a,b);
}


int main(){
  int N;
  cin >> N;
  map<P,int> mp;
  for(int i=1;i<=N;i++){
    P p = func(i);
    mp[P(p.first,p.second)]++;
  }

  int ans = 0;
  for(int i=1;i<=N;i++){
    P p = func(i);
    P q(p.second,p.first);
    ans += mp[q];
  }

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




Measured memory_bytes: 256
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <queue>
#include <string>
#include <sstream>
#include <vector>
 
typedef std::uint_least64_t cost_t;
#define COST_INF UINT_LEAST64_MAX
 
struct Edge {
    int target;
    int distance;
};
 
struct Node {
    std::vector<Edge> edges;
    cost_t cost;
 
    Node() : cost(COST_INF) {}
};
 
int main()
{
    int v, e, r;
    std::cin >> v >> e >> r;
 
    std::vector<Node> nodes(v);
    nodes[r].cost = 0;
 
    for (int i = 0; i < e; i++) {
        int s, t, d;
        std::cin >> s >> t >> d;
        nodes[s].edges.push_back({ t, d });
    }
 
    auto greater_node = [&](int x, int y) { return nodes[x].cost > nodes[y].cost; };
    std::priority_queue<int, std::vector<int>, decltype(greater_node)> queue(greater_node);
    queue.push(r);
 
    while (!queue.empty()) {
        Node& node = nodes[queue.top()];
        queue.pop();
 
        for (Edge e : node.edges) {
            Node& target = nodes[e.target];
            cost_t new_cost = node.cost + e.distance;
            if (new_cost < target.cost) {
                target.cost = new_cost;
                queue.push(e.target);
            }
        }
    }
 
    for (Node& node : nodes) {
        if (node.cost == COST_INF)
            std::cout << "INF";
        else
            std::cout << node.cost;
        std::cout << std::endl;
    }
 
    return 0;
}

Measured memory_bytes: 12780
def f(x):
	if x % 2 == 0:
		return x//2
	else:
		return 3*x+1
 
s = int(input())
a = [s]
m = 1
while True:
	t = f(s)
	m += 1
	if t not in a:
		a.append(t)
		s = t
	else:
		break
print(m)

Measured memory_bytes: 3188
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
B = set([int(input()) for _ in range(N)])

def check(line, num_set):
  for num in line:
    if(not(num in num_set)):
      return False
  return True

if (check([A[0][0], A[0][1], A[0][2]], B)
    or check([A[1][0], A[1][1], A[1][2]], B)
    or check([A[2][0], A[2][1], A[2][2]], B)
    
    or check([A[0][0], A[1][0], A[2][0]], B)
    or check([A[0][1], A[1][1], A[2][1]], B)
    or check([A[0][2], A[1][2], A[2][2]], B)
    
    or check([A[0][0], A[1][1], A[2][2]], B)
    or check([A[2][0], A[1][1], A[0][2]], B)):
  print("Yes")
else:
  print("No")



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

namespace AtCoderPractice0704
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            long[] NR = Console.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();

            long  N = NR[0];
            long  K = NR[1];
            long ans=0;

            while (N /K >=1)
            {
                ans++;
                N /= K;
            }

            Console.WriteLine(ans+1);
        }
    }
}


Measured memory_bytes: 27712