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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, m;
vector<array<int, 4>> in;
vector<pair<int, int>> e[500000];
int dist[500000];

template<typename Cost> void dijkstra(int start, vector<pair<int, Cost>> v[], Cost dist[]) {
	typedef pair<Cost, int> PC;
	PQ<PC, vector<PC>, greater<PC>> q;
	
	dist[start] = 0;
	q.emplace(dist[start], start);
	while(! q.empty()) {
		auto pc = q.top(); q.pop();
		if(pc.FI != dist[pc.SE]) { continue; }
		for(auto && e : v[pc.SE]) {
			if(setmin(dist[e.FI], dist[pc.SE] + e.SE)) { q.emplace(dist[e.FI], e.FI); }
		}
	}
	
	return;
}

int main() {
	cin >> n >> m;
	inc(i, m) {
		int p, q, c;
		cin >> p >> q >> c;
		p--; q--;
		
		int ep = n + 2 * i + 0;
		int eq = n + 2 * i + 1;
		in.PB({ p, c, ep, eq });
		in.PB({ q, c, eq, ep });
	}
	sort(ALL(in));
	
	inc(i, in.size()) {
		int  p = in[i][0];
		int ep = in[i][2];
		int eq = in[i][3];
		e[ep].PB({ eq, 0 });
		e[ep].PB({  p, 1 });
		e[ p].PB({ ep, 1 });
	}
	int k = in.size() - 1;
	// inc(i, in.size() - 1) {
	inc(i, k) {
		if(in[i][0] == in[i + 1][0] && in[i][1] == in[i + 1][1]) {
			int ep0 = in[i + 0][2];
			int ep1 = in[i + 1][2];
			e[ep0].PB({ ep1, 0 });
			e[ep1].PB({ ep0, 0 });
		}
	}
	
	int INF = n + 2 * m + 1;
	inc(i, n + m * 2) { dist[i] = INF; }
	dijkstra<int>(0, e, dist);
	
	cout << (dist[n - 1] == INF ? -1 : dist[n - 1] / 2) << endl;
	
	return 0;
}


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

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, m, br = 0, zb = 0, x = 0;
	cin >> n >> m;
	vector<int> v(n);
	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
		zb += v[i];
	}
	sort(v.rbegin(), v.rend());
	while (v[x] * (4 * m) >= zb)
	{
		br++;
		x++;
	}
	if (br >= m)
		cout << "Yes";
	else
		cout << "No";
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<cmath>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digitsum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
int getdigit(ll a) {
	return to_string(a).size();
}
int countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}
int to_num(char c) {
	if (c >= '0' && c <= '9')return (c - '0');
	else return -1;
}

int main() {
	IOS;
	int n, t;
	cin >> n >> t;
	vector<int> v(n);
	REP(i, n)cin >> v[i];
	ll sum = t;
	REP(i, n - 1) {
		sum += min(t, v[i + 1] - v[i]);
	}
	cout << sum << endl;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) {
    if (a[i] % 2 == 0 && (a[i] % 3 != 0 && a[i] % 5 != 0)) {
      cout << "DENIED" << endl;
      return;
    }
  }
  cout << "APPROVED" << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  
  int count = 1;
  bool b;
  for (int i = 1; i < N; i++) {
    b = true;
    for (int k = 0; k < i; k++) {
      if (H.at(i) < H.at(k)) {
        b = false;
        break;
      }
    }
    if (b == true) {
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;

int N;
int* marked_boss;

struct Info{
	vector<int> Children;
};

Info*info;

void update(int new_marked_boss_id){

	int current_boss_id = marked_boss[new_marked_boss_id],id;
	marked_boss[new_marked_boss_id] = new_marked_boss_id;
	queue<int> Q;

	for(int i = 0; i < info[new_marked_boss_id].Children.size();i++){

		if(marked_boss[info[new_marked_boss_id].Children[i]] == current_boss_id){
			marked_boss[info[new_marked_boss_id].Children[i]] = new_marked_boss_id;
			Q.push(info[new_marked_boss_id].Children[i]);
		}
	}

	while(!Q.empty()){
		id = Q.front();
		Q.pop();

		for(int i = 0; i < info[id].Children.size();i++){
			if(marked_boss[info[id].Children[i]] == current_boss_id){
				marked_boss[info[id].Children[i]] = new_marked_boss_id;
				Q.push(info[id].Children[i]);
			}
		}
	}
}

int main(){

	int Q,value;
	char buf[2];
	ll ans;

	marked_boss = new int[100001];
	info = (Info*)malloc(sizeof(Info)*(100001));

	while(true){
		scanf("%d %d",&N,&Q);
		if(N == 0 && Q == 0)break;

		for(int i = 1; i <= N; i++){
			marked_boss[i] = 1;
			info[i].Children.clear();
		}

		for(int i = 2; i <= N; i++){
			scanf("%d",&value);
			info[value].Children.push_back(i);
		}

		ans = 0;

		for(int i = 0; i < Q; i++){

			scanf("%s %d",buf,&value);

			if(buf[0] == 'Q'){
				ans += marked_boss[value];
			}else{
				update(value);
			}
		}

		printf("%lld\n",ans);
	}

	return 0;
}

Measured memory_bytes: 9008
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(int (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
const ll MOD=1e9+7;
const int nmax=8;
using namespace std;
ll num[200100];

int main(){
  ll n;
  cin >> n;
  ll left=100049,right=100050;
  if(n%2==0){
    rep(i,n){
      ll a;
      cin >> a;
      if(i%2==0) num[right++]=a;
      else num[left--]=a;
    }
    for(ll i=left+1;i<right;i++){
      if(i!=left+1) cout << " ";
      cout << num[i];
    }
    cout << endl;
  }else{
    rep(i,n){
      ll a;
      cin >> a;
      if(i%2==0) num[left--]=a;
      else num[right++]=a;
    }
    for(ll i=left+1;i<right;i++){
      if(i!=left+1) cout << " ";
      cout << num[i];
    }
    cout << endl;
  }
}

Measured memory_bytes: 3712
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( [ $ t : ty ] ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( [ $ t : ty ] ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( [ $ t ] ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let (n, k) = get!(u64, u64);

    let sum = (1..n + 1)
        .map(|mut x| {
            let mut i = 1;
            while x < k {
                i *= 2;
                x *= 2;
            }
            1.0 / i as f64
        })
        .sum::<f64>();

    println!("{}", sum / n as f64);
}


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


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	cin >>n >>k;
	VI sk(200100), gt;
	rep(i, n){
		int a; cin >>a; sk[a]++;
	}
	for(auto x: sk)if(x>0) gt.push_back(x);
	sort(all(gt));
	int sm = sz(gt);
	if(sm<= k){puts("0"); return 0;}
	int ans =0;
	rep(i, n){
		sm--; ans += gt[i];
		if(sm<= k){ cout << ans <<"\n"; break;}
	}
	
	return 0;
}


Measured memory_bytes: 2168
#include <stdio.h>
char map[8][8];

void which(int i,int j){
  //printf("%d %d\n",i,j);
  if(map[i+1][j]=='1' && map[i][j+1]=='1' && map[i+1][j+1]=='1')printf("A\n");
  else if(map[i+1][j]=='1' && map[i+2][j]=='1' && map[i+3][j]=='1')printf("B\n");
  else if(map[i][j+1]=='1' && map[i][j+2]=='1' && map[i][j+3]=='1')printf("C\n");
  else if(map[i+1][j]=='1' && map[i+1][j-1]=='1' && map[i+2][j-1]=='1')printf("D\n");
  else if(map[i][j+1]=='1' && map[i+1][j+1]=='1' && map[i+1][j+2]=='1')printf("E\n");
  else if(map[i+1][j]=='1' && map[i+1][j+1]=='1' && map[i+2][j+1]=='1')printf("F\n");
  else printf("G\n");
}
int main(){
  int i,j;
  int flag;
  char c;
  while(scanf("%s",&map[0])!=EOF){
    for(i=1;i<8;i++){
	scanf("%s",&map[i]);
      }
    for(i=0;i<8;i++){
      for(j=0;j<8;j++){
	if(map[i][j]=='1'){
	  which(i,j);
	  i=8;j=8;
	}
      }
    }
  }
  return 0;
}

Measured memory_bytes: 524
S = input()

z = 0
o = 0

for i in S:
    if i == "0":
        z += 1
    else:
        o += 1

for i in range(len(S)):

    if o == 0 or z == 0:
        print (len(S) - i)
        break

    if S[i] == "0":
        z -= 1
    else:
        o -= 1

    if S[-1-i] == "0":
        z -= 1
    else:
        o -= 1



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

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] array = new int[N];
    for (int i = 1; i <= N; i++)
      array[sc.nextInt() - 1] = i;
    System.out.println(String.join(" ", Arrays.stream(array).mapToObj(String::valueOf).toArray(String[]::new)));
  }
}

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

main()
{
        int n; cin>>n;
        vector<int> v(n);
        for(int i=0;i<n;i++)cin>>v[i];
        sort(v.begin(),v.end());
        cout<<v[n/2]-v[n/2-1]<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60
#define LLINF 1e12
#define PI 3.14159265359
#define ALL(a) (a).begin(), (a).end()
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int ny, nx;
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }

unsigned GetDigit(unsigned num) { return to_string(num).length(); }

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

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

ll nCr(int n, int r)
{
    if (n == r or n == 0)
        return 1;
    if (n < r)
        return 0;
    if (r == 1)
        return n;
    return nCr(n - 1, r - 1) + nCr(n - 1, r);
}

vector<ll> decom;

void decompositPrime(ll n)
{
    ll a = 2;
    while (n >= a * a)
    {
        if (n % a == 0)
        {
            decom.push_back(a);
            n /= a;
        }
        else
        {
            a++;
        }
    }
    decom.push_back(n);
}

//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////
int main()
{

    int N; cin >> N;
    vector<int> a(N+1);
    FOR(i,1,N+1) cin >> a[i];

    vector<int> ans;
    vector<int> b(N+1, 0);

    for(int i=N; i>=1; --i){
        int sum = 0;
        for (int j=i; j<=N; j+=i){
            sum += b[j];
        }
        if((sum + a[i]) %2 == 1){
            b[i]++;
            ans.push_back(i);
        }
    }

    reverse(ans.begin(), ans.end());
    cout << ans.size() << endl;
    for(auto &x: ans) cout << x << " ";

    return 0;
}


Measured memory_bytes: 3064
#!/usr/bin/env python3
Q = int(input())
prime = [0] + [1] * 10**5
prime[1] = 0
c = [0]
for i in range(1, 10**5 + 1):
    if prime[i]:
        c.append(c[-1] + prime[(i + 1) // 2])
        if i <= 10**2.5:
            for j in range(2, 10**5 // i+1):
                prime[j * i] = 0
    else:
        c.append(c[-1])
for i in range(Q):
    l, r = map(int, input().split())
    print(c[r] - c[l-1])


Measured memory_bytes: 10940
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        n: usize,
        a_list: [u32; n],
    }
    let mut a_list = a_list;
    a_list.sort_by(|a, b| b.cmp(a));
    let alice_sum: u32 =
        a_list.iter().enumerate()
            .filter(|&(i, _)| i % 2 == 0)
            .map(|(_, a)| a)
            .sum();
    let bob_sum: u32 =
        a_list.iter().enumerate()
            .filter(|&(i, _)| i % 2 == 1)
            .map(|(_, a)| a)
            .sum();
    println!("{}", alice_sum - bob_sum);
}


Measured memory_bytes: 4352
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A: Still TBD
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int Y = 2019, M = 4, D = 30;

/* typedef */

/* global variables */

char s[16];

/* subroutines */

inline int readnum(char *cpt) {
  int num = 0;
  while (*cpt >= '0' && *cpt <= '9')
    num = num * 10 + (*(cpt++) - '0');
  return num;
}

/* main */

int main() {
  scanf("%s", s);

  int y = readnum(s);
  int m = readnum(s + 5);
  int d = readnum(s + 8);
  //printf("%d/%d/%d\n", y, m, d);

  if (y < Y || (y == Y && (m < M || (m == M && d <= D)))) puts("Heisei");
  else puts("TBD");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <math.h>
#include <unordered_map>

using namespace std;

typedef long long int64;
typedef pair<int, int> ii;

const int mod = 1e9 + 7;

class Solution {
private:
public:
    int64 FizzBuzz(int n) {
        int64 ret = 0;
        for(int i = 1; i <= n; ++i) {
            if(!(i % 3 == 0 || i % 5 == 0)) ret += i;
        }
        return ret;
    }
};

int main() {
    int n;
    cin >> n;
    Solution sol;
    auto ret = sol.FizzBuzz(n);
    cout << ret << endl;
}

Measured memory_bytes: 3640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a11 = sc.next();
        String a12 = sc.next();
        String a13 = sc.next();
        String a21 = sc.next();
        String a22 = sc.next();
        String a23 = sc.next();
        String a31 = sc.next();
        String a32 = sc.next();
        String a33 = sc.next();

        int n = sc.nextInt();

        String[] b = new String[n];
        for (int i = 0; i < n; i++) {
            b[i] = sc.next();
        }
        if ((Arrays.asList(b).contains(a11)
            && Arrays.asList(b).contains(a12)
            && Arrays.asList(b).contains(a13))
            || (Arrays.asList(b).contains(a21)
                && Arrays.asList(b).contains(a22)
                && Arrays.asList(b).contains(a23))
            || (Arrays.asList(b).contains(a31)
                && Arrays.asList(b).contains(a32)
                && Arrays.asList(b).contains(a33))
            || (Arrays.asList(b).contains(a11)
                && Arrays.asList(b).contains(a21)
                && Arrays.asList(b).contains(a31))
            || (Arrays.asList(b).contains(a12)
                && Arrays.asList(b).contains(a22)
                && Arrays.asList(b).contains(a32))
            || (Arrays.asList(b).contains(a12)
                && Arrays.asList(b).contains(a22)
                && Arrays.asList(b).contains(a32))
            || (Arrays.asList(b).contains(a13)
                && Arrays.asList(b).contains(a23)
                && Arrays.asList(b).contains(a33))
            || (Arrays.asList(b).contains(a11)
                && Arrays.asList(b).contains(a22)
                && Arrays.asList(b).contains(a33))
            || (Arrays.asList(b).contains(a13)
                && Arrays.asList(b).contains(a22)
                && Arrays.asList(b).contains(a31))) {
                    System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }
}


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

int main(){
  int n;
  int a=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int k;
    cin>>k;
    if(k!=i+1) a += 1;
  }
  
  if(a>2) cout<<"NO"<<endl;
  else cout<<"YES"<<endl;
  return 0;
}

Measured memory_bytes: 256
/* src: (6 lines)

A, B, H, M = inputInt(), inputInt(), inputInt(), inputInt()
M /= 60.0
H = (H + M) / 12.0
dx = cos(M * 2 * M_PI) * B - cos(H * 2 * M_PI) * A
dy = sin(M * 2 * M_PI) * B - sin(H * 2 * M_PI) * A
printf("%.20f\n", sqrt(dx*dx+dy*dy))

*/

//#define NDEBUG

#include <cassert>
#include <vector>
#include <deque>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

const char*inputCLineOrWord(int mode){static char buf[2097152];static int bufLen=sizeof(buf);static int bufPos=sizeof(buf);static bool canReadFlag=true;static bool crFlag=false;static bool enterFlag=false;if(canReadFlag&&(enterFlag?bufLen<=bufPos:(int)sizeof(buf)<=bufPos+bufPos)){if(0<bufLen-bufPos){memmove(buf,buf+bufPos,bufLen-bufPos);bufLen-=bufPos;}else{bufLen=0;}char*result=fgets(buf+bufLen,sizeof(buf)-bufLen,stdin);canReadFlag=(result!=NULL);if(result!=NULL){int n=strlen(result);enterFlag=(n!=(int)sizeof(buf)-1-bufLen||(1<=bufLen+n&&buf[bufLen+n-1]=='\n'));bufLen+=n;}bufPos=0;}if(mode==0){int pos=bufPos;while(true){char c=buf[pos];if(c==32){buf[pos++]='\0';break;}else if(c==10){if(crFlag){crFlag=false;if(bufPos==pos){pos=++bufPos;continue;}}buf[pos++]='\0';break;}else if(c==13){crFlag=true;buf[pos++]='\0';break;}else if(c==0){break;}++pos;}const char*ret=buf+bufPos;bufPos=pos;while(true){char c=buf[bufPos];if(c==32||c==10||c==13){++bufPos;}else{break;}}return ret;}else if(mode==1){int pos=bufPos;while(true){char c=buf[pos];if(c==10){if(crFlag){crFlag=false;if(bufPos==pos){pos=++bufPos;continue;}}buf[pos++]='\0';break;}else if(c==13){crFlag=true;buf[pos++]='\0';break;}else if(c==0){break;}++pos;}const char*ret=buf+bufPos;bufPos=pos;if(crFlag){while(true){char c=buf[bufPos];if(c==13){++bufPos;crFlag=false;break;}else{break;}}}return ret;}else if(mode==2){return bufLen<=bufPos?NULL:buf+bufPos;}assert(false);return NULL;}const char*inputCWord(){return inputCLineOrWord(0);}int inputInt(){return atoi(inputCWord());}
// generated code (by mmlang) :

int A;
int B;
double H;
double M;
double dx;
double dy;

int main() {
    {
        const auto & $c1 = inputInt();
        const auto & $c2 = inputInt();
        const auto & $c3 = inputInt();
        const auto & $c4 = inputInt();
        tie(A, B, H, M) = tuple<int, int, int, int>($c1, $c2, $c3, $c4);
    }
    M /= 60.0;
    H = (H + M) / 12.0;
    dx = cos(M * 2 * M_PI) * B - cos(H * 2 * M_PI) * A;
    dy = sin(M * 2 * M_PI) * B - sin(H * 2 * M_PI) * A;
    printf("%.20f\n", sqrt(dx * dx + dy * dy));
    return 0;
}


Measured memory_bytes: 2472
import scala.collection.mutable

object Main extends App {
  def f(answers: Seq[(Int, String)]): (Map[Int, Int], Map[Int, Int]) = {
    val acs, was = mutable.HashMap.empty[Int, Int]
    answers.foreach { case (p, result) =>
      if (!acs.contains(p)) result match {
        case "AC" => acs.update(p, 0)
        case "WA" => was.update(p, was.getOrElse(p, 0) + 1)
      }
    }
    (acs.toMap, was.toMap)
  }

  val sc = new java.util.Scanner(System.in)
  val N, M = sc.nextInt()
  val (acs, was) = f(List.fill(M)(sc.nextInt() -> sc.next()))
  println(s"${acs.size} ${was.filter { case (i, _) => acs.contains(i) }.values.sum}")
}


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

int main() {
  int N, sum, l, r;
  cin >> N;
  sum = 0;

  for (int i = 0; i < N; i++) {
    cin >> l >> r;
    sum += (r - l + 1);
  }
  cout << sum << endl;
}


Measured memory_bytes: 384
n = gets.chomp.to_i
input = []
n.times do 
  input.push(gets.to_i)
end

=begin

def gcd (n,m)
  return 1 if n == 0 || m == 0
  while n != 0 && m != 0 do
    if n < m 
      m = m % n
    else 
      n = n % m 
    end
  end
  return n < m ? m : n
end

def lcm (n,m)
  n * m / gcd(n,m)
end

g = lcm(input[0],input[1])
1.upto(n-2) do |i|
  g = lcm(input[i],input[i+1])
end
puts g
=end
puts input.inject(:lcm)

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


typedef long long ll;
struct NT{
  vector<bool>isprime;

  ll mod_mult(ll a, ll b, ll m) {
    ll res = 0;
    ll exp = a % m;
    while (b) {
      if (b & 1) {
        res += exp;
        if (res > m) res -= m;
      }
      exp <<= 1;
      if (exp > m) exp -= m;
      b >>= 1;
    }
    return res;
  }

  ll mod_exp(ll a, ll b, ll m) {
    ll res = 1;
    ll exp = a % m;
    while (b) {
      if (b & 1) res = mod_mult(res, exp, m);
      exp = mod_mult(exp, exp, m);
      b >>= 1;
    }
    return res;
  }

  bool miller_rabin(ll n, ll times) {
    if (n < 2) return false;
    if (n == 2) return true;
    if (!(n & 1)) return false;
    ll q = n-1;
    int k = 0;
    while (q % 2 == 0) {
      k++;
      q >>= 1;
    }
    for (int i = 0; i < times; i++) {
      ll a = rand() % (n-1) + 1;
      ll x = mod_exp(a, q, n);
      if (x == 1) continue;
      bool found = false;
      for (int j = 0; j < k; j++) {
        if (x == n-1) {
          found = true;
          break;
        }
        x = mod_mult(x, x, n);
      }
      if (found) continue;
      return false;
    }
    return true;
  }

  ll pollard_rho(ll n, int c) {
    ll x = 2;
    ll y = 2;
    ll d = 1;
    while (d == 1) {
      x = mod_mult(x, x, n) + c;
      y = mod_mult(y, y, n) + c;
      y = mod_mult(y, y, n) + c;
      d = __gcd((x-y >= 0 ? x-y : y-x), n);
    }
    if (d == n) return pollard_rho(n, c+1);
    return d;
  }
};

int sum;

int main(){
  NT N;
  ll n;
  cin>>n;
  while(n--){
    ll a;
    scanf("%ld",&a);
    if(N.miller_rabin(a,100))sum++;
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 3148
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    double n;cin>>n;
    vector<vector<vector<double> > >dp(910,vector<vector<double> >(310,vector<double>(310)));
    dp[0][0][0]=1.0;
    ll x=0,y=0,z=0;
    rep(i,n){
        ll a;cin>>a;
        if(a==1)x++;
        if(a==2)y++;
        if(a==3)z++;
    }
    double ans=0.0;
    rep(i,x+y*2+z*3){
        rep(j,310){
            rep(k,310){
                if(dp[i][j][k]==0.0)continue;
                double l=i-j-k;
                if(l<0)continue;
                double f3=z-j;
                double f2=y+j-k;
                double f1=x+k-l;
                double f0=l;
                dp[i+1][j+1][k]+=dp[i][j][k]*(f3/(n-f0));
                dp[i+1][j][k+1]+=dp[i][j][k]*(f2/(n-f0));
                dp[i+1][j][k]+=dp[i][j][k]*(f1/(n-f0));
            }
        }
        rep(j,310){
            rep(k,310){
                if(dp[i][j][k]==0.0)continue;
                double l=i-j-k;
                if(l<0)continue;
                double f3=z-j;
                double f2=y+j-k;
                double f1=x+k-l;
                double f0=l;
                double b=f1+f2+f3;
                if(b==0)continue;
                ans+=dp[i][j][k]*n/b;
            }
        }
    }
    cout<<setprecision(16)<<ans<<endl;
}

Measured memory_bytes: 697344
#include <stdio.h>

int main(){
	int n, l,r;
	scanf("%d", &n);
	
	int ans = 0;
	
	for(int i = 0;i<n;i++){
		scanf("%d %d", &l, &r);
		ans += r-l+1;
	}

	printf("%d\n", ans);
		
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
  int n,k;
  cin >> n >> k;
  if (n%k==0) {
    cout << 0 << "\n";
  } else {
    cout << 1 << "\n";
  }
}


Measured memory_bytes: 384
#include <iostream>
#include <math.h>

using namespace std;

int calc_gcj(int a, int b) {
	int A=0, B=0;
	if (a == max(a,b)) {
		A = a;
		B = b;
	} else {
		A = b;
		B = a;
	}
	if (A == B) return A;
	else return calc_gcj(B,A-B);
	return -1;
}

void solve(int a, int b) {
	int gcj = calc_gcj(a,b);
	int lcm = a/gcj*b;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

Measured memory_bytes: 1160
/*
 * ----------------------------------------------------------------------------
 (: Bismillahir Rahmanir Rahim :) 
 * File: /root/Programming/Atcoder/D_Lunlun_Number.cpp
 * Project: /root/Programming/Atcoder
 * Created Date: Saturday, April 4th 2020, 6:34:50 pm
 * Author: Grim Firefly :)
 * Author Mail : GrimFirefly1@gmail.com
 * -----
 * Last Modified: Sun Apr 05 2020
 * Modified By: Grim Firefly :)
 * -----
 * ----------------------------------------------------------------------------
 */

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

//constant
#define PI acos(-1.0)

//typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned un;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef map<int, int> mii;
typedef map<char, char> mcc;
typedef map<char, int> mci;
typedef map<string, int> msi;
typedef map<ll, ll> mll;

//defined for loop

// defined for taking input
#define gl(x) getline(cin, x)
#define sf scanf
#define sfi(x) sf("%d", &x)
#define sfc(x) sf("%c", &x)
#define sfl(x) sf("%lld", &x)
#define sflu(x) sf("%llu", &x)
#define sfii(x, y) sf("%d %d", &x, &y)
#define sfll(x, y) sf("%lld %lld", &x, &y)
#define sfiii(x, y, z) sf("%d %d %d", &x, &y, &z)
#define sflll(x, y, z) sf("%lld %lld %lld", &x, &y, &z)

//defined for printing
#define pf printf
#define pfn pf("\n")
#define pfcas pf("Case %d: ", cas)
#define pfyes pf("YES")
#define pfno pf("NO")
#define pfi(x) pf("%d", x)
#define pfl(x) pf("%lld", x)

//Defined for loop
//increament
#define loopi(i, j, k) for (int i = j; i < k; i++)
#define loopl(i, j, k) for (ll i = j; i < k; i++)
#define loopc(i, j, k) for (char i = j; i < k; i++)
#define looplu(i, j, k) for (ull i = j; i < k; i++)
//decreament
#define loopri(i, j, k) for (int i = j; i > k; i--)
#define looprl(i, j, k) for (ll i = j; i > k; i--)
#define looprlu(i, j, k) for (ull i = j; i > k; i--)
#define looprc(i, j, k) for (char i = j; i > k; i--)
#define wa(t) while (t--)

//testcases
#define testc(t) for (char cas = 1; cas <= t; cas++)
#define testi(t) for (int cas = 1; cas <= t; cas++)
#define testl(t) for (ll cas = 1; cas <= t; cas++)

//some cmd
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define SZ 10000

//Main Function Start

int main()
{
    ll n;
    sfl(n);
    queue<ll> QQ;
    loopi(i, 1, 10)
    {
        QQ.push(i);
    }
    ll cnt = 0;
    while (true)
    {
        ll x = QQ.front() % 10;
        if (x)
        {
            QQ.push(x + QQ.front() * 10 - 1);
        }
        QQ.push(x + QQ.front() * 10);
        if (x != 9)
        {
            QQ.push(1 + x + QQ.front() * 10);
        }
        cnt++;
        if (cnt == n)
        {
            cout << QQ.front() << endl;
            break;
        }
        QQ.pop();
    }
    return 0;
}

Measured memory_bytes: 1792
num = []
r, c = gets.split.map(&:to_i)
r.times do
  line = gets.split.map(&:to_i)
  line << line.reduce(:+)
  num << line
  puts line.join(" ")
end

a = (0..c).to_a.map do |j|
  (0...r).to_a.map { |i| num[i][j] }.reduce(:+)
end
puts a.join(" ")

Measured memory_bytes: 6228
#include<stdio.h>
int main(void)
{
	int d,t,s;
	scanf("%d %d %d",&d,&t,&s);
	if(s*t==d){
		printf("Yes\n");
	}
	else if(s*t>d){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1644
#include <iostream>
#include <algorithm>
#include <numeric>
#include <map>
#include <vector>
#include <climits>
#include <cmath>

int main(void) {
  long long int N;
  std::cin >> N;

  std::vector<int> a(100002,0);
  for (int i = 0; i < N; i++) {
    int tmp;
    std::cin >> tmp;
    tmp += 1;
    a[tmp-1]++;
    a[tmp]++;
    a[tmp+1]++;
  }

  int max = 0;
  for (int i = 0; i < 100002; i++) {
    if (max < a[i]) {
      max = a[i];
    }
  }

  std::cout << max << std::endl;

  return 0;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
char ca[3][505][505];
int main(){
	int h,w;
	int i,j,k;
	int a,b,c;
	cin>>h>>w;
	for(i=0;i<h;i++){
		cin>>ca[0][i];
	}
	for(i=0;i<h;i++){
		ca[1][i][0]='#';
		ca[2][i][0]='.';
		ca[1][i][w-1]='.';
		ca[2][i][w-1]='#';
		for(j=1;j<w-1;j++){
			if(ca[0][i][j]=='#'){
				ca[1][i][j]='#',ca[2][i][j]='#';
			}else if(i%2==0){
				ca[1][i][j]='#',ca[2][i][j]='.';
			}else{
				ca[1][i][j]='.',ca[2][i][j]='#';
			}
		}
	}
	for(i=0;i<2;i++){
		for(j=0;j<h;j++){
			cout<<ca[i+1][j]<<endl;
		}
		if(i==0)cout<<endl;
	}
	return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    int p_min = n + 1;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        int p;
        cin >> p;
        p_min = min(p, p_min);
        if (p == p_min) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import java.io.{BufferedReader, InputStream, InputStreamReader}
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}

object Main {
  val MOD = 1000000007
  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N = sc.nextInt()

    val INF =100001
    val dp = Array.fill[Int](N + 1)(INF)
    dp(0) = 0
    var d = 6
    for {
      _ <- 1 to 6
    } {
      (1 to N) foreach { i =>
        if (i - d >= 0) dp(i) = min(dp(i), dp(i - d) + 1)
      }
      d *= 6
    }
    d = 9
    for {
      _ <- 1 to 5
    } {
      (1 to N) foreach { i =>
        if (i - d >= 0) dp(i) = min(dp(i), dp(i - d) + 1)
      }
      d *= 9
    }

    val ix = dp.lastIndexWhere(_ != INF)
    val ans = if (ix !=  -1) {
      dp(ix) + (N - ix)
    } else {
      N
    }

    println(ans)
  }


  def main(args: Array[String]): Unit = {
    solve()
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = null

    def next: String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next.toInt
    def nextLong(): Long = next.toLong
    def nextChar(): Char = next.charAt(0)
  }


}


Measured memory_bytes: 28044
#include <iostream>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()

int const N = 200001;

int main(){
    int n, k, d, v[N], vs[N];
    scanf("%d%d", &n, &k);
    for(int i = 0; i<k; ++i){
        cin >> d;
        for(int j = 0, x; j<d; ++j){
            cin >> x; 
            vs[x] = true;
        }
    }
    int an = 0;
    for(int i = 1; i<=n; ++i)if(!vs[i])++an;
    cout << an << "\n";
}

Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll ans = 0;
    if(a%2 || b%2 || c%2){cout << ans << endl; return 0;}
    if(a==b && b==c) {cout << -1 << endl; return 0;}
    while(1){
        if(a%2 || b%2 || c%2) break;
        ll A = (b+c)/2, B = (a+c)/2, C = (a+b)/2;
        a = A;
        b = B; 
        c = C;
        ans++;
    }
    cout << ans << endl;
    return 0;
}  

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N, T, A;
    cin >> N >> T >> A;
    int H[N];
    for (int i = 0; i < N; ++i) {
        cin >> H[i];
    }
    double answer = 1e9;
    int ans_position = 1;
    for (int i = 0; i < N; ++i) {
        double temp = abs(A - (T - (H[i] * 0.006)));
        answer = min(answer, temp);
        if (answer == temp) {
            ans_position = i + 1;
        }
    }
    cout << ans_position << endl;
}

Measured memory_bytes: 256
import sys
import heapq
from collections import defaultdict


def input():
    return sys.stdin.readline().strip()


def main():
    N, M = map(int, input().split())

    D = defaultdict(list)
    for i in range(N):
        A, B = map(int, input().split())
        D[A].append(-1 * B)
    R = []
    answer = 0
    for i in range(1, M + 1):
        if len(D[i]) > 0:
            d = D[i]
            for t in d:
                heapq.heappush(R, t)
        if R:
            answer += heapq.heappop(R)

    print(-1 * answer)


if __name__ == "__main__":
    main()


Measured memory_bytes: 27732
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N=int(input())
H=nl()
flag=True

H[0]-=1
for i in range(1,N-1):
    if(H[i-1]<H[i]):
        H[i]-=1
    if(H[i]>H[i+1]):
        flag=False

print('Yes' if flag==True else 'No')


Measured memory_bytes: 14812
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    while n>0:
        right=n+1
        left=1
        while right-left>0:
            k=(right+left)//2
            if n<k*(k-1)//2+1:
                right=k
                continue
            elif k*(k+1)//2<n:
                left=k
                continue
            break
        print(k)
        n-=k



if __name__=='__main__':
    main()

Measured memory_bytes: 3316
#include <cstdio>
#include <map>
#include <cstring>
#include <algorithm>
using namespace std;
#define mst(a,b) memset((a),(b),sizeof(a))
#define rush() int T;scanf("%d",&T);while(T--)

typedef long long ll;
const int maxn = 105;
const ll mod = 998244353;
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;

char s[maxn];

int main()
{
    while(~scanf("%s",s))
    {
        int len=strlen(s);
        printf("%c",s[0]);
        printf("%d",len-2);
        printf("%c\n",s[len-1]);
    }
}


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

#define mod 1000000007

ll bigmod( ll a, ll b, ll m)
{
    if( b==0LL )
        return 1LL%m;

    ll x = bigmod( a, b/2LL, m);
    x = ( x * x ) % m;

    if( b%2LL == 1LL ) x = (x*a)%m;

    return x;
}

int main()
{
    string s;
    cin >> s;
    int len = s.size();
    int ans = 0, a = 0, z = 0;
    for( int i=0; i<len; i++){
        if( s[i] == 'A'){
            a = i+1;
            break;
        }
    }
    for( int i=len-1; i>=0; i--){
        if( s[i] == 'Z'){
            z = i+1;
            break;
        }
    }
    cout << z - a + 1 << endl;

    return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <list>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(d) string(1,d)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  string s;
  cin>>s;
  ll k;
  cin>>k;
  string s1;
  rep(i,0,s.sz-1){
  	char c = s[i];
  	if(s[i]!='a'&&'z'+1-c<=k){
  		k-=('z'+1-c);
  		s1 += "a";
  	}
  	else{
  		s1+=s[i];
  	}
  }
  ll a = k + s[s.sz-1]-'a';
  a %= 26;
  s1 += 'a'+a;
  cout << s1 << endl;
  return 0;
}


Measured memory_bytes: 640
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> map;

    for (int i = 0; i < H; i++) {
        string tmp;
        cin >> tmp;
        map.push_back(tmp);
    }

    for (int y = 0; y < H; y++) {
        for (int x = 0; x < W; x++) {
            if (map[y][x] == '.') {
                int nB = 0;
                for (int dy = -1; dy <= 1; dy++) {
                    for (int dx = -1; dx <= 1; dx++) {
                        if (0 <= x + dx && x + dx < W && 0 <= y + dy &&
                            y + dy < H) {
                            if (map[y + dy][x + dx] == '#') nB++;
                        }
                    }
                }
                map[y][x] = to_string(nB)[0];
            }
        }
    }

    for (int y = 0; y < H; y++) {
        for (int x = 0; x < W; x++) {
            cout << map[y][x];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
from collections import deque


def main():
    H, W = list(map(int, input().split()))
    A = [list(input()) for _ in range(H)]
    # 「右or下のみ移動可」で深さ優先探索
    # 移動時、該当マスを左上角とする長方形領域以外に未訪問の '#' があったらNG
    # ゴールに到達できなくてもNG
    que = deque()
    que.append((0, 0))
    ok = False
    while len(que) > 0:
        h, w = que.pop()
        A[h][w] = '.'
        if (h, w) == (H - 1, W - 1):
            ok = True
            break
        # 横方向
        next_h, next_w = h, w + 1
        if next_w < W and A[next_h][next_w] == '#':
            exist_unvisited = False
            for hh in range(next_h, H):
                if A[hh][w] == '#':
                    exist_unvisited = True
                    break
            if exist_unvisited:
                break
            que.append((next_h, next_w))
            continue
        # 縦方向
        next_h, next_w = h + 1, w
        if next_h < H and A[next_h][next_w] == '#':
            exist_unvisited = False
            for ww in range(next_w, W):
                if A[h][ww] == '#':
                    exist_unvisited = True
                    break
            if exist_unvisited:
                break
            que.append((next_h, next_w))
            continue
    if ok:
        print('Possible')
    else:
        print('Impossible')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9444
N=int(input())
A=list(map(int,input().split()))+[0]
A.insert(0,0)
cost=0
for i in range(N+1):
    cost+=abs(A[i+1]-A[i])
for i in range(1,N+1):
    print(cost-abs(A[i+1]-A[i])-abs(A[i]-A[i-1])+abs(A[i+1]-A[i-1]))

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

int main()
{
  vector<int> V(3);
  scanf("%d %d %d", &V[0], &V[1], &V[2]);
  int five = 0;
  int seven = 0;

  for (int v : V)
  {
    if (v == 5)
    {
      five++;
    }
    else if (v == 7)
    {
      seven++;
    }
  }

  if (five == 2 && seven == 1)
  {
    printf("YES");
  }
  else
  {
    printf("NO");
  }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	p := make([]int, m)
	s := make([]string, m)

	ac := map[int]bool{}
	for i := 0; i < m; i++ {
		fmt.Scan(&p[i], &s[i])
		if s[i] == "AC" {
			ac[p[i]] = true
		}
	}

	aa := map[int]bool{}
	var cc, pc int
	for i := 0; i < m; i++ {
		if aa[p[i]] {
			continue
		}
		if s[i] == "AC" {
			aa[p[i]] = true
			cc++
		} else {
			if ac[p[i]] {
				pc++
			}
		}
	}

	fmt.Println(cc, pc)
}


Measured memory_bytes: 12404
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <utility>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 1e5+5;

int A, B;

int main() {
//#define LOCAL
#ifdef LOCAL
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif 
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> A >> B;
	for(int i = 1; i <= 1000000; ++i) {
		if(int(i*0.08) == A && int(i*0.1) == B) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}



Measured memory_bytes: 256