akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Extentions;

class IO
{
    int idx;
    string[] input = In.ReadToEnd().Split(new[] { " ", "\n", "\r" },
        StringSplitOptions.RemoveEmptyEntries);

    T Get<T>(Func<string, T> parser) => parser(input[idx++]);

    public string S => Get(s => s);
    public char C => Get(char.Parse);
    public int I => Get(int.Parse);
    public long L => Get(long.Parse);
    public double F => Get(double.Parse);
    public decimal D => Get(decimal.Parse);
    public BigInteger B => Get(BigInteger.Parse);

    T[] Gets<T>(int n, Func<string, T> parser)
        => input.Skip((idx += n) - n).Take(n).Select(parser).ToArray();

    public string[] Ss(int n) => Gets(n, s => s);
    public char[] Cs(int n) => Gets(n, char.Parse);
    public int[] Is(int n) => Gets(n, int.Parse);
    public long[] Ls(int n) => Gets(n, long.Parse);
    public double[] Fs(int n) => Gets(n, double.Parse);
    public decimal[] Ds(int n) => Gets(n, decimal.Parse);
    public BigInteger[] Bs(int n) => Gets(n, BigInteger.Parse);

    public void Write<T>(params T[] xs) => WriteLine(string.Join(" ", xs));
    public void Write(params object[] xs) => WriteLine(string.Join(" ", xs));
}

#region Library

static class Extentions
{
}

#endregion

static class Program
{
    public static void Main()
    {
        var sw = new StreamWriter(OpenStandardOutput()) { NewLine = "\n" };
#if DEBUG
        sw.AutoFlush = true;
#else
        sw.AutoFlush = false;
#endif
        SetOut(sw);
        Solve(new IO());
        Out.Flush();
    }

    static void Solve(IO io)
    {
        var a = io.S;
        var b = io.S;
        var c = io.S;

        io.Write(a.Last() == b.First() && b.Last() == c.First() ? "YES" : "NO");
    }
}

Measured memory_bytes: 13268
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;
using PP = std::pair<P, ll>;

constexpr ll INF = 1ll<<60;

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 S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

template<typename T>
struct BIT {
  int n;
  std::vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};

ll N, Q;
ll c[500010];
std::vector<PP> vs;
ll last[500010];
BIT<ll> bit(500010);
ll ans[500010];

int main()
{
  std::cin >> N >> Q;

  rep( i, N )
    std::cin >> c[i], --c[i];

  rep( i, Q ) {
    ll l, r;
    std::cin >> l >> r;
    --l; --r;

    vs.emplace_back( P( r, -l ), i );
  }

  std::sort( all(vs) );

  rep( i, N+5 )
    last[i] = -1;

  rep( i, vs[0].first.first+1 )
    last[c[i]] = i;
  
  rep( i, N ) if( last[i] != -1 )
    bit.add( last[i], 1 );

  ll R = vs[0].first.first;

  rep( q, Q ) {
    ll l = -vs[q].first.second, r = vs[q].first.first;

    if( R < r ) {
      ++R;

      while( R <= r ) {
        if( last[c[R]] != -1 )
          bit.add( last[c[R]], -1 );
        bit.add( R, 1 );
        last[c[R]] = R;
        ++R;
      }

      --R;
    }

    
    ans[vs[q].second] = bit.sum( l, r+1 );
  }

  rep( q, Q )
    std::cout << ans[q] << std::endl;

  return 0;
}

Measured memory_bytes: 31288
#include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	int H,W;
	while(true){
		scanf("%d %d",&H,&W);
		if(H == 0 && W == 0) break;
		for(int i = 0; i < W; i++) printf("#");
		printf("\n");

		for(int i = 1; i < H-1; i++){
			printf("#");
			for(int j = 1; j < W-1; j++) printf(".");
			printf("#\n");
		}

		if(H > 1){
			for(int i = 0; i < W; i++) printf("#");
			printf("\n");
		}
		printf("\n");
	}
}



Measured memory_bytes: 2628
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,sum=0,x;
    long int no,n;
    cin>>no;
    n=no;
    while(n>0){
    a=n%10;
    n=n/10;
    sum=sum+a;
    }
    x=no%sum;
    if(x == 0)      { cout<<"Yes"<<endl; }
    else            { cout<<"No"<<endl;  }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int N = 2e5 + 5;

int n, k;
int a[N];

bool chk(int x) {
    ll res = 0;
    for (int i = 0; i < n; i++) {
        res += (a[i] + x - 1) / x - 1;
        if (res > k) return false;
    }
    return true;
}

void run() {
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int l = 1, r = INF, mid;
    while (l < r) {
        mid = (l + r) >> 1;
        if (chk(mid)) {
            r = mid;
        } else {
            l = mid + 1;
        }
    }
    cout << r << '\n';
}

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


Measured memory_bytes: 4368
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const int INF = 1e9;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  bool t = true;
  while(true) {
    if (t) {
      c -= b;
      if (c <= 0) {
        cout << "Yes" << endl;
        return 0;
      }
      t = false;
    } else {
      a -= d;
      if (a <= 0) {
        cout << "No" << endl;
        return 0;
      }
      t = true;
    }
  }
}


Measured memory_bytes: 3624
import sys
import math


# \n
def input():
    return sys.stdin.readline().rstrip()


def main():
    mod = 10 ** 9 + 7

    N,K=map(int,input().split())

    C =[0] *(K+1)

    for k in range(K,1,-1):
        num = K//k
        count = pow(num,N,mod)
        while num>1:
            count -= C[num*k]
            count %=mod
            num-=1
        C[k] =count
    ans =0
    for i in range(K+1):
        ans += i*C[i]
        ans %=mod
    ans += pow(K,N,mod) -sum(C)

    print(ans%mod)



if __name__ == "__main__":
    main()


Measured memory_bytes: 68500
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;


int main(){
  int a,b;
  cin >> a >> b;
  int ans;
  if(a >= 13) ans = b;
  else if(a >= 6) ans = b/2;
  else ans = 0;
  printf("%d\n", ans);
  return 0;
}


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

int lcm(int a, int b){
  int i;
  int m = min(a, b);
  for(i=m; i>0; i--){
    if(a%i==0 && b%i==0){
      break;
    }
  }
  return i;
}

int main()
{
  int a, b, k;
  cin >> a >> b >> k;

  int l = lcm(a, b);
  int count=0 , i;
  for(i=l; i>0; i--){
    if(l%i==0){
      count++;
      if(count==k){
        cout << i << endl;
        break;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int S, h, m, s;

int main()
{
	cin >> S;

	h = S / 3600;
 
	m = (S % 3600) / 60;

	s = (S % 3600) % 60;

	cout << h << ":" << m << ":" << s << endl;
}

Measured memory_bytes: 1164
use std::io;

fn main() {
    let mut S = String::new();
    io::stdin().read_line(&mut S);
    let n :usize = S.trim().parse().unwrap();
    let r :usize = n % 1000;
    if r == 0 {
        println!("0");
    }else {
        println!("{}",1000-r);
    }
}

Measured memory_bytes: 2136
#include <stdio.h>

int main(void){
    char str[1050]={0};
    char ch[1050]={0};
    char mei[30]={0};
    char pl[1050]={0};
    int i,j,k,l,m,n,o;

    scanf("%s",str);
    scanf("%d",&n);
   
    for(i=0;i<7;i++){
        ch[i]=str[i];
    }

    j=0;
    o=0;
    k=l=0;

    for(i=0;i<n;i++){
        scanf("%s",mei);
        scanf("%d %d",&k,&l);
    
        if(mei[2]=='p'){
            scanf("%s",pl);
            for(m=0;m<l-k+1;m++){
	            str[m+k]=pl[m];	
            }
        }

        else if(mei[2]=='v'){      
            for(m=0;m<strlen(str);m++){
	            ch[m]=str[m];
            }
      
            for(m=0;m<l-k+1;m++){
	            str[k+m]=ch[l-m];
            }
    
        }

        else if(mei[0]=='p'){   
            for(m=k;m<=l;m++){
	            printf("%c",str[m]);
            }
            printf("\n");
        }
    }
    return 0;
}



Measured memory_bytes: 2112
use std::cmp;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        p: usize,
        q: usize,
        r: usize
    };
    let max = cmp::max(p, cmp::max(q, r));
    println!("{}", p + q + r - max);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define rint register int 
#define ll long long
#define mk make_pair
#define pa pair<int,int>
#define pb push_back
using namespace std;
struct node{int to,next;};
int n,rt1,rt2;
struct Tree{
	node e[410100];
	int h[210010],tot,dep[201000],fa[200100][21];
	inline void add(int from,int to){e[++tot].next=h[from];e[tot].to=to;h[from]=tot;}
	inline void Build() {
		for(rint i=1;i<n;++i){
			int a,b;cin>>a>>b;
			add(a,b);add(b,a);
		}
	}
	inline void DFS(int now,int ffa) {
		dep[now]=dep[ffa]+1;fa[now][0]=ffa;
		for(rint i=h[now];i;i=e[i].next) {
			int to=e[i].to;if(to==ffa) continue;
			DFS(to,now);
		}
	}
	inline void Build_St(){
		for(rint i=1;i<=20;++i) for(rint j=1;j<=n;++j) fa[j][i]=fa[fa[j][i-1]][i-1];
	}
	inline int Lca(int x,int y){
		if(x==y) return x;
		if(dep[x]>dep[y]) swap(x,y);
		for(rint i=20;i>=0;--i) if(dep[fa[y][i]]>=dep[x]) y=fa[y][i];
		if(x==y) return x;
		for(rint i=20;i>=0;--i) if(fa[x][i]!=fa[y][i]) x=fa[x][i],y=fa[y][i];
		return fa[x][0];
	}
	inline int Get_dis(int x,int y) {
		int lca=Lca(x,y);
		return dep[x]-dep[lca]+dep[y]-dep[lca];
	}
}A,B;
int ans=0;
inline void Solve(int now,int ffa){
	ans=max(ans,B.dep[now]-1);
	for(rint i=A.h[now];i;i=A.e[i].next) {
		int to=A.e[i].to;if(to==ffa) continue;
		A.dep[to]=A.dep[now]+1;
		if(A.dep[to]<B.dep[to]) {
			Solve(to,now);
		}
		if(B.Get_dis(to,now)>=3) {
			cout<<"-1\n";exit(0);
		}
	}
}
int main() {
	cin>>n>>rt1>>rt2;
	A.Build();
	B.Build();
	B.DFS(rt2,0);
	B.Build_St();
	A.dep[rt1]=1;
	Solve(rt1,0);
	cout<<ans*2<<endl;
	return 0;
} 

Measured memory_bytes: 40876
import java.util.*;

/**
 * Created by Surya on 9/24/2017.
 */
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt(), b = sc.nextInt();
        int val = 1;
        for (int i = 0; i < a; i++) {
            if (val >= b) {
                val += b;
            } else {
                val *= 2;
            }
        }
        System.out.println(val);
    }
  
}

Measured memory_bytes: 23892
import java.util.*;

public class Main{

	public static void main(String[] args) {

	Scanner s = new Scanner(System.in);

		int m = s.nextInt();
			int arr[] = new int[m - 1];
		int ans[] = new int[m];
			for (int i = 0; i < m - 1; i++) {
				arr[i] = s.nextInt();
			ans[arr[i] - 1]++;
			}

		for (int i = 0; i < ans.length; i++) {
			System.out.println(ans[i]);
			}

		}
}




Measured memory_bytes: 61532
#include <string>
#include <iostream>
#include <utility>
#include <algorithm>

using namespace std;

#define inf 100100100
#define INF 100100100

int main(){

    string s;

    cin >> s;

    cout << s[0] + to_string(s.length() - 2) + s[s.length() - 1] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
//const ll mod=1e9+7;
const ll mod=998244353;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

ll Pow(ll n,ll p){
	ll r=1;
	for(;p>0;p>>=1){
		if(p&1) r=(r*n)%mod;
		n=(n*n)%mod;
	}
	return r;
}

const int M=1000005;
ll F[M];

void Init(){
	F[0]=1;
	for(int i=1;i<M;i++) F[i]=F[i-1]*i%mod;
}

ll Div(ll n,ll m){
	return n*Pow(m,mod-2)%mod;
}

ll nCk(ll n,ll k){
	if(n<0) return 1;
	return Div(F[n],F[n-k]*F[k]%mod);
}

int n,m;
string A,B,C,D;

bool Check(string s){
	int N=s.size();
	return s==string(N,'0');
}

vl ff(){
	vl a(m+1);
	a[0]++;
	if(Check(A)){
		for(int i=0;i<m&&C[i]=='0'&&D[i]=='0';i++) a[i+1]++;
	}
	else{
		int S=0,t=0;
		for(int i=0;i<n;i++) S+=A[i]-'0';
		for(int i=0;i<m;i++){
			t+=C[i]-'0'+D[i]-'0';
			a[i+1]=nCk(S+t-1,t);
		}
	}
	swap(A,B);
	reverse(C.begin(),C.end());
	reverse(D.begin(),D.end());
	return a;
}

ll f(){
	ll res=0,t=0;
	vl a=ff(),b=ff();
	for(int i=0;i<m;i++) if(C[i]=='1'||D[i]=='1'){
		t=(C[i]-'0'+D[i]-'0')*(a[i]+t)%mod;
		(res+=t*b[m-1-i])%=mod;
	}
	swap(A,C);swap(B,D);swap(n,m);
	return res;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>m>>A>>B>>C>>D;
	Init();
	if(Check(A)&&Check(B)&&Check(C)&&Check(D)) cout<<1<<endl;
	else cout<<(f()+f())%mod<<endl;
}

Measured memory_bytes: 10320
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int maxn=200003;
int x[1001];
void primefactor(int n){

  bool flag=true;
  for( int i=2LL ;i*i<=n;i++){
    while(n%i==0){
      x[i]++;
      n/=i;
      flag=false;
    }
  }
  if(n!=1)x[n]++;
}


int main(){
  ll n;
  cin>>n;
  if(n==1){
    cout<<1<<endl;
    return 0;
  }
  else{
    fill(x,x+1001,0);
    ll res=1;
    for(int i=2;i<=n;i++){
      primefactor(i);
    }
    for(int i=2;i<=n;i++){
      res=((ll)(x[i]+1)*res)%(ll)(1000000000+7);
    }
    cout<<res<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	unsigned long int a, b, c, d, e;
	unsigned long int i, j;
	unsigned long int sum = 0;

	scanf("%ld", &a);
	scanf("%ld", &b);
	for (i = b; i <= (a + 1); i++) {
		c = 0;
		d = 0;

		c = (0 + i - 1) * i / 2;
		d = (2 * a - i + 1) * i / 2;
	
		sum = sum + d - c + 1;
	}

	sum = sum % (1000000000 + 7);

	printf("%ld", sum);

	return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

main(){
    INCANT;
    int n, k, x, y, tmp, res = 0;
    string s;
    in(n, k);
    rep(i, k + 1, n + 1){
        x = i - k;
        y = (n - k) / i;
        res += x * y;
        res += min(x, n - y * i - k + 1);
    }
    if(k == 0){
        res -= n;
    }
    print(res);
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
/*#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
                      
using namespace std;
                      
template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}
                      
template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}

#define int long long
#define ghost signed
#define left left228
#define right right228
#define prev prev228
#define list list228

const int N = 100 * 1000 + 228;

int n, ptr = 1;
bool is[N];
vector< pair<int, int> > e;

int build(int pos) {
	int sz = pos;
	int root = ptr++;
	--pos;
	while (pos && !is[pos]) --pos;
	if (pos) {
		e.push_back(make_pair(root, build(pos)));
		sz -= (pos + 1);
		for (int i = 0; i < sz; ++i) e.push_back(make_pair(root, ptr++));
	}
	return root;
}


ghost main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	n = (int)s.size();
	for (int i = 1; i <= n; ++i) {
		char c = s[i - 1];
		if (c == '0') is[i] = 0;
		else is[i] = 1;
	}
	if (is[n]) {
		cout << -1 << '\n';
		return 0;
	}
	if (!is[1]) {
		cout << -1 << '\n';
		return 0;
	}
	for (int i = 1; i < n; ++i) {
		if (is[i] != is[n - i]) {
			cout << -1 << endl;
			return 0;
		}
	}
	build(n);
	for (auto p : e) cout << p.first << " " << p.second << endl;
	return 0;
} // kek ;





Measured memory_bytes: 8128
import collections
import math
 
def comb(n, r):
    if n < 2:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
 
 
N = int(input())
L = input().split(" ")
 
c = collections.Counter(L)
 
d = {}
tmp_total = 0 
 
memo1 = {}
L2 = {}
 
for i in c:
    if c[i] not in memo1.keys():
        tmp = comb(c[i], 2)
        memo1[c[i]] = tmp
        tmp_total += tmp
    else:
        tmp_total += memo1[c[i]]
        
total = tmp_total
 
for i in L:
    ans = total - memo1[c[i]] + memo1[c[i]]*(c[i]-2)//c[i]
    print(ans)

Measured memory_bytes: 26788
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
  int n;
  cin >> n;
  int t,a;
  cin >> t >> a;
  vector<int>h(n);
  for(int i = 0; i < n; i++){
    cin >> h.at(i);
  }
  double tem = 0;
  double num = 999999;
  int ans = 0;
  for(int i = 0; i < n; i++){
    tem = t - h.at(i) * 0.006;
    if(abs(tem - a) < num) ans = i + 1;
    num = min(num, abs(tem - a));
  }
  cout << ans << endl;
}

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

using namespace std;


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

int main()
{
	long a, b, d;

	while(cin >> a >> b){
		d = gcd(a,b);
		cout << d << " " << (a*b)/d << endl; 
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>

using namespace std;

int n, m, k;
typedef long long ll;

int main() 
{
    ll a, b, c;
    scanf("%lld%lld%lld", &a, &b, &c);
    if(c - a - b >= 0 && 4 * a * b < (c - a - b) * (c - a - b))printf("Yes\n");
    else printf("No\n");


    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n;
    cin >> n;
    map<string, ll> mp;
    while(n--) {
        string s;
        cin >> s;
        mp[s]++;
    }
    string s[] = {"AC", "WA", "TLE", "RE"};
    for(ll i = 0; i < 4; i++) {
        cout << s[i] << " x " << mp[s[i]] << endl;
    }
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

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

int main() {
	char word;
	cin >> word;

	if (word == 'a' || word == 'i' || word == 'u' || word == 'e' || word == 'o') {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

signed main(){
    int N,M;
    cin>>N>>M;
    vector<int> v[100010];

    for(int i=0;i<M;i++){
        int A,B;
        cin>>A>>B;
        v[A].push_back(B);
        v[B].push_back(A);
    }

    int ans[100010]={0};
    int c=1;
    ans[1]=-1;
    queue<int> q;
    q.push(1);
    while(!q.empty()){
        int n=q.front();
        q.pop();
        for(int i=0;i<v[n].size();i++){
            int t=v[n][i];
            if(ans[t]==0){
                ans[t]=n;
                c++;
                q.push(t);
            }
        }
    }

    if(c==N){
        cout<<"Yes"<<endl;
        for(int i=2;i<=N;i++){
            cout<<ans[i]<<endl;
        }
    }
    else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 12600
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int n,m,q,f[100005][12],t[100005][12];
vector<int> v[100005];
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;++i){
        int x,y;
        scanf("%d%d",&x,&y);
        v[x].pb(y),v[y].pb(x);
    }
    scanf("%d",&q);
    for(int i=1;i<=q;++i){
        int x,y,z;
        scanf("%d%d%d",&x,&y,&z);
        f[x][y]=z,t[x][y]=i;
    }
    for(int k=10;k;--k){
        for(int i=1;i<=n;++i){
            if(t[i][k-1]<t[i][k])t[i][k-1]=t[i][k],f[i][k-1]=f[i][k];
            for(int j=0;j<v[i].size();++j){
                int o=v[i][j];
                if(t[o][k-1]<t[i][k])t[o][k-1]=t[i][k],f[o][k-1]=f[i][k];
            }
        }
    }
    for(int i=1;i<=n;++i)printf("%d\n",f[i][0]);
    //system("pause");
    return 0;
}


Measured memory_bytes: 15864
let input = require('fs').readFileSync('/dev/stdin', 'utf8');

let y = input.split(" ").map(x => Number(x));
function sort(array){
  for(let i = 0; i < array.length - 1; i++){
    if(array[i] > array[i+1]){
      for(let j = 0; j < array.length -1; j++){
        if(array[j] > array[j+1]){
          let prev = array[j];
          array[j] = array[j+1];
          array[j+1] = prev;
        }
        i = -1;
      }
    }
  }
  return array.join(" ");
}

console.log(sort(y));



Measured memory_bytes: 15120
import java.util.*;

public class Main {
	static final int r = 1000000000 + 7;

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), d = sc.nextInt();
		String an[] = {"Yes", "No"};
		int numa = (c + b - 1) / b;
		int numb = (a + d - 1) / d;
		int ans = 1;
		if(numa <= numb)ans = 0;
		sc.close();
		System.out.println(an[ans]);
	}
}


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

#define rng(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define pb push_back
#define eb emplace_back
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed

int main() {
  int a, b, ans = 0;
  string s, t;
  cin >> s >> t;
  //vector<int> v(n), c(n);
  rep(i, s.size()) if(s.at(i) != t.at(i)) ans++;
  cout << ans << endl;
}


Measured memory_bytes: 3920
s = input()
n = len(s)
def palin(sub):
    if sub == sub[::-1]:
        return True
    return False
x = ((n-1)//2) - 1
y =  ((n+3)//2) - 1
if palin(s) and palin(s[:x+1]) and palin(s[y:]):
    print("Yes")
else:
    print("No")

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

int main(){
  int n, m, ans;
  int a, b, c;
string str;

  cin>>str;

for(int i = 0; i< 5; i++)cout<<str[i];
cout<<" ";
for(int i = 6; i < 13; i++)cout<<str[i];
cout<<" ";
for(int i = 14; i< 19; i++)cout<<str[i];
cout<<endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] ab1 = new int[n+1];
    int[] ab2 = new int[n+1];
    for(int i = 0; i<m; i++){
      int a = sc.nextInt();
      int b = sc.nextInt();
      if(a == 1){
        ab1[b] = 1;
      }else if(b == n){
        ab2[a] = 1;
      }
    }

    for(int i = 1; i<n+1; i++){
      if((ab1[i] == 1)&&(ab2[i] == 1)){
        System.out.println("POSSIBLE");
        return;
      }
    }
    System.out.println("IMPOSSIBLE");
  }
}


Measured memory_bytes: 96224
#import<bits/stdc++.h>
using namespace std;
typedef struct{int k;string m;int p;int v;}R;
int a,b,c,i,j,m,n,w[100005];
char z[100005];R e[105];
int Q(R a,R b){return a.m<b.m||a.m==b.m&&a.p>b.p;}
int O(R a,R b){return a.k<b.k;}
main()
{
	for(cin>>n;i<n;e[i].k=i++)cin>>e[i].m>>e[i].p;
	sort(e,e+n,Q);
	for(i=0;i<n;i++)cout<<e[i].k+1<<endl;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
xsum=0;ysum=0;mod=10**9+7
for i,x in enumerate(X): xsum+=x*(i-(n-1-i))
for i,y in enumerate(Y): ysum+=y*(i-(m-1-i))
print(xsum * ysum % mod)

Measured memory_bytes: 18576
#include<string>
#include<iostream>
using namespace std;
string s1 ,s2 ,s;
int len1 ,len2 ,len ,max1 , k ,sum;
int main()
{
    cin >> s1>>s2 ;
    len1 = s1.size();
    len2 = s2.size() ;
    
    if( len1 < len2) {
    	len = len1;
    	len1 = len2 ;
    	len2 = len1 ;
    	
    	s = s1;
    	s1 =s2 ;
    	s2 = s1;
	}
    k = len1 - len2 ;
    
	   for(int i = 0 ; i <= k ; i ++)
	   {  
	        sum =0 ;
	   	   for(int j = 0 ; j < len2 ; j++)
	   	   {
	   	   	    if(s2[j] == s1[j+i])
	   	   	    sum++;
		   }
		   max1 = max(sum ,max1);	  
	  }	
    

	
    cout << len2 -max1 ;
	return 0 ;
} 

Measured memory_bytes: 3144
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <functional>
#include <iomanip>

#include <set>

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

// #define rep(i,n) for(int i=0;i<(n);++i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _fromto2(i,n) for(int i=0;i<=(n);++i)
#define _fromto3(i,a,b) for(int i=(a);i<=(b);++i)
#define fromto(...) _overload3(__VA_ARGS__,_fromto3,_fromto2,)(__VA_ARGS__)

#define rrep(i,n) for(int i=(n);i>=0;--i)
const int MOD = 1e9+7;
const int INF = 1e9;
const int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

// debug
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(int i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
#else
#define debug(...) 42
#endif




const int MAX_N = 1e5+5;

int parent[MAX_N], size[MAX_N];
int root(int x) {
  if (parent[x] == x)
    return x;
  return parent[x] = root(parent[x]);
}
int get_size(int x) {
  return size[root(x)];
}
void unite(int x, int y) {
  if (root(x) == root(y))
    return;
  x = root(x);
  y = root(y);
  parent[x] = y;
  size[y] += size[x];
  return;
}
bool same(int x, int y) {
  return root(x) == root(y);
}

int main() {
  int N, M, K; cin >> N >> M >> K;

  int h[N];
  rep(i, N) {
    parent[i] = i;
    size[i] = 1;
    h[i] = 0;
  }

  rep(i, M) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    unite(a, b);
    ++h[a]; ++h[b];
  }
  int ans[N];
  rep(i, N) {
    ans[i] = get_size(i) - 1 - h[i];
  }

  rep(i, K) {
    int c, d;
    cin >> c >> d;
    --c, --d;
    if (same(c, d)) {
      --ans[c];
      --ans[d];
    }
  }
  rep(i, N) {
    if (i)
      cout << " ";
    cout << ans[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 2560
program abc145e
type data
  integer::A,B
end type
integer N,T
type(data),allocatable::menu(:)
integer,allocatable::DP1(:,:),DP2(:,:)
integer ans
read*,N,T
allocate(DP1(0:N+1,0:T),DP2(0:N+1,0:T))
allocate(menu(N))
do i=1,N
    read*,menu(i)%A,menu(i)%B
end do

DP1=0;DP2=0
do i = 1,N
	do j = 0,T
    	if (j >= menu(i)%A)then
        	dp1(i+1,j) = max(dp1(i,J-menu(i)%A) +menu(i)%B, dp1(i,j))
        else
            dp1(i+1,j) = dp1(i,j)
        endif
    end do
end do
do i = N,1,-1
	do j = 0,T
    	if (j >= menu(i)%A)then
        	dp2(i-1,j) = max(dp2(i,J-menu(i)%A) +menu(i)%B, dp2(i,j))
        else
            dp2(i-1,j) = dp2(i,j)
        endif
    end do
end do
ans=0
do j=1,N
  do i=0,T-1
    ans=max(ans,DP1(j,i)+DP2(j,T-1-i)+menu(j)%B)
  end do
end do
print"(i0)",ans
end program


Measured memory_bytes: 70656
// https://atcoder.jp/contests/abc127/tasks/abc127_e

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

//------------------------------------------------------------------------------
ll mod_pow(ll x, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) {
      res = res * x % mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

ll mod_inverse(ll x, ll mod) {
  return mod_pow(x, mod - 2, mod);
}

ll mod_comb(ll n, ll k, ll mod) {
  if (n < 0 || k < 0 || n < k) return 0;
  ll a = 1, b = 1;
  while(k > 0) {
    a = a * n-- % mod;
    b = b * k-- % mod;
  }
  return a * mod_inverse(b, mod) % mod;
}

//------------------------------------------------------------------------------
const int M_MAX = 2*1e5;
const int MOD = 1e9+7;

ll N, M, K;

void solve() {
  ll y = 1;
  y = y * (N - 1) % MOD;
  y = y * N % MOD;
  y = y * (N + 1) % MOD;
  y = y * M % MOD;
  y = y * M % MOD;

  ll x = 1;
  x = x * (M - 1) % MOD;
  x = x * M % MOD;
  x = x * (M + 1) % MOD;
  x = x * N % MOD;
  x = x * N % MOD;

  ll ans = (x + y) % MOD;
  ans = ans * mod_inverse(6, MOD) % MOD;
  ans = ans * mod_comb(N * M - 2, K - 2, MOD) % MOD;
  printf("%lld\n", ans);
}

void input() {
  scanf("%lld%lld%lld", &N, &M, &K);
}

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


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

typedef long long int ll;

int N, D;
vector<string> names;
//
//ll to_int(string s){
//    const int MOD = 1000000009;
//    ll res = 0;
//    for(auto c: s){
//        res = (res*26 + (c - 'a')) % MOD;
//    }
//    return res;
//}

void solve(){
    sort(names.begin(), names.end());
    
    map<string, set<int>> mp;
    for(int ni=0; ni<N; ni++){
        string name = names[ni];
        int L = name.size();
        
        //delete
        for(int i=0; i<L; i++){
            string t = name;
            t.erase(t.begin()+i);
            mp[t].insert(ni);
        }
        //insert
        for(int i=0; i<=L; i++){
            for(char c='a'; c<='z'; c++){
                string t = name;
                t.insert(t.begin()+i, c);
                mp[t].insert(ni);
            }
        }
        //replace
        for(int i=0; i<L; i++){
            for(char c='a'; c<='z'; c++){
                string t = name;
                t[i] = c;
                mp[t].insert(ni);
            }
        }
        //swap
        for(int i=0; i<L-1; i++){
            string t = name;
            swap(t[i], t[i+1]);
            mp[t].insert(ni);
        }
    }
    if(D == 1){
        int cnt = 0;
        for(int ni=0; ni<N; ni++){
            string name = names[ni];
            if(mp[name].size() > 1){
                for(auto v: mp[name]){
                    if(v <= ni) continue;
                    cout << name << "," << names[v] << endl;
                    cnt++;
                }
            }
        }
        cout << cnt << endl;
    }
    if(D == 2){
        set<pair<int, int>> s;
        for(auto v: mp) if(v.second.size() > 1){
            vector<int> vec;
            for(auto vv: v.second) vec.push_back(vv);
            for(int i=0; i<vec.size(); i++){
                for(int j=i+1; j<vec.size(); j++){
                    s.insert(make_pair(vec[i], vec[j]));
                }
            }
        }
        for(auto v: s){
            cout << names[v.first] << "," << names[v.second] << endl;
        }
        cout << s.size() << endl;
    }

}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    while(cin>>N, N){
        cin >> D;
        names.resize(N);
        for(auto &v: names) cin >> v;
        solve();
    }
    
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int price = i * 1.08;
    if (price == n) {
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <utility>
#include <map>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <fstream>
using namespace std;
#define pi acos(-1)
#define N 1000000007
#define ll long long
#define ull unsigned long long
#define mem(a) memset(a,0,sizeof(a))

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


Measured memory_bytes: 3596
#最大公約数
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

#最小公倍数
def lcm(a,b):
  return a*b//gcd(a,b)

#全ての最小公倍数を求めればいい
n=int(input())
ans=1
for i in range(n):
  ans=lcm(ans,int(input()))
print(ans)

  





Measured memory_bytes: 9148
#include <iostream>
#include <cstdio>
using namespace std;
int A[50];
int n, q, k;
bool dfs(int i, int sum)
{
	if (i == n) {
		return sum == k;
	}
	
	if (dfs(i + 1, sum)) {
		return true;
	}
	if (dfs(i+1,  sum + A[i])) {
		return true;
	}
	return false;
}

int main(int argc, char *argv[]) {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &A[i]);
	}
	
	scanf("%d", &q);
	for (int i = 0;i < q;i++) {
		scanf("%d", &k);
		int sum = 0;
		if (dfs(0, sum)) {
			printf("yes\n");
		}else {
			printf("no\n");
		}
	}
	
	return 0;
}


Measured memory_bytes: 3140
#include <iostream>

using namespace std;

int main()
{
    int h[750],w[750],ih,iw,i,c;
    c=0;
    while(1){
        cin >> h[c] >> w[c];
        if(h[c]==0,w[c]==0)break;
        c++;
    }
    for(i=0;i<c;i++){
        for(ih=0;ih<h[i];ih++){

            for(iw=0;iw<w[i];iw++){

                if(ih==h[i]-1||ih==0){
                   cout << "#";
                }
                else{
                    if(iw==w[i]-1||iw==0){
                        cout << "#";
                    }
                    else{
                        cout << ".";
                    }
                }
            }
            cout << endl;
        }cout << endl;
    }
}



Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
/*
000001000000000
00001100000000
0001010000000
001111000000
01000100000 01000101000
1100110000 0000001100 1100111100
010101000 000001010 010100010
11111100
0000010
000011
00010
0011
010
11
0

000000000001000
00000000001100
0000000001010
000000001111
00000001000
0000001100
000001010
00001111
0001000
001100
01010
1111
000
00
0


000001000001000
00001100001100
0001010001010
001111001111
01000101000
1100111100
010100010
11110011
0001010
001111
01000
1100
010
11
0



 */
public class Main {
	
	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		fs.next();
		char[] line=fs.next().toCharArray();
		int[] diffs=new int[line.length-1];
		for (int i=0; i+1<line.length; i++) diffs[i]=Math.abs(line[i+1]-line[i]);
		int[] counts=new int[3];
		for (int i:diffs) counts[i]++;
		if (counts[1]!=0) {
			for (int i=0; i<diffs.length; i++) diffs[i]=diffs[i]%2;
		}
		while (diffs.length!=1) {
			diffs=getSmaller(diffs);
		}
		System.out.println(diffs[0]);
	}
	
	static int[] getSmaller(int[] line) {
//		System.out.println("Line: "+Arrays.toString(line));
		int n=line.length;
		int pow=Integer.highestOneBit(n-1);
		int newN=n-pow;
		int[] res=new int[newN];
		for (int i=0; i<newN; i++) {
			res[i]=Math.abs(line[i]-line[i+pow]);
		}
		return res;
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
	
}


Measured memory_bytes: 44508
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		double b = sc.nextDouble();
		int x = (int) (b * 100 + 0.5);

		System.out.println((long) (a * x) / 100);
	}

}


Measured memory_bytes: 37316
#include <iostream>
#include <algorithm>

int main(){
    std::string s;
    std::cin >> s;

    int i;
    for(i = 97; i < 124; ++i){
        if(std::string::npos == s.find((char)i)){
            break;
        }
    }

    if(123 == i){
        std::cout << "None" << std::endl;
    }else{
        std::cout << (char)i << std::endl;
    }

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
using namespace std;
int main(void){
  int i;
  string s;
  cin >> s;
  for (i=0;i<4;i++) cout << s[i];
  cout << ' ';
  for (;i<12;i++) cout << s[i];
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
a,b,c = map(int,input().split())
ans = 0
for i in range(10000001):
  if a%2 == 1 or b%2 == 1 or c%2 == 1:
    break
  if i == 1000000:
    print(-1)
    exit()
  m = a
  n = b
  l = c
  a = (b+c)//2 
  b = (c+m)//2 
  c = (m+n)//2
  ans += 1
print(ans)

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >>n;
  char s[n], t[n];
  cin >> s >> t;
  for(int i=0;i<n;i++){
    cout << s[i];
    cout << t[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define mod 1000000007;

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int k;
    string s;
    cin>>k;
    cin>>s;
    if(s.size() <= k)
        cout<<s;
    else
    {
        string ss;
        for(int i=0;i<k;i++)
            ss+=s[i];
        ss+="...";
        cout<<ss;
    }

    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int k;
    cin>>k;
    int a,b;
    cin>>a>>b;
    int f=0;
    for(int i=a;i<=b;i++)
    {
        if(i%k==0)
        {
            f=1;
            break;
        }
    }
    if(f==1)
    cout<<"OK"<<endl;
    else
    cout<<"NG"<<endl;
    
    
return 0;
}

Measured memory_bytes: 3624