akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define mod 1000000000
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vs vector<string>
#define psi pair<string,ll>
#define pii pair<ll,ll>
#define vsi vector<psi>
#define vii vector<pii>
#define mp make_pair
#define pb push_back
#define rep(n) for(long i=0;i<n;i++)
#define repr(n) for(long i=(n-1);i>=0;i--)
#define fori(i,a,b) for(auto i=a;i<=b;i++)
#define ford(i,b,a) for(auto i=b;i>=a;i--)
#define mset(a,i) memset(a,i,sizeof(a))
#define minv(a) min_element(a.begin(),a.end())
#define maxv(a) max_element(a.begin(),a.end())
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define sotit(a) sort(a.begin(),a.end());
#define sot(a) sort(a,a+n);
#define ff first
#define maxheap(v) priority_queue<v>
#define minheap(v) priority_queue<v, vector<v>, greater<v>>
#define ss second
#define endl "\n"
#define NL cout<<endl;
#define printmat(a,m,n) for(int i=0;i<m;i++){       \
                            for(int j=0;j<n;j++){   \
                                cout<<a[i][j]<<" "; \
                            }                       \
                            cout<<endl;             \
                        }
#define dbgn(x) cout<<" $ "<<x<<" $ "<<endl;
#define dbg(x) cout<<" $ "<<x<<" $ ";
#define all(v) v.begin(),v.end()
#define show(a,n) for(int i=0;i<n;i++){ cout<<a[i]<<" "; } NL
#define fast_io() cin.sync_with_stdio(false);cout.sync_with_stdio(false);cin.tie(NULL);
 
// lower_bound - which does not compare less than val
// upper_bound - which compares greater than val
int main() {
    fast_io()
 
    ll a,b;
    cin>>a>>b;
    if(a>=1&&b>=1&&a<=9&&b<=9){
        cout<<a*b;
    }
    else{
        cout<<-1;
    }
 
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H,K;
	string s;
	while(cin>>s) {
		s.erase(unique(ALL(s)), s.end());
		ll ans=s.size()-1;
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define repe(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF 100000000

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<ll>& vec) {
    for (ll value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    IO;

    ll N, X; cin >> N >> X;

    vector<ll> x(N), dist(N);
    rep(i, N) cin >> x[i];

    if (N == 1) {
        cout << abs(X - x[0]) << endl;
        return 0;
    }

    sort(all(x));

    ll g = x[1]-x[0];
    rep(i, N - 1) {
        g = gcd(g, x[i + 1] - x[i]);
    }

    rep(i, N) {
        dist[i] = gcd(g, abs(X - x[i]));
    }

    sort(all(dist));

    cout << dist[N - 1] << endl;

}

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

int main() {
    int H,W,N,sr,sc;
    string S,T;
    cin >> H >> W >> N;
    cin >> sr >> sc;
    cin >> S >> T;
 
    string ans;
    int rng_l=0,rng_r=W-1,rng_u=0,rng_d=H-1;
    for (int n=N-1;n>=0;--n){
        if (T[n]=='L' && rng_r<W-1) rng_r += 1;
        if (T[n]=='R' && rng_l>0) rng_l += -1;
        if (T[n]=='U' && rng_d<H-1) rng_d += 1;
        if (T[n]=='D' && rng_u>0) rng_u += -1;
        if (S[n]=='L') rng_l += 1;
        if (S[n]=='R') rng_r += -1;
        if (S[n]=='U') rng_u += 1;
        if (S[n]=='D') rng_d += -1;
        if ( rng_r-rng_l<0 || rng_d-rng_u<0 ) {
            ans="NO";
            break;
        }
    }
    if (ans.empty()) {
        if (sc-1 < rng_l || rng_r < sc-1 || sr-1 < rng_u || rng_d < sr-1 ) {
            ans="NO";
        } else {
            ans="YES";
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a-1; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define rALL(x) x.rbegin(), x.rend()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

vector<vector<char>> g;
int main(){
    ll n;   cin >> n;
    vector<ll> a(n);
    REP(i, n)   cin >> a[i];
    ll res=a.back()/2;
    a.back() %= 2;

    REPD(i, n-1){
        if(0<a[i]){
            res += (a[i]+a[i+1])/2;
            a[i] = (a[i]+a[i+1])%2;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 4024
#include<iostream>
#include<queue>
#include<vector>
#define INF 1e9
using namespace std;

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

int main(){
    int h,w; cin>>h>>w;
    char m[1005][1005];
    int d[1005][1005];
    queue<pair<int,int>> q;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>m[i][j];
            d[i][j]=INF;
            if(m[i][j]=='#'){
                q.push(make_pair(i,j));
                d[i][j]=0;
            }
        }
    }

    while(!q.empty()){
        int x=q.front().second;
        int y=q.front().first;
        q.pop();
        for(int i=0;i<4;i++){
            int nx=x+dx[i];
            int ny=y+dy[i];
            if(nx>=0&&nx<w&&ny>=0&&ny<h&&m[ny][nx]!='#'&&d[ny][nx]>d[y][x]+1){
                q.push(make_pair(ny,nx));
                d[ny][nx]=d[y][x]+1;
            }
        }
    }

    int ans=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            ans=max(ans,d[i][j]);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 13328
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	boolean ans = true;
      	int N = Integer.parseInt(sc.next());
      	Map<Integer, Integer> m = new HashMap<>();
      	for (int i = 0; i < N; i++) {
          	int d = Integer.parseInt(sc.next());
        	m.put(d, m.getOrDefault(d, 0) + 1);
        }
      	
      	int M = Integer.parseInt(sc.next());
      	for (int i = 0; i < M; i++) {
        	int t = Integer.parseInt(sc.next());
          	if (m.getOrDefault(t, 0) == 0) {
            	ans = false;
              	break;
            }
          	m.put(t, m.get(t) - 1);
        }
      	System.out.println(ans ? "YES" : "NO");
    }
}

Measured memory_bytes: 100836
n, x = map(int, input().split())

burger = [1]*(n+1)
patty = [1]*(n+1)

stopped = 0
for i in range(1,n):
	burger[i] = 2*burger[i-1]+3
	patty[i] = 2*patty[i-1]+1
	
def solve(n, x):
	if n == 0:
		if x == 0:
			return 0
		else:
			return 1
	elif n == 1:
		if x == 0:
			return 0
		elif x == 1:
			return 0
		elif x == 2:
			return 1
		elif x == 3:
			return 2
		elif x == 4:
			return 3
		else:
			return 3
	elif x == 0:
		return 0
	elif x == burger[n]:
		return patty[n]
	elif x == burger[n-1]+1:
		return patty[n-1]
	elif x == burger[n-1]+2:
		return patty[n-1]+1
	elif x < burger[n-1]+2:
		return solve(n-1, x-1)
	elif x > burger[n-1]+2:
		return solve(n-1, x-burger[n-1]-2)+patty[n-1]+1

print(solve(n, x))

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
//const ll MOD=998244353;

int N;
vector<vector<int>> G(202020);
int cnt[2],col[202020],ans[202020];
int num[3],sum[3];

void dfs(int v,int p,int d){
  cnt[d%2]++;
  col[v]=d%2;
  for(int u:G[v]){
    if(u==p) continue;
    dfs(u,v,d+1);
  }
}

void solve(int x){
  rep(i,N){
    int j=col[i];
    if(j==x){
      ans[i]=3*sum[2]+3;
      sum[2]++;
    }else{
      rep(k,3){
        if(sum[k]<num[k]){
          ans[i]=3*sum[k]+k+1;
          sum[k]++;
          break;
        }
      }
    }
  }
}

int main(){
  cin>>N;
  rep(i,N-1){
    int A,B; cin>>A>>B; A--,B--;
    G[A].push_back(B);
    G[B].push_back(A);
  }
  dfs(0,-1,0);
  
  num[0]=N/3+(N%3>0);
  num[1]=N/3+(N%3==2);
  num[2]=N/3;
  
  if(cnt[0]<=N/3) solve(0);
  else if(cnt[1]<=N/3) solve(1);
  else{
    rep(i,N){
      int j=col[i];
      if(sum[j]<num[j]){
        ans[i]=3*sum[j]+j+1;
        sum[j]++;
      }else{
        ans[i]=3*sum[2]+3;
        sum[2]++;
      }
    }
  }
  rep(i,N) cout<<ans[i]<<" ";
  cout<<endl;
  return 0;
}

Measured memory_bytes: 19072
# A=gets.to_i
# B=gets.split.map(&:to_i)
# C=N.times.map{gets.to_i}
# D=N.times.map{gets.split.map(&:to_i)}
# S=gets.chomp
# MOD=1000000007

N=gets.to_i
ss=N.times.map{gets.chomp.each_char.sort.join("")}.sort


count=1
old=""
ans=0
ss.each do |s|
  if old==s
    count+=1
  else
    if count>=2
      ans+=count*(count-1)/2
    end
    count=1
  end
  old=s
end
if count>=2
  ans+=count*(count-1)/2
end

puts ans

Measured memory_bytes: 28024
if __name__ == '__main__':
    w = (int)(input())
    n = (int)(input())
    a = [i+1 for i in range(0,w)]
    for i in range(n):
        x,y = map(int,input().split(","))
        a[x-1],a[y-1] = a[y-1],a[x-1]
    for x in a:
        print(x)

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

int main ()
{
    int N;
    int A[1010];
    cin >> N ;
    for(int k=0;k<N;k++){
        cin >> A[k];
    }
    int v,j;
    for(int i=0;i<N;i++){
        v=A[i];
        j=i-1;
        while(j>=0 && A[j]>v){
            A[j+1]=A[j];
            j--;
        }
        A[j+1]=v;
        for(int k=0;k<N;k++){
            if(k==N-1) cout << A[k] << endl;
            else if(k!=N-1) cout << A[k] << " ";
        }
    }
}










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

int main() {
    string memo;
    int price = 700;
    cin >> memo;
    if (memo[0] == 'o') price += 100;
    if (memo[1] == 'o') price += 100;
    if (memo[2] == 'o') price += 100;
    cout << price << endl;
}

Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll sum(ll n) {
	ll res = 0;
	while(n != 0) {
		res += n % 10;
		n /= 10;
	}
	return res;
}

ld f(ll n) {
	return (ld)n / (ld)sum(n);
}

void solve() {
	int k; cin >> k;
	vector<ll> cand;
	int tmp = 1LL;
	rep(j, 16) {
		for(int i = 1; i <= 150; ++ i) {
			int res = tmp * (ll)i - 1;
			if(res == 0) continue;
			cand.push_back(res);
		}
		tmp *= 10LL;
	}
	sort(all(cand));
	cand.erase(unique(all(cand)), cand.end());
	reverse(all(cand));
	vector<int> ans;
	ld now = INF;
	for(int x: cand) {
		if(now >= f(x)) {
			now = f(x);
			ans.pb(x);
		}
	}
	sort(all(ans));
	ans.erase(unique(all(ans)), ans.end());
	rep(i, k) {
		cout << ans[i] << endl;
	}
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int H, W;
	cin >> H >> W;

	vector <string> s(H);
	for (int ii = 0; ii < H; ++ii){
		cin >> s[ii];
	}

	vector<vector<int>> dp(H, vector <int> (W, 0));

	//スタート地点の処理
	dp[0][0] = (s[0][0]=='.') ? 0 : 1;

	//列0の処理
	for (int h = 1; h < H; ++h){
		dp[h][0] = dp[h-1][0];
		if ( (s[h-1][0]=='.') && (s[h][0]=='#') ){
			dp[h][0]++;
		}
	}

	//行0の処理
	for (int w = 1; w < W; ++w){
		dp[0][w] = dp[0][w-1];
		if ( (s[0][w-1]=='.') && (s[0][w]=='#') ){
			dp[0][w]++;
		}
	}

	//残りのマスの処理
	for (int h = 1; h < H; ++h){
		for (int w = 1; w < W; ++w){
			int up = dp[h-1][w];
			if ( (s[h-1][w]=='.') && (s[h][w]=='#') ){
				up++;
			}
			int left = dp[h][w-1];
			if ( (s[h][w-1]=='.') && (s[h][w]=='#') ){
				left++;
			}
			dp[h][w] = min(up, left);
		}
	}

	int ans = dp[H-1][W-1];
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	if(n%2==1){
		cout << 0;
		return 0;
	}
	ll ans1=0;
	ll ans2=0;
	ll cnt=5;
	while(cnt<=n){
		ans1+=n/cnt;
		if(n/cnt!=0){
			ll nex=n/cnt;
			ans2+=(nex+2-1)/2;
		}
		cnt*=5;
	}
	cout <<ans1-ans2;
	// your code goes here
	return 0;
}

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

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

using namespace std;

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

	int arb=0;
	bool color[8]={};
	rep(i,n){
		int a; cin>>a;
		if(a<3200) color[a/400]=true;
		else       arb++;
	}

	int c=count(color,color+8,true);
	cout<<max(c,1)<<' '<<c+arb<<endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int ans = 0;
	for (int i = a; i <= b; i++) {
		if (c % i == 0)ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3092
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
	int n,k,q;
	cin>>n>>k>>q;
	vi p(n,k-q);
	rep(i,q){
		int a;
		cin>>a;
		p[--a]++;
	}
	rep(i,n)Yes(p[i]>0);
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define rall(c) c.rbegin(), c.rend()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
#define init(a, x) memset(a,x,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)
const int L=1e6+7;
map<ll,ll> counter;
ll fastexpo(ll x,ll y,ll m)
{
	ll temp=1;
	while(y>0)
	{
		if(y&1)temp = ((temp%m)*(x%m))%m;
		x = ((x%m)*(x%m))%m;
		y>>=1;
	}return temp;
}
void fff()
{
	ll n, k;
	cin >> n >> k;
	ll ans = n%k;
	ans = min(ans, abs(n%k - k));
	cout<<ans<<ln;	
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//int t;cin >> t;while(t--)
	fff();
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
#define QMAX 15000
typedef struct { int t, s; } QUE;
QUE que[QMAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
	que[0] = que[--qsize];
	min_heapify(0);
}

void enq(int s, int t)
{
	int i, min;
	QUE qt;

	i = qsize++;
	que[i].s = s, que[i].t = t;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		i = min;
	}
}

#define INF   0x30303030
#define MAX_V 102
int hi[MAX_V], *to[MAX_V], *dd[MAX_V];
int dist[MAX_V];

void dijkstra(int n, int start)
{
	int i, s, e, t, nt;

	memset(dist, INF, n << 2);
	qsize = 0;
	dist[start] = 0, enq(start, 0);
	while (qsize) {
		s = que[0].s, t = que[0].t, deq();
		if (dist[s] < t) continue;
		for (i = 0; i < hi[s]; i++) {
			e = to[s][i], nt = t + dd[s][i];
			if (dist[e] > nt) dist[e] = nt, enq(e, nt);
		}
	}
}

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
 
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}
 
int main()
{
	int n, i, j, k, u;
 
	n = in();
	for (i = 0; i < n; i++) {
		u = in(), hi[u] = k = in();
		to[u] = malloc(k<<2);
		dd[u] = malloc(k<<2);
		for (j = 0; j < k; j++) {
			to[u][j] = in(), dd[u][j] = in();
		}
	}
	dijkstra(n, 0);
	for (i = 0; i < n; i++) printf("%d %d\n", i, dist[i]);
	return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

template<int M>
struct ModInt {
public:
	using value_type = long long;
	
	ModInt(value_type val = 0) : val(val < 0 ? (M - (-val % M)) % M : val % M) {}
	
	explicit operator bool() const noexcept { return val; }
	bool operator ==(const ModInt & rhs) const noexcept { return val == rhs.val; }
	bool operator !=(const ModInt & rhs) const noexcept { return !(*this == rhs); }
	ModInt operator +() const noexcept { return ModInt(*this); }
	ModInt operator -() const noexcept { return ModInt(0) -= *this; }
	ModInt operator +(const ModInt & rhs) const noexcept { return ModInt(*this) += rhs; }
	ModInt operator -(const ModInt & rhs) const noexcept { return ModInt(*this) -= rhs; }
	ModInt operator *(const ModInt & rhs) const noexcept { return ModInt(*this) *= rhs; }
	ModInt operator /(const ModInt & rhs) const noexcept { return ModInt(*this) /= rhs; }
	
	ModInt & operator +=(const ModInt & rhs) noexcept {
		val += rhs.val;
		if (val >= M) val -= M;
		return *this;
	}
	ModInt & operator -=(const ModInt & rhs) noexcept {
		if (val < rhs.val) val += M;
		val -= rhs.val;
		return *this;
	}
	ModInt & operator *=(const ModInt & rhs) noexcept {
		val = val * rhs.val % M;
		return *this;
	}
	ModInt & operator /=(const ModInt & rhs) noexcept {
		*this *= rhs.inverse();
		return *this;
	}
	
	ModInt pow(value_type n) const {
		ModInt res = 1, x = val;
		if (n < 0) { x = x.inverse(); n = -n; }
		while (n) { if (n & 1) res *= x; x *= x; n >>= 1; }
		return res;
	}
	
	ModInt inverse() const {
		long long a = val, a1 = 1, a2 = 0, b = M, b1 = 0, b2 = 1;
		while (b > 0) {
			value_type q = a / b, r = a % b;
			value_type nb1 = a1 - q * b1, nb2 = a2 - q * b2;
			a = b; b = r;
			a1 = b1; b1 = nb1;
			a2 = b2; b2 = nb2;
		}
		assert(a == 1);
		return a1;
	}
	
	const value_type & get() const noexcept { return val; }
	static decltype(M) get_mod() noexcept { return M; }
	
	friend std::ostream & operator <<(std::ostream & os, const ModInt & rhs) { return os << rhs.val; }
	friend std::istream & operator >>(std::istream & is, ModInt & rhs) {
		value_type x;
		is >> x;
		rhs = ModInt(x);
		return is;
	}
private:
	value_type val;
};
using mint = ModInt<MOD>;

mint dp[1123456][4];

int main() {
	int N;
	cin >> N;
	dp[0][0] = 1;
	REP(i, N) REP(j, 4) {
		dp[i + 1][j | 1] += dp[i][j];
		dp[i + 1][j | 2] += dp[i][j];
		FOR(k, 1, 9) dp[i + 1][j] += dp[i][j];
	}
	mint ans = dp[N][3];
	// REP(i, 3) ans += dp[N][i];
	cout << ans << endl;
	return 0;
}


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

using namespace std;

int main(void){
    unsigned long long A, B, C;
    int K;
    cin >> A >> B >> C >> K;
    unsigned long long D = max(A, max(B, C));
    unsigned long long E = max(A, max(B, C));
    for(int i=0;i<K;i++) D *= 2;
    unsigned long long ans = A+B+C+D-E;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#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;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(ll i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=200010;
const ll mod=1e9+7;


int main(){
  int n;
  cin >> n;
  vector<ll> a(3*n);
  priority_queue<ll,vector<ll>,greater<ll>> q1;
  priority_queue<ll> q2;
  ll sumz=0, sumk=0;
  rep(i,3*n){
    cin >> a[i];
    if(i<n){
      q1.push(a[i]);
      sumz += a[i];
    }
    if(2*n<=i){
      q2.push(a[i]);
      sumk += a[i];
    }
  }
  vector<ll> z(3*n);
  vector<ll> k(3*n);
  z[n-1] = sumz;
  REP(i,n,2*n){
    q1.push(a[i]);
    auto p = q1.top(); q1.pop();
    sumz += a[i] - p;
    z[i] = sumz;
  }

  k[2*n] = sumk;
  for(int i=2*n-1; i>=n; i--){
    q2.push(a[i]);
    auto p = q2.top(); q2.pop();
    sumk += a[i] - p;
    k[i] = sumk;
  }

  ll ans = -longinf;
  REP(i,n-1,2*n){
    ans = max(ans, z[i]-k[i+1]);
  }
  cout << ans << ln;
  return 0;
}

Measured memory_bytes: 11848
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 100;
int main()
{
	int n, dimen[N + 1], cost[N + 1][N + 1];
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> dimen[i - 1] >> dimen[i];
	for (int i = 1; i <= n; i++)
		cost[i][i] = 0;
	for (int cnt = 2; cnt <= n; cnt++)
	{
		for (int i = 1; i <= n - cnt + 1; i++)
		{
			int j = i + cnt - 1;
			cost[i][j] = (1 << 21);
			for (int k = i; k <= j - 1; k++)
				cost[i][j] = min(cost[i][j], cost[i][k]+cost[k + 1][j] + dimen[i - 1] * dimen[k] * dimen[j]);
		}
	}
	cout << cost[1][n] << endl;
}


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

int div_row[8] = {-1,-1,-1,0,0,1,1,1},div_col[8] = {-1,0,1,-1,1,-1,0,1},H,W;


int main(){

	int work_row,work_col,max_length;
	char table[10][21];
	string ans;

	set<string> SPELL;

	while(true){
		cin >> H >> W;
		if(H == 0 && W == 0)break;

		SPELL.clear();
		ans = "0";

		for(int i = 0; i < H; i++){
			for(int k = 0; k < W; k++)cin >>table[i][k];
		}

		max_length = 2;

		for(int row = 0; row < H; row++){
			for(int col = 0; col < W; col++){
				for(int a = 0; a < 8; a++){

					string work;
					work += table[row][col];

					work_row = (row + div_row[a]+H)%H;
					work_col = (col + div_col[a]+W)%W;

					while(work_row != row || work_col != col){
						work += table[work_row][work_col];

						if(SPELL.find(work) != SPELL.end()){
							if(work.length() > max_length){
								max_length = work.length();
								ans = work;
							}else if(work.length() == max_length){
								if(work < ans){
									ans = work;
								}
							}
						}else{
							SPELL.insert(work);
						}
						work_row = (work_row + div_row[a]+H)%H;
						work_col = (work_col + div_col[a]+W)%W;
					}
				}
			}
		}

		cout << ans << endl;

	}

	return 0;
}

Measured memory_bytes: 35672
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;


int main(){
    int X, Y, Z; cin >> X >> Y >> Z;
    X -= Z;
    cout << X / ( Y + Z) << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b);
#define chmin(a, b) a = min(a, b);
using namespace std;
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;

struct trie {
    int d[26] = {0};
    trie* nxt[26] = {NULL};
};

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    sort(s.begin(), s.end(), [](string& s1, string& s2) {
        return s1.size() < s2.size();
    });
    rep(i, n) reverse(s[i].begin(), s[i].end());
    trie t;
    trie *head = &t;
    ll ans = 0;
    rep(i, n) {
        trie* now = head;
        int waiting[26] = {0};
        rep(j, s[i].size()) {
            // j ... next to read
            rep(x, 26) waiting[x] += now->d[x];
            int ci = s[i][j] - 'a';
            ans += waiting[ci];
            waiting[ci] = 0;
            if (j + 1 == s[i].size()) {
                // next is the last
                now->d[ci] += 1;
            }
            if (now->nxt[ci] == NULL) {
                now->nxt[ci] = new trie;
            }
            now = now->nxt[ci];
        }
    }
    //rep(i, 26) cout << char('a'+i) << ' ' << head->d[i] << endl;
    cout << ans << endl;
}


Measured memory_bytes: 317020
#include <iostream>
using namespace std;
int main(){
    int N;
    cin>>N;
    int answer=0;
    for(int i=1;i<10;i++){
        for(int j=1;j<10;j++){ 
            for(int k=1;k<10;k++){
            if(i==j&&j==k){
              answer=(i*100)+(j*10)+(k); 
            }
            if(answer>=N)break;
            }
        }
    }
    cout<<answer<<endl; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int n; cin >> n;
  ll ans = 0;//1, 0, 1, 0, 2
  char temp[10] = {'M', 'A', 'R', 'C', 'H'};
  map<char, int> m;
  rep(i, n){
    string t; cin >> t;
    char c = t[0];
    for(int j = 0; j < 5; j++){
      if(c == temp[j]){
        m[c]++;
      }
    }
  }
  
  for(int i = 0; i < 3; i++){
    for(int j = i+1; j < 4; j++){
      for(int k = j+1; k < 5; k++){
        ll t = 1;
        t *= m[temp[i]];
        t *= m[temp[j]];
        t *= m[temp[k]];
        ans += t;
      }
    }
  }
  cout << ans << endl;
  system("pause");
}


Measured memory_bytes: 504
mod = 10**9+7

n,m = map(int,input().split())

s = list(map(int,input().split()))

s.sort()

s = [None] + s

dp = [[0 for i in range(m+1)] for j in range(n+1)]
dp[1] = [i % s[1] for i in range(m+1)]

for i in range(2,n+1):
    for j in range(m+1):
        dp[i][j] = (dp[i-1][j] * (i-1) + dp[i-1][j%s[i]]) % mod
print(dp[n][m])

Measured memory_bytes: 257928
import sys
n,m = map(int,input().split())
ans = [-1 for i in range(n)]
if n == 1:
    if m == 0:
        print(0)
        sys.exit()
    else:
        for i in range(m):
            s,c = map(int,input().split())
            if ans[s-1] == -1:
                ans[s-1] = c
            else:
                if c == ans[s-1]:
                    continue
                else:
                    print(-1)
                    sys.exit()
        print(ans[0])
else:
    for i in range(m):
        s,c = map(int,input().split())
        if s-1 == 0:
            if c == 0:
                print(-1)
                sys.exit()
            else:
                if ans[s-1] == -1:
                    ans[s-1] = c
                else:
                    if c == ans[s-1]:
                        continue
                    else:
                        print(-1)
                        sys.exit()
        else:
            if ans[s-1] == -1:
                    ans[s-1] = c
            else:
                if c == ans[s-1]:
                        continue
                else:
                    print(-1)
                    sys.exit()
    if ans[0] == -1:
        ans[0] = 1
    for i in range(n):
        if ans[i] == -1:
            ans[i] = 0
    ans2 = ""
    for i in range(n):
        ans2 += str(ans[i])
    print(ans2)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,h,w; cin >> n >> h >> w;
	int ans=0;
	for(int i=0;i<n/2;i++){
		int x,y; cin >> x >> y;
		y=w-y;
		ans+=(min(x,y)+w-max(x,y))*h;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3232
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b=LI()
  for i in range(100000):
    _a=i*0.08
    _b=i*0.1

    # print(int(_a),int(_b))

    if int(_a)==a and int(_b)==b:
      return i

  return -1

# main()
print(main())


Measured memory_bytes: 5716
#include <stdio.h>

int main(void)
{
	int n;
	int pm;
	int pe;
	int pj;
	int i;
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		for (i = 0; i < n; i++){
			scanf("%d %d %d", &pm, &pe, &pj);
			
			if (pm == 100 || pe == 100 || pj == 100){
				printf("A\n");
			}
			else if ((pm + pe) / 2.0 >= 90){
				printf("A\n");
			}
			else if ((pm + pe + pj) / 3.0 >= 80){
				printf("A\n");
			}
			else if ((pm + pe + pj) / 3.0 >= 70){
				printf("B\n");
			}
			else if ((pm + pe + pj) / 3.0 >= 50 && (pm >= 80 || pe >= 80)){
				printf("B\n");
			}
			else {
				printf("C\n");
			}
		}
	}
	return (0);
}

Measured memory_bytes: 584
/* ex3_3
	kanon */

#include <stdio.h>

int main(void)
{

    //与えられる値を入れる変数を宣言
    int N, K;

    //変数に値を入力する
    scanf("%d %d", &N, &K);

    //logを用いてNをK進法で表したときの桁数を計算する
    int answer=log(N)/log(K)+1;

    printf("%d",answer);

    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String n= scan.next();
		if (n.charAt(n.length()-1) == 's') {
			System.out.println(n + "es");
			return;
		} else {
			System.out.println(n + "s");
			return;
		}
	}

}

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

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

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

int main()
{
    ll a, b;
    cin >> a >> b;
    ll ans = lcm(a, b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := newIo()
	defer io.flush()

	n := io.nextInt()
	var fmHf, ltHf []int

	for i := range make([]bool, n) {
		a := io.nextInt()
		if n%2 != i%2 {
			fmHf = append(fmHf, a)
		} else {
			ltHf = append(ltHf, a)
		}
	}

	for i := len(fmHf) - 1; i >= 0; i-- {
		io.print(fmHf[i], " ")
	}
	for i, v := range ltHf {
		if i != 0 {
			io.print(" ")
		}
		io.print(v)
	}
	io.println()
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *io) flush() {
	_ = io.writer.Flush()
}

func (io *io) nextLine() string {
	var buffer []byte
	for {
		line, isPrefix, _ := io.reader.ReadLine()
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) nextString() string {
	for io.nextToken >= len(io.tokens) {
		line := io.nextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) nextInt() int {
	i, _ := strconv.Atoi(io.nextString())
	return i
}

func (io *io) print(a ...interface{}) {
	fmt.Fprint(io.writer, a...)
}

func (io *io) println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *io) printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}


Measured memory_bytes: 16768
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F;
		var h = G;
		var dp = new int[N];
		dp[N - 2] = Abs(h[N - 2] - h[N - 1]);
		for (var i = N - 3; i >= 0; i--) dp[i] = Min(Abs(h[i] - h[i + 1]) + dp[i + 1], Abs(h[i] - h[i + 2]) + dp[i + 2]);
		WriteLine(dp[0]);
	}
}


Measured memory_bytes: 20064
#include<cstdlib>
#include<iostream>

using namespace std;

int main()
{
	int n,y,m1,m2,m3;
	cin >> n >> y;
	int i,j;
	bool flag;
	flag=false;
	for (i=0;i<=n;i++)
	  for (j=0;j<=n;j++)
	     if (((i*10000+j*5000+(n-i-j)*1000)==y) and (n-i-j>=0))
	        {
	        	flag=true;
	        	m1=i;
	        	m2=j;
	        	m3=n-i-j;
	        	break;
			}
	if (flag) cout << m1 << " " << m2 << " " << m3;
	    else cout << "-1 -1 -1";
	return 0;	 		
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;
    vector<ll> l(n);
    rep(i,n) cin>>l[i];
    sort(begin(l),end(l),greater<ll>());
    ll ans=0;
    rep(i,k) ans+=l[i];
    cout<<ans<<endl;
}

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

int A[50][50];
int B[50][50];

bool check(int i,int j,int N,int M){
  for(int k=0;k<M;k++)
    for(int l=0;l<M;l++)
      if(A[i+k][j+l]!=B[k][l])
	return false;
  return true;
}

int main(){
  int N,M;
  cin>>N>>M;
  string str;
  
  for(int i=0;i<N;i++){
    cin>>str;
    for(int j=0;j<N;j++)
      if(str[j]=='#')
	A[i][j]=1;
  }
  for(int i=0;i<M;i++){
    cin>>str;
    for(int j=0;j<M;j++)
      if(str[j]=='#')
	B[i][j]=1;
  }
  int matchFlg=false;
  for (int i=0;i<N;i++)
    for(int j=0;j<N;j++)
      if(check(i,j,N,M))
	matchFlg=true;
  if(matchFlg)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
  int n; cin >> n;
  string s; cin >> s;
  int r = 0;
  for (int i = 0; i < n; ++i) if (s[i] == 'R') r++;
  int ans = 0;
  for (int i = 0; i < r; ++i) if (s[i] == 'W') ans++;
  cout << ans << endl;
}

Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define rep(i, a, b) for(int i = a; i < b; ++i)

int debug = 0;

const int N = 3e5;
int n, INF = 1e15;
int a[N], dp[N][2];

int get_dp(int n, int k) {
    if (n < 0) {
        return 0;
    }
    if (k == n / 2) {
        return dp[n][0];
    } else if (k == n / 2 + 1) {
        return dp[n][1];
    } else if (k > n / 2 + 1) {
        return -INF;
    }
}

main() {
    cin >> n;
    rep(i, 1, n + 1) {
        cin >> a[i];
    }
    dp[0][0] = 0;
    dp[0][1] = -INF;
    int OddFlag = n % 2;
    rep(i, 1, n + 1) rep(k, i/2, i/2 + 2) {
        dp[i][k - i/2] = max(get_dp(i - 2, k - 1) + a[i], get_dp(i - 1, k));
        if (debug) {
            printf("i: %d   K: %d dp: %d\n", i, k, dp[i][k]);
        }
    }
    cout << dp[n][0] << endl;
}

Measured memory_bytes: 8328
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    map<int,vector<int>> mp;
    rep(i,n) mp[a[i]].push_back(i);
    int cnt = 0, now = -1;
    while (cnt < n) {
        if (mp[cnt+1].empty()) break;
        int j = 0;
        while (j < mp[cnt+1].size() && mp[cnt+1][j] <= now) j++;
        if (mp[cnt+1][j] <= now) break;
        now = mp[cnt+1][j];
        cnt++;
    }
    int ans = (cnt == 0) ? -1 : n - cnt;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 25912
A = input().split(' ')
S = []
operator = ''
operand_1 = ''
operand_2 = ''

def operate(operator, operand_1, operand_2):
    if operator == '+':
        return operand_1 + operand_2
    
    elif operator == '-':
        return operand_1 - operand_2
    
    elif operator == '*':
        return operand_1 * operand_2

for i in range(len(A)):
    v = A[i]
    if v == '+' or v == '-' or v == '*':
        S.append(v)
        operator = S.pop()
        operand_2 = int(S.pop())
        operand_1 = int(S.pop())
        S.append(operate(operator, operand_1, operand_2))
        
    else:
        S.append(v)

print(str(S[0]))


Measured memory_bytes: 5600