akhauriyash/Code-Regression huggingface dataset:
/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

#[inline]
#[allow(dead_code)]
fn gcd(mut m: u64, mut n: u64) -> u64 {
    if m < n {
        std::mem::swap(&mut m, &mut n);
    }

    loop {
        let k = m % n;
        if k == 0 {
            return n;
        }

        m = n;
        n = k;
    }
}

#[inline]
#[allow(dead_code)]
fn lcm(m: u64, n: u64) -> u64 {
    m / gcd(m, n) * n
}

macro_rules! eprint(
    ($($arg:tt)*) => { {
        use std::io::Write;
        let r = write!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

macro_rules! eprintln(
    ($($arg:tt)*) => { {
        use std::io::Write;
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

macro_rules! dbg {
    ($val:expr) => {
        // Use of `match` here is intentional because it affects the lifetimes
        // of temporaries - https://stackoverflow.com/a/48732525/1063961
        match $val {
            tmp => {
                eprintln!("[{}:{}] {} = {:#?}",
                          file!(), line!(), stringify!($val), &tmp);
                tmp
            }
        }
    }
}

fn main() {
    input!{
        n: u64,
        m: u64,
    }

    let mut m = m;
    let mut answer = 0;
    if n * 2 <= m {
        m -= n * 2;
        answer += n + m / 4;

    } else {
        answer += m / 2;
    }

    println!("{}", answer);
}


Measured memory_bytes: 4352
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static boolean can(long A[] , long F[] , long val , long K){
		int N = A.length;
		long req[] = new long[N];
		for(int i = 0 ; i < N ; ++i){
			req[N - 1 - i] = val / F[i];
		}
		long r = 0;
		for(int i = 0 ; i < N ; ++i){
			if(req[i] >= A[i]){
			}else{
				r += A[i] - req[i];
			}
		}
		return r <= K;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long K = sc.nextLong();
		long A[] = new long[N];
		long F[] = new long[N];
		for(int i = 0 ; i < N ; ++i){
			A[i] = sc.nextLong();
		}
		for(int i = 0 ; i < N ; ++i){
			F[i] = sc.nextLong();
		}
		Arrays.sort(A);
		Arrays.sort(F);
		long high = A[N - 1] * F[N - 1];
		long low = 0;
		if(can(A, F , low , K)){
			System.out.println(low);
		}else{
			while(low < high){
				long mid = low + (high - low) / 2;
				if(can(A, F , mid , K)){
					high = mid;
				}else{
					low = mid + 1;
				}
			}
			System.out.println(low);
		}
	}
}


Measured memory_bytes: 159184
fn main() {
    println!("{}", (1..read::<usize>() + 1).sum::<usize>());
}

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


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  cout << 180 * (N-2) << endl;
  return 0;
}


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

int main(){
    int n,a,b,c,d;
    string s;
    cin >> n >> a >> b >> c >> d >> s;
    s="#"+s+"#";

    auto can_jump = [&](int start,int goal){
        for (int i = start; i+1 <= goal; i++){
            if (s[i]=='#'&&s[i+1]=='#'){
                return false;
            }
        }
        return true;
    };

    if(!can_jump(a,c)||!can_jump(b,d)){
        cout << "No" <<endl;
        return 0;
    }

    if (c>d){
        bool sunuke = false;
        for (int i = b; i <= d; i++){
            if (s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.'){
                sunuke = true;
            }
        }
        if(!sunuke){
            cout << "No" << endl;
            return 0;
        }
    }


    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 772
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int gcd(int m, int n) {
  while (m != n) {
    if (m > n)
      m = m - n;
    else
      n = n - m;
  }
  return m;
}

int main() {
  int n;
  scanf("%d", &n);
  int m;
  int a[100001];
  int max = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &m);
    a[i] = m;
    if (m > max)
      max = m;
  }
  int ans;
  for (int i = m; i > 0; i--) {
    int f = 0;
    int j;
    for (j = 0; j < n; ++j) {
      if (a[j] % i != 0)
        f++;
      if (f > 1)
        break;
    }
    if (f <= 1) {
      ans = i;
      break;
    }
  }
  printf("%d\n", ans);

  return 0;
}


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

#S = [[0 for j in range(3)] for i in range(2)]　2行3列の場合
S = [[0 for j in range(3)] for i in range(N)]

for i in range(M):
    A,B=map(str,input().split())
    A=int(A)
    if B=="AC":
        S[A-1][1]="AC"
    elif B=="WA":
        if S[A-1][1]=="AC":
            S[A-1][2]+=0
        else:
            S[A-1][2]+=1

ACcount=0
WAcount=0
for i in range(N):
    if S[i][1]=="AC":
        ACcount+=1
        WAcount+=S[i][2]
        
print(ACcount,WAcount)

Measured memory_bytes: 14836
#include <bits/stdc++.h>
using namespace std;
int A[20] = {};
int X[20][20] = {}, Y[20][20] = {};

int bitcount(int bits){
  int ans = 0;
  for(int i=0; i<15; i++){
    ans += 1 & (bits>>i);
  }
  return ans;
}

int Main(){
  int N;
  cin>>N;
  for(int i=0; i<N; i++){
    cin>>A[i];
    for(int j=0; j<A[i]; j++){
      cin>>X[i][j]>>Y[i][j];
    }
  }

  int bits;
  int ans = 0;
  for(bits=0; bits<(1<<N); bits++){
    //bit探索
    //cout<<"bits"<<bits;
    bool ok = true;
    for(int i=0; i<N; i++){
      //人iについて
      if(bits & (1<<i)){
        //iを正直と仮定しているとき要判定
        for(int j=0; j<A[i]; j++){
          //各証言について
          if( Y[i][j] ^ ( 1 & (bits>>(X[i][j]-1)) ) ){
            //-1が重要。Xは1始まりなので
            //j番目の証言と仮定が違う時
            ok = false;
          }
        }
      }
    }
    if(ok){
      //cout<<"ok"<<endl;
      ans = max(ans, bitcount(bits));
    }else{
      //cout<<"ng"<<endl;
    }
  }

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

int main(){
  Main();
}

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


using namespace std;


int main() {
    string S;
    cin >> S;
    int Q;
    cin >> Q;

    deque<char> s;
    for (auto ch : S)
        s.push_back(ch);

    bool rev = false;
    for (int i = 0; i < Q; i++) {
        int T, F;
        char C;
        cin >> T;
        if (T == 1) {
            rev = !rev;
            continue;
        }
        cin >> F >> C;
        if (rev) {
            F = (F == 1) ? 2 : 1;
        }
        if (F == 1) {
            s.push_front(C);
        } else if (F == 2) {
            s.push_back(C);
        }
    }

    if (rev) {
        for (auto it = s.rbegin(); it != s.rend(); ++it)
            cout << *it;
        cout << endl;
    } else {
        for (auto it = s.begin(); it != s.end(); ++it)
            cout << *it;
        cout << endl;
    }
}


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

//region Template
#include "ext/pb_ds/assoc_container.hpp"
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const int MOD = 1000000007;

using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;

#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(const string& USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }
/*
template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
 */
//endregion

/* Notes:
 * Farah </3
 */
const int MAXN = 2e5 + 6;

ll fact[MAXN];

long long modPow(ll b , long long pow){
	long long ans = 1;
	long long p = b;
	while(pow){
		if(pow & 1)
			ans = (ans * p) % MOD;
		p = (p * p) % MOD;
		pow >>= 1;
	}
	return ans;
}

void pre(){
	fact[0] = fact[1] = 1;

	for(ll i = 2; i <= 2005; i++){
		fact[i] = (i * fact[i - 1]) % MOD;
	}
}

ll ncr(int n, int r){
	ll x =  (fact[n] * modPow( fact[r], MOD - 2)) % MOD;
	x = (x * modPow( fact[n - r], MOD - 2)) % MOD;

	return x;
}

pair<int, int> p[MAXN];

int main() {
	#ifdef LOCAL

	setIn("in.txt");
	setOut("out.txt");
	#endif

	int n;
	cin >> n;


	for(int i = 0; i < n; i++){
		cin >> p[i].second >> p[i].first;
	}

	sort(p, p + n);

	int cur = 0;

	for(int i = 0; i < n; i++){
		if(p[i].second + cur > p[i].first){
			finish("No");
		}
		else{
			cur += p[i].second;
		}
	}

	cout << "Yes";
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i > n; --i)

ll solve() {
  int N; cin >> N;
  vector<int> A(N);
  rep(i, 0, N) cin >> A[i];
  rep(i, 0, N) if(A[i] > i) return -1;
  rep(i, 1, N) if(A[i] - A[i-1] > 1) return -1;
  int n = 0;
  ll ans = 0;
  rem(i, N-1, 0) {
    if(n < A[i]) {
      ans += A[i];
      n = A[i];
    }
    if(n) n--;
  }
  return ans;
}

int main() {
  cout << solve() << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;


int main()
{
  int a, b, c, K;
  scanf("%d %d %d", &a, &b, &c);
  scanf("%d", &K);
  int ans = a + b + c;
  int most = max(a, max(b, c));
  ans -= most;
  for (int i = 0; i < K; ++i) {
    most *= 2;
  }
  ans += most;
  printf("%d\n", ans);

  return 0;
}


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

int main(){
	int ans=0,n,k,x[100];

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

	for(int i=0;i<n;i++){
		if(x[i]<abs(k-x[i]))ans+=x[i]*2;
		else ans+=abs(k-x[i])*2;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

s64 N, K;
vs64 A;

bool bs(s64 x)
{
    s64 ret = 0;
    rep (i, N)
    {
        if (A[i] < 0)
        {
            int l = -1;
            int r = N;
            while (l + 1 < r)
            {
                int m = (l + r) / 2;
                if (A[i] * A[m] < x)
                {
                    r = m;
                }
                else
                {
                    l = m;
                }
            }
            ret += N - r;
        }
        else
        {
            int l = -1;
            int r = N;
            while (l + 1 < r)
            {
                int m = (l + r) / 2;
                if (A[i] * A[m] < x)
                {
                    l = m;
                }
                else
                {
                    r = m;
                }
            }
            ret += r;
        }
        if (A[i] * A[i] < x) --ret;
    }
    ret /= 2;
    return ret < K;
}

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

    cin >> N >> K;

    A.resize(N);
    rep (i, N)
    {
        cin >> A[i];
    }
    sort(A.begin(), A.end());

    s64 l = -((s64)1e18 + 1);
    s64 r = (s64)1e18 + (s64)1;

    while (l + 1 < r)
    {
        s64 m = (l + r) / 2;
        if (bs(m))
        {
            l = m;
        }
        else
        {
            r = m;
        }
    }

    cout << l << "\n";
    return 0;
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(ll i=0;i<(n);++i)
#define Fr(i,n) for(long long i=1;i<=(n);++i)
#define ifr(i,n) for(long long i=(n)-1;i>=0;--i)
#define iFr(i,n) for(long long i=(n);i>0;--i)
using Graph = vector<vector<int>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll a,b;
  cin>>a;
  ll arr[a+1][3];
  arr[0][0]=0;
  arr[0][1]=0;
  arr[0][2]=0;
  Fr(i,a){
    ll x,y,z;
    cin>>x>>y>>z;
    arr[i][0]=x;
    arr[i][1]=y;
    arr[i][2]=z;
  }
  fr(i,a){
    if(abs(arr[i+1][0]-arr[i][0])%2!=(abs(arr[i][1]-arr[i+1][1])+abs(arr[i+1][2]-arr[i][2]))%2 or abs(arr[i][1]-arr[i+1][1])+abs(arr[i+1][2]-arr[i][2])>abs(arr[i+1][0]-arr[i][0])){
      cout<<"No";
      exit(0);
    }
  }
  cout<<"Yes";
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;
const double PI = acos(-1);

int main() {
    int N; cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) scanf("%lld", &A[i]);

    vector<ll> csum(N);
    csum[0] = A[0];
    for (int i = 1; i < N; i++) {
        csum[i] = csum[i - 1] + A[i];
    }

    ll ans = INF;
    for (int i = 0; i < N - 1; i++) {
        ll snk = csum[i];
        ll ari = csum[N - 1] - csum[i];
        chmin(ans, abs(snk - ari));
    }

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

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

int main(){
    char b;
    cin>>b;
    
    switch(b){
        case 'A':
            cout<<'T'<<endl;
            break;
        case 'T':
            cout<<'A'<<endl;
            break;
        case 'C':
            cout<<'G'<<endl;
            break;
        case 'G':
            cout<<'C'<<endl;
            break;
    }

    return 0;
}

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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = int.Parse(Console.ReadLine());
            if (input < 2800)
            {
                if (input < 1200)
                {
                    Console.WriteLine("ABC");
                }
                else
                {
                    Console.WriteLine("ARC");
                }
            }
            else
            {
                Console.WriteLine("AGC");
            }
        }
    }
}


Measured memory_bytes: 11092
<?php
  declare(strict_types=1);

  fscanf(STDIN, "%i", $x);
  $d = (int)ceil($x / 11);
  $m = $x % 11;
  echo ($d * 2 - (($m >= 1 && $m <= 6) ? 1 : 0)).PHP_EOL;
?>


Measured memory_bytes: 2936
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
    int N,K;
    int l[60];
    cin >> N >> K;
    for (int i = 0; i < N; ++i) cin >> l[i];

    sort(l, l + N,greater<int>());
    int sum = 0;
    for(int i = 0; i < K; ++i){
        sum += l[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
N = int(input())

##########木を作る###########
S = [[]for i in range(N)] 
for i in range(N-1):
    a,b,c = map(int,input().split())
    S[a-1].append([b-1,c])
    S[b-1].append([a-1,c])

############クエリを保存#########
Q,K = map(int,input().split())
xy = list(list(map(int,input().split()))for i in range(Q))

len_ = [float('inf')]*N  # Kまでの距離
len_[K-1] = 0 #　K~Kは距離0

#############幅優先探索############
queue = [K-1]
hoge = []
while queue != []:
    for i in queue:
        for b,c in S[i]:
            if len_[b] > len_[i]+c:
                hoge.append(b)
                len_[b] = len_[i]+c
    queue = hoge
    hoge = []

#############x~K,y~Kの距離の和###########
for x,y in xy:
    print(len_[x-1]+len_[y-1])

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


void solve(long long N, long long K, std::vector<long long> l){
  sort(l.begin(), l.end(), greater<long long>());


  cout << accumulate(l.begin(), l.begin()+K, 0ll) << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long K;
  scanf("%lld",&K);
  std::vector<long long> l(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&l[i]);
  }
    solve(N, K, std::move(l));
    return 0;
}


Measured memory_bytes: 3672
#include<bits/stdc++.h>
#define LL long long
#pragma GCC optimize(2)
#define clr(x,y) memset(x,y,sizeof(x))
#define FOR(x,l,r) for(int x=l,x##_=r;x<=x##_;x++)
#define FR(x,l,r) for(int x=l,x##_=r;x<x##_;x++)
#define DOR(x,r,l) for(int x=r,x##_=l;x>=x##_;x--)
using namespace std;
const int N=100005;
const LL P=1e9+7;
int n,k,sz[N],dep[N];
LL ans=1;
vector<int>edge[N];
void dfs(int x,int f) {
	int s=edge[x].size();
	FR(i,0,edge[x].size()){
		int to=edge[x][i];
		if(to==f)continue;
		sz[to]=k-s;
		s--;
		dfs(to,x);
	}
}
int main() {
	scanf("%d%d",&n,&k);
	FOR(i,2,n){
		int a,b;
		scanf("%d%d",&a,&b);
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	dfs(1,0);
	sz[1]=k;
	FOR(i,1,n){
		if(sz[i]<0)ans=0;
		else ans=1LL*ans*sz[i]%P;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 10752
from math import sqrt

def circle(x1, y1, x2, y2, x3, y3):
    if x1 == 0:
        dx = 1
        x1 = x1 + dx
        x2 = x2 + dx
        x3 = x3 + dx
    else:
        dx = 0
    if y2 == 0:
        dy = 1
        y1 = y1 + dy
        y2 = y2 + dy
        y3 = y3 + dy
    else:
        dy = 0
    A = [[x1, y1, 1, 1, 0, 0],[x2, y2, 1, 0, 1, 0],[x3, y3, 1, 0, 0, 1]]
#    print(A)
    for i in range(3):
        A[0] = [x/A[0][0] for x in A[0]]
        A[1] = [A[1][j] - A[1][0] * A[0][j] for j in range(6)]
        A[2] = [A[2][j] - A[2][0] * A[0][j] for j in range(6)]
#        print(A)
        for j in range(3):
            A[j] = A[j][1:] + A[j][:1]
        A = A[1:] + A[:1]
#        print(A)
    for i in range(3):
        A[i] = A[i][:3]
#    print(A)
    V = [-x1**2-y1**2, -x2**2-y2**2, -x3**2-y3**2]
    M = [(A[i][0] * V[0] + A[i][1] * V[1] + A[i][2] * V[2]) for i in range(3)]
    xcenter = -0.5 * M[0] - dx
    ycenter = -0.5 * M[1] - dy
    radius = sqrt((M[0]**2) /4 + (M[1]**2) /4 - M[2])
    return xcenter, ycenter, radius

n = int(input())
for line in range(n):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    xc, yc, ra = circle(x1, y1, x2, y2, x3, y3)
    print('%.3f %.3f %.3f' % (xc, yc, ra))

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

using namespace std;

typedef long long ll;

void print(vector<int> v){
	rep(i, v.size()) cout << v[i];
	cout << endl;
}

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

	string S;
	cin >> S;

	int N = S.size();

	vector<int> v(N);
	rep(i, N) v[i] = S[i] - '0';

	int p = 0;
	int ans = 0;
	while(v.size() > 1 && p < v.size()-1){
		// cout << p << ":";
		// print(v);

		if(v[p] != v[p+1]){
			v.erase(v.begin()+p, v.begin()+p+2);
			ans += 2;
			if(p > 0) p--;
		}else{
			p++;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 848
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N; cin >> N;
  ll ans = 0;
  for(ll i = 1; i <= N; i++){
    if(i%3 == 0) continue;
    if(i%5 == 0) continue;
    ans += i;
  }
  cout << ans << endl;
}

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

int main()
{
    int N;
    int a;
    int count;

    cin >> N;

    count = 0;
    for(int i = 1; i <= N; i++) {
        cin >> a;
        if((i%2) == 1 && (a%2) == 1) {
            count += 1;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3560
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    A, B, C, D = map(int, input().split())

    if math.ceil(A/D) >= math.ceil(C/B):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Measured memory_bytes: 72788
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

#define MAX_N 100000
#define LOWER -30000000000
#define UPPER 30000000000
int a, b, q;

int main(void) {
  cin >> a >> b >> q;
  vector<long long> s(a), t(b);
  for (int i = 0; i < a; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < b; i++) {
    cin >> t[i];
  }
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  for (int i = 0; i < q; i++) {
    long long x;
    cin >> x;
    auto it = lower_bound(s.begin(), s.end(), x);
    long long s1, s2;
    if (it == s.begin()) {
      s1 = *it;
      s2 = LOWER;
    } else if (it == s.end()) {
      s1 = UPPER;
      s2 = s2 = *(--it);
    } else {
      s1 = *it;
      s2 = *(--it);
    }
    auto it2 = lower_bound(t.begin(), t.end(), x);
    long long t1, t2;
    if (it2 == t.begin()) {
      t1 = *it2;
      t2 = LOWER;
    } else if (it2 == t.end()) {
      t1 = UPPER;
      t2 = *(--it2);
    } else {
      t1 = *it2;
      t2 = *(--it2);
    }
    long long r1 = x - min(s2, t2);
    long long r2 = max(s1, t1) - x;
    long long r3 = (s1 - t2) + min(s1 - x, x - t2);
    long long r4 = (t1 - s2) + min(t1 - x, x - s2);
    long long r = min(min(r1, r2), min(r3, r4));
    cout << r << endl;
  }
}

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

using namespace std;
int main() {
  int k, x;
  cin >> k >> x;
  int maxXMax = x + k - 1;
  int minXMin = x - k + 1;

  for (int i = minXMin; i <= maxXMax; i++) {
    if (i == maxXMax) {
      cout << i << endl;
    } else {
      cout << i << " ";
    }
  }
  return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import copy

def linearSearch(S, length, key):
    numList = copy.copy(S)
    numList.append(key)
    j = 0
    while numList[j] != key:
        j += 1
    return j != length
    

sum = 0
lenS = int(input())
S = list(map(int, input().split())) 
lenT = int(input())
T = list(map(int, input().split())) 

for i in range(lenT):
    tmp = linearSearch(S, lenS, T[i])
    if tmp:
        sum += 1
print(sum)

    




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

const int MOD = (int)1e9+7;

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

	int ans=0;
	for(int i=0;i<S.size()/2;i++){
		if(S.at(i)!=S.at(S.size()-1-i))	ans++;
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
template< int id > struct CompTupleBy
{
  template<class T> 
  bool operator()( const T& a, const T& b ) const {
    return std::get<id>(a) < std::get<id>(b);
  }
};

using namespace std;

int main(){
    int n;
    cin >> n;
    map<string,ll> mp;
    mp["M"] = 0;
    mp["A"] = 0;
    mp["R"] = 0;
    mp["C"] = 0;
    mp["H"] = 0;
    rep(i,n){
        string tmp;
        cin >> tmp;
        char first_ch = tmp[0];
        if (first_ch == 'M'){
            mp["M"] += 1;
        }else if(first_ch == 'A'){
             mp["A"] += 1;
        }else if(first_ch == 'R'){
             mp["R"] += 1;
        }else if(first_ch == 'C'){
             mp["C"] += 1;
        }else if(first_ch == 'H'){
             mp["H"] += 1;
        }
    }
    ll ans = 0;
    ans += mp["M"]*mp["A"]*mp["R"];
    ans += mp["M"]*mp["A"]*mp["C"];
    ans += mp["M"]*mp["A"]*mp["H"];
    ans += mp["M"]*mp["R"]*mp["C"];
    ans += mp["M"]*mp["R"]*mp["H"];
    ans += mp["M"]*mp["C"]*mp["H"];
    ans += mp["A"]*mp["R"]*mp["C"];
    ans += mp["A"]*mp["R"]*mp["H"];
    ans += mp["A"]*mp["C"]*mp["H"];
    ans += mp["R"]*mp["C"]*mp["H"];
    cout << ans << endl;

    
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	ll l, r, ans;
	cin >> l >> r;

	if((r - l + 1) > 2018) ans = 0;
	else{
		ans = INT_MAX;
		for(ll i = l; i <= r; i++){
			for(ll j = i+1; j <= r; j++){
				ans = min(ans,(ll)((i*j)%2019));
			}
		}
	}

	cout << ans;
}

Measured memory_bytes: 256
function Main(input){
	input = input.split("\n");
	var bin_arr = [];
	for(var i = 0;i<3;i++){
		var temp = input[i].split(" ");
		for(var j = 0;j<3;j++)bin_arr[i*3+j] = parseInt(temp[j],10);
	}
	var N = parseInt(input[3],10);
	var b =[];
	for(var i = 0;i<N;i++)b.push(parseInt(input[i+4],10));
	for(var i= 0;i<9;i++){
		for(var j = 0;j<N;j++){
			if(bin_arr[i] === b[j])bin_arr[i] = 0;
		}
	}
	var result = false;
	for(var i= 0; i<7;i++){
		switch(i){
			case 0:
			if(bin_arr[i] == bin_arr[i+1] && bin_arr[i] == bin_arr[i+2]){
				result = true;
			}else if(bin_arr[i] == bin_arr[i+4] && bin_arr[i] == bin_arr[i+8]){
				result = true;
			}else if(bin_arr[i] == bin_arr[i+3] && bin_arr[i] ==bin_arr[i + 6]){
				result = true;
			}
			break;
			case 1:
			if(bin_arr[i] == bin_arr[i+3] && bin_arr[i]== bin_arr[i+6])result = true;
			break;
			case 2:
			if(bin_arr[i] == bin_arr[i+2] && bin_arr[i] == bin_arr[i+4]){
				result = true;
			}else if(bin_arr[i] == bin_arr[i+3] && bin_arr[i]== bin_arr[i+6]){
				result = true;
			}
			break;
			case 3:
			if(bin_arr[i] == bin_arr[i+1] && bin_arr[i] == bin_arr[i+2])result = true;
			break;
			case 6:
			if(bin_arr[i] == bin_arr[i+1] && bin_arr[i] == bin_arr[i+2])result = true;
			break;
		}//switch
	}
	console.log(result ? "Yes":"No");
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));


Measured memory_bytes: 7372
#include<iostream>
#include<algorithm>
typedef long long lint;
using namespace std;

lint f(lint a,lint b)
{
	lint ret=0;
	a=max(a,b);
	while(a>0)
	{
		a/=10;
		ret++;
	}
	return ret;
}

int main()
{
	lint N;
	lint ans;
	
	cin >> N;
	
	ans=f(1,N);
	for(lint i=1;i*i<=N;i++)
	{
		if(N%i!=0)continue;
		ans=min(ans,f(i,N/i));
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

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

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//akari : 1D, yukari : 2D, maki : 3D vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//akane : ascending order, aoi : decending order
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

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

void solve()
{
    int n;
    cin >> n;
    akari<int> as(n);
    for (int &a : as)
        cin >> a;
    cin >> n;
    akari<int> bs(n), ans;
    for (int &b : bs)
        cin >> b;
    set_union(as.begin(), as.end(), bs.begin(), bs.end(), inserter(ans, ans.end()));
    for (int a : ans)
    {
        cout << a << '\n';
    }
}

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



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


void solve(long long N, long long X, long long Y){
    X--;
    Y--;
    vector<long long> ans(N,0);
    for(long long i=0;i<N-1;i++){
        for(long long j=i+1;j<N;j++){
            if(i >= j){
                continue;
            }
            long long a = min(j-i,abs(X-i)+abs(Y-j) +1);
            ans[a]++;
        }
    }
    for(int i=1;i<N;i++){
        cout << ans[i] << endl;
    }

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    solve(N, X, Y);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<cmath>
#include<complex>
#include<iomanip>

using namespace std;

#define REP(i,s,e) for(int i=int(s);i<=int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)
#define pi 3.14159265358979

int a[100010];

int main(void){

	int n,w;
	cin >> n >> w;

	for(int i=1;i<=w/2;i++)
    a[i]=w-1+i;

	for(int i=w/2+1;i<=n-w+1;i++)
	a[i]=w+w/2;

	for(int j=w/2+1;j<=w-1;j++){
		for(int k=3*j;k<=n;k+=j){
			for(int i=k-w+1;i<=k-j;i++)
				a[i]+=1;
		}
	}

	for(int i=1;i<=n-w+1;i++){
    if(i!=n-w+1) cout << a[i] << ' ';
    else cout << a[i] << endl;

	}

	return 0;
}

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

int main(){
    int n, two=0, four=0;
    cin >> n;
    int A[n];
    for(int i=0 ; i<n ; i++){
        cin >> A[i];
        if(A[i]%4==2){
            two++;
        }else if(A[i]%4==0){
            four++;
        }
    }
    if(two>0 && four>=n-two-four){
        cout << "Yes" << endl;
    }else if(two==0 && four+1>=n-two-four){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 640
m,d = gets.split.map(&:to_i)

ans = 0
1.upto(m) do |i|
    1.upto(d) do |j|
        j1, j10 = j.divmod(10)
        next if j1 < 2 || j10 < 2
        ans += 1 if j1 * j10 == i
    end
end

puts ans

Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
#include <limits>
using namespace std;
// 素因数分解
typedef pair<long long, long long> P;
vector<P> prime_factorize(long long n)
{
vector<P> res;
for (long long p = 2; p * p <= n; ++p)
{
if (n % p != 0)
continue;
int num = 0;
while (n % p == 0)
{
++num;
n /= p;
}
res.push_back(make_pair(p, num));
}
if (n != 1)
res.push_back(make_pair(n, 1));
return res;
}
// 因数分解
long long gcd(long long x, long long y)
{
  if (y == 0)
  {
    return x;
  }
  else
  {
    return gcd(y, x % y);
  }
}
const int MOD = 1000000007;
typedef long long int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)

int main()
{
    int n, k;
    cin >> n >> k;
    int ans = 0;
    while (n != 0)
    {
        n /= k;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

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

long calc(int X, int Y, int** ski);

int main(void){
  int X,Y;
  while(true){
    cin>>X>>Y;
    if(X==0 and Y==0){break;}
    int** ski=(int**)malloc(sizeof(int*)*Y);
    for(int i=0;i<Y;i++){
      ski[i]=(int*)malloc(sizeof(int)*X);
      for(int j=0;j<X;j++){
        cin>>ski[i][j];
      }
    }
    cout<<calc(X,Y,ski)<<endl;
    for(int i=0;i<Y;i++){
      free(ski[i]);
    }
    free(ski);
  }
  return 0;
}

long calc(int X, int Y, int** ski){
  long** pattern=(long**)malloc(sizeof(long*)*Y);
  for(int i=0;i<Y;i++){
    pattern[i]=(long*)malloc(sizeof(long)*X);
    for(int j=0;j<X;j++){
      pattern[i][j]=0;
    }
  }

  for(int j=0;j<X;j++){
    if(ski[0][j]==0){
      pattern[0][j]=1;
    }
    else{
      pattern[0][j]=0;
    }
  }
  for(int i=1;i<Y;i++){
    for(int j=0;j<X;j++){
      if(ski[i][j]==1){
        pattern[i][j]=0;
      }
      else if(ski[i][j]==2){
        pattern[i][j]=0;
        if(ski[i-1][j]==0){
          pattern[i][j]+=pattern[i-1][j];
        }
        if(i>=2 and ski[i-2][j]==2){
          pattern[i][j]+=pattern[i-2][j];
        }
      }
      else{//ski[i][j]=0
        pattern[i][j]=0;
        if(j>0 and ski[i-1][j-1]==0){
          pattern[i][j]+=pattern[i-1][j-1];
        }
        if(ski[i-1][j]==0){
          pattern[i][j]+=pattern[i-1][j];
        }
        if(j<X-1 and ski[i-1][j+1]==0){
          pattern[i][j]+=pattern[i-1][j+1];
        }
        if(i>=2 and ski[i-2][j]==2){
          pattern[i][j]+=pattern[i-2][j];
        }
      }
    }
  }

  long retval=0;
  for(int j=0;j<X;j++){
    retval+=pattern[Y-1][j];
    if(Y>=2 and ski[Y-2][j]==2){
      retval+=pattern[Y-2][j];
    }
  }
  return retval;
}



Measured memory_bytes: 3112
/**akshaykumar99**/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
template<typename T> using id_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> ;
template<typename T> using id_setp = tree<pair<T,T>,null_type,less<pair<T,T>>,rb_tree_tag,tree_order_statistics_node_update> ;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define fr(i,x,n) for(i=x;i>=n;i--)
#define pu push_back           
#define pp pop_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SP(x) fixed<<setprecision(x)
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const long long MOD=1e9+7;
const long double PI = acos(-1);
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N=2e5+1;
 
typedef long long ll;
typedef long double ld;
 
int main()
{
    IOS();
    
   	ll n,k,i,j,r,p,s;
   	cin>>n>>k>>r>>s>>p;
   	string ss,res="";
   	cin>>ss;
   	f(i,0,n)
   	{
   		if(ss[i]=='r')
   		{
   			if(i>=k)
   			{
   				if(res[i-k]=='p')
   					res+='.';
   				else
   					res+='p';

   			}
   			else
   				res+='p';
   		}
   		if(ss[i]=='p')
   		{
   			if(i>=k)
   			{
   				if(res[i-k]=='s')
   					res+='.';
   				else
   					res+='s';

   			}
   			else
   				res+='s';
   		}
   		if(ss[i]=='s')
   		{
   			if(i>=k)
   			{
   				if(res[i-k]=='r')
   					res+='.';
   				else
   					res+='r';

   			}
   			else
   				res+='r';
   		}
   	}
   	// cout<<res<<'\n';
   	ll ans=0;
   	f(i,0,n)
   	{
   		if(res[i]=='r')
   			ans+=r;
   		else if(res[i]=='p')
   			ans+=p;
   		else if(res[i]=='s')
   			ans+=s;
   	}
   	cout<<ans<<'\n';

 
    return 0;
}

Measured memory_bytes: 640
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
const int MAXN = 1e5 + 7;
char s[MAXN];
int ans[2][MAXN],sum[MAXN];
int main()
{
	cin>>s+1;
	int n = strlen(s+1);
	for(int i=1;i<=n;++i) {
		if(s[i] == 'L')
			ans[0][i] = ans[0][i-1];
		else ans[0][i] = i;
	}
	for(int i=n;i>=1;--i) {
		if(s[i] == 'R')
			ans[1][i] = ans[1][i+1];
		else ans[1][i] = i;
	}
	int res;
	for(int i=1;i<=n;++i) {
		if(s[i] == 'L') {
			res = i - ans[0][i];
			if(res&1) {
				sum[ans[0][i]+1]++;
			} else sum[ans[0][i]]++;	//(res&1)ÅÐ¶ÏÆæÅ¼
		} else {
			res = ans[1][i] - i;
			if(res&1) {
				sum[ans[1][i]-1]++;
			} else sum[ans[1][i]]++;
		}
	}
	for(int i=1;i<=n;++i)
		printf("%d ",sum[i]);
	return 0;
}

Measured memory_bytes: 1664
r = [5, 7, 5, 7, 7]
while True:
    n = int(input())
    if n == 0:
        break
    w = []
    for _ in range(n):
        w.append(len(input()))
    for j in range(n):
        i = j
        for k in r:
            s = 0
            while s < k:
                s = s + w[i]
                i = i + 1
            if s != k:
                break
        else:
            print(j+1)
            break

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

#define INF 1000000000

using namespace std;

typedef long long LL;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;

	int d = a + b + c;

	int ans = 0;

	int m = max(max(a, b), c);

	m *= 3;

	while (true)
	{
		if ((d % 3 == 0) && (d >= m))
			break;
		d += 2;
	}

	cout << (d - (a + b + c)) / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
const int mod=1e9+7;
using LL=long long;
using std::cout;using std::endl;using std::cin;
using std::vector;using std::string;using std::set;using std::multiset;
using std::pair;using std::map;
using std::min;using std::max;
using std::make_pair;
std::ostream& operator<<(std::ostream& os,std::map<int,int>& obj){for(std::map<int,int>::iterator itr=obj.begin();itr!=obj.end();itr++){os<<itr->first<<"^"<<itr->second<<" ";}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<std::map<int,int>>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<std::endl;}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<int>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<endl;}return os;}

namespace ndifix{
template<class T>void sort(T &v){std::sort(v.begin(),v.end());}
}

int main(){
  int n,h,w;cin>>n>>h>>w;
  cout<<(n-h+1)*(n-w+1)<<endl;
  return 0;
}

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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

#define loop(i, n) for(int i = 0;i < n;i++)

int main(void){

    string a, b;
    cin >> a >> b;

    b.pop_back();

    if(a == b) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <stdio.h> 
using namespace std;

int main() {
    int X, value1, value2;
  	cin >> X;
    
    value1 = X/500;
    X -= 500*value1;
    value2 = X/5;
    cout << value1*1000+value2*5;
}

Measured memory_bytes: 256
n = int(input())

ans = n
for i in range(1, n):
    a = i
    b = n - i

    sum_a = sum(list(map(int, str(a))))
    sum_b = sum(list(map(int, str(b))))
    
    ans = min(ans, sum_a+sum_b)

print(ans)

Measured memory_bytes: 3060
<?php

fscanf(STDIN, "%s%s", $s, $t);
fscanf(STDIN, "%d%d", $a, $b);
fscanf(STDIN, "%s", $u);

if ($u === $s) {
    --$a;
} elseif ($u === $t) {
    --$b;
}

echo "{$a} {$b}";


Measured memory_bytes: 16080
N = int(input())
first = 0
second = 0
As = []
for i in range(N):
    n = int(input())
    As.append(n)
    if first < n:
        first = n
    elif second < n:
        second = n

for a in As:
    if a == first:
        print(second)
    else:
        print(first)

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

int ans[2010];
int main() {
  int N, X, Y;
  cin >> N >> X >> Y;
  --X; --Y;

  for (int i = 0; i < N; ++i) {
    for (int j = i; j < N; ++j) {
      ++ans[min(abs(j - i),
                abs(i - X) + abs(j -Y) + 1)];
    }
  }

  for (int i = 1; i < N; ++i) {
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
<?php
list($count, $blue, $red) = explode(' ', trim(fgets(STDIN)));

// 青が0の場合は計算の必要なし
if ((int)$blue === 0) {
    echo 0;
    return;
}

$roop_count = floor((int)$count / ((int)$blue + (int)$red));
$remainder = (int)$count % ((int)$blue + (int)$red);

if ((int)$blue >= $remainder) {
    echo (int)$blue * (int)$roop_count + $remainder;
} else {
    echo (int)$blue * ((int)$roop_count + 1);
}


Measured memory_bytes: 4728
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifndef print
#define print(...)
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
//const int mod=998244353;
const int mod = 1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk = clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) { uniform_int_distribution<int> uid(0, lim - 1); return uid(rang); }
int powm(int a, int b) { int res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }

const int N = 50000;

bitset<N> a[N];
int b[N];
int fr[N];
int32_t main() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.precision(10); srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	int n, m, t;
	cin >> n >> m >> t;
	if (t == 1) {
		std::vector<pii> li;
		for (int i = 0; i < m; ++i) {
			int u; cin >> u; u--;
			int v; cin >> v; v--;
			li.pb({u, v});
		}
		reverse(all(li));
		for (int i = 0; i < n; ++i) a[i][i] = 1;
		for (auto pi : li)
			a[pi.fi] |= a[pi.se], a[pi.se] |= a[pi.fi];
		int mi = n + 1;
		int in = -1;
		for (int k = 0; k < n; ++k) {
			if (a[k].count() < mi) {
				mi = a[k].count();
				in = k;
			}
		}
		for (int i = a[in]._Find_first(); i < n; i = a[in]._Find_next(i)) {
			for (int j = 0; j < n; ++j) {
				if (!a[j][i]) {
					break;
				} else if (a[j][i] && j == n - 1) {
					a[0].reset();
					a[0][i] = 1;
					string s = "";
					for (auto pi : li) {
						if ((a[0][pi.se] && !a[0][pi.fi])) {
							a[0][pi.fi] = 1;
							s += 'v';
						} else if ((!a[0][pi.se] && a[0][pi.fi])) {
							a[0][pi.se] = 1;
							s += '^';
						} else {
							s += '^';
						}
					}
					reverse(all(s));
					cout << s;
					exit(0);
				}
			}
		}
		cout << -1;
	} else {
		if (n >= 3) {
			std::vector<pii> li;
			for (int i = 0; i < m; ++i) {
				int u; cin >> u; u--;
				int v; cin >> v; v--;
				li.pb({u, v});
			}
			reverse(all(li));
			for (int i = 0; i < n; ++i) {
				b[i] = i;
				fr[i] = 1;
			}
			string ss = "";
			for (auto pi : li) {
				if (fr[b[pi.fi]] >= 2) {
					fr[b[pi.fi]]--;
					b[pi.fi] = b[pi.se];
					fr[b[pi.fi]]++;
					ss += "v";
				} else {
					fr[b[pi.se]]--;
					b[pi.se] = b[pi.fi];
					fr[b[pi.se]]++;
					ss += "^";
				}
			}
			reverse(all(ss));
			cout << ss << '\n';
		} else {
			cout << "-1";
		}
	}
}

Measured memory_bytes: 307568
// AOJ 1194 "バンパイア" (ICPC国内予選 2014 Problem C)
import java.util.Scanner;

public class Main {
    public static double INF = 100.0;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        while (true) {
            int r = sc.nextInt();
            int n = sc.nextInt();
            if (r == 0) {
                break;
            }
            
            int[] field = new int[40]; // field[x]: 区間[x-20, x-19）地点の影の高さ
            for (int i = 0; i < n; i++) {
                int xl = sc.nextInt();
                int xr = sc.nextInt();
                int h  = sc.nextInt();
                
                for (int j = xl + 20; j < xr + 20; j++) {
                    field[j] = Math.max(field[j], h);
                }
            }
            //printHeight(field);
            double minTime = INF;
            for (int i = 0; i < field.length; i++) {
                minTime = Math.min(minTime, crossTime(i - 20, field[i], r));
                minTime = Math.min(minTime, crossTime(i + 1 - 20, field[i], r));
            }
            System.out.println(minTime);
        }
    }
    
    public static double crossTime(int x, int y, int r) {
        //System.out.println("x: " + x + ", y: " + y + ", r: " + r);
        int d = (int)Math.pow(-2 * (y + r), 2) - 4 * (x * x + y * y + 2 * y * r);
        if (d <= 0) {
            return INF;
        } else {
            double ans = (2 * (y + r) - Math.sqrt(d)) / 2;
            //System.out.println(d + " " + Math.sqrt(d) + " " + ans);
            return ans;
        }
    }
    
    public static void printHeight(int[] field) {
        for (int i = 0; i < field.length; i++) {
            System.out.println((i - 20) + "-" + ((i - 20) + 1) + ": " + field[i]);
        }
    }
}

Measured memory_bytes: 25976
#include<iostream>
#include<cmath>
#include<iomanip>

using namespace std;
struct Point { double x, y; };
double six = M_PI / 3;
int koch(int d, Point p1, Point p2) {
    if (d == 0) return 0;
    Point s, u, t;
    s.x = (2*p1.x + p2.x) / 3;
    s.y = (2*p1.y + p2.y) / 3;
    t.x = (p1.x + 2*p2.x) / 3;
    t.y = (p1.y + 2*p2.y) / 3;
    u.x = (t.x - s.x) * cos(six) - (t.y - s.y) * sin(six) + s.x;
    u.y = (t.x - s.x) * sin(six) + (t.y - s.y) * cos(six) + s.y;
    koch(d-1, p1, s);
    cout << fixed << setprecision(8) << s.x << " " << s.y << endl;
    koch(d-1, s, u);
    cout << u.x << " " << u.y << endl;
    koch(d-1, u, t);
    cout << t.x << " " << t.y << endl;
    koch(d-1, t, p2);
    return 0;
	}

int main() {

    int n;
    Point p1, p2;
    p1.x = 0;
    p1.y = 0;
    p2.x = 100;
    p2.y = 0;
    cin >> n;
    cout << fixed << setprecision(8) << p1.x << " " << p1.y << endl;
    koch(n, p1, p2);
    cout << p2.x << " " << p2.y << endl;
    return 0;
}

Measured memory_bytes: 1252