akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
ll count(ll x) {
  ll i = -1, s = 0;
  while (s <= x) {
    i++;
    s += (i + 1);
  }
  // cerr << i << endl;
  return i;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  vector<pair<ll, ll>> fac;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      auto p = pair<ll, ll>(i, 0);
      while (n % i == 0) {
        p.second++;
        n /= i;
      }
      fac.push_back(p);
    }
  }
  // for (int i = 1; i < 41; i++) {
  //   cerr << i << ":" << count(i) << endl;
  // }
  if (n != 1) {
    fac.push_back(pair<ll, ll>(n, 1));
  }
  ll ans = 0;
  for (auto &p : fac) {
    ans += count(p.second);
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3648
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define mod ((ull)1e9+7)
//#define MAX ((ull)1e9)
#define MAX ((int)1e5)

int main(){
	int oc[MAX+1], ec[MAX+1];
	for(int i=0; i<MAX+1; i++){
		oc[i]=0; ec[i]=0;
	}

	int n;
	cin >> n;
	int m=n/2;
	int oc1=0, oc2=0, ec1=0, ec2=0;
	for(int i=0; i<m; i++){
		int ov, ev;
		cin >> ov >> ev;
		oc[ov]++; ec[ev]++;
		if(oc[oc1]<oc[ov]) oc1=ov;
		if(ec[ec1]<ec[ev]) ec1=ev;
	}
	for(int i=0; i<MAX+1; i++){
		if(oc[oc2]<oc[i] && i!=oc1) oc2=i;
		if(ec[ec2]<ec[i] && i!=ec1) ec2=i;
	}

	int ans=n-oc[oc1]-ec[ec1];
	if(oc1==ec1){
		if(oc[oc1]>ec[ec1]) ans=n-oc[oc1]-ec[ec2];
		else if(oc[oc1]<ec[ec1]) ans=n-oc[oc2]-ec[ec1];
		else{
			ans=min(n-oc[oc1]-ec[ec2], n-oc[oc2]-ec[ec1]);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	long long int  a, b = 0, c = 0, count = 0, ans = 0, n = 0,t[50];
	string s[50],x;
	vector<int> v;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> s[i] >> t[i];
	}
	cin >> x;
	for (int i = 0; i < n; i++)
	{
		if (x == s[i])count = i;
	}
	for (int i = count+1; i < n; i++)
	{
		ans += t[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 764
#include<stdio.h>
int main(void){
	int i,j,n,q,left,right,mid,S[100000],T[50000],C=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&S[i]);
	}
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&T[i]);
	}
	
	for(i=0;i<q;i++){
		left=0;
		right=n;
		while(left<right){
			mid=(left+right)/2;
			if(S[mid]==T[i]){
				C++;
				break;
			}else if(T[i]<S[mid]){
				right=mid;
			}else{
				left=mid+1;
			}
		}
	}
	
	printf("%d\n",C);
	return 0;
}


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

#define REP(i, a) for(int64 i = 0; i < (a);i++)
#define FOR(i, a, b) for(int64 i = (a); i < (b); i++)
#define INF (int64)1e9
#define INF_LL (int64)1e18
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int32_t;
using int64 = int64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

template<typename A, typename B> inline void chmin(A &a, B b) { if (a > b) a = b;}
template<typename A, typename B> inline void chmax(A &a, B b) { if (a > b) a = b;}

template<typename CommutativeMonoid>
class FenwickTree{
public:
  using value_structure = CommutativeMonoid;
  using value_type = typename CommutativeMonoid::value_type;
  using size_type = ::std::size_t;

private:
  ::std::vector<value_type> tree;
  size_type N;

  static value_type calc(const value_type& a, const value_type& b){
    return value_structure::operation(a, b);
  }

public:
  FenwickTree(){}
  FenwickTree(const size_type& N):N(N+10), tree(N+11, value_structure::identity()){}
  FenwickTree(const FenwickTree& bit):tree(bit.tree), N(bit.N){}

  void update(size_type k, const value_type& diff){ // update k in [1, N]
    for(;k <= N;k += k & -k){
      tree[k] = calc(tree[k], diff);
    }
  }

  value_type query(size_type k) const { // sum of [1, k]
    value_type res = value_structure::identity();
    for(;k > 0;k -= k & -k){
      res = calc(res, tree[k]);
    }
    return res;
  }

  void updatez(size_type k, value_type v){ // 0-indexed
    update(k+1, v);
  }

  value_type queryz(size_type k) const { // [0, k)
    return query(k);
  }

  size_type search(const std::function<bool(value_type)>& f) const { // Find k :[0, k) -> True, [0, k-1) -> False
    if(f(value_structure::identity()))
      return 0;
    if(!f(query(N)))
      return N+1;
    value_type x = value_structure::identity();
    size_type k = 1, idx = 0;
    while(k <= N) k <<= 1;
    k >>= 1;
    for(;k > 0;k >>= 1){
      if((idx|k) <= N && !f(tree[idx|k]+x))
        x = calc(x, tree[idx |= x]);
    }
    return idx+1;
  }

  size_type size() const {return N;}
};

class v_monoid {
public:
  using value_type = int64;
  static const value_type identity() { return 0; }
  static const value_type operation(const value_type& a, const value_type& b) {
    return a + b;
  }
};

int main(void) {
  int64 N;
  cin >> N;
  vector<PII> a(N);
  REP(i, N) {
    cin >> a[i].fs; a[i].sc = i+1;
  }
  cout << min_element(all(a))->sc << endl;
}




Measured memory_bytes: 3620
import scala.io.StdIn._
object Main extends App{
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  if(n<1200){
    print("ABC")
  }
  else if(n<2800){
    print("ARC")
  }
  else{
    print("AGC")
  }
}

Measured memory_bytes: 25524
#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<iostream>
#define pb push_back
#define fi first
#define se second
#define sz(x)  x.size()
#define cl(x)  x.clear()
#define all(x)  x.begin() , x.end()
#define r(x)  scanf("%d", &x)
#define rr(x , y)  scanf("%d%d" , &x , &y)
#define rst(s)  scanf("%s" , s)
#define rl(x)  scanf("%lld" , &x)
#define rrl(x , y)  scanf("%lld%lld" , &x , &y)
#define w(x)  printf("%d" , x)
#define ww(x , y)  printf("%d %d" , x , y)
#define wl(x)  printf("%lld" , x)
#define wwl(x , y)  printf("%lld %lld" , x , y)
#define sp()  printf(" ")
#define en()  puts("")
#define rep(i , x , n)  for(int i = x ; i <= n ; i ++) 
#define per(i , n , x)  for(int i = n ; i >= x ; i --) 
#define mem0(x)  memset(x , 0 , sizeof(x))
#define mem_1(x)  memset(x , -1 , sizeof(x))
#define mem_inf(x)  memset(x , inf , sizeof(x))
#define mem__inf(x)  memset(x , -inf , sizeof(x))
#define p_queue priority_queue
#define debug(x)  cout << x << '\n'
#define ddebug(x , y)  cout << x << ' ' << y << '\n'
using namespace std ;
//mt19937  rnd(chrono::high_resolution_clock::now().time_since_epoch().count()) ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair<int , int> pii ;
typedef pair<ll , ll> pll ;
typedef pair<int , ll> pil ;
typedef pair<ll , int> pli ;
const int inf = 0x3f3f3f3f ;
const int maxn = 1e5 + 5 ;
const int maxm = 30 ;
const ll mod = 1e9 + 7 ;
int n , m ;
int a[maxn] ; 
int main()
{
	rr(n , m) ;
	rep(i , 1 , m)  r(a[i]) ;
	int sum = 0 ;
	rep(i , 1 , m)
	{
		sum += a[i] ;
		if(sum > n)  {puts("-1") ; return 0 ;}
	}
	w(n - sum) , en() ;
	return 0 ;
}

Measured memory_bytes: 3800
import java.util.Scanner;

public class Main {
    public static void main(String[] args)
    {
        Scanner inputs = new Scanner(System.in);
        int n = inputs.nextInt();
        int x = inputs.nextInt();
        int t = inputs.nextInt();

        int takoyakiMade = 0;
        int timeTook = 0;
        do {
            timeTook += t;
            takoyakiMade += x;
        } while(takoyakiMade < n);
        System.out.println(timeTook);
    }
}


Measured memory_bytes: 35724
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(ll i = b; i <= e; i++)
#define Repr(e, b, i) for(ll i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define uniq(x) (x).erase(unique(all(x)),(x).end())

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<31-1;
const int MOD = 1000000007;

ll kaijo(ll x){
    ll tmp = 1LL;
    Repr(x, 1, xx) tmp = (tmp * xx) % MOD;
    return tmp;
}

void solve(void){
    ll N, M, ans = 0;
    cin >> N >> M;
    if (abs(N-M) >= 2) ans = 0;
    else if(abs(N-M) == 1) {
        ans = (kaijo(N)*kaijo(M))%MOD;
    }
    else ans = (kaijo(N)*kaijo(N)*2)%MOD;
    cout << ans << '\n';
}

int main(void){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

using ll = long long;
using P = pair<int, int>;

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

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  string s;
  cin >> s;

  // 解答
  cout << "2018" << s.substr(4) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	char str[100];
	int i,j,n,flag=0,count=0;
	long long int sum=0;
	long long int ten=1;
	for(;scanf("%s",str)!=EOF;){
		for(i=0;str[i]!='\0';i++){
			if(flag)count++;
			if(flag==0 && str[i]>='0'&&str[i]<='9')flag=1;
			if(flag==1 && !(str[i]>='0'&&str[i]<='9')){
				for(j=1;j<=count;j++){
					sum+=(long long)((str[i-j]-'0')*(long long)ten);
					ten*=10;
				}
				ten=1;
				flag=0;
				count=0;
			}
		}
		if(flag==1){
			count++;
			for(j=1;j<=count;j++){
				sum+=(long long)((str[i-j]-'0')*(long long)ten);
				ten*=10;
			}
			ten=1;
			flag=0;
			count=0;
		}
	}
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>   
using namespace std;   
typedef long long ll;
ll n, a[100001]; 
ll mod = 1e9+7;
int main()  
{   
    cin.tie(0); ios::sync_with_stdio(false);  
	//freopen("input.txt", "rt", stdin);
	cin >> n;
	if (n % 2 == 1) {
		ll evencount[n/2];
		memset(evencount, 0, sizeof(evencount));
		ll ans = 1;
		ll zerocount = 0;
		for (ll i = 0; i < n; i++) {
			ll t; cin >> t;
			if (t == 0) {
				zerocount++;
			}
			else 
				evencount[t/2-1]++;
		}
		for (ll i = 0; i < n/2; i++) {
			ans = ((ans%mod)*(evencount[i]%mod))%mod;	
		}
		if(zerocount > 1)
			cout << 0 << "\n";
		else
			cout << ans%mod << endl;	
	}
	else  {
		ll oddcount[n/2];
		ll onecount = 0;
		memset(oddcount, 0, sizeof(oddcount));
		ll ans = 1;
		for (ll i = 0; i < n; i++) {
			ll t; cin >> t;
			if (t == 1)
				onecount++;
			oddcount[t/2]++;
		}
		for (ll i = 0; i < n/2; i++) {
			ans = ((ans%mod)*(oddcount[i]%mod))%mod;	
		}
		if (onecount > 2)
			cout << 0 << "\n";
		else
			cout << ans%mod << endl;	
	}
		
	
	return 0;   
}  


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <istream>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) //aからbまで繰り替えす
#define vec vector<int>a(n)
#define soot(a) sort(a.begin(),a.end())
/*int n;
cin >> n;
vector<int>a(n);
rep0(i, n - 1)cin >> a[i];*/
using namespace std;
int main() {
	long long int n, x;
	int count = 0;
	cin >> n >> x;
	vector<long long int>a(n);
	rep0(i, n - 1)cin >> a[i];
	soot(a);
	rep0(i, n - 1) {
		if (a[i] <= x)
			if (a[i] == x) {
				count++;
				x -= a[i];
			}

			else if (i == n - 1)
				break;
			else {
				count++;
				x -= a[i];
			}
	}
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
def money(n):
    if n == 1:
        return 300000
    elif n == 2:
        return 200000
    elif n == 3:
        return 100000
    else:
        return 0

x, y = map(int, input().split())
ans = money(x) + money(y)
if x == y == 1:
    ans += 400000
print(ans)

Measured memory_bytes: 38384
#include<iostream>
#include<stdio.h>
#define MAX 100004

struct Node { int parent, left, right; };	//親、左の子、右の子
Node T[MAX];	//根付き木

using namespace std;

//preorder tree walk
void preorder(int u) {
	if (u == -1) {
		return;
	}
	printf(" %d", u);
	preorder(T[u].left);
	preorder(T[u].right);

}

//inorder walk
void inorder(int u) {
	if (u == -1) {
		return;
	}
	inorder(T[u].left);
	printf(" %d", u);
	inorder(T[u].right);
}

//postorder
void postorder(int u) {
	if (u == -1) {
		return;
	}
	postorder(T[u].left);
	postorder(T[u].right);
	printf(" %d", u);
}
int main() {
	int n, id, l, r;	//個数、節点番号、左の子の番号、右の子の節点番号

	cin >> n;
	
	for (int i = 0; i < n; i++) {
		T[i].parent = -1;
		T[i].left = -1;
		T[i].right = -1;
	}
	for (int i = 0; i < n; i++) {
		cin >> id >> l >> r;
		T[id].left = l;
		T[id].right = r;
		if (l != -1) {
			T[l].parent = id;
		}
		if (r != -1) {
			T[r].parent = id;
		}
	}
	
	int q;		//根
	for (int i = 0; i < n; i++) {
		if (T[i].parent == -1) {
			q = i;
		}
	}

	printf("Preorder\n");
	preorder(q);
	printf("\nInorder\n");
	inorder(q);
	printf("\nPostorder\n");
	postorder(q);
	printf("\n");

	return 0;
}


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

int main(){
  int a, b;
  cin >> a >> b;
  int c = max(a-b, a+b);
  int d = max(a*b, c);
  cout << d << endl;
}

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

int main() {
    int M, D;
    cin >> M >> D;
    int ans = 0;
    for (int m = 4; m <= M; m++) {
        for (int d = 22; d <= D; d++) {
            int d10 = d / 10;
            int d1 = d - d10 * 10;
            if (d1 < 2) continue;
            if (d10 * d1 == m) ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
// 解き直し.
// https://atcoder.jp/contests/abc178/editorial/84
// C++(GCC 9.2.1)
#include <bits/stdc++.h>
using namespace std;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
const int MAX = 202020;
int A[MAX], B[MAX], a[MAX], C[MAX], b[MAX], D[MAX];

int main() {
    
    // 1. 入力情報取得.
    int N;
    scanf("%d", &N);
    rep(i, N){
        scanf("%d", &A[i]);
        a[A[i] - 1]++;
    }
    rep(i, N){
        scanf("%d", &B[i]);
        b[B[i] - 1]++;
    }
    
    // 2. 条件を満たさないパターンを確認.
    rep(i, N){
        if(a[i] + b[i] > N){
            puts("No");
            return 0;
        }
    }
    
    // 3. A, B に出現する i以下 の 値 の個数.
    rep(i, N) C[i + 1] = C[i] + a[i];
    rep(i, N) D[i + 1] = D[i] + b[i];
    
    // 4. C[i] - D[i - 1] の 最大値.
    int x = -1;
    repx(i, 1, N + 1) x = max(x, C[i] - D[i - 1]);
    assert(x != -1);
    
    // 5. 出力.
    puts("Yes");
    rep(i, N){
        printf("%d", B[(i - x + N) % N]);
        printf("%s", (i < N - 1) ? " " : "\n");
    }
    return 0;
    
}

Measured memory_bytes: 8532
#include <iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

void mSort(int*, int, int, int);
void merge(int*, int, int, int, int);

int L[MAX / 2 + 2], R[MAX / 2 + 2];
int cnt;

int main(void){
    int A[MAX], n, i;
    cnt = 0;

    cin >> n;
    for(i = 0; i < n; i++) cin >> A[i];

    mSort(A, n, 0, n);

    for(i = 0; i < n; i++){
        if (i > 0) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << cnt << endl;
    return 0;
}

void mSort(int* A, int n, int left, int right){
    if (left + 1 >= right) return;
    int mid = (left + right) / 2;
    mSort(A, n, left, mid);
    mSort(A, n, mid, right);
    merge(A, n, left, mid, right);
}

void merge(int* A, int n, int left, int mid, int right){
    int n1 = mid - left;
    int n2 = right - mid;
    for(int i = 0; i < n1; i++) L[i] = A[left + i];
    for(int i = 0; i < n2; i++) R[i] = A[mid + i];
    L[n1] = R[n2] = SENTINEL;
    int i = 0, j = 0;
    for(int k = left; k < right; k++){
        cnt++;
        if(L[i] <= R[j]){
            A[k] = L[i];    
            i++;            
        }                  
        else{              
            A[k] = R[j];  
            j++;
        }
    }
}



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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  vector<vector<char>> c(3, vector<char>(3));
  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      cin >> c[i][j];
    }
  }
  string ans;
  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      if (i == j)
        ans += c[i][j];
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define lg long long
#define db double
#define lb(x) ((x)&-(x))
#define ft first
#define sd second

#define HII cerr<<"HI"<<endl
#define LLLINE cerr<<"@@@@@@@@@@@@@@@@@@@@"<<endl

template <class _T_>
void read(_T_& d){
	d=0;int f=1;char c=getchar();
	for(;c<'0'||c>'9';c=getchar())if(c=='-')f*=-1;
	for(;c>='0'&&c<='9';c=getchar())d=d*10+c-'0';
	d*=f;
}

/************************************************/
#define MN 5005
int n,a,b;
lg dp[MN][MN];
int v[MN];
#define Mi(x,y) (x)=(x)<(y)?(x):(y)
int main(){
	read(n);read(a);read(b);
	for(int i=1;i<=n;++i)read(v[i]);
	memset(dp,0x3f,sizeof dp);
	dp[0][0]=0;
	for(int i=1;i<=n;++i){
		for(int j=0;j<=n;++j){
			if(j<=v[i]){
				Mi(dp[j][i],dp[j][i-1]+a);
				Mi(dp[v[i]][i],dp[j][i-1]);
			}else{
				Mi(dp[j][i],dp[j][i-1]+b);
			}
		}
	}
	lg res=0x3f3f3f3f3f3f3f3f;
	for(int i=0;i<=n;++i)Mi(res,dp[i][n]);
	cout<<res;
	return 0;
}


Measured memory_bytes: 195968
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        if (s.charAt(0) == s.charAt(1) && s.charAt(2) == s.charAt(3) && s.charAt(0) != s.charAt(2)) {
            System.out.println("Yes");
        } else if (s.charAt(0) == s.charAt(2) && s.charAt(1) == s.charAt(3) && s.charAt(0) != s.charAt(1)) {
            System.out.println("Yes");
        } else if (s.charAt(0) == s.charAt(3) && s.charAt(1) == s.charAt(2) && s.charAt(0) != s.charAt(1)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

}


Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
int main () {
	int n;
	cin>>n;
	double x[n],y[n],ans=0;
	for (int i=0;i<n;i++) {
		cin>>x[i]>>y[i];
	}
	for (int i=0;i<n-1;i++) {
		for (int j=i+1;j<n;j++) {
			ans+=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
		}
	}
	ans=ans*(n-1)/(n*(n-1)/2);
	printf("%.10lf",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
#define dmp(x) cerr << __LINE__ << " " << #x << " " << x << endl;
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
template<class T>
void dump(vector<T> &vec){
	for(int i=0;i<vec.size();i++){
		cout << vec[i];
		if(i+1<vec.size())cout << ' ';
		else cout << endl;
	}
	return;
}
template<class T>
void input(vector<T>& vec,int n){
	vec.resize(n);
	for(int i=0;i<n;i++){
		cin >> vec[i];
	}
}
void fastio(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
}
typedef pair<string,int> Q;
int N;
string s;
int rk[100100];
int lcp[100100];
int main(){
	cin >> N;
	cin >> s;
	vector<Q> sa;
	for(int i=0;i<N;i++){
		sa.pb(Q(s.substr(i),i));
	}
	sort(all(sa));
	/*for(int i=0;i<N;i++){
		cout << sa[i].fi << ' ' << sa[i].sec << endl;
	}*/
	for(int i=0;i<N;i++){
		rk[sa[i].sec]=i;
	}
	for(int i=0,h=0;i<N;i++){
		if(rk[i]+1<N){
			for(int j=sa[rk[i]+1].sec;max(i,j)+h<N&&s[i+h]==s[j+h];++h);
			lcp[rk[i]+1] = h;
			if(h>0)--h;
		}
	}
	// for(int i=0;i<N;i++){
  //		cout << lcp[i] << endl;
	//}
	int ans = 0;
	for(int i=0;i<N;i++){
		int mi = 10000000;
		for(int j=i+1;j<N;j++){
			int S = sa[i].sec;
			int T = sa[j].sec;
			mi = min(mi,lcp[j]);
			// cout << mi << endl;
			ans = max(ans,min(abs(T-S),mi));
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 16256
#include <iostream>
using namespace std;
int main(){
  char a,b;
  cin>>a>>b;
  if('H'==a){
    cout<<b;
  }else{
    if('H'==b){
      cout<<'D';
    }else{
      cout<<'H';
    }    
  }
  return 0;
}

Measured memory_bytes: 256
import bisect

N = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0

for i in range(N - 2):
    a = L[i]
    for ii in range(i + 1, N - 1):
        b = L[ii]
        iii = bisect.bisect_left(L, a + b)
        ans += iii - ii - 1
            
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define T top()
#define E end()
#define PS push
#define Q queue
#define PP pop()
#define L0 (LL)0
#define V vector
#define ST stack
#define FI first
#define MAX 4e18
#define MIN -MAX
#define DQ deque
#define RE rend()
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define SE second
#define DL double
#define G getline
#define IN insert
#define endl "\n"
#define EM empty()
#define RB rbegin()
#define PSB push_back
#define PI acos(-1.00)
#define PPB pop_back()
#define PSF push_front
#define ub upper_bound
#define lb lower_bound
#define MD 1000000007
#define PPF pop_front()
#define LL long long int
#define PQ priority_queue
#define N cout<<"NO"<<endl
#define Y cout<<"YES"<<endl
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define UOSMOY v.C;w.C;ww.C;u.C;uu.C;uo.C;vo.C;vu.C;ab.C;bc.C;cc.C;uuu.C;a.C;b.C;c.C
V<LL>v;
V<LL>w,ab,bc;
set<LL>uo;
map<LL,LL>u;
map<LL,LL>ww,cc;
LL ar[50000001];
LL br[50000001];
LL cr[500][500];
V<pair<LL,LL> >uu;
map<LL,V<LL> >uuu;
map<pair<LL,LL>,LL> vo;
map<pair<LL,LL>,LL> vu;
LL veve(LL A[], LL n, LL k)
{
    sort(A, A + n);
    LL product = 1;
    if (A[n - 1] == 0 && (k & 1))
        return 0;
    if (A[n - 1] <= 0 && (k & 1))
    {
        for (LL i = n - 1; i >= n - k; i--)
        {
            product *= A[i];
            product%=1000000007;
        }
        return product%1000000007;
    }
    LL i = 0;
    LL j = n - 1;
 
    if (k & 1)
    {
        product *= A[j];
        product%=1000000007;
        j--;
        k--;
    }
    k >>= 1;
    for (LL itr = 0; itr < k; itr++)
    {
        LL left_product = A[i] * A[i + 1];
        LL right_product = A[j] * A[j - 1];
        if (left_product > right_product)
        {
            product *= (left_product%1000000007);
            product%=1000000007;
            i += 2;
        }
        else
        {
            product *= (right_product%1000000007);
            product%=1000000007;
            j -= 2;
        }
    }
    return product%1000000007;
}
int main()
{
//  BRR;
//  file;
    FAST;
    char ch;
    string a,b,c;
    DL x,y,d,e,f,g,h;
    LL n,m,i,j,k,p,q,o,l,s,tt=1,t,z,aa,r=0;
//    cin>>tt;
    while(tt--)
    {
        UOSMOY;
        cin>>n>>m;
        for(i=0; i<n; i++)
        {
            cin>>ar[i];
        }
        k=veve(ar,n,m);
        if(k<0)
        {
            k%=1000000007;
            cout<<1000000007+k<<endl;
 
        }
        else
        {
            k%=1000000007;
            cout<<k<<endl;
        }
    }
    return 0;
    //IN
    //AL
}

Measured memory_bytes: 5120
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll n ; cin >> n ;
	vll a(n),b(n),c(n) ;
	for(int i=0;i<n;i++) cin >> a.at(i) ;
	for(int i=0;i<n;i++) cin >> b.at(i) ;
	for(int i=0;i<n;i++) cin >> c.at(i) ;
	mysort(a) ; mysort(b) ; mysort(c) ;
	vll sum(n+1,0) ;
	ll pos = 0 ;
	for(int i=0;i<n;i++){
		while(pos!=n&&c.at(pos)<=b.at(i)) pos++ ;
		sum.at(i+1) = sum.at(i)+(n-pos) ;
	}
	ll ans = 0 ;
	pos = 0 ;
	for(int i=0;i<n;i++){
		while(pos!=n&&b.at(pos)<=a.at(i)) pos++ ;
		ans += sum.at(n)-sum.at(pos) ;
	}
	cout << ans << endl ;
}


Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include "limits.h"
#include <cmath>
#include <algorithm>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <functional>

#define mod 1000000000+7;
typedef long long ll;
using namespace std;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	int n; string s,t,ans;
	cin >> n >> s >> t;
	for(int i{}; i<n; i++){
		ans+=s[i];
		ans+=t[i];
	}

	cout << ans << "\n";
 

}

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

int main()
{
	int a, b;
	cin >> a >> b;
	
	int cnt = 1;
	
	if (b==1)
	{
		cout << 0 << "\n";
		return 0;
	} 
	for (int i = 1; ; i++) 
	{
		cnt+=(a-1);
		if (cnt>=b)
		{
			cout << i << "\n";
			return 0;
		}
	}
}

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

#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

int main(){
  string s[3];
  string ans={};
  rep(i,3){
    cin>>s[i];
    ans+=s[i][0];//これでよかった
    //string aaa=s[i];
    //ans+=aaa[0];
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
<?php
$n = intval(trim(fgets(STDIN)));
$s = trim(fgets(STDIN));

$div2 = array_fill(1,$n - 1,0);
for($i = 1; $i < 20; $i++){
    $I = 2**$i;
    for($j = $I; $j < $n; $j+=$I){
        $div2[$j]++;
    }
}
$nCm[0] = 0;
for($i = 1; $i < $n; $i++){
    $nCm[$i] = $nCm[$i-1]+$div2[$n-$i]-$div2[$i];
}

$kigu = 0;
for($i = 0; $i < $n; ++$i){
    $dp[$i] = ((int)$s[$i])-1;
    $kigu ^= ($dp[$i]%2) * ($nCm[$i]==0);
}
if($kigu){
    echo 1;
}else{
    if(array_search(1, $dp)!==false){
        echo 0;
    }else{
        $kigu = 0;
        for($i = 0; $i < $n; ++$i){
            $kigu ^= ($dp[$i]/2) * ($nCm[$i]==0);
        }
        if($kigu){
            echo 2;
        }else{
            echo 0;
        }
    }
}


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

int nxt[200002], val[200002];

int main() {
	string A;
	cin >> A;
	int N = A.size(), cnt[256] = { 0 }, pos[256];
	memset(pos, -1, sizeof(pos));
	for (int i = N - 1; i >= 0; --i) {
		val[i] = min_element(cnt + 'a', cnt + 'z' + 1) - cnt;
		nxt[i] = pos[val[i]];
		cnt[A[i]] = *min_element(cnt + 'a', cnt + 'z' + 1) + 1;
		pos[A[i]] = i;
	}
	cout << (char)(min_element(cnt + 'a', cnt + 'z' + 1) - cnt);
	for (int i = pos[min_element(cnt + 'a', cnt + 'z' + 1) - cnt]; i != -1; i = nxt[i]) cout << (char)val[i];
}

Measured memory_bytes: 2180
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <map>
#include <functional>
#include <limits>
#include <set>
#include <stack>
#define rep(i,a,b) for((i)=a;i<(int)(b);i++)
#define max(a,b) ((a) < (b) ? (b) : (a))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define AAA (1000000007)

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



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

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



int main() {
	string S;
	int i, j, k;
	//ll N, M, K;
	int N, M, K;
	
	cin >>K >> N >> M ;
	rep(i, N, M + 1) {
		if (i % K == 0) {
			cout << "OK";
			return 0;
		}
	}
	cout << "NG";
	return 0;
	
}


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

int main(){
  int d;
  cin >> d;
  vector<int> c(26);
  vector<vector<int>> s(d,vector<int>(26));
  int i,j;
  for(i=0;i<26;i++){
    cin >> c.at(i);
  }
  
  for(j=0;j<d;j++){
    for(i=0;i<26;i++){
      cin >> s.at(j).at(i);
    }
  }
  
  
  vector<int> last(26,-1),last1(26,-1);
  int k,l;
  for(j=0;j<d/2;j++){
    int maxv1,type1,type2;
    for(i=0;i<26;i++){
      for(k=0;k<26;k++){
        last1.at(k)=last.at(k);
      }
      int v1=s.at(j*2).at(i);
      for(k=0;k<26;k++){
        if(k!=i){
          v1 -= c.at(k)*(j*2-last.at(k));
        }
      }
      last1.at(i)=j*2;
      int maxv2,type12;
      for(k=0;k<26;k++){
        int v2=v1+s.at(j*2+1).at(i);
        for(l=0;l<26;l++){
          if(l!=k){
            v2 -= c.at(l)*(j*2+1-last1.at(l));
          }
        }
        if(k==0){
          maxv2=v2;
          type12=0;
        }else{
          if(maxv2<=v2){
            maxv2=v2;
            type12=k;
          }
        }
      }
      if(i==0){
        maxv1=maxv2;
        type1=0;
        type2=type12;
      }else{
        if(maxv1<=maxv2){
          maxv1=maxv2;
          type1=i;
          type2=type12;
        }
      }
    }
    cout << type1+1 << endl;
    cout << type2+1 << endl;
    last.at(type1)=j*2;
    last.at(type2)=j*2+1;
  }
  vector<int> v(26);
  int maxv,type;
  for(i=0;i<26;i++){
    v.at(i)=s.at(d-1).at(i);
    for(k=0;k<26;k++){
      if(k!=i){
        v.at(i) -= c.at(k)*(d-last.at(k));
      }
    }
    if(i==0){
      maxv=v.at(0);
      type=0;
    }else{
      if(maxv<=v.at(i)){
        maxv=v.at(i);
        type=i;
      }
    }
  }
  cout << type+1 << endl;
}

Measured memory_bytes: 3672
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

void max_self(ll& a, ll b) {
    a = max(a, b);
}

// O(n * W)

int main() {
    int n, W;
    scanf("%d%d", &n, &W);
    vector<ll> dp(W + 1); // 0 ... W
    // dp[i] - the maximum total value of items with total weight exactly i
    for(int item = 0; item < n; ++item) {
        int weight, value;
        scanf("%d%d", &weight, &value);
        // dp[0] -> dp[3] -> dp[6]
        for(int weight_already = W - weight; weight_already >= 0; --weight_already) {
        //~ for(int weight_already = 0; weight_already <= W - weight; ++weight_already) {
            max_self(dp[weight_already+weight], dp[weight_already] + value);
        }
    }
    ll answer = 0;
    for(int i = 0; i <= W; ++i) {
        max_self(answer, dp[i]);
    }
    printf("%lld\n", answer);
}

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

using namespace std;
using ll = long long;

int main(int argc, const char *argv[]) {
  //
  ll n, k;
  cin >> n >> k;

  vector<ll> vp(n), vc(n);
  for (int i = 0; i < n; ++i) {
    cin >> vp[i];
    vp[i]--;
  }

  for (int i = 0; i < n; ++i) {
    cin >> vc[i];
  }

  // マスiから始めたときの経路
  vector<vector<ll>> paths(n);
  for (int i = 0; i < n; ++i) {
    vector<ll> used(n, false);
    ll cur = i, pt = 0;
    while (!used[cur]) {
      used[cur] = true;
      pt += vc[vp[cur]];
      paths[i].push_back(pt);
      cur = vp[cur];
    }
  }

  ll ans;
  for (int i = 0; i < n; ++i) {
    auto path = paths[i];
    if (path.back() <= 0) {
      // sz > 0
      ll sz = min(k, static_cast<ll>(path.size()));
      ll pt = path.front();
      for (int j = 0; j < sz; ++j) {
        pt = max(pt, path[j]);
      }

      if (i == 0 || ans < pt) {
        ans = pt;
      }
    } else {
      ll sz = k / path.size();
      ll pt = sz * path.back();
      if (k % path.size() > 0) {
        ll max_pt = path.front();
        for (int j = 0; j < k % path.size(); ++j) {
          max_pt = max(max_pt, path[j]);
        }

        if (sz <= 0 || max_pt >= 0) {
          pt += max_pt;
        }
      } else {
        ll max_pt = *max_element(path.begin(), path.end());
        pt -= path.back();
        pt += max_pt;
      }

      if (i == 0 || ans < pt) {
        ans = pt;
      }
    }
  }

  cout << ans << '\n';
  return 0;
}

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

class Dice{
public:
  int r[5];
  int bottom, top, north, south, east, west;

  Dice(){}
  void roll(int i, int j, int k, int l){
    int t = r[i];
    r[i] = r[j];
    r[j] = r[k];
    r[k] = r[l];
    r[l] = t;
  }
  void roll_x(){roll(0, 1, 5, 4);} // to N
  void roll_y(){roll(0, 3, 5, 2);} // to E
  void move(char ch){
    if (ch == 'N') roll_x();
    if (ch == 'E') roll_y();
    if (ch == 'S') for (int i = 0; i < 3; i++) roll_x();
    if (ch == 'W') for (int i = 0; i < 3; i++) roll_y();
  }
};

int main(int argc, char const *argv[]) {
  Dice d;
  string orders;

  for (int i = 0; i < 6; i++) cin >> d.r[i];

  cin >> orders;
  for (int i = 0; i < orders.size(); i++) d.move(orders[i]);

  cout << d.r[0] << endl;

  return 0;
}

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

using triple = tuple<int, int, int>;

map<triple, bool> used;

int main(void)
{
    int n;

    scanf("%d", &n);

    int cnt = 0;
    while (n--){
        int p1, p2, p3;

        scanf("%d %d %d", &p1, &p2, &p3);
        if (p1 > p2) swap(p1, p2);
        if (p2 > p3) swap(p2, p3);
        if (p1 > p2) swap(p1, p2);
        triple t(p1, p2, p3);
        if (used[t]) ++cnt;
        used[t] = true;
    }

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

    return 0;
}

Measured memory_bytes: 3280
n = int(input())
d = {"S":[None]*13, "H":[None]*13, "C":[None]*13, "D":[None]*13}

for i in range(n):
    x, y = raw_input().split()
    d[x][int(y)-1] = True

for k in ["S", "H", "C", "D"]:
    for i in range(13):
        if d[k][i]:
            continue
        print("%s %d" % (k, i+1))

Measured memory_bytes: 4240
N = STDIN.gets.to_i
P = STDIN.gets.split(' ').map{|s| s.to_i}
Q = STDIN.gets.split(' ').map{|s| s.to_i}

n = 1.upto(N).to_a
n_all = n.permutation(N).to_a

pn = -1
qn = -1
n_all.each_with_index do |c, i|
  if c == P
    pn = i + 1
  end
  if c == Q
    qn = i + 1
  end
end

puts (pn - qn).abs



Measured memory_bytes: 6780
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	cin >> N;
	int ans = 1e9;
	vector<int>a(N);

	for (int i = 0; i < N; i++){
		cin >> a[i];
	}

	for (int i = -100; i <= 100; i++){
		int tmp = 0;
		for (int j = 0; j < N; j++) {
			tmp += pow(a[j] - i, 2);
		}
		ans = min(ans, tmp);
	}

	cout << ans << endl;
	return 0;
}

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

int main(){
  vector<vector<int>>a(3,vector<int>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>a[i][j];
    }
  }

  int n; cin>>n;

  vector<int>b(n);
  for(int i=0;i<n;i++){
    cin>>b[i];
  }

  vector<vector<int>>c(3,vector<int>(3,0));
  for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(b[i]==a[j][k]){
          c[j][k]=1;
        }
      }
    }
  }//ここでcの行列ができる

  bool d=false;
  for(int i=0;i<3;i++){
    if(c[i][0]==1 && c[i][1]==1 && c[i][2]==1){
      d=true;
      break;
    }else if(c[0][i]==1 && c[1][i]==1 && c[2][i]==1){
      d=true;
      break;
    }
  }

  int f=0;
  for(int i=0;i<3;i++){
    if(c[i][i]!=1){
      f=1;
      break;
    }
  }
  if(f==0){
    d=true;
  }

 if(c[0][2]==1 && c[1][1]==1 && c[2][0]==1){
   d=true;
 }

 if(d==true){
   cout<<"Yes"<<endl;
 }else{
   cout<<"No"<<endl;
 }





  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll par[314514];
ll ran[314514];
ll n=314514;
ll root(ll x){
	return par[x]==x?x:par[x]=root(par[x]);
}
void unite(ll x,ll y){
	x=root(x);
	y=root(y);
	if(x==y)return;
	if(ran[x]<ran[y])par[x]=y;
	else{
		par[y]=x;
		if(ran[x]==ran[y])ran[x]++;
	}
}
string s[410];
ll cnt[2][314514];
int main(){
	for(int i=1;i<=n;i++)par[i]=i;
	ll h,w;
	cin>>h>>w;
	ll dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
	for(int i=0;i<h;i++)cin>>s[i];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			for(int k=0;k<4;k++){
				if(i+dy[k]<0||i+dy[k]>=h||j+dx[k]<0||j+dy[k]>=w)continue;
				if(s[i][j]!=s[i+dy[k]][j+dx[k]])unite(500*i+j,500*(i+dy[k])+j+dx[k]);
			}
		}
	}
	for(int i=0;i<h;i++)for(int j=0;j<w;j++){
		if(s[i][j]=='.')cnt[0][root(500*i+j)]++;
		else cnt[1][root(500*i+j)]++;
	}
	ll ans=0;
	for(int i=0;i<h;i++)for(int j=0;j<w;j++){
		ans+=cnt[0][500*i+j]*cnt[1][500*i+j];
	}
	cout<<ans<<endl;
	return 0;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int x;
  cin >> x;
  int ans = 0;
  rep(i, 1000) {
    int tmp = i;
    rep(j, 1000) {
      tmp *= i;
      if (tmp <= x)
        ans = max(ans, tmp);
      else
        break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
	static int[][] list;
	public static void main(String[] args) {
		
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		while(true) {
			int n = sc.nextInt();
			if(n == 0) break;
			PriorityQueue<Integer> que = new PriorityQueue<Integer>(n);
			for(int i = 0; i < n; i++) {
				que.add(sc.nextInt());
			}
			long sum = 0;
			for(int i = 0; i < n; i++) {
				sum += que.poll() * (n - i - 1);
			}
			
			out.println(sum);
		}
		out.flush();
	}
	static void solv(int a, int b, boolean[] c) {
		list[a][b]++;
		if(a == 9) return;
		if(b > 1000) return;
		
		for(int i = 0; i < 101; i++) {
			if(a == 8) {
				if(!c[i]) {
					list[a+1][b+i]++;
				}
			}
			
			else if(!c[i]) {
				c[i] = true;
				solv(a+1,b+i,c);
				c[i] = false;
			}
		}
	}
}
//------------------------------//
//-----------//
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    
    public int nextInt() {
    	return (int)nextLong();
    }
    

}

Measured memory_bytes: 20520
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int Digits(llong num){
  int cnt = 0;
  while(num > 0){
    num / 10;
    cnt++;
  }
  return cnt;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int len = S.size();
    cout << S[0] << len -2 << S[len-1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

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

    vl dp(2010);  // dp[i] : 総和がiのときの場合の数
    dp[3] = dp[4] = dp[5] = 1;
    exrep(i, 6, 2000) {
        exrep(j, 3, i-3) {
            dp[i] += dp[j];
            dp[i] %= mod;
        }
        dp[i] += 1;
        dp[i] %= mod;
    }
    
    out(dp[s]);
    re0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <math.h>
using namespace std;

int main(void){
    int n;
    cin>>n;
    vector<int> a(n);
    int max=-1000001,min=1000001,pmax,pmin;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(min>a[i]){
            min=a[i];
            pmin=i;
        }
        if(max<a[i]){
            max=a[i];
            pmax=i;
        }
    }
    cout<<2*n-1<<endl;
    if(abs(min)<abs(max)){
        for(int i=0;i<n;i++){
            cout<<pmax+1<<" "<<i+1<<endl;
            a[i]+=max;
        }
    }
    else{
        for(int i=0;i<n;i++){
            cout<<pmin+1<<" "<<i+1<<endl;
            a[i]+=min;
        }
    }
    if(a[0]>0){
        for(int i=0;i<n-1;i++){
            cout<<i+1<<" "<<i+2<<endl;
            a[i+1]+=a[i];
        }
    }
    else{
        for(int i=n-1;i>0;i--){
            cout<<i+1<<" "<<i<<endl;
            a[i-1]+=a[i];
        }
    }
    return 0;
}


Measured memory_bytes: 256
import sys
import math
import bisect
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop


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


def I(): return int(sys.stdin.readline())


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


# A
def A():
    a = I()
    b = I()
    print(6 - a - b)
    return


# B
def B():
    n = I()
    s, t = input().split(' ')
    ans = []
    for i in range(n):
        ans.append(s[i])
        ans.append(t[i])
    print(''.join(ans))
    return


# C
def C():
    def GCD(a, b):
        if (b == 0):
            return a
        else:
            return GCD(b, a % b)

    a, b = LI()
    print(a * b // GCD(a, b))
    return


# D
def D():
    return


# E
def E():
    return


# F
def F():
    return


# Unittest
def resolve():
    C()
    return


# Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 38256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();		
		int count = 0;
		for(int i=1; i<=N; i++) {
			if(i%2==0)continue; //continueで偶数の場合は下の処理を行わない(奇数の場合は行う)
			int Yakusu=0; //ここに約数の個数を入れる
			
			for(int j=1; j<=i; j++) {
				if(i%j==0) Yakusu++; //1%1からN%Nを繰り返し、割り切れる場合Yakusuに＋1する
			}
			
			if(Yakusu==8)count++; //Yakusuの個数がちょうど８のとき
		}							//countに＋1する
		
		System.out.println(count); //N以下で「奇数かつ約数が８個」を満たす数の個数を表示
	}
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll N=5e5;

#define C getchar()-48
ll read()
{
  ll s=0,t=1,k=C;
  for (;k<0||9<k;k=C) if (k==-3) t=-1;
  for (;0<=k&&k<=9;k=C) s=(s<<1)+(s<<3)+k;
  return s*t;
}

  ll n,A,x,y;
void in()
{
  cin>>A>>x;
  y=A-x;
}

void wor()
{
  while (x)
	  {
      A+=y/x*2*x;
      y%=x;
      swap(x,y);
    }
  A-=y;
}

void out()
{
  cout<<A;
}

int main()
{
  in();
  wor();
  out();
  exit(0);
} 

Measured memory_bytes: 256