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

using namespace std;
typedef long long ll;
#define MOD 1000000007
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

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

    ll i, j, ans = LONG_LONG_MAX;
    for(i = 1; i <= ceil(sqrt(N)); i++) {
        if (N % i == 0) {
            j = N / i;
            ans = min(ans, i + j - 2);
        }
    }
    cout << ans << endl;

    return 0;
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int n;

int main()
{
    _FastIO;
    string s;
    cin >> n;
    cin >> s;
    int k = n / 2;
    if(n % 2){
        cout << "No" << endl;
        return 0;
    }
    string ans = "Yes";
    for(int i = 0; i < k; i++){
        if(s[i] != s[i + k])
            ans = "No";
    }
    cout << ans << endl;
    return 0;
}


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

namespace ABC122A
{
    static class MainClass
    {

        static int[] s;
        static int[] n;

        public static void Main(string[] args)
        {

            string u = Console.ReadLine();

            if (u == "A")
            {
                Console.WriteLine("T");
            }else if (u == "T")
            {
                Console.WriteLine("A");
            }else if (u == "G")
            {
                Console.WriteLine("C");
            }
            else
            {
                Console.WriteLine("G");
            }
            return;
        }
    }
}


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

int main(){
  
  int a,b;
  cin >> a >> b;
  string c;
  
  for(int i=0;i<b+2;i++){
       cout << "#";
  }
  cout << endl;
    
  for(int i=0;i<a;i++){
       cin >> c;
       cout << "#" << c << "#" << endl;
  }
  
  for(int i=0;i<b+2;i++){
       cout << "#";
  }
  cout << endl;
  
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; ++i)
#define rep(i, n) repl(i, 0, n)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define chmax(x,y) x = max(x, y)
#define chmin(x,y) x = min(x, y)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using G = vector<vector<int>>;
const int MOD = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, -1, 0, 1};

int main()
{
    int k, t;
    cin >> k >> t;
    int ma = 0;
    rep(i, t) {
        int a;
        cin >> a;
        chmax(ma, a);
    }
    int ans = 0;
    chmax(ans, ma - 1 - k + ma);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

ll M(string s)
{
  int p=0;
  stack<ll>st;
  int multi = 0;  
  for(int i=0;i<s.size();i++){
    if(s[i] == '+'){
      stringstream ss;
      ss << s.substr(p, i-p);
      ll x;
      ss >> x;
      if(multi){
	x *= st.top(); st.pop();
	multi = 0;
      }
      st.push(x);
      p = i+1;
    }else if(s[i] == '*'){
      stringstream ss;
      ss << s.substr(p, i-p);
      ll x;
      ss >> x;
      if(multi){
	ll t = st.top(); st.pop();
	x *= t;
	multi = 0;
      }
      st.push(x);
      p = i+1;
      multi = 1;      
    }
  }

  stringstream ss; ss << s.substr(p);
  ll x; ss >> x;
  if(multi){
    x *= st.top(); st.pop();
    multi = 0;
  }
  st.push(x);
  ll ret = 0;
  while(!st.empty()){
    ret += st.top();
    st.pop();
  }
  return ret;
}

ll L(string s)
{
  int p = 0, pe = 0;
  int mflag = 0, pflag = 0;
  ll ret = 0;
  while(pe < s.size()){
    if(s[pe] == '*'){
      stringstream ss; ss << s.substr(p, pe-p);
      ll x; ss >> x;
      if(mflag){
	ret *= x;
	mflag = 0;
      }else if(pflag){
	ret += x;
	pflag = 0;
      }else{
	ret = x;
      }
      mflag = 1;
      p = pe+1;
    }else if(s[pe] == '+'){
      stringstream ss; ss << s.substr(p, pe-p);
      ll x; ss >> x;
      if(mflag){
	ret *= x;
	mflag = 0;
      }else if(pflag){
	ret += x;
	pflag = 0;
      }else{
	ret = x;
      }      
      pflag = 1;
      p = pe+1;
    }
    pe++;
  }
  stringstream ss; ss << s.substr(p);
  ll x; ss >> x;
  if(mflag){
    ret *= x;
    mflag = 0;
  }else if(pflag){
    ret += x;
    pflag = 0;
  }else{
    ret = x;
  }
  
  return ret;
}

int main()
{
  string s;
  ll bob;  
  cin >> s >> bob;
  int Mflag = (M(s) == bob);

  int Lflag = (L(s) == bob);
  if(Mflag && Lflag) cout << 'U';
  else if (!Mflag && !Lflag) cout << 'I';
  else if(Mflag) cout << 'M';
  else cout << 'L';
  cout << endl;
  return 0;
}

Measured memory_bytes: 1228
/*
    Author : DemonStar
*/

#pragma GCC optimize("Ofast")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define loop(i, n) for(ll i = 0; i < n; i++)
#define pl pair<ll, ll>
#define vl vector<ll>
#define endl '\n'
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifdef LOCAL
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};


template <typename T, typename TT>
ostream &operator<<(ostream &os, const pair<T, TT> &t) {
    return os << t.first << " " << t.second;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &t) {
    for (auto &i : t) os << i << " ";
    return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &t : v) is >> t;
    return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, vector<pair<T1, T2>> &v) {
    for (pair<T1, T2> &t : v) is >> t.first >> t.second;
    return is;
}

const ll mod = 1e9 + 7;

int main()
{

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    fast;
    ll a, b, n;
    cin >> a >> b >> n;
    ll rem = min(b - 1, n);
    cout << ((a * rem) / b) - a*(rem / b) << endl;

#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s";
#endif

    return 0;
}

Measured memory_bytes: 3656
var n,i:longint;
    a,x:longint;
    max,maxx,min:longint;
    z:longint;
begin
  read(n);
  z:=0;
  if n=0 then writeln(1 div z);
  min:=maxlongint;
  for i:=1 to n do
  begin
    read(a,x);
    if a>max then max:=a;
    if x<min then min:=x;
  end;
  writeln(max+min);
end.


Measured memory_bytes: 128
package main

import "fmt"

func main() {
  var cnt int
  var str string
  fmt.Scan(&cnt)
  fmt.Scan(&str)
  
  l := (cnt / 2)  
  if str != str[:l] + str[:l] {
    fmt.Printf("No")
    return
  }
  fmt.Printf("Yes")
}


Measured memory_bytes: 512
fun main(args: Array<String>){
    readLine()
    val input: MutableList<Int> = readLine()!!.split(" ").map { it.toInt() }.toMutableList()
    var min: Int
    var firstMinSwitch: Boolean

    while(true) {
        firstMinSwitch = true

        if(input.size == 1) break

        min = input.min()!!

        for(i in 0 until input.size){
            if (input[i] == min){
                if(firstMinSwitch){
                    firstMinSwitch = false
                }else{
                    input[i] = 0
                }
            }else{
                input[i] %= min
            }
        }

        input.removeAll{it == 0}

    }

    println(input[0])
}

Measured memory_bytes: 52296
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 11 01:37:10 2020

@author: liang
"""

S = input()
N = len(S)
ans = 0
for i in range(N):
    if i%2 == 0 and S[i] == "0":
        ans += 1
    if i%2 == 1 and S[i] == "1":
        ans += 1
ans = min(ans, N - ans)
print(ans)

Measured memory_bytes: 9252
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


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;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;


int main() {
	int n;
	cin >> n;
	vector<ll> kazu(5, 0);
	rep(i, n) {
		string st;
		cin >> st;
		if (st[0] == 'M') kazu[0]++;
		if (st[0] == 'A') kazu[1]++;
		if (st[0] == 'R') kazu[2]++;
		if (st[0] == 'C') kazu[3]++;
		if (st[0] == 'H') kazu[4]++;
	}
	ll ans = 0;
	for (int i = 0; i < 5; ++i) {
		for (int j = i + 1; j < 5; ++j) {
			for (int k = j + 1; k < 5; ++k) {
				ans += kazu[i] * kazu[j] * kazu[k];
			}
		}
	}

	cout << ans << endl;

	return 0;
}


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

void solve(std::string S){
    bool ans = true;
    REP(i, S.size() - 1) {
        if (S[i] == S[i + 1]) {
            ans = false;
            break ;
        }
    }
    if (ans) cout << "Good" << '\n';
    else cout << "Bad" << '\n';
}

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


Measured memory_bytes: 256
input()
a = [int(i) for i in input().split()]
if len(a) == 2:
    print(max(a), min(a))
    exit()
n = max(a)
r = a[0]
dif = abs(n // 2 - r)
for i in a:
    if abs(n // 2 - i) < dif:
        dif = abs(n // 2 - i)
        r = i
print(n, r)


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

int main() {
    int N;
    vector<int> A;
    vector<int> p;

    scanf("%d", &N);
    A.resize(N + 2);
    p.resize(N + 2);
    A[0] = 0;
    A[N + 1] = 0;
    p[0] = 0; 

    for(int i = 1;i < N + 1;i++) {
        int x;
        scanf("%d", &x);
        A[i] = x;
        p[i] = p[i - 1] + abs(A[i] - A[i - 1]);
    }
    p[N + 1] = p[N] + abs(A[N] - A[N + 1]);

    for(int i = 1;i < N + 1;i++) {
        int x = (p[i - 1] - p[0]) + abs(A[i - 1] - A[i + 1]) + (p[N + 1] - p[i + 1]); 
        printf("%d\n", x);
    }
    return 0;
}


Measured memory_bytes: 2048
s=input()
x=bin(0)
count=0
for i in range((2**(len(s)-1))):
    cur=s[0]
    cur_num=x[2:].zfill(len(s)-1)
    for i in range(len(s)-1):
        if(cur_num[i]=='1'):
            cur+='+'
        cur+=s[i+1]
    count+=eval(cur)
    x = bin(int(x,2)+ 1)
print(count)

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

constexpr long long MOD = 1'000'000'007;

class binomial_coefficients {
	long long MAX_VAL;
	vector<long long> fac, mmi;

public:

	binomial_coefficients(){
	}
	
	binomial_coefficients(long long num){
		init(num);
	}
	
	~binomial_coefficients(){
		
	}
	
	void init(long long num){
		MAX_VAL = num+1; 
		fac.resize(MAX_VAL);
		mmi.resize(MAX_VAL);
		
		factorial_mod();
		modular_multiplicatibe_inverse();
	}
	
	void factorial_mod(){
		 fac[0] = 1;
		for(long long i = 1; i < MAX_VAL; fac[i] %= MOD, i++)
			fac[i] = fac[i - 1] * (i % MOD);
	}
	
	long long power(long long x, long long n){
		long long ans = 1;
		for(;n;n >>= 1, x *= x, ans %= MOD, x %= MOD)
			if(n&1)ans*=x;
		return ans % MOD;
	}
	
	void exgcd(long long a, long long b, long long &x, long long &y){
		if(b == 0){
			x = 1;
			y = 0;
			return ;
		}
		exgcd(b, a % b, y, x);
		y -= a / b * x;
	}
	
	void modular_multiplicatibe_inverse(){
		long long x, y;  
		exgcd(fac[MAX_VAL - 1], MOD, x, y);
		mmi[MAX_VAL-1] = (x % MOD + MOD) % MOD;
		// mmi[MAX_VAL-1] = power(fac[MAX_VAL-1], MOD-2);
		for(long long i = MAX_VAL - 2; i >= 0; mmi[i]%=MOD, i--)
			mmi[i] = mmi[i + 1] * ((i + 1) % MOD);
	}
	
	long long combination(long long n, long long r){
		return n < r ? 0 :fac[n] * (mmi[r] * mmi[n-r] % MOD) % MOD;
	}
};


int main(){
	
	long long n, k;
	long long ans = 0;
	binomial_coefficients bc;
	
	cin>>n>>k;
	
	bc.init(n+k);
	
	
	ans = bc.combination(n + k - 1, n);
	
	cout<<ans<<endl;
}


Measured memory_bytes: 3140
#include<stdio.h>
#include<set>
using namespace std;
int n,k;
int card[10];
bool used[10];
bool kt[10];
set<int> s;
void dfs(int i,int x){
	if(i==k){
		s.insert(x);
		return;
	}
	int j;
	for(j=0;j<n;j++){
		if(!used[j]){
			used[j]=true;
			if(kt[j])dfs(i+1,x*100+card[j]);
			else dfs(i+1,x*10+card[j]);
			used[j]=false;
		}
	}
}
int main(){
	while(1){
	scanf("%d %d",&n,&k);
	if(n==0)return 0;
	int i;
	s.clear();
	for(i=0;i<n;i++){
		scanf("%d",&card[i]);
		used[i]=false;
		if(card[i]<10)kt[i]=false;
		else kt[i]=true;
	}
	dfs(0,0);
	printf("%d\n",s.size());
	}
}

Measured memory_bytes: 1152
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<cmath>
#include<queue>
#include<unordered_map>
#include<map>
#include<stack>
#include<bits/stdc++.h>
#include<string.h>
#include <ext/pb_ds/assoc_container.hpp>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
//#define f first
//#define s second
#define respr(fir,sec) for(int i=0;i<=fir;i++){for(int j=0;j<=sec;j++){cout << res[i][j] << " ";}cout << "\n";}
#define pb push_back
//#define INF (1LL<<31)
using namespace std;
using namespace __gnu_pbds;
const int mod = 1e9+7;
const ll MAX = 1000000000000000000;
const ll INF = 1000000000000000000;
typedef pair<int,ll> pii;
typedef pair<ll,int> pi;
typedef tuple<long long,int> tp;
typedef tuple<int,int,long long> tu;
typedef multimap<pii , int> mpp;
typedef priority_queue< tp , vector<tp>, greater<tp>>  minheap;
typedef priority_queue<pii , vector<pii>> maxheap;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>  new_data_set;
const int nax=105;
//const int nax1 = 105;

int main()
{
	FASTIO;
	int n;
	int ans=0;
	cin >> n;
	vector<vector<int>> arr(n,vector<int>(3));
	vector<vector<int>> dp(n+1,vector<int>(3));
	
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			cin >> arr[i][j];
		}
	}
	
	for(int i=1;i<=n;i++){
		for(int j=0;j<3;j++){
				dp[i][j] = max(arr[i-1][j]+dp[i-1][(j+1)%3], arr[i-1][j]+ dp[i-1][(j+2)%3]);
				ans = max(ans, dp[i][j]);
		}
	}
	
	cout << ans << "\n";
	

	return 0;
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
#define int long long
using namespace std;


int32_t main(){

   int k,s; cin >> k >> s;
   int ans = 0;

   for(int x=0;x<=k;x++){
       for(int y=0;y<=k;y++){
           int add = x + y;
           if(add > s) continue;
           int z = s - add;
           if(z > k)    continue;
           ans++;
        //    if(x + y + z == s){
        //        cout << x << " " << y << " " <<z << endl;
        //        ans++;
        //    }
       }
   }

    cout << ans;

    return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()		// begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)				// repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)			// repeat reverse

#endif


int main(void)
{
	ll n; cin >> n;

	ll ans = 0;
	if (100000 <= n)
	{
		n -= 1;
		n -= ((9999 - 1000) + 1);
		n -= ((99 - 10) + 1);
	}
	else if (10000 <= n)
	{
		n -= ((9999 - 1000) + 1);
		n -= ((99 - 10) + 1);
	}
	else if (1000 <= n)
	{
		n -= ((n - 1000) + 1);
		n -= ((99 - 10) + 1);
	}
	else if (100 <= n)
	{
		n -= ((99 - 10) + 1);
	}
	else if (10 <= n)
	{
		n -= ((n - 10) + 1);
	}

	cout << n;

	return 0;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, M, *A = map(int, read().split())

    A.sort(reverse=True)
    
    if A[M - 1] >= sum(A) / (4 * M):
        print('Yes')
    else:
        print('No')

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 61608
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>

#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define elif else if
#define ll long long int
#define ld long double
#define vec vector
#define forn(a) for(ll a=0; a<n; a++)
#define fore(a, v, n) for(ll a=v; a<n; a++)
#define all(x) x.begin(), x.end()
#define presicion(x) cout<<fixed<<setprecision(x)
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define PI 3.14159265358979323
#define sen(ang) sin((ang)*PI/180)
//cout<<flush;

using namespace std;

#define MUCHO 9999999

ll n;

struct coso {
	ll cant;
	ll cands;
};

set<pair<ll, ll>> pots;
map<ll, set<ll>> g;
map<ll, struct coso> cants;
set<pair<ll, ll>> cands;

int main() {
	IOS;
	cin >> n;
	forn (i) {
		ll n;
		cin >> n;
		cants[n].cant++;
	}

	for (auto& v : cants)
	fore (e, 1, 31) {
		ll sum = 1 << e;
		auto b = cants.find(sum - v.first);
		if (b != cants.end()) {
			v.second.cands += b->second.cant;
			g[v.first].insert(b->first);
		}
	}

	for (const auto& c : cants)
		cands.emplace(c.second.cands, c.first);

	ll count = 0;
	for (auto n = cands.begin(); n != cands.end(); n = cands.begin()) {
		ll menos_cands = MUCHO;
		ll match = 0;
		for (auto v : g[n->second])
			if (cants[v].cands < menos_cands && cants[v].cands && cants[v].cant)
				menos_cands = cants[v].cands, match = v;
		if (menos_cands == MUCHO) {
			cants.erase(n->second);
			cands.erase(n);
			continue;
		}
		ll& ncant = cants[n->second].cant;
		ll& ncand = cants[n->second].cands;
		ll& mcant = cants[match].cant;
		ll& mcand = cants[match].cands;
		ll cmatches = min(ncant, mcant);
		if (match == n->second) {
			ncant = 0;
			ncand = 0;
			count += cmatches / 2;
			cands.erase(n);
			continue;
		}
		cands.erase(make_pair(mcand, match));
		ncant -= cmatches;
		mcant -= cmatches;
		ncand -= cmatches;
		mcand -= cmatches;
		if (ncant && ncand)
			cands.insert(make_pair(ncand, n->second));
		if (mcant && mcand)
			cands.insert(make_pair(mcand, match));
		cands.erase(n);
		count += cmatches;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 52352
require "set"

n,m = gets.split.map(&:to_i)

g = Array.new(n){ [] }
m.times do |i|
  a, b = gets.split.map(&:to_i)
  g[a] << b
  # g[b] << a
end

ans = 0
(2..n).to_a.permutation do |per|
  
  per.unshift(1)
  flag = true
  (n-1).times do |i|
    
    a, b = per[i], per[i+1]
    a, b = b, a if a > b
    
    if !g[a].include?(b)
      flag = false
      break
    end
  end
  ans += 1 if flag
end

puts ans

Measured memory_bytes: 2556
#include "bits/stdc++.h"
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define all(V) (V).begin(), (V).end() 
using namespace std;
typedef long long ll;
string to_string(string s) {
  return '"' + s + '"';
}
string to_string(const char* s) {
  return to_string((string) s);
}
string to_string(bool b) {
  return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef KEK
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {fio;
	string s;
	int N;
	cin >> N;
	// N = 100;
	cin >> s;
	vector <int> a(N);
	for(int i = 0; i < N; i++) {
		a[i] = s[i] - '1';
	}
	bool g = 0;
	if(count(all(a), 0) + count(all(a), 2) == N) {
		g = 1;
		for(int i = 0; i < N; i++) {
			a[i] /= 2;
		}
	} else {
		for(int i = 0; i < N; i++) {
			a[i] %= 2;
		}
	}
		int ans = 0;
		for(int i = 0; i < N; i++) {
			if((i & (N - 1)) == i) {
				ans ^= a[i];
			}
		}
		cout << ans * (1 + g) << endl;

    return 0;
}

Measured memory_bytes: 5276
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{

  int key;
  struct node *prev;
  struct node *next;

};

typedef struct node Node;

Node *head;

void init()
{
  head = (Node*)malloc(sizeof(Node));
  head -> prev = head;
  head -> next = head;
}
//head -> next?????? ??¢???????????°????????¢????????????
Node *search(int n){
  Node *x = head -> next;
  while( x != head && x -> key != n) x = x -> next;
  return x;
}
 
void insert(int n)//n???head????¬??????????????????????????????????
{
  Node *x;
  x = (Node*)malloc(sizeof(Node));
  x -> key = n;
  x -> next = head -> next;
  head -> next -> prev = x;
  head -> next = x;
  x -> prev = head;
}
 
void delete(int n)//m?????¢????????????????????´??????delete
{
  Node *x = search(n);
  if(x == head) return;
  x -> prev -> next = x -> next;
  x -> next -> prev = x -> prev;
}
 
void deleteFirst(){//?????????delete
  Node *x = head -> next;
  if(x == head) return;
  x -> prev -> next = x -> next;
  x -> next -> prev = x -> prev;
}
 
void deleteLast(){//?????????delete
  Node *x = head -> prev;
  if(x == head) return;
  x -> prev -> next = x -> next;
  x -> next -> prev = x -> prev;
}
 
int main()
{
  int n, i, m;
  Node *node;
  char c[20];
   
  init();
  scanf("%d", &n);

  for( i = 0; i < n; i++) {

    scanf("%s", c);

    if( strcmp(c,"insert") == 0){
      scanf("%d", &m);
      insert(m);
    }
    else if( strcmp(c,"delete") == 0){
      scanf("%d",&m);
      delete(m);
    }
    else if( strcmp(c,"deleteFirst") == 0){
      deleteFirst();
    }
    else if( strcmp(c,"deleteLast") == 0){
      deleteLast();
    }
  }
  for(node = head -> next; node != head;){
    printf("%d", node -> key);
    if((node = node -> next) != head) printf(" ");
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 34976
let readString() = stdin.ReadLine()
let readStringArray() = stdin.ReadLine().Split(' ');
let readInt() = readString() |> int
let readIntArray() = readStringArray() |> Array.map (fun x -> int x)

let x, y = readIntArray() |> fun x -> (x.[0], x.[1])


let rec same x y list= 
    match list with 
    | h :: t -> if (List.contains x h) && (List.contains y h) then true else same x y t
    | _ -> false

if same x y [[1; 3; 5; 7; 8; 10; 12]; [4; 6; 9; 11]; [2;]] then 
    "Yes"
else 
    "No"
|> printfn "%s"

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

 
int main(){

    vector<int> v2;
    vector<int> v1;

    for(int i = 0; i < 5; i++){
        int tmp;
        cin >> tmp;
        v1.push_back(tmp);
        if(tmp % 10 != 0) tmp = tmp + (10 - tmp % 10);
        v2.push_back(tmp);
    }

    int min_time = 650;

    for(int i = 0; i < 5; i++){
        for(int j = 0; j < 5; j++){
            if(i == j) continue;
            for(int k = 0; k < 5; k++){
                if(i == k || j == k) continue;
                for(int l = 0; l < 5; l++){
                    if(i == l || j == l || k == l) continue;
                    for(int m = 0; m < 5; m++){
                        if(i == m || j == m || k == m || l == m) continue;
                        min_time = min(min_time,v2[i] + v2[j] + v2[k] + v2[l] + v1[m]);
                    }
                }
            }
        }
    }

    cout << min_time << endl;

 
    return 0;
}

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

using namespace std;

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

    int k[] = { 1, 2, 4, 8, 16, 32, 64 };
    int i = 6;
    while (true) {
        if (k[i] <= n) break;
        i--;
    }

    cout << k[i] << endl;
}

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

    int n;
    cin>>n;
    int k = n/10;
    if(n-k*10 == 3){
        cout<<"bon"<<endl;
        return 0;
    }else{

    switch(n-k*10){
        case 0:
        cout<<"pon"<<endl;
        return 0;

        case 1:
        cout<<"pon"<<endl;
        return 0;

        case 6:
        cout<<"pon"<<endl;
        return 0;

        case 8:
        cout<<"pon"<<endl;
        return 0;
    }
    cout<<"hon"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#define INF 1e9
using namespace std;
long long cnt;
 
void merge(int A[],int L,int M,int R){
  int n1=M-L;
  int n2=R-M;
  int a[500000],b[500000];
  for(int i=0;i<n1;i++)a[i]=A[L+i];
  for(int i=0;i<n2;i++)b[i]=A[M+i];
  a[n1]=INF,b[n2]=INF;
  int i=0,j=0;

  for(int k=L;k<R;k++){
    if(a[i]<=b[j]) A[k]=a[i++];
    else A[k]=b[j++],cnt+=(n1-i);
  }
}
 
void mergeSort(int A[],int L,int R){
  if(L+1<R){
    int M=(L+R)/2;
    mergeSort(A,L,M);
    mergeSort(A,M,R);
    merge(A,L,M,R);
  }
}
 
int main(){
  int n, a[500000];
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  mergeSort(a,0,n);
  
  cout <<cnt<<endl;
  return 0;
}

Measured memory_bytes: 4388
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main() {
    double r;
    cin >> r;
    double area, per;
    area = r * r * 3.141592653589;
    per = 2 * 3.141592653589 * r;
    printf("%.6f %.6f\n", area, per);

    return 0;
}


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

int main(){
  	int N;
  	string S, T;
  	cin >> N >> S >> T;
  	
  	for(int i=0; i<N; i++){
    	cout << S[i] << T[i];
    }
  
  	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
#define MP make_pair
#define PB push_back
#define S(a) ((int)a.size())
typedef long long ll;

ll n, a, b;

int main () {
        scanf("%lld %lld %lld", &n, &a, &b);
        if (a>b || (a!=b&&n==1)) return puts("0"), 0;
        printf("%lld\n", 1ll + (b*(n-1)+a) - (a*(n-1)+b));
        return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n, m = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

from itertools import accumulate
cumsum_a = [0] + list(accumulate(a))
for i in range(len(cumsum_a)):
    cumsum_a[i] %= m

from collections import Counter

c = Counter(cumsum_a)

ans = 0

for i in c.keys():
    ans += c[i] * (c[i] - 1) // 2

print(ans)

Measured memory_bytes: 59940
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c;
  map<int,int>m;
  m[1]=13;
  m[13]=12;
  m[12]=11;
  m[11]=10;
  m[10]=9;
  m[9]=8;
  m[8]=7;
  m[7]=6;
  m[6]=5;
  m[5]=4;
  m[4]=3;
  m[3]=2;
  m[2]=1;
  cin>>a>>b;
  if(m[a]>m[b])
    cout<<"Alice\n";
  else if(m[b]>m[a])
    cout<<"Bob\n";
  else cout<<"Draw\n";
}


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



int main(){
    int N,M,res=0;
    cin>>N>>M;
    vector<int> H(N);
    vector<bool> good(N,true);
    for(int i=0;i<N;i++){
        cin>>H.at(i);
    }
    for(int i=0;i<M;i++){
        int A,B;
        cin>>A>>B;
        if(H.at(A-1)>H.at(B-1)){
            good.at(B-1)=false;
        }
        else if(H.at(A-1)<H.at(B-1)){
            good.at(A-1)=false;
        }
        else{
            good.at(A-1)=false;
            good.at(B-1)=false;
        }
    }
    for(int i=0;i<N;i++){
        if(good.at(i)){
            res++;
        }
    }
    cout<<res<<endl;

}

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n;
  cin >> n;
  vl p(n);
  REP(i,n) cin >> p[i];
  ll ans = 0;
  FOR(i,1,n-1){
    if((p[i-1]<p[i] && p[i]<p[i+1]) || (p[i-1]>p[i] && p[i]>p[i+1])) ans++;
  }
  cout << ans<< endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define nl printf("\n")
#define spc printf(" ")
#define sf scanf
#define pf printf
#define INF (LL)1e15
#define mod 1e9+7
#define FI freopen("input.txt","r",stdin)
#define FO freopen("output.txt","w",stdout)
///#define safeMod(a, m) ((((a)%(m))+(m))%(m))/*handling negative sign of remainder*/
///#define isValid(n,m,nx,ny)nx>=0&&nx<n&&ny>=0&&ny<m
///#define triangle_area(a,b,m,n,x,y) (a*(n-y)+m*(y-b)+x*(b-n))
///#define dis_without_sqrt(x,y,x1,y1) (x-x1)*(x-x1)+(y-y1)*(y-y1)
///int ax[]={1, 1, -1, -1, 2, 2, -2, -2}; //knight moves
///int ay[]={2,-2,  2, -2, 1,-1,  1, -1}; //knight moves
/*bool structCompare(struct_name first,struct_name second)
{
    return first.variable_name<second.variable_name //sorts element in increasing order
}*/

using namespace std;

//int dx[]={1,-1,0,0,1,-1,1,-1};//eight direction
//int dy[]={0,0,1,-1,1,-1,-1,1};//eight direction

///int setb(int n,int pos){return n=n | (1 << pos);}
///int resb(int n,int pos){return n=n & ~(1 << pos);}
///int togb(int n,int pos){return n=n ^ (1 << pos);}
///bool checkb(int n,int pos){return (bool)(n & (1 << pos)); }
///lsb T = (S & (-S)),log2(T);
///inline bool isEq(double a, double b){return abs(a - b) < eps;}
///inline bool isEq(double a, double b, double eps){return abs(a - b) < eps;}
///inline double toRad(double deg){return deg*PI/180;}
///inline double toDeg(double rad){return rad*180/PI;}

const int S=12345;
int main()
{
    //FI;
    //FO;
    //ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    while(cin>>n)
    {
        string s,ps;
        bool flag=true;
        map<string,bool>mp;
        mp.clear();
        for(int i=0;i<n;i++)
        {
            cin>>s;
            if(mp[s]==1)
            {
                flag=false;
            }
            else mp[s]=1;

            if(i==0)ps=s;
            else{
                if(ps[ps.size()-1]!=s[0])flag=false;
                ps=s;
            }
        }
        if(flag)puts("Yes");
        else puts("No");
    }
    return 0;
}







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

int main(){
  int n; cin >> n;
  int a[200010];
  for (int i = 1; i <= n; i++){
    cin >> a[i];
  }
  int b[200010];
  for (int i = 1; i <= n; i++){
    b[i] = 0;
  }
  int ans = 0;
  for (int i = n; i > 0; i--){
    int j = 1, cnt = 0;
    while (i * j <= n){
      cnt += b[i * j];
      j++;
    }
    if ((cnt - a[i]) % 2){
      b[i] = 1;
      ans++;
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++){
    if (b[i]) cout << i << " ";
  }
  cout << endl;
}

Measured memory_bytes: 2432
S=input()
T=input()
N=len(S)
L=[chr(i+97) for i in range(26)]
D=dict()
for i in range(26):
    D[L[i]]=i
A=[[] for i in range(26)]
B=[[] for i in range(26)]
for i in range(N):
    A[D[S[i]]].append(i)
    B[D[T[i]]].append(i)
X=[-1 for i in range(26)]
Y=[-1 for i in range(26)]
for i in range(26):
    for c in A[i]:
        if X[i]==-1:
            X[i]=D[T[c]]
        else:
            if X[i]!=D[T[c]]:
                print("No")
                exit()
    for c in B[i]:
        if Y[i]==-1:
            Y[i]=D[S[c]]
        else:
            if Y[i]!=D[S[c]]:
                print("No")
                exit()
print("Yes")


Measured memory_bytes: 14384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoderExamCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string tmp = Console.ReadLine();
            string[] tmpSplit = tmp.Split();
            int N = int.Parse(tmpSplit[0]);
            int K = int.Parse(tmpSplit[1]);
            bool[] flagN = new bool[N];
            
            for (int i = 0; i < K; i++)
            {
                int d = int.Parse(Console.ReadLine());
                string tmpA = Console.ReadLine();
                string[] tmpASplit = tmpA.Split();
                for (int j = 0; j < d; j++)
                {
                    int A = int.Parse(tmpASplit[j]);
                    flagN[A - 1] = true;
                }
            }

            int answer = 0;
            for (int i = 0; i < N; i++)
            {
                if (!flagN[i])
                    answer++;
            }

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 27580
#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=1e9+7 ;


void solve(string& s){
    int n=s.size();
    reverse(s.begin(),s.end());
    vector<int> cnt(11);
    cnt[0]=1;
    int sum=0;
    ll ans=0;
    rep(i,n){
        int x=s[i]-'0';
        if(i%2)x=11-x;
        sum=(sum+x)%11;
        if(s[i]!='0')ans+=cnt[sum];
        cnt[sum]++;
    }
    cout<<ans<<endl;
}
int main(){
    string s;
    while(cin>>s,s!="0")solve(s);
    return 0;
}


Measured memory_bytes: 3332
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int N, Q, a, com, l, r;
    cin >> N >> Q;
    fenwick_tree<ll> fw(N);
    rep(i,N){
        cin >> a;
        fw.add(i, a);
    }
    rep(_,Q){
        cin >> com >> l >> r;
        if(com == 0)fw.add(l, r);
        else cout << fw.sum(l,r) << endl;
    }
    return 0;
}


Measured memory_bytes: 8204
n,m=map(int,input().split())
L=[]
M=[]
for i in range(m):
  l,m=map(int,input().split())
  L.append(l)
  M.append(m)
  
a=max(L)
b=min(M)
if a<=b:
  print(b-a+1)
else:
  print(0)

Measured memory_bytes: 11088
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    string a, b, c;
    cin >> a >> b >> c;
    if (a.back() == b.front() && b.back() == c.front())
    {
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
ai = lambda: list(map(int, input().split()))

n,m = ai()
x = ai()
y = ai()
mod = 10**9+7
ans = 0

sx,ssx,sy,ssy = [x[0]], [x[-1]], [y[0]], [y[-1]]
for i in range(1, n):
    sx.append(sx[-1] + x[i])
    ssx.append(ssx[-1] + x[-i-1])
for i in range(1, m):
    sy.append(sy[-1] + y[i])
    ssy.append(ssy[-1] + y[-i-1])

a = sum(ssx[i] - sx[i] for i in range(n)) % mod
b = sum(ssy[i] - sy[i] for i in range(m)) % mod

ans = a*b % mod
print(ans)

Measured memory_bytes: 31040
K, A, B = map(int, input().split())
if B - A <= 2 or K - A < 1:
    ans = 1 + K
else:
    ans = 1
    K -= A - 1
    ans += A - 1
    if K % 2 == 0:
        ans += (B - A) * (K // 2)
    else:
        K -= 1
        ans += 1 + (B - A) * (K // 2)
print(ans)

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

int main() {
  ll a, b2;
  double b;
  cin >> a >> b;
  b2=round(b*100.00);
  //cout << b2 << endl;
  a=a*b2/100;
  cout << a << endl;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> vec(n, 0);
	for(int i = 0; i < n; ++i)cin>>vec[i];
	bool ok = true;
	for(int k = 1; k < n; ++k){
		if(vec[k] < vec[k - 1])ok = false;
	}
	if(ok){
		cout<<"YES"<<endl;
		return 0;
	}
	for(int i = 0; i < n; ++i){
		for(int j = i + 1; j < n; ++j){
			swap(vec[i], vec[j]);
			bool ok = true;
			for(int k = 1; k < n; ++k){
				if(vec[k] < vec[k - 1])ok = false;
			}
			if(ok){
				cout<<"YES"<<endl;
				return 0;
			}
			swap(vec[i], vec[j]);
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
using namespace std;
const int mod=1000000007;
typedef long long ll;
typedef pair<int,int> P;

//最大公約数 from 20190929
long long gcd(long long x, long long y) { return y ? gcd(y,x%y) : x;}

int main(){
    ll a,b,x,ans;
    cin >> a >> b;

    x = gcd(a,b);
    ans = a*b/x;

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define elnd endl //* missspell check


void solve(long long X, long long Y){
    ll res = 0;
    X--; Y--;
    res+= max(0LL, 300000-X*100000);
    res+= max(0LL, 300000-Y*100000);
    if(X==0 && Y==0)
        res += 400000;
    cout << res << endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    solve(X, Y);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer cur = nil->next;
  while(cur != nil && cur->key != key)
    cur = cur->next;
  return cur;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  if(t == nil)return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  deleteNode(nil->prev);
}

void delete(int key){
  deleteNode(listSearch(key));
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}

Measured memory_bytes: 31788
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;

int main(){
  int N;
  cin>>N;
  int t[N];
  int x[N];
  int y[N];
  t[0]=x[0]=y[0]=0;
  for(int i=0;i<N;i++){
    cin>>t[i+1]>>x[i+1]>>y[i+1];
  }
  for(int j=0;j<N;j++){
    int dt=abs(t[j+1]-t[j]);
    int dx=abs(x[j+1]-x[j]);
    int dy=abs(y[j+1]-y[j]);
    if(dt-(dx+dy)<0){
      cout<<"No"<<endl;
      return 0;
    }
    if(dt%2!=(dx+dy)%2){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
    
 
}

  
  

Measured memory_bytes: 1408
class UnionFind:  # 0-index
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n  # 親の番号 要素が根の場合は-(そのグループの要素数)を格納

    def find(self, x):  # 要素xが属するグループの根を返す
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):  # 要素xが属するグループと要素yが属するグループとを併合する
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):  # 要素xが属するグループのサイズ（要素数）を返す
        return -self.parents[self.find(x)]

    def same(self, x, y):  # 要素x, yが同じグループに属するかどうかを返す
        return self.find(x) == self.find(y)

    def members(self, x):  # 要素xが属するグループに属する要素をリストで返す
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):  # すべての根の要素をリストで返す
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):  # グループの数を返す
        return len(self.roots())

    def all_group_members(self):  # {根: [グループに含まれる要素のリスト], ...}の辞書を返す
        return {root: self.members(root) for root in self.roots()}

# ---------------------- #

n, m = (int(x) for x in input().split())
if m == 0:
    print(1)
    exit()
AB = [tuple(int(x) - 1 for x in input().split()) for _ in range(m)]
uf = UnionFind(n)
for a, b in AB:
    uf.union(a, b)

ans = 0
for root in uf.roots():
    ans = max(ans, uf.size(root))
print(ans)


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

typedef long long ll;

ll N;
vector<ll> P;
ll R;

int main() {
  cin >> N;
  P.resize(N);
  for (ll i = 0; i < N; ++i) cin >> P[i];
  for (ll i = 1; i < N - 1; ++i) {
    if ((P[i - 1] < P[i]) == (P[i] < P[i + 1])) ++R;
  }
  cout << R << endl;
  return 0;
}


Measured memory_bytes: 256
while True:
    n = int(raw_input())
    if n == 0:
        break

    a = []
    for i in range(n + 1):
        if i < n:
            a.append(map(int, raw_input().split()))
            a[i].append(sum(a[i]))
        else:
            a.append([sum([a[j][k] for j in range(n)]) for k in range(n + 1)])

    for aa in a:
        print ''.join(map(lambda x: str(x).rjust(5, ' '), aa)) + '\n',

Measured memory_bytes: 4240
N = int(input())
A = list(map(int,input().split()))
Aall = A[0]
for i in range(1,N):
    Aall ^= A[i]
import sys
flag = True
for i in range(N):
    if A[i]^Aall != A[i]:
        flag = False
        print("No")
        sys.exit()
if flag:
    print("Yes")

Measured memory_bytes: 85040
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#pragma comment(linker, "/STACK:1024000000,1024000000") 
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define EPS 1e-10
#define set0(x) memset((x),0,sizeof(x))
#define setINF(x) memset((x),63,sizeof(x))
using namespace std;
int n;
vector<int> g[100005];
int dfs(int x){
	vector<int> son;
	for(int i=0;i<g[x].size();i++){
		int u=g[x][i];
		son.push_back(dfs(u));
	}
	sort(son.begin(),son.end(),greater<int>());
	int res=0;
	for(int i=0;i<son.size();i++){
		res=max(res,i+1+son[i]);
	}
	return res;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	for(int i=1;i<n;i++){
		int x;
		cin>>x;
		g[--x].push_back(i);
	}
	cout<<dfs(0)<<endl;
	return 0;
}

Measured memory_bytes: 13568