akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll inf = 1e9 + 7;
const ll Mod = 998244353;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

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

  int Order[N] = {};
  for (int i = 0; i < K; i++) Order[i] = 1;
  sort(Order, Order + N);

  ll ans = 1e18;
  do{
    ll now = 0, Highest = A[0];
    for (int i = 1; i < N; i++){
      if (Order[i] == 1 && A[i] <= Highest){
        now += Highest - A[i] + 1;
        Highest++;
      }else{
        Highest = max(Highest, A[i]);
      }
    }
    ans = min(ans, now);
  }while (next_permutation(Order, Order + N));
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
const int inf=1145141919ll;
const int mod=1000000007ll;
const int dd[]={0,-1,0,1,0};
using namespace std;
int n,m;
struct Node{
	vector<int> e;
} p[222222];
int q[222222];
signed main(){
	int i,j;
	cin>>n>>m;
	for(i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		u--;
		v--;
		p[u].e.push_back(v);
		p[v].e.push_back(u);
	}
	for(auto x:p[0].e)
		q[x]=1;
	for(auto x:p[n-1].e)
		if(q[x]){
			cout<<"POSSIBLE"<<endl;
			return 0;
		}
	cout<<"IMPOSSIBLE"<<endl;
	return 0;
}

Measured memory_bytes: 14824
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ a, b ] <- readInts
	print $ solve a b [ n * ( n + 1 ) `div` 2 | n <- [ 1 .. ] ]

solve a b ( x : y : rest )
	| a < x && b < y && x - a == y - b = x - a
	| otherwise = solve a b ( y:rest )

Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
 
 
 
int main() {
  int N,K;
  cin >> N >> K;
  
  vector<double> P(N);
  for(int i=0;i<N;i++){
    cin >> P.at(i);
  }
  
  vector<double> E(N);
  for(int i=0;i<N;i++){
    E.at(i)=(P.at(i)+1.0)/2.0;
  }
  
  vector<double> S(N+1, 0);
  for (int i = 0; i < N; i++){
    S.at(i+1) = S.at(i) + E.at(i);
  }
  
  double result = 0.0;
  for (int i = 0; i < N-K+1; i++) {
     double value = S.at(K+i) - S.at(i);
      if (result < value) 
        result = value;
   }
  cout << fixed << setprecision(15) << result << endl;
}

Measured memory_bytes: 4992
/*
Author: miitbh1
*/
#include <bits/stdc++.h>

#define rep(i, n) for(int i=0; i<n; i++)
#define repA(i, a, n) for(int i=a; i<n; i++)
#define repD(i, a, n) for(int i=a; i>=n; i--)
#define trav(it, ctr) for(auto it=ctr.begin(); it!=ctr.end(); it++)
#define p(x) cout<<x<<"\n"
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pp(x, y) cout<<x<<" "<<y<<"\n"
#define btc __builtin_popcount
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef priority_queue<int> pq;
typedef pair<int, int> ii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;
using ll=long long int;
const int N=100001, M=1e9+7;

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, k;
    cin>>k;
    string s;
    cin>>s;
    n=s.length();
    if(n<=k)p(s);
    else{
        rep(i, k)
        cout<<s[i];
        p("...");
    } 
    return 0;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);
		    
		   int count = 0;
		   String  s = scanner.nextLine();
		   
		   for(int i = 0; i < s.length();) 
		   {
			   if(s.substring(i, i + 1 ).equals("+"))
			   {
				   count = count + 1;
			   }
			   else 
			   {
				   count = count - 1;
			   }
				i = i + 1;   
				   
		   }
		    
		   System.out.println(count);
		   
		    scanner.close(); }
		  }

Measured memory_bytes: 23252
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int n; cin >> n;
	double t, a; cin >> t >> a;
	
	int ans = -1;
	double d = 1 << 30;
	for(int i = 0; i < n; i++) {
		int h; cin >> h;
		
		double x = t - h * 0.006;
		if(std::abs(a - x) < d) {
			ans = i;
			d = std::abs(a - x);
		}
	}
	
	assert(ans != -1);
	cout << ans + 1 << endl;
	return 0;
}


Measured memory_bytes: 256
use std::io;


fn main() {
    let n = read_one::<usize>();
    let mut ab = Vec::new();

    for _ in 0..n {
        let (a, b) = {
            let i = read::<i64>();
            (i[0], i[1])
        };
        ab.push((a, b, a + b));
    }

    let mut ans: i64 = 0;
    ab.sort_by_key(|a| a.2);

    for _ in 0..n {
        if ab.len() == 0 { break; }
        let choku = ab.pop().unwrap();
        ans += choku.0;

        if ab.len() == 0 { break; }
        let aoki = ab.pop().unwrap();
        ans -= aoki.1;
    }
    println!("{}", ans);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 9336
package main

import "fmt"

func g(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func l(a, b int) int { return a / g(a, b) * b }

func f(n, x int) int {
	if n < 1 {
		return 0
	}
	return n / x
}

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	fmt.Println(b - a + 1 - f(b, c) - f(b, d) + f(b, l(c, d)) + f(a-1, c) + f(a-1, d) - f(a-1, l(c, d)))
}


Measured memory_bytes: 512
#include <stdio.h>

long long  a[2000000], b[2000000], c[10001];

void csort(long long *a, long long *b, long long k, long long n){
  long long i, j;
  for(j = 0; j < n; ++j) c[a[j]]++;
  for(i = 1; i <= k; ++i) c[i] += c[i - 1];
  for(j = n - 1; j >= 0; --j){
    b[c[a[j]] - 1] = a[j];
    c[a[j]]--;
  }
}

int main(){
  long long n, i, max  = 0;

  scanf("%lld", &n);
  for(i = 0; i < n; ++i){
    scanf("%lld", a + i);
    if(max < a[i]) max = a[i];
  }
  csort(a, b, max, n);

  for(i = 0; i < n; ++i) printf(i != 0 ? " %lld" : "%lld" , b[i]);
  puts("");
  return 0;
}

Measured memory_bytes: 31940
import bisect

N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))

B = [0]
for i in range(N):
    B.append(B[i]+A[i])
    
C = []
for i in range(M):
    b,c = map(int,input().split())
    C.append([c,b]) #数字，個数
C = sorted(C,key=lambda x:x[0],reverse=True)

c_index = 0
INS = 0
ADD = 0
for i in range(1,N+1):
    if c_index>=M: break
    INS += C[c_index][0]
    C[c_index][1]-=1
    if C[c_index][1]==0:
        c_index+=1
        
    addsub = INS - B[i]
    if addsub>ADD: ADD=addsub
    else: break
    
print(B[N]+ADD)

Measured memory_bytes: 31176
N = gets.to_i
A = gets.chomp.split.map(&:to_i)

# i < j
# j - i == A[i] + A[j]
# i + A[i] == j - A[j]

t = Hash.new(0)
c = 0

N.times do |i|
  c += t[i - A[i]]

  t[A[i] + i] += 1
end

print c


Measured memory_bytes: 38780
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let k: usize = sc.cin();
    let q: usize = sc.cin();
    let mut memo = vec![0; 100000];
    for _ in 0..q {
        let a: usize = sc.cin();
        memo[a-1] += 1;
    }
    for i in 0..n {
        if q - memo[i] >= k {
            put!("No");
        } else {
            put!("Yes");
        }
    }
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


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

using namespace std;

long long min(long long a, long long b);

int main(void)
{
    long long N, h[100001], sum[100001], i;

    cin >> N;

    for(i=1; i<=N; i++){
        cin >> h[i];
    }

    if(i == 1){
        cout << 0 << endl;
    }

    else if(i == 2){
        cout << abs(h[1]-h[2]) << endl;
    }

    else{
        sum[1] = 0;

        sum[2] = abs(h[1]-h[2]);

        for(i=3; i<=N; i++){
            sum[i] = min(sum[i-2]+abs(h[i-2]-h[i]), sum[i-1]+abs(h[i-1]-h[i]));
        }

        cout << sum[N] << endl;
    }

    return 0;
}

long long min(long long a, long long b)
{
    if(a < b){
        return a;
    }

    else{
        return b;
    }
}

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    string a, b, c; cin >> a >> b >> c;
    int ai = 0, bi = 0, ci = 0, f = 0;
    while(1){
        if(f == 0){
            if(ai == a.size()){
                cout << "A" << endl;
                return 0;
            }
            f = a[ai] - 'a';
            ai++;
        }else if(f == 1){
            if(bi == b.size()){
                cout << "B" << endl;
                return 0;
            }
            f = b[bi] - 'a';
            bi++;
        }else{
            if(ci == c.size()){
                cout << "C" << endl;
                return 0;
            }
            f = c[ci] - 'a';
            ci++;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <iterator>
using namespace std;
typedef unsigned long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=1005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
const ll p=880301;
const ll P=31;


double x[maxn],y[maxn];
vector<double> v;
int main(){
    int n;
    cin>>n;
    REP(i,n) cin>>x[i]>>y[i];
    REP(i,n){
        v.clear();
        REP(j,n) if(i!=j){
            double theta;
            double dx=x[j]-x[i],dy=y[j]-y[i];
	    if(dx==0&&dy>=0) theta=PI/2;
	    if(dx==0&&dy<0) theta=PI/2*3;
            else theta=atan(dy/dx);
            if(dx<0) theta=PI+theta;
            v.pb(theta);
        }
        sort(ALL(v));
	double mx=v[0]-v.back()+2*PI;
        REP(j,SZ(v)-1) mx=max(mx,v[j+1]-v[j]);
        printf("%.12lf\n",max(0.0,(mx-PI)/(PI+PI)));        
    }
}



Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>


int main()
{
	int a,b,c,d,sum,count = 0,num;
	while(scanf("%d",&num) != EOF){
		count = 0;
		for(a = 0; a < 10; a++){
			for(b = 0; b < 10; b++){
				for(c = 0; c < 10; c++){
					for(d = 0; d < 10; d++){
						sum = a + b + c + d;
						if(sum == num){
							count++;
						}
					}
				}
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
       
using namespace std;
       
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
 
// #define MAX 100010
 
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES
 
long long binpow(long long a,long long b)
{
    if (b == 1) return a;
    long long res = binpow(a, b/2)%MOD;
    if (b % 2) return (res*((res*a)%MOD))%MOD;
    else return (res * res)%MOD;
}

long long int fact(long long int a)
{
    if(a==0||a==1)
        return 1;
    long long int ans = 1;
    for(int i=a;i>=1;i--)
        ans = (ans * i)% MOD;
    return ans;
}

long long int ivmod(long long int a)
{
    return binpow(a,MOD-2);
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    // #endif
    int n;
    cin>>n;
    int a[n+4];
    stack<int> s;
    long long int ans =1;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        s.push(x);
        if (x<=2*i) 
        {
            s.pop();
            ans=ans*(i + 1)%MOD;
            n--;
            i--;
        }
    }
    ans = ans*fact(s.size())%MOD;
    cout<<ans<<endl;
    return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class Data{
public:
	int i,x,y;
	bool operator<(const Data& r){return i<r.i;}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	vector<Data> P(N);
	REP(i,N){
		P[i].i=i;
		P[i].x=in();
		P[i].y=in();
	}
	double sum = 0;
	int M=0;
	do{
		for(int i=0;i<N-1;i++){
			sum += hypot(P[i].x-P[i+1].x,P[i].y-P[i+1].y);
		}
		M++;
	}while(next_permutation(ALL(P)));
	out(sum/M);
	return 0;
}


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

using namespace std;

int main() {
  string a,b,c;
  cin >> a >> b >> c;
  
 if ( (a[a.size()-1] == b[0]) && (b[b.size()-1] == c[0])) {
    cout << "YES" << endl;}
 else { cout << "NO" << endl; }

  return 0;
}

Measured memory_bytes: 256
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);
ll n;
vll a;
ll dp[100010][3];
ll recurse(ll idx, ll prev) {
  if(idx == n-1) {
    if(prev == 0) {
      return a[idx];
    } else {
      return -a[idx];
    }
  }
  ll &ans = dp[idx][prev];
  if(ans != -1) return ans;
  ans = -inf;
  ll given = a[idx];
  if(prev == 1) given*=-1; 
  ans = max(ans, given + recurse(idx+1, 0));
  given*=-1;
  ans = max(ans, given + recurse(idx+1, 1));
  return ans;
}
int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  cin >> n;
  a.resize(n);
  for(ll i = 0; i < n; i++) cin >> a[i];
  memset(dp, -1, sizeof dp); 
  ll ans = recurse(0, 0);
  cout << ans << endl;
  return 0;
} //good night.

Measured memory_bytes: 6528
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
const int maxn = 1000050;
using namespace std;
typedef long long ll;
int p[maxn];
int main()
{
	char c;
	cin>>c;
	int cnt=c-'A';
	if(cnt>=0&&cnt<26)
	cout<<"A";
	else cout<<"a";
	return 0;
}

Measured memory_bytes: 3620
import sys


def input():
    return sys.stdin.readline()[:-1]


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N, M = map(int, input().split())
uf = UnionFind(N)
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    uf.union(a, b)

ans = 0
for i in range(N):
    ans = max(ans, uf.size(i))
print(ans)


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

using namespace std;

int n, A[100050];
int main(){
//	freopen("binomialcoefficients.in", "r", stdin);
	cin >> n;
	for(int i = 0; i<n; i++) cin >> A[i];
	int a = 0, b = INT_MAX;
	for(int i = 0; i<n; i++) a = max(a, A[i]);
	double poo = (double)a /2;
	for(int i = 0; i<n; i++){	
		if((double) abs((double) A[i]-poo) <= (double) abs((double) b-poo)) b = A[i];
	}
	cout << a << " " << b;
}


Measured memory_bytes: 640
d = int(input())
clst = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
last = [0 for _ in range(26)]

def score_minus(d, q):
    minus = 0
    for i, (c, ls) in enumerate(zip(clst, last)):
        if i == q:
            continue
        minus += c * (d + 1 - ls)
    return minus
    
ans = 0
for i in range(d):
    tmp = -10 ** 10
    for q in range(26):
        tmp_score = s[i][q] - score_minus(i, q)
        if tmp_score > tmp:
            tmp = tmp_score
            max_q = q
    print(max_q + 1)
    last[max_q] = i

Measured memory_bytes: 9512
n, x = map(int, input().split())
a = list(map(int, input().split()))

ans = 0
for i in range(n-1):
    if a[i] > x:
        ans += a[i] - x
        a[i] = x
    if a[i] + a[i+1] > x:
        ans += a[i] + a[i+1] - x
        a[i+1] = x - a[i]

print(ans)


Measured memory_bytes: 14052
n=int(input())
t=[int(i) for i in input().split()]
cnt=[0]*(n+1)
for i in t:
	cnt[i]+=1
	
s = 0
for i in cnt:
	s+=i*(i-1)//2

for i in t:
	g = cnt[i]
	ans = s - g*(g-1)//2 + (g-1)*(g-2)//2
	print(ans)


Measured memory_bytes: 25644
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)
int main()
{
  int n;
  cin >> n;
  vector<ll> A(n);

  rep(i, n)
  {
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  ll sum = A[0];
  int i = 0;
  int index = 1;
  while (i < n - 2)
  {
    if (i % 2 == 0)
    {
      sum += A[index];
    }
    else
    {
      sum += A[index];
      index++;
    }
    i++;
  }

  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 4844
#include<stdio.h>
int main(){
  int N; int i,j;
  int mis = 0;
  scanf("%d", &N);
  char A[N];
  for(i=0;i<N;i++){
    scanf("%d",&j);
    A[i]=j;
    if(j % 2 == 0){
      if((j % 3 != 0) && (j % 5 != 0))
        mis++;
    }
  }
  if(mis == 0){
    printf("APPROVED");
  }else{
    printf("DENIED");
  }
  return 0;
}
  

Measured memory_bytes: 1696
#include<stdio.h>
int main(void)
{
	int ss,h,m,s;
	scanf("%d",&ss);
	m=ss/60;
	m=m%60;
	s=ss%60;
	h=ss/3600;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <stack>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;

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

  stack<int> stk;

  int cnt = 0;
  REP(i, 0, N) {
    if(S[i] == '(') stk.push(0);
    if(S[i] == ')') {
      if(stk.size() >= 1) stk.pop();
      else cnt++;
    }
  }

  string ans = S;
  REP(i, 0, cnt) ans = '(' + ans;
  REP(i, 0, stk.size()) ans = ans + ')';

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()
#define MAX_N 500000

typedef struct node_tbl{
	int key;
	int parent;
	int left;
	int right;
} node;

const int nil = -1;
node t[MAX_N + 1];
int root;
int room;
int ix;

int tree_minimum(int u){
	while (t[u].left != nil) u = t[u].left;

	return u;
}

int find(int u, int k){
	while (u != nil && k != t[u].key)
	{
		if (k < t[u].key)
			u = t[u].left;
		else
			u = t[u].right;
	}

	return u;
}

int tree_successor(int u){
	if (t[u].right != nil)
		return tree_minimum(t[u].right);

	int y = t[u].parent;
	while (y != nil && u == t[y].right)
	{
		u = y;
		y = t[y].parent;
	}

	return y;
}

void delete(int z){
	int y; /* ????????????????±? */
	int x; /* y?????? */

	/* ??????????????????????±??????? */
	if (t[z].left == nil || t[z].right == nil) y = z;
	else y = tree_successor(z);

	/* y??????x????±??????? */
	if (t[y].left != nil) x = t[y].left;
	else x = t[y].right;

	if (x != nil) t[x].parent = t[y].parent;

	if (t[y].parent == nil) root = x;
	else{
		if (y == t[t[y].parent].left) t[t[y].parent].left = x;
		else t[t[y].parent].right = x;
	}

	if (y != z) t[z].key = t[y].key;

	t[y].right = room;
	room = y;
}
void insert(int k){
	int z;

	int y = nil;
	int x = root;
	if (room == nil)
		z = ix++;
	else{
		z = room;
		room = t[room].right;
	}

	t[z].key = k;
	t[z].left = nil;
	t[z].right = nil;

	while (x != nil){
		y = x;
		if (t[z].key < t[x].key) x = t[x].left;
		else x = t[x].right;
	}

	t[z].parent = y;
	if (y == nil)
		root = z;
	else{
		if (t[z].key < t[y].key) t[y].left = z;
		else t[y].right = z;
	}
}
void inorder(int u){
	if (u == nil) return;

	inorder(t[u].left);
	printf(" %d", t[u].key);
	inorder(t[u].right);
}

void preorder(int u){
	if (u == nil) return;

	printf(" %d", t[u].key);
	preorder(t[u].left);
	preorder(t[u].right);
}

int main(int argc, char** argv){
	char command[8];
	int n;
	int x;
	int i;

	root = nil;
	room = -1;
	ix = 0;
	scanf("%d", &n);
	for (i = 0; i < n; ++i){
		scanf("%s", command);
		switch (command[0]){
		case 'd':
			scanf("%d", &x);
			delete(find(root, x));
			break;

		case 'f':
			scanf("%d", &x);
			printf("%s\n", find(root, x) != nil ? "yes" : "no");
			break;

		case 'i':
			scanf("%d", &x);
			insert(x);
			break;

		case 'p':
		default:
			inorder(root);
			printf("\n");

			preorder(root);
			printf("\n");
			break;
		}
	}

	return 0;
}



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

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

  int cake = 4;
  int donut = 7;

  bool just = false;
  for (int i = 0; i < N / cake + 1; i++)
  {
    for (int j = 0; j < N / donut + 1; j++)
    {
      if (N == i * cake + j * donut){
        just = true;
        break;
      }
    }
    
  }
  cout << (just ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <queue>
#include <cmath>
// #include <iomanip>
// std::cout << std::fixed << std::setprecision(5);



int main()
{
    int v[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    std::cin >> k;
    std::cout << v[k-1] << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define MOD 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define bolt ios::sync_with_stdio(0)
#define light cin.tie(0);cout.tie(0)
#define umll unordered_map<ll,ll>
#define mll map<ll,ll>
#define forr(i,p,n) for(ll i=p;i<(ll)n;i++)
#define test int t;cin>>t;while(t--)
#define MAXN 1000003
typedef long long ll;
using namespace std;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n%p; n = n * n%p;} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = MOD){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}
using namespace __gnu_pbds;  
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>ordered_set; 
void solve() {
	ll n,k;
	cin>>n>>k;
	ll a[n];
	forr(i,0,n) cin>>a[i];
	ll dp[n];
	forr(i,0,n) dp[i] = INT_MAX;
	dp[0] = 0;
	dp[1] = abs(a[1]-a[0]);
	forr(i,2,n) {
		forr(j,max(i-k,0ll),i) 
		{
			dp[i] = min(dp[i],dp[j]+abs(a[i]-a[j]));
			
		}
	}
	cout<<dp[n-1]<<"\n";

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

Measured memory_bytes: 1792
#include<cstdio>
#include <algorithm>
using namespace std;
#define maxn 2000005
int a[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;++i)
        scanf("%d",&a[i]);
    sort(a,a+n);
    for(int i=0;i<n;++i)
    {
        if(i) printf(" ");
        printf("%d",a[i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 10564
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define square(x) pow(x 2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](int a, int b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
*/

int main() {
  ll n,m,num;
  cin >> n >> m;
  rep(i,m){
    cin >> num;
    n-=num;
    if(n<0){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << n << endl;
  return 0;
}


Measured memory_bytes: 3616
N = int(input())
A = list(map(int, input().split()))
A.sort()
bs = [True] * (A[-1] + 1)
bs[0] = False
last = None
for a in A:
    if bs[a]:
        start = 2 * a if a != last else a
        for j in range(start, A[-1] + 1, a):
            bs[j] = False
    last = a
print(len({a for a in A if bs[a]}))

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

int main() {
    int n;
    int temp;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        temp = i;
        if (i % 3 == 0) {
            cout << " " << i;
        } else {
          while (temp) {
              if (temp % 10 == 3) {
                  cout << " " << i;
                  break;
              }
              temp /= 10;
          }
        }
    }
    cout << endl;
    return 0;
}

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

int main(){
  string s,t;
  cin>>s;
  cin>>t;
  int cnt=0;
  if(s[0]==t[0])cnt++;
  if(s[1]==t[1])cnt++;
  if(s[2]==t[2])cnt++;
  cout<<cnt;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

typedef string::const_iterator State;

string cipher(State &);
string str(State &);
string letter(State &);

class ParseError
{
};
void consume(State &begin, char expected)
{
    if (*begin == expected)
    {
        begin++;
    }
    else
    {
        cerr << "Expected '" << expected << "' but got '" << *begin << "'"
             << endl;
        cerr << "Rest string is '";
        while (*begin)
        {
            cerr << *begin++;
        }
        cerr << "'" << endl;
        throw ParseError();
    }
}
string cipher(State &begin)
{
    string ret;
    while (*begin && *begin != ']')
    {
        ret += str(begin);
    }
    return ret;
}

string str(State &begin)
{
    if (*begin == '[')
    {
        consume(begin, '[');
        string ret = cipher(begin);
        consume(begin, ']');

        reverse(ret.begin(), ret.end());
        return ret;
    }
    else
    {
        string ret = letter(begin);
        return ret;
    }
}

string letter(State &begin)
{
    if (*begin == '+')
    {
        consume(begin, '+');
        string ret = letter(begin);
        if (ret[0] == '?')
            return ret;
        ret[0]++;
        if (ret[0] == 'Z' + 1)
        {
            ret[0] = 'A';
        }
        return ret;
    }
    if (*begin == '-')
    {
        consume(begin, '-');
        string ret = letter(begin);
        if (ret[0] == '?')
            return ret;
        ret[0]--;
        if (ret[0] == 'A' - 1)
        {
            ret[0] = 'Z';
        }

        return ret;
    }
    char ret = *begin;
    begin++;

    return string() + ret;
}

int main()
{

    while (true)
    {
        string s;
        getline(cin, s);
        if (s == ".")
            break;
        State begin = s.begin();
        string ans = cipher(begin);
        rep(i, ans.size())
        {
            if (ans[i] == '?')
                ans[i] = 'A';
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3192
#include <iostream>
#include <string.h>
#include <math.h>
using namespace std;

int main(){
    char s[4];
    cin>>s;
    int kosu = 0;
    for(int i=0; i<3; i++){
        if(s[i]=='1'){
            kosu++;
        }
    }
    cout<<kosu<<endl;
    return 0;
}

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

string raw = "CODEFESTIVAL2016";
string s;

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

  cin >> s;
  int ans = 0;
  REP(i, s.size()) {
    if (s[i] != raw[i]) ans++;
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long int n;
	cin>>n;
	long double b;
	long int i,a[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i];	
	}
	sort(a,a+n);
	b=(a[0]+a[1])/2.00000;
	for(i=2;i<n;i++)
	{
		b=(b+a[i])/2;
	}
	cout<<b;
}

Measured memory_bytes: 3780
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

ll facts[100010],invs[100010];
ll powll(ll base,ll power){
    ll ans = 1;
    while (power){
        if (power&1) ans = (base*ans);
        base = (base*base);
        power >>= 1;
    }
    return ans;
}

int n,a,b;
vi v;

ll ncr(int n, int r){
    int v = 1;
    int in = 1;
    int ir = 1;
    int inr = 1;
    while(in <= n){
        v *= in;
        while(ir <= r){
            if(v%ir != 0) break;
            v /= ir;
            ir++;
        }
        while(inr <= n-r){
            if(v%inr != 0) break;
            v /= inr;
            inr++;
        }
        in++;
    }
    return v;
}
signed main(){
    I(n); I(a); I(b);
    v.resize(n);
    REP(i,n) I(v[i]);
    sort(all(v), greater<int>());

    b++;
    int avemax = accumulate(v.begin(),v.begin()+a,0LL);
    int aven = a;
    int comb = 0;
    FOR(i,a,b){
        int imax = accumulate(v.begin(),v.begin()+i,0LL);
        if (imax*aven < avemax*i) continue;
        // if (imax*aven > avemax*i){
        //     comb = 0;
        //     avemax = imax;
        //     aven = i;
        // }
        
        int in = 0, ir = 0, itgt = v[i-1];
        REP(ii,n){
            if (v[ii] == itgt){
                in++;
                ir += (ii<i);
            }
        }

        // cerr << in << " " << ir << endl;
        comb += ncr(in,ir);
        // cerr << comb << endl;
        
    }
    printf("%.7f\n%lld\n", (double)avemax/aven, comb);
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
using namespace std;
int main(void)
{
    string x;
    cin >> x;
    int ssize = x.length();
    for(int i = 0;i < ssize ;i++)
    {
        if(x[i] == '1')
        {
            x[i] = '9';
        }
        else
        {
            x[i] = '1';
        }
    }
    cout << x << endl;
}

Measured memory_bytes: 256
function Main(input) {
  input = input.trim()
 input = input.split(" ").map(Number);
if(input[0]<=input[2]&&input[0]+input[1]>=input[2]){
  console.log("YES")
}else{
  console.log("NO")
}
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
    string s;
    cin >> s;
    string first = s.substr(0,2);
    string second = s.substr(2,2);
    
    //数字列の大小は辞書の方法で比較することが可能
    if ("01"<=first && first <= "12" && "01"<=second && second <= "12"){
        cout << "AMBIGUOUS" << endl;
    }
    else if(second!="00" && second<"13"){
        cout << "YYMM" << endl;
    }
    else if (first!="00" && first<"13"){
        cout << "MMYY" << endl;
    }
    else cout << "NA" << endl;
}



Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

const MAX: usize = 30;

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let a: Vec<usize> = sc.vec(N);
    let mut cnt = vec![0; MAX];
    for i in 0..N {
        for b in 0..MAX {
            if (a[i]>>b) & 1 != 0 {
                cnt[b] += 1;
            }
        }
    }
    let mut ans = vec![0; N];
    for i in 0..N {
        for b in 0..MAX {
            if (cnt[b] - ((a[i]>>b) & 1)) % 2 != 0 {
                ans[i] |= 1<<b;
            }
        }
        println!("{}", ans[i]);
    }
}


Measured memory_bytes: 4896
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

ll ans;
int N;
ll A[10005];

int main(void) {
    scanf("%d", &N);
    REP(i, 0, N) scanf("%lld", &A[i]);

    REP(i, 0, N) {
    	while (A[i] % 2 == 0) {
    		ans++;
    		A[i] /= 2;
    	}
    }
    
    printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll> ;
#define all(v) v.begin(),v.end()

ll modpow(ll a,ll b,ll mod){
  ll ans=1%mod;
  while(b){	
    if(b&1) ans=(ans*a)%mod;
    a=(a*a)%mod;
    b=b>>1; 
  }
  return ans;
  }

int main(){
  string S;cin>>S;
  ll tmp_mod[200010];
  tmp_mod[S.size()]=0;
  ll dg = 0;
  for(ll i=S.size()-1;i>=0;--i){
    ll num = S[i]-'0';
    tmp_mod[i] = (num*modpow(10,dg,2019) + tmp_mod[i+1]) % 2019;
    dg++;
  }
  map<ll,ll> m;
  for(ll i=S.size();i>=0;--i){
    m[tmp_mod[i]]++;
  }
  ll ans=0;
  for(auto& x : m){
    ll cnt = ll(x.second);
    if(cnt<=1) continue;
    else ans += (cnt-1)*cnt/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 5228
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll n;
    cin >>n;
    ll a[n];
    REP(i,n)cin >> a[i];
    ll l[n],r[n];
    ll answer = 1000000000000;
    l[0]=a[0];
    FOR(i,1,n){
        l[i]=l[i-1]+a[i];
    }
    r[n-1]=a[n-1];
    FORR(i,n-2,0){
        r[i]=r[i+1]+a[i];
    }
    REP(i,n-1){
        ll tmp = llabs(l[i]-r[i]+a[i]);
        answer = min(answer,tmp);
    }
    
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 4992
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int sx = sc.nextInt();
        int sy = sc.nextInt();
        int tx = sc.nextInt();
        int ty = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        
        for (int i=sy; i<ty; i++){
            sb.append("U");
        }
        for (int i=sx; i<tx; i++){
            sb.append("R");
        }
       
        for (int i=sy; i<ty; i++){
            sb.append("D");
        }
        for (int i=sx; i<tx; i++){
            sb.append("L");
        }
        
        sb.append("L");
        for (int i=sy; i<ty+1; i++){
            sb.append("U");
        }
        for (int i=sx; i<tx+1; i++){
            sb.append("R");
        }
        sb.append("D");
        
        sb.append("R");
        for (int i=sy; i<ty+1; i++){
            sb.append("D");
        }
        for (int i=sx; i<tx+1; i++){
            sb.append("L");
        }
        sb.append("U");

        System.out.println(sb.toString());
    }

}


Measured memory_bytes: 23764
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    A,B = map(int, lines.pop(0).split(' '))
    diff = B - A
    print(sum(range(1, diff+1)) - B)

#
# main
#

# 1. use list instead of stdin

#contents = '''\
#54 65\
#'''
#lines = contents.split('\n')
#
# 2. use stdin

lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vst = vector<st>;
using vch = vector<char>;
using vbl = vector<bl>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
#define mkp(a, b) make_pair(a, b) 
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 ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

int main() {
  ll n;
  cin >> n;
  vll a(1000001, 0);
  rep(i, 2, a.size()){
    while(n % i == 0){
      n /= i;
      a.at(i)++;
    }
  }
  ll ans = 0;
  vrep(i, a) if(i != 0){
    ll ct = 1;
    while(true){
      i -= ct;
      if(i < 0) break;
      ct++;
      ans++;
    }
  }
  if(n > 1) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 11152