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

int main() {
    long long N;
    long long Blue;
    long long Red; 
    cin >> N >> Blue >> Red;
    long long BR = Blue + Red;
    long long BR_count = N / BR;
    N = N % BR;
    long long tot_count = BR_count * Blue;
    if (N >= Blue) {
        tot_count += Blue;
    } else {
        tot_count += N;
    } cout << tot_count << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _LIBCPP_DEBUG 0
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;
int INF = 1 << 30;

int main(void){

    ll N,K; cin>>N>>K;
    ll ans = N % K;
    ans = min(ans, abs(ans - K));
    cout<<ans<<endl;

    return 0;
}

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

int main( void )
{
    int a, b;
    char op;
    cin >> a >> op >> b;
    if ( op == '+' )
    {
        cout << a + b << endl;
    }
    else
    {
        cout << a - b << endl;
    }

    return 0;
}


Measured memory_bytes: 256
/*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither into the truth.
	  	  	- William Butler Yeats
*/
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#ifndef LOCAL
#define cerr if(0)cout
#endif
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int n;
int main(){
	cin>>n;
	for(int i=1;i<=9;i++){
		if(n%i==0&&n/i<=9){
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 200005
int a[maxn];
int main(){
	int n;scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",a+i),a[i]-=i;
	sort(a,a+n);
	int mid=n>>1;
	long long ans=0;
	for(int i=0;i<n;i++)ans+=abs(a[mid]-a[i]);
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1024
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, double> pid;
typedef pair<double, int> pdi;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int ans[30], cnt[30];

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

	fill(ans, ans + 30, 100);

	int N;
	string S;

	cin >> N;
	rep(i, 0, N)
	{
		cin >> S;
		fill(cnt, cnt + 30, 0);
		rep(j, 0, SZ(S))
		{
			cnt[S[j] - 'a']++;
		}
		rep(j, 0, 26)
		{
			chmin(ans[j], cnt[j]);
		}
	}

	rep(i, 0, 26)
	{
		rep(j, 0, ans[i])
		{
			cout << (char)('a' + i);
		}
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
/*****************************************************

*****************************************************/

#include<bits/stdc++.h>
#define MAX 9223372036854775807
#define endl "\n"
#define ll long long
#define int long long
#define pb push_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define ip pair<int, int>

#define loop(i,n) for(int i=0;i<n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
using namespace std;

const ll MOD = 1e9+7;
const ll SZ = 107;
const ll N = 2e5+7;
const ll inf = 1e17;

int pwr(int x, int y)
{
    ll r = 1LL;
    while(y)
    {
        if(y&1)
            r = (r * x) % MOD;
        y >>= 1;
        x = (x * x) % MOD;
    }
    return r % MOD;
}

int inv(int x)
{
    return pow(x, MOD-2);
}

void solve()
{
    string s; cin>>s;
    int n = s.size();
    int c = 15-n;
    for(auto i : s)
        if(i=='o')
            c++;
    if(c>=8)
        cout<<"YES";
    else
        cout<<"NO";
}

signed main()
{
    fast;

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

/*****************************


****************************/

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  
  int left = 0, right = 0;
  for(int i = 0; i < n; i++){
    if(s.at(i) == '(') left++;
    else if(left > 0) left--;
    else right++;
  }
  
  for(int i = 0; i < right; i++) cout << '(';
  cout << s;
  for(int i = 0; i < left; i++) cout << ')';
  cout << endl;
}

Measured memory_bytes: 3624
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
      
        List<Integer> list = new ArrayList<>();
        while (sc.hasNext()) {
            list.add(sc.nextInt());
        }

        Collections.sort(list);
        String max = String.valueOf(list.get(2)) + String.valueOf(list.get(1));
        int result = Integer.parseInt(max) + list.get(0);
      
        System.out.println(result);
    }
}


Measured memory_bytes: 39508
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  ll a, b;
  cin >> a >> b;
  cout << a / __gcd(a,b) * b;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
ans = n
s = 0
b = [0 for i in range(n)]
for i in range(n):
    b[i] = a[i]
for i in range(1,n):
    if i%2 == 1:
        if b[i] > b[i-1]:
            flag = True
            if i < n-1:
                if b[i-1] > b[i+1] and b[i+1] < b[i]:
                    v = b[i+1]
                    b[i+1] = b[i]
                    b[i] = v
                    flag = False
            if flag:
                v = b[i-1]
                b[i-1] = b[i]
                b[i] = v
            s += 1
    else:
        if b[i] < b[i-1]:
            flag = True
            if i < n-1:
                if b[i-1] < b[i+1] and b[i+1] > b[i]:
                    v = b[i+1]
                    b[i+1] = b[i]
                    b[i] = v
                    flag = False
            if flag:
                v = b[i-1]
                b[i-1] = b[i]
                b[i] = v
            s += 1
ans = min(ans, s)

s = 0
for i in range(n):
    b[i] = a[i]
for i in range(1,n):
    if i%2 == 0:
        if b[i] > b[i-1]:
            flag = True
            if i < n-1:
                if b[i-1] > b[i+1] and b[i+1] < b[i]:
                    v = b[i+1]
                    b[i+1] = b[i]
                    b[i] = v
                    flag = False
            if flag:
                v = b[i-1]
                b[i-1] = b[i]
                b[i] = v
            s += 1
    else:
        if b[i] < b[i-1]:
            flag = True
            if i < n-1:
                if b[i-1] < b[i+1] and b[i+1] > b[i]:
                    v = b[i+1]
                    b[i+1] = b[i]
                    b[i] = v
                    flag = False
            if flag:
                v = b[i-1]
                b[i-1] = b[i]
                b[i] = v
            s += 1
ans = min(ans, s)
print(ans)



Measured memory_bytes: 16984
n, m, x, y = map(int, input().split())

xs = sorted(map(int, input().split()))
ys = sorted(map(int, input().split()))

max_x, min_y = xs[-1], ys[0]

if x > max_x:
    max_x = x
if y < min_y:
    min_y = y

if max_x < min_y:
    print("No War")
else:
    print("War")

Measured memory_bytes: 3064
#include <stdio.h>
int main(void)
{
	int h,w,i,j,x[101],y[101];
	char s[101][101];
	scanf("%d%d",&h,&w);
	for(i=0; i<h; i++){
		scanf("%s",s[i]);
	}
	for(i=0; i<h; i++){
		for(j=0; j<w; j++){
			if(s[i][j]=='#'){
				x[i]=1;
				break;
			}
		}
	}
	for(i=0; i<w; i++){
		for(j=0; j<h; j++){
			if(s[j][i]=='#'){
				y[i]=1;
				break;
			}
		}
	}
	for(i=0; i<h; i++){
		for(j=0; j<w; j++){
			if(x[i]==1 && y[j]==1){
				printf("%c",s[i][j]);
			}
		}
		if(x[i]==1){
			puts("");
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int c1, c2, c3;
double si;

int main(){
	while (cin >> c1 >> c2 >> c3){
		si = 0;
		for (int i = 1; i <= 10; i++){
			if (i == c1 || i == c2 || i == c3)continue;
			if (i <= 20 - c1 - c2)si++;
		}
		if (si / 7 >= 0.5)cout << "YES\n";
		else cout << "NO\n";
	}
}

Measured memory_bytes: 1120
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long in = sc.nextLong();
		long ans = in / 11 * 2;
		long mod = in % 11;
		
		if (mod != 0) ans += (mod <= 6) ? 1 : 2;
		
		System.out.println(ans);		
	}
}


Measured memory_bytes: 21844
#include <stdio.h>

int main(void)
{
	int K, S;
	int X, Y, Z;
	int cnt = 0;

	scanf("%d", &K);
	scanf("%d", &S);

	for (X = 0; X <= K; X++) {
		for (Y = 0; Y <= K; Y++) {
			Z = S - X - Y;
			if (0 <= Z && Z <= K)
				cnt++;
		}
	}

	printf("%d", cnt);
	return 0;
}

Measured memory_bytes: 128
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

// https://atcoder.jp/contests/hokudai-hitachi2019-1/submissions/10518254

macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}


pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: u32 = 1_000_000_007;
const INF: i64 = std::i64::MAX/3;

fn solve() {
	let (x,y) = read!(i64,i64);
	for i in 0..x+1 {
		for j in 0..x+1 {
			if i+j!=x {
				continue;
			}
			if 2*i+4*j==y {
				println!("Yes");
				return;
			}
		}
	}
	println!("No");
}

fn run() {
    solve();
}


Measured memory_bytes: 2268
import java.util.Scanner;

public class Main {
	int check(char[] bar, char[] board){
		int space, pos;
		for(int i = 0; i < board.length; i++){
			if(bar[0] == board[i]) {
				for(int j = i + 1; j < board.length; j++){
					if(bar[1] == board[j]) {
						space = j - i;
						if( board.length <= space * (bar.length - 1) + i) break; // ??????????????§???????????°
						pos = j;
						for(int k = 2; k < bar.length; k++){
							pos += space;
							if(bar[k] != board[pos]){
								break;
							} else if(k == bar.length - 1) {
								return 1;
							}
						}
					}
				}
			}
		}
		return 0;
	}

	void doIt(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), cnt = 0;
		char[] bar = sc.next().toCharArray();
		for(int i = 0; i < n; i++){
			char[] board = sc.next().toCharArray();
			cnt += check(bar, board);
		}
		System.out.println(cnt);
	}

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

Measured memory_bytes: 27304
using System;
class Practice
{
    public static void Main()
    {
        int S = int.Parse(Console.ReadLine());
        int h = S / 3600;
        S -= h * 3600;
        int m = S / 60;
        S -= m * 60;
        Console.WriteLine("{0}:{1}:{2}", h, m, S);
    }
}


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

int main() {
  int a;
  int b;
  int t;
  double end;
  int time;
  int bis;
  cin >> a >> b >> t;
    
  	end = t + 0.5;
  	time = a;
  while( time < end){
		time = time + a;
    	bis = bis + b;
	}
    
  cout << bis << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 10;
const int INF = 0x3f3f3f3f;
ll n, k;
int main() {
	cin >> n >> k;
	cout << min(n%k, k - n % k) << endl;
	return 0;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: u32 = read(&mut stdin_lock, &mut buf, b' ');
    let m: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut mv = vec![0u16; m];
    for i in 0..m {
        let k: usize = read(&mut stdin_lock, &mut buf, b' ');
        let mut bits = 0u16;
        for _ in 0..k - 1 {
            bits |= 1u16 << (read::<u16>(&mut stdin_lock, &mut buf, b' ') - 1);
        }
        bits |= 1u16 << (read::<u16>(&mut stdin_lock, &mut buf, b'\n') - 1);
        mv[i] = bits;
    }
    let mut pv = vec![0u32; m];
    for i in 0..m - 1 {
        pv[i] = read(&mut stdin_lock, &mut buf, b' ');
    }
    pv[m - 1] = read(&mut stdin_lock, &mut buf, b'\n');

    let mut ans = 0;
    for i in 0..2u16.pow(n) {
        let mut all = true;
        for j in 0..m {
            if ((mv[j] & i).count_ones() % 2) != pv[j] {
                all = false;
            }
        }
        if all {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
a, b, c, x, y = map(int, input().split())
c = 2 * c
ans = 1001001001
for i in range(max(x, y) + 1):
    tmp = a * max(0, x - i) + b * max(0, y - i) + c * i
    ans = min(ans, tmp)
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int S,K;
    int ans;
    cin >> K >> S;
    REP(x,K+1){
        REP(y,K+1){
            int z = S - x - y;
            if(z>=0 && z <= K){
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys, math, itertools, bisect, copy, re
from collections import Counter, deque, defaultdict

# from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
# from functools import reduce
# from math import ceil, floor, log10, log2, factorial
# from pprint import pprint

INF = float('inf')
MOD = 10 ** 9 + 7
EPS = 10 ** -7
sys.setrecursionlimit(1000000)

# N = int(input())
# N,M = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]
# DP = [[0] * 100 for _ in range(100)]
# DP = defaultdict(lambda: float('inf'))

N = int(input())
H = [int(x) for x in input().split()]

c = H[0]
ans = True
for h in H:
    if c <= h:
        c = max(c, h - 1)
    else:
        ans = False
        break

if ans == True:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 15472
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const long long INF = 1e6; 
static const long long n = 200009; 
using ll = long long  ; 
long long N, K ; 
long long p ; 
long long  roop, roop_time; 
vector<long long> r(n,0); 
vector<long long> A(n, 0) ; 
vector<long long> d(n, -1) ; 

void solve(long long x){
    while(d[A[x]] == -1){
        d[A[x]] = d[x] + 1 ;
        x = A[x] ; 
    }
    roop = A[x];
    roop_time = d[x] + 1 - d[roop];
    r[0] = roop + 1  ;
    long long k = 1 ; 
    while(k <= roop_time){
        r[k] = A[r[k-1]-1] + 1;
        k++ ; 
    }
    
}

int main(){
    cin >> N >> K ; 
    rep(i,N){
        cin >> p;
        A[i] = p - 1 ; 
    }
    d[0] = 0 ; 
    solve(0); 
    if(K < d[roop]){
        rep(i,N)if(d[i] == K){
            cout << i + 1 << endl ;
            return 0; 
        }
    }
    else{
        K -= d[roop]; K = K % roop_time; 
        cout << r[K] << endl ; 
        return 0; 
    }
    
}

Measured memory_bytes: 7860
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = int(input())
A = inpl()
Adic = {}
for i in range(1,N+1):
    Adic[i] = A[i-1]

Adic_sorted = sorted(Adic.items(), key=lambda x:x[1])

anslist=list()
for a,b in Adic_sorted:
    anslist.append(str(a))

print(" ".join(anslist))

Measured memory_bytes: 33128
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
n=N()
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
import collections
c=collections.Counter(prime_factorize(n))
ans=0
for i in c.values():
    t=1
    while i>=t:
        i-=t
        t+=1
        ans+=1
print(ans)

Measured memory_bytes: 9476
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#define rep(x, l, r) for(int x = l; x <= r; x++)
#define repd(x, r, l) for(int x = r; x >= l; x--)
#define clr(x, y) memset(x, y, sizeof(x))
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define MAXN 200005
#define fi first
#define se second
#define SZ(x) ((int)x.size())
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
const int INF = 1 << 30;
const int p = 1000000007;
int lowbit(int x){ return x & (-x);}
int fast_power(int a, int b){ int x; for(x = 1; b; b >>= 1){ if(b & 1) x = 1ll * x * a % p; a = 1ll * a * a % p;} return x % p;}

int n;
int a[MAXN], b[MAXN];

bool check(int mid){
	int res = 0, minx = INF;
	rep(i, 1, 2 * n - 1) b[i] = a[i] >= mid;
	rep(i, 1, 2 * n - 1)
		if(b[i] == b[i + 1]){
			if(min(abs(n - i), abs(n - (i + 1))) < minx){
				minx = min(abs(n - i), abs(n - (i + 1)));
				res = b[i];
			}
		}
	if(minx == INF) return (n & 1) == b[n];
	return res;
}

int main(){
	//freopen("pyramid.in", "r", stdin);
	//freopen("pyramid.out", "w", stdout);
	scanf("%d", &n);
	rep(i, 1, 2 * n - 1) scanf("%d", &a[i]);
	int l = 0, r = 2 * n - 1, ans;
	while(l <= r){
		int mid = (l + r) >> 1;
		if(check(mid)){
			ans = mid;
			l = mid + 1;
		}
		else r = mid - 1;
	} 
	printf("%d\n", ans);
    return 0;
}

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

#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))

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

template <class T> inline T biton(T n, T pos) { return n | ((T)1 << pos); }
template <class T> inline T bitoff(T n, T pos) { return n & ~((T)1 << pos); }
template <class T> inline T ison(T n, T pos) { return (bool)(n & ((T)1 << pos)); }
template <class T> inline T gcd(T a, T b) { while (b) { a = a%b; swap(a, b); } return a; }
template <class T> inline T bigmod(T p, T e, T m) { T ret = 1; for (; e > 0; e >>= 1) { if (e & 1) ret = (ret * p) % m; p = (p * p) % m; } return (T)ret; }



void solve() {

	int p, q, r;
	cin >> p >> q >> r;

	int res = p + q;
	res = min(res, p + r);
	res = min(res, q + r);

	cout << res << endl;
}

int main()
{

	ios_base::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(10); cout.tie(nullptr); cin.tie(nullptr);

	int t = 1;

	while (t--) {

		solve();
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

vector<ll> enum_divisors(ll N) {
    vector<ll> res;
    for (ll i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            if (N/i != i) res.push_back(N/i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int main() {
    ll N;
    cin >> N;
    const auto &res = enum_divisors(N);

    ll ans = 2e+12;
    REP(i, res.size()){
        if(N/res[i] + res[i] < ans){
            ans = N/res[i] + res[i];
        }
    }

    cout << ans - 2 << endl;
}

Measured memory_bytes: 3644
// OURL: https://atcoder.jp/contests/abc065/tasks/abc065_b
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));  }

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){ for(auto &e:t) fill_v(e,v);  }

#ifdef LOCAL
#include "pprint.hpp"
pprint::PrettyPrinter printer;
#define debug(...) cerr << "[L" << __LINE__ << ":" <<#__VA_ARGS__ << "]: ", printer.print(__VA_ARGS__)
#else
#define debug(...) 42
#endif


int main() {
#ifdef LOCAL
  printer.compact(true);
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;
  auto as = make_v<int>(n);
  for (int i = 0; i < n; ++i) {
    cin >> as[i];
    as[i]--;
  }
  auto used = make_v<bool>(n);
  int idx = 0, ans=0;
  while(!used[idx] && idx != 1) {
    used[idx] = true;
    idx = as[idx];
    ans++;
  }
  if (idx == 1) {
    cout << ans << endl;
  } else {
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
int cnt[200003];
int main(){
  int n;
  cin >> n;
  vector<int> a(n+1, 0);
  rep(i,n) cin >> a[i+1];
  vector<int> res;
  for (int i = n; i > 0; i--) {
    int sum = 0;
    for (int j = i * 2; j <= n; j += i) sum ^= cnt[j];
    cnt[i] = sum ^ a[i];
    if (cnt[i]) res.emplace_back(i);
  }
  cout << res.size() << endl;
  for (auto e : res) cout << e << " ";
  cout << endl;
  return 0;
}

Measured memory_bytes: 3064
import java.util.LinkedList;
import java.util.Scanner;
 
public class Main {
	private class Node {
		public long pattern = 0;
		public int index;
		public LinkedList<Integer> children = new LinkedList<Integer>();
		public int parent = -1;
		
		public Node(int i) {
			this.index = i;
		}
		
		public void setParent(int K, int parent, int use, Node[] nodes) {
			this.pattern = K - use;
			this.parent = parent;
			int count = 1;
			if (parent != -1) {
				count++;
			}
			for (int n : children) {
				if (n == this.parent) {
					continue;
				}
				nodes[n].setParent(K, index, count, nodes);
				
				count++;
			}
		}
	}
	
	public void solve() {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int K = in.nextInt();
		Node[] nodes = new Node[N];
		for (int i=0; i<N; i++) {
			nodes[i] = new Node(i);
		}
		for (int i=0; i<N-1; i++) {
			int a = in.nextInt() - 1;
			int b = in.nextInt() - 1;
			nodes[a].children.add(b);
			nodes[b].children.add(a);
		}
		in.close();
		
		nodes[0].setParent(K, -1, 0, nodes);
		
		long patterns = 1;
		for (int i=0; i<N; i++) {
			patterns = (patterns * nodes[i].pattern) % 1_000_000_007;
		}
		
		System.out.println(patterns);
	}
	
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}
 
}


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

int main()
{
  int n; cin >> n;
  unordered_map<int, bool> exist;
  for (int a; cin >> a; )
    if (exist[a]) exist[a] = false;
    else exist[a] = true;
  
  int count = 0;
  for (auto itr = exist.begin(); itr != exist.end(); ++itr)
    if ((*itr).second) ++count;
    
  cout << count << endl;
}

Measured memory_bytes: 4388
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define pint pair<int,int>
#define Lower(v,X) lower_bound(v.begin(),v.end(),X)-v.begin();
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
   lli A,B,C,L,R,N,M,K,X=0,Y=0,W,H=INF,sum=0,num=0,flag=0;string S,T,O;
   cin >> H >> W;
   DV(P,char,H,W,'.');
   rep(i,0,H)rep(j,0,W){
      cin >> P[i][j];
      if(P[i][j]=='#')sum++;
   }
   DV(dist,int,H,W,-1);
   dist[0][0]=0;
   queue<pint> que;
   que.push(pint(0,0));
   while(!que.empty()){
      auto Xq=que.front();que.pop();
      rep(i,0,4){
         lli nx=Xq.first+dx[i];
         lli ny=Xq.second+dy[i];
         if(nx<0||ny<0||nx>H-1||ny>W-1||P[nx][ny]=='#'||dist[nx][ny]!=-1)continue;
         dist[nx][ny]=dist[Xq.first][Xq.second]+1;
         que.push(pint(nx,ny));
         }
      }
   if(dist[H-1][W-1]==-1)Out(-1);
   else Out(H*W-dist[H-1][W-1]-1-sum);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
typedef pair<ll,ll> ipair;
#define F first
#define S second
 
/*
//functions from gfg
 
long long int power(long long int x,long long int y,long long  int p)
{
    long long int res = 1;     // Initialize result
 
    x = x % p;  // Update x if it is more than or 
                // equal to p
 
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            {//d=(long double)x/p;
            res = (res*x) % p;
            }
 
        // y must be even now
        y = y>>1; // y = y/2
        x=(x*x)%p;
        
    }
    return res%p;
}
 
long long int gcd(long long int a,long long int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
 
long long int binomialCoeff(long long int n, ll k) 
{ 
    ll res = 1; 
  
    // Since C(n, k) = C(n, n-k) 
    if (k > n - k) 
        k = n - k; 
  
    // Calculate value of [n*(n-1)*---*(n-k+1)] / [k*(k-1)*---*1] 
    for (ll i = 0; i < k; ++i) 
    { 
        res *= (n - i); 
        res /= (i + 1); 
    } 
  
    return res; 
} 
 

void sieve(int n, vector<ll> &primes) 
{ 
    vector<int> prime(n,1);
    ll p;
    for ( p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == 1) 
        { 
            
            for (int i=p*p; i<=n; i += p) 
                prime[i] = 0; 
        } 
    } 
  
    for(p=2;p<=n;p++)
    {
        if(prime[p])
        primes.pb(p);
    }
   
} 


void dfs(vector<ll> adj[] ,ll src,vector<ll> &vis)
{
    vis[src]=1;
    for(ll i=0;i<adj[src].size();i++)
    {
        if(vis[adj[src][i]]==0)
        dfs(adj,adj[src][i],vis)
    }
}
 
*/

int main() {
	ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);
    
    
	ll n,i,j,p,k,m,ans=0;
    cin>>n;
    string a;
    cin>>a;
    i=0;j=n-1;
    ans=0;
    while(i<j)
    {
        for(;i<n;i++)
        {
            if(a[i]=='W')
            break;
        }
        for(;j>=0;j--)
        {
            if(a[j]=='R')
            break;
        }
        if(i<j)
        {
            ans++;i++;j--;
        }
        else break;
    }
    cout<<ans<<endl;
    
    
    
    
    
    // for(i=0;i<n;i++)
    // {
    //     cout<<a[i]<<" ";
    // }
    // cout<<endl;
    
	return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define pb push_back
using namespace std; 
long long n,k,x[200005],now,pos[200005],lst,ans;
bool udah[200005];
vector<int> v;

string s,t;
int main(){
    cin>>n>>k;
    
    for(int i =1;i<=n;i++){
        cin>>x[i];
    }
    now=1;
    memset(pos,-1,sizeof(pos));
    while(pos[now]==-1){
        pos[now]=v.size();
        v.pb(now);
        // udah[now]=1;
        now=x[now];
        lst=now;
    }
    // cout<<lst<<endl;
    if(k<=pos[lst]){
        ans=v[k];
    }
    else{
        k-=pos[lst];
        ans=v[pos[lst]+k%(v.size()-pos[lst])];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 7336
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint INF = 1e18;
#define rep(i, n) for(int i = 0; i < int(n); i++)

signed main(){
	int n, l; cin >> n >> l;
	vector<int> a(n);
	rep(i, n) a[i] = l + i;
	int ans = 0;
	rep(i, n) ans += a[i];
	vector<int> b(n);
	rep(i, n) b[i] = ans - a[i];
	rep(i, n) b[i] = abs(ans - b[i]);
	int id = min_element(b.begin(), b.end()) - b.begin();
	//rep(i, n) cout << b[i] << " ";
	cout << ans - a[id] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}

////////////////////////////////////////
struct edge{
    int x;
    int y;
    int c;
};

int main(){
    ll l;cin>>l;
    vector<edge>v;
    rep(i,1,19){
        edge e;
        e.x=i;e.y=i+1;e.c=0;
        v.pb(e);
    }
    /*rep(l,1,10){*/
    int t=2,count=0;
    while(t<=l){t*=2;count++;}
  /*     cout<<l<<" "<<count<<endl;
    }*/
    rep(i,1,count){
        edge e;
        e.x=20-i;e.y=21-i;e.c=(ll)pow(2,i-1);
        v.pb(e);
    }
    if(l<=(ll)1<<19){
        int now=(int)pow(2,count);
        for(int i=count-1;i>=0;i--){
            if((l>>i)&1){
                edge e;
                e.x=1;e.y=20-i;e.c=now;
                v.pb(e);
                now+=(ll)pow(2,i);
            }
        }
    }else{
        int now=(int)pow(2,19);
        for(int i=18;i>=0;i--){
            if((l>>i)&1){
                edge e;
                e.x=1;e.y=20-i;e.c=now;
                v.pb(e);
                now+=(ll)pow(2,i);
            }
        }
    }
    cout<<20<<" "<<v.size()<<endl;
    for(auto e:v){
        cout<<e.x<<" "<<e.y<<" "<<e.c<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD=pow(10,9)+7;
const ll INF=(1LL<<62);
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

template< typename Monoid >
class SegmentTree {
public:
  using F = function< Monoid(Monoid, Monoid) >;

  int sz;
  vector< Monoid > seg;

  const F f;
  const Monoid M1;

  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }

  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }

  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }

  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }

  template< typename C >
  int find_subtree(int a, const C &check, Monoid &M, bool type) {
    while(a < sz) {
      Monoid nxt = type ? f(seg[2 * a + type], M) : f(M, seg[2 * a + type]);
      if(check(nxt)) a = 2 * a + type;
      else M = nxt, a = 2 * a + 1 - type;
    }
    return a - sz;
  }


  template< typename C >
  int find_first(int a, const C &check) {
    Monoid L = M1;
    if(a <= 0) {
      if(check(f(L, seg[1]))) return find_subtree(1, check, L, false);
      return -1;
    }
    int b = sz;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) {
        Monoid nxt = f(L, seg[a]);
        if(check(nxt)) return find_subtree(a, check, L, false);
        L = nxt;
        ++a;
      }
    }
    return -1;
  }

  template< typename C >
  int find_last(int b, const C &check) {
    Monoid R = M1;
    if(b >= sz) {
      if(check(f(seg[1], R))) return find_subtree(1, check, R, true);
      return -1;
    }
    int a = sz;
    for(b += sz; a < b; a >>= 1, b >>= 1) {
      if(b & 1) {
        Monoid nxt = f(seg[--b], R);
        if(check(nxt)) return find_subtree(b, check, R, true);
        R = nxt;
      }
    }
    return -1;
  }
};

ll getFirst(ll n){
  string s=to_string(n);
  return (s[0]-'0');
}
ll getLast(ll n){
  return n%10;
}

int main(){
    init();
    ll data[10][10]={0};
    
    ll N;cin>>N;
    for(int i=1;i<=N;i++){
      data[getFirst(i)][getLast(i)]++;
    }

    ll ans=0;

    for(int i=0;i<10;i++){
      for(int j=0;j<10;j++){
        ans+=data[i][j]*data[j][i];
      }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
/*              `-._:  .:'   `:::  .:\           |\__/|           /::  .:'   `:::  .:.-'
                    \      :          \          |:   |          /         :       /    
                     \     ::    .     `-_______/ ::   \_______-'   .      ::   . /      
                      |  :   :: ::'  :   :: ::'  :   :: ::'      :: ::'  :   :: :|       
                      |     ;::         ;::         ;::         ;::         ;::  |       
                      |  .:'   `:::  .:'   `:::  .:'   `:::  .:'   `:::  .:'   `:|       
                      /     :           :           :           :           :    \       
                     /______::_____     ::    .     ::    .     ::   _____._::____\      
                                   `----._:: ::'  :   :: ::'  _.----'                    
                                          `--.       ;::  .--'                           
                                              `-. .:'  .-'                               
                                                 \    /                        
                                                  \  /                                   
                                                   */
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define all(v) v.begin(),v.end() 
#define F first
#define S second
#define pa pair<int,int>
#define ld long double 
#define sz(x) x.size()
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define INF 1e18
#define PI 3.14159265
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
priority_queue<int, vector<int>, greater<int> > pq;//Min Heap
double startTime;
double getCurrentTime() {
  return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
int power(int x, unsigned int y, int p) 
{ 
    int res=1;
    x=x%p;
    while(y>0) 
    {
        if(y&1) res=(res*x)%p; 
        y=y>>1;
        x=(x*x)%p;   
    }
    return res;
}
void outP(int idx)
{
    cout<<"Case #"<<idx<<": ";
}
const int maxn = 3005;
int n;
double p[maxn];
ld dp[maxn][maxn];
int32_t main()
{
    IOS;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>p[i];
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        dp[i][0]=dp[i-1][0]*(1-p[i]);
        for(int j=0;j<=i;j++)
        {
            if(j==0)
                dp[i][j]=dp[i-1][j]*(1-p[i]);
            else
                dp[i][j]=dp[i-1][j]*(1-p[i])+dp[i-1][j-1]*p[i];
        }
    }
    ld ans=0;
    cout<<fixed;
    cout<<setprecision(9);
    for(int i=n/2+1;i<=n;i++)
        ans+=dp[n][i];
    cout<<ans;
    return 0;
}

Measured memory_bytes: 85640
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

// 参考 https://ei1333.github.io/luzhiled/snippets/structure/segment-tree.html
template <typename T>
struct SegTree {
    using F = function<T(T,T)>;
    
    int size;
    vector<T> dat;

    const F f;
    const T INIT;
    
    SegTree(int n, const F func, const T &init) : f(func), INIT(init) {
        size = 1;
        while(size < n) size <<= 1;
        dat.assign(2*size, INIT);
    }

    void update(int k, const T &x) {
        k += size;
        dat[k] = x;
        while(k >>= 1) {
            dat[k] = f(dat[2*k],dat[2*k+1]);
        }
    }

    T query(int a,int b) {
        T l = INIT, r = INIT;
        for(a += size, b += size+1; a < b; a >>= 1, b >>= 1) {
            if (a & 1) l = f(l,dat[a++]);
            if (b & 1) r = f(r,dat[--b]);
        }
        return f(l,r);
    }

    // 未使用機能
    //private:
    void set(int k, const T &x) {
        dat[k+size] = x;
    }

    void build() {
        for(int k = size - 1; k > 0; k--) {
            dat[k] = f(dat[2*k],dat[2*k+1]);
        }
    }

    T operator[](const int &k) const {
        return dat[k+size];
    }

};


int main(void)
{
    IOS
    constexpr int C = 26;
    int N, Q;
    string S;
    cin >> N >> S >> Q;
    using bs = bitset<C>;
    auto al = [](char c) {return 1 << (c - 'a');};

    SegTree<bs> seg(N,[](bs a,bs b){return a | b;}, bs());

    REP(i,S.size()) {
        seg.set(i, bs(al(S[i])) );
    }
    seg.build();

    REP(i,Q) {
        int q; cin >> q;
        if (q == 1) {
            int i; char c;
            cin >> i >> c;
            i--;
            seg.update(i, bs(al(c)) );
        } else {
            int l,r;
            cin >> l >> r;
            l--; r--;
            OUT(seg.query(l,r).count());
        }
    }

    return 0;
}

Measured memory_bytes: 9116
#include <iostream>
#include <cstdio>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <vector>
#include <memory.h>
#include <algorithm>
#define case        printf("Case %d: ",++tc);
#define read        freopen("tst.txt","r",stdin)
#define write       freopen("out.txt","w",stdout)
typedef long long ll;
using namespace std;
#define pi acos(-1)
#define mx 3002
string s,t;
int dp[mx][mx],ans;

int lcs(int i,int j){
    if(i==s.size()  || j==t.size()) return 0;
    int &ans = dp[i][j];
    if(dp[i][j]!=-1)    return ans;
    ans = 0;
    if(s[i]==t[j])  ans = max(ans,1+lcs(i+1,j+1));
    else ans = max(ans,max(lcs(i+1,j),lcs(i,j+1)));
    return ans;
}
string xx;

void fn(int i,int j,int z){

    if(z==0){
        cout<<xx<<endl;
        exit(0);
    }
    if(dp[i][j]!=z) return;
    if(s[i]==t[j]){
        xx.push_back(s[i]);
        fn(i+1,j+1,z-1);
        xx.pop_back();
    }
    else{
        fn(i+1,j,z);
        fn(i,j+1,z);
    }
}

main(){
cin>>s>>t;

memset(dp,-1,sizeof dp);
ans = lcs(0,0);
fn(0,0,ans);

return 0;
}


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

using namespace std;

int main()
{
    while (true) {
        int h, w;
        cin >> h >> w;
        if (h == 0 and w == 0) {
            break;
        }
        int d = h * h + w * w;
        int minh = 0;
        int minw = 0;
        int mini = numeric_limits<int>::max();
        for (int i = 1; i < 2 * w + 2; i++) {
            for (int j = i + 1; j < 2 * w + 2; j++) {
                const int dd = i * i + j * j;
                if (dd >= d) {
                    if (dd == d and i <= h) {
                        continue;
                    }
                    if (mini > dd) {
                        minh = i;
                        minw = j;
                        mini = dd;
                    }
                }
            }
        }
        cout << minh << " " << minw << endl;
    }
    return 0;
}

Measured memory_bytes: 3064
class Node:
    def __init__(self):
        self.parent = -1

def dfs(v, d=0):
    G[v].depth = d
    for child in G[v].children:
        dfs(child,d+1)

N = int(input())
G = [Node() for _ in range(N)]
for _ in range(N):
    idx,k,*children = [int(x) for x in input().split()]
    G[idx].children = children
    if k:
        G[idx].type = 'internal node'
    else:
        G[idx].type = 'leaf'
    for child in children:
        G[child].parent = idx

root = [i for i,x in enumerate(G) if x.parent == -1][0]
G[root].type = 'root'
dfs(root)
for i,node in enumerate(G):
    print('node {}: parent = {}, depth = {}, {}, [{}]'.format(
        i,
        node.parent,
        node.depth,
        node.type,
        ', '.join(map(str,node.children))
        )
    )


Measured memory_bytes: 40200
#include<bits/stdc++.h>
using namespace std;
int main (){
  int x;
cin >> x;
if(x == 22) cout << "Christmas Eve Eve Eve" << endl;
else if(x == 23) cout << "Christmas Eve Eve" << endl;
else if(x == 24) cout << "Christmas Eve" << endl;
else if(x == 25) cout << "Christmas" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rep(i, n) for(int i = 0; i < n; i++)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
using namespace std;

int main(){
    string S;
    cin >> S;
    string ans = "AC";
    bool c = 1;
    if((S.at(0) == 'A') && (S.at(1) != 'C') && (S.at(S.len-1) != 'C') && (S.at(S.len - 1) != 'C')){
        for(int i = 2; i < S.len - 1; i++){
            if(S.at(i) == 'C'){
                c = 0;
                erc(S, 0);
                erc(S, i - 1);
                rep(i, S.len){
                    if(isupper(S.at(i))){
                        ans = "WA";
                        break;
                    }
                }
            }
        }
    }
    else ans = "WA";
    if(c) ans = "WA";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <cmath>
#include <limits>
#include <math.h>
#include <cassert>

#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 INF 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
    int x;

    cin >> x;
    if (x == 0)
    {
        cout << "1" << endl;
    }
    else
    {

        cout << "0" << endl;
    }
}

Measured memory_bytes: 3616