akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int N = S.length();
		int cnt_0=0;
		int cnt_1=0;
		for (int i=0;i<N;i++) {
			if(S.charAt(i)=='0') {
				cnt_0++;
			}else{
				cnt_1++;
			}
		}
		System.out.println(Math.min(cnt_0,cnt_1)*2);
	}
}

Measured memory_bytes: 25044
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";
/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, E, F, K,W, H, P, Q, R, X, Y;
  ll ans;
  string S, T;
  cin >> S;
  rep(i, S.length()-1){
    if (S[i]==S[i+1]) {
      cout<<"Bad"<<endl;
      return 0;
    }
  }
  cout << "Good" << endl;
  
  
  
}


Measured memory_bytes: 256
/*Author
   SaJiB */

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


#define pb   push_back
#define fi   first
#define se   second
#define all(x)    x.begin(),x.end()

#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

typedef long long int ll;
typedef unsigned long long int ull;
const double pi = 2.0*acos(0.0);

ll big_mod(ll BASE, ll POWER, ll MOD){

    if(POWER == 0) return 1;
    else if(POWER %2 ==0){
        ll RESULT = big_mod(BASE,POWER/2,MOD);
        return ((RESULT % MOD)*(RESULT % MOD))% MOD;
    }
    else return ((BASE % MOD)*(big_mod(BASE,POWER-1,MOD)% MOD))% MOD;

}

int main(){

char c[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'} ;

ll n;
cin>>n;

string s ="";
while(n>26){
    ll d = n / 26;
    ll p = n%26;

    //cout<<p<<" ";
    if(p==0) {
        s+=c[25];
        d--;
    }
    if(p!=0) s+=c[p-1];
    n = d;
}
//cout<<n<<endl;
if(n!=0)cout<<c[n-1];
reverse(all(s));
cout<<s;



}



Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{	
	
	string xx;
	cin>>xx;
	if(xx=="RRR")cout<<3<<endl;
	else if(xx=="RRS"|| xx=="SRR")cout<<2<<endl;
	else if(xx=="SSS")cout<<0<<endl;
	else cout<<1<<endl;
}

Measured memory_bytes: 3580
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
long long x, a,b;
int main()
{
	scanf("%lld%lld%lld",&x,&a,&b);
	if(b >= x + a + 1) printf("dangerous\n");
	else{
		if(a >= b) printf("delicious\n");
		else printf("safe\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_temp>
using smaller_queue = priority_queue<Q_temp, vector<Q_temp>, greater<Q_temp>>;

const ll MOD = (ll)(1e9 + 7);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

template <typename T>
class SegmentTree
{
private:
  using Fn = function<T(T, T)>;
  int N;
  vector<T> dat;
  const T unit; //単位元 a * e = a
  Fn func;

public:
  SegmentTree(int n_, Fn func_, T unit_) : func(func_), unit(unit_)
  {
    N = 1;
    while (N < n_)
      N *= 2;
    dat.assign(2 * N - 1, unit);
  }

  void update(int k, T a)
  {
    k += N - 1;
    dat[k] = a;
    while (k > 0)
    {
      k = (k - 1) / 2;
      dat[k] = func(dat[k * 2 + 1], dat[k * 2 + 2]); //
    }
  }

  T query(int a, int b, int k = 0, int l = 0, int r = -1)
  {
    if (r < 0)
      r = N;
    if (r <= a || b <= l)
      return unit;
    if (a <= l && r <= b)
      return dat[k];
    else
    {
      T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
      T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
      return func(vl, vr);
    }
  }
};

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

  int n, k;
  cin >> n >> k;
  SegmentTree<ld> sg(n, [](ld a, ld b) { return a + b; }, 0.0);
  rep(i, n)
  {
    ld p;
    cin >> p;
    sg.update(i, (p + 1.0) / 2.0);
  }

  int i = 0;
  ld Max = 0;
  while (i + k <= n)
  {
    Max = max(Max, sg.query(i, i + k));
    i++;
  }
  cout << Max << endl;
  return 0;
}


Measured memory_bytes: 8576
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
double D[80]; int d;

double pop_n(){
  return (D[--d]);}
void push_n(double a) {
  D[d]=a; d++;
}

int main() {
  char inbuf[100];
  while (fgets(inbuf, 81, stdin)!=NULL) {
    char *tp = strtok(inbuf, " \n");
    while (tp != NULL) {
      double a,b;
      if ((tp[0] == '+') && (tp[1]==0)) {
        b = pop_n(); a = pop_n();
        push_n(a+b);
      }
      else if (tp[0] == '*') {
        b = pop_n(); a = pop_n();
        push_n(a*b);
      }
      else if ((tp[0] == '-') && (tp[1]==0)) {
        b = pop_n(); a = pop_n();
        push_n(a-b);
      }
      else if (tp[0] == '/') {
        b = pop_n(); a = pop_n();
        push_n(a/b);
      }
      else {
        push_n(atof(tp));
      }
      tp = strtok(NULL, " \n");
    }
    printf("%.6lf\n",pop_n());
  }
  return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repd(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)

int gcd(int x, int y)
{
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

int main()
{

  ll N;
  cin >> N;

  ll A[N];
  rep(i, N) cin >> A[i];

  ll n_gcd = A[0];
  rep(i, N)
  {
    n_gcd = gcd(n_gcd, A[i]);
  }

  cout << n_gcd;
}


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

#define ll long long

string s;

ll dfs(int n, ll nw, ll tmp){
  ll ans = nw + tmp * 10 + (s[n] - '0');
  if(s.size() - 1 == n){
    return ans;
  }
  return (ll)(dfs(n + 1, ans, 0) + dfs(n + 1, nw, ans - nw)); 
}

int main()
{
  cin >> s;
  cout << (ll)(dfs(0 ,0 ,0)) << endl;
}

Measured memory_bytes: 256
Scanf.scanf "%d %d" (fun n m ->
    let xyz = Array.init n (fun _ -> Scanf.scanf " %d %d %d" (fun x y z -> x, y, z)) in
    let (@|) a b = max a b in

    let f a b c =
        Array.sort (fun (x0, y0, z0) (x1, y1, z1) ->
            compare (x0 * a + y0 * b + z0 * c) (x1 * a + y1 * b + z1 * c)) xyz;
        let rec loop r i x y z =
            if r = m then abs x + abs y + abs z else
                let (x0, y0, z0) = xyz.(i) in
                loop (r + 1) (i - 1) (x + x0) (y + y0) (z + z0)
        in
        loop 0 (n - 1) 0 0 0
    in

    let p, m = 1, -1 in

    f p p p @| f p p m @|
    f p m p @| f p m m @|
    f m p p @| f m p m @|
    f m m p @| f m m m |> Printf.printf "%d\n"
)

Measured memory_bytes: 1408
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int q = sc.nextInt();
		for (int i = 0; i < q; i++) {
			switch (sc.nextInt()) {
				case 0:
					int b  = sc.nextInt();
					int e = sc.nextInt();
					System.out.println(Collections.min(list.subList(b, e)));
					break;
				case 1:
					b  = sc.nextInt();
					e = sc.nextInt();
					System.out.println(Collections.max(list.subList(b, e)));
					break;
			}
		}
	}
}




Measured memory_bytes: 33784
#![allow(unused_imports)]

use proconio::fastout;
use proconio::input;
use proconio::marker::{Bytes, Chars, Usize1};

#[fastout]
fn main() {
    input! {
        r: f64,
    }
    println!("{}", 2.0 * r * std::f64::consts::PI);
}


Measured memory_bytes: 2248
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <stdlib.h>
#include <string>
#include <vector>

#define el endl
#define fd fixed
#define INF INT_MAX/2-1
#define pb push_back

using namespace std;

bool island[50][50];
bool visited[50][50];

void visit(int x, int y) {
  visited[y][x] = true;
  if (x > 0 && island[y][x-1] && !visited[y][x-1]) visit(x-1, y);
  if (x < 49 && island[y][x+1] && !visited[y][x+1]) visit(x+1, y);
  if (y > 0 && island[y-1][x] && !visited[y-1][x]) visit(x, y-1);
  if (y < 49 && island[y+1][x] && !visited[y+1][x]) visit(x, y+1);
  if (x > 0 && y > 0 && island[y-1][x-1] && !visited[y-1][x-1]) visit(x-1, y-1);
  if (x > 0 && y < 49 && island[y+1][x-1] && !visited[y+1][x-1]) visit(x-1, y+1);
  if (x < 49 && y > 0 && island[y-1][x+1] && !visited[y-1][x+1]) visit(x+1, y-1);
  if (x < 49 && y < 49 && island[y+1][x+1] && !visited[y+1][x+1]) visit(x+1, y+1);
}

int main() {
  int w, h, tmp, cnt;
  while (cin >> w >> h, w | h) {
    for (int i = 0; i < 50; i++) {
      for (int j = 0; j < 50; j++) {
        island[i][j] = false;
        visited[i][j] = false;
      }
    }
    cnt = 0;

    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if (cin >> tmp, tmp)
          island[i][j] = true;
      }
    }
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if (island[i][j] && !visited[i][j]) {
          visit(j, i);
          cnt++;
        }
      }
    }
    cout << cnt << el;
  }
}

Measured memory_bytes: 1384
<?php
list($n) = ints();
$a = ints();
for ($i = 0; $i < $n; ++$i) {
    if (isset($cnt[$a[$i]])) $cnt[$a[$i]]++;
    else $cnt[$a[$i]] = 1;
}
ksort($cnt);
if (isset($cnt[1])) {
    if ($cnt[1] > 1) exit('0');
    else exit('1');
}
$max = max($a);
$isPrime = isPrimeArr($max);
$ans = 0;
foreach ($cnt as $i => $v) {
    if ($v === 1 && $isPrime[$i]) $ans++;
}
echo $ans;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}

function isPrimeArr($max)
{
    global $cnt;
    $arr = array_fill(0, $max + 1, true);
    $arr[0] = false;
    foreach ($cnt as $i => $v) {
        for ($j = 2 * $i; $j <= $max; $j += $i) {
            $arr[$j] = false;
        }
    }
    return $arr;
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <ll,ll> pii;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rept(i,x,y) for(int i=x;i<=y;i++)
#define per(i,x,y) for(int i=x;i>=y;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define fi first
#define se second
#define mes(a,b) memset(a,b,sizeof a)
#define mp make_pair
#define dd(x) cout<<#x<<"="<<x<<" "
#define de(x) cout<<#x<<"="<<x<<"\n"
#define debug() cout<<"I love Miyamizu Mitsuha forever.\n"
const int inf=0x3f3f3f3f;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x;
	cin>>x;
	cout<<x+x*x+x*x*x<<"\n";
	return 0;
}

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

#define ll long long 
#define ull unsigned long long
#define M1 1000000007


#define for0(i, n) for (ll i = 0; i < (ll)(n); i++) // 0 based indexing
#define for1(i, n) for (ll i = 1; i <= (ll)(n); i++) // 1 based indexing
#define forc(i, l, r) for (ll i = (ll)(l); i <= (ll)(r); i++) // closed llerver from l to r r inclusive
#define forr0(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--) // reverse 0 based.
#define forr1(i, n) for (ll i = (ll)(n); i >= 1; i--) // reverse 1 based


#define pb push_back
#define fi first
#define se second



#define all(x) (x).begin(), (x).end() 
#define rall(x) (x).rbegin(), (x).rend() 

using namespace std;

typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef double ld;

bool inc(vi vec){   // tells if an array is NOn-decreasing or NOt in O(n) time complexity.
		forc(i,0,vec.size()-1){
				if(vec[i]<vec[i-1])return 0;
		}
		return 1;
}

bool dec(vi vec){
	forc(i,0,vec.size()-1){
				if(vec[i]>vec[i-1])return 0;
		}
		return 1;
}

bool isprime(ll n){    // miller rabin(deterministic version) with time complexity of O(log n).
		if(n<2)
				return false;
		for(ll x:{2,3,5,7,11,13,17,19,23,29,31,37}){
				if(n==x)
						return true;
				bool flag=true;
				ll r=1;
				ll t=1;
				while(r<=((n-1)>>__builtin_ctzll(n-1))){
						if(r&((n-1)>>__builtin_ctzll(n-1)))
								t=((ll)t*x)%n;
						x=((ll)x*x)%n;
						r<<=1;
				}
				if(t==1||t==n-1)
						flag=false;
				for(r=0;r<__builtin_ctzll(n-1);r++){
						t=((ll)t*t)%n;
						if(t==n-1)
								flag=false;
				}
				if(flag)
						return false;
		}
		return true;
}

ll binpow(ll a, ll b) {  // Time complexity-->log(n) 
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll addmod(ll a,ll b){
	return (a%M1 + b%M1)%M1;
}


//-----------------------------------------------------------END------------------------------------------------------------------------------//


void solve(){
    int k;cin>>k;
    string ans="";
    while(k--){
    	ans+= "ACL";
    }
    cout<<ans;
}



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

		//cout.precision(10);
		//cout << fixed;
        
        /*ll size=1000000;
        vector<bool> isthisprime(size+5,true);

        isthisprime[0]=false;
        isthisprime[1]=false;
        
        forc(i,2,size){
        	if(isthisprime[i]){
        		for(ll j=i*2;j<=size;j+=i){
        			isthisprime[j]=false;
        		}
        	}
        }*/

		//ll tt;cin>>tt;
		//while(tt--){
			solve();
		//}
		return 0;
}




Measured memory_bytes: 3676
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int ans = 0;
		if(s.contains("R")) {
			ans = 1;
		}
		if(s.contains("RR")) {
			ans = 2;
		}
		if(s.contains("RRR")) {
			ans = 3;
		}
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 35588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#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)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll A;
    string B;
    cin >> A >> B;
    ll C = (B[0] - '0')*100 + (B[2] - '0')*10 + (B[3] - '0');
    A=A*C;
    A/=100;
    cout << A << "\n";
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define st first
#define nd second

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

int main(){
	int n;
	ll d, x, y;
	scanf("%d %lld", &n, &d);
	d *= d;
	int cnt = 0;
	for(int i = 1; i <= n; i++){
		scanf("%lld %lld", &x, &y);
		if(x * x + y * y <= d) cnt++;
	}
	printf("%d", cnt);
	


}

Measured memory_bytes: 3832
def test():

	while True:
		i = list(map(int,input().split()))
	
		H = i[0]
		W = i[1]

		if H == 0 and W == 0:
			break

		for i in range(H):
			for j in range(W):
				if (i % 2 == 0 and j % 2 == 0) or (i % 2 != 0 and j % 2 != 0) :
					print("#",end="")
				else:
					print(".",end="")
			print()

		print()

if __name__ == "__main__":
	test()


Measured memory_bytes: 7008
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<complex>
using namespace std;
typedef long long int llint;
int main(){
	int a, b, c, d, e;
	cin >> a >> b;
	c = a + b;
	d = a - b;
	e = a*b;
	if (c < d){
		if (d < e){
			cout << e << endl;
		}
		else{
			cout << d << endl;
		}
	}
	else{
		if (c < e){
			cout << e << endl;
		}
		else{
			cout << c << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
//stringray

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

/*#ifndef __LOCAL__ 
#pragma comment(linker,"/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif*/ 

using namespace std;
using namespace __gnu_pbds;

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

typedef pair<int,int> pii;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<set<int>> vsi;

#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
#define pb emplace_back
#define F first
#define S second
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0)


const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T>
istream& operator >> (istream& is,vector<T>& vec){
  for(T &x:vec)is>>x;
  //for(int i=0;i<vec.size();++i)is>>x[i];
  return is;
}

template<typename T>
ostream& operator << (ostream& os,vector<T>& vec){
  for(int i=0;i<vec.size();++i){
    os<<vec[i]<<(i+1==vec.size()?"":" ");
  }
  return os;
}

ll mpow(ll a, ll b){
  ll ret=1;
  while(b>0){
    if(b&1)ret=(ret*a)%mod;
    (a=a*a)%=mod;
    b>>=1LL;
  }
  return ret;
}

//#define int int64_t
int a[2*N+2];
int x[2*N+2];
void solve(){
  int n;cin>>n;
  fori(i,n)cin>>a[i];
  memset(x,-1,sizeof(x));
  //let's solve from top 
  for(int i=n;i>=1;--i){
    int sum=0;
    for(int j=2*i;j<=n;j+=i){
      sum+=x[j];
      sum%=2;
    }
    x[i]=((a[i]-sum)+2)%2;
  }
  //now check 
  int cnt=0;
  for(int i=1;i<=n;++i){
    int sum=0;
    if(x[i]==1)cnt++;
    for(int j=i;j<=n;j+=i){
      sum+=x[j];
    }
    if(sum%2!=a[i]){cout<<"-1\n";return ;}
  }
  cout<<cnt<<endl;
  for(int i=1;i<=n;++i)if(x[i]>0)cout<<i<<" ";
  cout<<endl;

  
}
int32_t  main(){
  IOS;
  solve();
  return 0;
}



Measured memory_bytes: 2560
N = int(input())
li = list(map(int,input().split()))
out_count = 0

for j in range(N - 1 , 0 , -1):
  if li[j] <= li[j - 1] - 2:
    out_count += 1
  elif li[j] == li[j - 1] - 1:
    li[j - 1] -= 1
if out_count == 0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 14224
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int count = 0;
		int count8 = 0;
		int n = scan.nextInt();

		int i = 1;
		int j = 1;
		while (i <= n) {
			while (j <= i) {
				if (i % j == 0) {
					count++;
				}

				j = j + 1;
			}
			if (count == 8) {
				count8 = count8 + 1;
			}
			count = 0;
			i = i + 2;
			j = 1;

		}
		System.out.println(count8);
	}

}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
const int r = 1e5 + 1;
struct day{
    int s, b, h;
    day(){};
};
day a[r]; int n, dp[r][4];
int solve(int idx, int p){
    if (idx == n)
        return 0;
    if (dp[idx][p] != -1)
        return dp[idx][p];
    int ret = -1;
    if (p == 0){
        ret = max(ret, a[idx].s + solve(idx + 1, 1));
        ret = max(ret, a[idx].b + solve(idx + 1, 2));
        ret = max(ret, a[idx].h + solve(idx + 1, 3));
    }
    else if (p == 1){
        ret = max(ret, a[idx].b + solve(idx + 1, 2));
        ret = max(ret, a[idx].h + solve(idx + 1, 3));
    }else if (p == 2){
        ret = max(ret, a[idx].s + solve(idx + 1, 1));
        ret = max(ret, a[idx].h + solve(idx + 1, 3));
    }else if (p == 3){
        ret = max(ret, a[idx].s + solve(idx + 1, 1));
        ret = max(ret, a[idx].b + solve(idx + 1, 2));
    }
    return dp[idx][p] = ret;
}
int main(){
    memset(dp, -1, sizeof dp);
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i].s >> a[i].b >> a[i].h;
    cout << solve(0, 0);
    return 0;
}


Measured memory_bytes: 9216
#include<stdio.h>
#define N 101
#define W 0
#define B 1
#define INF 1000000000
int n,w[N][N],d[N];
 
void dijkstra(){
  int i,j,u,v,c[N];
  int mincost;
  for(u=0;u<n;u++){
    d[u]=INF;
    c[u]=W;
  }
  d[0]=0;
  
  while(1){
    mincost = INF;
    for(i=0;i<n;i++){
      if(c[i]!=B&&d[i]<mincost){
    u = i;
    mincost = d[i];
      }
    }
    if(mincost==INF) break;
    c[u]=B;
    for(v=0;v<n;v++){
      if(c[v]!=B && d[u]+w[u][v]<d[v]){
    d[v] =d[u]+w[u][v];
      }
    }
  }
}
 
 
int main(){
  int i,j;
  int u,k,v,c;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      w[i][j]=INF;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&v,&c);
      w[u][v]=c;
    }
  }
  dijkstra();
  for(i=0;i<n;i++) printf("%d %d\n",i,d[i]);
  return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll; 
int main(void)
{
	string s;	
	cin >> s;
	if (s == "SUN") {
		cout << 7 << endl;
	}
	else if (s == "MON") {
		cout << 6 << endl;
	}
	else if (s == "TUE") {
		cout << 5 << endl;
	}
	else if (s == "WED") {
		cout << 4 << endl;
	}
	else if (s == "THU") {
		cout << 3 << endl;
	}
	else if (s == "FRI") {
		cout << 2 << endl;
	}
	else if (s == "SAT") {
		cout << 1<<endl;
	}


	return 0;
}

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

long long int n,p[1000010],j=0,a;
int main(){
	bool isp[1000010];							  
	for(int i=0;i<=1000009;i++){
		isp[i]=true;
	}
	isp[0]=false;
	isp[1]=false;
	for(int i=2;i<=1000010;i++){
		if(isp[i]){
			p[j]=i;
			for(int k=i*2;k<1000010;k+=i){
				isp[k]=false;
			}
		}
	}
	while(cin>>n){
		a=0;
		for(int i=1;i<=n;i++){
			if(isp[i])a++;
		}
		cout<<a<<endl;
	}
	return 0;
}

Measured memory_bytes: 3944
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
//import org.apache.commons.lang3.StringUtils;
 
 
/**
 *
 * @author aj
 */
public class Main {
    
    public static void main(String[] args){
        try {
            //Scanner sc = new Scanner(System.in);
            BufferedInputStream bf = new BufferedInputStream(System.in);
            BufferedReader r = new BufferedReader(
                    new InputStreamReader(bf, StandardCharsets.UTF_8));
            OutputStream out = new BufferedOutputStream ( System.out );
            String[] nx = r.readLine().split(" ");
            int n = Integer.parseInt(nx[0]);
            long x = Integer.parseInt(nx[1]);
            String[] sa = r.readLine().split(" ");
            long[] a = new long[n];
            for(int i=0;i<n;i++) a[i] = Long.parseLong(sa[i]);
            int cnt = 0;
            Arrays.sort(a);
            long sum = 0;
            for(int i=0;i<n;i++){
                sum += a[i];
                if (sum<=x && i<n-1) cnt++;
                if (i==n-1 && sum==x) cnt++;
            }
            out.write((cnt+"\n").getBytes());
            out.flush();
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }
}

Measured memory_bytes: 23252
#include <stdio.h>
        #include <math.h> 
        int main(void){
            // Your code here!
            int H,W,K;
            char map[6][7] = {};
            int ans = 0;
            
            scanf("%d%d%d",&H,&W,&K);
            
            for(int i = 0; i < H; i++){
                scanf("%6s",map[i]);
                //printf("%s\n",map[i]);
            }
            
            for(int Hb = 0; Hb < (int)pow(2,H); Hb++ ){
                for(int Wb = 0; Wb < (int)pow(2,W); Wb++){
                    int brack = 0;
                    for(int i = 0; i < H; i++){
                        for(int j = 0; j < W; j++){
                            if((Hb>>i & 1) == 0 && (Wb>>j & 1) == 0 && map[i][j] == '#'){
                                brack++;
                            }
                        }
                    }
                    if(brack == K){
                        ans++;
                    }
                }
            }
            
            printf("%d\n",ans);
        }


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

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 2019

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define part(v, s, e) v.begin() + s, v.begin() + e
#define print(v) for (auto i: v) cout << i << " ";

int main() {
    fast;
    ll l, r;
    cin >> l >> r;
    ll a = l % M, b = r % M;
    if (a < b && r-l < M) {
        ll m = LLONG_MAX, t;
        REP(i, a, b) {
            REP(j, i+1, b+1) {
                t = (i * j) % M;
                m = min(m, t);
            }
        }
        cout << m << endl;
    }
    else
        cout << 0 << endl;
    return 0;
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define myabs(a) ((a)<0?(-(a)):(a))
#define AIN(a, b, c) assert(b <= a && a <= c)
#define pi acos(-1.0)
#define CLR(a) memset(a,0,sizeof(a))
#define SET(a) memset(a,-1,sizeof(a))
#define pb push_back
#define all(a) a.begin(),a.end()
#define ff first
#define ss second
#define eps 1e-9
#define root 1
#define lft 2*idx
#define rgt 2*idx+1
#define cllft lft,st,mid,s,e
#define clrgt rgt,mid+1,ed,s,e
#define inf (1<<29)
#define ii64 long long
#define MX 120
#define MD 100000007
typedef pair<int,int> pii;
char mat[MX][MX];
int n, m, dp[MX][MX][2];

int func(int i, int j, int bc){
    if(i >= n) return inf;
    if(j >= m) return inf;
    if(i == n-1 && j == m-1) return (mat[i][j] == '#' ? bc : 0);
    int &ret = dp[i][j][bc], tmp, a, b;
    if(ret != -1) return ret;

    ret = mat[i][j] == '#' ? bc : 0;
    a = func(i + 1, j, 1);
    b = func(i,  j + 1, 1);
    tmp = min(a, b);
    if(mat[i][j] == '#'){
        a = func(i + 1, j, 0);
        tmp = min(tmp, a);

        a = func(i, j + 1, 0);
        tmp = min(tmp,  a);
    }
    ret += tmp;
    return ret;
}
int main(){
    int i, j;
    while(scanf("%d %d", &n, &m) == 2){
        for(i = 0; i < n; i++) scanf("%s", mat[i]);
        SET(dp);
        printf("%d\n", func(0, 0, 1));
    }
	return 0;
}




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

#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007

int main(){
	fast;
    string n;
    cin>>n;
    ll sum=0;
    for(int i=0;i<n.length();i++)
        sum+= n[i] - '0';
    if(sum%9)
        cout<<"No";
    else
        cout<<"Yes";
	return 0;
}



Measured memory_bytes: 3740
#include<stdio.h>
#include<iostream>
using namespace std;
int  incalc(long long int b)
{
    if(b==0)
    {
        return 1;
    }
    return (b*incalc(b-1))%(1000000007);
}
int main()
{
    long long int b=0;
    cin>>b;
    cout<<incalc(b);
}

Measured memory_bytes: 1792
import java.util.Scanner;
import java.util.ArrayList;
public class Main {

  public static class Node {
    int key;
    Node left;
    Node right;
    Node p;
    public Node(int key) {
      this.key = key;
      this.left = null;
      this.right = null;
      this.p = null;
    }
  }

  public static class Tree {
    Node root;
    public Tree() {
      this.root = null;
    }
  }

  public static void insert(Tree T, Node z) {
    Node y = null;
    Node x = T.root;
    while (x != null) {
      y = x;
      if (z.key < x.key)
        x = x.left;
      else
        x = x.right;
    }
    z.p = y;

    if (y == null)
      T.root = z;
    else if (z.key < y.key)
      y.left = z;
    else
      y.right = z;
  }

  public static String print_inorder(Node x) {
    String a = "";
    if (x != null) {
      a = a + print_inorder(x.left);
      a = a + " " + x.key;
      a = a + print_inorder(x.right);
    }
    return a;
  }

  public static String print_preorder(Node x) {
    String a = "";
    if (x != null) {
      a = a + " " + x.key;
      a = a + print_preorder(x.left);
      a = a + print_preorder(x.right);
    }
    return a;
  }

  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int m = s.nextInt();
    ArrayList<String> results = new ArrayList<String>();
    Tree T = new Tree();
    for (int i = 0; i < m; i++) {
      String cmd = s.next();
      switch(cmd) {
        case "insert":
          int key = s.nextInt();
          Node x = new Node(key);
          insert(T, x);
          break;
        case "print":
          results.add(print_inorder(T.root));
          results.add(print_preorder(T.root));
          break;
        default:
          break;
      }
    }
    s.close();
    for (String result : results) {
      System.out.println(result);
    }
  }
}



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

int main() {
  int n; 
  cin>>n;
  cout<<n+n*n+n*n*n;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 int mod=1000000007;
const int INF=1001001001;

int main() {
  int64_t D,T,S;
  cin>>D>>T>>S;
  if(D-T*S<=0){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
  return 0;  
}

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

int N, M;
bool relation[8][8];

int search(int current, vector<bool>& visited) {
  bool all_visited = true;
  for (int i = 0; i < visited.size(); i++) {
    if (!visited.at(i)) {
      all_visited = false;
    }
  }
  if (all_visited) return 1;
  
  int result = 0;
  for (int i = 0; i < N; i++) {
    if (!relation[current][i]) continue;
    if (visited.at(i)) continue;
    
    visited.at(i) = true;
    result += search(i, visited);
    visited.at(i) = false;
  }
  return result;
}

int main() {
  cin >> N >> M;
  
  int a, b;
  for (int i = 0; i < M; i++) {
    cin >> a >> b;
    relation[a - 1][b - 1] = true;
    relation[b - 1][a - 1] = true;
  }
  
  vector<bool> visited(N, false);
  visited.at(0) = true;
  
  int result = search(0, visited);
  cout << result << endl;
  
  return 0;
}

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

int main() {
  string S;
  cin >> S;
  
  int count = 0;
    for( int i = 1; i < S.size(); i++ ){
      if( i % 2 == 0 ){ //偶数のタイルが
        if( S.at(i) != S.at(0) ) count++;
      }else{ //奇数のタイルが
        if( S.at(i) == S.at(0) ) count++;
      }   
    }
  cout << count << endl;
          
}

Measured memory_bytes: 512
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <cmath>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
        int A, B, C, X, Y;
        cin >> A >> B >> C >> X >> Y;

        int ans = max(X, Y) * C * 2;
        ans = min(A * X + B * Y, ans);
        if (X > Y)
        {
                int tmp = Y * C * 2 + (X - Y) * A;
                ans = min(ans, tmp);
        }
        else
        {
                int tmp = X * C * 2 + (Y - X) * B;
                ans = min(ans, tmp);
        }

        cout << ans << endl;

        return 0;
}


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

using namespace std;

int main(){
    int n,m,x;
    int ans = INT_MAX;

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

    for(int i=0;i<pow(2,n);i++){//パターン
        int cost = 0;
        int tmp = i;
        int rikaido[m];
        bool ok = true;
        for(int j=0;j<m;j++)rikaido[j]=0;

        for(int j=0;j<n;j++){//本
            if(tmp%2==1){
                cost += c[j];
                for(int k=0;k<m;k++){
                    rikaido[k]+=a[j][k];
                }
            }
            tmp =tmp/2;
        }
        for(int j=0;j<m;j++){
            if(rikaido[j]<x){
                ok = false;
            }
        }
        if(ok)ans = min(ans,cost);
    }

    if(ans == INT_MAX)ans = -1;
    cout << ans << endl;
}

Measured memory_bytes: 4048
def main(input = STDIN)
  table = {'o' => 1, 's' => 0, 'x' => -1}
  while state = input.gets
    state = state.chomp.split(//)
    result = nil
    3.times do |i|
      bool = 0
      bool1 = 0
      bool2 = 0
      3.times do |j|
        bool += table[state[3 * i + j]]
        bool1 += table[state[i + 3 * j]]
        bool2 += table[state[i + (4 - i) * j]]
      end
      result = true if (bool == 3) or (bool1 == 3) or (bool2 == 3)
      result = false if (bool == -3) or (bool1 == -3) or (bool2 == -3)
    end
    if result
      puts "o\n"
    elsif result.nil?
      puts "d\n"
    else
      puts "x\n"
    end
  end
end
main

Measured memory_bytes: 6100
from __future__ import annotations

import unittest
from dataclasses import dataclass, field
from typing import List


@dataclass
class Sweet:
    id: int


@dataclass
class User:
    id: int
    sweets: List[Sweet] = field(default_factory=list)

    def register_sweet(self, sweet: Sweet) -> None:
        if sweet not in self.sweets:
            self.sweets.append(sweet)

    def has_no_sweets(self) -> bool:
        return len(self.sweets) == 0


@dataclass(frozen=True)
class Users:
    values: List[User] = field(default_factory=list)

    def add(self, user: User) -> Users:
        return Users(self.values + [user])

    def __len__(self) -> int:
        return len(self.values)

    def __getitem__(self, index: int) -> User:
        return self.values[index]

    @classmethod
    def create(cls, num_people: int) -> Users:
        return Users([User(id=i) for i in range(1, num_people + 1)])

    def count_users_has_no_sweets(self) -> int:
        return len([user for user in self.values if user.has_no_sweets()])

    def find_by(self, user_id: int) -> User:
        idx = user_id - 1

        return self.values[idx]


def answer(num_people: int, sweet_id_list: List[int], sweets_distribute_list: List[List[int]]):
    users = Users.create(num_people)

    for sweet_id, distribute_list in zip(sweet_id_list, sweets_distribute_list):
        sweet = Sweet(id=sweet_id)

        for user_id in distribute_list:
            user = users.find_by(user_id)
            user.register_sweet(sweet)

    return users.count_users_has_no_sweets()

  
  
num_people, num_sweets = map(int, input().split())

sweet_id_list = []
sweets_distribute_list = []
for i in range(num_sweets):
	d = int(input())
	sweet_id_list.append(d)
	has_list = list(map(int, input().split()))
	sweets_distribute_list.append(has_list)

print(answer(num_people, sweet_id_list, sweets_distribute_list))

Measured memory_bytes: 16372
#include <iostream>

using namespace std;

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

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

    int maxDiff = 0, minPrice = a[0], ans = 0;
    for (int i = 1; i < n; i++) {
        minPrice = min(minPrice, a[i]);

        if (maxDiff == a[i]-minPrice) {
            ans++;
        } else if (maxDiff < a[i]-minPrice) {
            maxDiff = a[i]-minPrice;
            ans = 1;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 640
N=int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
A=make_divisors(N)
ret=0
for k in A:
  m=N//k-1
  if m>k:
    ret+=m
  else:
    break
print(ret)

Measured memory_bytes: 3264
loop do
  n = gets.to_i
  break if n==0
  hash = Hash.new(0)
  gets.split.each{|s|
    a = s.to_i
    hash[a] += 1
  }
  if (n + 1) / 2 >= hash.size
    mk, mv = hash.max_by{|k,v| v}
    if mv*2>n
      puts mk
    else
      puts "NO COLOR"
    end
  else
    puts "NO COLOR"
  end
end


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

public class Main {

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

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//        String[] str = br.readLine().split(" ");
        int n = Integer.parseInt(br.readLine());

        long ans = 1;
        for (int i = 0; i < n; i++) {
            long in = Long.parseLong(br.readLine());
            ans = in / gcd(ans, in) * ans;
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 22996
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <list>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <iterator> 
#include <limits>

#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define ALL(a) (a).begin(),(a).end()
#define RALL(A) (a).rbegin(),(a).rend()
#define PB push_back
#define MP make_pair

#define dump(x) cerr << #x << " = " << (x) << endl;

using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

const int MAX_H = 10;
const int MAX_W = 10;
char maze[MAX_H][MAX_W];
bool visited[MAX_H][MAX_W];
int H, W;
bool flg;

bool check() {
    REP(i, H) {
        REP(j, W) {
            if (maze[i][j] == '#' and visited[i][j] == false) {
                return false;
            }
        }
    }
    return true;
}

void dfs(int h, int w) {
    //cout << h << " " << w << endl;
    if (flg) {
        return;
    }
    visited[h][w] = true;
    if (h == H - 1 and w == W - 1) {
        if (check()) {
            cout << "Possible" << endl;
        } else {
            cout << "Impossible" << endl;
        }
        flg = true;
        return;
    }
    int dx[2] = {0, 1};
    int dy[2] = {1, 0};
    REP(i, 2) {
        int nx = h + dx[i];
        int ny = w + dy[i];
        if (0 <= nx and nx < H and 0 <= ny and ny < W) {
            if (maze[nx][ny] == '#' and visited[nx][ny] == false) {
                dfs(nx, ny);
                visited[nx][ny] = false;
            }
        }
    }

}

int main(int argc, char const* argv[])
{
    cin >> H >> W;
    REP(i, H) {
        REP(j, W) {
            cin >> maze[i][j];
        }
    }
    dfs(0, 0);
    if (flg == false) {
        cout << "Impossible" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n;
    while(cin >> n, n){
        map<int, long long> info;
        map<int, long long>::iterator it;
        vector<long long> name;
        rep(i,n){
            long long a, b, c;
            cin >> a >> b >> c;
            if(!info[a])name.push_back(a);
            info[a] += b * c;
        }
        bool c = true;
        rep(i, name.size()){
            if(info[name[i]]>= 1000000){
                cout << name[i] << endl;
                c = false;
            }
        }
        if(c) cout << "NA" << endl;
    }
}

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

int main(){
    string s[3];
    rep(i, 0, 3) cin >> s[i];
    rep(i, 0, 3) cout << s[i][i];
    cout << endl;
    return 0;
}

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

double dp[3000][3000];

int main(){
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<double> C(N);
    for(int i = 0;i < N; ++i) cin >> C[i];
    dp[0][0] = 1.0;
    for(int i = 0; i < N; ++i){
        for(int j = 0; j <= i; ++j){
            dp[i+1][j] += dp[i][j] * (1 - C[i]);
            dp[i+1][j+1] += dp[i][j] * C[i];
        }
    }
    double ans = 0.0;
    for(int j = N; j >= N/2 + 1; --j) ans += dp[N][j];
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 68992
import java.io.*;
import java.util.*;

class JudgingMchine {
    static boolean isPrime(int x) {
        if(x == 2) {
        return true;
    }
    if(x < 2 || x % 2 == 0) {
        return false;
    }

    int i =3;
    while(i <= Math.sqrt(x)) {
        if(x % i == 0) {
            return false;
        }
        i += 2;
    }
    return true;
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

    List<Integer> nums = new ArrayList<>();
    for(int i=0; i<n; ++i) {
        nums.add(sc.nextInt());
    }

    int count = 0;
    for(int num : nums) {
        if(JudgingMchine.isPrime(num)) {
            count++;
        }
    }

    System.out.println(count);

    }
}

Measured memory_bytes: 41916
#include <bits/stdc++.h>
using namespace std;
typedef signed long long lint;

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  lint x, y, na, nb, nc;
  cin >> x >> y >> na >> nb >> nc;
  vector< lint > A(na), B(nb), C(nc);
  for (lint i=0; i<na; ++i) {
    cin >> A[i];
  }
  for (lint i=0; i<nb; ++i) {
    cin >> B[i];
  }
  for (lint i=0; i<nc; ++i) {
    cin >> C[i];
  }
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());
  vector< lint > eat(x+y);
  for (lint i=0; i<x; ++i) eat[i] = A[na-i-1];
  for (lint i=0; i<y; ++i) eat[x+i] = B[nb-i-1];
  sort(eat.begin(), eat.end());
  for (lint i=0; i<min(nc, x+y); ++i) {
    if (C[nc-i-1] > eat[i]) eat[i] = C[nc-i-1];
  }
  lint ans = 0;
  for (lint i=0; i<x+y; ++i) ans += eat[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3968
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner scan=new Scanner(System.in);
		int T=0;
		int H=0;
		int b=scan.nextInt();
		for(int j=0;j<b;j++) {
			String str=scan.next();
			String str2=scan.next();
			int g=str.compareTo(str2);
			if(g>0) {
				T+=3;
			}
			else if(g<0){
				H+=3;
			}
			else {
				H++;
				T++;
			}
		}
		System.out.println(T+" "+H);
	}
}


Measured memory_bytes: 29964
#include <bits/stdc++.h>
using namespace std;
int main() {
  string c;
  cin >> c;
  if (c == "a") cout << "b" << endl;
  if (c == "b") cout << "c" << endl;
  if (c == "c") cout << "d" << endl;
  if (c == "d") cout << "e" << endl;
  if (c == "e") cout << "f" << endl;
  if (c == "f") cout << "g" << endl;
  if (c == "g") cout << "h" << endl;
  if (c == "h") cout << "i" << endl;
  if (c == "i") cout << "j" << endl;
  if (c == "j") cout << "k" << endl;
  if (c == "k") cout << "l" << endl;
  if (c == "l") cout << "m" << endl;
  if (c == "m") cout << "n" << endl;
  if (c == "n") cout << "o" << endl;
  if (c == "o") cout << "p" << endl;
  if (c == "p") cout << "q" << endl;
  if (c == "q") cout << "r" << endl;
  if (c == "r") cout << "s" << endl;
  if (c == "s") cout << "t" << endl;
  if (c == "t") cout << "u" << endl;
  if (c == "u") cout << "v" << endl;
  if (c == "v") cout << "w" << endl;
  if (c == "w") cout << "x" << endl;
  if (c == "x") cout << "y" << endl;
  if (c == "y") cout << "z" << endl;
  if (c == "z") cout << "a" << endl;
}

Measured memory_bytes: 256