akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
using namespace std;

bool check(vector<int> &v, int goal) {
    int size = v.size();
    int base = 20000;
    vector<vector<bool>> dp(size + 1, vector<bool>(base * 2, false));
    dp[0][base] = true;
    for (int i = 0; i < size; i++) {
        for (int j = 0; j < base * 2; j++) {
            if (!dp[i][j]) continue;
            dp[i + 1][j + v[i]] = true;
            dp[i + 1][j - v[i]] = true;
        }
    }
    return dp[size][goal + base];
}

int main(void){
    string s;
    cin >> s;
    int x, y;
    cin >> x >> y;
    int tmp = 0;
    vector<int> X, Y;
    bool isX = true;
    s += 'T';
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'T') {
            if (isX) {
                X.push_back(tmp);
            } else {
                Y.push_back(tmp);
            }
            isX = !isX;
            tmp = 0;
        } else {
            tmp++;
        }
    }
    if (X.size() >= 1) {
        x -= X[0];
        X.erase(X.begin());
    }
    cout << ((check(X, x) && check(Y, y)) ? "Yes" : "No") << endl;
    return 0;
}


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

using namespace std;

using lo = long long int;
#define pb emplace_back
#define st first
#define nd second
#define inf (int)1e9
#define N (int)1e5 * 5
#define mod (int)1e9 + 7
#define all(x) (x).begin(), (x).end()
#define watch(x) cout << #x << " = " << x << endl
int in(){
	int a;
	cin >> a;
	return a;
}

void solve(){
    string s;
    cin >> s;
    cout << s[0] << s[1] << s[2] << endl;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0); cerr.tie(0);
    mt19937 rng(5);
    // freopen("gir.gir", "r", stdin);
    // freopen("cik.cik", "w", stdout);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
/*

*/


Measured memory_bytes: 3604
use std::cmp::max;
use std::cmp::min;

fn main() {
    input! {
        n: usize,
        s: [chars; n]
    }
    let mut edges = vec![vec![]; n];
    for i in 0..n {
        for j in 0..n {
            if s[i][j] == '1' {
                edges[i].push(j);
            }
        }
    }
    // 二部グラフかどうか調べる
    let mut reached = vec![false; n];
    let mut colors = vec![-1; n];
    let mut stack = vec![0];
    reached[0] = true;
    colors[0] = 0;
    while let Some(c) = stack.pop() {
        for edge in &edges[c] {
            let edge_color = if colors[c] == 0 { 1 } else { 0 };
            if colors[*edge] >= 0 && colors[*edge] != edge_color {
                println!("-1");
                return;
            }
            colors[*edge] = edge_color;
            if reached[*edge] {
                continue;
            }
            reached[*edge] = true;
            stack.push(*edge);
        }
    }
    // 直径を調べる
    let mut dist_mat = vec![vec![205; n]; n];
    for i in 0..n {
        dist_mat[i][i] = 0;
    }
    for (i, edge) in edges.iter().enumerate() {
        for e in edge {
            dist_mat[i][*e] = 1
        }
    }
    for k in 0..n {
        for i in 0..n {
            for j in 0..n {
                if dist_mat[i][j] > dist_mat[i][k] + dist_mat[k][j] {
                    dist_mat[i][j] = dist_mat[i][k] + dist_mat[k][j];
                    dist_mat[j][i] = dist_mat[i][k] + dist_mat[k][j];
                }
            }
        }
    }

    let ans = dist_mat
        .iter()
        .map(|a| a.iter().filter(|b| **b != 205).fold(0, |b, c| max(b, *c)))
        .fold(0, |b, c| max(b, c));

    println!("{}", ans + 1);
}

#[macro_export(local_inner_maccros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[macro_export(lcal_inner_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

#[macro_export(lcal_inner_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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


Measured memory_bytes: 2716
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    ll ans = 0;
    F0R(i, N) {
        ll cur = i;
        ans += (cur+1) * (N-cur);
    }
    F0R(i, N-1) {
        ll A, B; cin >> A >> B;
        if (A > B) swap(A, B);
        ans -= A * (N+1-B);
    }
    cout << ans << nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 3640
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

const mod = 1000000007

func mpow(a, b int) int {
	if b == 0 {
		return 1
	} else if b%2 == 0 {
		tmp := mpow(a, b/2)
		return tmp * tmp % mod
	}
	return mpow(a, b-1) * a % mod
}

var fracMemo = []int{1, 1}

func mfrac(n int) int {
	if len(fracMemo) > n {
		return fracMemo[n]
	}
	if len(fracMemo) == 0 {
		fracMemo = append(fracMemo, 1)
	}
	for len(fracMemo) <= n {
		size := len(fracMemo)
		fracMemo = append(fracMemo, fracMemo[size-1]*size%mod)
	}
	return fracMemo[n]
}

var ifracMemo = []int{1, 1}

func mifrac(n int) int {
	if len(ifracMemo) > n {
		return ifracMemo[n]
	}
	if len(ifracMemo) == 0 {
		fracMemo = append(ifracMemo, 1)
	}
	for len(ifracMemo) <= n {
		size := len(ifracMemo)
		ifracMemo = append(ifracMemo, ifracMemo[size-1]*mpow(size, mod-2)%mod)
	}
	return ifracMemo[n]
}

func nCr(n, r int) int {
	if n == r {
		return 1
	}
	if n < r || r < 0 {
		return 0
	}
	ret := 1
	ret *= mfrac(n)
	ret %= mod
	ret *= mifrac(r)
	ret %= mod
	ret *= mifrac(n - r)
	ret %= mod
	return (ret)
}

// 逆元を使った割り算（MOD）
// mod. m での a の逆元 a^{-1} を計算する
func modinv(a, m int) int {
	b := m
	u := 1
	v := 0
	for b != 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= m
	if u < 0 {
		u += m
	}
	return u
}

func main() {
	sc.Split(bufio.ScanWords)
	X, Y := getInt(), getInt()

	a := 2*X - Y
	b := 2*Y - X
	if a%3 != 0 || b%3 != 0 {
		out(0)
		return
	}
	a /= 3
	b /= 3

	out(nCr(a+b, a))
	return
	ans := 1
	for i := 1; i <= a+b; i++ {
		ans *= i
		ans %= mod
	}
	as := 1
	for i := 1; i <= a; i++ {
		as *= i
		as %= mod
	}
	bs := 1
	for i := 1; i <= b; i++ {
		bs *= i
		bs %= mod
	}

	// out(ans, as, bs)
	ans *= modinv(as, mod)
	ans %= mod
	ans *= modinv(bs, mod)
	ans %= mod
	out(ans)
}


Measured memory_bytes: 22656
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200005;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int n,fa[N],f[N];
ll ans;
struct node{int i,x,y;}a[N];
void operator+=(node &x,node y){x.x+=y.x;x.y+=y.y;}
bool operator<(node x,node y){ll t=(ll)x.x*y.y-(ll)x.y*y.x;return (t) ? (t<0) : ((x.i!=y.i) ? (x.i<y.i) : (x.x+x.y<y.x+y.y));}
bool operator>(node x,node y){return y<x;}
bool operator==(node x,node y){return (x.x==y.x)&&(x.y==y.y)&&(x.i==y.i);}
int find(int x){return (x==f[x]) ? x : f[x]=find(f[x]);}
void merge(int x,int y){
	x=find(x);y=find(y);
	ans+=(ll)a[x].x*a[y].y;
	f[y]=x;a[x]+=a[y];
}
struct hp{
	priority_queue< node,vector<node>,greater<node> > f,g;
	void push(node x){f.push(x);}
	void erase(node x){g.push(x);}
	void check(){while ((!g.empty())&&(f.top()==g.top())) f.pop(),g.pop();}
	void pop(){check();f.pop();}
	node top(){check();return f.top();}
}g;
int main(){
	n=read();
	for (int i=2;i<=n;i++) fa[i]=read();
	for (int i=1;i<=n;i++){
		f[i]=i;
		if (read()) a[i]=(node){i,1,0};
		else a[i]=(node){i,0,1};
	}
	for (int i=2;i<=n;i++) g.push(a[i]);
	for (int i=2;i<=n;i++){
		int x=g.top().i,y=find(fa[x]);
		g.pop();
		if (y!=1) g.erase(a[y]);
		merge(y,x);
		if (y!=1) g.push(a[y]);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 12656
// E - Simple String Queries
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)

int N,Q;
string S;
vector<set<int>> abc(26);

void add(int i, char c){//type1
	if(S[i] == c) return;
	abc[S[i]-'a'].erase(i);
	S[i] = c;
	abc[S[i]-'a'].insert(i);
}

void out(int l, int r){//type2
	int ans = 0;
	rep(i,26){
		auto it = abc[i].lower_bound(l);
		if(it != abc[i].end() && *it <= r) ans++;
	}
	printf("%d\n",ans);
}

int main(){
	cin>>N>>S>>Q;
	rep(i,N) abc[S[i]-'a'].insert(i);
	rep(i,Q){
		int t,a;
		cin>>t;
		if(t-1){//type2
			int b;
			cin>>a>>b;
			out(a-1, b-1);
		}
		else{//type1
			char b;
			cin>>a>>b;
			add(a-1, b);
		}
	}
}

Measured memory_bytes: 24196
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
typedef long long ll;
int main() {
int N, M; cin >> N >> M;
  vector<ll> a(N), b(N);
  rep(i, N) cin >> a[i] >> b[i];
  map<ll, ll> m;
  rep(i, N) {
    m[a[i]]+=b[i];
  }
  ll ans = 0;
  ll buy = 0;
  
  
  for(auto shop:m)  { buy = min((ll)M, shop.second); 
                     ans += shop.first*buy; M -= (int)buy;}
    
cout << ans << endl;
}

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

const int INF = 1e9;

int f(int a, int b) { // a <= b
  while (a > 0) {
    b %= a;
    if (a > b)
      swap(a, b);
  }
  return b;
}

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

  vector<int> A(N);
  rep(i, N) cin >> A[i];

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

  int ans = INF;
  rep(i, N - 1) ans = min(ans, f(A[i], A[i + 1]));

  cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String[] tokens = in.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int L = Integer.parseInt(tokens[1]);

		long taste = 0;
		int lMin = L;
		int lMax = L + N - 1;
		int l = L;
		for (int i = 0; i < N; ++i) {
			taste += l;
			l++;
		}
		if (lMin < 0 && lMax < 0) {
			taste -= lMax;
		} else if (lMin <= 0 && lMax >= 0) {

		} else {
			taste -= lMin;
		}
		System.out.println(taste);
		in.close();
	}

}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

void solve ( int test_case )
{
    string s ; cin >> s ;
    for ( auto i : s )
    {
        if ( i == '9' ) cout << 1 ;
        else cout << 9 ;
    }
}

int main()
{
    int t = 1;
    // cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	string s[3];
	for (int i = 0; i < 3; i++) {
		cin >> s[i];
	}
	int i = 0;
	while (s[i].size() > 0) {
		int j = s[i][0] - 'a';
		s[i].erase(0, 1);
		i = j;
	}
	cout << (char) ('A'+i) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int x[60], y[60];
    int n;
    int cnt = 0;
    int i;
    double ans;

    while(1){
        scanf("%d", &n);
        if(n == 0) break;
        for(i = 0; i < n; i++)
            scanf("%d %d", &x[i], &y[i]);

        x[n] = x[0]; y[n] = y[0];
        ans = 0;
        for(i = 0; i < n; i++)
            ans += (x[i+1] - x[i]) * (y[i+1] + y[i]);

        cnt++;
        printf("%d %.1lf\n", cnt, ans/2);
    }
    return 0;
}




Measured memory_bytes: 2032
N, M = map(int, input().split())


den = []
for i in range(M):
    tmp = list(map(int, input().split()))
    den.append(tmp[1:])

p = list(map(int, input().split()))

ans = 0
for i in range(2 ** N):
    tmp = []
    den_count = 0
    for j in reversed(range(N)):
        if (i & (1 << j)):
            #スイッチがonの場合
            tmp.append(1)
        else:
            #スイッチがoffの場合
            tmp.append(0)
    for k in range(len(den)):
        #つながっているスイッチの配列が降りてくる
        switch_count = 0
        for z in den[k]:
            if tmp[z-1] == 1:
                switch_count += 1
        if switch_count % 2 == p[k]:
            den_count += 1
        else:
            break
    if den_count == M:
        ans += 1
print(ans)

Measured memory_bytes: 3064
from collections import defaultdict, deque
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate
import sys


def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


def main():
    n = I()
    num = LI()
    for i in range(n):
        for j in range(n):
            tmp = num.copy()
            tmp[i], tmp[j] = tmp[j], tmp[i]
            if tmp == sorted(num):
                return 'YES'
    return 'NO'


print(main())

Measured memory_bytes: 4844
S = input()
if 1 <= int(S[:2]) and int(S[:2]) <= 12 and 1 <= int(S[2:]) and int(S[2:]) <= 12:
    print("AMBIGUOUS")
elif 1 <= int(S[:2]) and int(S[:2]) <= 12:
    print("MMYY")
elif 1 <= int(S[2:]) and int(S[2:]) <= 12:
    print("YYMM")
else:
    print("NA")

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

int L, R, d;

int main(){
    cin >> L >> R >> d;
    int cnt = 0;
    for(int i = L; i < R+1; i++){
        if(i%d==0){
            cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}

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

int main(){
  int a, b, k;
  cin >> a >> b >> k;
  for (int i = a; i <= min(a + k - 1, b - k); i++){
    cout << i << endl;
  }
  for (int i = max(a, b - k + 1); i <= b; i++) {
    cout << i << endl;
  }
  return 0;
}


Measured memory_bytes: 256
def examA():
    x, y = LI()
    ans = 0
    if x<0 and y<0:
        if x<=y:
            ans = y-x
        else:
            ans = x-y+2
    elif x<0 and 0<=y:
        if -x<=y:
            ans = y+x+1
        else:
            ans = min(-(x+y)+1,y-x)
    elif y<=0:
        ans = abs(y+x)+1
    else:
        if x<=y:
            ans = y-x
        else:
            ans = x-y+2
    print(ans)
    return

def examB():
    B, K = LI()
    A = LI()
    cumA = [0]*(B+1); negA = [0]*(B+1)
    for i,a in enumerate(A):
        cumA[i+1] = cumA[i]
        negA[i+1] = negA[i]
        if a>0:
            cumA[i+1] +=a
        else:
            negA[i+1] +=a
    ans = 0
    for i in range(B-K+1):
        curC = cumA[K+i]-cumA[i]; curN = negA[K+i]-negA[i]
        now1 = cumA[B] + curN
        now2 = cumA[B] - curC
#        print(now1,now2)
        ans = max(ans,now1,now2)
    print(ans)
    return

def examC():
    Ai,Ao,At,Aj,Al,As,Az = LI()
    ans = 0
    ans += Ao
    ans += (Ai//2 + Aj//2 + Al//2)*2
    if Ai>=1 and Aj>=1 and Al>=1:
        if Ai%2 + Aj%2 + Al%2==3:
            ans += 3
        elif Ai%2 + Aj%2 + Al%2==2:
            ans +=1
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18

if __name__ == '__main__':
    examC()


Measured memory_bytes: 3568
x = int(input());
n1 = 0;
n2 = 0;
if(x == 1):
    n1 = 0;
    n2 = -1;
    print(n1, n2);
flag = False;

if(x != 1):
    for i in range(1000):
        for j in range(1000):
            if((i * i * i * i * i) - (-(j * j * j * j * j)) == x ):
                print(i, -j);
                flag = True;
                break;
            if ((i * i * i * i * i) - ((j * j * j * j * j)) == x):
                print(i, j);
                flag = True;
                break;
        if(flag):
            break;

Measured memory_bytes: 9160
#include <bits/stdc++.h>
using namespace std;
// ----------------------R00TDADA------------------------------
#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (a); i > (b); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define bitcount __builtin_popcount //count no's of ones in a set bit
#define prq priority_queue
#define mp make_pair
#define mem(x, val) memset((x), (val), sizeof(x));
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define int long long
#define M 1000000007
signed main()
{
    rootdada;

    int a;
    cin >> a;
    cout << fixed << setprecision(20) << 2 * M_PI * a << endl;
}

Measured memory_bytes: 3780
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	int n, q;
	string s;
	cin >> n >> q >> s;

	vector<int> l(q, 0), r(q, 0);
	for (int i = 0; i < q; i++) {
		cin >> l[i] >> r[i];
	}

	vector<int> acs(n + 1, 0);
	s = "?" + s;

	for (int i = 1; i < s.size(); i++) {
		acs[i] = acs[i - 1];
		if (s[i - 1] == 'A' && s[i] == 'C') {
			acs[i]++;
		}
	}

	vector<int> ans(q, 0);
	for (int i = 0; i < q; i++) {
		ans[i] = acs[r[i]] - acs[l[i]];
	}

	for (auto x: ans) {
		cout << x << endl;
	}

	return 0;
}


Measured memory_bytes: 2684
#include<stdio.h>
#include<math.h>
int main(){
    int N,i;
    int cnt = 0;
    int digit;

    scanf("%d", &N);
    
    for(i = 1; i <= N; i++){
        digit = (int)log10((double)i)+1;
        if (digit%2==1)
        {
            cnt++;
        }
        
    }

    printf("%d", cnt);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;

    if (m1 != m2) puts("1");
    else puts("0");
    return 0;
}

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

int main(){
  int N,count,flag;
  flag=0;
  count = 0;
  cin >> N;
  int As[N];
  
  for (int i=0;i<N;i++){
    int a;
    cin >> a;
    As[i]=a;
  }
  
  while (flag==0){
    for(int i=0;i<N;i++){
      if(As[i]%2==0){
        As[i] = As[i]/2;
      }
      else{
        flag = 1;
      }
    }
    if(flag==0){
        count++;
      }
  }
  cout << count;
}

Measured memory_bytes: 256
#include <iostream>
#define N 400
using namespace std;
int n,ma,mb,a,b,c,mn=1e9,x[N+5][N+5];
int main() {
	int i,j;
	cin>>n>>ma>>mb;
	for(i=0; i<=N; i++) for(j=0; j<=N; j++) x[i][j] = 1e9;
	x[0][0] = 0;
	while(n--) {
		cin>>a>>b>>c;
		for(i=N; i>=a; i--) for(j=N; j>=b; j--) {
			x[i][j] = min(x[i][j], x[i-a][j-b]+c);
		}
	}
	for(i=1; i*ma<=N && i*mb<=N; i++) {
		mn = min(mn, x[i*ma][i*mb]);
	}
	cout<<(mn<1e9 ? mn:-1);
	return 0;
}

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

#define fr first
#define sc second
#define mk make_pair

using namespace std;

string s;


int main()
{
    cin >> s;
    int sum = 0;
    for(int i = 0; i < s.size(); i++)
    {
        if(i % 2 == 1)
        {
            if(s[i] == 'g')
                sum++;
        }else
        {
            if(s[i] == 'p')
                sum--;
        }
    }

    cout << sum;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector <int> n(10001,0);
  for(int x=1;x*x<10001;x++){
    for(int y=x;x*x+y*y+x*y<10001;y++){
      for(int z=y;z<10001;z++){
        int tmp;
        tmp=x*x+y*y+z*z+x*y+y*z+z*x;
        if(tmp>10000)break;
        if(x==y&&y==z){
          /*xyzが全て同じ値*/
          n.at(tmp)+=1;
        }else if(x==y||y==z){
          /*xとyとzのうち2つが同じ値.
          ただし，x>=y>=zは常に成り立つ*/
          n.at(tmp)+=3;
        }else{
          n.at(tmp)+=6;
        }
      }
    }
  }
  int N;
  cin >> N;
  for(int i=1;i<N+1;i++){
    cout << n.at(i) << endl;
  }
  return 0;
}

Measured memory_bytes: 3572
from collections import deque
from typing import List, Optional, Tuple


def cycle_detectable_topological_sort(
    graph: List[List[int]], in_degrees: List[int], first_index: int = 0
) -> Tuple[Optional[List[int]], Optional[List[int]]]:
    """Topological sort that uses Kahn's algorithm and detects a loop (DAG or not).
    Returns:
        if the given graph is DAG, a list of sorted vertices and a list of depths of
        each vertex is returned.
        Otherwise, (None, None) is returned.
    """
    V = len(graph) + first_index
    depths = [0] * V  # depths[i] := the length of the longest path to V_i
    order = [i for i in range(first_index, V) if not in_degrees[i]]
    queue = deque(order)

    while queue:
        u = queue.popleft()
        cur_depth = depths[u]
        for v in graph[u]:
            in_degrees[v] -= 1
            if not in_degrees[v]:
                depths[v] = cur_depth + 1
                queue.append(v), order.append(v)

    return (order, depths) if len(order) + first_index == V else (None, None)


def abc139_e():
    # https://atcoder.jp/contests/abc139/tasks/abc139_e
    N, *A = map(int, open(0).read().split())

    ids = [[-1] * (N + 1) for _ in range(N + 1)]
    cur_id = 0
    for i in range(1, N + 1):
        for j in range(i + 1, N + 1):
            ids[i][j] = ids[j][i] = cur_id
            cur_id += 1

    graph = [[] for _ in range(N * (N - 1) // 2)]
    in_degrees = [0] * (N * (N - 1) // 2)
    for i, a in enumerate(zip(*[iter(A)] * (N - 1)), 1):
        source = -1
        for j in a:
            target = ids[i][j]
            if source != -1:
                graph[source].append(target)
                in_degrees[target] += 1
            source = target

    _, depths = cycle_detectable_topological_sort(graph, in_degrees)
    print(max(depths) + 1 if depths else -1)


def grl_4_a():
    # https://onlinejudge.u-aizu.ac.jp/courses/library/5/GRL/4/GRL_4_A
    V, _, *ST = map(int, open(0).read().split())
    graph = [[] for _ in range(V)]
    in_degrees = [0] * V
    for s, t in zip(*[iter(ST)] * 2):
        graph[s].append(t)
        in_degrees[t] += 1

    res, _ = cycle_detectable_topological_sort(graph, in_degrees)
    print(1 if res is None else 0)


if __name__ == "__main__":
    abc139_e()
    # grl_4_a()


Measured memory_bytes: 144364
import sys
sys.setrecursionlimit(10**7)
def dfs(v,c):
  for i,w in enumerate(e[v]):
    e[w]-={v}
    c=c*dfs(w,k-i+~(v>0))%(10**9+7)
  return c
n,k,*t=map(int,open(0).read().split())
e=[set()for _ in[0]*n]
for a,b in zip(t[::2],t[1::2]):
  e[a-1]|={b-1}
  e[b-1]|={a-1}
print(dfs(0,k))

Measured memory_bytes: 119256
#include <iostream>
    #include <string>
    #include <vector>
    #include <math.h>
    using namespace std;
     
    int main() {
            	
    	int N;
    	cin>>N;
    	vector<string> a(N);
    	for (int i = 0; i < N; i++) {
    		cin >> a[i];
    	}
    	for(int i=0;i<N-1;i++){
    	    for(int j=i+1;j<N;j++){
    	        if(a[i]==a[j]){
    	            cout<<"No"<<endl;
    	            return 0;
    	        }
    	    }
    	    if(a[i][a[i].length()-1]!=a[i+1][0]){
    	        cout<<"No"<<endl;
    	        return 0;
    	    }
    	}
    	cout<<"Yes"<<endl;
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,i,flag=0;
    cin>>n;
    char arr[n];
    for(i=0;i<n;i++)
    cin>>arr[i];
    if(n<=1)
    cout<<"No"<<endl;
    else if(n%2!=0)
    cout<<"No"<<endl;
    else
    {
        for(i=0;i<n/2;i++)
        {
            if(arr[i]!=arr[n/2+i])
            {
                flag++;
                break;
            }
        }
        if(flag==0)
        cout<<"Yes"<<endl;
        else
        {
            cout<<"No"<<endl;
        }
        
    }
    
}

Measured memory_bytes: 3500
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d,x,y;
	cin>>a>>b>>c>>d;
	x=a*b;
	y=c*d;
	if(x>y)
	cout<<x;
	else 
	cout<<y;
}
	


Measured memory_bytes: 256
// https://qiita.com/e869120/items/eb50fdaece12be418faa

#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

double calc_dist(double x1, double y1, double x2, double y2) {
    return pow(pow(x1 - x2, 2.0) + pow(y1 - y2, 2.0), 0.5);
}

int main()
{
    int n;
    cin >> n;
    vector<double> X(n), Y(n);
    rep(i, n) {
        cin >> X[i] >> Y[i];
    }

    vector<int> v(n);
    iota(v.begin(), v.end(), 0);
    double res = 0.0;
    double sum = 0.0;
    do {
        sum++;
        for (int i = 0; i < n - 1; i++) {
            res += calc_dist(X[v[i]], Y[v[i]], X[v[i+1]], Y[v[i+1]]);
        }
    } while (next_permutation(v.begin(), v.end()));

    cout << fixed << setprecision(10) << res / sum << endl;

    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;
ll a,b,ans;
int main() {
	cin>>a>>b;
	ans=b-a+1;
	if(b>=0&&a<=0) {puts("Zero");return 0;}
	if(a<0&&ans&1) {puts("Negative");return 0;}
	puts("Positive");
	return 0;
}

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int p[200000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, k;
    cin >> n >> k;
    double ret = 0, cur = 0;
    for (int i=0; i<n; i++) {
        cin >> p[i];
        cur += (p[i] + 1) / 2.0;
        if (i >= k)
            cur -= (p[i-k] + 1) / 2.0;
        ret = max(ret, cur);
    }

    cout << fixed << setprecision(10) << ret << "\n";

    return 0;
}


Measured memory_bytes: 4560
import sys
import math
#import random
#sys.setrecursionlimit(100000000)
input = sys.stdin.readline
 
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
################################################################
############ ---- THE ACTUAL CODE STARTS BELOW ---- ############

x=insr()

for c in x:
	if c=='?':
		print("D",end="")
	else:
		print(c,end="")
	
	
		
		


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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	int N;
	cin >>N;
	vector<vector<int>> S(N, vector<int> (N, 0));
	for (int i=0; i<N; i++) {
		string SS;
		cin >>SS;
		for (int j=0; j<N; j++) 
			S.at(i).at(j)=SS.at(j)-'a';
	}
	int s=0;
	for (int i=0; i<N; i++) {
		bool SIM=true;
		for (int j=0; j<N; j++) {
			int I1=i+j/2;
			int J1=(j+1)/2;
			int I0=i+(j+1)/2;
			int J0=j/2;
			//cout <<"start: " <<I0 <<' ' <<J0 <<' ' <<I1 <<' ' <<J1 <<' ' <<endl;
			for (int k=0; k*2<N; k++) {
				int i0=(I0+k+N)%N;
				int j0=(J0-k+N)%N;
				int i1=(I1-k+N)%N;
				int j1=(J1+k+N)%N;
				//cout <<i0 <<' ' <<j0 <<' ' <<i1 <<' ' <<j1 <<' ' <<endl;
				if (S.at(i0).at(j0)==S.at(i1).at(j1))
					continue;
				else {
					SIM=false;
					break;
				}
			}
			if (!SIM)
				break;
		}
		if (SIM)
			s++;
	}
	cout <<s*N <<endl;
	return 0;
}



Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    // https://atcoder.jp/contests/abc083/tasks/abc083_b
    class Abc_083_B
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int n = inputLongArray[0];
            int a = inputLongArray[1];
            int b = inputLongArray[2];
            int result = 0;
            for (int i = 0; i <= n; i++)
            {
                int sum = findSumOfDigits(i);
                if (sum >= a && sum <= b)
                {
                    result += i;
                }
            }

            Console.WriteLine(result);

            Console.Out.Flush();
        }
        // 各桁の和を計算する関数
        private static int findSumOfDigits(int n)
        {
            int sum = 0;
            while (n > 0)
            { // n が 0 になるまで
                sum += n % 10;
                n /= 10;
            }
            return sum;
        }
    }
}


Measured memory_bytes: 13396
def solve(x):
    ans = (x // 11) * 2
    x -= (ans // 2) * 11
    if x == 0:
        return ans
    elif x <= 6:
        return ans + 1
    else:
        return ans + 2


if __name__ == "__main__":
    x = int(input())
    print(solve(x))


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

int main() {
  vector<int> num(28);
  int i, count;
  for (i = 0; i < 28; i++) {
    cin >> num[i];
  }
  sort(num.begin(), num.end());
  count = 1;
  for (i = 0; i <= 28; i++) {
    if (num[i] != count) {
      cout << count << endl;
      count++;
    }

    count++;
    if (count > 30) {
      break;
    }
  }
  return 0;
}



Measured memory_bytes: 3164
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt(), k = scanner.nextInt();
			double sum = IntStream.rangeClosed(1, Math.min(n, k)).mapToDouble(i -> {
				double result = 1.0d;
				// iがkを超えるまでコインを振り続ける
				while (i < k) {
					i <<= 1;
					result /= 2.0d;
				}
				return result;
			}).sum();
			sum += (n > k) ? (n - k) : 0.0d;
			System.out.println(sum / n);
		}
	}
}


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

void boost(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int main(){
    boost();
    ll n;
    cin >> n;
    vector<ll>v(n);
    ll i;
    for(i=0;i<n;i++){
    cin >> v.at(i);
    
    if(v.at(i)==0){
        cout << "0"<< endl;
        return 0;
        }
    }
    ll ans=1;
    for(i=0;i<n;i++){
        double x = (double)ans*(double)v[i];
        if(x>1e18){
            cout << "-1" << endl;
            return 0;
        }
        ans*=v[i];
        if(ans>(ll)1e18){
            cout << "-1" << endl;
            return 0;
        }
    }
    cout << (ll)ans << endl;
}

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

string rotate(string s){
    string s1 = s;
    for(int i = 0; i < s.size() - 1; i ++) s1[i] = s[i+1];
    s1[s.size()-1] = s[0];
    
    return s1;
}

int main(void){
    
    string s, t;
    cin >> s >> t;
    int n = s.size();
    for(int i = 0; i < n; i ++){
        s = rotate(s);
        if(s == t){
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;

#define ll long long

const int INF = 1e9+5;

int main(){

    
    int n, w;
    cin >> n >> w;
    vector<ll> weight(n), value(n);

    for(int i = 0; i < n; ++i){
        cin >> weight[i] >> value[i];
    }
    int sum_value = 0;
    for(int i = 0; i < n; ++i){
        sum_value += value[i];
    }

    vector<ll> dp(sum_value+1, INF);
    dp[0] = 0;
    // dp[i] - the minimum total weight of items with total value exactly i
    for(int i = 0; i < n; ++i){
        for(int value_cal = sum_value-value[i]; value_cal >= 0; --value_cal){
            dp[value_cal+value[i]] = min(dp[value_cal+value[i]], dp[value_cal]+weight[i]);
        }
    }

    ll ans = 0;
    for(int i = 0; i <= sum_value; ++i){
        if(dp[i] <= w)
            ans = max(ans, (ll)i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <map>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;

int main(void){
  int N;
  cin >> N;
  int a[N];
  rep(i, N)
    cin >> a[i];
  //ここまで入力

  //整数firstがsecond個あることを表す
  map<int, int> mapp;
  rep(i, N)
    mapp[a[i] ]++;

  //取り除く整数の数
  int count = 0;
  for(auto m : mapp){
    //整数よりも個数の方が大きければ，差分が取り除く数
    if(m.first < m.second)
      count += (m.second - m.first);
    //整数の方が個数よりも小さければ，今ある個数だけ取り除く
    else if(m.first > m.second)
      count += m.second;
  }

  cout << count << endl;
    
  return 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,x,y;
  cin>>n>>k>>x>>y;
  if(n<=k){
    cout<<n*x<<endl;
  }
  else{
	cout<<k*x+(n-k)*y<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
<?php
//error_reporting(0);
//$N = (int)trim(fgets(STDIN));
//$S = trim(fgets(STDIN));
list($X,$Y,$Z) = array_map('intval',explode(" ",trim(fgets(STDIN))));
//$a = array_map('intval',explode(" ",trim(fgets(STDIN))));

list($X,$Y) =array($Y,$X);
list($X,$Z) = array($Z,$X);
printf("%d %d %d\n",$X,$Y,$Z);


Measured memory_bytes: 4728
H, W, K = map(int, input().split())
S = [list(input()) for _ in range(H)]
ans = [[0] * W for _ in range(H)]

def calc(h, w, k):
    #上下方向の限界を決める
    up = h
    for i in range(1, h + 1):
        if S[h - i][w] == '.' and ans[h - i][w] == 0:
            if h == i:
                up = 0
            continue
        else:
            up = h - (i - 1)
            break

    down = h
    for i in range(1, H - h):
        if S[h + i][w] == '.' and ans[h + i][w] == 0:
            if i == H - h - 1:
                down = H - 1
            continue
        else:
            down = h + (i - 1)
            break
    # print ('up, down =', up, down, i)
    # up から down までの縦の長さの長方形を作る。
    for i in range(up, down + 1):
        ans[i][w] = k
    
    flag = True
    for i in range(1, w + 1):
        for j in range(up, down + 1):
            if ans[j][w - i] == 0 and S[j][w - i] == '.':
                continue
            else:
                flag = False
                break
        if not flag:
            break
        for j in range(up, down + 1):
            ans[j][w - i] = k
    flag = True
    for i in range(1, W - w):
        for j in range(up, down + 1):
            if ans[j][w + i] == 0 and S[j][w + i] == '.':
                continue
            else:
                flag = False
                break
        if not flag:
            break
        for j in range(up, down + 1):
            ans[j][w + i] = k
        


k = 1
for w in range(W):
    for h in range(H):
        if S[h][w] == '#':
            # print (h, w)
            calc(h, w, k)
            k += 1

for tmp in ans:
    print (*tmp, sep = ' ')

Measured memory_bytes: 8256
#include<bits/stdc++.h>
#define reg register
#define ll long long
#define pi acos(-1)
using namespace std;
ll n,m;
int main()
{
    scanf("%lld%lld",&n,&m);
    printf("%lld",n<=((n<<1)+m)>>2?((n<<1)+m)>>2:m>>1);
    return 0; 
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
  int N, M;
  while (cin >> N >> M) {
    vector<vector<pair<int, int>>> conditions(N);
    for (int i = 0; i < M; i++) {
      int s, t, x;
      cin >> s >> t >> x;
      --s;
      --t;
      conditions[t].emplace_back(s, x);
    }
    static ll dp[310][310][310];
    memset(dp, -1, sizeof(dp));
    function<ll(int, int, int)> solve = [&](int r, int g, int b) {
      ll &res = dp[r + 1][g + 1][b + 1];
      if (res != -1) {
        return res;
      }
      int k = max({r, g, b});
      if (k >= 0) {
        for (auto cond : conditions[k]) {
          int s = cond.first, x = cond.second;
          int y = (s <= r) + (s <= g) + (s <= b);
          if (y != x) {
            return res = 0;
          }
        }
      }
      if (k >= N - 1) {
        return res = 1;
      }
      res = 0;
      res = (res + solve(k + 1, g, b)) % MOD;
      res = (res + solve(r, k + 1, b)) % MOD;
      res = (res + solve(r, g, k + 1)) % MOD;
      return res;
    };
    cout << solve(-1, -1, -1) << endl;
  }
  return 0;
}


Measured memory_bytes: 233088
#pragma GCC optimize(2,3,"Ofast","unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define in inline
namespace fast_io
{
	char buf[1<<12],*p1=buf,*p2=buf,sr[1<<23],z[23],nc;int C=-1,Z=0,Bi=0,ny;
	in char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
	in ll read()
	{
		ll x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;Bi=1;if(nc<0)return nc;
		x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48),Bi++;return x*ny;
	}
	in db gf() {int a=read(),y=ny,b=(nc!='.')?0:read();return (b?a+(db)b/pow(10,Bi)*y:a);}
	in int gs(char *s) {char c,*t=s;while(c=gc(),c<=32);*s++=c;while(c=gc(),c>32)*s++=c;return s-t;}
	in void ot() {fwrite(sr,1,C+1,stdout);C=-1;}
	in void flush() {if(C>1<<22) ot();}
	template <typename T>
	in void write(T x,char t)
	{
		int y=0;if(x<0)y=1,x=-x;while(z[++Z]=x%10+48,x/=10);
		if(y)z[++Z]='-';while(sr[++C]=z[Z],--Z);sr[++C]=t;flush();
	}
	in void write(char *s) {int l=strlen(s);for(int i=0;i<l;i++)sr[++C]=*s++;sr[++C]='\n';flush();}
};
using namespace fast_io;
#define pb push_back
int main()
{
	int a;cin>>a;
	cout<<a+a*a+a*a*a<<endl;
	return ot(),0;
}
//Author: disangan233

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
const int N=1e6;
ll v[N+10];
#define charToInt(c) (c-'0')

int main()
{
 ll sum = 0;

string str;

cin>>str;

for (ll i=0; i<str.length(); ++i)
 {

 if (isdigit(str[i]))
    {


   ll a=charToInt(str[i]);

 sum = sum + a;

 }

}

if(sum%9==0)cout<<"Yes"<<endl;
else cout<<"No"<<endl;




return 0;
}


Measured memory_bytes: 3752
n,k=map(int,input().split())
p=list(map(int,input().split()))
ans=0
for i in range(k):
    ans+=p[i]
pre=ans
for i in range(k,n,1):
    pre=(pre+p[i]-p[i-k])
    if ans<pre:
        ans=pre
print((ans+k)*0.5)

Measured memory_bytes: 71792
#include <cstdio>
using namespace std;
const int MAXN=1e6+7;
int n,cnt=0;
int a[MAXN],g[105],h[105];
void is (int g) {
	for (int i=g;i<n;i++) {
		int v=a[i],j=i-g;
		while (j>=0&&a[j]>v) {
			a[j+g]=a[j];
			j-=g;
			cnt++;
		}
		a[j+g]=v;
	}
}
int main () {
	scanf ("%d",&n);
	for (int i=0;i<n;i++) {
		scanf ("%d",&a[i]); 
	}
	int m=1;
	h[1]=1;
	while (h[m]<n) h[++m]=3*h[m-1]+1;
	if (h[m]>n) m--;
	for (int i=1;i<=m;i++) {
		g[i]=h[m+1-i];
	}
	for (int i=1;i<=m;i++) {
		is (g[i]);
	}
	printf ("%d\n%d",m,g[1]);
	for (int i=2;i<=m;i++) {
		printf (" %d",g[i]);
	}
	printf ("\n%d\n",cnt);
	for (int i=0;i<n;i++) {
		printf ("%d\n",a[i]);
	}
    return 0;
}


Measured memory_bytes: 6508
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <iomanip>
#include <map>
using namespace std;

void solve(){
  string s; cin >> s;
  string sy, sm, sd;
  for(int i = 0; i < 4; i++) sy[i] = s[i];
  for(int i = 0; i < 2; i++) sm[i] = s[4 + i];
  for(int i = 0; i < 2; i++) sd[i] = s[6 + i];
  if(s <= "2019/04/30") cout << "Heisei\n";
  else cout << "TBD\n";
  return;
}

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


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

ans = 0
for i in range(n,0,-1):
    if a[i] <= b[i-1]:
        ans += a[i]
        b[i-1] = b[i-1] - a[i]
    else:
        ans += b[i-1]
        b[i-1] = 0
    if a[i-1] <= b[i-1]:
        ans += a[i-1]
        a[i-1] = 0
    else:
        ans += b[i-1]
        a[i-1] = a[i-1] - b[i-1]

print(ans)


Measured memory_bytes: 19776
import math

a1 = list(map(int, input().rstrip().split()))
a2 = list(map(int, input().rstrip().split()))
a3 = list(map(int, input().rstrip().split()))
a = [a1,a2,a3]

m = [[0,0,0],[0,0,0],[0,0,0]]

n = int(input())
b = []
for i in range(n) :
    b = int(input())
    for j in range(3) :
        for k in range(3) :
            if a[j][k] == b :
                m[j][k] = 1

if m[0].count(1) == 3 :
    print('Yes')
elif m[1].count(1) == 3 :
    print('Yes')
elif m[2].count(1) == 3 :
    print('Yes')
elif m[0][0] == 1 and m[1][0] == 1 and m[2][0] ==1 :
    print('Yes')
elif m[0][1] == 1 and m[1][1] == 1 and m[2][1] ==1 :
    print('Yes')
elif m[0][2] == 1 and m[1][2] == 1 and m[2][2] ==1 :
    print('Yes')
elif m[0][0] == 1 and m[1][1] == 1 and m[2][2] ==1 :
    print('Yes')
elif m[0][2] == 1 and m[1][1] == 1 and m[2][0] ==1 :
    print('Yes')
else :
    print('No')


Measured memory_bytes: 3064