akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <queue>
using namespace std;

long long LucaNum(int n);

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

    vector<long long> dp(N+1,0);

    dp[0] = 2;
    dp[1] = 1;

    for(int i=2; i<=N; i++){
        dp[i] = dp[i-1] + dp[i-2];
    }
    cout << dp[N] << endl;
    return 0;

}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include <boost/multiprecision/cpp_int.hpp> 

#define gc getchar//_unlocked
#define pc putchar//_unlocked
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pp pair<int,int>
#define ppl pair<ll,ll>
#define bigint boost::multiprecision::cpp_int
#define finp ios_base::sync_with_stdio(0);cin.tie(0);
#define bc __builtin_popcountll
#define afor(i,a,b) for(int i=a;i<=b;++i)
#define bfor(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vpp vector<pp>
#define vll vector<ll>

using namespace std;
using namespace __gnu_pbds;

char putnb[20];
void putn(ll n) {if(!n)pc('0');if(n<0)pc('-'),n=0-n;int pi=0;while(n)putnb[pi++]=(n%10)+'0',n/=10;while(pi)pc(putnb[--pi]);}
void sci(int *x) {register char c = gc();*x = 0;for(; (c<48)||(c>57);c = gc());for(; (c>47)&&(c<58);c = gc())*x = (int)((((*x)<<1) + ((*x)<<3)) + c - 48);}
void scll(ll *x)  {register char c = gc();*x = 0;for(; (c<48)||(c>57);c = gc());for(; (c>47)&&(c<58);c = gc())*x =  (ll)((((*x)<<1) + ((*x)<<3)) + c - 48);}
ll fp(ll a,ll b,ll c) {if(b<=0)return 1; if(b==1)return a; ll ret=fp(a,b/2,c); ret=(ret*ret); if(b&1)ret=(ret*a); return ret;}

const ll mod=1e9 +7;
const ll mod2=1999999973;
const ll inf=1e18;
const int infs=1e9 + 1000;
const int N=100000;
const long double PI = acos(-1);

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll n;
ll p;
ll ev = 0;
ll od = 0;
ll nc2(ll x)
{
	ll ret = x;
	ret*= x-1;
	ret/=2;
	return ret;
}
int main()
{
  finp;
  cin>>n>>p;
  afor(i,1,n)
  {
  	ll val;
  	cin>>val;
  	if(val & 1)od++;
  	else ev++;
  }

  if(p==1 && od==0)
  {
  	cout<<"0";
  	return 0;
  }

  
  	ll ans = fp(2,ev,mod) * fp(2,od-1,mod);
  	cout<<ans<<"\n";
 
  
return 0;
}

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

int with9(const int a){
  int x = a;
  int ans = 0;
  while(x >= 9){
    int i = 1;
    while(x >= i * 9)
      i *= 9;
    x -= i;
    ++ans;
  }
  return ans + x;
}

int with6(const int a){
  int x = a;
  int ans = 0;
  while(x >= 6){
    int i = 1;
    while(x >= i * 6)
      i *= 6;
    x -= i;
    ++ans;
  }
  return ans + x;
}

int main() {
  int n;
  cin >> n;
  
  int ans = n;
  for(int i=0; i<=n; i++){
    ans = min(ans, with9(i) + with6(n-i));
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<limits.h>
#include<set>
#include<map>
#include<string.h>
#include<queue>
#include<math.h>
#include<stdio.h>
#include<unordered_set>
using namespace std;
struct comp{
    bool operator () (const pair<int,char>& p1,const pair<int,char>& p2){
        return p1.first>p2.first;
    }
};
int main(){
    int n;
    while(cin>>n,n){
        map<char,int>ma;
        bool f=false;
        for(int i=0;i<n;i++){
            char c;
            cin>>c;
            ma[c]++;
            deque<pair<int,char> >que;
            for(auto p:ma){
                que.push_back(make_pair(p.second,p.first));
            }
            sort(que.begin(),que.end(),comp());
            pair<int,char> a=que[0];que.pop_front();
            if(que.size()){
                pair<int,char> b=que[0];que.pop_front();
                if(a.first-b.first>n-1-i){
                    for(int j=i+1;j<n;j++){
                        char x;
                        cin>>x;
                    }
                    cout<<a.second<<" "<<i+1<<endl;
                    f=true;
                    break;
                }
            } else {
                if(a.first>n-1-i){
                    for(int j=i+1;j<n;j++){
                        char x;
                        cin>>x;
                    }
                    cout<<a.second<<" "<<i+1<<endl;
                    f=true;
                    break;
                }
            }
        }
        if(!f){
            cout<<"TIE"<<endl;
        }
    }
    return 0;
}

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

void selectionsort(int A[],int N, int& count){
    for(int i = 0; i < N; ++i){
      int minj = i;
      for(int j = i; j < N; ++j){
        if(A[j] < A[minj]){
          minj = j;
        }
      }
      if(i!=minj) {
        swap(A[i], A[minj]);
        count++;
      }
    }
}

int main(){
  int A[100], N, count = 0;

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

  selectionsort(A, N, count);

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

  cout << count << endl;

  return 0;
}



Measured memory_bytes: 3084
#include<stdio.h>
int main(void){
int a,b,c,d,e,f,g;
int A[1000000];
d=0;
for(c=0;c<a;c++){
   
  A[c]=0;
}

scanf("%d",&a);
for(c=1;c<a;c++){
    scanf("%d",&e);
  A[e]=A[e]+1;
}
for(c=0;c<a;c++){
    d=A[c+1];
   printf("%d\n",d);
}
}


Measured memory_bytes: 2472
void main() {
    long[] tmp = readln.split.to!(long[]);
    long x = tmp[0], y = tmp[1];
    long mod = 10 ^^ 9 + 7;
    long ans;
    if ((x + y) % 3 == 0) {
        long n = (2 * y - x) / 3, m = (2 * x - y) / 3;
        if (n >= 0 && m >= 0) {
            long l = n+m;
            long[] fac = new long[l+1];
            long[] finv = new long[l+1];
            long[] inv = new long[l+1];
            fac[0] = 1, fac[1] = 1;
            finv[0] = 1, finv[1] = 1;
            inv[1] = 1;
            foreach (i; 2 .. l+1) {
                fac[i] = fac[i-1] * i % mod;
                inv[i] = mod - inv[mod%i] * (mod / i) % mod;
                finv[i] = finv[i-1] * inv[i] % mod;
            }
            long comb(long x, long y) {
                if (x < y) return 0;
                if (x < 0 || y < 0) return 0;
                return fac[x] * (finv[y] * finv[x-y] % mod) % mod;
            }
            ans = comb(n+m, n);
        }
    }
    ans.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 20988
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const double EPS = 1e-10;
const ll mod=1000000007;
//const ll mod=998244353;

int main(void){
  string a,b,c;
  cin>>a>>b>>c;
  cout<<a[0]<<b[0]<<c[0]<<endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

int main() {
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 1; i < s.length(); ++i) {
        if(s[i] != s[i-1]) ans++;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <queue>
#include<iomanip>
#include <cmath>
#include <set>

#define ABS(x) ((x)>0?(x):-(x))
#define MIN(x,y) ((x)>(y)?(y):(x))

using namespace std;
typedef long long ll;

ll newton(long long int a, long long int  b)
{
	if(a==b)
		return a;
	while(a != 0 && b != 0)
	{
		if(a > b)
		{
			b += a;
			a = b-a;
			b -= a;
		}
		b %= a;
	}
	return a;
}

struct UnionFind {
	vector<int> p;
	UnionFind(int N):p(N)
	{
		for(int i=0; i< N; i++)
		{
			p[i] = i;
		}
	}
	int root(int x)
	{
		if(p[x] == x)
			return x;
		return p[x] = root(p[x]);
	}
	void unite(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		if(rx == ry) return;
		p[rx] = ry;
	}
	bool issame(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

//大きな数に対する割り算をするとき、MODを指定することで掛け算の値に変換できる

ll div2mul_calc(ll a, ll b, ll m)
{
	if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll d = div2mul_calc(a, b / 2, m);
        return (d * d) % m;
    } else {
        return (a * div2mul_calc(a, b - 1, m)) % m;
    }
}
ll div2mul(ll n, ll mod)
{
	return div2mul_calc(n, mod-2, mod);
}

ll twoRow(ll a, ll b, ll mod)
{
	ll ret = 1;
	for(ll i = 1 ;i <= a+b;++i)
	{
		ret *= i;
		ret %= mod;
	}
	for(ll i = 1 ;i <= a;++i)
	{
		ret *= div2mul(i,mod);
		ret %= mod;
	}
	for(ll i = 1 ;i <= b;++i)
	{
		ret *= div2mul(i,mod);
		ret %= mod;
	}
	return ret;
}

int main()
{
	ll mod = 1000000007;
	ll N,K;
	cin >> N >> K;
	ll blue = K - 1;
	ll red  = N - K;
	ll ans = ((twoRow(blue,0,mod)%mod)*(twoRow(red,1,mod)%mod))%mod;
	cout << ans << endl;
	for(ll i=2;i<=K ;++i)
	{
		if(red < 0)
		{
			cout << 0 << endl;
			continue;
		}
		ans *= blue;
		ans %= mod;
		ans *= div2mul(i-1, mod);
		ans %= mod;
		ans *= red;
		ans %= mod;
		ans *= div2mul(i, mod);
		ans %= mod;
		--blue;
		--red;
		//cout << blue << " " << red << endl;
		cout << ans << endl;
	}
	return 0;
}



































Measured memory_bytes: 256
from copy import deepcopy


def main():
    word = input()
    target = ["", "K", "I", "H", "", "B", "", "R", ""]
    index = [0, 4, 6, 8]
    for i in range(2 ** 4):
        now_target = deepcopy(target)
        bin_i = bin(i)[2:].zfill(4)
        for j in range(4):
            if bin_i[j] == "1":
                now_target[index[j]] = "A"
        if "".join(now_target) == word:
            print("YES")
            break
    else:
        print("NO")


if __name__ == '__main__':
    main()



Measured memory_bytes: 3444
n = int(input())
b = list(map(int, input().split()))
ans = []

for i in range(n, -1, -1):
    for j in range(i - 1, -1, -1):
        if b[j] == j + 1:
            ans.append(j + 1)
            b = b[:j] + b[j + 1:]
            break
    if i < len(b):
        break

if len(ans) == n:
    print("\n".join(map(str, reversed(ans))))
else:
    print(-1)

Measured memory_bytes: 38768
n, m = map(int, input().split())
if n == 1 and m == 0:
  print(0)
  exit()
  
answer = [-1]*n

for i in range(m):
  s, c = map(int, input().split())
  if s == 1 and c == 0:
    if n == 1:
      print(0)
      exit()
    else:
      print(-1)
      exit()
  if answer[s-1] == -1 or answer[s-1] == c:
    answer[s-1] = c
  else:
    print(-1)
    exit()

if answer[0] == -1:
  answer[0] = 1
for j in range(n):
  if answer[j] == -1:
    answer[j] = 0
    
answer = [str(x) for x in answer] 

print(int(''.join(answer)))



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

using namespace std;


int main() {
	string S;
	cin >> S;

	//0101,,, or 1010...
	int l = 0, r = 0;
	for(int i = 0; i < S.size(); i++) {
		if(i % 2 == 0) {
			if(S[i] == '0') r++;
			else l++;
		} else {
			if(S[i] == '0') l++;
			else r++;
		}

	}

	cout << min(l, r) << endl;
}


Measured memory_bytes: 760
Scanf.scanf "%d %d" @@ fun n k ->
  let rec f i s =
    if i = n + 1 then s
    else
      let j = (n - k) / i in
      f (i + 1) (s - k * (j + 1) + min (n + 1) (i * (j + 1))) in
  let ans = f (k + 1) (if k = 0 then k - n  else 0) in
  Printf.printf "%d\n" ans


Measured memory_bytes: 3804
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
const ll INF = INT_MAX;

int main() {
  int N,C;
  cin >> N >> C;
  vector<vint> D(C,vint(C,0));
  vector<vint> c(N,vint(N,0));
  vector<vint> sumD(3,vint(C,0));
  repeat(i,C){
    repeat(j,C){
      cin >> D[i][j];
    }
  }
  repeat(i,N){
    repeat(j,N){
      cin >> c[i][j];
      c[i][j]--;
      sumD[(i+j)%3][c[i][j]]++;
    }
  }
  ll ans=INF;
  repeat(i,C){
    repeat(j,C){
      if(i==j) continue;
      repeat(k,C){
        if(i==k||j==k) continue;
        ll a=0;
        repeat(l,C){
          a += sumD[0][l]*D[l][i];
        }
        repeat(l,C){
          a += sumD[1][l]*D[l][j];
        }
        repeat(l,C){
          a += sumD[2][l]*D[l][k];
        }
        ans = min(ans,a);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1280
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
using namespace std;
using i32 = int32_t; using i64 = int64_t; using f64 = double_t; using str = string;
template <typename T> using vec = vector<T>;
template <typename T> using heap = priority_queue<T, vec<T>, greater<T>>;
#define times(n, i) for (i32 i = 0; i < (n); ++i)
#define range(n, m, i) for (i32 i = (n); i < (m); ++i)
#define upto(n, m, i) for (i32 i = (n); i <= (m); ++i)
#define downto(n, m, i) for (i32 i = (n); i >= (m); --i)
#define foreach(xs, x) for (auto &x : (xs))
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define uniqueall(xs) (xs).erase(unique(all(xs)), (xs).end())
#define maximum(xs) (*max_element(all(xs)))
#define minimum(xs) (*min_element(all(xs)))
#define even(x) (((x) & 1) == 0)
#define odd(x) (((x) & 1) == 1)
#define append emplace_back
const i64 MOD = 1000000007;

i32 n;
i32 b[1002][3];
vec<pair<f64, i32>> d[1002];

i32 main()
{
    i32 _0, _1, _2, _3;
    cin >> _0 >> _1 >> _2 >> _3 >> n;
    b[0][0] = _0; b[0][1] = _1; b[n+1][0] = _2; b[n+1][1] = _3;
    b[0][2] = 0; b[n+1][2] = 0;
    times(n, i) {
        cin >> b[i+1][0] >> b[i+1][1] >> b[i+1][2];
    }

    f64 dmax = sqrt(pow(b[0][0] - b[n+1][0], 2) + pow(b[0][1] - b[n+1][1], 2));
    times(n+1, i) {
        range(i+1, n+2, j) {
            f64 px = pow(b[i][0] - b[j][0], 2);
            f64 py = pow(b[i][1] - b[j][1], 2);
            f64 dist = max(0.0, sqrt(px + py) - b[i][2] - b[j][2]);
            if (dist <= dmax) {
                d[i].append(make_pair(dist, j));
                d[j].append(make_pair(dist, i));
            }
        }
        sortall(d[i]);
    }

    f64 ans = 0;
    set<pair<f64, i32>> rest;
    bool fp[1002]; times(1002, i) fp[i] = false;
    rest.insert(make_pair(0, 0));
    while (rest.size() > 0) {
        f64 dd = rest.begin()->first;
        i32 i = rest.begin()->second;
        rest.erase(rest.begin());

        if (fp[i])
            continue;
        fp[i] = true;

        if (i == n+1) {
            ans = dd;
            break;
        }

        times(d[i].size(), j) {
            if (fp[d[i][j].second] || d[i][j].first + dd > dmax)
                continue;
            rest.insert(make_pair(d[i][j].first + dd, d[i][j].second));
        }
    }

    cout << fixed << setprecision(12) << ans << endl;
    return 0;
}

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

int main() {
  int N; cin >> N;
  vector<int> dp(N+1, 1000000000);
  dp.at(0) = 0;
  for (int i = 0; i < N; i++) {
    dp.at(i+1) = min(dp.at(i+1), dp.at(i) + 1);
    for (int j = 6; i + j <= N; j *= 6) {
      dp.at(i + j) = min(dp.at(i + j), dp.at(i) + 1);
    }
    for (int k = 9; i + k <= N; k *= 9) {
      dp.at(i + k) = min(dp.at(i + k), dp.at(i) + 1);
    }
  }
  cout << dp.at(N) << endl;
}

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

int main() {

int A,B;
cin >> A >> B;
int64_t oka = min(A,B);
int c = min(A,B);
while (oka % A != 0 || oka % B != 0) {
  oka = oka + c;
}

cout << oka << endl;

return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

bool check(vector<string>& w){
    int N=w.size();
    REP(i,N-1){
        if(w[i].back()!=w[i+1].front()) return false;
    }
    
    set<string> st;
    REP(i,N) st.insert(w[i]);
    if(st.size()<N) return false;

    return true;
}

signed main()
{
    int N; cin>>N; 
    vector<string> w(N);
    REP(i,N) cin>>w[i];
    
    if(check(w))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  char x;
  cin >> x;
  
  if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') {
    cout << "vowel" << endl;
  }
  
  else {
    cout << "consonant" << endl;
  }
  
}

Measured memory_bytes: 3620
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Libraries --------------------------------//

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//akari : 1D, yukari : 2D, maki : 3D vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//akane : ascending order, aoi : decending order
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    int n, k;
    cin >> n;
    akari<int> as(n);
    for (int &a : as)
        cin >> a;
    cin >> n;
    while (n--)
    {
        cin >> k;
        cout << distance(as.begin(), lower_bound(as.begin(), as.end(), k)) << endl;
    }
}

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



Measured memory_bytes: 3100
#include <cstdio>

int main() {
  int n, m, ans = 0;
  scanf("%d %d", &n, &m);
  while (n--) {
    int cur;
    scanf("%d", &cur);
    if (cur >= m) ++ans;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>

typedef long long ll;

using namespace std;

int main() {
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> C(N);
    vector<vector<int>> A(N, vector<int>(M));
    for (int i = 0; i < N; i++) {
        cin >> C[i];
        for (int j = 0; j < M; j++) {
            cin >> A[i][j];
        }
    }
    int minC = -1;
    for (int bit = 0; bit < (1 << N); bit++) {
        vector<int> exp(M, 0);
        int totalC = 0;
        bool reached = false;
        for (int i = 0; i < N; i++) {
            if (bit & (1 << i)) {
                totalC += C[i];
                bool ok = true;
                for (int j = 0; j < M; j++) {
                    exp[j] += A[i][j];
                    if (exp[j] < X) {
                        ok = false;
                    }
                }
                if (ok) {
                    reached = true;
                    break;
                }
            }
        }
        if (reached) {
            minC = minC != -1 ? min(minC, totalC) : totalC;
        }
    }
    cout << minC << endl;
    return 0;
}



Measured memory_bytes: 3604
N, Q = map(int, input().split())
S = input()
a = []
an = [0] * (N + 1)
for i in range(Q):
    a.append(list(map(int, input().split())))

for i in range(len(S) - 1):
    an[i + 1] = an[i]
    if S[i:i + 2] == "AC":
        an[i + 1] += 1
for i in range(Q):
    print(an[a[i][1] - 1] - an[a[i][0] - 1])

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

int main() {
  int n; cin>>n;
  vector<int> b(n);
  for (int i=0; i<n; i++) cin>>b[i], b[i]--;
  vector<int> ans;
  while (b.size() > 0) {
    int z = -1;
	for (int i = 0; i < b.size(); i++) {
      if(b[i] == i) z = i;
    }
	if( z==-1) {
      cout << -1 << endl;
      return 0;
	}
	ans.push_back(z);
	b.erase(b.begin() + z);
  }
  reverse(ans.begin(), ans.end());
  for (int i=0; i<n; i++) cout<<1+ans[i]<<endl;
  return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) ((x).begin()), ((x).end())

#define READ(x) (cin >> (x))
#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))
#define WRITE_YESNO(x) (WRITE_N((x) ? "Yes" : "No"))

#define PRECISE_COUT std::cout << std::setprecision(15) << std::fixed

bool xor_logic(bool x, bool y) { return (x && y) || (!x && !y); }

ll solve(ll N, ll X, ll M) {
  vector<ll> a_vec{0, X};
  unordered_set<ll> a_set{X};

  ll a_i = X;
  ll i = 1;
  ll loop_l_i = 1;
  vector<ll> a_sum_vec{0, X};

  while (i < N) {
    a_i = (a_i * a_i) % M;

    if (a_set.count(a_i) != 0) {
      auto itr_found = find(a_vec.begin() + 1, a_vec.end(), a_i);
      loop_l_i = distance(a_vec.begin(), itr_found);
      break;
    }

    a_set.insert(a_i);
    a_vec.push_back(a_i);
    a_sum_vec.push_back(a_sum_vec.back() + a_i);
    i++;
  }

  ll loop_sum = a_sum_vec.back() - a_sum_vec[loop_l_i - 1];
  ll loop_count = (N - loop_l_i + 1) / (i - loop_l_i + 1);
  ll single_r_i = loop_l_i - 1 + (N - loop_l_i + 1) % (i - loop_l_i + 1);
  ll ans = loop_sum * loop_count + a_sum_vec[single_r_i];
  return ans;
}

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N, X, M;
  cin >> N >> X >> M;

  // main procedure
  ll ans = solve(N, X, M);

  // output
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6152
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;


signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int h,w,k;
    cin>>h>>w>>k;
    vector<string>s(h);
    for (int i = 0; i < h; i++)
    {
        cin>>s[i];
    }
    int ans=0;
    for (int i = 0; i < 1<<h; i++)
    {
        for (int j = 0; j < 1<<w; j++)
        {
            vector<string>grid(h);
            for (int i = 0; i < h; i++)
            {
                grid[i]=s[i];
            }
            for (int r = 0; r < h; r++)
            {
                if( (1<<r & i) ){
                    for (int c = 0; c < w; c++)
                    {
                        grid[r][c]='A';
                    }
                    
                }
            }
             for (int c = 0; c < w; c++)
            {
                if( (1<<c & j) ){
                    for (int r = 0; r < h; r++)
                    {
                        grid[r][c]='A';
                    }
                }
            }
            int cnt=0;
            for (int i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    if(grid[i][j]=='#') cnt++;
                }
                
            }
            if(cnt==k)ans++;
            
            
        }
        
    }
    cout<<ans<<endl;
    
    return 0;
}

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

using namespace std;

int n;
int cnt;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		if(a==b)
		{
			cnt++;
		}
		else
		{
			cnt=0;
		}
		if(cnt==3)
		{
			printf("Yes");
			return 0;
		}
	}
	printf("No");
	return 0;
}


Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int r,g,b,s;
    cin>>r>>g>>b;
    s=100*r+10*g+b;
    if(s%4==0)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
    return 0;

}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	MAX_NM = 55
)

var A [MAX_NM]string
var B [MAX_NM]string
var N, M int

func check(y, x int) bool {
	if y+M-1 >= N {
		return false
	}
	if x+M-1 >= N {
		return false
	}
	cntY, cntX := 0, 0
	for i := 0; i < M; i++ {
		cntX = 0
		for j := 0; j < M; j++ {
			if B[i][j] != A[y+cntY][x+cntX] {
				return false
			}
			cntX++
		}
		cntY++
	}
	return true
}
func main() {
	fsc := NewFastScanner()
	N, M = fsc.NextInt(), fsc.NextInt()
	for i := 0; i < N; i++ {
		A[i] = fsc.Next()
	}
	for i := 0; i < M; i++ {
		B[i] = fsc.Next()
	}

	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			if check(i, j) {
				fmt.Println("Yes")
				os.Exit(0)
			}
		}
	}
	fmt.Println("No")
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func IntMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}


Measured memory_bytes: 640
/*author : Yashvardhan
Saturday, April 04, 2020
6:37 PM
*/

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define rev(Y) reverse(all(Y))
#define printArr(name,from,to) for(int x = from; x < to; x++) cout << name[x] << " ";


#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
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...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int takemod(int a){return ((a%mod)+mod)%mod;}

int pow(int a, int b, int m)
{
	int ans = 1;
	a %= m;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int modinv(int a){return takemod( pow( takemod(a), mod-2,mod ) );}


signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	int n;
	cin >> n;

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

	int ans = 0;
	for(int i = 2; i * i <= n; i++){
		if(n%i == 0){
			int ot = n/i;
			int tmp = n;
			while(tmp%i == 0){
				tmp /= i;
			}
			if(tmp%i == 1) ans++;
			if(ot == i) continue;
			tmp = n;
			while(tmp%ot == 0) tmp /= ot;
			if(tmp%ot == 1) ans++;
		}
	}

	n--;
	for(int i = 2; i * i <= n; i++){
		if(n%i == 0){
			int ot = n/i;
			ans++;
			if(ot != i) ans++;
		}
	}

	ans += 2;

	
	cout << ans << endl;

	t2 = clock();
	cerr << endl << t2-t1 << endl;
	
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());
  ll ans = 1;
  rep(i, n) {
    if(a[i] == 0) {
      ans = 0;
      break;
    } else if(a[i] > (ll)1e18 / ans) {
      ans = -1;
      break;
    } else {
      ans *= a[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4020
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    string s,res;
    cin >> s;
    for(int i=0; i<s.size(); i++){
        if(i%2==0) res.push_back(s.at(i));
    }
    cout << res << endl;
}


Measured memory_bytes: 592
import numpy as np
N = int(input())
XYH = np.array([input().split() for _ in range(N)], dtype=np.int64)
x, y, h = XYH[XYH[:, 2] != 0][0].T
X, Y, H = XYH.T

for Cx in range(101):
    for Cy in range(101):
        estimated_heights = h + abs(x - Cx) + abs(y - Cy)
        if (np.clip(estimated_heights - np.abs(X - Cx) - np.abs(Y - Cy), 0, None) == H).all():
            print(Cx, Cy, estimated_heights)
            quit()


Measured memory_bytes: 12452
fun main(args : Array<String>) {
    val (N, T) = readLine()!!.split(" ").map { it.toInt() }
    val matrix = (1..(N)).map { readLine()!!.split(" ").map { it.toInt() } }

    val min = matrix.filter {
        val (c, t) = it
        t <= T
    }.minBy {
        val (c, t) = it
        c
    }

    if (min == null) {
        println("TLE")
        return
    }
    val (c, t) = min
    println(c)
}

Measured memory_bytes: 38056
// Vivek Rai
// Blazer_007

#include<bits/stdc++.h>
using namespace std;

#define fastio    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl      '\n'

typedef long long int ll;
const int hell = 1e9 + 7 ;

signed main() {

    fastio

    int a , b , c , d;
    cin >> a >> b >> c >> d;


    while(true)
    {
    	c = c - b;
    	if(c <= 0)
    	{
    		cout << "Yes";
    		return 0;
    	}
    	a = a - d;
    	if(a <= 0)
    	{
    		cout << "No";
    		return 0;
    	}
    }

    return 0;
}

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

int main(){
  int N;
  cin>>N;
  vector<int> vec(N);
  for(int i=0;i<N;i++)
    cin>>vec[i];
  sort(vec.begin(),vec.end());
  
  int x=1,s=vec[0];
  for(int i=1;i<N;i++){
    if(s<vec[i])
      x++;
    s=vec[i];
  }
  cout<<x<<endl;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN,'%d',$D);
if($D == 25){
  echo "Christmas";
}elseif ($D == 24) {
  // code...
  echo "Christmas Eve";
}elseif ($D == 23) {
  // code...
  echo "Christmas Eve Eve";
}else {
  // code...
  echo "Christmas Eve Eve Eve";
}


 ?>


Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define vsort(v) sort(v.begin(), v.end())
#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;
bool judge(int a) 
{
	if ((a >= 1) && (a <= 9)) {
    	return true;
    } else {
    	return false;
    }
}
int main()
{
	int A, B; cin >> A >> B;
  	if (judge(A) && judge(B)) {
    	cout << A * B << endl;
    } else {
    	cout << -1 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <type_traits>
#include <map>


using namespace std;


int main(int argc, const char * argv[]) {
  int n;
  cin >> n;
  vector<long long> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());

  long long prev = a[0];
  int cnt = 1;
  long long s = -1;
  long long l = -1;
  for(int i = 1; i < n; i++){
    if(prev == a[i]){
      cnt++;
    }else{
      if(cnt >= 4){
        if(l == -1){
          cout << prev * prev << endl;
          return 0;
        }else{
          s = prev;
          cout << l * prev << endl;
          return 0;
        }
      }
      if(cnt >= 2){
        if(l == -1){
          l = prev;
        }else{
          s = prev;
          cout << l * s << endl;
          return 0;
        }
      }
      cnt=1;
    }
    prev = a[i];
  }
  if(cnt >=2 && l != -1){
    cout << l * prev << endl;
    return 0;
  }
  cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Stringstring | diff Stringstring.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Stringstring.cpp && ./a.out

/*
 
 11/3/2019
 
 7:00-7:17
 
 */

int N;
string S;

//const int Inf=1e8;
void solve() {
  N=SZ(S);
  VI A(N+1,-1);
  queue<int> Q;
  REP(i,N) {
    if(i==0&&S[i]=='<') {
      Q.emplace(i),A[i]=0;
    } else if(i==N-1&&S[i]=='>') {
      Q.emplace(i+1),A[i+1]=0;
    } else if(S[i]=='>'&&S[i+1]=='<') {
       Q.emplace(i+1),A[i+1]=0;
    }
  }
  dump(SZ(Q));
  while(SZ(Q)) {
    int i=Q.front(); Q.pop();
    int a=A[i];
    if(i>0&&S[i-1]=='>') {
      SMAX(A[i-1],a+1),Q.push(i-1);
    }
    if(i<N&&S[i]=='<') {
      SMAX(A[i+1],a+1),Q.push(i+1);
    }
  }
//    dumpc(A);
  assert(count(ALL(A),-1)==0);

  LL res=accumulate(ALL(A),0LL);
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>S;
  solve();
  
  return 0;
}


Measured memory_bytes: 3740
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
 
using namespace std;
int MOD = 1000000007;

signed main(){
    int h,w;
    int a,b;
    cin >> h >> w >> a >> b;
    cout << h*w - a*w - b*h + a*b << endl;

    
    

    return 0; 
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://abc121.contest.atcoder.jp/tasks/abc121_a
// rm -r -f test;oj dl http://yahoo-procon2017-qual.contest.atcoder.jp/tasks/yahoo_procon2017_qual_c

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d%d",&a,&b);
    for(int i=1;i<=3;i++)
    {
        if(i*a*b%2)
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long LL;
int _min(int x, int y) {return x < y ? x : y;}
int _max(int x, int y) {return x > y ? x : y;}
int read() {
	int s = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
	return s * f;
}

struct node {
	int x, y;
} a[1100];
char ans[1100][41];
int n, now, D[40];

void solve(int x) {
	++now; D[now] = x;
	for(int i = 1; i <= n; i++) {
		if(abs(a[i].x) > abs(a[i].y)) {
			if(a[i].x > 0) ans[i][now] = 'R', a[i].x -= x; 
			else ans[i][now] = 'L', a[i].x += x;
		} else {
			if(a[i].y > 0) ans[i][now] = 'U', a[i].y -= x;
			else ans[i][now] = 'D', a[i].y += x;
		}
	}
}

int main() {
	n = read();
	for(int i = 1; i <= n; i++) a[i].x = read(), a[i].y = read();
	for(int i = 30; i >= 0; i--) solve(1 << i);
	if(a[1].x || a[1].y) solve(1);
	for(int i = 1; i <= n; i++) {
		if(a[i].x || a[i].y) {puts("-1"); return 0;}
	} printf("%d\n", now);
	for(int i = 1; i <= now; i++) printf("%d ", D[i]);
	printf("\n");
	for(int i = 1; i <= n; i++) printf("%s\n", ans[i] + 1);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long GCD(long long a,long long b);//関数プロトタイプ宣言。
long long LCM(long long a,long long b);//関数プロトタイプ宣言。
signed main(){
    int n;
    cin>>n;
    long long a,sum=1;
    for(int i=0;i<n;i++){
        cin>>a;
        sum=LCM(a,sum);  //このsumはユーザー定義関数のbのこと。
    }
    cout<<sum<<'\n';
    return(0);
}
long long LCM(long long a,long long b){
    return(a/GCD(a,b)*b);
}
long long GCD(long long a,long long b){  //ユーザー定義関数。
    while(b!=0){         //GCDのユ定関が先！LCMのユ定関でGCDを使ってるから！
        long long r=a%b;                
        a=b;
        b=r;
    }
    return(a);
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define reg register
#define rep(i, a, b) for (reg int i = (a), i##end = (b); i <= i##end; ++i)
#define dep(i, a, b) for (reg int i = (a), i##end = (b); i >= i##end; --i)
using namespace std;
using ll = long long;

signed main() {
	ll n,k;
	cin>>n>>k;
	ll h[n];
	rep(i, 0, n-1) {
		cin>>h[i];
	}
	sort(h, h+n);
	ll mi = h[k-1] - h[0];
	rep(i, 0, n-k) {
		mi = min(mi, h[i+k-1]-h[i]);
	}
	cout<<mi<<endl;
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  VI c = {0,6000,4000,3000,2000};
  REP(i,4){
	int t, n;
	cin >> t >> n;
	cout << c[t] * n << endl;
  }

  return 0;
}



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

using ll = long long;

// 組合せを素数で割った値を求める
const int MAX = 510000;
const ll MOD = 998244353;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k) {
  if (n < k || n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// 繰り返し自乗法(x^nをmで割った余り) O(logn)
ll power(ll x, ll n, ll m) {
  ll res = 1;
  if (n > 0) {
    res = power(x, n / 2, m);
    if (n % 2 == 0) res = (res * res) % m;
    else res = (((res * res) % m) * x) % m;
  }
  return res;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n, m, k;
  cin >> n >> m >> k;
  
  COMinit();
  
  ll ans = 0;
  for (ll i = 0; i <= k; i++) {
    ll nown = n - i;
    ll keep = COM(n - 1, i);
    //cout << keep << endl;
    keep *= (m * power(m - 1, nown - 1, MOD)) % MOD;
    keep %= MOD;
    ans += keep;
    //cout << keep << endl;
    ans %= MOD;
    //cout << ans << endl;
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 15600
#include <bits/stdc++.h>
/*cout<<setprecision(5)<<ret<<endl;で、数字部分を計5桁表示かつゼロ埋め無*/
/*cout<<fixed<<setprecision(5)<<ret<<endlで、小数部のみ5桁表示かつゼロ埋め有*/
using namespace std;

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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; }
/* [Shift+Command+b]（コンパイル）ー＞[Ctrl+Shift+`]（ターミナル起動）ー＞[./a.out] */

//////////////////
//  A
/*int main(void){
    int a,b,c;cin>>a>>b>>c;
    int d=a-b;
    if(d>c){
        cout<<"0"<<endl;
    }else{
        cout<<c-d<<endl;
    }
    return 0;
}*/
//////////////////
//  B
/*int main(void){
    int n;cin>>n;
    int cnt=0;
    for(int i=1;i<=n;i++){
        if(to_string(i).length()%2==1)cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}*/
//////////////////
//  C 
int main(void){
    int n;cin>>n;
    vector<int> v(n);
    rep(i,n){
        cin>>v[i];
        v[i]--;
    }

    for(int i=1;i<n;i++){
        if(v[i-1]>v[i]){
            v[i]++;
            if(v[i-1]>v[i]){
                cout<<"No"<<endl;
                return 0;
              }
        }
    }
    /*/check
    for(int i=1;i<n;i++){
        if(v[i-1]>v[i]){
            cout<<"No"<<endl;
            return 0;            
        }
    }*/
    cout<<"Yes"<<endl;
    return 0;
}
//////////////////
//  D
/*int main(void){

    return 0;
}*/


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


ll COM(int n,int k){
    int pres=n;
    ll pret=1LL;
    int q=2;
    rep(qqqqq,k){
        pret*=pres;
        pres--;
        while(pret%q==0&&q<=k){
            pret/=q; q++;
        }
    }
    while(q<=k){
        pret/=q; q++;
    }
    return pret;
}

int main(){
    int n; cin >> n;
    int a,b; cin >> a >> b;
    vector<ll> v(n);
    rep(i,n) cin >> v[i];
    sort(ALL(v),greater<ll>());
    int x[n]; x[0]=0;
    Rep(i,n){
        if(v[i]==v[i-1]) x[i]=x[i-1];
        else x[i]=i;
    }
    ll sum[n+1]; sum[0]=0;
    rep(i,n) sum[i+1]=sum[i]+v[i];
    long double ans=0.0;
    for(ll i=a;i<=b;i++){
        if(ans*i<=sum[i])ans=(long double)sum[i]/(long double)i;
    }
    cout << fixed << setprecision(10) << ans << endl;
    ll res=0;
    for(ll i=a;i<=b;i++){
        if(ans==(long double)sum[i]/(long double)i){
            //v[i-1]
            int d=x[i-1];
            int cnt=0;
            rep(j,n){
                if(v[i-1]==v[j]) cnt++;
            }
            //cout << cnt << " " << i << " " << i-d << endl;
            res+=COM(cnt,i-d);
            //cout << res << endl;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<climits>
#include<vector>
#include <sstream>
#include<algorithm>
#include<array>
#include<map>
 
using namespace std;
 
int main(void) {
 
	int n;
	string in;
 
	cin >> n;
 
	long long buf=0, score=0;
	map<long long, long long> mapA;
	mapA[0] = 1;
 
	for (int i = 0; i < n;++i) {
		cin >> in;
		buf += stoll(in);
		score += mapA[buf];
		mapA[buf]++;
	}
 
	cout << score;
	return 0;
 
}

Measured memory_bytes: 12800