akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

vector<P> graph[100005];
vector<int> dist(100005, INF);

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

    int k;
    cin >> k;
    for(int i = 0; i < k - 1; ++i)  graph[i].push_back(P(i + 1, 1));
    graph[k - 1].push_back(P(0, 1));
    for(int i = 1; i < k; ++i){
        int foo = i * 10 % k;
        if(foo == i)    continue;
        graph[i].push_back(P(foo, 0));
    }
    dist[1] = 1;
    deque<int> deq;
    deq.push_back(1);
    while(!deq.empty()){
        int from = deq.front();
        deq.pop_front();
        for(auto p : graph[from]){
            int to = p.first, cost = p.second;
            if(cost){
                if(dist[to] > dist[from] + cost){
                    dist[to] = dist[from] + cost;
                    deq.push_front(to);
                }
            }
            else{
                if(dist[to] > dist[from]){
                    dist[to] = dist[from];
                    deq.push_back(to);
                }
            }
        }
    }
    cout << dist[0] << endl;
}

Measured memory_bytes: 6400
N = int(input())
kuku= [1, 2, 3, 4, 5, 6, 7, 8, 9]
c = 0

for a in kuku:
    for b in kuku:
        if a*b == N:
            c+=1
if c>=1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3316
#include <iostream>
#include <cmath>
#define rep(i,a,n) for(int i=a; i<n; i++)
using namespace std;

int main() {
    int n; cin >> n;
    for(int i=0; i<n; i++) {
        double x1, y1, x2, y2, x3, y3, x4, y4;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        
        double a1 = x2 - x1;
        double b1 = y2 - y1;
        double a2 = x4 - x3;
        double b2 = y4 - y3;
        
        if(abs(a1 * b2 - a2 * b1) < 1e-10) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 1224
use std::io::{self, Read};
use std::str::FromStr;

pub struct Scanner<R: Read> {
    reader: R,
}
impl<R: Read> Scanner<R> {
    pub fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }
    pub fn read<T: FromStr>(&mut self) -> T {
        let s = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.expect("failed to read char") as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        s.parse::<T>().ok().expect("failed to parse token")
    }
}

fn left(i: usize) -> usize {
    i*2
}

fn right(i: usize) -> usize {
    i*2+1
}

fn max_heapify(a: &mut Vec<i64>, i: usize, h: usize) {
    let l = left(i);
    let r = right(i);

    // 左の子、自分、右の子で最大のノードを選ぶ
    let mut largest = if l <= h && a[l] > a[i] {
        l
    } else {
        i
    };

    if r <= h && a[r] > a[largest] {
        largest = r;
    }

    if largest != i { // 自身より子の方が大きい場合
        a.swap(i, largest);
        max_heapify(a, largest, h);
    }
}

fn build_max_heap(a: &mut Vec<i64>, h: usize) {
    // h/2で子を持つノードの最後尾から順に計算する
    for i in (1..h/2+1).rev() {
        max_heapify(a, i, h);
    }
}

fn main() {
    let sin = io::stdin();
    let sin = sin.lock();
    let mut sc = Scanner::new(sin);

    let h: usize = sc.read();
    let mut vals: Vec<i64> = vec![0; h+1];

    for i in 1..h+1 {
        vals[i] = sc.read();
    }
    build_max_heap(&mut vals, h);

    println!(" {}", 
        vals[1..].iter()
        .map(|v| v.to_string())
        .collect::<Vec<String>>()
        .join(" "));
}



Measured memory_bytes: 29496
#include "bits/stdc++.h"
 
using namespace std;

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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define REREP(i,n) for(int i=int(n-1); i>=0; i--)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define REFOR(i,m,n) for(int i=int(n-1); i>=int(m); i--)
#define ALL(obj) (obj).begin(),(obj).end()
 
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>
 
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>
 
#define SUMI(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SUMD(obj) accumulate((obj).begin(), (obj).end(), 0.)
#define SUML(obj) accumulate((obj).begin(), (obj).end(), 0LL)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

#define PB push_back
#define Cout(str) cout << str << endl

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const ll EPS = (ll)1e-8;

int main(){
	int n,m;
	int a,b,c;
	int sum;
	string str;
	string s,t;
	char ch;
	VI vi;
	vector<char> vc;
	VS vs;
	int reserve_vi = 100;
	map<int, int> table; 

	//cin >> n >> m;
	//cin >> a >> b;
	cin >> a >> b >> c;
	//cin >> str;
	//cin >> n;
	
	//cin >> s >> t;
	//cin >> c;

	if(a<b) swap(a, b);
	if(a<c) swap(a, c);

	if(a == b+c)Cout("Yes");
	else Cout("No");

	//cout << accumulate(vi.begin(), vi.begin()+n, 0) << endl;

	//swap(a, b);
	//vi.resize(N);
	//fill(vi.begin(), vi.end(), 1);
	//vi.reserve(reserve_vi);
	//vi.PB(n);

	//vc.resize(5);
	//vc[i] = (str[i]);

	//sort(vc.begin(), vc.end(), greater<char>());
	//sort(vc.begin(), vc.end());

	//for(auto itr = table.begin(); itr != table.end(); ++itr) {
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int kk, nn, max = -1;
  scanf("%d %d", &kk, &nn);
  int aa[nn], sa[nn];
  for(int ii = 0;ii < nn;ii++)
  {
    scanf("%d", &aa[ii]);
  }
  for(int ii = 0;ii < (nn - 1);ii++)
  {
    sa[ii] = aa[ii + 1] - aa[ii];
  }
  sa[nn - 1] = kk + aa[0] - aa[nn - 1];
  for(int ii = 0;ii < nn;ii++)
  {
    if(max < sa[ii])
      max = sa[ii];
  }
  max = kk - max;
  printf("%d\n", max);
  return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * Author: Hamkor a.k.a. OakenSh1eld
 *
 * */
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n; cin>>n;
	ll dp[n+1][n+1][2], a[n];
	ms(dp, 0);
	for(int i=0; i<n; ++i) {
		cin>>a[i];
		dp[i][i][0] = a[i];
		dp[i][i][1] = -a[i];
	}
	for(int l = n-1; l>=0; --l) for(int r=l+1; r<n; ++r){
		dp[l][r][0] = max(dp[l+1][r][1] + a[l], dp[l][r-1][1] + a[r]);
		dp[l][r][1] = min(dp[l+1][r][0] - a[l], dp[l][r-1][0] - a[r]);
	}
	cout<<dp[0][n-1][0];
	return 0;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define has(c,i) ((c).find(i) != end(c))
#define DBGDO(X) ({ if(1) cerr << "DBGDO: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll m, n, k; cin >> m >> n >> k;
	vl x(k), y(k);
	FOR(i,0,k) cin >> x[i] >> y[i];
	
	set<pll> p, done;
	FOR(i,0,k) p.emplace(x[i],y[i]);
	
	vl res(10);
	FOR(i,0,k) {
		FOR(dx,-2,1) FOR(dy,-2,1) {
			ll nx = x[i]+dx, ny = y[i]+dy;
			if (nx < 1 || ny < 1 || nx >= m-1 || ny >= n-1) continue;
			if (has(done,pll(nx,ny))) continue;
			done.emplace(nx,ny);
			ll cnt = 0;
			FOR(ndx,0,3) FOR(ndy,0,3) cnt += has(p,pll(nx+ndx,ny+ndy));
			res[cnt]++;
		}
	}
	
	res[0] = (m-2)*(n-2);
	FOR(i,1,10) res[0] -= res[i];
	FOR(i,0,10) cout << res[i] << endl;

}


Measured memory_bytes: 64384
import math
n, d = map(int, input().split())
xy_list = [[0 for i in range(2)] for j in range(n)]
ans = 0
for k in range(n):
  x, y = map(int, input().split())
  xy_list[k][0] = x ** 2
  xy_list[k][1] = y ** 2
dist1 = [0 for l in range(n)]
for m in range(n):
  dist1[m] = math.sqrt(xy_list[m][0]+xy_list[m][1])
  if dist1[m] <= d:
    ans += 1
print(ans)

Measured memory_bytes: 50136
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef pair<ll,int> P;

#define all(x) x.begin(),x.end()

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

vector<int> dst;
vector<vector<P> > g;

void dfs(int r){
	for(int i = 0; i < g[r].size(); i++){
		if(dst[g[r][i].second]<0){
			dst[g[r][i].second] = dst[r] + g[r][i].first;
			dfs(g[r][i].second);
		}
	}
}

int main()
{
	int n;
	cin>>n;
	g.resize(n);
	for(int i = 0; i < n-1; i++){
		int a,b,w;
		cin>>a>>b>>w;
		g[a].push_back(P(w,b));
		g[b].push_back(P(w,a));

	}

	dst.resize(n,-1);
	dst[0]=0;
	dfs(0);
	int p=0,d=-1;
	for(int i = 0; i < n; i++){
		if(dst[i]>d){
			d = dst[i];
			p=i;
		}
	}
	for(int i = 0; i < n; i++){
		dst[i]=-1;
	}
	dst[p]=0;
	dfs(p);
	d=-1;
	for(int i = 0; i < n; i++){
		d = max(d,dst[i]);
	}
	cout << d << endl;

	return 0;
}


Measured memory_bytes: 13388
#define rep(i,x) for (int i = 0; i < x; i++)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;


int main() {
	int n; string s;
	cin >> n >> s;
	int a[26];
	rep(i, 26) {
		a[i] = 0;
	}
	ll ans = 1;
	rep(i, s.size()) {
		a[s[i] - 'a']++;
	}
	rep(i, 26) {
		ans *= (a[i] + 1);
		ans %= mod;
	}
	cout << ans-1 << endl;
	return 0;
}

Measured memory_bytes: 512
n = int(input())
d = [[int(i) for i in input().split()] for j in range(n)]

cnt = 0

for i in range(n):
    if d[i][0] == d[i][1]:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        print("Yes")
        exit()
        
print("No")

Measured memory_bytes: 9180
// AOJ 2313 Box Witch
// 2018.3.15 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

// AOJ 2118 Oil Company
// 2018.3.10 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/*******************************************/
/* Dinic's Max Flow Algorithm 
/*******************************************/

#define INF 0x01010101
#define VMAX 505
typedef struct { int to, cap, rev; char run; } EDGE;
EDGE edge[VMAX][VMAX]; int hi[VMAX];
int V, source, sink;
char used[VMAX];

void add_edge(int from, int to, int cap)
{
	int f, t;
	EDGE *e;

	f = hi[from]++, t = hi[to]++;
	e = &edge[from][f], e->to = to, e->cap = cap, e->rev = t, e->run = 1; 
	e = &edge[to][t], e->to = from, e->cap = cap, e->rev = f, e->run = 1;
}

int dfs(int v, int t, int f)
{
	int i, d;
	EDGE *e;
	
	if (v == t) return f;
	used[v] = 1;
	for (i = 0; i < hi[v]; i++) {
		e = &edge[v][i];
		if (e->run == 0) continue;
		if (e->cap > 0 && !used[e->to]) {
			d = dfs(e->to, t, f <= e->cap? f: e->cap);
			if (d > 0) {
				e->cap -= d;
				edge[e->to][e->rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int maxFlow(int s, int t, int max)
{
	int f, flow = 0;
	while (max > 0) {
		memset(used, 0, V);
		f = dfs(s, t, max);
		if (!f) break;
		flow += f;
		max -= f;
	}
	return flow;
}

int back_edge(int from, int to)
{
	int i;
	EDGE *e;

	for (i = 0; i < hi[from]; i++) if (edge[from][i].to == to) {
		e = &edge[from][i];
		if (e->run) {
			e->run = 0;
			if (e->cap == 0 && maxFlow(from, to, 1) == 0) {
				maxFlow(from, source, 1);
				maxFlow(sink, to, 1);
				break;
			}
			return 0;
		}
	}
	return 1;
}

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


//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int main()
{
	int N, E, Q, i, ans;

	N = in(), E = in(), Q = in();
	
	source = 0, sink = N-1, V = sink+1;
	for (i = 0; i < E; i++) {
		int f = in()-1, t = in()-1;
		add_edge(f, t, 1);
	}

	ans = maxFlow(source, sink, INF);

	while (Q--) {
		int m = in(), a = in()-1, b = in()-1;
		if (m == 1) {
			add_edge(a, b, 1);
			ans += maxFlow(source, sink, 1);
		} else {
			ans -= back_edge(a, b);
			ans -= back_edge(b, a);
		}
		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 4208
#include <iostream>

using namespace std;

int max(int a,int b){
  if (a>b)
    return a;
  else
    return b;
}
int min(int a,int b){
  if (a>b)
    return b;
  else
    return a;
}

int main(){
  int r,c;
  int p2[11];
  p2[0] = 1;
  for(int i=0;i<10;i++){
    p2[i+1] = p2[i]*2;
  }
  
  while(true){
  cin >> r >> c;
  if (r==0&&c==0)
    break;
  int sen[c];
  int cc;
  for(int i=0;i<c;i++)
    sen[i] = 0;

  for(int j=0;j<r;j++){
    for(int i=0;i<c;i++){
      cin >> cc;
      sen[i] *= 2;
      sen[i] += cc;
    }
  }
  
  int s,n,sum = 0,smax = 0;
  for(int i=0;i<p2[r];i++){
    sum = 0;
    for(int j=0;j<c;j++){
      s = sen[j]^i;
      n=0;
      for(;s>0;n+=s%2,s/=2);
      sum += max(n,r-n);
    }
    if (sum>smax)
      smax = sum;
  }
  cout << smax << endl;
  }
  return 0;
}

Measured memory_bytes: 904
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define vec vector
using pint = pair<int,int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
const int mod = 1000000007;
struct mint {
    int64_t x;
    mint(int64_t x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {if ((x += a.x) >= mod) x -= mod;return *this;}
    mint& operator-=(const mint a) {if ((x += mod-a.x) >= mod) x -= mod;return *this;}
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(int64_t t) const {if (!t) return 1;mint a = pow(t>>1);a *= a;if (t&1) a *= *this;return a;}
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) {return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


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

    ll n,k;
    cin>>n>>k;
    vll a(n);
    rep(i,n) cin>>a[i];
    ll ans = LLONG_MAX;
    
    if(k==1){
        rep(i,n) chmin(ans,abs(a[i]));
    }else{
        rep(i,n-k+1){
            ll num = abs(a[i+k-1] - a[i]);
            ll cur = num + abs(a[i+k-1]);
            ans = min(ans,cur);
            ll cur2 = num + abs(a[i]);
            ans = min(ans, cur2);
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3968
#include <bits/stdc++.h>
typedef long long ll;

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

int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<int>> to(N);
	vector<int> in_cnt(N, 0);
	for (int i = 0; i < N - 1 + M; ++i) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		to[a].push_back(b);
		++in_cnt[b];
	}

	int root = -1;
	for (int i = 0; i < N; ++i) {
		if (in_cnt[i] == 0) {
			root = i;
			break;
		}
	}

	vector<int> order(N, -1);
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, root));
	int num = 0;
	while (!que.empty()) {
		P p = que.top(); que.pop();
		int v = p.second;
		if (in_cnt[v] < p.first) { continue; }
		
		if (in_cnt[v] == 0) { order[num++] = v; }
		for (int i = 0; i < to[v].size(); ++i) {
			--in_cnt[to[v][i]];
			que.push(P(in_cnt[to[v][i]], to[v][i]));
		}
	}

	vector<int> par(N, -1);
	par[root] = 0;
	for (int i = 0; i < N; ++i) {
		int v = order[i];
		for (int j = 0; j < to[v].size(); ++j) {
			par[to[v][j]] = v + 1;
		}
	}

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

	return 0;
}


Measured memory_bytes: 7424
a, b, c, k = map(int, input().split())
if k % 2 == 1:
    if b - a > 10 ** 18:
        print("Unfair")
    else:
        print(b - a)
else:
    if a - b > 10 ** 18:
        print("Unfair")
    else:
        print(a - b)

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;

/*
double arctan(double x) {
    double left = -1e-9;
    double right = acos(-1) / 2;

    while (right - left > 1e-9) {
        double mid = (right + left) / 2;

        if (x < tan(mid)) right = mid;
        else left = mid;
    }
    return right;
} */

int main() {
    double a, b, x;
    cin >> a >> b >> x;
    double res;
    if (x > a / 2 * a * b){
        res = atan(2 / a * b - 2 / (a * a * a) * x) * 180 / acos(-1);
    }
    else{
        res = atan(a / 2 / x * b * b) * 180 / acos(-1);
    }
    cout << fixed << setprecision(10) << res << endl;
}

Measured memory_bytes: 512
//
// Created by 李青坪 on 2018/10/11.
//

#include <string>
#include "cstdio"
using namespace std;

struct Card{
    int index;
    char ch;
    int num;
};

void swap(Card c[], int i, int j){
    Card temp = c[i];
    c[i] = c[j];
    c[j] = temp;
}

int partion(Card c[], int low, int high){
    Card x = c[high];
    int i = low - 1;
    for (int j = low; j < high; ++j) {
        if (c[j].num <= x.num){
            ++i;
            swap(c, i, j);
        }
    }
    swap(c, i+1, high);
    return i+1;
}

int quickSort(Card c[], int low, int high){
    if (low < high){
        int index = partion(c, low, high);
        quickSort(c, low, index-1);
        quickSort(c, index+1, high);
    }
}

void print(Card c[], int n){
    int stable = 1;
    for (int i = 0; i < n; ++i) {
        if (i) {
            if (c[i].num == c[i-1].num && c[i].index < c[i-1].index){
                stable = 0;
            }
        }
    }
    if (stable) printf("Stable\n");
    else printf("Not stable\n");

    for (int i = 0; i < n; ++i) {
        if (i) {
            printf("\n");
            if (c[i].num == c[i-1].num && c[i].index < c[i-1].index){
                stable = 0;
            }
        }

        printf("%c %d", c[i].ch, c[i].num);
    }
    printf("\n");
}

int main(){
    int n ;
    scanf("%d", &n);
    Card c[n];
    for (int i = 0; i < n; ++i) {
        char ch;
        int in;
        scanf("%c", &ch);
        if (ch == '\n') {
            --i;
            continue;
        }
        scanf("%d", &in);
        c[i].index = i;
        c[i].ch = ch;
        c[i].num = in;
//        printf("%c %d\n", c[i].ch, c[i].num);
    }
//    print(c, n);
    quickSort(c, 0, n-1);
    print(c, n);
}


Measured memory_bytes: 3848
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

n,k = m()

a = l()

a.sort()

ans = 0

for i in range(k):
	ans += a[i]
print(ans)


Measured memory_bytes: 65804
#include<stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++)
    scanf("%d",&a[i]);
    int sum=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            sum+=a[i]*a[j];
        }
    }
    printf("%d",sum);
    
}

Measured memory_bytes: 1732
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
ll N, M;
int main() {
  scanf("%ld %ld", &N, &M);
  ll ans = 0LL, mx = max(N, M), mn = min(N, M);
  if(mx-mn < 2) {
    ll mxR = 1LL, mnR = 1LL;
    for(int i = mx; i > 1; --i) mxR = mxR*i%MOD;
    for(int i = mn; i > 1; --i) mnR = mnR*i%MOD;
    ans = mxR*mnR%MOD;
    if(mx == mn) ans = 2*ans%MOD;
  }
  printf("%ld\n", ans);
}

Measured memory_bytes: 128
//#include<bits\stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<algorithm>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long
#define db double
#define INF 1000000000000000000ll
#define ld long double
#define put(x) printf("%d\n",x)
#define min(x,y) ((x)>(y)?(y):(x))
#define max(x,y) ((x)>(y)?(x):(y))
#define mod 1000000007
#define rep(p,n,i) for(ll i=p;i<=n;++i)
using namespace std;
char buf[1<<15],*fs,*ft;
inline char getc()
{
	return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline ll read()
{
	ll x=0,f=1;char ch=getc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
	return x*f;
}
const ll MAXN=200010<<1;
ll n,k;
ll maxx,ans;
ll fac[MAXN],inv[MAXN];
inline ll fast_pow(ll b,ll p)
{
	ll cnt=1;
	while(p){if(p&1)cnt=cnt*b%mod;p=p>>1;b=b*b%mod;}
	return cnt;
}
inline void prepare()
{
	fac[0]=1;
	for(ll i=1;i<=maxx;++i)fac[i]=fac[i-1]*i%mod;
	inv[maxx]=fast_pow(fac[maxx],mod-2);
	for(ll i=maxx-1;i>=0;--i)inv[i]=inv[i+1]*(i+1)%mod;
}
inline ll C(ll a,ll b)
{
	return fac[a]*inv[b]%mod*inv[a-b]%mod;
}
signed main()
{
	//freopen("1.in","r",stdin);
	n=read();k=read();
	maxx=n<<1;prepare();
	if(k>=n-1)printf("%lld\n",C(n+n-1,n-1));
	else
	{
		ans=C(n+n-1,n-1);
		ll op=1;
		for(ll i=k+1;i<n;++i)
		{
			op=-1;
			ans=(ans+op*C(n,i)*C(n-1,n-i-1)%mod+mod)%mod;
			//cout<<op*C(n,i)*C(n-i+n-1,n-i-1)<<endl;
		}
		printf("%lld\n",ans);
	}
	return 0;
}


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

int main() {
  string S; cin >> S;
  
  for(int i=0; i<S.size(); i++) {
    for(int j=0; j<S.size(); j++) {
      if(i!=j && S[i]==S[j]) {
        cout << "no" << endl;
        return 0;
      }
    }
  }
  cout << "yes" << endl;
}

Measured memory_bytes: 3616
from bisect import bisect_left as bl
a,b,q = map(int,input().split())

s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]
s.insert(0,-10**12)
s.append(10**12)
t.insert(0,-10**12)
t.append(10**12)

for i in range(q):
    x = int(input())
    si = bl(s,x)
    ti = bl(t,x)
    ans = 10**12
    for j in range(si-1,si+1):
        for k in range(ti-1,ti+1):
            if s[j] <= t[k]:
                if t[k] <= x:
                    ans = min(ans,x-s[j])
                elif x <= s[j]:
                    ans = min(ans,t[k]-x)
                else:
                    ans = min(ans,min(x-s[j],t[k]-x)+t[k]-s[j])
            else:
                if s[j] <= x:
                    ans = min(ans,x-t[k])
                elif x <= t[k]:
                    ans = min(ans,s[j]-x)
                else:
                    ans = min(ans,min(x-t[k],s[j]-x)+s[j]-t[k])
    print(ans) 


Measured memory_bytes: 12080
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

Int N, A, B, C, D, res;
map<Int, Int> memo;

Int Y[] = {5, 3, 2}, Z[3];

Int rec(Int x) {
  if (x == 0) {
    return 0;
  }
  if (memo.count(x)) {
    return memo[x];
  }
  Int ans = INFLL;
  if (x < INFLL / D + 1) {
    chmin(ans, x * D);
  }
  for (int i = 0; i < 3; ++i) {
    if (x / Y[i] > 0) {
      chmin(ans, rec(x / Y[i]) + (x % Y[i]) * D + Z[i]);
    }
    if (x % Y[i] > 0 && x / Y[i] + 1 != x) {
      chmin(ans, rec(x / Y[i] + 1) + (Y[i] - x % Y[i]) * D + Z[i]);
    }
  }
  memo[x] = ans;
  return ans;
}

void solve() {
  N = lin();
  A = lin();
  B = lin();
  C = lin();
  D = lin();
  Z[0] = C;
  Z[1] = B;
  Z[2] = A;
  memo.clear();

  printf("%lld\n", rec(N));
}

int main() {
  int T = in();
  while (T--) {
    solve();
  }

  return 0;
}


Measured memory_bytes: 4628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] strArr = br.readLine().split(" ");
		long[] arr = new long[strArr.length];
		for(int i = 0; i < strArr.length; i++){
			arr[i] = Long.parseLong(strArr[i]);
		}
		Arrays.sort(arr);
		System.out.printf("%d %d %d%n",arr[0], arr[1], arr[2]);
	}
}

Measured memory_bytes: 16908
import java.util.*;
import java.io.*;

public class Main {

	private static void solve(){
		//Implement solution here.
		long a = nl();
		long b = nl();
		long k = nl();
		if(k - a > 0) {			
			k -= a;
			a = 0;
			b = Math.max(b - k,0);
		}else {
			a -= k;
		}
		System.out.println(a + " " + b);
	}
	
	private static long pow(final long a) {
        long result = 1;
        for (long i = 0; i < a; i++) {
        	result *= 2;
        	result %= mod;
        } 
        return result;
    }
	static int mod = 1000000007;


	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << '\n';}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
ll dp[210000], a[210000], ps[210000];
void solve() {
	var(ll, n, x);
	ps[0] = 0;
	rep(i, 0, n) {
		cin >> a[i];
		ps[i + 1] = ps[i] + a[i];
	}
	ll ans = 1e18;
	ll cur = 0, now, cc;
	rep(i, 1, n + 1) {
		cur += 5 * a[n - i] + x;
		now = cur;
		cc = 1;
		for (int j = n - 1 - i; j >= 0; j -= i) {
			now += (ps[j + 1] - ps[max(0, j - i + 1)]) * (2 * ++cc + 1);
			if (now > ans)
				break;
		}
		chmin(ans, now);
	}
	print(ans + n * x);
}
int main() {
	solve();
	return 0;
}


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

using namespace std;

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

	vector<int> A(N);
	for (int i = 0; i < N; ++i) cin >> A[i];

	vector<int> s(N);
	s[0] = abs(A[0]);
	for (int i = 1; i < N; ++i)  s[i] = s[i - 1] + abs(A[i] - A[i - 1]);

	for (int i = 0; i < N; ++i) {
		if (i == 0) {
			cout << abs(A[i + 1]) + s[N - 1] - s[i + 1] + abs(A[N - 1]) << endl;
		}
		else if (i == N - 1) {
			cout << s[i - 1] + abs(A[i - 1]) << endl;
		}
		else {
			cout << s[i - 1] + abs(A[i + 1] - A[i - 1]) + s[N - 1] - s[i + 1] + abs(A[N - 1]) << endl;
		}
	}
}

Measured memory_bytes: 2048
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;

int main () {
  long long a,b,c;
  string ans="No";
  cin >> a >> b >> c;
  if (a + b > c){
    cout << ans;
    return 0;
  }

  long long left = (a + b - c)*(a + b - c) ;
  long long right = 4 * a * b ;

  if (left > right){
    ans = "Yes";
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
ll gcd(ll a, ll b)
{
	for (;;)
	{
		if (a < b)swap(a, b);
		a %= b;
		if (a == 0)return b;
	}
}
int a[202020];
int main()
{
	int num;
	scanf("%d", &num);
	for (int i = 0; i < num - 1; i++)
	{
		int s, len, mod;
		scanf("%d%d%d", &len, &s, &mod);
		for (int j = 0; j <= i; j++)
		{
			a[j] = max(s, (a[j] + mod - 1) / mod*mod) + len;
		}
	}
	for (int i = 0; i < num; i++)printf("%d\n", a[i]);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

vector<int> fr[100005], bl[100005];
int nr, uz[100005], uz2[100005];
ll noduri, ans[100005];

void DFS(int x);
void DFS2(int x);

int main()
{
    int n, m, k;

    cin >> n >> m >> k;
    
    int x, y;
    for (int i=1;i<=m;i++)
    {
        cin >> x >> y;
        fr[x].pb(y);
        fr[y].pb(x);
    }
    for (int i=1;i<=k;i++)
    {
        cin >> x >> y;
        bl[x].pb(y);
        bl[y].pb(x);
    }

    for (int i=1;i<=n;i++)
        if (!uz[i])
        {
            noduri = 0;
            nr++;
            DFS(i);
            DFS2(i);
        }
    for (int i=1;i<=n;i++)
        cout << ans[i] << ' ';
    return 0;
}

void DFS(int x)
{
    uz[x] = nr;
    noduri++;
    for (int i : fr[x])
        if (!uz[i])
            DFS(i);
}

void DFS2(int x)
{
    uz2[x] = 1;
    ans[x] = noduri - 1 - fr[x].size();
    for (int i : bl[x])
        if (uz[i] == nr)
            ans[x]--;
    for (int i : fr[x])
        if (!uz2[i])
            DFS2(i);
}

Measured memory_bytes: 13440
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLD = vector<PLD>;

const int IINF = numeric_limits<int>::max();

int main() {

    LL n, m, k;
    cin >> n >> m >> k;
    VLL a(n+1,0), b(m+1,0);
    REP(i,n) { LL tmp; cin >> tmp; a[i+1] = a[i] + tmp; }
    REP(i,m) { LL tmp; cin >> tmp; b[i+1] = b[i] + tmp; }

    LL ans = 0;
    LL tmp_j = m;
    REP(i,n+1) {
        if (a[i]>k) break;
        LL j = tmp_j;
        while(b[j]>k-a[i]) { j--; }
        ans = max(ans, i+j);
        tmp_j = j;
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6424
#include <stdio.h>
int main(void){
   int N,i=0,x,sum=0,MAX,temp;
   int L[15];
   scanf("%d",&N);
   temp=N;
   for(;N--;){
       scanf("%d",&x);
          i++;
       L[i]=x;
   }
   
   N=temp;
   MAX=L[1];
    for(i=1;i<=N;i++){
        sum+=L[i];
    if(MAX<L[i])
    MAX=L[i];
}

    sum=sum-MAX;
if(MAX<sum)
printf("Yes");
else
printf("No");


return(0);
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main()
{
	int n,m,c,s=0,total=0;
	cin>>n>>m>>c;
	int a[m+1],b[n+1][m+1];
	for(int i=1;i<=m;i++)cin>>a[i];
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++)
	{
		cin>>b[i][j];
	}
	for(int i=1;i<=n;i++)
	{
		total=0;
		for(int j=1;j<=m;j++)
		{
			total+=b[i][j]*a[j];
		}
		if(total+c>0)
		{
			s++;
		}
	}
	cout<<s;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace Takahashi_s_Information
{
    class Program
    {
        public static void Main(string[] args)
        {
             using (var sc = new SetConsole())
            {
                var c = new int[3][];
                for (int i = 0; i < 3; i++) { c[i] = new int[3]; }
                for (int i = 0; i < 3; i++)
                {
                    c[i] = GetArray<int>();
                }

                int[] x = new int[3], y = new int[3];
                y = c[0];
                x[0] = 0;
                x[1] = c[1][0] - y[0];
                x[2] = c[2][0] - y[0];
                for (int i = 0; i < c.Length; i++)
                {
                    for (int j = 0; j < c[0].Length; j++)
                    {
                        if (c[i][j] != x[i] + y[j])
                        {
                            CWrite("No");
                            return;
                        }
                    }
                }
                CWrite("Yes");
            }
        }

        static void CWrite<T>(T str) => Console.WriteLine(str);
        static string GetString() => Console.ReadLine();
        static T[] GetArray<T>()
        {
            var t = typeof(T);
            var str = Console.ReadLine();
            if (t == typeof(string))
            {
                return (T[])(object)str.Split();
            }
            if (t == typeof(int))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            if (t == typeof(long))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            if (t == typeof(double))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            throw new NotSupportedException($"{t} is not supported.");
        }
    }



    class SetConsole : IDisposable
    {
        readonly StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
        public SetConsole()
        {
            sw.AutoFlush = false;
            Console.SetOut(sw);
        }
        public void Dispose()
        {
            Console.Out.Flush();
            sw.AutoFlush = true;
            Console.SetOut(sw);
        }
    }

    static class ExtentionsLibrary
    {
        public static T[] ToNumArray<T>(this string str)
        {
            var t = typeof(T);
            if (t == typeof(int))
            {
                return (T[])(object)str.Split().Select(int.Parse).ToArray();
            }
            if (t == typeof(long))
            {
                return (T[])(object)str.Split().Select(long.Parse).ToArray();
            }
            if (t == typeof(double))
            {
                return (T[])(object)str.Split().Select(double.Parse).ToArray();
            }
            throw new NotSupportedException();
        }
        public static int ToInt(this string str) => int.Parse(str);
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
ll gcd(ll x, ll y) {
	if (x < y)swap(x, y);
	if (y == 0)return abs(x - y);
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;
ll mypow(ll x, ll n, ll m) {
	if (n == 0) {
		return 1;
	}
	if (n % 2 == 0) {
		return mypow(x*x%m, n / 2, m);
	}
	else {
		return x * mypow(x, n - 1, m) % m;
	}
}
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
//テーブルをつくる前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;//mod pにおける1,2,,,nの逆元
	for (int i = 2; i < MAX; ++i) {
		fac[i] = fac[i - 1] * i%INF;
		inv[i] = INF - inv[INF%i] * (INF / i) % INF;
		finv[i] = finv[i - 1] * inv[i] % INF;
	}
}

ll COM(int n, int k) {
	if (n < k)return 0;
	if (n < 0 || k < 0)return 0;
	return fac[n] * (finv[k] * finv[n - k] % INF) % INF;
}
///////////////////////////////////////

int L[500010];
int R[500010];
int a[500010];
int n;
int cnt = 0;
void merge(int A[], int n, int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;
	for (int i = 0; i < n1; ++i) {
		L[i] = A[left + i];
	}
	for (int i = 0; i < n2; ++i) {
		R[i] = A[mid + i];
	}
	L[n1] = INF;
	R[n2] = INF;
	int i = 0, j = 0;
	for (int k = left; k < right; ++k) {
		cnt++;
		if (L[i] <= R[j]) {
			A[k] = L[i++];
		}
		else {
			A[k] = R[j++];
		}
	}
}
void mergesort(int A[], int n, int left, int right) {
	if (left + 1 < right) {
		int mid = (left + right) / 2;
		mergesort(A, n, left, mid);
		mergesort(A, n, mid, right);
		merge(A, n, left, mid, right);
	}
}
int main() {
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	mergesort(a, n, 0,n);
	for (int i = 0; i < n; ++i) {
		if (i)cout << " ";
		cout << a[i];
	}
	cout << endl;
	cout << cnt << endl;
	return 0;
}



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

int a[200010];

signed main(){

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

  for(int i = 0; i < n; i++){
    int v = a[i];
    for(int j = i-1; j >= 0; j--){
      if(a[j] <= v){
        a[j+1] = v;
        break;
      }
      a[j+1] = a[j];
      if(j == 0) a[j] = v;
    }

    for(int j = 0; j < n; j++){
      if(j == n-1) cout << a[j] << endl;
      else cout << a[j] << " ";
    }
  }

  return 0;
}



Measured memory_bytes: 3088
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

//#define _USE_MATH_DEFINES
//#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>
#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

//const i64 mod = 1000000007ll;
const i64 smod = 11; //  998244353ll;
//const i64 inf = 1000000007; // 10000000000000007ll;

const double eps = 1e-8;

const i64 MAXN = 4 * 1'000'000 + 6;

i64 T;

i64 n, m;
i64 a[MAXN];

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n;

    vector<i64> q;
    for (i64 i = 1; i < 10; i++) {
        q.push_back(i);
    }

    if (n <= q.size()) {
        cout << q[n - 1] << endl;
        return 0;
    }
    n -= q.size();

    while (true) {
        vector<i64> nq;

        for (auto c : q) {
            i64 l = c % 10;
            for (i64 i = -1; i <= 1; i++) {
                i64 r = l + i;
                if (r < 0 || r > 9) {
                    continue;
                }
                i64 t = c * 10 + r;
                nq.push_back(t);
            }
        }

        q = nq;
        if (n <= q.size()) {
            cout << q[n - 1] << endl;
            return 0;
        }
        n -= q.size();
    }


    return 0;
}

Measured memory_bytes: 2848
#include <stdio.h>

int main(void)
{
	int m = 0, f = 0, r = 0;

	while (m != -1 || f != -1 || r != -1)
	{
		scanf("%d %d %d", &m, &f, &r);
		if (m == -1 && f == -1 && r == -1)
			break;

		if (m == -1 || f == -1) {
			printf("F\n");
		}
		else if (m + f >= 80) {
			printf("A\n");
		}
		else if (m + f >= 65) {
			printf("B\n");
		}
		else if (m + f >= 50) {
			printf("C\n");
		}
		else if (m + f >= 30) {
			if (r >= 50)
			{
				printf("C\n");
			}
			else {
				printf("D\n");
			}
		}
		else {
			printf("F\n");
		}
	}

	return 0;
}


Measured memory_bytes: 2052
/*
 root (x1-x2)^2 + (y1-y2)^2 = ((x1-x2) + (y1-y2))^2 - 2*(x1-x2)*(y1-y2)

 (x1-x2)*(y1-y2) = 0
 x1 = x2  
 or
 y1 = y2

 a = (x1 == x2)

 b = (y1 == y2)

 c = (x1==x2 && y1 == y2)

 c = c*(c-1)/2;


 a * b - c;
*/

#include<bits/stdc++.h>
using namespace std;

int main(void)
{
	int n;
	cin>>n;
	int h[n+1];
	for(int i=1;i<=n;i++)
		cin>>h[i];
	int dp[n+1];
	dp[1]=0;
	dp[2] = abs(h[1]-h[2]);

	for(int  i = 3;i<=n;i++)
		dp[i] = min((dp[i-1]+abs(h[i]-h[i-1])),(dp[i-2]+abs(h[i]-h[i-2])));
cout<<dp[n]<<endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

    vector<char> res;
    for (int i = 0; i < static_cast<int>(s.size()); i++) {
        if (s[i] == 'B') {
            if (!res.empty()) {
                res.pop_back();
            }
        } else {
            res.push_back(s[i]);
        }
    }

    for (int i = 0; i < static_cast<int>(res.size()); i++) {
        cout << res[i];
    }
    cout << endl;
}


Measured memory_bytes: 256