akhauriyash/Code-Regression huggingface dataset:
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

#define DEBUG
#ifndef DEBUG
#define endl "\n"
#endif

const double PI = 3.1415926535897932384626433;
typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

void solve() {
	cins(s);
	cins(t);
	cout << t << s << endl;
}

int main() {
	cin.tie(nullptr);
	std::ios::sync_with_stdio(false);
	solve();
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P  = pair <int, int>;

#define rep(i, n)     for (int i = 0; i < (int) (n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define each(i, mp)   for (auto &i : mp)

const int INF = 1001001001;

int main()
{
  int n, x, t;
  cin >> n >> x >> t;

  int counter = 0;
  int tmp     = n;
  while (1) {
    tmp -= x;
    counter++;
    if (tmp  <= 0) {
      break;
    }
  }
  ll ans = t * counter;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  string S;
  cin>>S;
  int N=S.size();
  int ans=N;
  FOR(i,1,N){
    if(S[i]!=S[i-1]){
      ans=min(ans,max(i,N-i));
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

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

  vector<int> wc(N);
  if (S[0] == '.')wc[0] = 1;
  else wc[0] = 0;
  for(int i=1; i<N; i++) {
    if(S[i] == '.') wc[i] = wc[i-1] + 1;
    else wc[i] = wc[i-1];
  }

  int ans = N;

  for(int i=0; i<N; i++) {
    int right_white = wc[N-1] - wc[i];
    int left_black = i+1-wc[i];
    ans = min(ans, right_white + left_black);
  }
  ans = min(ans, wc[N-1]);
  ans = min(ans, N-wc[N-1]);
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1412
from itertools import combinations_with_replacement

n, m, q = map(int, input().split())
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
    a[i], b[i], c[i], d[i] = map(int, input().split())

ans = 0
for v in combinations_with_replacement(list(range(1, m + 1)), n):
    sm = 0
    for i in range(q):
        if v[b[i] - 1] - v[a[i] - 1] == c[i]:
            sm += d[i]
    ans = max(ans, sm)
print(ans)


Measured memory_bytes: 73496
#include<stdio.h>
#define N 105
#define DC -1
#define inf 1000000
#define W 0
#define B 1
int n;
int d[N];
int pi[N];
int color[N];

void initializeSingleSource(int s){
  int i;
  for(i=0;i<n;i++){
    d[i]=inf;
    pi[i]=DC;
  }
  d[s]=0;
}
void dijkstra(int hako[N][N]){
  int i,j,u,v,mincost;
  initializeSingleSource(0);
  while(1){
    mincost = inf;
    for(i=0;i<n;i++){
      if(color[i]!=B && d[i]<mincost){
	mincost=d[i];
	u=i;
      }
    }
    if(mincost==inf) break;
    color[u]=B;
    for(i=0;i<n;i++){
      if(hako[u][i]!=DC){
	v=i;
	if(color[v]!=B && d[u]+hako[u][v]<d[v]){
	  pi[v]=u;
	  d[v]=d[u]+hako[u][v];
	}
      }
    }
  }
  
}
int main(){
  int i,j,u,k,x;
  int hako[N][N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      hako[i][j]=DC;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&x);
      scanf("%d",&hako[u][x]);
	}
  }
  dijkstra(hako);
  for(i=0;i<n;i++){
    printf("%d %d",i,d[i]);
    printf("\n");
    }

  return 0;
}



Measured memory_bytes: 2108
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int N;
    string S;
    cin >> N >> S;
    vector<vector<int>> DP(N, vector<int>(N, 0));
    // 自分自身に対してlargest common substrings
    // DP初期化
    for (int j = 1; j < N; ++j)
    {
        if (S[0] == S[j])
        {
            DP[0][j] = 1;
        }
    }
    // S[i] == S[j]ならば，DP[i][j] = DP[i-1][j-1] + 1
    // 計算量はO(N^2)
    for (int i = 1; i < N; ++i)
    {
        for (int j = i + 1; j < N; ++j)
        {
            if (S[i] == S[j])
            {
                DP[i][j] = DP[i - 1][j - 1] + 1;
            }
        }
    }
    // 重複しないもののみ選ぶ O(N^2)
    int maxLen = 0;
    for (int i = 0; i < N; ++i)
    {
        for (int j = i + 1; j < N; ++j)
        {
            const int len = DP[i][j];
            if (len > maxLen && i + len <= j)
            {
                maxLen = len;
            }
        }
    }
    cout << maxLen << endl;
    return 0;
}


Measured memory_bytes: 98176
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <valarray>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>

using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
  string s;
  cin >> s;
  int b = 0, w = 0;
  for (int i = 0; i < s.size(); ++i)
  {
    if (i % 2 == 0)
    {
      if (s[i] == '0')
        b++;
    }
    else
    {
      if (s[i] == '1')
        b++;
    }
  }
  for (int i = 0; i < s.size(); ++i)
  {
    if (i % 2 == 1)
    {
      if (s[i] == '0')
        w++;
    }
    else
    {
      if (s[i] == '1')
        w++;
    }
  }

  cout << min(b, w) << endl;

  return 0;
}


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

int main() {
  int n;
  cin >> n;
  int a[n], b[n];
  vector<int> diff(n);
  long long a_sum = 0, b_sum = 0;
  int i;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    a_sum += a[i];
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
    b_sum += b[i];
    diff[i] = a[i] - b[i];
  }
  if (a_sum < b_sum) {
    cout << -1 << endl;
    return 0;
  }

  sort(diff.begin(), diff.end());

  long long minus = 0, puls = 0;
  int result = 0;
  for (i = 0; i < n; i++) {
    if (diff[i] >= 0) {
      break;
    }
    minus += diff[i];
    result++;
  }
  minus = fabs(minus);
  for (i = n - 1; i >= 0; i--) {
    if (minus <= puls) {
      break;
    }
    puls += diff[i];
    result++;
  }
  for (i = 0; i < n; i++) {
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 200010;

int n;
lint K, a[MAX];

bool check(lint mid){
    lint cnt = 0;
    rep(i, n-1){
        if(a[i] == 0) cnt += mid >= 0 ? n-(i+1) : 0LL;
        else if(a[i] > 0 && a[i]*a[i] <= mid){
            lint tmp = upper_bound(a+i+1, a+n, div_floor(mid, a[i])) - a;
            //printf("%d %lld\n", i, tmp);
            cnt += tmp - (i+1);
        }
        else if(a[i] < 0){
            lint tmp = lower_bound(a+i+1, a+n, div_ceil(mid, a[i])) - a;
            //printf("%d %lld\n", i, tmp);
            cnt += n - tmp;
        }
        //printf("%lld\n", cnt);
    }
    //printf("%lld\n", cnt);
    return cnt >= K;
}

void solve(){
    scanf("%d%lld", &n, &K);
    rep(i, n) scanf("%lld", &a[i]);
    sort(a, a+n);
    lint low = -INF, high = INF;
    while(high - low > 1){
        lint mid = (high + low) / 2;
        (check(mid) ? high : low) = mid;
    }
    //return high;
    printf("%lld\n", high);
    //check(0);
    //for(int i=-10; i<=10; ++i) cout << check(i) << " ";
    //check(6);
}

lint stupid(){
    vector<int> v;
    rep(i, n-1)For(j, i+1, n) v.push_back(a[i] * a[j]);
    sort(v.begin(), v.end());
    return v[K-1];
}

int main(){
    /*mt19937 mt((unsigned)time(nullptr));
    uniform_int_distribution<> dn(2, 10);
    uniform_int_distribution<> da(-10, 10);
    while(true){
        n = dn(mt);
        uniform_int_distribution<> dk(1, n*(n-1)/2);
        K = dk(mt);
        rep(i, n) a[i] = da(mt);
        if(solve() != stupid()){
            printf("%d %lld\n", n, K);
            rep(i, n) printf("%lld ", a[i]);
            break;
        }
    }*/
    solve();
}

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


int main(){
  string s;
  cin >> s;
  if(s == "Sunny")cout << "Cloudy" << endl;
  else if(s == "Cloudy")cout << "Rainy" << endl;
  else cout << "Sunny" << endl;
  return 0;
}

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

int main()
{
	int n;
	cin>>n;
	while(n--)
	{
		int ball[11];
		bool flag = true;
		for(int i = 1;i <= 10;i++)
		{
			cin>>ball[i];
		}
		int left = -1,right = -1;
		for(int i = 1;i <= 10;i++)
		{
			if(ball[i] > left)
		    {
		    	left = ball[i];
		    	continue;
			}
			if(ball[i] > right)
			{
				right = ball[i];
				continue;
			}
			flag = false;
			break;
		}
		if(flag == true)
		{
			cout<<"YES"<<endl;
		}
		else
		{
			cout<<"NO"<<endl;
		}
	}
}


Measured memory_bytes: 3060
using System;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int a = input[0], b = input[1], h = input[2], m = input[3];
            double aRad = Math.PI * (h + m / 60.0) / 6.0;
            double bRad = Math.PI * m / 30.0;
            (double x, double y) ap = (a * Math.Sin(aRad), a * Math.Cos(aRad));
            (double x, double y) bp = (b * Math.Sin(bRad), b * Math.Cos(bRad));
            Console.WriteLine(Math.Sqrt((ap.x - bp.x) * (ap.x - bp.x) + (ap.y - bp.y) * (ap.y - bp.y)));
        }
    }
}

Measured memory_bytes: 28772
#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
const int N = 35;
const int M = 1e4;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0); 

int main(){
	double r;
	cin >> r;
	printf("%.16f",2*PI*r);
	return 0;
}

Measured memory_bytes: 3772
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
typedef long long int LL;
const int INF=1e9+7;
vector<pair<LL,LL> > v1;
int main(){
	int n;
	cin>>n;
	long long int a=INF,b=0,c=INF,d=0;
	int i,j,k;
	long long int e,f;
	long long int s1,s2;
	for(i=0;i<n;i++){
		cin>>e>>f;
		if(e>f)swap(e,f);
		if(a>e)a=e;//min
		if(b<f)b=f;//max
		if(c>f)c=f;//large.min
		if(d<e)d=e;//small.max
		v1.push_back(make_pair(e,f));
	}
	s2=(b-c)*(d-a);
	s1=b-a;
	sort(v1.begin(),v1.end());
	for(i=0,e=d-a;i<n-1;i++){
		d=max(d,v1[i].second);
		a=min(v1[i+1].first,c);
		if(e>d-a)e=d-a;
	}
	s1*=e;
	if(s1>s2)s1=s2;
	cout<<s1<<endl;
	return 0;
}
	


Measured memory_bytes: 6512
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  lint N,K;
  cin>>N>>K;
  lint P[N],C[N];
  REP(i,N){
    cin>>P[i];
    P[i]--;
  }
  REP(i,N)cin>>C[i];
  lint ans=-1e18;
  REP(i,N){
    int p=i;
    lint k=K;
    lint temp=0;
    REP(j,k){
      p=P[p];
      temp+=C[p];
      if(p==i){
        int c=max(0LL,k/(j+1)-2);
        temp+=temp*c;
        k-=(j+1)*c;
        cerr<<i<<" "<<j<<" "<<k<<" "<<c<<endl;
      }
      ans=max(ans,temp);
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3628
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 n=read::<f32>();
    println!("{}",2_f32.powf(n.log(2.).floor()))
}


Measured memory_bytes: 4604
main = print =<< solve <$> getLineAsInt

getLineAsInt :: IO Int
getLineAsInt = read <$> getLine

solve :: Int -> Int
solve x =
    let (div500, mod500) = divMod x 500
        div5 = mod500 `div` 5
    in div500 * 1000 + div5 * 5

Measured memory_bytes: 508
import fractions

A,B,C,D = map(int,input().split())

gcd = fractions.gcd(C,D)
lcm = int(C*D/gcd)

ans_A = int((A-1) - (A-1)//C - (A-1)//D + (A-1)//lcm)
ans_B = int(B - B//C - B//D + B//lcm)
print(ans_B - ans_A)


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

using namespace std;

#define ll long long

void solve() {
	char a, b;
	cin >> a >> b;
	if (a == b){
		cout << "=\n";
	} else if (a > b) {
		cout << ">\n";
	} else {
		cout << "<\n";
	}
}

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

	int t = 1, i = 1;
	//cin >> t;
	while(t--) {
		//cout << "Case #" << i << ": ";
		solve();
		//i++;
	}
	return 0;
}



Measured memory_bytes: 3572
H,W,K = map(int,input().split())
dp = []
for i in range(H+1):
  L = [0]*W
  dp.append(L)
fb = [1,1]
for i in range(W-2):
  fb.append(fb[i]+fb[i+1])
dp[0][0] = 1
if W != 1:
  for i in range(1,H+1):
    for j in range(W):
      if 1 <= j <= W-2:
        dp[i][j] = dp[i-1][j-1]*fb[j-1]*fb[W-j-1]+dp[i-1][j]*fb[j]*fb[W-j-1]+dp[i-1][j+1]*fb[j]*fb[W-j-2]
      elif j == 0:
        dp[i][j] = dp[i-1][j]*fb[W-1]+dp[i-1][j+1]*fb[W-2]
      else:
        dp[i][j] = dp[i-1][j]*fb[W-1]+dp[i-1][j-1]*fb[W-2]
else:
  dp[H][0] = 1
print(dp[H][K-1]%(10**9+7))

Measured memory_bytes: 3064
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int x1 = sc.nextInt();
    	int y1 = sc.nextInt();
    	int x2 = sc.nextInt();
    	int y2 = sc.nextInt();
    	int x3 = x2 - (y2 - y1);
    	int y3 = y2 + (x2 - x1);
    	int x4 = x3 - (x2 - x1);
    	int y4 = y3 - (y2 - y1);
    	System.out.println(x3 + " " + y3 + " " + x4 + " " + y4);
    }
}

Measured memory_bytes: 23636
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String[] arr = new String[n];
        char last = ' ';
        char first = ' ';
        boolean f = true;

        for (int i = 0; i < n; i++) {
            String str = sc.next();
            first = str.charAt(0);
            if (i != 0 && (first != last || Arrays.asList(arr).contains(str))) {
                f = false;
                break;
            }
            last = str.charAt(str.length() - 1);
            arr[i] = str;

        }
        if (f) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23124
var cnt;

function insertionSort(A, n, g) {
	for (var i = g; i < n; i++) {
		var v = A[i];
		var j = i - g;
		while (j >=0 && A[j] > v) {
			A[j + g] = A[j];
			j = j - g;
			cnt++;
		}
		A[j + g] = v;
	}
}

function shellSort(A, n) {
	cnt = 0;

	var G = [];
	for (var i = 1; Math.pow(2, i) - 1 <= n; i++) {
		G.push(Math.pow(2, i) - 1);
	}
	G.reverse();
	var m = G.length;

	for (var i = 0; i < m; i++) {
		insertionSort(A, n, G[i]);
	}

	console.log(m);
	console.log(G.join(' '));
	console.log(cnt);
	for (var i = 0; i < n; i++) {
		console.log(A[i]);
	}
}

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
var n = lines.shift();

lines = lines.map(function(i) {return i - 0;});

shellSort(lines, n);

Measured memory_bytes: 138424
// tested by Hightail - https://github.com/dj3500/hightail
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;
import std.datetime, std.bigint;

immutable inf = 2L * 10L^^16;

int n;
long[] a;

void main() {
    scan(n);
    a = readln.split.to!(long[]);

    bool check(long k) {
        auto b = a.dup;
        b[] += k;

        long cnt;

        foreach (i ; 0 .. n) {
            if (b[i] - (n - 1) <= 0) continue;
            cnt += (b[i] - (n - 1) + n) / (n + 1);

            if (cnt > k) {
                return false;
            }
        }

        return true;
    }

    auto ans = new long[](n);
    long btm, top;

    foreach (i ; 0 .. n) {
        btm = -1;
        top = inf;

        while (top - btm > 1) {
            long mid = btm + (top - btm) / 2;

            if (check(n * mid + i)) {
                top = mid;
            }
            else {
                btm = mid;
            }
        }
        ans[i] = n * top + i;
    }

    debug {
        writeln(ans);
    }

    writeln(ans.reduce!min);
}




void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
#define INF 1000000001
#define ll long long
using namespace std;



int main()
{
  ll A, B;
  cin >> A >> B;
  if (B % A == 0)
  {
    cout << A + B << endl;
  }
  else
  {
    cout << B - A << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int animals;
    int legs;
    cin >> animals;
    cin >> legs;
    if (legs >= 2 * animals && legs <= 4 * animals)
    {
        if (legs % 2 == 0)
        {
            cout << "Yes";
            return 0;
        }
        else
        {
            cout << "No";
            return 0;
        }
    }
    else
    {
        cout << "No";
    }
}

Measured memory_bytes: 3600
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    string S;
    scan(S);

    auto N = S.length;
    bool ok = true;

    foreach (i ; 0 .. N) {
        if (i % 2 == 0) {
            if (S[i] == 'L') ok = false;
        }
        else {
            if (S[i] == 'R') ok = false;
        }
    }

    writeln(ok ? "Yes" : "No");
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  int n = 0;
  fscanf(stdin, "%d", &n);
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    fscanf(stdin, "%d", &v[i]);
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = n - 1; j > i; --j) {
      if (v[j] < v[j - 1]) {
        swap(v[j], v[j - 1]);
        ++ans;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    if (i) { fprintf(stdout, " "); }
    fprintf(stdout, "%d", v[i]);
  }
  fprintf(stdout, "\n%d\n", ans);
  return 0;
}

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

using namespace std;


long int power100(int D) {
    long int result = 1;
    for (int i = 1; i <= D; i++) {
        result *= 100;
    }
    return result;
}

int main(void) {
    int D, N;
    cin >> D >> N;
    long int result;
    if (N != 100) {
        result = power100(D) * N;
    } else {
        result = power100(D) * (N + 1);
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
typedef long long ll;
using namespace std;

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

const long long INF = 1LL << 60;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
ll n, m;
ll ma = 1000000000 + 7;
vector<vector<ll>> uv;
vector<bool> used;
int main() {
	char in;char res;
	cin >> in;
	if (in == 'A') {
		res = 'T';
	}
	else if (in == 'T') {
		res = 'A';
	}
	else if (in == 'C') {
		res = 'G';
	}
	else if (in == 'G') {
		res = 'C';
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=25;
lint f[N][2][2];//[left need one][right has one]
int num[N],del,ns;
inline lint work(int d){
	if(d==1)return 0;
	memset(f,0,sizeof(f));
	f[0][0][0]=1;
	int l=0,r=d-1,t=0;
	for(;l<r;l++,r--,t++){
		for(int a=0;a<2;a++){
			for(int b=0;b<2;b++){
				lint F=f[t][a][b];
				if(F==0)continue;
				for(int lnum=0;lnum<=9;lnum++){
					for(int rnum=l==0;rnum<=9;rnum++){
						int tmpl=lnum+num[l]+b;
						int tmpr=rnum+num[r]-a*10;
						int na=0,nb=tmpl/10;
						if(tmpr<0){
							tmpr+=na=1;
						}
						if(tmpr<0||tmpr>9)continue;
						tmpl%=10;
						if(rnum!=tmpl)continue;
						if(lnum!=tmpr){
							tmpr+=1-na;
							na=1;
						}
						if(lnum!=tmpr)continue;
						f[t+1][na][nb]+=F;
					}
				}
			}
		}
	}
	if(l>r)return f[t][0][0]+f[t][1][1];
	return (num[l]==0)*10*f[t][0][0]+(num[l]==9)*10*f[t][1][1];
}
inline lint Main(){
	del=ni;
	for(int &i=ns=0,t=del;t;num[i]=t%10,t/=10,i++);
	lint ans=0;
	for(int i=ns;i<=20;i++){
		ans+=work(i);
	}
	return ans;
}
int main(){
	printf("%lld\n",Main());
	return 0;
}

Measured memory_bytes: 256
N, k = [ int(i) for i in input().split()]
cPos = [ int(i) for i in input().split()]
time = 10**10
for i in range(N-k+1):
    if time > min( abs(cPos[i])+ abs(cPos[i]- cPos[i+k-1]), abs(cPos[i+k-1])+ abs(cPos[i]- cPos[i+k-1])):
        time = min( abs(cPos[i])+ abs(cPos[i]- cPos[i+k-1]), abs(cPos[i+k-1])+ abs(cPos[i]- cPos[i+k-1]))
print(time)


Measured memory_bytes: 14252
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll MOD=(ll)1e9+7;
//}}}

ll modpow(ll a, ll b){
  if(b == 0) return 1;
  if(b % 2){
    return a * modpow(a, b - 1) % MOD;
  }else{
    ll half = b / 2;
    half = modpow(a, half);
    return half * half % MOD;
  }
}

ll modfact(ll n){
  ll res = 1;
  rep(i, n) res = res * (i + 1) % MOD;
  return res;
}

ll modcomb(ll n, ll r){
  ll res = 1;
  r = min(r, n - r);
  rep(i, r) res = res * (n - i) % MOD;
  return res * modpow(modfact(r), MOD - 2) % MOD;
}

ll modh(ll n, ll r){
  return modcomb(n + r - 1, r - 1);
}

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> v;
  ll ans = 1;
  rep(n, 2, 100000){
    if(M == 1) break;
    int num = 0;
    while(M % n == 0){
      M /= n;
      num++;
    }
    if(num){
      ans *= modh(num, N);
      ans %= MOD;
    }
  }
  if(M != 1){
    ans *= N;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
T=list(map(int,input().split()))
M=int(input())
total=sum(T)
ans=[0 for i in range(M)]
for i in range(M):
    p,x=map(int,input().split())
    ans[i]=total-T[p-1]+x

for an in ans:
    print(an)

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

using namespace std;

inline int read()
{
    char ch=getchar(); int f=1,x=0;
    while (ch<'0' || ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
    while (ch>='0' && ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
    return f*x;
}

int n;
char s[100005];

signed main()
{
    n=read();
    scanf("%s",s+1);
    int ans=1;
    for (int i=2;i<=n;i++) ans+=s[i]!=s[i-1];
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 384
def warshall_floyd(dist_matrix)
	dist = dist_matrix
	n = dist.size
	raise "dist_matrix is not square" if dist.any?{|row| row.size != n}

	next_dist = (1..n).map{ Array.new(n) }	
	(0..n-1).each{|k|
		dist_k = dist[k]
		(0..n-1).each{|i|
			dist_i = dist[i]
			next_dist_i = next_dist[i]
			(0..n-1).each{|j|
				x = dist_i[j]
				y = dist_i[k] + dist_k[j]
				next_dist_i[j] = (x < y ? x : y)
			}
		}
		dist = next_dist
	}
	dist
end

loop do
	n = gets.to_i
	break if n == 0

	node_idx = {}
	out_neighbour = Hash.new(0)
	in_neighbour = Hash.new(0)

	cross_points = (1..n).map { gets.chomp.split(?-) }
	puts node_num = cross_points.flatten.uniq.size
	graph = (1..node_num).map { [Float::INFINITY] * node_num }
	
	cross_points.each do |s, t|
		i = (node_idx[s] ||= node_idx.size)
		j = (node_idx[t] ||= node_idx.size)
		out_neighbour[i] |= (1 << j)
		in_neighbour[j] |= (1 << i)
		graph[i][j] = 1
	end

	(0..node_num-1).each do |i|
		neighbours = (0..node_num-1).select{|x| out_neighbour[i][x] == 1}
		neighbours.combination(2) do |j, k|
			next if in_neighbour[j] & out_neighbour[k] > 0
			next if in_neighbour[k] & out_neighbour[j] > 0
			graph[j][k] = 2
			graph[k][j] = 2
		end
		neighbours = (0..node_num-1).select{|x| in_neighbour[i][x] == 1}
		neighbours.combination(2) do |j, k|
			next if in_neighbour[j] & out_neighbour[k] > 0
			next if in_neighbour[k] & out_neighbour[j] > 0
			graph[j][k] = 2
			graph[k][j] = 2
		end
	end

	dist = warshall_floyd(graph)
    
	m = gets.to_i
	m.times do
		s, t = gets.chomp.split(?-)
		i = node_idx[s]
		j = node_idx[t]
		if !i || !j
			puts 'NO'
			next
		end
		
		d = dist[i][j]
		if d == Float::INFINITY || d.even?
			puts 'NO'
		else
			puts 'YES'
		end
	end
end

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

lli data[100100];
lli cnt[100100];
lli even[100100];

signed main(){

    lli n,m;
    cin>>n>>m;

    vector<lli> v(n);
    REP(i,0,n){
        cin>>v[i];
        data[v[i]]++;
        cnt[v[i]%m]++;
    }

    REP(i,0,100010){
        even[i%m]+=data[i]/2;
    }

    lli ans=0;
    ans += cnt[0]/2;
    for(lli i=1;i<(m+1)/2;i++){
        lli a=i,b=m-i;
        if(cnt[a] > cnt[b])swap(a,b);
        ans += cnt[a];
        cnt[b]-=cnt[a];
        ans += min(cnt[b]/2,even[b]);
    }
    if(m%2==0){
        ans+=cnt[m/2]/2;
    }
    cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
int main(){
    ll N;
    cin>>N;
    
    map<string,ll> st;
    REP(i,N){
        string s;
        cin>>s;
        VECi(ll,num,26,0);
        REP(j,10){
            num[ll(s[j])-97]++;
        }
        string t;
        REP(j,26){
            t+=char(num[j]+48);
        }
        if(st.count(t)==0)st[t]=1;else st[t]++;
    }
    
    ll sum=0;
    for(const auto t:st){
        ll n = t.second;
        if(n>=2){
            sum+=n*(n-1)/2;
        }
    }
    cout<<sum;
    
    
    
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 14336
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}

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

    ll A, B, C, D;
    cin >> A >> B >> C >> D ;

    ll E = lcm(C,D);

    ll C_from=0, C_to=0;
    ll D_from=0, D_to=0;
    ll E_from=0, E_to=0;

    C_from = (A/C);
    if(A%C != 0) C_from ++;
    C_to = (B/C);

    D_from = ((A/D));
    if(A%D != 0) D_from ++;
    D_to = (B/D);

    E_from = ((A/E));
    if(A%E != 0) E_from ++;
    E_to = (B/E);

    cerr << "--------" << endl;
    cerr << C_from << "::" << C_to << endl;
    cerr << D_from << "::" << D_to << endl;
    cerr << E_from << "::" << E_to << endl;
    cerr << "--------" << endl;

    ll num = (C_to - C_from +1) + (D_to - D_from +1) -(E_to-E_from +1);
    cout << (B-A + 1) - num << endl;

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


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
int main(void){
int n,x;
int sum=0;
int sumn=0;
int low=999999;
int m[105];
scanf("%d %d",&n,&x);

for(int count=0;count<n;count++){
    scanf("%d",&m[count]);
    sum=sum+m[count];
    if(low>=m[count]){low=m[count];}
}
sumn=n;
x=x-sum;
sumn=sumn+(x/low);
printf("%d",sumn);
}

Measured memory_bytes: 128
N, K = map(int, input().split())
X = list(map(int, input().split()))

ub = 10 ** 9 + 7
lb = 0
while ub - lb > 1:
    mid = (ub + lb) // 2

    res = 0
    for v in X:
        res += (v - 1) // mid

    if res <= K:
        ub = mid
    else:
        lb = mid

if K == 0:
    print(max(X))
else:
    print(ub)


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long MOD = 998244353;

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

    int x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;

    return 0;
}

Measured memory_bytes: 256
num = int(input())
board = list(map(int, input().split()))
evener = 0
ope = True

while True:
    for i in range(num):
        if board[i]%2 == 0:
            board[i] = board[i]/2
        else:
            ope = False
            break
    if ope == True:
        evener+=1
    else:
        break

print(evener)

Measured memory_bytes: 3060
N = int(input())

t, x, y = 0, 0, 0

def judge(t0, x0, y0, t1, x1, y1):
    t = t1- t0
    x = abs(x1- x0)
    y = abs(y1- y0)

    if t < x+y:
        return False
    if t%2 == (x+y)%2:
        return True
    else:
        return False


result = True
for i in range(N):
    t1, x1, y1 = list(map(int, input().split(" ")))
    result = result and judge(t, x, y, t1, x1 ,y1)
    t, x, y = t1, x1, y1

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



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  char c;

  cin >> c ;

  if(c=='a') cout << "vowel" << endl;
 
  else if(c=='i') cout << "vowel" << endl;
 
  else if(c=='u') cout << "vowel" << endl;
 
  else if(c=='e') cout << "vowel" << endl;

  else if(c=='o') cout << "vowel" << endl;
 
  else cout << "consonant" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a*b >= c * d) {
		cout << a * b << endl;
	}
	else {
		cout << c * d << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A,*B;
  int C[VMAX+1];
  int n,i,j;
  scanf("%d",&n);
  A=malloc(sizeof(short)*n+1);
  B=malloc(sizeof(short)*n+1);

  for(i=0;i<=VMAX;i++) C[i] = 0;
  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];
  for(j=0;j<=n;j++){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  for(i=1;i<=n;i++){
    if(i>1) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  return 0;
}



Measured memory_bytes: 9636
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ull unsigned long long
#define ld long double

#define mod 1000000007
#define EULER 2.7182818284
#define INF 1000000000

#define pb push_back
#define ins insert
#define IT iterator
#define PQ priority_queue

#define fi first
#define se second
#define maxe max_element
#define mine min_element
#define er erase
#define lb lower_bound
#define ub upper_bound

#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define pi pair<int,int>
#define pll pair<ll,ll>


#define mem(v,i) memset(v,i,sizeof(v)) // v is array. To set all elements to 0 or -1 only. mem(arr,0);


#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORd(i,a,b) for(int i=(a);i>=(b);i--)
#define FORl(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORN(i,n) for(int i=(0);i<(n);i++)
#define FORR(i,n) for(int i=(n);i>=0;i--)
#define bs bitset
#define bpc(a) __builtin_popcount(a)

ll max(ll a,ll b)
{
    if(a>b)return a;return b;
}
ll min(ll a,ll b)
{
    if(a<b)return a;return b;
}

ll mypow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    return gcd(b,a%b);
}
//..............................!!!!!!Get ready to fight!!!!!!............................



int main()
{
    fast
    string s;
  int n,k;
  cin>>k;
  cin>>s;
  
    n=s.length();
    string ans;
    int i;
    for( i=0;i<min(k,n);i++)
      {
        ans.push_back(s[i]);
      }
      if(n>k)
      {
        for(i=0;i<3;i++)
        ans.push_back('.');
      }
      for(i=0;i<ans.length();i++)
      cout<<ans[i];
      cout<<"\n";
      return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

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

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

int main(){
    ll n;
    cin >> n;
    vector<ll> t(n);
    rep(i, n)cin >> t.at(i);
    ll ans = t.at(0);
    REP(i, n-1)ans = lcm(ans, t.at(i));
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define forn(i, n) for(int i = 0; i < int(n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi; typedef vector<pair<int, int>> vpi; typedef vector<vi> vvi;
typedef vector<ll> vll; typedef vector<pair<ll, ll>> vpll; typedef vector<vll> vvll;


int32_t main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    cout.precision(10); cout << fixed;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
#endif

    
    int a,b;
    cin>>a>>b;
    if(a>b) cout<<"safe"<<endl;
    else cout<<"unsafe"<<endl;

    
    return 0;
}


Measured memory_bytes: 3612
MOD = 10 ** 9 + 7


class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    __radd__ = __add__

    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )

    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )


n, a, b = map(int, input().split())
ans = pow(2, n, MOD) - 1
product = ModInt(1)
div = ModInt(1)
for i in range(b + 1):
    product *= (n - i)
    div *= i + 1
    if i == a - 1 or i == b - 1:
        ans -= product / div
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <ctype.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

int main() {
	int N;
	cin >> N;
	int trueans = 0;
	vector<int>V(N);
	rep(i, N) {
		cin >> V[i];
	}
	vector<int>C(N);
	rep(i, N) {
		cin >> C[i];
	}

	vector<int>ans(N);
	for (int i = 0; i < N; i++) {
		if (V[i] > C[i]) {
			ans[i]= V[i] - C[i];
		}
	}
	rep(i, N) {
		trueans += ans[i];
	}
	cout << trueans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
 
static class MainClass {
 
  public struct City{
    public long num;
    public long year;
    public int ID;
    public City(long n, long y, int i){
      num = n;
      year = y;
      ID = i;
    }
 
  }
 
  public static void Main (string[] args) {
    var N = long.Parse(Console.ReadLine());
    var list = new List<long>(){N};
    var ans = 1;
 
    while(true){
      ans++;
      N = N % 2 == 0 ? N / 2 : 3 * N + 1;
      if(list.Contains(N)){
        Console.WriteLine(ans);
        return;
      }
      list.Add(N);
    }
  }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MOD 1000000007
#define MOD2 998244353
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<=b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
#define T int
#define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
auto clk=clock();
 
ll mexp(ll a, ll b, ll m){
    ll ans=1;
    a%=m;
    while(b){
        if(b&1) ans=ans*a%m;
        b>>=1;
        a=a*a%m;
    }
    return ans;
}

const int N = 100005;
int a[N];

int main(){
    IOS
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int n, x;
    cin >> n >> x;
    FOR(i,1,n){
        cin >> a[i];
    }
    ll c = 0;
    FOR(i,2,n){
        if(a[i] + a[i-1] > x){
            int d = (a[i] + a[i-1]) - x;
            if(a[i] >= d){
                a[i] -= d;
            }
            else{
                a[i-1] -= d - a[i];
                a[i] = 0;
            }
            c += d;
        }
    }
    cout << c;

    cerr<<endl<<endl<<"Time: "<<fixed<<setprecision(12)<<(long double)(clock()-clk)/CLOCKS_PER_SEC<<" ms"<<endl<<endl;
 
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <map>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    map<int, int> mp;
    mp[a]++;
    mp[b]++;
    mp[c]++;
 
    cout << mp.size() << endl;
	return 0;
}

Measured memory_bytes: 3144
from collections import deque

N, L = map( int, input().split() )
T = []
V = []
for i in range( N ):
  t, v = map( int, input().split() )
  T.append( t )
  V.append( v )

dq = deque()
ct, cv = 0.0, 0.0
for i in range( N ):
  while cv + V[ i ] > L:
    ft, fv = dq[ 0 ]
    take = min( cv + V[ i ] - L, fv )
    ct, cv = ( ct * cv - ft * take ) / ( cv - take ), cv - take
    if take == fv:
      dq.popleft()
    else:
      dq[ 0 ] = [ ft, fv - take ]
  ct, cv = ( ct * cv + T[ i ] * V[ i ] ) / L, L
  print( "%.7f" % ct )
  while len( dq ):
    bt, bv = dq[ len( dq ) - 1 ]
    if bt < T[ i ]: break
    T[ i ], V[ i ] = ( T[ i ] * V[ i ] + bt * bv ) / ( V[ i ] + bv ), V[ i ] + bv
    dq.pop()
  dq.append( [ T[ i ], V[ i ] ] )


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

int main() {
	int N;
	string S;
	bool X[100000] = {}, check = false;
	cin >> N >> S;
	for (int h = 0; h < 4; h++) {
		if (h % 2 == 0) X[0] = true;
		else X[0] = false;
		if (h < 2) X[1] = true;
		else X[1] = false;
		for (int i = 1; i < N - 1; i++) {
			if (S[i] == 'o') {
				if (X[i]) X[i + 1] = X[i - 1];
				else X[i + 1] = !X[i - 1];
			}
			else {
				if (X[i]) X[i + 1] = !X[i - 1];
				else X[i + 1] = X[i - 1];
			}
		}
		if (S[0] == 'o' && S[N - 1] == 'o') {
			if (X[0] == (X[1] == X[N - 1]) && X[N - 1] == (X[0] == X[N - 2])) {
				check = true;
				break;
			}
		}
		else if (S[0] == 'o' && S[N - 1] == 'x') {
			if (X[0] == (X[1] == X[N - 1]) && X[N - 1] == (X[0] != X[N - 2])) {
				check = true;
				break;
			}
		}
		else if (S[0] == 'x' && S[N - 1] == 'o') {
			if (X[0] == (X[1] != X[N - 1]) && X[N - 1] == (X[0] == X[N - 2])) {
				check = true;
				break;
			}
		}
		else {
			if (X[0] == (X[1] != X[N - 1]) && X[N - 1] == (X[0] != X[N - 2])) {
				check = true;
				break;
			}
		}
	}
	if (check) {
		for (int i = 0; i < N; i++) {
			if (X[i]) cout << 'S';
			else cout << 'W';
		}
	}
	else cout << -1;
}

Measured memory_bytes: 640
#include <algorithm>
#include <deque>
#include <iostream>
#include <vector>

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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

LL H;

LL rec(LL h) {
    if (h == 1) {
        return 1;
    }
    return 1 + 2 * rec(h / 2);
}

int main() {
    cin >> H;
    cout << rec(H) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 998244353;

int n;
LL ans;
char s[200005];
vector<int> v;

void solve()
{
	int cnt0 = 0;
	rep(i, v.size()) {
		if(v[i]) ans += cnt0;
		else cnt0 ++;
	}
	v.clear();
}

int main()
{
	scanf("%s", &s);
	n = strlen(s);
	
	rep(i, n) {
		if(s[i] == 'A') v.push_back(0);
		else if(s[i] == 'B' && i < n - 1 && s[i + 1] == 'C') {
			v.push_back(1);
			i ++;
		} else solve();
	}
	solve();
	
	printf("%lld\n", ans);
	return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if ((A + B) > (C + D)) {
    cout << "Left" << endl;
  }
  
  else if ((A + B) < (C + D)) {
    cout << "Right" << endl;
  }
  
  else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256