akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

LL n, x;

int main() {
    GLL(n); GLL(x);

    LL res = n;

    LL a = x; LL b = n-x; if (a > b) swap(a, b);

    while (a > 0) {
        LL q = b / a;
        LL r = b % a;
        
        if (r > 0) {
            res += 2 * q * a;
        }
        else {
            res += (2 * q - 1) * a;
        }

        b = a;
        a = r;
    }

    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include <fstream>
using namespace std;
typedef long long ll;
const ll INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int mod = 1e9+7;
const int maxn = 200005;
ll T,n,m;
string s[maxn];
int main() {
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s[i];
		sort(s[i].begin(),s[i].end());
	}
	sort(s,s+n);
	ll cnt = 1;
	ll sum = 0;
	for(ll i=0;i<n;i++){
		if(s[i]!=s[i+1]&&cnt!=1){
			sum+=(cnt*(cnt-1))/2;
			cnt = 1;
		}
		else if(s[i]!=s[i+1]&&cnt==1){
			cnt = 1;
		}
		else {
			cnt++;
		}
	}
	sum+=(cnt*(cnt-1))/2; 
	cout<<sum<<endl;
}



Measured memory_bytes: 8064
#include <stdio.h>
 
int main()
{
  int b[13] = {0,1,3,1,2,1,2,1,1,2,1,2,1};
  int a[4];
  scanf("%d%d",&a[0],&a[1]);
  if (b[a[0]] == b[a[1]])
    printf("Yes");
  else
    printf("No");
}

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

typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);

ll const inf = 1e18;
ll const maxn = 1e6+5;
ll const mod = 1e9+7;

// code begins here

vector<ll> id(maxn), sz(maxn);

void initialise(ll n){
    for(ll i=1;i<=n;i++){
        id[i] = i;
        sz[i] = 1;
    }
}

ll root(ll i){
    while(i!=id[i]){
        id[i] = id[id[i]];
        i = id[i];
    }
    return i;
}

bool connected(ll p, ll q){
    return root(p)==root(q);
}

void merge(ll p, ll q){
    if(connected(p, q))
        return;
    ll proot = root(p);
    ll qroot = root(q);
    
    if(sz[proot]<sz[qroot])
        swap(proot, qroot);
    
    id[qroot] = proot;
    sz[proot] += sz[qroot];
}

int main(){
    fast;
    
    ll n,m;
    cin>>n>>m;
    
    initialise(n);
    
    for(ll i=0;i<m;i++){
        ll a,b;
        cin>>a>>b;
        merge(a, b);
    }
    
    ll ans = 0;
    for(ll i=1;i<=n;i++){
        if(i==id[i]){
            ans = max(ans , sz[i]);
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}

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

int main() {
  int N, Q;
  cin >> N >> Q;
  
  string S;
  cin >> S;

  int lenS = S.size();
  vector<int> cntS(lenS, 0); 
  string ac = "AC";
 
  for (int i = 1; i < lenS; i++) {
	if (S.substr(i - 1,2) == ac) {
		cntS.at(i) = cntS.at(i - 1) + 1;
	} else {
		cntS.at(i) = cntS.at(i - 1);
	}
  }

  int sQ = 0;
  int eQ = 0;

  for (int i = 0; i < Q; i++) {
	cin >> sQ >> eQ;
	sQ--;
	eQ--;
	cout << cntS.at(eQ) - cntS.at(sQ) << endl;
  }
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

int binpow(int a, int b) {
    if (b == 0)
    {
        return 1;
    }
    ll res = binpow(a, b / 2);
    res*=res;
    if (b % 2)
    {
        return res * a;
    }
    return res;
}

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

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    double pi=3.1415926;
    int n;
    cin>>n;
    cout<<pi*2*n;
    return 0;
}

Measured memory_bytes: 3792
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>
#include <iomanip>

using namespace std;

#define ll long long
#define vi vector<int>
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pi 3.14159265359


int main() {
	ll N, A;
	cin >> N >> A;
	N %= 500;
	if (N > A) {
		cout << "No";
	}
	else {
		cout << "Yes";
	}
	return 0;
}

Measured memory_bytes: 256
import sys
N = int(input())
ans = 0
for i in range(N):
  D1, D2 = [int(x) for x in input().split()]
  if(D1==D2):
    ans += 1
  else:
    ans = 0
  if(ans==3):
    print('Yes')
    sys.exit()
print('No')

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

namespace agc030_a
{
    class Program
    {
        static void Main(string[] args)
        {
            var text = Console.ReadLine();
            var list = text.Split(' ').Select(x => Int64.Parse(x)).ToList();

            var a = list[0];
            var b = list[1];
            var c = list[2];
            var d = list[3];
            var f = Lcm(c, d);

            Int64 total = b - a + 1;

            var max_c = b / c;
            var min_c = (a - 1) / c;
            var max_d = b / d;
            var min_d = (a - 1) / d;
            var max_f = b / f;
            var min_f = (a - 1) / f;

            var divc = max_c - min_c;
            var divd = max_d - min_d;
            var divf = max_f - min_f;

            var current = total - divc - divd + divf;
            Console.WriteLine(current.ToString());
        }

        public static Int64 Lcm(Int64 a, Int64 b) {
            return a * b / Gcd(a, b);
        }

        public static Int64 Gcd(Int64 a, Int64 b) {
            if (a < b)
                return Gcd(b, a);
            while (b != 0) {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }

    }
}


Measured memory_bytes: 13268
#!/usr/bin/env python3
s = int(input())


def f(n):
    return n // 2 if n % 2 == 0 else 3 * n + 1


a = [s]
used = [None] * 1000000
used[s] = True
while True:
    x = f(a[-1])
    if used[x] is not None:
        print(len(a) + 1)
        exit()
    a += [x]
    used[x] = True


Measured memory_bytes: 10868
#include<cstdio>
#include<cctype>
using namespace std;

int main(){
	long long int a,b;
	int ans;
	while(scanf("%lld %lld",&a,&b)!=EOF){
		a+=b;
		ans=0;
		while(a>0){
			a=a/10;
			ans++;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();
        string s = sc.next();
        while (0 < s.Length)
        {
            if (s.Length >= 6 && s.IndexOf("eraser", s.Length - 6) == s.Length - 6)
            {
                s = s.Remove(s.Length - 6, 6);
            }
            else if (s.Length >= 5 && s.IndexOf("erase", s.Length - 5) == s.Length - 5)
            {
                s = s.Remove(s.Length - 5, 5);
            }
            else if (s.Length >= 7 && s.IndexOf("dreamer", s.Length - 7) == s.Length - 7)
            {
                s = s.Remove(s.Length - 7, 7);
            }
            else if (s.Length >= 5 && s.IndexOf("dream", s.Length - 5) == s.Length - 5)
            {
                s = s.Remove(s.Length - 5, 5);
            }
            else
            {
                break;
            }
        }

        if (s.Length == 0) Console.WriteLine("YES");
        else Console.WriteLine("NO");
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 31884
using System;
class Program
{
    static void Main(string[] args)
    {
        string input = Console.ReadLine();
        int len = input.Length;
        string head = input[0].ToString();
        string tail = input[len - 1].ToString();
        string format = head + "{0}" + tail;
        Console.WriteLine(format, (len - 2));
    }
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, k, q; cin>>n>>k>>q;
	vll point(n+1, k-q);
	rep(i, q){
		ll A; cin>>A;
		point[A]++;
	}
	rep(i, n){
		if (point[i+1]>0){
			cout << "Yes\n";
		}else{
			cout << "No\n";
		}
	}
	return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<cmath>
#include<algorithm>

int GetDigit(unsigned num){
    int digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

int main(void){
    long long n;
    std::cin >> n;

    if(n == 1){
        std::cout << 1 << std::endl;
        return 0;
    }
    if(n == 2){
        std::cout << 1 << std::endl;
        return 0;
    }

    //n >= 3

    int ans = 50;

    for(long long i = 1; i <= std::sqrt(n); i++){
        long long  a = i;
        if(n % a != 0) continue;
        long long  b = n / a;

        int digit_a = GetDigit(a);
        int digit_b = GetDigit(b);

        int temp_ans = std::max(digit_a, digit_b);
        ans = std::min(ans, temp_ans);
    }
  std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll mod= 1e9 + 7;



int main(){
  ll a,v,b,w,t;
  cin >> a >>v >>b >> w >>t;
  if(t*(v-w)>=abs(a-b)){cout << "YES" << endl;}else{cout << "NO" << endl;}
}

Measured memory_bytes: 3636
import numpy as np
a,b,x=map(int,input().split())
c=(b*(a**2))/2
rad=0
h=0
if x>=c:
    h=2*b-((2*x)/(a**2))
    print(np.rad2deg(np.arctan(h/a)))
else:
    h=(2*x)/(a*b)
    print(np.rad2deg(np.arctan(b/h)))
    


Measured memory_bytes: 12504
//
//  main.cpp
//  AC
//
//  Created by makinofuya on 2019/07/08.
//  Copyright © 2019 makinofuya. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>

typedef long long ll;
using namespace std;
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define out(s) cout << s << endl


int main(){
    int n;cin >> n;
    vector<int>h(n);
    rep(i,n)cin >> h[i];
    string ans="Yes";
    for(int i=n-2;i>=0;i--){
        if(h[i]>h[i+1]+1){
            ans="No";
        }
        if(h[i]==h[i+1]+1){
            h[i]--;
        }
    }
    cout << ans << endl;
    return 0;
    
}


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

int main() {
  int n;
  cin >> n;
  long double ans = 0;
  for (int i = 0; i < n; i++) {
	long double x;
    string s;
    cin >> x >> s;
    if (s == "JPY") {
      ans += x;
    } else {
      ans += 380000.0 * x;
    }
  }
  cout << fixed << setprecision(20) << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>

using namespace std;

typedef unsigned long long ll;

int n;
ll m;
ll a[20];
long double P[20];

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int keta(ll v) {
	int ret = 0;
	while (v) {
		v /= 10;
		++ret;
	}
	return ret;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	ll ret = a / g;
	if ( keta(ret) + keta(b) - 1 >= 19 ) return m+1;
	return ret * b;
}

/*
ll count(vector<int>& v) {
	ll ret = 0;
	int N = v.size();
	for (int k = 1; k < (1 << N); ++k) {
		ll s = 1;
		for (int i = 0; i < N; ++i) {
			if (k & (1 << i)) s *= a[v[i]];
		}
		ret += (__builtin_popcount(k) % 2 ? 1 : -1) * (m / s);
	}
	return ret;
}
*/

int main() {
	cin >> n >> m;
	int N = 1 << n;
	for (int i = 0; i < n; ++i) cin >> a[i];
	for (int i = 0; i < n; ++i) {
		cin >> P[i];
		P[i] /= 100;
	}

	long double ans = 0;
	for (int k = 1; k < N; ++k) {
		vector<int> v;
		for (int i = 0; i < n; ++i) {
			if (k & (1 << i)) v.push_back(i);
		}
		long double p = 1;
		for (int i = 0; i < n; ++i) {
			if (k & (1 << i)) p *= P[i];
//			else p *= 1 - P[i];
		}
		ll s = 1;
		for (int i = 0; i < v.size(); ++i) {
			s = lcm(s, a[v[i]]);
		}

		int f = __builtin_popcount(k) % 2 ? 1 : -1;
//		cout << k << " " << f << " " << p << " " << m << " " << s(m/s) << endl;;
		ans += f * p * (m / s);
	}
	printf("%.10Lf\n", ans);
}

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

int main(){
  int N;
  int A[210];
  cin >> N;
  for(int i=0;i<N;i++) cin >> A[i];
  int count = 0;
  while(true){
    bool flag=false;
  	for(int i=0;i<N;i++){
    	if(A[i]%2==0){
          A[i]/=2;
        }else{
        	flag=true;
        }
    }
    if(flag==true) break;
    count++;
  }
  cout << count;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
const int N=1002020;
int n,a[N],b[N];
void print(){
	puts("Yes");
	for(int i=1;i<=n;i++)
		cout<<b[i]<<" ";cout<<endl;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=n;i>=1;i--)cin>>b[i];
	int l=n,r=0;
	for(int i=1;i<=n;i++)
		if(a[i]==b[i])l=min(l,i),r=max(r,i);
	if(!r){print();return 0;}
	int nw=l;
	for(int i=1;i<l && nw<=r;i++)
		if(b[nw]!=a[i] && b[nw]!=b[i])
			swap(b[nw],b[i]),++nw;
	for(int i=r+1;i<=n && nw<=r;i++)
		if(b[nw]!=a[i] && b[nw]!=b[i])
			swap(b[nw],b[i]),++nw;
	int fl=0;
	for(int i=1;i<=n;i++)
		if(b[i]==a[i]){fl=1;break;}
	if(fl)puts("No"); else print();
	return 0;
}

Measured memory_bytes: 5104
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int mod=200003,G=5,N=8e5+50;
const double pi=acos(-1);
int n,id[N],r[N],lim=1,val[N];LL ans;
struct node{
    double x,y;
    node friend operator +(node a,node b){return node{a.x+b.x,a.y+b.y};}
    node friend operator -(node a,node b){return node{a.x-b.x,a.y-b.y};}
    node friend operator *(node a,node b){return node{a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x};}
}c[N];
void FFT(node *a,int n,int op){
    for(int i=0;i<n;i++)r[i]=r[i>>1]>>1^(i&1?n>>1:0);
    for(int i=0;i<n;i++)if(i<r[i])swap(a[i],a[r[i]]);
    for(int i=1;i<n;i<<=1){
        node Wn=node{cos(pi/i),sin(pi/i)};
        for(int j=0;j<n;j+=i<<1){
            node w=node{1,0};
            for(int k=0;k<i;k++,w=w*Wn){
                node x=a[j+k],y=a[i+j+k]*w;
                a[j+k]=x+y;a[i+j+k]=x-y;
            }
        }
    }
    if(op==-1){
        reverse(a+1,a+n);
        for(int i=0;i<n;i++)a[i].x/=n;
    }
}
int power(int x,int y){
    int z=1;
    for(;y;y>>=1,x=1ll*x*x%mod)if(y&1)z=1ll*z*x%mod;
    return z;
}
int main(){
    for(int i=1,j=0;j<mod-1;i=1ll*i*G%mod,j++)id[i]=j,val[j]=i;
    scanf("%d",&n);
    for(int i=1,x;i<=n;i++){
        scanf("%d",&x);
        ans-=1ll*x*x%mod;
        if(x)c[id[x]].x++;
    }
    while(lim<mod*2)lim<<=1;
    FFT(c,lim,1);
    for(int i=0;i<lim;i++)c[i]=c[i]*c[i];
    FFT(c,lim,-1);
    for(int i=0;i<mod*2;i++)
        ans+=(LL)(c[i].x+0.5)*val[i%(mod-1)];
    cout<<ans/2;
    return 0;
}

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

using namespace std;

#define REP(var, n)  for (int var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<int>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pii;

#define all(c) begin(c),end(c)

#define D(x) do { std::cerr << x << " "; } while (0)
#define D2(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)


template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}


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

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

int MOD = (int) 1e9 + 7;

auto solve() {
    int N, K;
    cin >> N >> K;
    vi V(N);
    REP(i, N) cin >> V[i];



    int ans = 0;
    REP(i, K+1) {
        REP(j, K+1) {
            REP(t, K+1) {
                if (i + j + t > K) continue;
                if (i + j > N) continue;

                int pos=0;
                vi neg;
                REP(u,i) {
                    if(V[u] >= 0) pos += V[u];
                    else neg.push_back(-1 * V[u]);
                }

                REP(_u,j) {
                    int u = N-_u-1;
                    if(V[u] >= 0) pos += V[u];
                    else neg.push_back(-1 * V[u]);
                }

                int tneg = 0;
                sort(all(neg));
                reverse(all(neg));
                FOR(u,min(t,(int)neg.size()),(int)neg.size()) {
                    tneg += neg[u];
                }

                chmax(ans, pos - tneg);
            }
        }
    }

    return ans;
}


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

    cout << solve() << endl;
//    solve();
//    cout << (solve() ? "Yes" : "No") << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>

using namespace std;

vector<string> build(int n){
    if(n == 1) return {"a"};
    auto pre = build(n-1);
    vector<string> res;
    for(string s: pre){
        char mx = *max_element(s.begin(),s.end()); mx++;
        for (char c = 'a'; c <= mx; c++)
        {
            string tmp = s;
            tmp.push_back(c);
            res.push_back(tmp);
        }
    }
    return res;
}

int main()
{
    int n; cin >> n;
    auto res = build(n);
    sort(res.begin(),res.end());
    for (int i = 0; i < res.size(); i++)
    {
        cout << res[i] << endl;
    }
    
}

Measured memory_bytes: 10956
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define mod (int)(1e9+7)
#define INF (ll)(1e18)
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }


void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int T;
    // cin >> T;
    T = 1;
    
    while (T--) {
        solve();
    }
}


void solve() {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    rep(i, b) cout << a; cout << endl;
}


Measured memory_bytes: 256
import java.util.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    String S = sc.next();
    String ret = S;
    if (S.length() > K) {
      ret = S.substring(0, K);
      ret += "...";
    }
    System.out.println(ret);
  }

}

Measured memory_bytes: 27036
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int sum;
  for (int i = 0; i < N; i++) {
    int r,l;
    cin >> r >> l;
    sum += l-r + 1;
  } 
  cout << sum <<endl;
}

Measured memory_bytes: 256
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define BigInt      __int128
#define endl        '\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define sim         template < class c
#define ris         return * this
#define dor         > debug & operator <<
#define eni(x)      sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {

using namespace std;

sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug 
{
	~debug() 
	{ 
		cerr<<endl; 
	}
	eni(!=) cerr << boolalpha << i; ris; }
	eni(==) ris << range(begin(i), end(i)); }
	sim, class b dor(pair < b, c > d) 
	{
		ris << "(" << d.first << ", " << d.second << ")";
	}
	sim dor(rge<c> d) 
	{
	  	*this << "[";
	  	for (auto it = d.b; it != d.e; ++it)
	    	*this << ", " + 2 * (it == d.b) << *it;
	  	ris << "]";
	}
};
#define fuck(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int n,k;
		cin>>n>>k;
		ll int arr[n+1];
		for(ll int i=1;i<=n;i++)
		{
			// arr[i]=1;
			cin>>arr[i];
			// arr[i]=rand()%(n+1);
		}
		ll int brr[n+2];
		ll int cnt=0;
		while(k--)
		{
			memset(brr,0,sizeof(brr));
			for(ll int i=1;i<=n;i++)
			{
				ll int l=max(1ll,i-arr[i]);
				ll int r=min(n,i+arr[i]);
				brr[l]++;
				brr[r+1]--;
			}
			ll int sm=0;
			for(ll int i=1;i<=n;i++)
			{
				sm+=brr[i];
				brr[i]=sm;
			}
			bool fnd=0;
			for(ll int i=1;i<=n;i++)
			{
				if(arr[i]!=brr[i])
				{
					fnd=1;
				}
				arr[i]=brr[i];
			}
			cnt++;
			// for(ll int i=1;i<=n;i++) cout<<brr[i]<<" ";cout<<endl;
			if(!fnd) break;
		}
		for(ll int i=1;i<=n;i++) cout<<arr[i]<<" ";cout<<endl;
		// cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 6744
import numpy as np
import sys

L, R = map(int, input().split())

if( R - L >= 2018):
    print(0)
    sys.exit()

r = np.array(list(i for i in range(L, R+1)))


mins = 2018

for i, ri in enumerate(r):
    for j in range(i+1, len(r)):
        rj = r[j]
        s  = np.mod(ri * rj, 2019)
        if(s < mins):
            mins = s
        if(s == 0):
            print(0)
            sys.exit()



print(mins)


Measured memory_bytes: 12500
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int minCostToReachN(vector<int>& stones) {
	int stonesCount = stones.size();
	vector<int> dp(stones.size());

	dp[stonesCount - 1] = 0;
	for (int i = stonesCount - 2; i >= 0; --i) {
		dp[i] = dp[i + 1] + abs(stones[i] - stones[i + 1]);

		if (i + 2 < stonesCount)
			dp[i] = min(dp[i], dp[i + 2] + abs(stones[i] - stones[i + 2]));
	}

	return dp[0];
}

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

	vector<int> stones(n);
	for (auto& stone : stones)
		cin >> stone;
	cout << minCostToReachN(stones) << endl;

	return 0;
}



Measured memory_bytes: 1024
#include <stdio.h> 

int main(void)
{
	int a, b, c, i, ans=0;

	scanf("%d %d %d", &a, &b, &c);

	for(i=a; i<=b; i++)
	{
		if(c%i == 0)
		{
			ans++;
		}
	}

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

	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s=="SUN"){
    cout << 7;
  }
   if(s=="MON"){
    cout << 6;
  }
   if(s=="TUE"){
    cout << 5;
  }
   if(s=="WED"){
    cout << 4;
  }
   if(s=="THU"){
    cout << 3;
  }
   if(s=="FRI"){
    cout << 2;
  }
   if(s=="SAT"){
    cout << 1;
  }
}

Measured memory_bytes: 256
with open(0) as f:
    N, A, B, *H = map(int, f.read().split())

diff = A - B #追加ダメージ
T = (max(H)+B-1)//B #答えはT以下

def clearable(t): #t回以内で敵を全滅できるか判定
    Higher = [h-B*t for h in H if h-B*t > 0]
    return True if sum([(h+diff-1)//diff for h in Higher]) <= t else False

def binary_search(a, b, judge): #b must be a or higher
    if a == b:
        return a, b
    
    c = a + (b - a)// 2
    return (a, c) if judge(c) else (c+1, b)

a, b = 0, T
while a != b:
    a, b = binary_search(a, b, clearable)
print(a) 

Measured memory_bytes: 20848
# 入力
input_int = lambda:int(input())
input_ints = lambda:map(int,input().split())
input_str = lambda:input()
input_strs = lambda:input().split()
input_lines = lambda n,f:[f() for _ in range(n)]

import functools,fractions
import numpy as np
gcd = lambda a:functools.reduce(fractions.gcd,a) # 最大公約数（リスト）
lcm_base = lambda a,b:(a*b)//fractions.gcd(a,b) # 最小公倍数(2値)
lcm = lambda a:functools.reduce(lcm_base,a,1) # 最小公倍数(リスト)

def solution():
    N = input_int()
    Ts = input_lines(N,input_int)

    ans = lcm(Ts)
    print(ans)

if __name__ == '__main__':
    solution()

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main() {
    int n;
    cin >> n;
    int ans=1,odd=1;
    REP(i,n){
        int t;
        cin>>t;
        ans*=3;
        if(t%2==0)odd*=2;
    }
    COUT(ans-odd);
    return 0;
}


Measured memory_bytes: 256
N,W=list(map(int,input().split()))
wv=[list(map(int,input().split())) for _ in range(N)]

#dp[i個目までの品物][総和がw以下]
dp=[[0]*(W+1) for _ in range(N+1)]

for i in range(N):
    for w in range(W+1):
        if wv[i][0]>w:dp[i+1][w]=dp[i][w]
        else:dp[i+1][w]=max(dp[i][w],dp[i][w-wv[i][0]]+wv[i][1])

print(dp[N][W])


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

using namespace std;

#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORD(i, m, n) for (int i = m; i >= n; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REP1(i, n) for (int i = 0; i <= n; ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using ll = long long;
using ull = unsigned long long;
using ld = long double;

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

	string s;
	cin >> s;
	int ans = 1000;
	REP(i, s.length() - 2)
	{
		int s1 = stoi(s.substr(i, 3));
		if (abs(753 - s1) < ans)
			ans = abs(753 - s1);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3572
import sys
sys.setrecursionlimit(10**5)
input = sys.stdin.readline


N = int(input())
G = [[] for _ in range(N)]
for _ in range(N-1):
    u, v, w = map(int, input().split())
    G[u-1].append([v-1, w])
    G[v-1].append([u-1, w])
ans = [0]*N


def dfs(v, p, c):
    global ans
    ans[v] = c
    for e in G[v]:
        nv, cost = e
        if nv == p:
            continue
        if (cost % 2) == 0:
            dfs(nv, v, c)
        else:
            dfs(nv, v, (c+1) % 2)


def main():
    dfs(0, -1, 0)
    for c in ans:
        print(c)


if __name__ == '__main__':
    main()


Measured memory_bytes: 85204
#include <stdio.h>

int main(void){
  int N;
  int x, y;
  int buf;
  int flag = 0;//存在すれば1，存在しなければ0
  scanf("%d", &N);
  for(y = 0; y <= N/7; y++){
    buf = N - 7*y;
    if(buf%4 == 0 && buf >= 0){
      flag = 1;
      y = buf;
      break;
    }
  }
  if(flag == 1){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main()
{
int a,b;

scanf("%d",&a);
scanf("%d",&b);

if(a==1&&b==2)
{
	printf("3");
}
else if(a==2&&b==1)
{
	printf("3");
}
else if(a==2&&b==3)
{
	printf("1");
}	
else if(a==3&&b==2)
{
	printf("1");
}
else if(a==3&&b==1)
{
	printf("2");
}
else if(a=1&&b==3)
{
	printf("2");
}
	
		
	
return 0;	
}

Measured memory_bytes: 1620
#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 ALL(x) (x).begin(),(x).end()

using ll = long long;
using ull = unsigned long long;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

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

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

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

    int n;cin >> n;
    ll ans = 0;
    for(int i=1;i<=n;i++){
        if(i%3!=0 && i%5!=0)ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    int d;cin >> d;
    int c[26];
    rep(i,26)cin >> c[i];
    rep(i,d){
        P mx = P(0,0);
        rep(j,26){
            int a;cin >> a ;
            mx = max(mx,P(a,j));
        }
        
        cout << mx.second +1 << endl;
        
    }
    return 0;
}

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

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

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

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

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N, K;
	cin >> N >> K;
	vector<int64> d(K);
	auto A = make_v<int64>(K);
	set<int64> st;
	REP(i, K) {
	  cin >> d[0];
	  REP(j, d[0]) {
	    int64 a;
	    cin >> a;
	    st.insert(a);
	  }
	}
	cout << N - st.size() << endl;
}


Measured memory_bytes: 3672
N = int(input())
W = [int(i) for i in input().split()]
sum_W = sum(W)
s = 0
m = 1000000
for i in range(N):
    s += W[i]
    t = sum_W - s
    z = abs(s - t)
    if m > z:

        m = z
    else:
        break

print(m)


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

int main () {
  string s;
  int k;
  cin >> k;
  cin >> s;
  if (s.size() <= k) cout << s;
  else {
    for (int i = 0;i<k;i++)cout << s[i];
    cout << "...";
  }
  return 0;
}


Measured memory_bytes: 3604
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    a = 0
    w = 0
    t = 0
    r = 0
    for i in range(n):
        s = input()
        if s == "AC":
            a += 1
        elif s == "WA":
            w += 1
        elif s == "TLE":
            t += 1
        else:
            r += 1
    print("AC x",a)
    print("WA x",w)
    print("TLE x",t)
    print("RE x",r)

    return None

if __name__ == '__main__':
    main()


Measured memory_bytes: 71040
#include <stdio.h>
#define HMAX 500001

int H=0;
int A[HMAX];

void maxHeapify(int i)
{
	int l,r,swap,largest=0;
	l=2*i;
	r=2*i+1;
	//左の子、自分、右の子で値が最大のノードを選ぶ
	if(l<=H && A[l]>A[i])
		largest=l;
	else
		largest=i;
	if(r<=H && A[r]>A[largest])
		largest=r;

	if(largest!=i){ //iの子の値が大きい場合
		swap=A[i];
		A[i]=A[largest];
		A[largest]=swap;
		maxHeapify(largest);
	}
}


void buildMaxHeap(void)
{
	int i;
	for(i=(H/2) ;i>=1;i--)
		maxHeapify(i);
}




int main(){

	int i;

	scanf("%d",&H);
	for(i=1;i<=H;i++)
		scanf("%d",&A[i]);

	buildMaxHeap();

	for(i=1;i<=H;i++){
		printf(" %d",A[i]);
	}
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 2552
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD=1000000007;
using namespace std;
int main(){
    int n;
    cin>>n;
    
    double ans=0;
    rep(i,0,n){
        double a;
        cin>>a;
        ans+=1/a;
    }
    
    cout<<fixed<<setprecision(10)<<1/ans<<endl;
    
}


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

string max_size(string s, string t) {
    if (s.size() < t.size()) swap(s, t);
    return s;
}

int main() {
    string s, t;
    cin >> s >> t;
    vector<vector<int>> dp(s.size() + 1, vector<int>(t.size() + 1, 0));
    for (int i = 1; i <= s.size(); i++) {
        for (int j = 1; j <= t.size(); j++) {
            if (s[i - 1] == t[j - 1]) {
                dp[i][j] = dp[i - 1][j - 1] + 1;
            } else {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }
    string ans = "";
    int i = s.size(), j = t.size();
    while (i > 0 && j > 0) {
        if (dp[i][j] == dp[i - 1][j]) {
            i--;
        } else if (dp[i][j] == dp[i][j - 1]) {
            j--;
        } else {
            ans = s[i - 1] + ans;
            i--;
            j--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 35584
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)

#define debug(x) cerr<<#x<<": "<<x<<'\n'

#define fi first
#define se second

#define vi vector<int>
#define pb push_back
#define mp make_pair

#define pcnt __builtin_popcount

typedef long long ll;

const ll inf = 1<<30;
const int MOD = 998244353;
const double EPS = 1e-9;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n,C;
    cin >> n >> C;
    int d[550][550] = {};
    int c[40][40] = {};
    int m[3][40] = {};//m[A][i] Aチームにいる色iの数
    rep(y,C){
      rep(x,C){
        cin >> c[y][x];
      }
    }
    rep(y,n){
      rep(x,n){
        cin >> d[y][x];
        m[(x+y)%3][d[y][x]-1]+=1;
      }
    }
    int a[3] = {};
    ll mi = inf;
    for(a[0]=0;a[0]<C;a[0]++){
      for(a[1]=0;a[1]<C;a[1]++){
        if(a[0]==a[1]) continue;
        for(a[2]=0;a[2]<C;a[2]++){
          if(a[0]==a[2] || a[1]==a[2]) continue;
          ll al=0;
          rep(i,3){
            rep(k,C){
              al += c[k][a[i]]*m[i][k];  //色kから色a[i]に変換するコスト*数
            }
          }
          if(al < mi) mi = al;
        }
      }
    }
    cout << mi << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#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 bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

ll mygcd(ll a, ll b)
{
    if (b == 0)
    {
        return a;
    }
    else
    {
        return mygcd(b, a % b);
    }
}
signed main()
{
    int n;
    ll ans = 1;
    cin >> n;
    rep(i, n)
    {
        ll t;
        cin >> t;
        ans = t / mygcd(ans, t) * ans;
    }
    cout << ans << endl;
    return 0;
}

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

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

    for(int j=0; j<n; j++){
        cout << a[n-j-1];
        if(j!=n-1){cout << " ";}
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3108
#include <stdio.h>

int main() {
  long A,B,K;
  scanf("%ld %ld %ld",&A,&B,&K);
  if(A-K<0) {
    if(B+A-K<=0) {
      A=0;
      B=0;
    }else {
      B-=(K-A);
      A=0;
    }
  }else {
    A-=K;
  }
  printf("%ld %ld",A,B);
  return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define rep(k,i,n) for(long long i=k;i<n;++i)
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    ll ans=0;
    int a[2];
    cin>>a[0]>>a[1];
    rep(0,i,2){
        if(a[i]==1){
            ans+=300000;
        }else if(a[i]==2){
            ans+=200000;
        }else if(a[i]==3){
            ans+=100000;
        }
    }
    if(a[0]==1&&a[1]==1){
        ans+=400000;
    }
    cout<<ans<<endl;
    
}


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

int main() {
  int N,K,Q;
  cin >> N >> K >> Q;
  vector<int> V(N,0);
  
  for(int i=0;i<Q;i++){
    int a;
    cin >> a;
    V[a-1]++;
  }
  
  for(int i=0;i<N;i++){
    if(Q-V[i]<K) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  std::array<i64, 3> N;
  tools::read(N);
  std::sort(N.begin(), N.end(), std::greater<i64>());
  std::cout << 10 * N[0] + N[1] + N[2] << std::endl;
  return 0;
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> ans(100001, 0);
  int i, k;
  for(i = 1; i <= 100000; i++)
  {
    ans.at(i) = ans.at(i-1)+1;
    for(k = 6; k <= i; k *= 6)
    {
      ans.at(i) = min(ans.at(i), ans.at(i-k)+1);
    }
    for(k = 9; k <= i; k *= 9)
    {
      ans.at(i) = min(ans.at(i), ans.at(i-k)+1);
    }
  }
  cout << ans.at(n) << endl;
}

Measured memory_bytes: 640
N, A, B = map(int, input().split())
sums = 0
cnt = 0
for i in range(1, N+1):
    words_i = str(i)
    for word_i in words_i:
        sums += int(word_i)
    if A <= sums <= B:
        cnt += i
    sums = 0
print(cnt)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const long long LINF = 1000000000000000018ll;
const int INF = 1000000009;
const int mod = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;

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

  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());

  long long ans = 0;
  for (int i = 0; i < n; i++) {
    // b[i] を使うとき
    // cnt_a: aの候補数, cnt_b: bの候補数
    long long cnt_a = max(0LL, (long long)(lower_bound(a.begin(), a.end(), b[i]) - a.begin()));
    long long cnt_c = n - (long long)(upper_bound(c.begin(), c.end(), b[i]) - c.begin());
    ans += (cnt_a * cnt_c);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int n;
	ll k;
	cin >> n >> k;
	
	vector<int> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	
	ll ans = 0LL;
	for (int i = 0; i < n; i++) {
		ll ainv = 0, rinv = 0;
		
		for(int j = i; j < n; ++j) {
			if( a[i] > a[j] ) rinv++;
		}
		
		for(int j = 0; j < n; ++j) {
			if( a[i] > a[j] ) ainv++;
		}
		
		ans += (k * rinv) % MOD_LL;
		ans %= MOD_LL;
		ans += (ainv % MOD_LL) * ((k * (k - 1LL) / 2LL) % MOD_LL);
		ans %= MOD_LL;
	}
	
	cout << ans << endl;
	
	return 0;
}


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


int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tt = 1; // cin >> t;
    for (; tt; tt--) {
        string s, t; cin >> s >> t;
        int ans = t.size();
        for (int i = 0; i + t.size() <= s.size(); i++) {
            int nans = 0;
            for (int j = i; j < i + t.size(); j++) {
                if (s[j] != t[j - i]) nans++;
            }
            if (nans < ans) ans = nans;
        }
        cout << ans << endl;
    }
    return 0;
}




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

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

    int num[110] = {0};
    for (int i = 0; i < N; ++i) {
        num[d[i]]++;
    }

    int res = 0;
    for (int i = 1; i <= 100; ++i) {
        if (num[i] >0) {
            ++res;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#define INF 1e12
using namespace std;
typedef long long ll;
int n,m;
int hp[101];
ll dp[2][100001];
int mp[101],t[101],d[101];
int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<n;i++){
			scanf("%d",&hp[i]);
		}
		scanf("%d",&m);
		for(int i=0;i<m;i++){
			string str,st2;
			cin >> str >> mp[i] >> st2 >> d[i];
			if(st2=="Single")t[i]=0;
			else t[i]=1;
		}
		for(int i=0;i<=100000;i++){
			dp[0][i]=dp[1][i]=INF;
		}
		for(int i=0;i<2;i++){
			dp[i][0]=0;
			for(int j=0;j<=100000;j++){
				if(dp[i][j]<INF){
					for(int k=0;k<m;k++){
						if(t[k]==i){
							dp[i][min(j+d[k],100000)]=min(dp[i][min(j+d[k],100000)],dp[i][j]+mp[k]);
							//printf("%d %d %d\n",i,min(j+d[k],100000),dp[i][min(j+d[k],100000)]);
						}
					}
				}
			}
			for(int j=100000;j>=1;j--){
				if(dp[i][j]<dp[i][j-1])dp[i][j-1]=dp[i][j];
			}
		}
		ll res=INF;
		for(int i=0;i<=100000;i++){
			ll cost=dp[1][i];
			for(int j=0;j<n;j++){
				if(hp[j]>i)cost+=dp[0][hp[j]-i];
			}
			res=min(res,cost);
		}
		printf("%lld\n",res);
	}
	return 0;
}

Measured memory_bytes: 2836