akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
const int INF = numeric_limits<int>::max();

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(n*a, b) << endl;
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        a: [i64; n],
    }
    if n % 3 != 0 {
        let ok = a.iter().all(|&x| x == 0);
        puts!("{}\n", if ok { "Yes" } else { "No" });
        return;
    }
    let mut freq = HashMap::new();
    for i in 0..n {
        *freq.entry(a[i]).or_insert(0) += 1;
    }
    let mut ok = true;
    let mut sum = 0;
    for (&p, &f) in freq.iter() {
        if f % (n / 3) != 0 {
            ok = false;
        }
        let u = f / (n / 3);
        if u % 2 != 0 {
            sum ^= p;
        }
    }
    ok &= sum == 0;
    puts!("{}\n", if ok { "Yes" } else { "No" });
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

using namespace std;
 
typedef long long int ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector <string> vs;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pi;

//#define int ll
#define forl(i,a,b) for (int i = a; i < b; i++)
#define rfor(i,b,a) for (int i = b; i >= a; i--)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define srt(x) sort(x.begin(), x.end())
#define sumup(x) accumulate(x.begin(), x.end(), 0)
#define PI 3.141592653589793238
#define MOD 1000000007
#define loop(n) for(int i = 0; i < n; i++)
#define rloop(n) for(int i = n-1; i >= 0; i--)

void io() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

void solve() {
    string s;
    int ans=0;
    cin>>s;
    if(s=="RRR") ans=3;
    else if(s=="RRS" || s=="SRR") ans =2;
    else if(s=="RSS" || s=="SRS" || s=="SSR" || s=="RSR") ans =1;

    cout<<ans<<"\n";
    return;
}
int32_t main() {
    io();
    int t=1;
    //cin>>t;
    while(t--) {
        solve();
    }
    return 0;
}

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

const int N = 210;

int n, m, r;
int v[N], a[N], mat[N][N], dis[N][N];

int main(){
	scanf("%d%d%d", &n, &m, &r);
	for (int i = 0; i < r; ++ i){
		scanf("%d", &v[i]);
	}
	for (int i = 0, u, v, w; i < m; ++ i){
		scanf("%d%d%d", &u, &v, &w);
		mat[u][v] = mat[v][u] = w;
	}
	memset(dis, 0x3f, sizeof(dis));
	for (int i = 1; i <= n; ++ i){
		for (int j = 1; j <= n; ++ j){
			if (mat[i][j]){
				dis[i][j] = dis[j][i] = mat[i][j];
			}
		}
	}
	for (int k = 1; k <= n; ++ k){
		for (int i = 1; i <= n; ++ i){
			for (int j = 1; j <= n; ++ j){
				if (k == i || k == j){
					continue;
				}
				dis[i][j] = std::min(dis[i][j], dis[i][k] + dis[k][j]);
			}
		}
	}
	for (int i = 0; i < r; ++ i){
		a[i] = i;
	}
	int ans = INT_MAX;
	do{
		int sum = 0;
		for (int i = 0; i < r - 1; ++ i){
			sum += dis[v[a[i]]][v[a[i + 1]]];
		}
		ans = std::min(sum, ans);
	}
	while (std::next_permutation(a, a + r));
	return printf("%d\n", ans), 0;
}

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

int main() {
  int i,N,K,ans=0;
  cin >> N >> K;
  for(i=0;i<N;i++) {
    int x;
    cin >> x;
    ans += min(x,K-x);
  } 
  cout << 2*ans << endl;
  return 0;
}     
    

Measured memory_bytes: 256
#include<stdio.h>
 
int main(void)
 
{
    int i , j;
    for(i = 1; i <= 9; i++)
    {
        for(j = 1; j <= 9; j++)
        {
            printf("%dx%d=%d\n",i,j,i*j);
        }
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
// end of Template

int n;
multiset <int> m;
multiset <int> :: iterator itr;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin>>n;
    for(int i=1;i<=n;i++){
        int val; cin>>val;
        val *= -1;
        if(i==1) m.insert(val);
        else{
            if(val >= *m.rbegin()) m.insert(val);
            else{
                int upp = *m.upper_bound(val);
                m.erase(m.find(upp));
                m.insert(val);
            }
        }
    }
    cout<<m.size()<<newl;

}



Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define lli long long int
#define MOD 1000000007
#define KING 1000000002
#define queen 1000002
#define fi first
#define se second
#define se second
#define lsb(i) (i & -i)
#define nl cout<<'\n'
#define TEST cout<<"TEST",nl
#define all(a) a.begin(), a.end()
#define pr pair<lli,lli>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define vi vector<lli>
#define vpi vector<pr> 
#define P pair<lli,pr>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define NA(i,s,n) for(lli i=s;i<n;i++)
using namespace std;

lli power(lli x,lli y,lli p) { 
	lli res = 1;	 
	x = x % p; 
	while (y > 0) 
	{ 
		if (y & 1) 
			res = (res*x) % p; 
		y = y>>1; 
		x = (x*x) % p; 
	} 
	return res; 
} 

lli n,a,b,c;

void solve(){
    lli n, p; cin>>n;
	vi a(n+1, 0);
	NA(i,2,n+1){
		cin>>p;
		++a[p];
	}
	NA(i,1,n+1) cout<<a[i]<<'\n';
    return;
}

int main(){
    fastIO;
    lli t = 1; 
    // cin>>t;
    NA(i,0,t) solve();
    return 0;
}


Measured memory_bytes: 4768
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		//		new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();

			System.out.println((numA - 1) * (numB - 1));

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			int count = 0;
			for (int i = 1; i <= numN; i++) {
				if (i % 2 == 0) {
					continue;
				}
				int wk = i;
				Map<Integer, Integer> wkMap = new HashMap<Integer, Integer>();
				for (int j = 2; j < i;) {
					if (wk % j == 0) {
						wk /= j;
						wkMap.put(j, wkMap.get(j) == null ? 1 : wkMap.get(j) + 1);
					} else {
						j++;
					}
				}
				int wkRes = 1;
				for (Integer val1 : wkMap.values()) {
					wkRes *= (val1 + 1);
				}
				if (wkRes == 8) {
					count++;
				}
			}

			System.out.println(count);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB2() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			int count = 0;
			for (int i = 1; i <= numN; i++) {
				if (i % 2 == 0) {
					continue;
				}
				int wkRes = 1;
				int wk = i;
				for (int j = 0; j < numN; j++) {
					if (j % 2 == 0) {
						continue;
					}
					if (i % j == 0) {
						wkRes++;
					}
				}
				if (wkRes == 8) {
					count++;
				}
			}

			System.out.println(count);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		String wkS;
		long count = 0;

		try {
			scanner = new Scanner(System.in);
			wkS = scanner.next();
			count = scanner.nextLong();
			String wk = wkS;
			if (count <= wkS.length()) {
				wk = wkS.substring(0, (int) count);
			}
			for (int i = 0; i < wk.length(); i++) {
				if (wk.charAt(i) != '1') {
					System.out.println(wk.charAt(i));
					return;
				}
			}
			System.out.println(1);
		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#include <malloc.h>
#include <cstdlib>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tr_policy.hpp>
//using namespace __gnu_pbds;

#define int				long long
#define double			long double
#define pb 				push_back
#define endl 			'\n'
#define F				first
#define S				second
#define mod				(int)1000000007
#define mp              make_pair
#define ios 			ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inf				1e18
#define mem(a,x)		for(int i=0;i<(int)(sizeof(a)/sizeof(a[0]));i++) a[i] = x;
#define trace(a)		cout<<(#a)<<" --> "<<a<<endl
#define trace2(a,b)		{trace(a);trace(b);cout<<"------------------\n";}
#define trace3(a,b,c)	{trace(a);trace(b);trace(c);cout<<"------------------\n";}
#define trace4(a,b,c,d) {trace(a);trace(b);trace(c);trace(d);cout<<"------------------\n";}
#define M_PI           	3.14159265358979323846
#define T				pair<int,int>
//#define ordered_set 	tr<T, null_type,less<T>, rb_tr_tag,tr_order_statistics_node_update>



void run(){
	char c;
	cin>>c;
	cout<<(char)(c+1);
}

signed main(){
	ios;
//	int t;
//	cin>>t;
//	for(int i=1;i<=t;i++)
//		cout<<"Case #"<<i<<": ", run();
		run();
	return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define FOR(i, a)           for (auto &i : a)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define Endl                endl

using namespace std;
const int MOD   = (int)(1e9 + 7);
const int INF   = (int)(1e13 + 7);
const double PI = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int x, int y) {                                                             //return x^y in order(log(y))
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
struct trio {
  T first{};
  T second{};
  T third{};
};
template <class T>
void cumulative_sum(T &container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}
int factorial(int n) {
  int ret = 1;
  for (int i = 2; i <= n; i++) ret *= i;
  return ret;
}

class DXorSum2 {
public:
  static void solve(istream &cin, ostream &cout) {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    vector<int> ans(N, 0);
    int now = A[0];
    int R   = 0;
    int L   = 0;
    while (!(R == N - 1 and L == N - 1)) {
      ans[L] = max(ans[L], R);
      if (R == N - 1) {
        break;
      }
      rep(i, 20) {
        if ((now >> i) & (A[R + 1] >> i)) {
          if (R == L) {
            R++;
            L++;
            now = A[R];
            break;
          } else {
            rep(j, 20) {
              if ((now >> j) & 1 and (A[L] >> j) & 1) {
                now -= bpm(2, j);
              }
            }
            L++;
            break;
          }
        } else if (i == 19) {
          R++;
          rep(j, 20) {
            if ((A[R] >> j) & 1 == 1) {
              now += bpm(2, j);
            }
          }
          break;
        }
      }
    }
    int sum = 0;
    int k   = ans[0];
    rep(i, N) {
      k = max(k, i);
      k = max(k, ans[i]);
      sum += (k - i + 1);
    }
    cout << sum << endl;
  }
};


signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  DXorSum2 solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
#define chmax(x, a)  do { x = max(x, a); } while(0)
#define chmin(x, a)  do { x = min(x, a); } while(0)

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll,ll> PLL;

ll N, ans;
vector<ll> v;
ll dp[3000][3000];
const ll WILD_CARD = 2500;
const ll SENTINEL = 2600;

struct T {
  ll x, y, val;
  T(ll x, ll y, ll val): x(x), y(y), val(val) {}
};

void update(ll x, ll y, ll val) {
  chmax(dp[x][y], val);
  chmax(dp[y][x], val);
  chmax(dp[x][WILD_CARD], val);
  chmax(dp[y][WILD_CARD], val);
  chmax(dp[WILD_CARD][x], val);
  chmax(dp[WILD_CARD][y], val);
  chmax(dp[WILD_CARD][WILD_CARD], val);
}

void solve() {
  cin >> N;
  v.resize(3*N);
  rep(i, 3*N)
    cin >> v[i], v[i]--;
  v.push_back(SENTINEL + 1);
  v.push_back(SENTINEL + 2);
  rep(i, 3000) rep(j, 3000) dp[i][j] = -(1e18);
  update(v[0], v[1], 0);

  for (ll i = 2; i < 3 * N; i+=3) {
    vector<T> upd;
    // A
    if (v[i] == v[i+1] && v[i+1] == v[i+2]) {
      ans++;
      continue;
    }
    vector<ll> w = {v[i], v[i+1], v[i+2]};
    sort(begin(w),end(w));
    do {
      ll a = w[0], b = w[1], c = w[2];
      // printf("a = %lld b = %lld c = %lld\n", a, b, c);
      // B
      if (a == b) {
        rep(y, N) {
          upd.emplace_back(c, y, dp[a][y]+1);
        }
      }
      // C
      upd.emplace_back(b, c, dp[a][a]+1);
      // D
      ;
      // E
      rep(x, N)
        upd.emplace_back(x, a, dp[x][WILD_CARD]);
      // F
      upd.emplace_back(a, b, dp[WILD_CARD][WILD_CARD]);
    } while (next_permutation(begin(w), end(w)));

    for (auto [x, y, val] : upd) {
      update(x, y, val);
    }
  }

  ans += dp[WILD_CARD][WILD_CARD];
  cout << ans << endl;
}

int main() {
  //ll T;
  //cin >> T;
  //rep(_,T)
    solve();
  return 0;
}


Measured memory_bytes: 74244
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc174/abc174_c.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int K;
  cin >> K;
  ll ans = 0;

  int first = K % 10;
  if (first % 2 == 0 || first == 5) {
    cout << -1 << endl;
    return 0;
  }

  ll sevens = 0;
  repi(i, 1, K + 1) {
    sevens *= 10;
    sevens += 7;
    sevens %= K;
    if (sevens == 0) {
      cout << i << endl;
      return 0;
    };
  }

  cout << -1 << endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  //鏡餅の直径を小さい順にした
  
  int ans = 0;
  int top = 0;

  for(int i=0; i<n; i++){
    if(top < a.at(i)){
      ans++;
      top = a.at(i);
    }
  }
  
  cout <<ans <<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <bitset>

using namespace std;
using ll=long long;

#define REP(i, n)  for(int i = 0; i < (int)n; ++i)
#define REP1(i, n)  for(int i = 1; i <= (int)n; ++i)
#define REPT(i, t, n)  for(int i = t; i <= (int)n; ++i)
#define REPll1(i, n)  for(ll i = 1; i*i < (int)n; ++i)

int cnt(ll n) {
    int c = 0;
    while (true) {
        if (n < 1)break;
        n = n / 10;
        c++;
    }
    return c;
}

string zeroPadding(ll n) {
    string s = to_string(n);
    while (s.length() < 6) {
        s = "0" + s;
    }
    return s;
}

const char alphabet[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'};
const ll mod = 1e9 + 7;

int main() {
    int N = 0, M, K, O, a = 0, b = 0;
    ll x, y, sum, pos = 0, c = 0;
    string k, v;
    bool flag = true;
    cin >> k;
    sum = 0;
    for (int bit = 0; bit < (1 << k.length() - 1); ++bit) {
        //cout << bitset<10>(bit) << endl;
        ll s = 0, t = 0;
        if (bitset<1>(bit) == 0)t = k[0] - '0';
        else s = k[0] - '0';

        REP(i, k.length() - 1) {
            if (bit & (1 << i)) {
                if (t != 0) {
                    s += t;
                    t = k[i + 1] - '0';
                } else t = k[i + 1] - '0';
            } else {
                t = t * 10 + k[i + 1] - '0';
            }
          //  cout << s << " " << t << endl;
        }
        sum += s + t;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)

using namespace std;
using ll=long long;


int main() {
  ll n,k;cin >> n>> k;
  vector<ll> hs(n);
  rep(i,n)cin >> hs.at(i);
  sort(ALL(hs));
  ll ans = 0;
  if(n>k){
    rep(i,n-k){
      ans+=hs.at(i);
    }
  }
  cout << ans;
}

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

#define int             long long
#define INF             1e18
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)

const int MOD = 1e9 + 7;





int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int n;
	cin >> n;
	int a[4] = {0};
	vector<string> v = {"AC", "WA", "TLE", "RE"};
	while (n--)
	{
		string s;
		cin >> s;
		if (s == "AC")
			a[0]++;
		else if (s == "WA")
			a[1]++;
		else if (s == "TLE")
			a[2]++;
		else a[3]++;
	}
	for (int i = 0; i < 4; i++)
		cout << v[i] << " x " << a[i] << endl;



	return 0;
}

Measured memory_bytes: 3664
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){

			String S = scan.next();
			char[]s = S.toCharArray();
			long K = scan.nextLong();

			ArrayList<Character>chara = new ArrayList<Character>();
			ArrayList<Integer>inte = new ArrayList<Integer>();

			Runlength(S,chara,inte);


			/*
			for(Character c:chara) {
				System.out.println(c);
			}

			for(Integer i:inte) {
				System.out.println(i);
			}
			*/




			if(chara.size()==1) {
				System.out.println((K*(long)(inte.get(0)))/2);
			}else{
				char f = chara.get(0);
				char l = chara.get(chara.size()-1);
				long goukei = 0;
				if(f==l) {
					long F = (long)(inte.get(0)/2);
					long L = (long)(inte.get(inte.size()-1)/2);
					goukei+=F;
					goukei+=L;
					goukei+=(K-1)*(long)((inte.get(0)+inte.get(inte.size()-1))/2);
					long p = 0;
					for(int i = 1;i<inte.size()-1;i++) {
						p+=(long)(inte.get(i)/2);
					}

					p+=(K-1)*p;
					goukei+=p;

					System.out.println(goukei);




				}else {

					for(Integer i:inte) {
						goukei+=(long)(i/2);
					}
					goukei+=(K-1)*goukei;
					System.out.print(goukei);

				}

			}








		}


	}

	//ランレングス圧縮　
	//必ず２個配列用意するように。
	/*
	 * (例)
	 * ArrayList<Character>chara = new ArrayList<Character>();
	 * ArrayList<Integer>inte = new ArrayList<Integer>();
	 *
	 * */


	private static void Runlength(String S,ArrayList<Character> chara,ArrayList<Integer>inte) {


		char[]s = S.toCharArray();
		char mem =s[0];
		int count = 0;
		for(int i = 0;i<s.length;i++) {
			if(s[i]==mem) {
				count++;
				if(i==s.length-1) {
					chara.add(s[i]);
					inte.add(count);
				}
			}else if(s[i]!=mem) {
				chara.add(s[i-1]);
				inte.add(count);
				mem=s[i];
				count = 1;
				if(i==s.length-1) {
					chara.add(s[i]);
					inte.add(count);
				}
			}
		}


	}




}


Measured memory_bytes: 35592
program test
implicit none

integer :: h=0,w=0,a(500,500)=0,i=0,j=0,k=0,count=0,ans(250000,4)=0,even=0

read(*,*) h,w
do i=1,h
	read(*,*) (a(i,j),j=1,w)
enddo

do i=1,h
	if(mod(i,2)==1)then
		do j=1,w-1
			if((mod(a(i,j),2)) == 1) then
				count = count + 1
				a(i,j) = a(i,j) - 1
				a(i,j+1) = a(i,j+1) + 1
				ans(count,1) = i
				ans(count,2) = j
				ans(count,3) = i
				ans(count,4) = j+1
			endif
		enddo
		if(i<h .and. mod(a(i,w),2) == 1)then
			count = count + 1
			a(i,w) = a(i,w) - 1
			a(i+1,w) = a(i+1,w) + 1
			ans(count,1) = i
			ans(count,2) = w
			ans(count,3) = i+1
			ans(count,4) = w
		endif
	else
		do j=w,2,-1
			if((mod(a(i,j),2)) == 1)then
				count = count + 1
				a(i,j) = a(i,j) - 1
				a(i,j-1) = a(i,j-1) + 1
				ans(count,1) = i
				ans(count,2) = j
				ans(count,3) = i
				ans(count,4) = j-1
			endif
		enddo
		if(i<h .and. mod(a(i,1),2) == 1)then
			count = count + 1
			a(i,1) = a(i,1) - 1
			a(i+1,1) = a(i+1,1) + 1
			ans(count,1) = i
			ans(count,2) = 1
			ans(count,3) = i+1
			ans(count,4) = 1
		endif
	endif
enddo

write(*,*) count
do i=1,count
	write(*,*) (ans(i,j),j=1,4)
enddo

end program

Measured memory_bytes: 10112
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int a,b,x;

int main(){
	cin>>a>>b>>x;
	if(a<=x&&x<=a+b) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a,b;
  cin>>a>>b;
   int f=10*b;
   int s=10*(b+1);
   int ans=-1;
   for(int i=f;i<s;i++)
   {
      if((i*8)/100 == a)
      {
         ans=i;
         break;
      }
   }
   cout<<ans<<endl;
   
}

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

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


Measured memory_bytes: 256
#include<stdio.h>
using namespace std;
int main() {
	int s[4],flag=0;
	scanf("%1d%1d%1d%1d",&s[0],&s[1],&s[2],&s[3]);
	if((s[0]==s[1] && s[1]==s[2]) || (s[1]==s[2] && s[2]==s[3])) flag=1;
	printf("%s\n",flag?"Yes":"No");
	return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  string S;
  cin >> S;
  vector<int> pos;
  char cur = 'a';
  for (int i = 0; i < N; i++) {
    if (cur != S[i]) {
      cur = S[i];
      pos.emplace_back(i);
    }
  }
  pos.emplace_back(N);
  cur = S[0];
  for (int i = 1; i < (int)pos.size() - 1 && K > 0; i += 2) {
    for (int j = pos[i]; j < pos[i + 1]; j++) {
      S[j] = cur;
    }
    K--;
  }
  int res = 0;
  for (int i = 0; i < N - 1; i++) {
    if (S[i] == S[i + 1]) res++;
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 972
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            double pi = 3.141592653589;
            string input = Console.ReadLine();
            string[] array = input.Split(' ');

            double r = double.Parse(array[0]);

            double area = r * r * pi;
            double zhou = 2 * pi * r;


            
            Console.WriteLine(string.Format("{0} {1}",area, zhou));  
        }
    }
}

Measured memory_bytes: 9360
#include<bits/stdc++.h>
using namespace std;
set<int> s;
main()
{
    int n;scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int x;scanf("%d",&x);
        if(s.find(x)!=s.end())s.erase(x);
        else s.insert(x);
    }
    printf("%d\n",s.size());
    return 0;
}



Measured memory_bytes: 4864
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7

ans = 0
for i in range(60):
    one = 0
    for a in A:
        if (a & (1 << i) != 0):
            one += 1
    zero = N - one
    now = one * zero % mod
    ans += now * pow(2, i) % mod
    ans %= mod
print(ans)


Measured memory_bytes: 118504
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a[200001];
int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	int flag=1;
	int cnt=0;
	for(int i=1;i<n;i++){
		if(a[i]<a[i-1]){
			if(flag==2){
				cnt++;
				flag=1;
			}else flag=0;
		}
		if(a[i]>a[i-1]){
			if(flag==0){
				cnt++;
				flag=1;
			}else flag=2;
		}
	}
	printf("%d\n",cnt+1);
	return 0;
}


Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
#define vv(a,b,c,d) vector<vector<a> >(b,vector<a>(c,d))
#define vvv(a,b,c,d,e) vector<vector<vector<a> > >(b,vv(a,c,d,e))
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

ll N, C;
vll X, V;

ll f(vll x, vll v) {
    ll re = 0;
    
    multiset<ll> T;
    T.insert(0ll);

    vll S(N);
    ll p = 0;
    for (int i = N - 1; i >= 0; --i) {
        p += v[i];
        S[i] = p - (C - x[i]);
        T.insert(S[i]);
    }

    ll q = 0;
    rep(i, N) {
        q += v[i];
        smax(re, q - x[i]);
        T.erase(T.find(S[i]));

        smax(re, q - x[i] * 2 + *T.rbegin());
    }

    return re;
}

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

    while (cin >> N >> C) {
        X = V = vll(N);
        rep(i, N)cin >> X[i] >> V[i];
        vll Y(N), W(N);

        rep(i, N) {
            Y[i] = C - X[N - 1 - i];
            W[i] = V[N - 1 - i];
        }

        ll ans = f(X, V);
        smax(ans, f(Y, W));
        cout << ans << endl;
    }
}

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

int main(void){
  int n, a, b, c, d;
  cin >> n;
  d = n % 10;
  n /= 10;
  c = n % 10;
  n /= 10;
  b = n % 10;
  n /= 10;
  a = n % 10;
  if(a + b + c + d == 7){
    cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
    return 0;
  }
  if(a + b + c - d == 7){
    cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
    return 0;
  }
  if(a + b - c + d == 7){
    cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
    return 0;
  }
  if(a + b - c - d == 7){
    cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
    return 0;
  }
  if(a - b + c + d == 7){
    cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
    return 0;
  }
  if(a - b + c - d == 7){
    cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
    return 0;
  }
  if(a - b - c + d == 7){
    cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
    return 0;
  }
  if(a - b - c - d == 7){
    cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
    return 0;
  }
  return 0;
}


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

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

using namespace std;

typedef long long ll;

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

  int n; cin >> n;
  vector<int> p(n);

  rep(i, n) { cin >> p[i]; }

  int ans = 0;

  // greedy
  rep(i, n) {
    if (p[i] == i+1) {
      int tmp = p[i];
      p[i] = p[i+1];
      p[i+1] = tmp;
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

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

int main() {
	int n;
	long long gcd, num;
	cin >> n;
	vector<int> a(n), left(n), right(n);
	for(int i = 0; i < n; ++i){
		cin >> a[i];
		if(!i) left[i] = a[i];
		else left[i] = __gcd(a[i], left[i - 1]);
	}
	for(int i = n - 1; i >= 0; --i){
		if(i == n - 1) right[i] = a[i];
		else right[i] = __gcd(a[i], right[i + 1]);
	}
	
	int best = max(right[1], left[n - 2]);
	for(int i = 1; i < n - 1; ++i){
		int uwu = __gcd(right[i + 1], left[i - 1]);
		best = max(uwu, best);
	}
	cout << best;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <iomanip>
#include <climits>
#include <string>
#include <sstream>
#include <numeric>
#include <stack>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
int check(char c1, char c2) {
	return c1 == '?' || c2 == '?' || c1 == c2;
}
signed main() {
	string a, b, c;
	cin >> a >> b >> c;
	N = a.size();
	M = b.size();
	K = c.size();
	int ans = LINF;
	vector< int > ab(10000, 1), ac(10000, 1), bc(10000, 1);
	rep(i, N) rep(j, M) if (!check(a[i], b[j])) ab[i - j + 5000] = 0;
	rep(i, N) rep(j, K) if (!check(a[i], c[j])) ac[i - j + 5000] = 0;
	rep(i, M) rep(j, K) if (!check(b[i], c[j])) bc[i - j + 5000] = 0;
	for (int i = -4000; i <= 4000; i++)
		for (int j = -4000; j <= 4000; j++) {
			if (ab[i + 5000] && ac[j + 5000] && bc[j - i + 5000]) {
				int l = min(0LL, min(i, j));
				int r = max(N, max(i + M, j + K));
				chmin(ans, r - l);
			}
		}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
n = int(input())
bubble=list(map(int,input().split()))
count = 0
for i in  range(len(bubble)):
    for a in range(len(bubble)-1):
        if (bubble[a] > bubble[a+1]):
            bubble[a], bubble[a+1] = bubble[a+1], bubble[a]
            count = count+1
print(*bubble)
print(count)


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

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

  int ans = 0;

  for (int i = 1; i < N; i++) {
    string X = S.substr(0, i);
    string Y = S.substr(i);
    int cnt = 0;
    for (char c = 'a'; c <= 'z'; c++) {
      if ((int)X.find(c) > -1 && (int)Y.find(c) > -1) cnt++;
    }
    ans = max(ans, cnt);
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define Decimal fixed << setprecision(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}
constexpr int INF = 1100000000;
constexpr long long LLINF = 1100000000000000000LL;
constexpr long long MOD = 1000000007;

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

//法
#define MOD 1000000007

//ａをbで割る
long long mod_div(long long a,long long b){
  if(a % b == 0)return a/b;
  long long tmp = MOD - 2,c = b,ret = 1;
  while(tmp > 0){
    if(tmp & 1){
      ret *= c;ret %= MOD;
    }
    c *= c;c %= MOD;tmp >>= 1;
  }
  return a*ret%MOD;
}

//階乗の上限
#define MAX_K 333333
vector<long long> kaijo(MAX_K);
long long combination(long long n, long long r){
  if(n < r || n < 0 || r < 0)
    return 0;
  if(kaijo[0] != 1){
    kaijo[0] = 1;
    for(long long i = 1;i < MAX_K;i++) {
      kaijo[i] = (kaijo[i-1] * i) % MOD;
    }
  }
  long long ret = kaijo[n];
  long long tmp = (kaijo[r] * kaijo[n-r]) % MOD;
  return mod_div(ret,tmp);
}
int main()
{
  ll N, K;
  cin >> N >> K;
  for (int i = 1; i <= K; i++) {
    ll ans = combination(N - K + 1, i);
    (ans *= combination(K - 1, i-1)) %= MOD;
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 2816
#include <stdio.h>

int main(void)
{
    long int num, a, b, set, total;

    scanf("%ld %ld %ld", &num, &a, &b);
    
    set = num / (a+b);
    if (num % (a+b) <= a)
    total = set * a + num % (a+b);
    else
    total = set * a + a;
    
    printf("%ld", total);

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
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)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;
#define pai 3.141592653589793238462643383279




int main(){
  int N; cin >> N; int a[N];
  rep(i, N){
    cin >> a[i];
  }
  sort(a, a+N); bool check[1010100] = {}; int ans = 0;
  rep(i, N){
    if(check[a[i]]){
      ans++; continue;
    }
    for(int j=a[i]; j<=1000000; j+=a[i]){
      check[j] = true;
    }
    if(a[i]==a[i+1] && i<=N-2) ans++;
  }
  cout << N-ans << endl;
}
    

Measured memory_bytes: 5360
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int N;
int main() {
  ios::sync_with_stdio(false);
  set<int> st;
  cin >> N;
  for(int i = 0; i < N; ++i) {
    int c;
    cin >> c;
    st.insert(c);
  }
  cout << st.size();
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sca = new Scanner(System.in);
		String src = sca.next();
		if(src.equals("ABC")) {
			System.out.println("ARC");
		}
		else if(src.equals("ARC")) {
			System.out.println("ABC");
		}

		// 後始末
		sca.close();
	}
}

Measured memory_bytes: 35592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
ll mod=998244353;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b,c,x,y,z;
    cin>>a>>b>>c;
    int cnt=0;
    int tc=10000000;
    //cout<<(a&1)<<endl;
    while ((a&1)==0 && (b&1)==0 && (c&1)==0 && tc--)
    {
        //cout<<"bal"<<endl;
        cnt++;
        x=(b+c)/2;
        y=(a+c)/2;
        z=(a+b)/2;
        a=x;
        b=y;
        c=z;
        //cout<<a<<' '<<b<<' '<<c<<endl;
    }
    if ((a&1)==0 && (b&1)==0 && (c&1)==0)
    cout<<-1<<endl;
    else
        cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int[] t = new int[N + 1];
    int[] v = new int[N + 2];

    for (int i = 0; i < N; i++) t[i + 1] = scanner.nextInt() * 2 + t[i];
    for (int i = 0; i < N; i++) v[i + 1] = scanner.nextInt() * 2;

    long dist = 0;
    long cv = 0;
    for (int i = 1; i <= N; i++) {
      for (int j = t[i - 1] + 1; j <= t[i]; j++) {
        long f = v[i];
        for (int k = 0; k < i; k++) f = Math.min(f, v[k] + j - t[k]);
        for (int k = i + 1; k <= N + 1; k++) f = Math.min(f, v[k] + t[k - 1] - j);
        dist += cv + f;
        cv = f;
      }
    }

    System.out.println(dist / 8.d);
  }
}


Measured memory_bytes: 24020
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#define INF 1000000000
#define MOD 1000000007

using namespace std;

int main()
{
    int maxv, minv;

    int n;
    int a;

    cin >> n;
    cin >> a;
    maxv = minv = a;

    for (int i = 1; i < n; i++) {
        cin >> a;

        maxv = max(maxv, a);
        minv = min(minv, a);
    }

    cout << maxv - minv << endl;

    return 0;
}


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

using namespace std;

int main(){
   int n,m;
   cin>>n>>m;
   cout<<(n-1)*(m-1)<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
		int min;
		int max;
		double sum = 0;

		int num;
		int i;
		int value;

		scanf("%d",&num);

		for(i = 0; i < num; i++){
				scanf("%d",&value);
				sum += value;
				if(i==0){
						min = value;
						max = value;
				}else if(value < min){
						min = value;
				}

				if(value > max){
						max = value;
				}
		}

		printf("%d %d %.0f\n",min,max,sum);
		return 0;
}


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

long long arr[4],mx;

int main(){
	mx = LLONG_MIN;
	for(int i = 0; i < 4; i++){
		cin >> arr[i];
	}
	for(int i = 0; i < 2; i++){
		for(int j = 2; j < 4; j++){
			mx = max(arr[i]*arr[j],mx);
		}
	}
	cout << mx << '\n';
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x) x.begin(), x.end()
#define rep(i, s, n)      for(int i(s); i < int(n); ++i)
#define endl '\n'
#ifndef YDK
#define eprintf(...)
#endif
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr const int INF  = 0x3f3f3f3f;
constexpr const i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr const int MOD  = int(1e9) + 7;
// }}}

// Library {{{
// }}}

vector<int> G[200010];
int dist[200010];

signed main()
{
    int N, M;
    cin >> N >> M;

    rep(i, 0, M) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    memset(dist, INF, sizeof(dist));

    queue<int> que;
    que.emplace(1);
    dist[1] = 0;
    while(que.size()) {
        int u = que.front(); que.pop();
        for(int nxt : G[u]) {
            int nc = dist[u] + 1;
            if (chmin(dist[nxt], nc)) {
                que.emplace(nxt);
            }
        }
    }

    cout << (dist[N] <= 2 ? "POSSIBLE" : "IMPOSSIBLE") << endl;

    return 0;
}


Measured memory_bytes: 13168
x = int(input())

def check(n):
    m = int(n**0.2)
    if abs(m**5 - n) < 1e-6:
        return True
    else:
        return False

for i in range(10**7):
    y = abs(x-i**5)
    if check(y):
        if x-i**5>0:
            print(i, int(y**0.2)*(-1))
        else:
            print(i, int(y**0.2))
        exit()

Measured memory_bytes: 62368
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    int x,a,b;
    cin >>x >> a >> b;
    if (abs(x-a)>abs(x-b)){
      cout << "B";
    }else{
      cout << "A";
    }
    return 0;
}


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

using namespace std;

typedef long long int64;

int main()
{
  int64 N;
  cin >> N;
  for(int64 i = 1; i <= 3500; i++) {
    for(int64 j = 1; j <= 3500; j++) {
      if(N * i + N * j - 4 * i * j != 0 && N * i * j != 0) {
        if(N * i * j % (N * i + N * j - 4 * i * j) == 0) {
          int64 k = -N * i * j / (N * i + N * j - 4 * i * j);
          if(k > 0) {
            cout << i << " " << j << " " << k << endl;
            return (0);
          }

        }
      }
    }
  }
}

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

ans = [0, 4, 7, 8, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
    28, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36, 36, 37, 38, 39, 39, 40, 40, 41,
    42, 42, 43, 43, 44, 44, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51,
    52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60,
    60, 61, 61, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 66, 66, 67, 67, 67, 68,
    68, 68, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 74, 74, 74, 75,
    75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81,
    81, 82, 82, 82, 83, 83, 83, 84, 84, 84, 84, 85, 85, 85, 86, 86, 86, 87, 87,
    87, 88, 88, 88, 88, 89, 89, 89, 90, 90, 90, 91, 91, 91, 91, 92, 92, 92, 92,
    93, 93, 93, 94, 94, 94, 95, 95, 95, 95, 96, 96, 96, 96, 97, 97, 97, 98, 98,
    98, 98, 99, 99, 99, 99, 100, 100, 100, 100, 101, 101, 101, 102, 102, 102,
    102, 103, 103, 103, 103, 104, 104, 104, 105, 105, 105, 106, 106, 106, 106,
    107, 107, 107, 107, 108, 108, 108, 109, 109, 109, 110, 110, 110, 110, 111,
    111, 111, 112, 112, 112, 113, 113, 113, 114, 114, 114, 114, 115, 115, 115,
    116, 116, 116, 117, 117, 117, 118, 118, 118, 119, 119, 119, 120, 120, 120,
    121, 121, 121, 122, 122, 122, 123, 123, 123, 124, 124, 124, 125, 125, 126,
    126, 126, 127, 127, 127, 128, 128, 128, 129, 129, 130, 130, 130, 131, 131,
    131, 132, 132, 133, 133, 134, 134, 134, 135, 135, 135, 136, 136, 137, 137,
    138, 138, 138, 139, 139, 140, 140, 141, 141, 142, 142, 142, 143, 143, 144,
    144, 145, 145, 146, 146, 147, 147, 148, 148, 149, 149, 150, 150, 151, 151,
    152, 152, 153, 154, 154, 155, 155, 156, 156, 157, 158, 158, 159, 159, 160,
    161, 162, 162, 163, 163, 164, 165, 166, 166, 167, 168, 169, 170, 170, 171,
    172, 173, 174, 175, 176, 177, 178, 179, 180, 182, 183, 184, 186, 187, 190,
    191, 194, 198]

if N in ans:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3320
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main (void)
{
    int n;
    scanf("%d",&n);
    int a;
    scanf("%d",&a);
    int c;
    c=n*n;
    c=c-a;
    printf("%d\n",c);
    return 0;
}

Measured memory_bytes: 256