akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}

vector<int>v[2*maxn];
int ans[2*maxn];
int val[2*maxn];
int dropped[2*maxn];
set<int>s;
void dfs(int st, int p){
	
	auto t = s.lower_bound(val[st]);
	if(t==s.end()) s.insert(val[st]);
	else{
		s.erase(*t);
		dropped[st] = *t;
		s.insert(val[st]);
	}
	
	ans[st] = s.size();
	for(auto i:v[st]){
		if(i==p) continue;
		dfs(i,st);
	}
	s.erase(val[st]);
	if(dropped[st]){
		s.insert(dropped[st]);
	}
}

int32_t main(){
	fastio();
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>val[i];
	}
	for(int i=1;i<=n;i++){
		int a,b;
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	

	
	dfs(1,0);
	for(int i=1;i<=n;i++){
		cout<<ans[i]<<"\n";
	}
}

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

using namespace std;

int main()
{

    string s1,s2,u;
    int a,b;
    cin>>s1>>s2;
    cin>>a>>b;
    cin>>u;
    if(u==s1)cout<<a-1<<" "<<b;
    else if(u==s2)cout<<a<<" "<<b-1;
    else cout<<a<<" "<<b;

    //cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 256
/* Simplicity and Goodness */

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

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int maxN = 2e5+2;

ll me(ll x, ll n, ll m)
{
    ll res = 1; x %= m;
    while(n) {
        if(n & 1) res = (1LL * res * x) % m;
        x = (1LL * x * x) % m;
        n >>= 1;
    }
    return res;
}

void solve()
{
    ll k;
    lscn(k);

    ll remain = 0;

    for(ll i = 0; i <= (ll) 1e6 + 2; ++ i) {
        ll here = me(10, i, k);
        here = (here * 7LL) % k;

        remain += here;

        if(remain % k == 0) {
            lprin(i + 1);
            exit(0);
        }

        if(here == 0) {
            prin(-1);
            exit(0);
        }
    }

    prin(-1);
}

int main()
{
    int t = 1;
    // scn(t);
    while(t --) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3824
#include <iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>
#include<map>
#include<queue>
using namespace std;

int main() {
	int n;
	int ans = 0;
	cin >> n;
	vector<int>l;
	for (int i = 0; i < n; i++) {
		int L;
		cin >> L;
		l.push_back(L);
	}
	sort(l.begin(), l.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
				if (l[i] < l[j] + l[k]) {
					ans++;
				}
				else {
					break;
				}
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		new Main().hattaiSource();
	}

	public void hattaiSource(){

		Scanner inputscan = new Scanner(System.in);

		int W = inputscan.nextInt();
		int H = inputscan.nextInt();
		int x = inputscan.nextInt();
		int y = inputscan.nextInt();
		int r = inputscan.nextInt();

		int Horizontal1 = x - r;
		int Horizontal2 = x + r;
		int Vertical1 = y - r;
		int Vertical2 = y + r;

		if(Horizontal1 >=0 && Horizontal2 <= W
				&& Vertical1 >=0 && Vertical2 <=H){
			//System.out.println("??????");
			System.out.println("Yes");
		}else{
			//System.out.println("?????????");
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 26312
#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(){
  int h,w;
  cin>>h>>w;
  char board[h+2][w+2]={};
  int b_num[h+2][w+2]={};
  FOR(i,1,h+1){
    FOR(j,1,w+1){
      cin>>board[i][j];
    }
  }
  FOR(i,1,h+1){
    FOR(j,1,w+1){
      if(board[i][j]=='#'){
        b_num[i-1][j-1]++;
        b_num[i-1][j]++;
        b_num[i-1][j+1]++;
        b_num[i][j-1]++;
        b_num[i][j+1]++;
        b_num[i+1][j-1]++;
        b_num[i+1][j]++;
        b_num[i+1][j+1]++;}
        }
  }
  FOR(i,1,h+1){
    FOR(j,1,w+1){
      if(board[i][j]=='#'){cout<<'#';}
      else{cout<<b_num[i][j];}
    }cout<<endl;
  }
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long int
#define vi vector <int>
#define FOR(i,a,b) for(int i=a; i<b; i++)
using namespace std;
int t;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
  
    string s;
    cin>>s;
    if (s[2]==s[3] && s[4]==s[5]) cout<<"Yes"; else cout<<"No";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef pair<int,int> pa;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
const int MO=1e9+7;
int n;
LL f[111][111][111],C[111][111];
int main(){
	cin>>n;
	C[0][0]=1;
	FOR(i,1,n){
		C[i][0]=1;
		FOR(j,1,i) C[i][j]=(C[i-1][j]+C[i-1][j-1])%MO;
	}
	f[0][0][0]=1;
	FOR(i,1,n)
		FOR(a,0,i)
			FOR(b,0,i-a){
				if (a==0 && b==0) continue;
				FOR(x,0,a+b){
					LL t=0;
					int d=x-a;
					FOR(A,0,i-a-b){
						int B=A+d;
						if (B<0) continue;
						(t+=f[i-a-b][A][B])%=MO;
					}
					(f[i][a][b]+=t*C[i][x]%MO*C[i-x][a+b-x])%=MO;
				}
			}
	cout<<(f[n][0][1]%MO+MO)%MO<<endl;
	return 0;
}

Measured memory_bytes: 4608
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdio>
#include<string.h>
using namespace std;
#define LL long long int
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define PI pair<int,int>
#define mem(a,t) memset(a,t,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(v) (int)sizeof(v)
const int inf=0x3f3f3f3f;
const int mod=10007;
const int M=20;
using namespace std;
#define N 100005
string str;
int main()
{
    int k,n,i;
    cin>>str>>k;
    n=str.length();
    for(i=0;i<n;++i){
        if(str[i]=='a')
            continue;
       int  t='z'-str[i]+1;
        if(t<=k){
            k-=t;
            str[i]='a';
        }
    }
    if(k){
        k%=26;
        while(k--){
            if(str[n-1]<'z'){
                str[n-1]++;
            }
            else{
                str[n-1]='a';
            }
        }
    }
    cout<<str<<endl;
    return 0;
}


Measured memory_bytes: 512
// practice with Dukkha
#include <algorithm>
#include <iostream>

using namespace std;

const int N = 200000;

int aa[N * 2];

int main() {
	int n; cin >> n;
	int m = 0;
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		int x = a + i, y = i - a;
		aa[m++] = x << 1;
		if (y > 0)
			aa[m++] = y << 1 | 1;
	}
	n = m;
	sort(aa, aa + n);
	long long ans = 0;
	for (int i = 0, j, k; i < n; i = k) {
		int a = aa[i] >> 1;
		j = i;
		while (j < n && aa[j] == (a << 1))
			j++;
		k = j;
		while (k < n && aa[k] == (a << 1 | 1))
			k++;
		ans += (long long) (j - i) * (k - j);
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 5000
#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>
#include <math.h>
#include <time.h>
#include <assert.h>
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end() 
#define PII pair <ll,pair<int, int>>
#define N 100005
#define MOD 1000000007
#define INF 1000000000000000000
using namespace std;

int main()
{
	int n;
	cin >> n;
	cout << (n - 2) * 180;
}

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

typedef long long int ll;
typedef struct node
{
    int x,y;
    ll h;
}model;
model a[105];

ll MAX(ll a,ll b)
{
    if(a > b) return a;
    else return b;
}

int cmp(model m,model n)
{
    return m.h<n.h;
}

int main()
{
    int n;
    int i,j,k;
    int p;
    int cx,cy;
    ll H;

    scanf("%d",&n);
    for(i = 0;i < n;i++)
    {
        scanf("%d%d%lld",&a[i].x,&a[i].y,&a[i].h);
    }
    sort(a,a+n,cmp);

    p = 0;
    while(a[p].h == 0)
    {
        p++;
    }

    int flag;
    for(i = 0;i <= 100;i++)
    {
        for(j = 0;j <= 100;j++)
        {
            flag = -1;
            cx = i,cy = j;
            H = a[p].h+abs(cx-a[p].x)+abs(cy-a[p].y);

            for(k = 0;k < n;k++)
            {
                int temp = H-abs(cx-a[k].x)-abs(cy-a[k].y);
                if(temp < 0) temp = 0;
                if(a[k].h != temp)
                {
                    break;
                }
            }
            if(k == n)
            {
                flag = 1;
                break;
            }
        }
        if(flag == 1) break;
    }
    printf("%d %d %lld\n",cx,cy,H);

    return 0;
}


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  string s;
  cin >> s;

  string t = "CODEFESTIVAL2016";

  int ans = 0;
  rep(i, s.length()){
    if(s[i] != t[i]){
      ans++;
    }
  }

  cout << ans << endl;



  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long q = sc.nextInt();
		long h = sc.nextInt();
		long s = sc.nextInt();
		long d = sc.nextInt();
		long n = sc.nextInt();
		sc.close();
		long sum = 0;
		if(d/2<=s && d/2<=2*h && d/2<=4*q) {
			sum += n/2*d;
			if(n%2==1) {
				if(s<=2*h && s<=4*q) {
					sum += s;
				} else if(2*h<=s && h<=2*q) {
					sum += 2*h;
				} else {
					sum += 4*q;
				}
			}
		} else if(s<=2*h && s<=4*q) {
			sum += n*s;
		} else if(h<=2*q) {
			sum += 2*n*h;
		} else {
			sum += 4*n*q;
		}
		System.out.println(sum);
	}

}

Measured memory_bytes: 23892
#include<stdio.h>
#include <string.h>


int main(void){
    int num,i;
    long int x=0,min=1000000,max=-1000000,sum=0;
    scanf("%d",&num);
    for(i=0;i<num;i++){
        scanf("%ld",&x);
        sum = sum+x;
        if(min>=x){
        min = x;
        }
        if(max<=x){
        max = x;
        }
    }
    printf("%ld %ld %ld\n",min,max,sum);

    return 0;
}

Measured memory_bytes: 600
open Batteries

let sum a b c =
  let p = List.combine a b in
  let rec aux acc = function
    | [] -> acc + c
    | (a1, b1) :: rest -> aux (acc + (a1 * b1)) rest
  in
  aux 0 p

let () =
  let n, _, c =
    Scanf.sscanf (read_line ()) "%d %d %d" (fun a b c -> (a, b, c))
  in
  let b = read_line () |> String.split_on_char ' ' |> List.map int_of_string in
  let ans = ref 0 in
  for i = 0 to n - 1 do
    let a =
      read_line () |> String.split_on_char ' ' |> List.map int_of_string
    in
    if sum a b c > 0 then ans := !ans + 1 else ()
  done;
  print_int !ans;
  print_newline ()


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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int ans=10000000;
	for (int i = 1; i < n; ++i)
	{
		int l=i,r=n-i,nans=0;
		while (l>0)
		{
			nans+=l%10;
			l/=10;
		}
		while (r>0)
		{
			nans+=r%10;
			r/=10;
		}
		ans=min(ans,nans);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
N=int(input())
s=[]
nin=10**7
for i in range(N):
    temp=int(input())
    if temp%10!=0:
        nin=min(nin,temp)
    s.append(temp)

ans=sum(s)
if ans%10==0:
    ans-=nin
    print(max(ans,0))
else:
    print(ans)


Measured memory_bytes: 9148
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#include<map>
#include<iomanip>

#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 VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
const vector<VE> DIR{ {-1,0},{1,0},{0,-1},{0,1} };
const llong MOD = 1000000007;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
template<class T>
int dp2csv(const vector<vector<T>> & dp, const string fname);
int range_check(int val, int min, int max) {
	if (val < min) {
		return -1;
	}
	if (val > max) {
		return -1;
	}
	return val;
}
template<class T,class T1>
bool array_find(const T& array, const T1& dst) {
	auto result = find(array.first(), array.end(), dst);
	if (result == array.end()) {
		return false;
	}
	else {
		return true;
	}
}
int main() {
	llong a, b;
	cin >> a >> b;
	llong c = GCD(a, b);
	llong ans = a * b / c;
	cout << ans << endl;
	return 0;
}
template<class T>
int dp2csv(const vector<vector<T>> & dp, const string fname) {
	ofstream ofs(fname);
	if (ofs.fail()) { cerr << "cannot open file. :" + fname << endl; return -1; }
	for (auto dp_row : dp) {
		for (auto dp_cell : dp_row) {
			ofs << dp_cell << ",";
		}
		ofs << endl;
	}
	ofs.close();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (ll i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    int x;
    cin >> x;
    cout << !x << endl;
}


Measured memory_bytes: 3560
//Problem Y

#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define endl "\n"
 
int myXOR(int x, int y) 
{ 
    int res = 0; 
      
    for (int i = 31; i >= 0; i--)                      
    { 
    
       bool b1 = x & (1 << i); 
       bool b2 = y & (1 << i); 
         

        bool xoredBit = (b1 & b2) ? 0 : (b1 | b2);           
  
        
        res <<= 1; 
        res |= xoredBit; 
    } 
    return res; 
} 
 
int main ()
{
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  //#define int ll
  
  int n;
  cin >> n;
  vector <int> numbers(n);
  int total;
  cin >> total;
  numbers[0] = total;
  for (int i=1; i<n; i++){
      cin >> numbers[i];
      total = myXOR(total, numbers[i]);
  }
  
  for (int i=0; i<n; i++){
      cout << myXOR(total, numbers[i]) << " ";
  }
  cout << endl;
  
  
  return 0;
  
}


Measured memory_bytes: 3984
N,M = gets.split.map(&:to_i)
A = []
for i in 0..N-1
    A[i] = []
    A[i] = gets.strip.split.map(&:to_i)
end
B = []

for i in 0..N-1
    B[i] = A[i][0]
    A[i].delete_at(0)
end
count = 0

for i in 0..M-1

    a = 0

    for j in 0..N-1

        if A[j].none?{|x| x == i+1}

            a = 1

        end

    end

    if a == 0

        count += 1

    end

end

puts count 
       


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int dist[505][505],n,p[250005];
bool f[505][505];
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int cnt;
inline void Min(int&x,int y){if(x>y)x=y;}
inline void dfs(int x,int y){
	for(int d=0;d<4;++d){
		int tx=x+dx[d],ty=y+dy[d];
		if(tx<1 or tx>n or ty<1 or ty>n)continue;
		if(dist[tx][ty]>dist[x][y]+f[x][y]){
			dist[tx][ty]=dist[x][y]+f[x][y];
			dfs(tx,ty);
		}
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;++i)for(int j=1;j<=n;++j)f[i][j]=1,dist[i][j]=min(min(i-1,n-i),min(j-1,n-j));
	for(int i=1;i<=n*n;++i){
		cin>>p[i];
		int x=(p[i]-1)/n+1,y=(p[i]-1)%n+1;
		cnt+=dist[x][y];
		f[x][y]=0;
		dfs(x,y);
	}
	cout<<cnt<<'\n';
}

Measured memory_bytes: 25080
N = int(input())
X=10**12
Y=10**12
flag = 0
for i in range(2,int(N**0.5)+2):
  if N%i==0:
    flag = 1
    temp = N//i
    if X+Y > temp+i:
      X = i
      Y = temp
      
if flag==0 or X+Y > N+1:
  X = N
  Y = 1
print(X+Y-2)

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

int main() 
{
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    for(int i = 0; i < H - B; ++i) {
        for(int j = 0; j < W - A; ++j) {
            printf("1");
        }
        for(int j = 0; j < A; ++j) {
            printf("0");
        }
        printf("\n");
    }
    for(int i = 0; i < B; ++i) {
        for(int j = 0; j < W - A; ++j) {
            printf("0");
        }
        for(int j = 0; j < A; ++j) {
            printf("1");
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main(){
    int ans=100,n,a;cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;int cnt=0;
        while(a%2==0){
            a/=2;cnt++;
        }
        if(cnt<ans)ans=cnt;
        
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,ans=0,anss=0;
    long int a[10005];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		
	} 
	while(1){
    for(int i=0;i<n;i++){
    	//cin>>a[i];
    	if(a[i]%2==0){
    		ans++;
    		a[i]=a[i]/2;
	}
}
if(anss==ans){
	break;
}
anss=ans;
}
	cout<<ans;
	
	return 0;
} 

Measured memory_bytes: 384
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spacesn

m, d = na()
ct = 0
for i in range(1, m+1):
    for j in range(1, d+1):
        d1 = j %10
        d10 = j//10
        if i == d1 * d10 and d1 >= 2 and d10 >= 2:
            ct +=1
print(ct)

Measured memory_bytes: 38512
N,K=map(int,input().split())
P=[0]+list(map(int,input().split()))
C=[0]+list(map(int,input().split()))
D=[0 for i in range(N+1)]
D[0]=5

ans=-10**20
for i in range(1,N+1):
    if D[i]==0:
        D[i]=1
        p=P[i]
        cnt=-10**20
        L=[0]
        l=[i]
        for j in range(10**7):
            if D[p]==5:
                break
            else:
                D[p]+=1
                L.append(L[-1]+C[p])
                l.append(p)
                p=P[p]
        #print(L)
        #print(l)
        loop_len=len(L)//5
        loop_cnt=L[loop_len]
        #print(loop_len)
        #print(loop_cnt)
        R=K//loop_len
        M=K%loop_len
        loop_max=-10**20
        if R>=2 and loop_cnt>0:
            cnt+=(R-2)*loop_cnt
            for x in range(loop_len):
                for y in range(1,M+2*loop_len+1):
                    loop_max=max(loop_max,L[y+x]-L[x])
            cnt=max(cnt,loop_cnt*(R-2)+loop_max)
            #print(L,cnt)
            ans=max(ans,cnt)
        else:
            cnt=-10**20
            for x in range(loop_len):
                for y in range(1,min(K,2*loop_len)+1):
                    cnt=max(cnt,L[y+x]-L[x])
                    #print(L,cnt,x,y,R)
            ans=max(ans,cnt)
#print(D)
print(ans)

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

#define rep(i,n) for(signed i=0;i<n;++i)
#define int long long
#define str string
#define debg(a) cout<<#a<<":"<<a<<endl;
#define print(a) cout<<a<<endl;
#define end cout<<endl;
#define elif else if

int even[100001],odd[100001];

signed main(){
  int n;
  cin>>n;
  int mxa=0,mxb=0,a=0,b=0,x;
  rep(i,n){
    cin>>x;
    if(i%2==0){
      even[x]++;
      if(mxa<even[x]){
        mxa=even[x];
        a=x;
      }
    }
    else {
      odd[x]++;
      if(mxb<odd[x]){
        mxb=odd[x];
        b=x;
      }
    }
  }
  sort(even,even+100001);
  sort(odd,odd+100001);
  reverse(even,even+100001);
  reverse(odd,odd+100001);

  if(a!=b)cout<<(n-mxa-mxb);
  else cout<<(n-max(mxa+odd[1],even[1]+mxb));


  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	int a,b,d,r;
	double x,y,f;
	cin>>a>>b;
	d=a/b;
	r=a%b;
	x=a;
	y=b;
	f=x/y;
	cout<<d<<" "<<r<<" ";
	printf("%f5",f);
	cout<<endl;
	return 0;
}

Measured memory_bytes: 3160
n, m = map(int, input().split())
X = sorted(list(map(int, input().split())))
A = []
for a, b in zip(X, X[1:]):
	A.append(b - a - 1)
A.sort(reverse = True)
print(X[-1] - X[0] + 1 - sum(A[:n-1]) - n if n < m else 0)

Measured memory_bytes: 58920
package main

import (
	"fmt"
	"math"
)

func main() {
	var N float64
	fmt.Scanf("%f", &N)
	i := 100.0
	cnt := 0
	for ; i < N; cnt++ {
		i = math.Floor(i * 1.01)
	}
	fmt.Println(cnt)
}

Measured memory_bytes: 1820
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input())
    a = list(int(_) for _ in input().split())
    a.sort()
    a = a[::-1]
    ans = 0
    for i in range(N):
        if i % 2 == 0:
            ans += a[i]
        else:
            ans -= a[i]
    print(ans)
    
if __name__ == '__main__':
    main()


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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  vector<vector<int>> v(3, vector<int>(n, 0));
  vector<vector<int>> h(3, vector<int>(n, 0));
  for (int i = 0; i < n; i++) {
  	scanf("%d %d %d", &v[0][i], &v[1][i], &v[2][i]);
  }
  for (int j = 0; j < 3; j++) {
    h[j][0] = v[j][0]; // min(v[(j + 1) % 3][0], v[(j + 2) % 3][0]);
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      h[j][i] = v[j][i] + max(h[(j + 1) % 3][i - 1], h[(j + 2) % 3][i - 1]);
    }
  }
  printf("%d\n", max(h[0][n - 1], max(h[1][n - 1], h[2][n - 1])));
  return 0;
}

Measured memory_bytes: 2940
package main

import (
	"fmt"
)


func main() {
	var n int
	fmt.Scan(&n)

	min := int(1e16)
	for i := 0 ; i < 5; i++{
		var a int
		fmt.Scan(&a)
		if min > a {
			min = a
		}
	}
	p := 0
	if n % min != 0 {
		p= 1

	}

	fmt.Println(n/min + 4+p)


}



Measured memory_bytes: 1768
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

solve :: Int -> [Int] -> [Int] -> [Int] -> Int
solve _ [] _ _ = 0
solve prev (a:as) bs cs
    | a - prev == 1 = (cs !! prev) + (bs !! a) + solve a as bs cs
    | otherwise     = (bs !! a) + solve a as bs cs

r = fst . fromJust . BS.readInt

main = do
    _  <- getLine
    as <- map ((\x -> x-1) . r) . BS.words <$> BS.getLine
    bs <- map r . BS.words <$> BS.getLine
    cs <- map r . BS.words <$> BS.getLine
    print $ (bs !! head as) + solve (head as) (tail as) bs cs


Measured memory_bytes: 508
N = input()
K = int(input())

count = len(N)

dp = [[[0] * 2 for _ in range(4)] for _ in range(105)]

dp[0][0][0] = 1

for i in range(count):
    for j in range(4):
        for k in range(2):
            nd = int(N[i])
            for d in range(10):
                ni = i + 1
                nj = j
                nk = k
                if d != 0:
                    nj += 1
                if nj > K:
                    continue
                if k == 0:
                    if d > nd:
                        continue
                    if d < nd:
                        nk = 1
                dp[ni][nj][nk] += dp[i][j][k]

ans = dp[count][K][0] + dp[count][K][1]
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>
int main() {
	int m, d, cnt = 0;
	scanf("%d%d", &m, &d);
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= d; j++) {
			int d1, d10;
			d1 = j % 10;
			d10 = (j - d1) / 10;
			if (d1 >= 2 && d10 >= 2 && d1 * d10 == i) {
				cnt++;
			}
		}
	}
	printf("%d\n", cnt);
	return 0;
}

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

using namespace std;

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

  vector<vector<int>> A(3, vector<int>(3));
  for (int i = 0; i < 3; ++i) {
    cin >> A[i][0] >> A[i][1] >> A[i][2];
  }
  int N;
  cin >> N;
  unordered_set<int> b;
  int tmp;
  for (int i = 0; i < N; ++i) {
    cin >> tmp;
    b.insert(tmp);
  }

  vector<vector<bool>> v(3, vector<bool>(3));
  for (int r = 0; r < 3; ++r) {
    for (int c = 0; c < 3; ++c) {
      auto it = b.find(A.at(r).at(c));
      if (it == b.end()) {
        v.at(r).at(c) = false;
      } else {
        v.at(r).at(c) = true;
      }
    }
  }

  for (int r = 0; r < 3; ++r) {
    if (v[r][0] && v[r][1] && v[r][2]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  for (int c = 0; c < 3; ++c) {
    if (v[0][c] && v[1][c] && v[2][c]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (v[0][0] && v[1][1] && v[2][2]) {
    cout << "Yes" << endl;
    return 0;
  }
  if (v[0][2] && v[1][1] && v[2][0]) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool IsOK(ll N, const vector<ll>& A)
{
    assert(A.size() == N);

    const ll sum = accumulate(all(A), 0LL);
    const ll sumN = N * (N + 1) / 2;

    if (sum % sumN != 0)
    {
        return false;
    }

    const ll opNum = sum / sumN;

    vector<ll> diff(N);
    rep(i, 0, N)
    {
        diff[i] = A.at(i) - A.at(((i - 1) + N) % N);
    }

    if (accumulate(all(diff), 0LL) != 0)
    {
        return false;
    }

    vector<ll> oneNum(N);
    rep(i, 0, N)
    {
        if (opNum - diff[i] < 0)
        {
            return false;
        }

        if ((opNum - diff[i]) % N != 0)
        {
            return false;
        }

        oneNum[i] = (opNum - diff[i]) / N;
    }

    if (accumulate(all(oneNum), 0LL) != opNum)
    {
        return false;
    }

    return true;
}

void _main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, 0, N) cin >> A[i];
    cout << (IsOK(N, A) ? "YES" : "NO") << endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using ll=long long;
using vi=vector<int>;
using pii=pair<int, int>;

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
ll read(){ll a;scanf("%lld",&a);return a;}

const int inf = 3 * TEN(18) + 10;
const int mod = 998244353;

signed main()
{
	int A, B; cin >> A >> B;

	cout << max({A + B, A - B, A * B}) << endl;
}




Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);
const long double PI = std::acos(-1.0L);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	long double a,b,h,m,ans;
	std::cin >> a >> b >> h >> m;
	h *= 60.0L; h += m; h *= PI; h /= 360.0L; m *= PI; m /= 30.0L;
	ans = std::sqrt(a*a+b*b-a*b*std::cos(h-m)*2);
	std::cout << std::fixed << std::setprecision(50) << ans << std::endl;
	return 0;
}


Measured memory_bytes: 3944
#include <stdio.h>
 
int main(void)
{
  int n;
  char s[10000];
  int i, j;
  
  scanf("%d %s", &n, s);
  
  i = 0;
  while (s[i] != '\0') {
    j = 0;
    while (j < n) {
      if (s[i] == 'Z')
        s[i] = 'A';
      else
        s[i]++;
      j++;
    }
    i++;
  }
  
  printf("%s\n", s);
  
  return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int h=in.nextInt();
		int w=in.nextInt();
		String[] G=new String[h];
		int[][] dp=new int[h][w];
		int mod=1000000007;
		for (int i=0;i<h;++i)
			G[i]=in.next();
		if (G[0].charAt(0)=='.') dp[0][0]=1;
		for (int i=0;i<h;++i)
			for (int j=0;j<w;++j) if (i>0||j>0) {
				if (G[i].charAt(j)=='#') continue;
				if (i>0) dp[i][j]+=dp[i-1][j];
				if (dp[i][j]>=mod) dp[i][j]-=mod;
				if (j>0) dp[i][j]+=dp[i][j-1];
				if (dp[i][j]>=mod) dp[i][j]-=mod;
			}
		System.out.println(dp[h-1][w-1]);
	}
}

Measured memory_bytes: 34684
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using dl = long double;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b+c>=22)cout<<"bust";
    else cout<<"win";

    return 0;
}


Measured memory_bytes: 256
def insertion(mi):
    cnt = 0
    for i in range(mi, n):
        v = A[i]
        j = i - mi
        while j >= 0 and A[j] > v:
            A[j+mi] = A[j]
            j -= mi
            cnt += 1
        A[j+mi] = v
    return cnt


def shell():
    g = list()
    h = 1

    if n == 1:
        g.append(h)
    else:
        while h < len(A):
            g.append(h)
            h = 3 * h + 1

    return g


n = int(input())
A = list()
m = list()
count = 0

for k in range(n):
    A.append(int(input()))

m = shell()

print(len(m))

m_list = [str(m[k]) for k in reversed(range(len(m)))]
print(' '.join(m_list))

for k in reversed(m):
    count += insertion(k)

print(count)

for k in range(len(A)):
    print(A[k])



Measured memory_bytes: 45524
#include<bits/stdc++.h>
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define LSOne(i) (i&(-i))
#define rep(i,a,b) for(int(i)=(a);(i)<(b);i++)
#define rrep(i,a,b) for(int(i)=(a);(i)>(b);i--)
#define BUG(x) {cout<<#x<<" = "<<x<<endl;}
#define left(x) (x<<1)
#define right(x) ((x<<1) +1)
#define middle(s,e)(s+(e-s)/2)
#define size_tree(n) 2*(int)pow(2,ceil(log2(n)))
#define CL(A,I) (memset(A,I,sizeof(A)))
#define endl '\n'
#define PHAS(_n) (pbits[(_n)>>5] & (1u << ((_n) & 0x1f)))
#define PSET(_n) (pbits[(_n)>>5] |= (1u << ((_n) & 0x1f)))
//unsigned int pbits[200000000/32+1];

static const int INF = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const long double epsilon = 1e-15;
static const long double pi = acos((long double) -1);
using namespace std;
inline void init_io(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef long long ll;
const int MAX_N = 100001;

/*
struct data{
  string s;
  int p,i;
  data():s(""), p(0), i(0){};
  data(string s_, int p_, int i_) : s(s_),p(p_), i(i_){};
  bool operator < (data other) const {
	if(s==other.s)
		return p>other.p;
    return s < other.s;
  }
};
*/

int st[MAX_N];
int arr[10*MAX_N];
int L[10*MAX_N],R[10*MAX_N];

int main()
{

        init_io();
        ll n;
        cin>>n;
        cout<<((n-2)*180)<<endl;
        return 0;
}

Measured memory_bytes: 256
n = gets.to_i
a = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)

suma=0
sumb=0
n.times do |i|
  suma += a[i]
  sumb += b[i]
end

suma += b[n-1]
sumb += a[0]

if suma > sumb then
  ans=suma
else
  ans=sumb
end

tmpsuma=a[0]
tmpsumb=sumb-a[0]
for i in 1..n-1 do
  if i==0 then
    i = 1
  end
  tmpsuma += a[i]
  tmpsumb -= b[i-1]
  if tmpsuma+tmpsumb > ans then
    ans = tmpsuma+tmpsumb
  end
end

puts ans


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

using namespace std;

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define pb emplace_back
#define ll long long
#define ld long double

const int INF = 2e9 + 1;
const ll INFLL = 1e18 + 1;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    if (s == "AAA" || s == "BBB") cout << "No";
    else cout << "Yes";
    return 0;
}


Measured memory_bytes: 3636
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> A(N),B(N);
    for(int i=0; i<N; i++){
        cin >> A[i] >> B[i];
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    if(N%2){
        cout << B[N/2] - A[N/2] + 1 << "\n";
    }else{
        cout << (B[N/2] + B[N/2-1]) - (A[N/2] + A[N/2-1]) + 1 << "\n"; 
    }
    return 0;
}

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

#define ld long double
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define nl '\n'
#define pii pair <ll, ll>
#define pb push_back
#define mp make_pair
#define pi 3.14159265358979323846264
#define y1 abacaba
#define fn "abc"
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define chill_wave ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pressF freopen("lepus.in", "r", stdin); freopen("lepus.out", "w", stdout);
#define __lcm(a, b) a * b / __gcd(a, b)
#define up_b upper_bound
#define low_b lower_bound
#define pcnt(i) __builtin_popcount(i)

using namespace std;

const long long MXN = 1e6 + 1;
const long long MAXN = 1e3 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;

inline void JUDGE(bool ok = 0) { chill_wave if(ok) { pressF; } }

//int dx[]= {1,-1,0,0}; int dy[]= {0,0,1,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1}; int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2}; int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={-1,-1,+0,+1,+1,+0}; int dy[]={-1,+1,+2,+1,-1,-2}; //Hexagonal Direction

ll n, m;

int main() {

    JUDGE();

    cin >> n >> m;
    cout << __lcm(n, m);
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  set<int>a,b;
  cin>>n;
  while(n--){
    int x;
    cin>>x;
    a.insert(x);
  }
  cin>>n;
  while(n--){
    int x;
    cin>>x;
    b.insert(x);
  }
  vector<int>c;
  set_union(a.begin(),a.end(),b.begin(),b.end(),back_inserter(c));
  for(int i=0;i<c.size();i++)cout<<c[i]<<endl;
}



Measured memory_bytes: 23636
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <iomanip>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    double N; cin >> N;
    double count = 0;
    for(int i = 1; i < N+1; ++i) {
        if(i%2==1) ++count;
    }
    cout << setprecision(7) << count/N << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll m,sum=0,sk=0;
	cin>>m;
	vl d(m),c(m);
	rep(i,m){
		cin>>d[i]>>c[i];
		sum+=d[i]*c[i];
		sk+=c[i];
	}
	ll ans=(sk-1);
	while(sum>=10){
		ll tmp=sum;
		ans+=tmp/10;
		sum=tmp/10+sum%10;

	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
struct UnionFind{
vector<int> par,depth;
vector<int> Size;
UnionFind(int n){
par.resize(n); depth.resize(n); Size.resize(n);
for(int i=0; i<n; i++){
par[i]=i;
depth[i]=0;
Size[i]=1;
}
}
int find(int x){
if(par[x]==x){
return x;
}
else{
return par[x]=find(par[x]);
}
}
bool same(int x, int y){
return find(x)==find(y);
}
void unite(int x, int y){
x=find(x); y=find(y);
if(x==y) return;
if(depth[x]<depth[y]) swap(x,y);
if(depth[x]==depth[y]) depth[x]++;
par[y]=x;
Size[x]+=Size[y];
}
int size(int x){
    return Size[find(x)];
}
};
int main(){
    ll n,m;cin >> n >> m;
    vector<int> a(m),b(m);
    for(int i=0;i<m;i++){
        cin >> a[i] >> b[i];
    }
    vector<ll> ans(m);
    ans[m-1]=n*(n-1)/2;
    UnionFind uf(n+1);
    for(int i=m-1;i>=1;i--){
        if(uf.same(a[i],b[i])){
            ans[i-1]=ans[i];
        }
        else{
            ll x=uf.size(a[i]);
            ll y=uf.size(b[i]);
            ans[i-1]=ans[i]-x*y;
            uf.unite(a[i],b[i]);
        }
    }
    for(int i=0;i<m;i++) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 4096
a=b=ab=[]
n, m, l = map(int, input().strip().split())
for i in range(m+n):
    ab.append(list(map(int, input().strip().split())))
a,b=ab[:n],ab[n:]
for i in range(n):
    c = [sum(a[i][k]*b[k][j] for k in range(m)) for j in range(l)]
    print(*c)

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


int e[100002];

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int a,b;
		cin>>a>>b;
		e[a]++;
		e[b+1]--;
	}
	int ans=0,c=0;
	for(int i=1;i<=100001;i++){
		c+=e[i];
		if(i<=c+1)ans=i-1;
	}
	cout<<ans<<endl;
	return 0;
}

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

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)

        {
            var k = Console.ReadLine();
            var ans = "No";
            if (k[2] == k[3] && k[4] == k[5]) ans = "Yes";

            Console.WriteLine(ans);
                
                





        }

       
        static public long Input()
        {
            return long.Parse(Console.ReadLine());
        }

        static public string[] Input2()
        {
            return Console.ReadLine().Split();
        }

        static public long[] Input3()
        {
            string[] data = Console.ReadLine().Split();
            long[] res = new long[data.LongLength];
            for(long i = 0; i < data.LongLength; i++)
            {
                res[i] = long.Parse(data[i]);
            }
            return res;
        }
        public static long Choose(long n, long a)
        {
            long x = 1;
            long y = 1;
            for (long i = 0; i < a; i++)
            {
                x *= n - i;
                y *= i + 1;
            }
            return x / y;
        }

        public static long Gcd(long a, long b)
        {
            long x = Math.Max(a, b);
            long y = Math.Min(a, b);
            if (x % y == 0) return y;
            else return Gcd(y, x % y);
        }
    }
}


Measured memory_bytes: 11092
import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Comparator;
import java.util.Set;

public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値リスト用 int
    static List<Integer> inputIntList() throws Exception {
        List<String> strList = Arrays.asList(br.readLine().trim().split(" "));
        List<Integer> intList = new ArrayList<Integer>();
        for (String elem : strList){
            intList.add(Integer.parseInt(elem));
        }
        return intList;
    }

    // 標準入力数値配列用 integer 降順ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
        // write your code here
        int [] intarray = inputval();
        int n = intarray[0];
        int m = intarray[1];
        int ans [] = new int [n];
        for(int i=0; i<m; i++){
            int [] ab = inputval();
            int a = ab[0];
            int b = ab[1];
            ans[a-1]++;
            ans[b-1]++;
        }
        for(int a : ans){
            System.out.println(a);
        }

    }

}



Measured memory_bytes: 32604