akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
#define cMaxLimit 260
#define UNDEFINED -2000000001

typedef struct { int key, parent, leftChild, rightChild; } Node;
stringstream ans1, ans2;

void print(Node node[], int maxNum)
{
	for (int i = 1; i <= maxNum; i++)
	{
		ans1 << "node " << i << ": ";
		ans1 << "key = " << node[i].key << ", ";
		if (node[i].parent != UNDEFINED) ans1 << "parent key = " << node[i].parent << ", ";
		if (node[i].leftChild != UNDEFINED) ans1 << "left key = " << node[i].leftChild << ", ";
		if (node[i].rightChild != UNDEFINED) ans1 << "right key = " << node[i].rightChild << ", ";
		ans1 << endl;
	}
}

int main()
{
	int nodeMaxNum; cin >> nodeMaxNum;
	Node node[cMaxLimit + 1]; // ????????????????????????1-???????????????????????????
	for (int i = 1; i <= nodeMaxNum; i++)
	{
		int key; cin >> key;
		node[i].key = key;
		node[i].leftChild = UNDEFINED;
		node[i].rightChild = UNDEFINED;
		node[i].parent = UNDEFINED;
	}
	for (int i = 1; i <= nodeMaxNum; i++)
	{
	   ans2 << "node " << i << ": ";
	   ans2 << "key = " << node[i].key << ", ";
	   if (i / 2 >= 1) ans2 << "parent key = " << node[i / 2].key << ", ";
	   if (i * 2 <= nodeMaxNum) ans2 << "left key = " << node[i * 2].key << ", ";
	   if (i * 2 + 1 <= nodeMaxNum) ans2 << "right key = " << node[i * 2 + 1].key << ", ";
	   ans2 << endl;
	}
	for (int i = 1; i <= nodeMaxNum; i++)
	{
		if (i / 2 >= 1) node[i].parent = node[i / 2].key;
		if (i * 2 <= nodeMaxNum) node[i].leftChild = node[i * 2].key;
		if (i * 2 + 1 <= nodeMaxNum) node[i].rightChild = node[i * 2 + 1].key;
	}
	print(node, nodeMaxNum);
	cout << ans2.str();
	return 0;
}

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

using namespace std;

int main(void){
    string s;
    int k;
    cin >> k >> s;

    if(s.size() <= k){
        cout << s << endl;
        return 0;
    }

    for(int i = 0;i < k;i++){
        cout << s[i];
    }

    cout << "..." << endl;
}

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

const int Maxn = 1005;

const string three[] = {"a..", "a..", ".bb"};
const string four[] = {"aabc", "kkbc", "cdzz", "cdyy"};
const string five[] = {"abc..", "abc..", "deeaa", "d.bcc", "kkbdd"};
const string six[] = {"abc...", "abc...", "d.eeff", "dznn..", ".z.abb", "yy.acc"};
const string seven[] = {"abc....", "abc....", "dfk....", "dfk....", "e..wwyy", "e..aabb", ".zzccdd"};

int n;
char B[Maxn][Maxn];

void Write(int st, const string s[], int len)
{
    for (int i = 0; i < len; i++)
        for (int j = 0; j < len; j++)
            B[st + i][st + j] = s[i][j];
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        fill(B[i], B[i] + n, '.');
        B[i][n] = '\0';
    }
    int mem = n;
    if (n == 2) { printf("-1\n"); return 0; }
    if (n == 3) Write(0, three, 3);
    else {
        int st = 0;
        while (n >= 8) {
            Write(st, four, 4);
            st += 4; n -= 4;
        }
        if (n == 4) Write(st, four, 4);
        else if (n == 5) Write(st, five, 5);
        else if (n == 6) Write(st, six, 6);
        else if (n == 7) Write(st, seven, 7);
    }
    for (int i = 0; i < mem; i++)
        printf("%s\n", B[i]);
    return 0;
}


Measured memory_bytes: 2176
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
int main(void)
{
  int N;
  int check = 1; 
  int i;
  scanf("%d", &N);
  char moji[N][11];
  for(i = 0; i < N; i++) {
    scanf("%s", moji[i]);
  }
  qsort(moji, N, 11, strcmp); 
  for(i = 0; i < N - 1; i++) {
    if(strcmp(moji[i], moji[i+1]) != 0)
      check++;
  }
  printf("%d", check);
  return 0;
 }

Measured memory_bytes: 5736
#include<iostream>
using namespace std;
long long a,b,c=0,d[1000001],e[1000001];
int main(){
	cin>>a;
	b=a;
	while(b>0){
		c+=b%10;
		b/=10;
	}
	if(a%c==0){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ii=pair<ll,ll>;
using vi=vector<ll>;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (ll)1e18
#define all(x) (x).begin(),(x).end()
#define print(a); for(auto x:a)cout<<x<<" "; cout<<"\n";
#define mset(a); memset(a,0,sizeof(a));

const ll N=1e5+5;
ll dp[N];

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
    ll n,x;cin>>n>>x;
    for(int i=1;i<(int)1e5+1;i++)dp[i]=INF;
    dp[0]=0;
    while(n--){
        ll a,b;cin>>a>>b;
        for(int i=100000;i>=b;i--)dp[i]=min(dp[i],dp[i-b]+a);
    }
    ll ans=0;
    for(int i=1;i<=100000;i++){
        if(dp[i]<=x)ans=i;
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    ll n; cin >> n;
    ll sum=0;
    for(ll i=1;i<=n;i++){
        if(i%3==0||i%5==0) continue;
        sum+=i;
    }
    cout << sum << endl;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> l(2*n);
  rep(i,2*n) cin >> l[i];
  sort(l.begin(),l.end());
  int ans = 0;
  rep(i,2*n){
    if(i%2 == 0){
      ans += min(l[i],l[i+1]);
    }
  }
  cout << ans << endl;
  return 0;
}


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

int bubbleSort(int A[], int N) {
  int sw = 0;
  bool flag = 1;
  for ( int i = 0; flag; i++ ) {
    flag = 0;
    for ( int j = N - 1; j >= i + 1; j-- )
      if ( A[j] < A[j - 1] ) {
        swap(A[j], A[j - 1]);
        flag = 1;
        sw++;
      }
  }
  return sw;
}

int main() {
  int A[100], N, sw;
  cin >> N;
  for ( int i = 0; i < N; i++ ) cin >> A[i];

  sw = bubbleSort(A, N);

  for ( int i = 0; i < N; i++ ) {
    if (i) cout << " ";
    cout << A[i];
  }
  cout << endl;
  cout << sw << endl;

  return 0;
}


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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c;
  d = c - (a - b);
  if (d >= 0){
    cout << d << endl;
  }
  else if (d < 0){
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int x;
    cin >> x;
    string ans = "ABC";
    if (x>=1200) ans = "ARC";
    
    cout << ans << endl;
    return 0;
}


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

int main(void)
{
    int n;
    double p;
    cin >> n;
    n % 2 == 0 ? p = (double)n / 2 / n : p = (double)(n + 1) / 2 / n;
    cout << p << endl;
    return 0;
}

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

int n, A[30];

bool solve(int idx, int target) {
  if (target == 0) return true;
  if (idx >= n) return false;
  bool res = (solve(idx + 1, target) || solve(idx + 1, target - A[idx]));
  return res;
}

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

  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int m;
    cin >> m;
    if (solve(0, m)) cout << "yes" << endl;
    else cout << "no" << endl;
  }

  return 0;
}


Measured memory_bytes: 3080
#include <vector>
#include <iostream>
#define ll long long
using namespace std;

struct UnionFind{
  vector< pair<int, ll int> > data;
  UnionFind(int n) : data(n, pair<int,ll int>(-1,0LL)) {}
  bool unite(int x, int y, ll int w){//weight(y)-weight(x) = w;
    int x_ = find(x), y_ = find(y);
    if(x_ == y_){
      
      return true;
    }
    if(data[y_].first < data[x_].first){
      swap(x_,y_);
      swap(x,y);
      w *= -1LL;
    }
    data[x_].first += data[y_].first;//???????????´??°
    data[y_].first = x_;//????????´??°
    data[y_].second += w + rel_weight(x) - rel_weight(y);
    return true;
  }
  bool same(int x, int y){ return find(x) == find(y); }
  int find(int x){
    if(data[x].first < 0) return x;
    int p = find(data[x].first);
    data[x].second += data[data[x].first].second;
    data[x].first = p;
    return data[x].first;
  }
  ll int rel_weight(int x){
    return data[x].second;
  }
};

int main(){
  int N, M;
  while(cin >> N >> M, N){
    UnionFind uf(N);
    char q;
    int a, b;
    ll int w;
    for(int i = 0; i < M; ++i){
      cin >> q >> a >> b;
      --a;--b;
      if(q == '!'){
	cin >> w;
	uf.unite(a,b,w);
      }else{
	//cout << uf.find(a) << " " << uf.find(b) << endl;
	if(uf.same(a,b)){
	  cout << uf.rel_weight(b) - uf.rel_weight(a) << endl;
	}else{
	  cout << "UNKNOWN" << endl;
	}
      }
    }
  }
  return 0;
}

Measured memory_bytes: 4632
from collections import deque

class UnionFind:
    def __init__(self, size):
        self.parent = list(range(size))
        self.height = [0] * size
        self.size = [1] * size
        self.componentCount = size

    def root(self, index):
        if self.parent[index] == index:  # 根の場合
            return index
        rootIndex = self.root(self.parent[index])  # 葉の場合親の根を取得
        self.parent[index] = rootIndex  # 親の付け直し
        return rootIndex

    def union(self, index1, index2):  # 結合
        root1 = self.root(index1)
        root2 = self.root(index2)

        if root1 == root2:  # 連結されている場合
            return

        self.componentCount -= 1  # 連結成分を減らす

        if self.height[root1] < self.height[root2]:
            self.parent[root1] = root2  # root2に結合
            self.size[root2] += self.size[root1]
        else:
            self.parent[root2] = root1  # root1に結合
            self.size[root1] += self.size[root2]
            if self.height[root1] == self.height[root2]:
                self.height[root1] += 1
        return

    def isSameRoot(self, index1, index2):
        return self.root(index1) == self.root(index2)

    def sizeOfSameRoot(self, index):
        return self.size[self.root(index)]

H, W = map(int, input().split())
C = tuple(map(int, input().split()))
D = tuple(map(int, input().split()))
S = [input() for _ in range(H)]

def cord(h, w):
    return h * W + w

tree = UnionFind(H * W + 100)

for h in range(H):
    for w in range(W):
        if S[h][w] == '#':
            continue

        for dh, dw in ((-1, 0), (1, 0), (0, -1), (0, 1)):
            toH, toW = h + dh, w + dw

            if 0 <= toH < H and 0 <= toW < W and S[toH][toW] == '.':
                tree.union(cord(h, w), cord(toH, toW))

roots = [tree.root(i) for i in range(H * W)]
M = max(roots) + 1
edges = [set() for _ in range(M)]

def search(h, w):
    for dh in range(-2, 3):
        for dw in range(-2, 3):
            toH, toW = h + dh, w + dw
            if 0 <= toH < H and 0 <= toW < W and S[toH][toW] == '.':
                if roots[cord(h, w)] == roots[cord(toH, toW)]:
                    continue
                edges[roots[cord(h, w)]].add(roots[cord(toH, toW)])

for h in range(H):
    for w in range(W):
        if S[h][w] == '#':
            continue
        search(h, w)

edges = [list(e) for e in edges]

S = roots[cord(C[0] - 1, C[1] - 1)]
T = roots[cord(D[0] - 1, D[1] - 1)]

INF = 10**18
que = deque([(S, 0)])
minDist = [INF] * M
minDist[S] = 0

while que:
    now, dist = que.popleft()

    for to in edges[now]:
        if minDist[to] > dist + 1:
            minDist[to] = dist + 1
            que.append((to, dist + 1))

print(minDist[T] if minDist[T] < INF else -1)


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

void bmon(int n,int k);

int main(void){
    int n,k;
    scanf("%d %d",&n,&k);
    bmon(n,k);
    return(0);
}

void bmon(int n,int k){
    int d[n];
    int people = 0;
    int tmp = 0;
    int cnt = 0;

    for(int i = 0; i < n; i++){
        d[i] = 0;
    }

    for(int i = 0; i < k; i++){
        scanf("%d",&people);

        for(int j = 0; j < people; j++){
            scanf("%d",&tmp);
            d[tmp - 1]++;
        }
    }
    for(int i = 0; i < n; i++){
        if(d[i]==0){
            cnt++;
        }
    }
    printf("%d\n",cnt);
    return;
}


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

using namespace std;

int counttwo(int num)
{
    int count = 0;
    for(;;) {
        if(num % 2 == 0) {
            num /= 2;
            count++;
        }
        else {
            break;
        }
    }
    return count;
}

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

    int res = 0;

    
    for(auto hoge : a) {
       res += counttwo(hoge); 
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val n, x = sc.nextLong

  println(3 * (n - gcd(n, x)))

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a
    else gcd(b, a % b)
}


Measured memory_bytes: 27704
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c)) 
#define all(v) (v).begin(),(v).end()
typedef long long ll;
typedef unsigned long long llu;

const int INF = 1e9;
const int MOD = 1e9+7;
const double PI = 2*acos(0.0);

signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int a,b;
	cin>>a>>b;
	int res = 0;
	int cnt = 1;
	while(cnt<b)
	{
		--cnt;
		cnt+=a;
		++res;
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
/// IN THE NAME OF METAL
#include <bits/stdc++.h>

using namespace std;

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

#define sz(x)                       (ll) x.size()
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second

ll Pow(ll a, ll b, ll md, ll ans = 1) {
    for (; b; b >>= 1, a = a * a % md)
        if (b & 1)
            ans = ans * a % md;
    return ans % md;
}

const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
string s;

int main() {
    cin >> s;
    for (char c : s) {
        if (c == '?') cout << 'D';
        else cout << c;
    }
    return 0;
}



Measured memory_bytes: 3748
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a >= 6 && a <= 12) {
            System.out.println(b / 2);
        } else if (a >= 13) {
            System.out.println(b);
        } else {
            System.out.println(0);
        }
    }
}

Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;



int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	ll r,g,b,n,ans=0;
	cin >> r >> g >> b >> n;
	FOR(i,0,n+1){
		FOR(j,0,n+1){
			ll k = n-i*r-j*g;
			if(k<0)break;
			if(k%b==0)ans++;
		}
	}
	cout << ans << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N; i >= 0; i--)
const ll INF = 1000000000;
const ll mod = 1000000007;
#define PI 3.1415926535
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true;} return false;}
bool seen[100000];
void dfs(const Graph &G, int v) {
    seen[v] = true; // v を訪問済にする
 
    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v); // 再帰的に探索
    }
}

//dpTable
int dp[100050];

int main(){
    string S;
    cin >> S;
    int A = 0,B = 0,C = 0;
    rep (i,S.size()) {
        if (S.at(i) == 'a') A++;
        else if (S.at(i) == 'b') B++;
        else C++;
    }
    if (abs(A - B) <= 1 && abs(B - C) <= 1 && abs(C - A) <= 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3720
N=int(input())
P=list(map(float,input().split()))

NOW=[1]

for i in range(N):
    NEXT=[0]*(i+2)

    for j in range(i+1):
        NEXT[j]+=NOW[j]*(1-P[i])
        NEXT[j+1]+=NOW[j]*P[i]

    NOW=NEXT
    #print(NOW)

print(sum(NOW[1+N//2:]))

Measured memory_bytes: 44636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ull  unsigned long long
#define vll  vector <long long>
#define pll pair <long long,long long>
#define f first
#define s second
#define up upper_bound
#define lp lower_bound
#define pq priority_queue
#define inf 1e10
#define minf -1e10
#define pi 3.14159265
#define mod 300000000000000000
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);
int main()
{
    string a,b;
    cin>>a>>b;
    ll n=a.size();
    ll m=b.size();
    ll l[n+1][m+1];
    for(ll i=0;i<=n;i++)
    {
        for(ll j=0;j<=m;j++)
        {
            if(i==0||j==0)
            {
                l[i][j]=0;

            }
            else if(a[i-1]==b[j-1])
                l[i][j]=1+l[i-1][j-1];
            else
            {
                l[i][j]=max(l[i][j-1],l[i-1][j]);
            }
        }
    }
    ll p=l[n][m],i=n,j=m;
    vector<char> vec;
    while(i>0&&j>0&&p>0)
    {
        if(a[i-1]==b[j-1])
        {
            vec.pb(a[i-1]);
            p--;
            i--;
            j--;
        }
        else if(l[i-1][j]>l[i][j-1])
        {
            i--;
        }
        else
            j--;
    }
    reverse(vec.begin(),vec.end());
    for(auto x:vec)
    {
        cout<<x;
    }

}


Measured memory_bytes: 70656
N, M, X = map(int, input().split())
C = [0] * N
A = [[0 for _ in range(M)] for _ in range(N)]
for i in range(N):
  A[i] = list(map(int, input().split()))
  C[i] = A[i][0]
  A[i] = A[i][1:]
ans = sum(C) + 1
Y = [0] * M
for p in range(2 ** N):
  for i in range(M):
    Y[i] = 0
  cnt = 0
  _p = p
  for i, c in enumerate(C):
    if _p % 2 == 1:
      cnt += c
      for j, a in enumerate(A[i]):
        Y[j] += a
    _p //= 2
  ans = min(ans, cnt) if min(Y) >= X else ans
print(ans if ans <= sum(C) else -1)

Measured memory_bytes: 9232
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s; cin >> s;
    bool isa = false;
    bool isb = false;
    rep(i,s.size()){
        if(s[i]=='A') isa = true;
        if(s[i]=='B') isb = true;
    }
    cout << ((isa && isb)? "Yes":"No") << endl;
    
}



signed main() {
    solve();
    return 0;
}



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

int main(int argc, char *argv[]) {
  int N, K;
  scanf("%d %d", &N, &K);
  for (int i = 1; i <= N; i += 2) {
    K--;
  }
  if (K <= 0) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int a, b, c, x;
	cin >> a >> b >> c >> x;
	int cnt = 0;
	rep(i, a+1) {
		rep(j, b+1) {
			rep(k, c+1) {
				if (i * 500 + j * 100 + k * 50 == x) {
					cnt++;
				}
			}
		}
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{

 public static void main(String[] args){

 Scanner sc = new Scanner(System.in);

 int a = sc.nextInt();
 int b = sc.nextInt();

 if((a*b)%2 == 0 ){
    System.out.println("Even");
 }else{
    System.out.println("Odd");
 }
 }
}


Measured memory_bytes: 21716
#include<stdio.h>

void addition(int a[100][100],int b[100][100],long long c[100][100],int m,int n,int l){
	int i,i_r, i_c;
	for (i_r = 0; i_r < m; i_r++){
		for (i_c = 0; i_c < l; i_c++){
			for (i = 0; i < n; i++){
				c[i_r][i_c] = c[i_r][i_c] + a[i_r][i] * b[i][i_c];
			}
		}
	}
}

int main(void){
	int m,n,l;
	int a[100][100] = { 0 };
	int b[100][100] = { 0 };
	long long c[100][100] = { 0 };
	scanf("%d %d %d",&m,&n,&l);
	int i_r, i_c;
	for (i_r = 0; i_r < m; i_r++){
		for (i_c = 0; i_c < n; i_c++){
			scanf("%d", &a[i_r][i_c]);
		}
	}
	for (i_r = 0; i_r < n; i_r++){
		for (i_c = 0; i_c < l; i_c++){
			scanf("%d", &b[i_r][i_c]);
		}
	}

	addition(a,b,c,m,n,l);
	for (i_r = 0; i_r < m; i_r++){
		for (i_c = 0; i_c < l-1; i_c++){
			printf("%lld ", c[i_r][i_c]);
		}
		printf("%lld\n", c[i_r][i_c]);
	}


	return 0;
}


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

typedef long long ll;

struct at{
  ll a,t;
};

bool comp(const at &x, const at &y){
  return (x.a*(x.t-1)+y.a*(x.t+y.t-1))<(y.a*(y.t-1)+x.a*(x.t+y.t-1));
}

vector<at> e;

int main(){
  int n;
  cin>>n;
  ll hp,atk,def,sp;
  ll ans=0;
  cin>>hp>>atk>>def>>sp;
  for(int i=0;i<n;i++){
    ll ehp,eatk,edef,esp;
    cin>>ehp>>eatk>>edef>>esp;
    ll dm=max((ll)0,atk-edef);
    ll dmk=max(0LL,eatk-def);
    if(esp>sp)ans+=dmk;
    
    if(dm==0 && dmk>0){
      cout<<-1<<endl;
      exit(0);
    }

    if(dm==0)continue;
    e.push_back((at){dmk,(ehp+dm-1)/dm});
  }

  sort(e.begin(),e.end(),comp);
  ll cnt=0;
  for(int i=0;i< (int)e.size() ;i++){
    ll x=e[i].a,y=e[i].t;
    cnt+=y;
    ans+=x*(cnt-1);
    if(hp-ans<=0) break;
  }
  if(hp-ans<=0) cout<<-1<<endl;
  else cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3828
#include<iostream>
#include<queue>
#include<vector>
#include<tuple>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

template<typename T>
std::vector<std::vector<T>> mk2d(size_t s1, size_t s2, T const& val) {
  std::vector<T> tmp(s2, val);
  return std::vector<std::vector<T>>(s1, tmp);
}

template<typename T>
std::vector<T> mk1d(size_t s, T const& val) {
  return std::vector<T>(s, val);
}

int const dx[4] = {1, 0, -1, 0};
int const dy[4] = {0, 1, 0, -1};
int64_t const INF = 1e18;
int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int H, W, K; std::cin >> H >> W >> K;
  int xs, ys, xg, yg; std::cin >> xs >> ys >> xg >> yg;
  auto bm = mk2d(H+2, W+2, '@');
  for(int h = 1; h <= H; ++h) for(int w = 1; w <= W; ++w) std::cin >> bm[h][w];
  auto dtmp = mk2d(H+2, W+2, INF);
  auto dist = mk1d(2, dtmp);
  using TP = std::tuple<int64_t,int,int,int>;
  std::priority_queue<TP, std::vector<TP>, std::greater<TP>> q;
  q.emplace(0, 0, xs, ys);
  q.emplace(0, 1, xs, ys);
  while(!q.empty()) {
    int d, x, y; int64_t c;
    std::tie(c, d, x, y) = q.top(); q.pop();
    if(c >= dist[d][x][y]) continue;
    dist[d][x][y] = c;
    int64_t nc = ((c+K-1)/K)*K;
    q.emplace(nc, 1-d, x, y);
    int nx = x + dx[d];
    int ny = y + dy[d];
    if(bm[nx][ny] == '.') q.emplace(c+1, d, nx, ny);
    nx = x + dx[d+2];
    ny = y + dy[d+2];
    if(bm[nx][ny] == '.') q.emplace(c+1, d, nx, ny);
  }
  int64_t ans = dist[0][xg][yg];
  if(ans == INF) ans = -1; else ans = (ans+K-1)/K;
  fin(ans);
  return 0;
}


Measured memory_bytes: 76900
// AGC 022 A
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define MAX 100000
void inarray(int a[], int n){
    for(int i = 0; i < n; i++) cin >> a[i];
}

int main(){
    string s; cin >> s;
    int len = s.length();
    int ch[26];
    for(int i = 0; i < 26; i++) ch[i] = 0;
    for(int i = 0; i < len; i++){
        ch[s[i]-'a']++;
    }
    if(s == "zyxwvutsrqponmlkjihgfedcba"){
        cout << -1 << endl;
        return 0;
    }
    if(len < 26){
        cout << s;
        for(int i = 0; i < 26; i++){
            if(ch[i] == 0){
                cout << (char)(i+'a') << endl;
                return 0;
            }
        }
    }else{
        int i = 25;
        for(i = 25; i > 0; i--){
            ch[s[i]-'a']--;
            if(s[i] > s[i-1]){
                break;
            }
        }
        for(int j = 0; j < i-1; j++) cout << s[j];
        for(int k = 0; k < 26; k++){
            if(ch[k] == 0 && s[i-1] < 'a'+k){
                cout << (char)(k+'a') << endl;  
                return 0;
            }
        }
    }
    return 0;
}

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

int main() {
  int A, B, D, N, sum=0;
  cin >> A >> B;
  N = B-A+1;
  
  for (int i=0; i<N; i++) {
    int a,b,c,d,e;
    a = A/10000;
    b = (A-a*10000)/1000;
    c = (A-a*10000-b*1000)/100;
    d = (A-a*10000-b*1000-c*100)/10;
    e = A-a*10000-b*1000-c*100-d*10;
    
    if ((a==e) && (b==d)) {
      sum++;
    }
    
    A++;
  }
  
  cout << sum << endl;
  
}

Measured memory_bytes: 3636
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#define long long ll;
using namespace std;
int main(){
string s;
cin>>s;
int n=s.length();
string s1,s2;
s1=s.substr(0,n/2);
s2=s.substr((n/2)+1,n/2);
if(s1==s2){
    cout<<"Yes"<<endl;
}
else
{
    cout<<"No"<<endl;
}


}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define endl '\n'

using namespace std;

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

	int X, Y, Z;
	cin >> X >> Y >> Z;
	cout << Z << " " << X << " " << Y << endl;

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    N, = read_h()
    A = read_v(N)

    cnts = {}
    for a in A:
        cnts[a] = cnts.get(a, 0) + 1

    #  print(cnts)

    ans = 0
    for n in cnts.values():
        if n % 2 != 0:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 16268
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#include <map>
using namespace std;

void solve(){
  int d, n; cin >> d >> n;
  long long int ans;
  if(d == 0) ans = 1;
  else if(d == 1) ans = 100;
  else ans = 10000;
  if(n == 100) n++;
  cout << ans * n << endl;
  return;
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
from collections import deque
H,W=map(int,input().split())

L=[]
Q=deque()
for i in range(H):
    a=list(input())
    for j in range(W):
        if a[j]==".":
            a[j]=10000
        else:
            a[j]=0
            Q.append([i,j,0])
    L.append(a)
    

#print(L)
#print(Q)
cnt=0
X=[1,-1,0,0]
Y=[0,0,1,-1]
for i in range(10**6+5):
    if len(Q)==0:
        break
    else:
        #print(Q)
        QZ=Q.popleft()
        for j in range(4):
            
            if (QZ[0]+1)<=(H-1) and j==0:
                #print(L[Q[0][0]+X[j]][Q[0][1]+Y[j]])
                if L[QZ[0]+X[j]][QZ[1]+Y[j]]>(QZ[2]+1):
                    L[QZ[0]+X[j]][QZ[1]+Y[j]]=(QZ[2]+1)
                    Q.append([QZ[0]+X[j],QZ[1]+Y[j],QZ[2]+1])
                    if cnt<QZ[2]+1:
                        cnt=Q[0][2]+1
            if (QZ[0]-1)>=(0) and j==1:
                if L[QZ[0]+X[j]][QZ[1]+Y[j]]>(QZ[2]+1):
                    L[QZ[0]+X[j]][QZ[1]+Y[j]]=(QZ[2]+1)
                    Q.append([QZ[0]+X[j],QZ[1]+Y[j],QZ[2]+1])
                    if cnt<QZ[2]+1:
                        cnt=QZ[2]+1
            if (QZ[1]+1)<=(W-1) and j==2:
                if L[QZ[0]+X[j]][QZ[1]+Y[j]]>(QZ[2]+1):
                    L[QZ[0]+X[j]][QZ[1]+Y[j]]=(QZ[2]+1)
                    Q.append([QZ[0]+X[j],QZ[1]+Y[j],QZ[2]+1])
                    if cnt<Q[0][2]+1:
                        cnt=Q[0][2]+1
            if (QZ[1]-1)>=(0) and j==3:
                if L[QZ[0]+X[j]][QZ[1]+Y[j]]>(QZ[2]+1):
                    L[QZ[0]+X[j]][QZ[1]+Y[j]]=(QZ[2]+1)
                    Q.append([QZ[0]+X[j],QZ[1]+Y[j],QZ[2]+1])
                    if cnt<QZ[2]+1:
                        cnt=QZ[2]+1
        #print(L)
      

print(cnt)
#print(L)

Measured memory_bytes: 145756
# coding: utf-8
# Your code here!

N = int(input())
a = list(map(int, input().split()))
a_sort = sorted(a)
ctr = 0

for i in range(N):
    if a[i] != a_sort[i]:
        ctr += 1

if ctr == 0 or ctr == 2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

ll powmod(ll x, ll y) {
    ll res = 1;
    for (ll i = 0; i < y; i++) {
        res = res * x % mod;
    }
    return res;
}
int main() {
    ll n;
    cin >> n;
    ll ans = powmod(10, n) - powmod(9, n) - powmod(9, n) + powmod(8, n);
    ans %= mod;
    ans = (ans + mod) % mod;
    cout << ans << "\n";
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n; cin >> n;
  string s,t; cin >> s >> t;

  string ans = "";
  
  rep(i,n){
    ans+=s[i];
    ans+=t[i];
  }

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


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin >> N >> M;
  vector<int> vote(N);
  int sum = 0;
  for (int i = 0; i < N; i++){
    cin >> vote.at(i);
    sum += vote.at(i);
  }
  
  sort(vote.begin(), vote.end());
  reverse(vote.begin(), vote.end());
  int count = 0;
  for (int i = 0; i < N; i++){
    if (vote.at(i) * 4 * M < sum){
      break;
    }
    else {
      count += 1;
    }
  }
  if (count >= M){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
const int mx = 500005;
int l, r = 1, z[mx*2], s1, s2, j, c, ans, mt[mx];
bool o;
string s, t, u;
int main(){
	cin >> s >> t;
	s1 = s.size(), s2 = t.size();
	u = t + "$";
	while(u.size() < s1+s2*2+1) u += s;
	rep(i,s1+s2+1){
		if((o = z[i-l]+i >= r)) for(l=i, r=max(r,i); u[r-l]==u[r]; r++);
		if((z[i] = o ? r-l : z[i-l]) == s2) mt[i-s2-1] = 1;
	}
	rep(i,s1) if(mt[i]){
		for(j = i, c = 1; mt[j]; c += mt[j=(j+s2)%s1]) mt[j] = 0;
		if(j==i) return 0*puts("-1");
		ans = max(ans, mt[i] = c);
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 9160
import math

a, b, c = list(map(float, input().split()))
c = math.radians(c)
s = 0.5 * a * b * math.sin(c)
l = (a + b) + math.sqrt((a ** 2) + (b ** 2) - (2 * a * b * math.cos(c)))
h = b * math.sin(c)

print("{}\n{}\n{}".format(s, l, h))


Measured memory_bytes: 5692
import sys
input = sys.stdin.readline
# 昇順ソートされた配列の挿入位置indexを返す O(logN)
from bisect import bisect_left

def isOver(A,n,x):
	cnt = 0
	for a in A:
		cnt += n-bisect_left(A,x-a)
	return cnt

def calOut(A,s,n,x):
	out = 0
	for a in A:
		idx = bisect_left(A,x-a)
		out += s[n]-s[idx]+a*(n-idx)
	return out - (isOver(A,n,x)-m)*x

def calX(A,n,m,l,r):
	while r-l>1:
		# x: 握手で得たい最低パワー値
		x = (l+r)//2
		if isOver(A,n,x) >= m:
			l = x
		else: #握手する限界回数すら満たせないほど大きいxなら
			r = x 
	return l

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

#累積和の下準備
A.sort()
S = [0]*(n+1)
for i in range(n):
	S[i+1] = S[i]+A[i]

x = calX(A,n,m,A[0]*2,A[n-1]*2)

print(calOut(A,S,n,x))

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

constexpr int mod = 1e9 + 7;

template<int mod>
struct ModInt {
    int n;
    ModInt(int n_=0):n(
        n_ >= 0 ? n_%mod : mod - ((-n_)%mod)
    ) {}

    ModInt& operator+= (const ModInt& p) {
        if((n+=p.n) >= mod) n-=mod;
        return *this;
    }
    ModInt& operator-=(const ModInt& p) {
        n += mod - p.n;
        if(n >= mod) n-= mod;
        return *this;
    }

    ModInt& operator*=(const ModInt& p) {
        n = (int) ((1LL*n*p.n) % mod);
        return *this;
    }
    ModInt& operator/=(const ModInt& p) {
        *this *= p.inverse();
        return *this;
    }
    ModInt operator-() const {return ModInt(-n);}
    ModInt operator+(const ModInt &p) const {return ModInt(*this) += p;}
    ModInt operator-(const ModInt &p) const {return ModInt(*this) -= p;}
    ModInt operator*(const ModInt &p) const {return ModInt(*this) *= p;}
    ModInt operator/(const ModInt &p) const {return ModInt(*this) /= p;}
    
    bool operator==(const ModInt &p) const {return n==p.n;}
    bool operator!=(const ModInt &p) const {return n!=p.n;}

    ModInt inverse() const {
        int a=n, b=mod, u=1, v=0;
        while(b) {
            int t = a/b;
            a -=t*b; swap(a,b);
            u -= t*v; swap(u,v);
        }
        return ModInt(u);
    }
    ModInt pow(int64_t z) const {
        ModInt ret(1), mul(n);
        while(z>0) {
            if(z&1) ret *= mul;
            mul *= mul;
            z >>= 1;
        }
        return ret;
    }
    friend ostream &operator<<(ostream &os, const ModInt &p){
        return os << p.n;
    }
    friend istream &operator>>(istream &is, ModInt &a){
        int64_t t;
        is >> t;
        a = ModInt<mod> (t);
        return (is);
    }
};
using modint = ModInt<mod>;

int main(int argc, char const *argv[])
{
    int n,a,b; cin>>n>>a>>b;
    modint z(2);
    z = z.pow(n) - 1;
    modint tmp(1);
    for(int i=1; i<=a; i++) {
        tmp *=n-a+i;
        tmp /= i;
    }
    z -= tmp;
    tmp = 1;
    for(int i=1; i<=b; i++) {
        tmp*= n-b+i;
        tmp /= i;
    }
    cout << z-tmp << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#define ll long long
#define maxn 200005
#define re register
#define inf 1e9
#define eps 1e-10
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll a,b;

int main()
{
	cin>>a>>b;
	cout<<a/__gcd(a,b)*b;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
d = [input().split() for i in range(n)]
# print(d)
# dice1 = input().split()
# dice2 = input().split()
# dice3 = input().split()

def rotate(faces, move):
    for i in range(len(move)):
        m = move[i]
        
        if m == "N":
            # N
            tmp = faces[4]
            faces[4] = faces[0]
            faces[0] = faces[1]
            faces[1] = faces[5]
            faces[5] = tmp
            
        elif m == "S":
            # S
            tmp = faces[1]
            faces[1] = faces[0]
            faces[0] = faces[4]
            faces[4] = faces[5]
            faces[5] = tmp
            
        elif m == "E":
            # E
            tmp = faces[2]
            faces[2] = faces[0]
            faces[0] = faces[3]
            faces[3] = faces[5]
            faces[5] = tmp
            
        elif m == "W":
            # W
            tmp = faces[3]
            faces[3] = faces[0]
            faces[0] = faces[2]
            faces[2] = faces[5]
            faces[5] = tmp

# for k, v in enumerate(dice1):
#     print(k, v)
#     if v in dice2:
#         index1 = dice2.index(v)
#         print(index1)

# if dice1[2] in dice2:
#     index1 = dice2.index(dice1[2])
#     if index1 == 0:
#         rotate(dice1, "W")
#     elif index1 == 1:
#         rotate(dice1, "WS")
#     elif index1 == 2:
#         pass
#     elif index1 == 3:
#         rotate(dice1, "WW")
#     elif index1 == 4:
#         rotate(dice1, "WN")
#     elif index1 == 5:
#         rotate(dice1, "E")
        
def equals(a, b):
    for (a1, b1) in zip(a, b):
        if a1 != b1:
            return False
            
    return True


def check(a, b):
    # print(a, b)
    isMatch = equals(a, b)
    
    
    looping = True
    for j in range(4):
        #print(dice1)
        if isMatch:
            break
        for i in range(4):
            # print(a)
            rotate(a, "N")
            if equals(a, b):
                isMatch = True
                break
        #print('----')
        #print(dice1)
        rotate(a, "W")
        #print(dice1)
    
    # print('---- ---- ----')
    #print(copy_list)
    # print('---- ---- ----')
    
    rotate(a, "NW")
    
    for j in range(4):
        #print(dice1)
        if isMatch:
            break
        for i in range(4):
            #print(dice1)
            rotate(a, "N")
            if equals(a, b):
                isMatch = True
                break
        #print('----')
        #print(dice1)
        rotate(a, "W")
        #print(dice1)
    
    return isMatch
    

result = True
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        
        if (check(d[i], d[j])):
            result = False

if result:
    print('Yes')
else:
    print('No')



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

int x[105];
int y[105];
int h[105];

int main()
{
    int n;
    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> x[i] >> y[i] >> h[i];
    }

    for(int i = 0; i <= 100; ++i){
        for(int j = 0; j <= 100; ++j){

            int curH;
            bool br = false;

            for(int ind = 0; ind < n; ++ind){
                if(h[ind] != 0){
                    curH = h[ind] + abs(x[ind] - i) + abs(y[ind] - j);
                    break;
                }
            }

            for(int ind = 0; ind < n; ++ind){
                if(max(curH - abs(x[ind] - i) - abs(y[ind] - j), 0) != h[ind]){
                    br = true;
                    break;
                }
            }

            if(!br){
                cout << i << " " << j << " " << curH << "\n";
                return 0;
            }

        }
    }

    return 0;
}


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

using namespace std;
using ll = long long;

const int N = 1e6 + 5, mod = 1e9 + 7, inf = 1e9 + 7;
const ll INF = 1e18 + 5;

main() {
    ios :: sync_with_stdio(0);
    cin.tie(0);
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int cnt = 0;
    while (b <= a) {
        b *= 2;
        ++cnt;
    } 
    while (c <= b) {
        c *= 2;
        ++cnt;
    }
    if (cnt <= k) cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
 
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define INF 999999999
#define MOD 1000000007
 
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
 
int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};
 
int n;
ll ma, mb;
ll a;
set<ll> S;
 
int main(){
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> a;
		if(S.count(a)){
			S.erase(a);
			if(a > ma){
				mb = ma;
				ma = a;
			}else if(a > mb){
				mb = a;
			}
		}else{
			S.insert(a);
		}
	}
	cout <<  ma * mb << endl;
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  ll n,m;
  cin >>n>>m;
  ll l[m],r[m];
  for(ll i=0;i<m;i++){
    cin >>l[i]>>r[i];
  }
  ll t[n];
  for(ll i=0;i<n;i++) t[i]=0;
  for(ll i=0;i<m;i++){
    t[l[i]-1]++;
    t[r[i]]--;
  }
  for(ll i=0;i<n;i++){
    if(i>0) t[i]+=t[i-1];
  }
  ll ans=0;
  for(ll i=0;i<n;i++){
    if(t[i]==m) ans++;
  }
  cout <<ans<<endl;
  return 0;
}


Measured memory_bytes: 2560
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

a,b=[0],[0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

ans,j=0,M

for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j-=1
    
    ans = max(ans,i+j)

print(ans)


Measured memory_bytes: 47680
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

int n, x, minn = 0x3f3f3f3f, maxx = -1;

int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
		scanf( "%d", &x ), minn = min(minn, x), maxx = max(maxx, x);
	cout << maxx - minn << endl;
	return 0;
}

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

int
main (
  int   argc,
  char *argv[ ]
  )
{
  int a, b;

  scanf ( "%d%d", &a, &b );
  printf ( "%.4f\n", a * b / 3.305785 );

  return ( EXIT_SUCCESS );
}

Measured memory_bytes: 636
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
void insertionSort(int A[], int N);
int main() {
	int A[100] = { 0 }, n, i;
	scanf("%d", &n);
	for (i = 0; i < n; i++) scanf("%d", &A[i]);
	insertionSort(A, n);
	return 0;
}

void insertionSort(int A[], int N)
{
	int i, j, v, k;
	for (k = 0; k < N; k++) printf("%d%c", A[k], k < N - 1 ? ' ' : '\n');
	for (i = 1; i <= N - 1; i++) {
		v = A[i];
		j = i - 1;
		while (j >= 0 && A[j] > v) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		for (k = 0; k < N; k++) printf("%d%c", A[k], k < N-1 ? ' ' : '\n');
	}
}

Measured memory_bytes: 600
using System;
class _0034
{
    public static void Main()
    {
        string str;
        string[] data;
        int L, k;
        double t, mPos, sum;
        while ((str = Console.ReadLine()) != null)
        {
            L = 0; t = 0; mPos = 0; sum = 0;
            data = str.Split(',');
            for (int i = 0; i < data.Length - 2; i++) L += int.Parse(data[i]);
            t = (double)L / (double.Parse(data[10]) + double.Parse(data[11]));
            mPos = double.Parse(data[10]) * t;
            k = 0;
            while (mPos > sum)
            {
                sum += double.Parse(data[k]);
                k++;
            }
            Console.WriteLine((int)mPos == (int)sum ? k : k);
        }
    }
}

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

int main(){
  int n,a[210];
  cin >> n;
  for(int i=0;i<n;i++) cin >> a[i];

  int cnt = 0;

  while(true){
    bool exist_odd = false;
    for(int i=0;i<n;i++){
      if(a[i]%2 != 0) exist_odd=true;
    }

    if(exist_odd) break;

    for(int i=0;i<n;i++){
      a[i] /= 2;
    }

    cnt++;
  }

  cout << cnt <<endl;
}


Measured memory_bytes: 256