akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>

long long m[1000005]={0};
int main() 
{
	long long x,i,j,s,d,b,a,max;
	double q,e,p;
	scanf("%lld%lld%lld",&a,&b,&x);
	i=(b-1)>x?x:(b-1);
		q= (double)(a*i) / b;
		j=q;
		
 
    
	 printf("%lld",j);
    return 0;
}








Measured memory_bytes: 1724
#include<bits/stdc++.h>							
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;
const ll maxsize = 100000009;


ll ans = maxn;
ll d(ll n) {
	for(ll i = sqrt(n); i >= 1; --i) {
		if(n % i == 0) {
			ans  = n / i + i;
			ans -= 2; 
			return ans;
			}
		}
}

void solve() {
	ll n;
	cin >> n;
	cout << d(n) << endl;
}


int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(35);
	solve();
	return 0;
}
 
 
 



Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  std::string S; std::cin >> S;

  int ans = 0;
  rep(i,sz(S)/2) {
    if ( S[sz(S)-1-i] != S[i] ) ans++;
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
#![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 gcd(a: i64, b: i64) -> i64 { if b == 0 { a } else { gcd(b, a % b) } }
fn lcm(a:i64,b:i64)->i64{a/gcd(a,b)*b}

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let ts: Vec<i64> = sc.vec(n);
    put!(ts[1..].iter().fold(ts[0], |a, &b| lcm(a,b)));
}

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()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 4352
package main

import "fmt"

func main() {
	var (
		minMod int
		result int
	)
	var a int
	for i := 0; i < 5; i++ {
		fmt.Scan(&a)
		mod := a % 10
		if minMod == 0 {
			minMod = mod
		}
		if mod != 0 && mod < minMod {
			minMod = mod
		}
		if mod != 0 {
			result += (a/10 + 1) * 10
		} else {
			result += a
		}
	}
	if minMod != 0 {
		result -= 10
	}
	fmt.Println(result + minMod)
}


Measured memory_bytes: 512
package main

import (
    "bufio"
    "fmt"
    "os"
)

var r = bufio.NewReader(os.Stdin)

func main() {
    var a, b int
    fmt.Fscan(r, &a)
    fmt.Fscan(r, &b)
    x := a * b
    y := (a + b) * 2
    fmt.Println(x, y)
}


Measured memory_bytes: 1136
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		List<Integer> a = new LinkedList<>();
		List<Integer> b = new LinkedList<>();
		List<String> op = new LinkedList<>();
		int n, m;
		String s;

		while(true){
			n = sc.nextInt();
			s = sc.next();
			m = sc.nextInt();
			if(s.equals("?")){
				break;
			}
			a.add(n);
			b.add(m);
			op.add(s);
		}
		for(int i = 0;i < op.size(); i++){
			switch(op.get(i)){
				case "+":
					System.out.println(a.get(i) + b.get(i));
					break;
				case "-":
					System.out.println(a.get(i) - b.get(i));
					break;
				case "/":
					System.out.println(a.get(i) / b.get(i));
					break;
				case "*":
					System.out.println(a.get(i) * b.get(i));
					break;
				default:
			}
		}
	}
}



Measured memory_bytes: 26148
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<cmath>
using namespace std;
const int inf = static_cast<int>(pow(10,9)); 
int main()
{
	string s;
	cin >> s;
	auto ans = inf;
	for(int _min=0;_min < s.size()-2;_min++){
	    ans = min(ans,abs(stoi(s.substr(_min,3))-753));
	}	
	cout << ans;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n)cin >> a[i];
    const ll mod = 1e9+7;
    ll cnt[60] = {};
    rep(i,n){
        rep(j,60)if(a[i] >> j & 1)cnt[j]++;
    }
    ll ans = 0;
    rep(i,60){
        ans = (ans + cnt[i] * (n - cnt[i]) % mod * ((1LL << i) % mod) % mod) % mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
const int N = 3003;
#define next omega

int dp[N][N];
bool vis[N][N];
int next[N][N];
string a , b;
string w;

int solve(int i , int j){
	if(i == 0 || j == 0){
		return 0;
	}
	if(vis[i][j]) return dp[i][j];
	vis[i][j] = true;
	dp[i][j] = 0;
	if(solve(i- 1 , j ) > dp[i][j]){
		dp[i][j] = solve(i-1 , j);
		next[i][j] = 1;
	}
	if(solve(i, j-1) > dp[i][j]){
		dp[i][j] = solve(i,j-1);
		next[i][j] = 2;
	}
	if(a[i-1] == b[j-1] && (solve(i-1,j-1) + 1) > dp[i][j]){
		dp[i][j] = 1 + solve(i-1,j-1);
		next[i][j] = 3;
	}
	return dp[i][j];
}	

void recover(int i , int j){
	if(i == 0 || j == 0){
		return;
	}
	if(next[i][j] == 1) recover(i-1,j);
	if(next[i][j] == 2) recover(i, j-1);
	if(next[i][j] == 3){
		w += a[i-1];
		recover(i-1,j-1);
	}
}


int32_t main(){
	cin>>a>>b;
	solve(a.size() , b.size());
	recover(a.size() , b.size());
	reverse(w.begin() , w.end());
	cout<<w;
}

Measured memory_bytes: 79872
#if 0
set???????????´?????\??£???????????§??????????????????????´????????????????set?????¨????????????
#endif

#include <string>
#include <set>
#include <iostream>
#include <algorithm>
using namespace std;

int main(){
	int n;
	string t, t1, t2, r1, r2; //??\???(??????),????????????,????????????,???????????¢,???????????¢
	typedef set<string> SET; //????????´?????\??£???????????§??????????????????????´?
	cin>>n;
	for(int k=0;k<n;++k){
		cin>>t;
		SET T;
		for(int i=0;i<t.length();++i){
				t1="";
				t2="";
			for(int j=0;j<=i;++j){ //??????????????????
				t1+=t[j];
			}
			for(int j=0;j<t.length()-1-i;j++){
				t2+=t[t.length()-1-j]; //??????
			}
			r1=t1;
			reverse(r1.begin(),r1.end()); //?????¢
			r2=t2;
			reverse(r2.begin(),r2.end()); //?????¢
			T.insert(t1+t2);
			T.insert(t2+t1);
			T.insert(t1+r2);
			T.insert(r2+t1);
			T.insert(t2+r1);
			T.insert(r1+t2);
			T.insert(r1+r2);
			T.insert(r2+r1);
			}
		cout << T.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 3092
a,b,c,x,y = map(int,input().split())
ans = 0
while x and y:
    if a+b>2*c:
        ans += 2*c
    else:
        ans += a+b
    x-=1
    y-=1
while x:
    if a > 2*c:
        ans += 2*c
    else:
        ans += a
    x-=1
while y:
    if b > 2*c:
        ans += 2*c
    else:
        ans += b
    y-=1
print(ans)

Measured memory_bytes: 9204
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	private	static	BufferedReader	br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String	strIn = null;
		double	in    = 0.0;
		double	max   = Double.MIN_VALUE;
		double	min   = Double.MAX_VALUE;
		boolean	bflag = false;

		while ((strIn = parseStdin()) != null) {
			in    = Double.parseDouble(strIn);
			max   = Math.max(max, in);
			min   = Math.min(min, in);
			bflag = true;
		}

		if (bflag) {
			System.out.println(max - min);
		}
	}

	private static String parseStdin() {
		String	strNum = null;

		try {
			String line = br.readLine();
			if (line != null) {
				if (!line.isEmpty()) {
					strNum = line;
				}
			}
		}
		catch (IOException e) {}

		return strNum;
	}
}

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

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;

const ll INF = 2e11;
const int MOD = 1e9 + 7;
const int MAXN = 5e5 + 5;

int N, P[505 * 505], A[505][505];
int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
bool chk[505][505];

void f(int x, int y) {
	for(int i=0; i<4; i++) {
		int nx = x + dx[i], ny = y + dy[i];
		if(A[nx][ny] > A[x][y]) {
			if(!chk[x][y] && !chk[nx][ny]) {
				if(A[nx][ny] > A[x][y] + 1) {
					A[nx][ny] = A[x][y] + 1;
					f(nx, ny);
				}
			}
			if(!chk[x][y] && chk[nx][ny]) {
				A[nx][ny] = A[x][y];
				f(nx, ny);
			}
			if(chk[x][y] && !chk[nx][ny]) {
				if(A[nx][ny] > A[x][y] + 1) {
					A[nx][ny] = A[x][y] + 1;
					f(nx, ny);
				}
			}
			if(chk[x][y] && chk[nx][ny]) {
				A[nx][ny] = A[x][y];
				f(nx, ny);
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> N;
	for(int i=1; i<=N*N; i++) cin >> P[i];
	for(int i=1; i<=N; i++) for(int j=1; j<=N; j++) A[i][j] = min({i-1, j-1, N-i, N-j}) + 1;
	ll ans = 0;
	for(int i=1; i<=N*N; i++) {
		int x = (P[i]-1)/N+1, y = (P[i]-1)%N+1;
		ans += --A[x][y]; chk[x][y] = 1;
		f(x, y);
	}
	cout << ans;
}

Measured memory_bytes: 36788
#include<iostream>
using namespace std;
int main()
{
    int a,b,n=1,m;
    cin>>a>>b;
    while(a>0)
    {
        n*=100;
        a--;
    }
    if(a==0)
    {
        if(b==100)
            b++;

    }
    cout<<b*n<<endl;
    return 0;
}


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

#define X first
#define Y second
#define pb push_back

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    int c[3][3];
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
            cin >> c[i][j];
    }

    int a[3], b[3];
    for (a[0] = -100; a[0] <= 100; a[0]++)
        for (a[1] = -100; a[1] <= 100; a[1]++)
            for (a[2] = -100; a[2] <= 100; a[2]++)
            {
                for (int i = 0; i < 3; i++)
                    b[i] = c[i][i] - a[i];
                bool ok = true;
                for (int i = 0; i < 3; i++)
                    for (int j = 0; j < 3; j++)
                        ok &= c[i][j] == a[i] + b[j];
                if (ok)
                    cout << "Yes";
                if (ok)
                    return 0;
            }
        cout << "No";
       return 0;
}


Measured memory_bytes: 256
using System;
class Program
{
	static void Main(string[] args)
	{
        int a = int.Parse(Console.ReadLine());
        int b = int.Parse(Console.ReadLine());
        int c = int.Parse(Console.ReadLine());
        int x = int.Parse(Console.ReadLine());
        
        int count = 0;   
        for(int i = 0;i <= a;i++){
            for(int j = 0;j <= b;j++){
                for(int k = 0;k <= c;k++){
                    if(500*i+100*j+50*k == x) count++;
                }
            }
        }
        Console.WriteLine(count);
	}
}

Measured memory_bytes: 11092
n=int(input())
xyp=[list(map(int,input().split())) for i in range(n)]
cost=[10**20]*(1<<n)
cost[0]=0
for bitt in range(1,1<<n):
  xx=[]
  yy=[]
  pp=[]
  m=0
  for i in range(n):
    x,y,p=xyp[i]
    if (1<<i)&bitt:
      xx.append(x)
      yy.append(y)
      pp.append(p)
      m+=1
  for i in range(m):
    sx=xx[i]
    anss=0
    for x,y,p in zip(xx,yy,pp):
      anss+=min(abs(y),abs(x),abs(sx-x))*p
    cost[bitt]=min(cost[bitt],anss)
  for j in range(m):
    sy=yy[j]
    anss=0
    for x,y,p in zip(xx,yy,pp):
      anss+=min(abs(y),abs(x),abs(sy-y))*p
    cost[bitt]=min(cost[bitt],anss)
dp=[sum(min(abs(xyp[i][0]),abs(xyp[i][1]))*xyp[i][2] for i in range(n) if (1<<i)&j) for j in range(1<<n)]
print(dp[-1])
for j in range(n):
  for i in range((1<<n)-1,0,-1):
    x=i
    while x>=0:
      x&=i
      dp[i]=min(dp[i],dp[i-x]+cost[x])
      x-=1
  print(dp[-1])


Measured memory_bytes: 80096
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;

int main() {
  int n, q, t;
  string name;
  // 標準ライブラリから queue を使用
  queue<pair<string, int> > Q;  // プロセスのキュー

  cin >> n >> q;

  // 全てのプロセスをキューに順番に追加する
  for ( int i = 0; i < n; i++ ) {
    cin >> name >> t;
    Q.push(make_pair(name, t));
  }

  pair<string, int> u;    // ここで、pairは値の組を保持するための構造体テンプレートで、
  int elaps = 0, a;       // < >の中に2つの型を指定して宣言します。make_pairによって
                          // 組を生成し、1つ目の要素はfirst、2つ目の要素はsecondで
  // シミュレーション        // アクセスすることができます
  while ( !Q.empty() ) {
    u = Q.front(); Q.pop();
    a = min(u.second, q);  // q または必要な時間 u.second だけ処理を行う
    u.second -= a;  // 残りの必要時間を計算
    elaps += a;  // 経過時間を加算
    if ( u.second > 0 )
      Q.push(u);  // 処理が完了していなければキューに追加
    else
      cout << u.first << " " << elaps << endl;
  }

  return 0;
}


Measured memory_bytes: 6216
#include<stdio.h>
int main()
{
    int n, m, c, cn=0, s;
    scanf("%d %d %d", &n, &m, &c);
    int b[m], a[n][m];
    for(int i=0; i<m; i++){
        scanf("%d", &b[i]);
    }
    for(int i=0; i<n; i++){
        s=0;
        for(int j=0; j<m; j++){
            scanf("%d", &a[i][j]);
            s+=b[j]*a[i][j];
        }
        if((s+c)>0)
            cn++;
    }
    printf("%d\n", cn);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <cstdio>
using namespace std;

typedef pair<int, int> ii;

struct Node {
    bool d;
    vector<ii> tos;
};

int n;
vector<Node> ns;

int prim() {
    for (int i = 0; i < n; i++) {
        ns[i].d = false;
    }
    priority_queue<ii, vector<ii>, greater<ii> > q;
    q.push(make_pair(0, 0));
    int ans = 0;
    while (!q.empty()) {
        ii p = q.top();
        q.pop();
        int i = p.second;
        if (ns[i].d) {
            continue;
        }
        ns[i].d = true;
        ans += p.first;
        for (vector<ii>::iterator it = ns[i].tos.begin(); it != ns[i].tos.end(); it++) {
            q.push(make_pair(it->second, it->first));
        }
    }
    return ans;
}

int main() {
    while (cin >> n, n) {
        ns.clear();
        ns.resize(n);
        int m;
        cin >> m;
        for (int i = 0; i < m; i++) {
            int a, b, c;
            scanf("%d,%d,%d", &a, &b, &c);
            c = c / 100 - 1;
            ns[a].tos.push_back(make_pair(b, c));
            ns[b].tos.push_back(make_pair(a, c));
        }
        cout << prim() << endl;
    }
}

Measured memory_bytes: 1548
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll x,a,b,c;
    cin >> a >> b >> c >> x;
    ll ans = 0;
    rp(i,a+1) rp(j,b+1) rp(z,c+1){
      if(i*500 + j*100 + z*50 == x) ++ans;
    }
    cout << ans << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 998244353;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }

int main(void) {
	int n, x = 0;
	cin >> n;
	vector<int> a(n);
	rep(i, 0, n) {
		cin >> a[i];
		x ^= a[i];
	}
	rep(i, 0, n) {
		printf(i == n - 1 ? "%d\n" : "%d ", x ^ a[i]);
	}
	return 0;
}


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

int main () {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int left, right;
  left = A + B;
  right = C + D;
  
  if (left > right) {
    cout << "Left" << endl;
  }
  else if (left == right) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
typedef long long ll;
template <class T>
inline void _read(T &x)
{
	x = 0;
	char t = getchar();
	while (!isdigit(t) && t != '-') t = getchar();
	if (t == '-')
	{
		_read(x);
		x *= -1;
		return ;
	}
	while (isdigit(t))
	{
		x = x * 10 + t - '0';
		t = getchar();
	}
}
template <class T>
inline void _read(T &a, T &b)  { _read(a), _read(b); } 
ll a[MAXN], id[MAXN], st[MAXN], n, m, k, vis[MAXN], ans[MAXN];
int main(int argc, char **argv)
{
	_read(n);
	for (int i = 1; i <= n; ++i) _read(a[i]), id[i] = i;
	for (int i = n; i ; --i) a[i] -= a[i - 1];
	_read(m, k);
	for (int i = 1, x; i <= m; ++i) _read(x), swap(id[x], id[x + 1]);
	for (int i = 1; i <= n; ++i)
	{
		if (!vis[i])
		{
			int  top = 0;
			for (int j = i; !vis[j]; j = id[j]) st[++top] = j, vis[j] = 1;
			for (int j = 1; j <= top; ++j) ans[st[j]] = a[st[(k + j - 1) % top + 1]];
		}
	}
	for (int i = 1; i <= n; ++i) ans[i] += ans[i - 1], printf("%lld\n", ans[i]);
	return 0;
}

Measured memory_bytes: 5120
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>

using namespace std;

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


#define X real()
#define Y imag()
typedef complex<double> P;
double cross(P a,P b){return a.X*b.Y-a.Y*b.X;}
bool ccw(P a,P b,P c){return cross(b-a,c-a)>=0;}

int main(){
	
	double xa,ya,xb,yb,xc,yc,xp,yp;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&xa,&ya,&xb,&yb,&xc,&yc,&xp,&yp)!=EOF){
		P a = P(xa,ya);
		P b = P(xb,yb);
		P c = P(xc,yc);
		P p = P(xp,yp);
		
		if(!ccw(a,b,c)){
			swap(b,c);
		}
		
		if(!ccw(a,b,p)||!ccw(b,c,p)||!ccw(c,a,p))puts("NO");
		else puts("YES");
	}
}

Measured memory_bytes: 1184
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;

int main(){
	
	vector<vector<vector<int> > > building;
	vector<vector<int> > one(3, vector<int>(10)), two(3, vector<int>(10)), three(3, vector<int>(10)), four(3, vector<int>(10));
	
	building.push_back(one);
	building.push_back(two);
	building.push_back(three);
	building.push_back(four);
	
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 10; j++){
			one.at(i).at(j) = 0;
			two.at(i).at(j) = 0;
			three.at(i).at(j) = 0;
			four.at(i).at(j) = 0;
		}
	}
	
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		int b,f,r,v;
		cin >> b >> f >> r >> v;
		building.at(b-1).at(f-1).at(r-1) += v;
	}
	
	
	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < 10; k++){
				cout << " " << building.at(i).at(j).at(k);
			}
			cout << endl;
		}
		if(i != 3) cout << "####################" << endl;
	}
	
}





Measured memory_bytes: 3160
h, n = map(int, input().split())
ab = tuple(tuple(map(int, input().split())) for _ in range(n))

dp = [10 ** 20] * 10 ** 4 * 2
dp[0] = 0
for a, b in ab:
    for i in range(h):
        dp[i + a] = min(dp[i + a], dp[i] + b)
print(min(dp[h:]))

Measured memory_bytes: 47836
N, M = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(M)]
P = list(map(int, input().split()))

ans = 0

# N個のスイッチの状態をbit全探索
for i in range(2 ** N):
    cntFlg = True
    # 各電球について点灯状態を確認
    for m in range(M):
        # ONになっているスイッチの数をカウント
        onSwCnt = 0
        for j in range(L[m][0]):
            # SWがONなら
            if (i >> L[m][j+1] - 1) & 1:
                onSwCnt += 1
        if not P[m] == onSwCnt % 2:
            cntFlg = False

    if cntFlg:
        ans += 1

print(ans)


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

int main(){

	int X, Y, cont = 0;
	scanf("%d %d", &X, &Y);

	if (X == Y)
		cont = X + Y;
	else if (X > Y){
		cont += X--;
		if (X > Y)
			cont += X;
		else
			cont += Y;

	} else{
		cont += Y--;
		if (Y > X)
			cont += Y;
		else
			cont += X;

	}

	printf("%d\n",cont );
	

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int n=s.length();
	string a[n];
	a[0]=s[0];
	int t=1;
	for(int i=1;i<n;i++)
	{
		a[t]+=s[i];
		if(a[t]==a[t-1]) continue;
		else t++;
	}
	printf("%d\n",t);
}

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

//#define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
/* }}} */
signed main() 
{
  int h,w;
  cin>>h>>w;
  rep(i,w+2) cout<<'#';
  cout << endl;
  rep(i,h)
  {
    string tmp;
    cin>>tmp;
    cout<<'#'<<tmp<<'#'<<endl;
  }
  rep(i,w+2) cout<<'#';
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n + 1];
		for(int i = 1; i < n + 1; i++) {
			a[i] = sc.nextInt();
		}
		boolean[] ans = new boolean[n + 1];
		for(int i = n; i > 0; i--) {
			int cnt = 0;
			for(int j = 2; j * i < n + 1; j++) {
				if(ans[j * i])
					cnt++;
			}
			if(a[i] == cnt % 2) {
				ans[i] = false;
			} else {
				ans[i] = true;
			}
		}
		int num = 0;
		for(int i = 1; i < n + 1; i++) {
			if(ans[i])
				num++;
		}
		System.out.println(num);
		for(int i = 1; i < n + 1; i++) {
			if(ans[i])
				System.out.print(i + " ");
		}
	}

}


Measured memory_bytes: 90760
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#pragma warning( disable:4996 )
using namespace std;
typedef long long ll;
typedef long long Int;
#define MOD 1000000007

#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define MIN(a, b) ((a) < (b) ? (a) : (b))


int main(void) {
	/*int x, y;
	scanf("%d %d", &x, &y);
	if (x == 1 && y == 1) {
		printf("1000000\n");
		return 0;
	}
	else {
		printf("%d\n", ((4 - ((x>=4)?4:x)) + (4 - ((y>=4)?4:y))) * 100000);
	}*/
	/*int n;
	ll a[200001];
	scanf("%d", &n);
	ll total = 0;
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
		total += a[i];
	}
	ll before = 0;
	ll length = a[0];
	ll counter = 1;
	while (1) {
		before = length;
		length += a[counter++];
		if (length == total / 2 && total % 2 == 0) {
			printf("0\n");
			return 0;
		}
		if (length > total / 2) {
			if (length * 2 - total < total - before*2) {
				printf("%d\n", length * 2 - total);
			}
			else {
				printf("%d\n", total - before * 2);
			}
			
			return 0;
		}
	}*/
	int firstrow = -1;
	int lastrow = 999;
	vector<int> emptyrow;
	int h, w, k;
	char s[301][301];
	scanf("%d %d %d", &h, &w, &k);
	for (int i = 0; i < h; i++) {
		scanf("%s", s[i]);
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#') {
				if (firstrow == -1) {
					firstrow = i;
				}
				lastrow = i;
				goto found;
			}
		}
		emptyrow.push_back(i);
	found:
		1;
	}
	int ans[301][301];
	int number = 1;
	if (firstrow > 0) {
		int temprow = 0;
		int first = -1;
		for (int i = 0; i < w; i++) {
			if (s[firstrow][i] == '#') {
				if (first == -1) {
					ans[firstrow][i] = 1;
					first = i;
				}
				else {
					number++;
					ans[firstrow][i] = number;
				}
			}
			else {
				ans[firstrow][i] = number;
			}
		}
		for (int i = 0; i < firstrow; i++) {
			for (int j = 0; j < w; j++) {
				ans[i][j] = ans[firstrow][j];
			}
		}
		number++;
	}
	if (firstrow == 0)firstrow = -1;
	for (int i = firstrow + 1; i < h; i++) {
		if (find(emptyrow.begin(), emptyrow.end(), i)!=emptyrow.end()) {//emptyrow
			for (int j = 0; j < w; j++) {
				ans[i][j] = ans[i - 1][j];
			}
		}
		else {
			int first = -1;
			for (int j = 0; j < w; j++) {
				if (s[i][j] == '#') {
					if (first == -1) {
						ans[i][j] = number;
						first = j;
					}
					else {
						number++;
						ans[i][j] = number;
					}
				}
				else {
					ans[i][j] = number;
				}
			}
			number++;
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (j == w-1) {
				printf("%d\n", ans[i][j]);
			}
			else {
				printf("%d ", ans[i][j]);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <map>

using namespace std;

int n;
string s;
map<pair<string, string>, long long> mm;
long long ans;
string s1, s2;

int main()
{
    cin >> n >> s;
    for (int i = 0; i < n; i++) s1 += s[i];
    for (int i = n; i < 2 * n; i++) s2 += s[i];
    reverse(s2.begin(), s2.end());
    for (int i = 0; i < (1 << n); i++)
    {
        string t1 = "", t2 = "";
        for (int j = 0; j < n; j++)
        {
            if ((1 << j) & i)
                t1 += s2[j];
            else
                t2 += s2[j];
        }
        mm[{t1, t2}]++;
    }
    for (int i = 0; i < (1 << n); i++)
    {
        string t1 = "", t2 = "";
        for (int j = 0; j < n; j++)
        {
            if ((1 << j) & i)
                t1 += s1[j];
            else
                t2 += s1[j];
        }
        ans += mm[{t2, t1}];
    }
    cout << ans;
}


Measured memory_bytes: 91904
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
	ll n,k;
	cin>>n>>k;
	    ll a[n];
	    for(ll i=0;i<n;i++) cin>>a[i];
	    ll b[n];
	    for(ll i=0;i<n;i++) b[i]=0;
	    b[1]=abs(a[0]-a[1]);
	    for(int i=2;i<n;i++)
	    { ll m=10000000000000,l;
	        if (i<k) l=i;
	        else l=k;
	        for(ll j=1;j<=l;j++)
	        { 
	          if(m>(b[i-j]+abs(a[i]-a[i-j])))
	            m=b[i-j]+abs(a[i]-a[i-j]);
	        }
          b[i]=m;	  
	    }
	    cout<<b[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 4692
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

struct EdgeA
{
	int to;
	ll cost;
};

void calcAllShortest(vector<vector<EdgeA>>& G, vector<vector<ll>>& d)
{
	auto numV = (int)G.size();
	for (auto i = 0; i < numV; ++i)
	{
		d.push_back(vector<ll>(numV, LLONG_MAX));

		for (auto v : G[i])
		{
			d[i][v.to] = v.cost;
		}
		d[i][i] = 0;
	}

	for (auto k = 0; k < numV; ++k)
	{
		for (auto i = 0; i < numV; ++i)
		{
			for (auto j = 0; j < numV; ++j)
			{
				if (d[i][k] >= LLONG_MAX || d[k][j] >= LLONG_MAX)
				{
					continue;
				}
				auto kd = d[i][k] + d[k][j];
				if (d[i][j] > kd)
				{
					d[i][j] = kd;
				}
			}
		}
	}
}

int main()
{
	int N, M;
	cin >> N >> M;
	vector<vector<EdgeA>> G(N);
	for (auto i = 0; i < M; ++i)
	{
		int a, b, c;
		cin >> a >> b >> c;
		--a;
		--b;
		G[a].push_back({ b, c });
		G[b].push_back({ a, c });
	}

	vector<vector<ll>> d;
	calcAllShortest(G, d);

	auto ans = 0;
	for (auto i = 0; i < N; ++i)
	{
		for (auto& e : G[i])
		{
			if (e.to < i)
			{
				continue;
			}

			if (d[i][e.to] < e.cost)
			{
				++ans;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
package main

import (
	"fmt"
	"sort"
)

func main() {
	// Code for C - Divide the Problems
	var N int
	fmt.Scanf("%d", &N)

	d := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &d[i])
	}

	sort.Sort(sort.IntSlice(d))

	fmt.Println(d[len(d)/2] - d[(len(d)/2)-1])
}


Measured memory_bytes: 6324
n = int(input())
nums = list(map(int, input().split()))
count = 0
def judge(n, nums, count):
  for i in range(10000):
    for j in range(n):
      if nums[j] % 2 == 0:
        nums[j] /= 2
      else:
        return count
    count += 1

print(judge(n, nums, count))

Measured memory_bytes: 3316
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    S = input().strip()
    n=len(S)
    # eprint('S[0:(n-1)//2] , S[0:(n-1)//2][::-1] , S[(n+3)//2 - 1:n] , S[(n+3)//2 - 1:n][::-1] ',end=':\n')
    # eprint(S[0:(n-1)//2] , S[0:(n-1)//2][::-1] , S[(n+3)//2 - 1:n] , S[(n+3)//2 - 1:n][::-1])
    if S[0:(n-1)//2] == S[0:(n-1)//2][::-1] == S[(n+3)//2 - 1:n] == S[(n+3)//2 - 1:n][::-1]:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Measured memory_bytes: 61036
using System;
using System.Linq;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC138.Alchemist();
        }
    }

    class ABC138
    {
        public static void Alchemist()
        {
            int n = int.Parse(Console.ReadLine());
            int[] v = Input.getIntArray();
            var sortV = v.Select(x=>double.Parse(x.ToString())).OrderBy(x=>x).ToArray();

            double ed;
            for(int i=0; i<n-1; i++)
            {
                ed = (sortV[i]+sortV[i+1])/2;
                sortV[i+1] = ed;
            }

            Console.WriteLine(sortV[n-1]);
        }
    }

    class Input
    {
        public static int getInt()
        {
            int i = int.Parse(Console.ReadLine());
            return i;
        }

        public static string getString()
        {
            string s = Console.ReadLine();
            return s;
        }
        public static int[] getIntArray()
        {
            string[] s = Console.ReadLine().Split(' ');
            int[] num = s.Select(x=>int.Parse(x)).ToArray();
            return num;
        }
        public static long[] getLongArray()
        {
            string[] s = Console.ReadLine().Split(' ');
            long[] num = s.Select(x=>long.Parse(x)).ToArray();
            return num;
        }
        public static string[] getStringArray(int n)
        {
            var s = new string[n];
            for(int i=0; i<n; i++)
            {
                s[i] = Console.ReadLine();
            }
            return s;
        }
    }

}


Measured memory_bytes: 13396
def is_square_num(n):
  i2 = 0
  for i in range(0, n + 1):
    if i2 == n:
      return "Yes"
    if i2 > n:
      return "No"
    i2 += i * 2 + 1
    
i = list(map(str, input().split()))
n = int(i[0]+i[1])

print( is_square_num(n) )

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

int main() {
   int a[3]={0},b[3]={0};
  int v[6]={0};
  for(int i=0;i<3;i++)
  {
    cin>>a[i]>>b[i];
    v[a[i]]++;
      v[b[i]]++;
    if(  v[a[i]]>2 ||   v[b[i]]>2) {
    //   cout<< v[a[i]]<<'\n'; 
    //     cout<< v[b[i]]<<'\n'; 
    cout<<"NO";return 0;}
  }
  cout<<"YES";
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdbool.h>

typedef long long int ll;

static inline ll gcd(ll a,ll b){
    ll max,min,r;
    max = a<b?b:a;
    min = a<b?a:b;
    while(min){
        r = max;
        r %= min;
        max = min;
        min = r;
    }
    return max;
}

bool prime_flag[1000001];//caution true -> 0 fasle -> 1

int main(void){
    ll a,b,gcdnum,count = 1;
    scanf("%lld %lld",&a,&b);
    gcdnum = gcd(a,b);
    for(int i = 2;i*2 < 1000001;i++)for(int j = 2;i * j < 1000001;j++)prime_flag[i*j] = 1;
    for(ll i = 2;i*i <= gcdnum;i++)if(!(prime_flag[i] || (gcdnum % i))){
        count++;
        while(!(gcdnum % i))gcdnum /= i;
    }
    if(gcdnum != 1)count++;
    printf("%lld",count);
    return 0;
}

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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if (-1 * a + b > x) {
		cout << "dangerous";
	}
	else if(-1 * a + b > 0 ) {
		cout << "safe";
	}
	else {
		cout << "delicious";
	}

}


Measured memory_bytes: 256
/* 学籍番号 17D8101029G 石塚 博之 ID: mcatpolo 言語:C */
#include <stdio.h>
#include <math.h>
#define N 500000

long c = 0;

long A[N];

void merge(int left, int mid, int right){
    long L[N/2+1], R[N/2+1];
    int n1, n2, i, j, k;

    n1 = mid - left;
    n2 = right - mid;

   for(i=0; i<n1; i++){
       L[i] = A[left+i];
   }

   for(i=0; i<n2; i++){
       R[i] = A[mid + i];
   }

   L[n1] = (long)INFINITY;
   R[n2] = (long)INFINITY;

   i=0;
   j=0;

   for(k=left; k<right; k++){
       c++;
       if(L[i] <= R[j]) {
           A[k] = L[i];
           i++;
       }
       else {
           A[k] = R[j];
           j++;
       }
   }

}

void mergeSort(int left, int right){
    int mid;
    if(left+1<right){
        mid = (left+right)/2;
        mergeSort(left, mid);
        mergeSort(mid, right);
        merge(left, mid, right);
    }
}

int main(void){
    int i, n;

    scanf("%d", &n);

    for(i=0; i<n; i++) {
        scanf("%d", &A[i]);
    }

   mergeSort(0, n);

   for(int i=0; i<n; i++){
       if(i!=n-1){
           printf("%d ", A[i]);
       }
       else
       {
           printf("%d\n", A[i]);
       }
       
   }

   printf("%d\n", c);

   return 0;
}


Measured memory_bytes: 9528
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pii pair<int,int>
#define mx 5000
#define fori0(i,n) for(int i=0;i<n;i++)
int main() {
    int n,t;
    double a;
    cin >> n >> t >> a;
    int arr[n];
    fori0(i,n) cin >> arr[i];

    double ans = t - (double)(arr[0]*0.006);
    double dis = (double)(abs(a-ans));
    int idx = 1;
    for(int i=1;i<n;i++){
        ans = t - (arr[i]*0.006);
        double tmp = (double)(abs(a - ans));
        if(tmp < dis){
            dis = tmp;
            idx = i+1;
        }
    }
    cout << idx << endl;
    return 0;
}


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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
ll ret;
stack<ll> s;
ll M;
vector<pair<ll, ll>> bri;
vector<ll> par;
vector<ll> sizes;

ll root(ll a){
  if(par[a] == a){
    return a;
  }else{
    par[a] = root(par[a]);
    return par[a];
  }
}

void unite(ll a, ll b) {
  ll a_p = root(a);
  ll b_p = root(b);
  if (a_p == b_p){
    return;
  }else{
    if(sizes[a_p] < sizes[b_p]){
      swap(a_p, b_p);
    }
    par[b_p] = a_p;
    sizes[a_p] += sizes[b_p];
  }
}

bool same(ll a, ll b){
  return root(a)==root(b);
}

ll size(ll a){
  return sizes[root(a)];
}

void input() {
  IN(N);
  IN(M);
  ll A, B;
  REP(i,M){
    IN(A);
    IN(B);
    bri.push_back(make_pair(A, B));
  }

  REP(i, N+1){
    par.push_back(i);
    sizes.push_back(1);
  }
}

void solve() {
  ret = (N * (N-1)) / 2;
  for(ll i=M-1; i>=0; i--){
    ll fi = bri[i].first;
    ll se = bri[i].second;
    s.push(ret);

    if(root(fi) != root(se)){
      ll a = size(fi);
      ll b = size(se);
      unite(fi, se);
      ret -= a*b;
    }
  }
}

int main(void){
  input();
  solve();
  REP(i,M){
    ll ans = s.top();
    s.pop();
    PRINT(ans);
  }
}


Measured memory_bytes: 5872
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N, X, Y;
    cin >> N >> X >> Y;
    X--; Y--;
    vector<int> edges[2000];
    for(int i=0; i<N-1; i++){
        edges[i].push_back(i+1);
        edges[i+1].push_back(i);
    }
    edges[X].push_back(Y);
    edges[Y].push_back(X);
 
    vector<int> ans(N);
    for(int s=0; s<N; s++){
        vector<int> dist(N, 1e9);
        queue<int> que;
        dist[s] = 0;
        que.push(s);
        while(que.size()){
            int i = que.front(); que.pop();
            for(int j : edges[i]) if(dist[j] == 1e9){
                dist[j] = dist[i] + 1;
                que.push(j);
            }
        }
        for(int i=s+1; i<N; i++) ans[dist[i]]++;
    }
    for(int i=1; i<N; i++) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
bool exist[108][108];
int main(){  
	int x, y, s;
	while(cin >> x >> y >> s, x | y | s){
		int res = 0;
		for(int i = 1;i <= s;i++){
			for(int j = 1;j <= s;j++){
				if(i * (100 + x) / 100 + j * (100 + x) / 100 == s){
					res = max(res, i * (100 + y) / 100 + j * (100 + y) / 100);
				}
			}
		}
		cout<< res << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
import math
import string
import collections
from collections import Counter


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

k, n = map(int, input().split())
a = readints()
# 1→N特殊
tokusyu = (k-(k-a[n-1]+a[0]))
# 2→1（2-1)
# 3→2（3-2）

for i in range(n-1):
    tokusyu = min(tokusyu, k-(a[i+1]-a[i]))
print(tokusyu)


Measured memory_bytes: 26632
#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
#include <functional>
#include <numeric>
#include <math.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(void) {
	int N;
	cin >> N;
	vector<int> vec(N+1);
	for (int x = 1; x < 100; x++) {
		for (int y = 1; y < 100; y++) {
			if (x*x + y * y + x * y > N) break;;
			for (int z = 1; z < 100; z++) {
				int tmp = x * x + y * y + z * z + x*y + y*z + z*x;
				if (tmp > N) break;
				vec.at(tmp)++;
			}
		}
	}
	for (int i = 1; i <= N; i++) {
		cout << vec.at(i) << endl;
	}
	return 0;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b;cin>>a>>b;
  cout<<max(0LL,a-2*b)<<endl;
  return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int x;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> x;
	if (x >= 30) cout << "Yes\n";
	else cout << "No\n";
	//system("pause");
	return 0;
}

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

long long int N, a, b, i;

int main(){
    scanf("%lld", &N);
    for(;i <N; ++i){
        scanf("%lld", &a);
        b ^= (a & 1);
    }
    puts(b ? "NO" : "YES");
    return 0;
}


Measured memory_bytes: 384