akhauriyash/Code-Regression huggingface dataset:
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ff first
#define ss second
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long 
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define print_time cerr << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define ull unsigned long long
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-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 gcd(int x,int y)
{
   // cout<<x<<' '<<y<<endl;
    if(y==0)
    return x;
    else
    return gcd(y,x%y);
}
int expo(int n,int m,int p)   //modULAR EXPONENTIATION
{
    int r=1;
    n=n%p;
    while(m>0)
    {
    if(m%2)
	r=(r*n)%p;
    n=(n*n)%p;
    m=m/2;
    }
    return r%p;
}
bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;
 
    // This is checked so that we can skip 
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;
 
    for (int i=5; i*i<=n; i=i+6)
    if (n%i == 0 || n%(i+2) == 0)
       return false;
 
    return true;
}
vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
    if (i <= r)
	z[i] = min (r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]])
	++z[i];
    if (i + z[i] - 1 > r)
	l = i, r = i + z[i] - 1;
    }
    return z;
}
int n,w;
struct day
{
	int a,b;
};
day aa[100005];
int dp[105][100005];
int solve(int i,int t)
{
	if(i==n)
	{
		return 0;
	}
	int ans=0;
	if(dp[i][t]!=-1)
		return dp[i][t];
	ans=solve(i+1,t);
	if(t>=aa[i].a)
		ans=max(ans,aa[i].b+solve(i+1,t-aa[i].a));
	dp[i][t]=ans;
	return ans;
}
int32_t main()
{
   IOS;
   /*#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin); 
   freopen("output.txt","w",stdout);
   #endif
   /********************* Code starts here ***********************/
   cin>>n>>w;
   memset(dp,-1,sizeof(dp));
   for(int i=0;i<n;i++)
   {
   	cin>>aa[i].a>>aa[i].b;
   }
   cout<<solve(0,w)<<endl;
}                       

Measured memory_bytes: 82304
#include <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;

bool is_prime(int n)
{
    if(n<=1)
        return false;
    for(int i=2; i*i<=n; i++){
        if(n%i==0)
            return false;
    }
    return true;
}

int gcd(int a, int b)
{
    if(b==0)
        return a;

    return gcd(b, a%b);
}

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

int main(){
    while(1){
        int a,b;
        cin >> a >> b;
        if(cin.eof()){
            break;
        }
        cout << gcd(a,b) << ' ' << a/gcd(a,b)*b << endl;
    }
}


Measured memory_bytes: 3000
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int n, sum = 0;
    cin >> n;
    string s;
    map<string, long long int> mp;

    for (int i = 0; i < n; i++)
    {
        cin >> s;
        sort(s.begin(), s.end()); 
        mp[s]++;
    }

    for (auto it = mp.begin(); it != mp.end(); ++it)
    {
        long long int s = it->second;
        sum += ((s) * (s - 1)) / 2;
    }
    cout << sum;
}

Measured memory_bytes: 11136
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>

using namespace std;

#define ll long long

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

    if(n % 2 == 1){
        cout << "No" << endl;
    }else{
        int noFlag = 0;
        for(int i = 0;i < n/2;++i){
            if(s[i] != s[i+n/2]){
                noFlag = 1;
            }
        }

        if(noFlag == 1){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
K, N = map(int, input().split())

A = list(map(int, input().split()))
a = A[-1] - A[0]
ans = 10000000
i = 1
for d in A:
  b = K-A[-i]+A[-i-1]
  ans = min(b, ans)
  i += 1
  if i == len(A):
    break

if a <= ans:
  print(a)
else:
  print(ans)
 

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

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

    string target_str;
    cin >> target_str;

    int ans = 0;
    int i_c, j_c, k_c;
    for (int i = 0; i < 10; ++i) {
        for (i_c = 0; i_c < n; ++i_c) {
            if (target_str.substr(i_c, 1) == to_string(i)) {
                break;
            }
        }
        for (int j = 0; j < 10; ++j) {
            for (j_c = i_c + 1; j_c < n; ++j_c) {
                if (target_str.substr(j_c, 1) == to_string(j)) {
                    break;
                }
            }
            for (int k = 0; k < 10; ++k) {
                for (k_c = j_c + 1; k_c < n; ++k_c) {
                    if (target_str.substr(k_c, 1) == to_string(k)) {
                        ++ans;
                        break;
                    }
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "l    ", long, "r");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    auto a = aryread();
    auto b = aryread();
    auto c = aryread();
    long s = b.sum();
    foreach (i; iota(n - 1))
    {
        if(a[i + 1] - a[i] == 1)
            s += c[a[i] - 1];
    }
    s.writeln();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


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

using namespace std;

// First try: TLE, O(QN)

void transform(vector<vector<int>>& graph, vector<vector<int>>& tree, int parent, int current) {
  for (int child : graph[current]) {
    if (child != parent) {
      tree[current].push_back(child);
      transform(graph, tree, current, child);
    }
  }
}

// void operate(vector<vector<int>>& tree, vector<int>& counter, int p, int x) {
//   counter[p] += x;
//   for (int child : tree[p]) {
//     operate(tree, counter, child, x);
//   }
// }

void add(vector<vector<int>>& tree, vector<int>& counter, int parent_sum, int current) {
  counter[current] += parent_sum;
  for (int child : tree[current]) {
    add(tree, counter, counter[current], child);
  }
}

int main() {
  int N, Q; cin >> N >> Q;
  vector<vector<int>> graph(N);
  for (int i = 0; i < N - 1; i++) {
    int a, b; cin >> a >> b;
    graph[a - 1].push_back(b - 1);
    graph[b - 1].push_back(a - 1);
  }
  int p[Q];
  int x[Q];
  for (int j = 0; j < Q; j++) {
    cin >> p[j] >> x[j];
    p[j]--;
  }

  vector<vector<int>> tree(N);
  transform(graph, tree, -1, 0);

  vector<int> counter;
  counter.assign(N, 0);
  for (int i = 0; i < Q; i++) {
    counter[p[i]] += x[i];
  }

  add(tree, counter, 0, 0);

  for (int i = 0; i < N; i++) {
    cout << counter[i];
    if (i < N - 1) cout << " ";
  }
  cout << endl;
}

Measured memory_bytes: 45312
#include<bits/stdc++.h>
#include<unordered_set>
#define rep(i,a,b) for(ll i = a; i<b; i+= 1)
#define dep(i,a,b) for(int i = a; i>b; i--)
#define makeUnique(vec) sort(all(vec)); vec.resize(unique(all(vec)) - vec.begin())
#define LOG_vec(vec, sep) for (int fl = 0; fl < vec.size(); fl++) { std::cout << vec[fl]<< (fl == vec.size()-1?"\n":sep;)}
#define LOG_ints(vec, sep) for (int fl = 0; fl < MAXSIZE; fl++) { std::cout << vec[fl]<< sep; } std::cout << "\n"
#define all(x) (x).begin(), (x).end()
#define LSB(i) ((i) & -(i))
#define MAXSIZE 100000

using namespace std;
typedef long long ll;
typedef vector<int> vi;

void solve() {
	int x, y, z;
	cin >> x >> y >> z;
	cout << z << " " << x << " " << y << endl;
}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	while (t--) {
		solve();
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

int main(){
    int n;
    cin>>n;
    int x[n];
    rep(i,n)cin>>x[i];
    int l,q;
    cin>>l>>q;
    int r[20][n];
    rep(i,n){
        int to=upper_bound(x,x+n,x[i]+l)-x;
        r[0][i]=to-1;
    }
    for(int i=1;i<20;++i){
        for(int j=0;j<n;++j){
            r[i][j]=r[i-1][r[i-1][j]];
        }
    }
    rep(i,q){
        int a,b;
        cin>>a>>b;
        --a,--b;
        if(a>b)swap(a,b);
        int t=0;
        for(int j=19;j>=0;--j){
            if(r[j][a]<b){
                a=r[j][a];
                t+=(1<<j);
            }
        }
        cout<<t+1<<endl;
    }
}


Measured memory_bytes: 9088
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 998244353
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 100000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}
string s[10];
int k;
int fun2(vector<int>v,int n){
    int m=s[0].size();
    int a[n];
    int j1=0;
    for(int i=0;i<n;i++){
        if(v[j1]==i)j1++;
        a[i]=j1-1;
    }
    int ans[v.size()]={0};
    int x=0;
    for(int j=0;j<m;j++){
        bool b=true;

        for(int i=0;i<n;i++){
            ans[a[i]]+=s[i][j]-'0';
            if(ans[a[i]]>k)b=false;
        }
        if(!b){
            x++;
            memset(ans,0,sizeof(ans));
            for(int i=0;i<n;i++){
                ans[a[i]]+=s[i][j]-'0';
            }
        }
    }
    if(x==m)x=INT_MAX;
    //cout<<x<<" "<<a[];
    return x;
}
int fun(int i,vector<int>v,int n){
    if(i==n){
        //v.push_back(n);
        return fun2(v,n)+v.size()-1;
    }
    int ans=INT_MAX;
    ans=min(ans,fun(i+1,v,n));
    v.push_back(i);
    ans=min(ans,fun(i+1,v,n));
    return ans;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    srand(time(0));
    int n,m;
    cin>>n>>m>>k;
    
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    vector<int>v(1,0);
    cout<<fun(1,v,n);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int a1, a2, a3;

  scanf("%d %d %d", &a1, &a2, &a3);

  if ((a1 + a2 + a3) >= 22) {
    printf("bust");
  }
  else {
    printf("win");
  }

  return 0;
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
	    String line = Io.read();
	    int num = Integer.parseInt(line);

	    int digits = (int)Math.log10(num) + 1;
        int div = 0;

        int tmp = num;
        for (int i = 0; i < digits; i++) {
            div += tmp % 10;
            tmp = tmp / 10;
        }

        if (num % div == 0) Io.write("Yes");
        else Io.write("No");
    }
}

class Io {

    public static String read() throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        br.close();
        return line;
    }

    public static void write(String answer)
    {
        System.out.println(answer);
    }
}

Measured memory_bytes: 23252
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iomanip>
#include<vector>
using namespace std;
int main()
{
	int k,i;
	cin>>k;
	string s;
	cin>>s;
	int len=s.size();
	if(len<=k)cout<<s<<endl;
	else 
	{
		for(i=0;i<k;i++)
		{
			cout<<s[i];
		}
		cout<<"..."<<endl;
	}
	return 0;
 } 

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORr(i, k, n) for(int i = (k); i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORr(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;
vector<int> to[2500];
vector<int> from[2500];
bool reachableFrom1[2500];
bool reachableToN[2500];
bool ok[2500];

void dfs(int v){
  if(reachableFrom1[v]) return;
  reachableFrom1[v] = true;
  for(int u: to[v]){
    dfs(u);
  }
}

void rdfs(int v){
  if(reachableToN[v]) return;
  reachableToN[v] = true;
  for(int u : from[v]){
    rdfs(u);
  }
}

int main(void){
  int n, m, p;
  cin >> n >> m >> p;
  
  vector<tuple<int, int, int>> edges;

  REP(i, m){
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    edges.emplace_back(a, b, p-c);
    to[a].push_back(b);
    from[b].push_back(a);
  }

  dfs(0);
  rdfs(n-1);
  REP(i, n) ok[i] = reachableFrom1[i] && reachableToN[i];

  vector<int> d(n, INF);
  d[0] = 0;
  bool upd = true;
  int step = 0;
  while(upd){
    upd = false;
    REP(i, m){
      int a, b, c;
      tie(a, b, c) = edges[i];
      if(!ok[a] || !ok[b]) continue;
      int newD = d[a] + c;
      if(newD < d[b]){
        upd = true;
        d[b] = newD;
      }
    }
    step++;
    if(step > n){
      cout << -1 << endl;
      return 0;
    }
  }

  ll ans = -d[n-1];
  chmax(ans, 0ll);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define lson rt<<1, l, mid
#define rson rt<<1|1, mid+1, r
using namespace std;
typedef long long ll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T>
void read(T &res) {
  int f = 1; res = 0;
  char c = getchar();
  while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar(); }
  while(c >= '0' && c <= '9') { res = res * 10 + c - '0'; c = getchar(); }
  res *= f;
}
const int N = 60;
ll a[N];
int main() {
  int n; read(n);
  ll sum = 0;
  for(int i = 0; i < n; ++i) { read(a[i]); }
  for(int i = 0; i < n; ++i) {
    for(int j = i + 1; j < n; ++j) {
      sum += a[i] * a[j];
    }
  }
  cout << sum << endl;
	return 0;
}


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

int main(void){
    int H,W;
    cin >> H >> W;
    int h,w;
    cin >> h >> w;
    int ans = (H-h)*(W-w);
    
    cout << ans <<endl;
    
    return 0;
}



































Measured memory_bytes: 256
import std.stdio, std.conv;

void main(){
	int n;
	while (readf("%d\n", &n), n != -1) {
		string s;
		while (n > 0) {
			s = text(n % 4) ~ s;
			n /= 4;
		}
		if (!s) s = "0";
		writeln(s);
	}
}

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

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

    int n;
    cin >> n;
    if (n == 1) {
        cout << "Hello World";
    } else if (n == 2) {
        int a, b;
        cin >> a >> b;
        cout << a + b;
    }
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i < b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

vector<int> eratos(int max_n) {
	vector<int> is_prime(max_n, 1);
	is_prime[0] = is_prime[1] = 0;
	for (int i = 2; i < max_n; i++) {
		if (!is_prime[i]) continue;
		for (int j = i * 2; j < max_n; j += i) {
			is_prime[j] = 0;
		}
	}
	return is_prime;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int n;
	cin >> n;

	vector<int> prime = eratos(55555);
	vector<int> ans;
	for (int i = 0; i < sz(prime); i++)
	{
		if (prime[i]) {
			if (i % 10 == 1) {
				ans.push_back(i);
			}
		}
	}
	
	rep(i, n) {
		cout << ans[i] << " ";
	}
	cout << endl;

	return 0;
}

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

using namespace std;

int n;
string s;

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

	cin >> n >> s;
	for (int i=0;i<s.size();i++)
	{
		int z = s[i] - 'A';
		z = (z + n)%26;
		char c = z + 'A';
		cout << c;
	}
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= 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;
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

bool check(int n) {
    int a = 2;
    int num = 2;
    while (a*a < n)
    {
        if (n%a == 0) {
            num+=2;
        }
        a++;
    }

    if (num == 8) return true;
    else return false;
    
}

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

    int n;
    cin >> n;

    if (n < 105) {
        cout << 0 << endl;
    } else {
        int ans = 0;
        for (int i = 105; i <= n; i+=2) {
            if (check(i)) ans++;
        }

        cout << ans << endl;
    }
    

    return 0;
}


Measured memory_bytes: 256
x, y = map(int, input().split())

ans = float("inf")

if y >= x:
    ans = min(ans, y - x)

if y >= x * -1:
    ans = min(ans, y - x * -1 + 1)

if y * -1 >= x:
    ans = min(ans, y * (-1) - x + 1)

if y * -1 >= -1 * x:
    ans = min(ans, y * -1 - x * -1 + 2)

print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
 
int main(){
  int A,B;
  cin >> A >> B;
  if(A+B>=A-B && A+B>=A*B){
    cout << A+B << endl;}
  else if(A-B>=A+B && A-B>=A*B){
    cout << A-B << endl;}
  else{
    cout << A*B << endl;}
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<bits/stdc++.h>
using namespace std;
int main() 
{ 
char a[3],b[3];
for(int i=0;i<3;i++)
{
cin>>a[i];
}
for( int i=0;i<3;i++)
{
cin>>b[i];
}
if(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0])
cout<<"YES";
else
cout<<"NO";
return 0;  
}

Measured memory_bytes: 3636
#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 all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;
// const int MOD = 998244353;

int f(ll n) {
   int res = 0;
   for (ll i = 2; i * i <= n; i++) {
      ll c = i;
      while (n % c == 0) {
         n /= c;
         c *= i;
         res++;
      }
      while (n % i == 0) {
         n /= i;
      }
   }
   if (n != 1) res++;
   return res;
}
int main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);

   ll n;
   cin >> n;
   cout << f(n) << endl;
   return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <sstream>
#include <vector>
#include <string>
#include <iomanip>
#include <bitset>
using namespace std;
#define INF	100000000
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define SS stringstream
#define rep(i,n) for(int i = 0; i < n; i++)
#define sz(x) ((int)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define clr(a,b) memset((a),(b),sizeof(a))
typedef pair<int, int> P;
typedef long long int ll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<P> Vp;
typedef priority_queue<int> PQ;

int main(){
	double xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2;
	while(cin >> xa1 >> ya1 >> xa2 >> ya2 >> xb1 >> yb1 >> xb2 >> yb2){
		if(xa1 <= xb1 && ya1 <= yb1 && xa2 >= xb2 && ya2 >= yb2) cout << "YES" << endl;
		else if(xb1 <= xa1 && xa1 <= xb2 && ya1 <= yb1 && ya2 >= yb2) cout << "YES" << endl;
		else if(xb1 <= xa2 && xa2 <= xb2 && ya1 <= yb1 && ya2 >= yb2) cout << "YES" << endl;
		else if(yb1 <= ya1 && ya1 <= yb2 && xa1 <= xb1 && xa2 >= xb2) cout << "YES" << endl;
		else if(yb1 <= ya2 && ya2 <= yb2 && xa1 <= xb1 && xa2 >= xb2) cout << "YES" << endl;
		else if(xb1 <= xa1 && xa1 <= xb2 && yb1 <= ya1 && ya1 <= yb2) cout << "YES" << endl;
		else if(xb1 <= xa1 && xa1 <= xb2 && yb1 <= ya2 && ya2 <= yb2) cout << "YES" << endl;
		else if(xb1 <= xa2 && xa2 <= xb2 && yb1 <= ya1 && ya1 <= yb2) cout << "YES" << endl;
		else if(xb1 <= xa2 && xa2 <= xb2 && yb1 <= ya2 && ya2 <= yb2) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

Measured memory_bytes: 1220
//%std
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
inline int read()
{
	int out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		fh=-1,jp=getchar();
	while (jp>='0'&&jp<='9')
		out=out*10+jp-'0',jp=getchar();
	return out*fh;
}
const int P=1000000007;
int add(int a,int b)
{
	return (a+b>=P)?(a+b-P):(a+b);
}
void inc(int &a,int b)
{
	a=add(a,b);
}
int mul(int a,int b)
{
	return 1LL * a * b % P;
}
const int MAXN=1e5+10;
int t[MAXN],a[3];
int main()
{
	int n=read();
	int ans=1;
	for(int i=0;i<n && ans;++i)
	{
		int x=read();
		int s=0;
		for(int k=0;k<3;++k)
			s+=(a[k]==x);
		ans=mul(ans,s);
		for(int k=0;k<3;++k)
			if(a[k]==x)
			{
				++a[k];
				break;
			}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
# https://misteer.hatenablog.com/entry/ABC113

MOD = 10 ** 9 + 7

H, W, K = map(int, input().split())

K -= 1
# 以降縦棒の番号は0-indexedで扱う

dp = [[0 for _ in range(W)] for _ in range(H + 1)]
dp[0][0] = 1
# dp[h][k]
# 横線h段からなるあみだくじで、0がkに来るものの数

for h in range(1, H + 1):
    # 移動後の高さh
    for b in range(1 << (W - 1)):
        if '11' in bin(b): continue

        perm = [i for i in range(W)]
        # 0-indexedの到達位置

        for i in range(W - 1):
            if (b >> i) & 1:
                perm[i], perm[i + 1] = perm[i + 1], perm[i]

        for i in range(W):
            dp[h][perm[i]] += dp[h - 1][i]
            dp[h][perm[i]] %= MOD

print(dp[H][K])


Measured memory_bytes: 3064
#include<stdio.h>

void maxHeapify(int *,int);

int H;

int main(){

  int i,A[500000];

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

  for(i=H/2 ; i>=1 ; i--){
     maxHeapify(&A[0],i);
  }

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

  printf("\n");
   
  return 0;
}

 void maxHeapify(int *A,int i){

   int temp,l,j,r,largest;

   l = i*2;
   r = i*2+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){
     temp = A[i];
   A[i] = A[largest];
   A[largest] = temp;

   maxHeapify(&A[0],largest);

 	 
 }

 }



Measured memory_bytes: 3696
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let a=read::<i32>();
    let b=read::<i32>();
    println!("{}",b*2-a);
}

Measured memory_bytes: 4352
import itertools
import math

N = int(input())

array = list(range(N))
ckyori_list = list(itertools.combinations(array, 2))
path_list = list(itertools.permutations(array))
kyori_list = [[ 0 for i in range(N)] for j in range(N)]

cmap = []
for i in range(N):
    temp = list(map(int, input().split(" ")))
    cmap.append(temp)
    
for i,j in ckyori_list:
    kyori_list[i][j] = math.sqrt((cmap[i][0]-cmap[j][0])**2 + (cmap[i][1]-cmap[j][1])**2)
    kyori_list[j][i] = kyori_list[i][j]

sum = 0
for i in path_list:
    for j in range(len(i)-1):
        sum += kyori_list[i[j]][i[j+1]]
        
print(sum/len(path_list))

Measured memory_bytes: 7996
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int count = 0;
        int[] ans = new int[n - 1];
        String x;
        String y;
        for (int i = 1; i < n; i++) {

            x = s.substring(0, i);

            y = s.substring(i);

            for (int j = 0; j < x.length(); j++) {
                if (y.contains(String.valueOf(x.charAt(j)))) {
                    if (j == 0) {

                        count++;
                    } else if (!(x.substring(0, j).contains(String.valueOf(x.charAt(j))))) {
                        count++;

                    }

                }
            }

            ans[i - 1] = count;
            count = 0;
        }
        Arrays.sort(ans);
        System.out.println(ans[n - 2]);
    }
}

Measured memory_bytes: 21972
import math
a, b, n = map(int, input().split())

if n < b:
    score = math.floor(a*n/b) - a * math.floor(n/b)
    print(score)
    
else:
    max_score = -10000
    for i in range(1,10):
        x = (b-1)*i
        score = math.floor(a*x/b) - a * math.floor(x/b)
        max_score = max(max_score, score)
    print(max_score)

Measured memory_bytes: 9108
A, B = list(map(int, input().split(' ')))

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

if A == 0:
    print(f(B))
else:
    print(f(A-1) ^ f(B))

Measured memory_bytes: 3060
#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;

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() {
  i64 N, M;
  std::cin >> N >> M;
  std::vector<i64> p;
  tools::read(p, N);
  std::transform(p.begin(), p.end(), p.begin(), [](const i64 p_i) { return p_i - 1; });

  std::vector<std::unordered_set<i64>> edges(N);
  for (i64 i = 0; i < M; ++i) {
    i64 x_i, y_i;
    std::cin >> x_i >> y_i;
    edges[x_i - 1].insert(y_i - 1);
    edges[y_i - 1].insert(x_i - 1);
  }

  std::vector<std::unordered_set<i64>> components;
  std::unordered_set<i64> unvisited;
  for (i64 i = 0; i < N; ++i) {
    unvisited.insert(i);
  }
  while (!unvisited.empty()) {
    components.emplace_back();
    std::queue<i64> queue({*unvisited.begin()});
    while (!queue.empty()) {
      const i64 from = queue.front();
      queue.pop();
      unvisited.erase(from);
      components.back().insert(from);
      for (const i64& to : edges[from]) {
        if (unvisited.find(to) != unvisited.end()) {
          queue.push(to);
        }
      }
    }
  }

  i64 answer = 0;
  for (const std::unordered_set<i64>& component : components) {
    for (const i64& i : component) {
      if (component.find(p[i]) != component.end()) ++answer;
    }
  }

  std::cout << answer << std::endl;
  return 0;
}

Measured memory_bytes: 29212
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int n;
	cin>>n;
	int sum=0;
	string s=to_string(n);
	for(int i=0;i<s.size();i++){
		sum+=(int)(s[i]-'0');
	}
	if(n%sum==0){
		cout<<"Yes\n";
	}
	else{
		cout<<"No\n";
	}
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(ll i=0;i<n;++i)
#define END(x) (*(x.end()-1))
#define INF (INT_MAX / 2)

using namespace std;
typedef long long ll;


template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a/gcd(a,b)*b;
}

int main(void){
    ll d;
    ll max_v=-INF;
    ll max_i=0;
    cin>>d;
    vector<ll>c(26);
    vector<vector<ll>>s(d,vector<ll>(26));
    vector<ll> ans;
    rep(i,26){
        cin>>c[i];
    }
    rep(i,d){
        max_v=-INF;
        rep(j,26){
            cin>>s[i][j];
            if(max_v<s[i][j]){
                max_v=s[i][j];
                max_i=j+1;
            }
        }
        ans.push_back(max_i);
    }
    for(auto i:ans){
        cout<<i<<endl;
    }
}
/*




*/


Measured memory_bytes: 3728
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
static const int N = 1000;

int lcs(string X, string Y) {
  int c[N + 1][N + 1];
  int m = X.size();
  int n = Y.size();
  int maxl = 0;
  X = ' ' + X;
  Y = ' ' + Y;
  for ( int i = 0; i <= m; i++ ) c[i][0] = 0;
  for ( int j = 1; j <= n; j++ ) c[0][j] = 0;

  for ( int i = 1; i <= m; i++ ) {
    for ( int j = 1; j <= n; j++ ) {
      if ( X[i] == Y[j] ) {
	c[i][j] = c[i - 1][j - 1] + 1;
      } else {
	c[i][j] = max(c[i - 1][j], c[i][j - 1]);
      }
      maxl = max(maxl, c[i][j]);
    }
  }

  return maxl;
}

int main() {
  string s1,s2;
  int n; cin >> n;
  for ( int i = 0; i < n; i++ ) {
    cin >> s1 >> s2;
    cout << lcs(s1, s2) << endl;
  }
  return 0;
}



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

int main(void) {
    int arr[5], index;
    for (int i = 0; i < 5; i++) {
        cin >> arr[i];
        if (arr[i] == 0) index = i+1;
    }
    cout << index << "\n";
    return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef unordered_map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

vi adj[200001];

struct DSU
{
	int S;
	
	struct node
	{
		int p;
		unordered_map<int,int> ma;
	};
	vector<node> dsu;
	
	DSU(int n)
	{
		S = n;
		for(int i = 0; i < n; i++)
		{
			node tmp;
			tmp.p = i;
			dsu.pb(tmp);
		}
	}
	
	void reset(int n, vi &vec)
	{
		dsu.clear();
		S = n;
		for(int i = 0; i < n; i++)
		{
			node tmp;
			tmp.p = i;
			tmp.ma[vec[i]]++;
			dsu.pb(tmp);
		}
	}
	
	int rt(int u)
	{
		if(dsu[u].p == u) return u;
		dsu[u].p = rt(dsu[u].p);
		return dsu[u].p;
	}
	
	void merge(int u, int v)
	{
		u = rt(u); v = rt(v);
		if(u == v) return ;
		if(dsu[v].ma.size()>dsu[u].ma.size()) swap(u,v);
		dsu[v].p = u;
		while(!dsu[v].ma.empty())
		{
			mit it = dsu[v].ma.begin();
			dsu[u].ma[it->fi]+=it->se;
			dsu[v].ma.erase(it);
		}
	}
	
	bool sameset(int u, int v)
	{
		if(rt(u) == rt(v)) return true;
		return false;
	}

};
//DSU end

vi cc;
int cn = 0;
bool vis[200001];
void dfs(int u)
{
	vis[u]=1;
	cc[u]=cn;
	for(int i = 0; i < adj[u].size(); i++)
	{
		int v = adj[u][i];
		if(vis[v]) continue;
		dfs(v);
	}
}

DSU dsu(1);

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	srand(77);
	int n, k, l;
	cin>>n>>k>>l;
	for(int i = 0; i < k; i++)
	{
		int u, v; cin>>u>>v;
		u--; v--;
		adj[u].pb(v); adj[v].pb(u);
	}
	cc.resize(n);
	for(int i = 0; i < n; i++)
	{
		if(!vis[i])
		{
			dfs(i);
			cn++;
		}
	}
	dsu.reset(n,cc);
	for(int i = 0; i < l; i++)
	{
		int u, v; cin>>u>>v;
		u--; v--;
		dsu.merge(u,v);
	}
	for(int i = 0; i < n; i++)
	{
		cout<<dsu.dsu[dsu.rt(i)].ma[cc[i]];
		if(i<n-1) cout<<' ';
	}
}


Measured memory_bytes: 35044
#include <bits/stdc++.h>
#define endl "\n"

using namespace std;

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

    int total_happens = 0;
    bool found = false;

    while(total --)
    {
        int a, b;
        cin >> a >> b;

        if(a == b)
        {
            total_happens ++;
        }
        else
        {
            total_happens = 0;
        }

        if(total_happens == 3)
        {
            found = true;
        }
    }

    if(found == false)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }

    return 0;
}



Measured memory_bytes: 3620
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);    //scanner
        long    a = sc.nextLong();      // A:long
        double  b = sc.nextDouble();    // B:小数点以下は二桁
        // 精度を補うため，long型で計算を行う
        a = a * (long)(b*100 + 0.01) /100;   // (A x (Bx100)) / 100
        System.out.println(a);    // output
    }
}

Measured memory_bytes: 36708
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include<numeric>
using namespace std;
using P = pair<int, int>;
#define rep(i,n) for(int i=0; i<(n);i++)
typedef long long ll;


int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n, 101);
    rep(i,k){
        int d;
        cin >> d;
        vector<int> b(d);
        rep(j, d){
            int c;
            cin >> c;
            a[--c] = 0;
        }
    }
    int ans=0;
    rep(i, n){
        if(a[i] == 101){
            ans++;
        }
    }
    cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3112
k = int(input())
nums = reversed([ int(s) for s in input().split(" ")])

pass_min = 2
pass_max = 2
for n in nums:

    # pass_min = このラウンドを通過する人数の下限
    # pass_max = このラウンドを通過する人数の上限

    # pass_min以上の最小のnの倍数
    aaa = pass_min + (n - pass_min % n) % n

    # pass_max以下の最大のnの倍数
    bbb = pass_max - pass_max % n

    # 不可能チェック
    if aaa > pass_max or bbb < pass_min:
        print(-1)
        exit()
    
    pass_min = aaa
    pass_max = bbb + (n - 1)

print(pass_min, pass_max)

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

int main(){
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    string s;
    cin>>s;

    int boole = 1;
    for(int i = 0; i < s.size(); i++){
        if((i%2 == 0 && s[i] == 'L') || (i%2 != 0 && s[i] == 'R'))
            boole = 0;
    }

    if(boole == 1)
        cout<<"Yes";
    else
        cout<<"No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll unsigned long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
//vector <bool> prime(boolsize,1);
//void seive()
//{
//    ll n=boolsize;
//    prime[0]=prime[1]=0;
//    for(ll i=2;i<=sqrt(boolsize);i++)
//    {
//        if(prime[i]==1)
//        {
//            for(ll j=i*i;j<=n;j+=i)
//            {
//                prime[j]=0;
//            }
//        }
//    }
//}

/// check for test case before submitting
void vfun()
{
    ll n,k;
    cin>>n;
    vi v(n);
    fo(i,n)
        cin>>v[i];
    ll lcm=v[0];
    fo1(i,n-1)
    {
        lcm=(lcm)/(__gcd(lcm,v[i]));
        lcm*=v[i];
    }
    cout<<lcm<<endl;

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0); ///cant use scanf, printf
    cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
    //cin>>test;
    while(test--)
    {

        //fun();
        vfun();
//         if(vfun())
//            cout<<"YES\n";
//         else
//            cout<<"NO\n";
    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or not




Measured memory_bytes: 3660
#include <vector>
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

int main()
{
	int n, k;

	cin >> n >> k;

	double result = n >= k ? n - k + 1: 0;

	int t = 1;
	long pow2 = 2;
	double pow12 = 1.0 / 2;

	for (int i = n > k - 1 ? k - 1 : n; i >= 1; i--)
	{
		while (i * pow2 < k)
		{
			t++;
			pow2 *= 2;
			pow12 /= 2;
		}
		result += pow12;
	}

	result /= n;

	printf("%.50lf", result);

	return 0;
}

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

#define ld double
#define ll long long
#define pii pair <int, int>
#define ull unsigned long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)

#define PI acos(-1)
#define MOD 51123987
#define MUL 191260817
#define EPS 1e-10
#define INF 1 << 30
#define LINF 1LL << 60

template <typename T> inline void chkmin(T &x, T y) {if (y < x) x = y;}
template <typename T> inline void chkmax(T &x, T y) {if (y > x) x = y;}
template <typename T> inline T add(T x, T y) {return (x + y) % MOD;}
template <typename T> inline T mul(T x, T y) {return 1LL * x * y % MOD;}
template <typename T> inline T qp(T x, T n) {
	T ans = 1;
	do {if (n & 1) ans = mul(ans, x); x = mul(x, x);} while (n >>= 1);
	return ans;
}

const int SZ = 1 << 13;
char buff[SZ], *pos = buff + SZ - 1;
#define getchar() (++ pos == buff + SZ ? fread(pos = buff, 1, SZ, stdin), *pos : *pos)

inline ll read() {
	ll x = 0; int f = 1, c = getchar();
	for (;!isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = (x<<3) + (x<<1) + (c^48);
	return x * f;
}

const int N = 1 << 20;
char s[N];
int fail[N];
int t[N], pre[N], suf[N];
int n;

void solvePre() {
	int f = fail[0] = -1;
	rep(i, n) {
		while (~f && s[f] != s[i]) f = fail[f];
		fail[i + 1] = ++ f;
	}
	rep(i, n + 1) if (i) t[i] = i % (i - fail[i]) == 0 && i - fail[i] <= i / 2 ? i - fail[i] : -1;
}

int main() {
	n = 0;
	while (!isspace(s[n] = getchar())) ++ n;
	solvePre();
	memcpy(pre, t, sizeof pre);
	reverse(s, s + n);
	solvePre();
	reverse(t + 1, t + n + 1);
	memcpy(suf, t, sizeof suf);
	reverse(s, s + n);
	if (!~pre[n]) {printf("1\n1\n"); return 0;}
	if (pre[n] == 1) {printf("%d\n1\n", n); return 0;}
	printf("2\n");
	int cnt = 0;
	rep(i, n) if (i) if (!~pre[i] && !~suf[i + 1]) ++ cnt;
	printf("%d\n", cnt);
	return 0;
}


Measured memory_bytes: 13056
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define popcount(x) __builtin_popcount(x)
#define MOD 1000000007
#define MAXN 100010
inline int fuck(int x, int p) {
	register int y = 1;
	for (; p; p >>= 1) {
		if (p & 1) y = 1LL * y * x % MOD;
		x = 1LL * x * x % MOD;
	}
	return y;
}
int n, m, k, a[20], f[20][MAXN], frc[MAXN], inv[MAXN], ans;
inline int P(int n, int m) {
	if (m > n) return 0;
	return 1LL * frc[n] * inv[n - m] % MOD;
}
inline void up(int &x, int y) {
	if ((x += y) >= MOD) x -= MOD;
}
int main() {
	scanf("%d%d", &n, &m);
	k = 1 << n;
	for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
	std::sort(a + 1, a + m + 1, [](int a, int b) { return a > b; });

	frc[0] = 1;
	for (int i = 1; i < MAXN; i++) frc[i] = 1LL * frc[i - 1] * i % MOD;
	inv[MAXN - 1] = fuck(frc[MAXN - 1], MOD - 2);
	for (int i = MAXN - 1; i; i--) inv[i - 1] = 1LL * inv[i] * i % MOD;

	f[0][0] = 1;
	for (int i = 0; i < m; i++) {
		for (int d = 0; d < k; d++) {
			if (!f[i][d]) continue;
			up(f[i + 1][d], f[i][d]);
			int can = k - d - a[i + 1];
			for (int j = 0; j < n; j++) {
				if ((d >> j) & 1) continue;
				up(f[i + 1][d | (1 << j)], 1LL * f[i][d] * P(can, (1 << j) - 1) % MOD * (1 << j) % MOD);
			}
		}
	}
	ans = frc[k - 1];
	for (int d = 1; d < k; d++) f[m][d] = 1LL * f[m][d] * frc[k - d - 1] % MOD, up(ans, (popcount(d) & 1) ? MOD - f[m][d] : f[m][d]);
	printf("%lld\n", 1LL * ans * (1 << n) % MOD);
	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int dx[4] = {0, 0, 1, -1};
    int dy[4] = {1, -1, 0, 0};
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    vector<vector<int> > g(h, vector<int>(w, Inf));
    rep (i, h) cin >> s[i];
    int black = 0;
    rep (i, h) rep (j, w) if (s[i][j] == '#') black++;
    queue<pair<int, int> > q;

    q.push(make_pair(0, 0));
    g[0][0] = 0;
    while (!q.empty()) {
        int x, y;
        x = q.front().first, y = q.front().second;
        q.pop();
        rep (i, 4) {
            int nx, ny;
            nx = x + dx[i], ny = y + dy[i];
            if (nx < 0 || ny < 0 || nx >= h || ny >= w) continue;
            if (s[nx][ny] == '#') continue;
            if (g[nx][ny] != Inf) continue;
            g[nx][ny] = g[x][y] + 1;
            q.push(make_pair(nx, ny));
        }
    }
    if (g[h - 1][w - 1] == Inf) {
        cout << -1 << endl;
        return 0;
    }

    cout << h * w - 1 - black - g[h - 1][w - 1] << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

char *o	= "+-*";

inline void swap(int *a, int *b)
{
	int t = *a;
	*a = *b;
	*b = t;
}

inline int calc(int x, int y, int oid)
{
	switch (oid){
	  case 0: return (x + y);
	  case 1: return (x - y);
	  case 2: return (x * y);
	}
}

int check(int a, int b, int c, int d)
{
	int i, j, k, l;

	for (l = 0; l < 4; l++) {
		for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) for (k = 0; k < 3; k++){
			if (calc(calc(a, b, i), calc(c, d, j), k) == 10) return printf("(%d%c%d)%c(%d%c%d)", a, o[i], b, o[k], c, o[j], d);
			if (calc(calc(calc(a, b, i), c, j), d, k) == 10) return printf("((%d%c%d)%c%d)%c%d", a, o[i], b, o[j], c, o[k], d);
		}
		if (l % 2 == 0) swap(&a, &b);
		if (l == 1) swap(&c, &d);
	}
	return (0);
}

int main(void)
{
	int a, b, c, d;
	while (scanf("%d %d %d %d", &a, &b, &c, &d), a){
		if (check(a, b, c, d) || check(a, c, b, d) || check(a, d, c, b) || check(c, d, a, b) || check(b, d, a, c) || check(b, c, a, d));
		else {
			printf("0");
		}
		puts("");
	}
	return (0);
}

Measured memory_bytes: 616
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
using ll = long long;
using VI = vector<int>;

int main(){
  Int n;cin >> n;
  Int k = (n*(n-1))/2;

  cout << k << endl;
}


Measured memory_bytes: 256