akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
using namespace std;
#define int long long

main(){
  int n;
  cin>>n;
  int a[n][n];
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      cin>>a[i][j];
  int ans=0;
  bool used[n];
  memset(used,0,sizeof(used));
  used[0]=1;
  int cost[n];
  for(int i=0;i<n;i++) cost[i]=a[0][i];
  while(1){
    int v=-1;
    for(int i=0;i<n;i++){
      if(used[i]||cost[i]<0) continue;
      if(v<0||cost[i]<cost[v]) v=i;
    }
    if(v<0) break;
    used[v]=1;
    ans+=cost[v];
    for(int i=0;i<n;i++){
      if(a[v][i]<0) continue;
      if(cost[i]<0||a[v][i]<cost[i]) cost[i]=a[v][i];
    }
  }
  cout << ans << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  long ans = 0;
  for (long l = 0, r = 0, now = 0, sum = 0; r < N; r++) {
    now ^= A.at(r), sum += A.at(r);
    while (l <= r && now != sum) {
      now ^= A.at(l), sum -= A.at(l), l++;
    }
    ans += r - l + 1;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 4052
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a,b,c,d,e,f;
		double x,y;

		while(sc.hasNext()){
			a=sc.nextInt();
			b=sc.nextInt();
			c=sc.nextInt();
			d=sc.nextInt();
			e=sc.nextInt();
			f=sc.nextInt();
			y=(double)(c*d-a*f)/(b*d-a*e);
			x=(double)(c-b*y)/a;
			
			System.out.printf("%.3f %.3f\n",x,y);
	
			}
		
	}

}

Measured memory_bytes: 18144
#!/usr/bin/env python3

import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(1)
	n, k = map(int, sys.stdin.readline().split())
	have = [0]*n
	for i in range(k):
		di = int(sys.stdin.readline())
		a = list(map(int, sys.stdin.readline().split()))
		for i in range(di):
			have[a[i]-1] += 1
	cnt = 0
	for i in range(n):
		if have[i] == 0:
			cnt += 1
	print(cnt)


main()

Measured memory_bytes: 9964
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 1000000007

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

int main() {
	ll N, A, B;
	cin >> N >> A >> B;

	if ((B - A) % 2 == 0) cout << (B - A) / 2 << endl;
	else {
		ll ans1, ans2;
		ans1 = A + (B - A) / 2;
		ans2 = (N - B + 1) + (B - A - 1) / 2;
		cout << min(ans1, ans2) << endl;
	}
}


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


typedef long long int ll;

vector<ll> adj[1000001]; 

ll i,tc;
#define mod 1000000007
#define pb push_back
#define endl cout<<"\n";
#define prt1(a) cout<<a<<" "
#define prt2(a,b) cout<<a<<" "<<b<<" "
#define prt3(a,b,c) cout<<a<<" "<<b<<" "<<c<<" "
#define rep(i,st,end) for( i=st;i<end;i+=2)
#define repv(i,st,end) for( i=st;i>=end;i-=2)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define TEST cin>>tc;while(tc--)


int main() 
{ 
 string s,t;
 cin>>s>>t;
 if(s==t.substr(0,s.length()))
    cout<<"Yes";
else
    cout<<"No";
} 



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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 200001
#define int ll
int N;
int A[maxn],ss[maxn],sxor[maxn];


int32_t main(){
	fast;
	
	cin>>N;
	FOR(i,1,N) cin>>A[i];
	
	ss[1] = sxor[1] = A[1];

	FOR(i,2,N){
		ss[i] = ss[i-1] + A[i];
		sxor[i] = sxor[i-1] ^ A[i];
	}
	
	int ans = 0;
	FOR(i,1,N){
		int l = i, r = N+1;
		
		while (l+1<r){
			int mid = (l+r)/2;
			
			if (ss[mid] - ss[i-1] == (sxor[mid] ^ sxor[i-1])) l = mid;
			else r = mid;
		}
		
		ans += l - i + 1;
	}
	
	cout<<ans;
	

	
}



Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a , b , c , d , e , f , g;
  cin >> a;
  b = a % 10;
  c = a - b;
  d = c % 100;
  e = d / 10;
  f = c - d;
  g = f / 100;
  cout << b + e + g << endl;
}

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

#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define EPS (1e-7)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;

int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

int dx[]={1,0,-1,1,-1,1,0,-1};
int dy[]={1,1,1,0,0,-1,-1,-1};

const ll mod=1e9+7;
const int INF=INT_MAX/2;
const int MAX=1e9;
ll calc(ll x, ll y){
	ll res=0;
	while(x<=y){
		x*=2;
		res++;
	}
	return res;
}
int main(){
	ll x,y;
	cin>>x>>y;
	cout<<calc(x,y)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n, m;
  	cin >> n >> m;
  	int flg = 0;
  	for(int i = 1; i <= 3; i++){
		if(n * m * i % 2 == 1) flg = 1;
    }
  	if(flg == 1) cout << "Yes" << endl;
  	else cout << "No" << endl;
  	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>

using namespace std;

template<typename T>
istream& operator >> (istream& is, vector<T>& v) {
    for (auto& x : v) {
        is >> x;
    }
    return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& v) {
    for (auto& x : v) {
        os << x << " ";
    }
    os << "\n";
    return os;
}

const uint64_t MOD = 1e9 + 7;
const uint64_t MAX_N = 2e5 + 5;

uint64_t pow(uint64_t a, int p) {
    if (p == 0) return 1;
    if (p == 1) return a % MOD;
    uint64_t b = pow(a, p / 2);
    b *= b;
    b %= MOD;
    if (p % 2 == 0) {
        return b;
    } else {
        return (b * a) % MOD;
    }
}

uint64_t C(int n, int k, const vector<uint64_t>& f, const vector<uint64_t>& rf) {
    // cout << n << " " << k << endl;
    if (k < 0 || k > n) return 0;
    return (((f[n] * rf[k]) % MOD) * rf[n - k]) % MOD;
}

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

#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    vector<uint64_t> fact(MAX_N, 1), rev_fact(MAX_N, 1);
    for (uint64_t i = 1; i < MAX_N; ++i) {
        fact[i] = (fact[i - 1] * i) % MOD;
        rev_fact[i] = pow(fact[i], MOD - 2);
    }
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    uint64_t ans = 0;
    for (int k = 0; k < min(H - A, W - B); ++k) {
        uint64_t cur = C(H - A - 1 + B, H - A - 1 - k, fact, rev_fact);
        cur *= C(W - B + A - 1, W - B - k - 1, fact, rev_fact);
        cur %= MOD;
        ans += cur;
        ans %= MOD;
    }
    cout << ans;
}


Measured memory_bytes: 6288
import math
import queue
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=qb
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
def dq():
	return queue.deque()
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1

n = readInt()
a = readInts()
a.sort()

for i in range(n-1):
	if a[i]==a[i+1]:
		print("NO")
		exit()
print("YES")

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

int main() {
    int K, A, B;
    cin >> K >> A >> B;

    int res = A / K * K;
    string ans = "NG";
    for(int i = res; i<=B; i += K) {
        if(i >= A && i <= B) {
            ans = "OK";
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3612
cnt = 0
n = int(input())
a = list(map(int,input().split()))
for i in range(0,n):
	mini = i
	for j in range(i,n):
		if a[j]<a[mini]:
			mini = j
	a[i],a[mini] = a[mini],a[i]	
	if i!=mini:
		cnt += 1
print(" ".join(map(str,a)))
print(cnt)

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

#define MAX_N 102
#define MAX_W 100002

using namespace std;
using ll = long long;

ll N,W;
ll w[MAX_N];
ll v[MAX_N];
ll dp[MAX_N][MAX_W];
void solve()
{
    for(int i=1;i<=N;i++){
        for (int j=0;j<=W;j++){
            if(j<w[i-1])dp[i][j] = dp[i-1][j];
            else dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
        }
    }
    cout<<dp[N][W]<<endl;
}

int main()
{
    cin>>N>>W;
    for(int i = 0;i<N;i++)
        cin>>w[i]>>v[i];
    solve();
    return 0;
}


Measured memory_bytes: 78336
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(b)-1;i>=(a);--i)
#define ALL(a) a.begin(),a.end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if (a < b) { a = b; return true; }
    return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if (a > b) { a = b; return true; }
    return false;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "{";
    int a = 0;
    for (auto &tp : mp) {
        if (a) os << ", "; a = 1;
        os << tp;
    }
    return os << "}";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << ":" << p.second;
    return os;
}


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

    int n; cin >> n;
    vi d(n);
    REP(i, n) cin >> d[i];

    int MAX = n * (n + 1) / 2;
    vi appeared(MAX+1);

    REP(i, n) {
        int sum = 0;
        FOR(j, i, n) {
            sum *= 10;
            sum += d[j];
            if (sum > MAX) break;
            appeared[sum] = 1;
        }
    }

    REP(i,MAX+1) {
        if (!appeared[i]) {
            cout << i << endl;
            break;
        }
    }

    return 0;
}



Measured memory_bytes: 4948
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using piii = pair<int, pair<int, int>>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;

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

    int L;
    cin >> L;
    long double ans = L * L * L / 27.0;
    printf("%.10Lf\n", ans);
    return 0;
}


Measured memory_bytes: 256
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::iter::FromIterator;
use std::collections::BinaryHeap;

#[allow(unused_macros)]
macro_rules! unwrap {
    ($arg:expr) => {
        {
            let tmp = $arg;
            if tmp.is_none() {return;}
            tmp.unwrap()
        }
    };
}

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let n = scan.read::<usize>();
    let mut m = scan.read::<usize>();
    let mut heap = scan.readn::<i64>(n).into_iter().collect::<BinaryHeap<_>>();
    while m > 0 {
        let item: i64 = unwrap!(heap.pop());
        if item == 0 {break;}
        heap.push(item / 2);
        m -= 1;
    }
    println!("{}", heap.iter().cloned().sum::<i64>());
}

// region template
#[allow(dead_code)]
fn iu(i: i64) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> i64 { i as i64 }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

#[allow(dead_code)]
fn alt<S, T>(v: Vec<S>) -> T where T: FromIterator<S> {
    v.into_iter().collect::<T>()
}

#[allow(dead_code)]
fn dup<S, T>(v: &[S]) -> T where T: FromIterator<S>, S: Clone {
    v.iter().cloned().collect::<T>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> P(N);
    vector<int> Q(N);
    rep(i, N) {
        A[i] = i + 1;
    }
    rep(i, N) {
        cin >> P[i];
    }
    rep(i, N) {
        cin >> Q[i];
    }
    map<vector<int>, int> mp;
    mp[A] = mp.size();
    while (next_permutation(A.begin(), A.end())) {
        mp[A] = mp.size();
    }
    cout << abs(mp[P] - mp[Q]) << endl;
    return 0;
}

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

const int N = 2000 + 7;

int save[2][N][N];
int dp[N][N];
int n, res;
int c[2 * N], t[2 * N];
int sen[2][N];

int main() {
	cin >> n;
	for (int i = 0; i <= n; i++)
		for (int j = 0; j <= n; j++)
			dp[i][j] = 100000000 + 7;
	dp[0][0] = 0;
	for (int i = 1; i <= 2 * n; i++) {
		char cc;
		cin >> cc;
		if (cc == 'B')
			c[i] = 1;
		cin >> t[i];
	}
	for (int i = 1; i <= 2 * n; i++)
		for (int j = i + 1; j <= 2 * n; j++)
			if (c[i] == c[j] && t[i] > t[j])
				res++;
	for (int i = 1; i <= 2 * n; i++) {
		for (int j = n; j >= 0; j--) {
			save[c[i]][t[i]][j] = save[c[i]][t[i]][j + 1];
			if (sen[1 - c[i]][j + 1])
				save[c[i]][t[i]][j]++;
		}
		sen[c[i]][t[i]] = 1;
	}
	for (int i = 0; i <= n; i++)
		for (int j = 0; j <= n; j++) {
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + save[0][i + 1][j]);
			dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + save[1][j + 1][i]);
		}
	cout << dp[n][n] + res << endl;
	
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
    string o, e; cin >> o >> e;

    for(int i = 0; i < max(o.size(), e.size()); i++){
        if(o[i]) cout << o[i];
        if(e[i]) cout << e[i];
    }
    cout << endl;
}


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

long h,w,a,b,ans,mod=1000000007;
vector<long> fac(210000);

long modpow(long modpow_x,long modpow_y) {
  long modpow_return=1;
  for(long i=1;i<=modpow_y;i*=2) {
    if(modpow_y/i%2==1) modpow_return=modpow_return*modpow_x%mod;
    modpow_x=modpow_x*modpow_x%mod;
  }
  return modpow_return;
}

long ncr(long n,long r) {
  return fac[n]*modpow(fac[r],mod-2)%mod*modpow(fac[n-r],mod-2)%mod;
}

int main() {
  cin >> h >> w >> a >> b;
  fac[0]=1;
  fac[1]=1;
  for(long i=2;i<210000;i++) fac[i]=fac[i-1]*i%mod;
  ans=ncr(h+w-2,h-1);
  for(long i=1;i<=b;i++) {
    ans=(ans+mod-(ncr(h-a+i-2,h-a-1)*ncr(w-i+a-1,a-1)%mod))%mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4700
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;


void eating_symbols_easy()
{
  string s;
  cin >> s;

  int cnt = 0;
  for (int i = 0; i < 4; ++i)
  {
    if (s[i] == '+') ++cnt;
    else --cnt;
  }
  cout << cnt << "\n";
}


void multiple_of_2_and_n()
{
  int n;
  cin >> n;

  if (n % 2 == 0) cout << n << "\n";
  else cout << 2 * n << "\n";
}


void task_scheduling_problem()
{
  vector<int> a(3);
  for (int i = 0; i < 3; ++i) cin >> a[i];

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

  cout << a[2] - a[0] << "\n";
}


void rated_for_me()
{
  int r;
  cin >> r;

  if (r < 1200) cout << "ABC\n";
  else if (r < 2800) cout << "ARC\n";
  else cout << "AGC\n";
}


void atcoder_crackers()
{
  int n, k;
  cin >> n >> k;

  if (n % k == 0) cout << 0 << "\n";
  else cout << 1 << "\n";
}


void garden()
{
  int a, b;
  cin >> a >> b;

  cout << (a - 1) * (b - 1) << "\n";
}


void train()
{
  int n, i;
  cin >> n >> i;

  cout << n - i + 1 << "\n";
}


void Pair()
{
  int k;
  cin >> k;

  if (k % 2 == 0) cout << k / 2 * k / 2 << "\n";
  else cout << k / 2 * (k / 2 + 1) << "\n";
}


int main()
{
  //eating_symbols_easy();
  //multiple_of_2_and_n();
  //task_scheduling_problem();
  //rated_for_me();
  //atcoder_crackers();
  //garden();
  //train();
  Pair();
}

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

using ll=int64_t;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DMP(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%" SCNd64,&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%" PRId64,x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341000];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341000];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

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

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

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;

void No(){
	cout<<"No"<<endl;
	exit(0);
}
void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}

signed main(){
	int n=read();
	vi a(n),b(n);
	REP(i,n)a[i]=read();
	REP(i,n)b[i]=read();
	int aSum=accumulate(ALL(a),int(0));
	int bSum=accumulate(ALL(b),int(0));
	if(aSum>bSum)No();
	int op=bSum-aSum;
	int req=0;
	REP(i,n)req+=(max(b[i]-a[i],int(0))+1)/2;
	if(req>op)No();
	else Yes();
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    int n;
    cin>>n;
    int h[n+5];
    int mx = ninf;
    int i;
    FOR0(i, n)  cin>>h[i];
    int ans = 0;
    FOR0(i, n)
    {
        if(h[i]>=mx) ans++;
        mx = MAX2(h[i], mx);
    }
    cout<<ans;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 256
{-# LANGUAGE OverloadedLists     #-}
{-# LANGUAGE OverloadedStrings   #-}
{-# LANGUAGE ScopedTypeVariables #-}

import           Control.Monad
import           Data.IORef
import           Data.Maybe
import qualified Data.Text     as T
import qualified Data.Text.IO  as T
import           System.IO

import qualified Data.Vector   as V

readT :: Read a => T.Text -> a
readT = read . T.unpack

getLineSpcVec :: Read a => IO (V.Vector a)
getLineSpcVec = do
  t <- T.getLine
  let xs = V.fromList $ map readT $ T.split (== ' ') t
  return xs

main :: IO ()
main = travelingPlan

diffAbsV :: V.Vector Int -> Int -> Int -> Int
diffAbsV xs i j = let xi = xs V.! i
                      xj = xs V.! j
                 in  abs $ xi - xj

travelingPlan :: IO ()
travelingPlan = do
  n   :: Int   <- readLn
  as' :: V.Vector Int <- getLineSpcVec
  let as = 0 `V.cons` as' `V.snoc` 0
  sumDiff <- newIORef (0 :: Int)
  forM_ ([0..n] :: [Int]) $ \i ->
    modifyIORef sumDiff (+ diffAbsV as i (i + 1))
  sumDiff <- readIORef sumDiff
  forM_ ([1..n] :: [Int]) $ \i -> do
    ans <- newIORef 0
    modifyIORef ans (+ (sumDiff - diffAbsV as (i - 1) i - diffAbsV as i (i + 1) + diffAbsV as (i - 1) (i + 1)))
    print =<< readIORef ans

Measured memory_bytes: 27004
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] sq = new int[n];
    for (int i = 0; i < n; i++) {
    	sq[i] = sc.nextInt();
    }
    int min = 0, max = 0;
    long sum = 0;
    for (int i = 0; i < sq.length; i++) {
    	if (i == 0) { min = sq[i]; max = sq[i]; }
    	if (sq[i] < min) { min = sq[i]; }
    	if (sq[i] > max) { max = sq[i]; }
    	sum += sq[i];
    }
    System.out.printf("%d %d %d\n", min, max, sum);
  }
}


Measured memory_bytes: 40940
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <atcoder/all>

#define F first
#define S second
//#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace atcoder;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 3000000;
const int K = 100000;
const int mod = 1e9 + 7;
int op(int a, int b){
    return max(a, b);
}
int e(){
    return -1;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, q;
    cin >> n >> q;
    vector <int> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    segtree <int, op, e> st(v);
    while(q--){
        int t;
        cin >> t;
        if (t == 1){
            int x, v;
            cin >> x >> v;
            st.set(x - 1, v);
        } else
        if (t == 2){
            int l, r;
            cin >> l >> r;
            cout << st.prod(l - 1, r) << endl;
        } else
        if (t == 3){
            int x, v;
            cin >> x >> v;
            cout << 1 + st.max_right (x - 1, [&](int y){ return (v > y);}) << endl;
        }
    }
}


Measured memory_bytes: 6172
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		long max = 0;
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
			max = Math.max(max, a[i]);
		}
		long half = 0;
		for(int i = 0; i < n; i++) {
			if(Math.abs(max / 2 - a[i]) < Math.abs(max / 2 - half)) {
				half = a[i];
			}
		}
		System.out.println(max + " " + half);
	}

}


Measured memory_bytes: 61196
package main


import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()

	s := make(map[string]bool)
	sum := 0
	for sc.Scan() {
		inputs := strings.Split(sc.Text(), " ")

		if inputs[0] == "0" {
			if !s[inputs[1]] {
				s[inputs[1]] = true
				sum++
			}
			fmt.Printf("%d\n", sum)
		} else if inputs[0] == "1" {
			if s[inputs[1]] {
				fmt.Println(1)
			} else {
				fmt.Println(0)
			}
		} else if inputs[0] == "2" {
			if s[inputs[1]] {
				s[inputs[1]] = false
				sum--
			}
		}
	}
}



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

int n;
int c[505] = {0};
int s[505] = {0};
int f[505] = {0};
int sum[505] = {0};

int main() {
  int i, j;
  cin >> n;
  for(i = 0; i < n - 1; ++i) cin >> c[i] >> s[i] >> f[i];
  for(i = n - 2; i >= 0; --i) {
    sum[i] = sum[i + 1];
    sum[i] += c[i];
  }
  for(i = 0; i < n; ++i) {
    if(i == n - 1)
      cout << 0 << endl;
    else {
      int ans = 0;
      for(j = i; j < n - 1; ++j) {
        if(ans < s[j]) ans = s[j];
        if(ans % f[j] != 0) ans = f[j] * ((ans / f[j]) + 1);
        ans += c[j];
      }
      cout << ans << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    long long int a[10000],  min=1000000, max=-1000000, sum=0;
    int n, i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%lld",&a[i]);
        if(a[i] >= max){
            max = a[i];
        }
        if(a[i] <= min){
            min = a[i];
        }
        sum+=a[i];
    }
    printf("%lld %lld %lld\n",min, max, sum);
    return 0;
}

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

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

ll power(ll x,ll y)
{
    ll res = 1;
    while(y>0){
        if(y&1)
            res *= x;
        y>>=1;
        x*=x;
    }
    return res;
}

void seive_prime(ll n)
{
    ll p[n+1]={0};
    for(ll i=2;i*i<=n;i++){
        if(p[i]==0){
            for(ll j=i*i;j<=n;j+=i){
                p[j]=1;
            }
        }
    }
    for(ll i=2;i<=n;i++)
        if(p[i]==0)
            cout<<i<<' ';
}
int main()
{
    string s;
    cin>>s;
    int cnt=0,q=0,r=0,cnt1=0;
    for(int i=0;i<(int)s.length();i++){
        if(!(i&1)){
            if(s[i]=='R' || s[i]=='U' || s[i]=='D')
                cnt++;
            q++;
        }
        else{
            if(s[i]=='L' || s[i]=='U' || s[i]=='D')
                cnt1++;
            r++;
        }
    }
    if(r==cnt1 && cnt==q){cout<<"Yes"<<'\n';}
    else {cout<<"No"<<'\n';}
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,m;
    cin>>n>>m;
    int num[50][3]={};
    char str[50][51];
    for(int i=0;i<n;i++){
    	for(int j=0;j<m;j++){
    		cin>>str[i][j];
    		if(str[i][j]=='W')num[i][0]++;
    		else if(str[i][j]=='B')num[i][1]++;
    		else num[i][2]++;
    	}
    }
    int ans=25000;
    for(int i=0,notw=0;i<n-2;i++){
    	notw+=num[i][1]+num[i][2];
    	for(int j=i+1,notb=0;j<n-1;j++){
    		notb+=num[j][0]+num[j][2];
    		for(int k=j+1,notr=0;k<n;k++){
    			notr+=num[k][0]+num[k][1];
    			if(k==n-1)ans=min(ans,notw+notb+notr);
    		}
    	}
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void solve(){
    ll x,z,a;
    cin>>x;
        if (x>2000)
            cout<<1;
        else
        {   
               a=x/100;
               if (a*5>=x%100)
                cout<<1;
               else
                cout<<0; 

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

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

vector<int> v[210];

int dep[210];
int d[210][210],dis[210],fa[210],col[210],n;
bool vis[210];
char s[210];

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

inline int bfs(int x)
{
	queue<int> q;
	vis[x]=1;q.push(x);
	dis[x]=1;
	while (!q.empty())
	{
		int x=q.front();q.pop();
		for (int t:v[x]) if (!vis[t]) dis[t]=dis[x]+1,q.push(t),vis[t]=true;
	}
	int res=0;
	for (int i=1;i<=n;i++) res=max(res,dis[i]);
	return res;
}

inline void pre_dfs(int x)
{
	vis[x]=true;
	for (int t:v[x]) if (!vis[t]) fa[t]=x,dep[t]=dep[x]+1,pre_dfs(t);
}

inline bool dfs1(int x)
{
	for (int t:v[x])
	{
		if (col[t]<0)
		{
			col[t]=col[x]^1;
			if (!dfs1(t)) return false;
		}
		else if (col[t]==col[x]) return false;
	}
	return true;
}

int main()
{
	n=rd();
	for (int i=1;i<=n;i++)
	{
		scanf("%s",s+1);
		for (int j=1;j<=n;j++) d[i][j]=s[j]-'0';
	}
	int tt=0;
	for (int i=1;i<n;i++) for (int j=i+1;j<=n;j++) if (d[i][j])
	{
		v[i].push_back(j);
		v[j].push_back(i);
		tt++;
	}
	if (tt==n-1)
	{
		int ans=0;
		for (int i=1;i<=n;i++)
		{
			memset(vis,false,sizeof(vis));
			ans=max(ans,bfs(i));
		}
		printf("%d\n",ans);
		return 0;
	}
	for (int i=1;i<=n;i++) col[i]=-1;
	col[1]=0;
	if (!dfs1(1)) { puts("-1");return 0; }
	int ans=0;
	for (int i=1;i<=n;i++) memset(vis,false,sizeof(vis)),ans=max(ans,bfs(i));
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
N, Y = map(int, input().split())
flg = 0

for i in range(N+1):
    for j in range(N + 1 - i):
        if i * 10000 + j * 5000 + (N - i - j) * 1000 == Y:
            ans = "{} {} {}".format(i,j,(N - i - j))
            flg = 1
            break
if flg:
    print(ans)
else:
    print("-1 -1 -1")



Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,b,ans;
    cin>>n>>a>>b;
    if(n==0 || a>b) ans=0;
    else if(n==1 && a==b) ans=1;
    else if(n==1 && a!=b) ans=0;
    else{
        ans=(a+(n-1)*b)-(b+(n-1)*a)+1;
    }
    cout<<ans<<endl;
    return 0;
}

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

#define rep(i,n) for (int i = 0; i< (n); ++i)
#define vvec(m,n) vector<vector<int>> (int(m), vector<int>(n))
#define ALL(a) (a).begin(), (a).end()

using ll = long long;

int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(char c:s){
        if(c == '+') ans++;
        else ans--;
    
    }
    cout << ans << endl;
}

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

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int s, w;
    cin >> s >> w;
    if(s <= w){
        cout << "unsafe";
    }else{
        cout << "safe";
    }
    return 0;
}


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

#define ll long long

using namespace std;


int m,Nmin,Nmax;

int P[205]={};


int main(){

    while(1){
        int ans = 0;
        scanf("%d %d %d",&m,&Nmin, &Nmax);
        if(m == 0 && Nmin == 0 && Nmax == 0) break;

        for(int i=0;i<m;i++){
            scanf("%d",&P[i]);
        }
        int max_gap = 0;
        for(int i=Nmin-1;i<Nmax;i++){
            int gap = P[i] - P[i+1];
            if(max_gap <= gap){
                max_gap = gap;
                ans = i+1;
            }
        }
        printf("%d\n",ans);
    }


}


Measured memory_bytes: 3160
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.TreeMap;
import java.util.*;

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

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

public class Main {
    static int[] w = new int[100010];
    static int[] v = new int[100010];
    static int[][] dp = new int[110][100010];
    static int k;

    static int chmin(int a, int b) {
        if (a > b) {
            a = b;
            return a;
        }
        return a;
    }

    static int chmax(int a, int b) {
        if (a < b) {
            a = b;
            return a;
        }
        return a;
    }

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int a = fs.nextInt();
        int b = fs.nextInt();
        int c = fs.nextInt();
        int k = fs.nextInt();
        int max = Math.max(Math.max(a, b), c);
        System.out.println(a + b + c + max * (int) Math.pow(2, k) - max);
    }

}


Measured memory_bytes: 79440
<?php

// define('DEBUG', true);
define('DEBUG', false);

function gcd($a, $b){
    if (DEBUG) echo "gcd($a, $b)\n";
    if($b == 0) {
        $ret = $a;
    } else {
        $ret = gcd($b, $a % $b);
    }
    if (DEBUG) echo "ret(gcd) = " . $ret . PHP_EOL;
    return $ret;
}

function lcm($a, $b){
    if (DEBUG) echo "lcm($a, $b)\n";
    $g = gcd($a, $b);
    $ret = $a / $g * $b;
    if (DEBUG) echo "ret(lcm) = " . $ret . PHP_EOL;
    return $ret; 
}

fscanf(STDIN, "%d", $N);

for ($i = 0; $i < $N; ++$i) {
    fscanf(STDIN, "%d", $a[$i]);
}

$ans = $a[0];

for ($i = 1; $i < $N; ++$i) {
    $ans = lcm($ans, $a[$i]);
}

echo $ans . PHP_EOL;


Measured memory_bytes: 4604
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
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<ll,pll> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
const int DX[8]={-1,0,1,0,-1,-1,1,1},DY[8]={0,-1,0,1,-1,1,-1,1};

int f(int x,int d){
	auto s=to_string(x);
	while(s.size()<d) s+='0';
	sort(s.begin(),s.end());
	auto t=s;
	reverse(t.begin(),t.end());
	return atoi(t.c_str())-atoi(s.c_str());
}

int main(){
	bool flag=0;
	while(1){
		int n;
		cin>>n;
		if(n==0) break;
		if(flag) cout<<endl;
		n/=10;
		int a,b,c,d,e[4]={1,5,10,50},res=inf,ans[4];
		cin>>a>>b>>c>>d;
		for(int i=0;i<=a;i++) for(int j=0;j<=b;j++) for(int k=0;k<=c;k++) for(int l=0;l<=d;l++) if(i+5*j+10*k+50*l>=n){
			int t=i+5*j+10*k+50*l-n;
			int x=a-i,y=b-j,z=c-k,w=d-l;
			bool B=1;
			if(t>=50){
				if(l) B=0;
				w+=t/50;
				t%=50;
			}
			if(t>=10){
				if(k) B=0;
				z+=t/10;
				t%=10;
			}
			if(t>=5){
				if(j) B=0;
				y+=t/5;
				t%=5;
			}
			if(t>=1){
				if(i) B=0;
				x+=t;
			}
			if(B&&x+y+z+w<res){
				res=x+y+z+w;
				ans[0]=i;
				ans[1]=j;
				ans[2]=k;
				ans[3]=l;
			}
		}
		for(int i=0;i<4;i++) if(ans[i]){
			cout<<e[i]*10<<' '<<ans[i]<<endl;
		}
		flag=1;
	}
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
using namespace std;

int dp[500][500];  // 区間[l, r)で取り除くことができるブロック数
int main() {
    int n;
    while (cin >> n, n) {
        vector<int> a(n);
        for (int i = 0; i < n; i++) cin >> a[i];
        memset(dp, 0, sizeof(dp));
        for (int b = 2; b <= n; b++) {
            for (int l = 0; l < n; l++) {
                int r = l + b;
                if (r > n) continue;
                if (dp[l + 1][r - 1] == b - 2 && abs(a[l] - a[r - 1]) <= 1) {
                    dp[l][r] = b;
                }
                for (int m = l; m <= r; m++) {
                    dp[l][r] = max(dp[l][r], dp[l][m] + dp[m][r]);
                }
            }
        }
        cout << dp[0][n] << endl;
    }
    return 0;
}


Measured memory_bytes: 3984
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

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


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int h, w;
  char s[256];
  int counter[26] = {};
  int cc[5] = {};
  
  scanf("%d%d",&h,&w);

  for(int i=0;i<h;i++){
    scanf("%s",s);

    for(int j=0;j<w;j++)
      counter[s[j]-'a']++;
  }

  for(int i=0;i<26;i++){
    cc[4] += counter[i]/4;
    cc[counter[i]%4]++;
  }

  bool ans = 0;

  cc[1] += cc[3];
  cc[2] += cc[3];
      
  if(h%2 == 0 && w%2 == 0){

    ans = cc[4]*4 == h*w;
    
  }else if(h%2 && w%2){
    ans = cc[1] == 1 && cc[2] <= (w/2 + h/2);
  }else{
    if(h%2 == 0) swap(h,w);
    ans = cc[1] == 0 && cc[2] <= w/2;
  }
  
  if(ans){
    puts("Yes");
  }else{
    puts("No");
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
   int N;
   cin >> N;
   int a[N], b[N], c[N];
   for (int i = 0; i < N; i++) {
      cin >> a[i] >> b[i] >> c[i];
   }
   int dp[3][N];
   dp[0][0] = a[0];
   dp[1][0] = b[0];
   dp[2][0] = c[0];
   for (int i = 1; i < N; i++) {
      dp[0][i] = max(dp[1][i - 1], dp[2][i - 1]);
      dp[0][i] += a[i];
      dp[1][i] = max(dp[2][i - 1], dp[0][i - 1]);
      dp[1][i] += b[i];
      dp[2][i] = max(dp[0][i - 1], dp[1][i - 1]);
      dp[2][i] += c[i];
   }
   cout << max(max(dp[0][N - 1], dp[1][N - 1]), dp[2][N - 1]) << endl;
   return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define int long long
#define INT_MAX INT64_MAX
#define INT_MIN INT64_MIN
#define PI 3.14159265358979323846
#define CLK clock_t clk = clock();//Start of main
#define OCLK cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';//End of main
#define MOD 1000000007
/* DEFINE cout */
#define pln cout << "===============================\n"
#define on cout<<"\n"
#define os cout<<" "
#define o2(a,b) cout<<a<<" "<<b
#define o(a) cout << a
#define bitcount __builtin_popcount
/* DEFINE cout */
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);//fastio
using namespace std;
struct hash_pair { // use pair as key in unordered_map<pair<int,int>,int,hash_pair>;
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
bool prime[10000001];
int P=MOD-2;
int factorial[10000001]={0};
int powerFunction(int x,int y){
    int res = 1;
    int p = MOD;
    x = x % p;
    while (y > 0){
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
void sieveFunction(int maxLimit){
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1]=false;
    for(int i=2; maxLimit >= i ; i++){
        if(prime[i]){
            for(int j=2*i ; maxLimit >= j ; j+=i)
                prime[j]=false;
        }
    }
}
void factorialFunction(int maxLimit){
    factorial[0]=1;
    for(int i=1 ; i <= maxLimit ; i++)
        factorial[i]=(factorial[i-1]*i)%MOD;
    return;
}
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
signed main(){
    char c;
    cin >> c;
    if(c >='A' && c<='Z'){
        cout << 'A' <<endl;
    }else{
        cout << 'a' << endl;
    }
}






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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const ll INF = 1LL<<60;
//int INF = numeric_limits<int>::max();

int main(int, char**) {
	int n; cin >> n;
	string s, t;
	cin >> s >> t;
	string ret = "";
	for (int i=0; i<n; i++) {
		ret = ret + s[i] + t[i];
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.array, std.string;
import std.algorithm;
import std.container;
import std.range;
import core.stdc.stdlib;
import std.math;

void main() {
  auto N = readln.chomp.to!int / 2;
  auto S = readln.chomp;

  auto T = S[0..N];
  writeln(T ~ T == S ? "Yes" : "No");
}


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

typedef long long ll;
typedef pair<int, int> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  ll a, b, c, d, n;
  cin >> a >> b >> c >> d >> n;

  ll m = a * 4;
  if(m > b * 2) m = b * 2;
  if(m > c) m = c;

  ll ans = n * m;
  if(n % 2 == 1) ans = min(ans, (n / 2) * d + m);
  else ans = min(ans, (n / 2) * d);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<bitset>
using namespace std;
int main(){
  string s;
  cin >>s;
  int n=s.size();
  int a[10000];
  int j=0;
  for(int i=0;i<10000;i++){
    a[i]=0;
     }
  for(int i=0;i<n;i++){
    if(s[i]=='T'){j++;}
    else{a[j]++;}
    };
  bitset<16001> dpx,dpy;
  dpx=dpy=1;
  dpx=dpx<<8000;
  dpy=dpy<<8000;
  dpx=dpx<<a[0];
  int i=1;
  while(i<8000){
    dpy=(dpy<<a[i])|(dpy>>a[i]);
    i++;
    dpx=(dpx<<a[i])|(dpx>>a[i]);
    i++;
    }
  int x,y;
  cin>>x>>y;
  if(dpx[x+8000]&&dpy[y+8000])
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
  }

      

Measured memory_bytes: 384
#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline

def main():
    A, B, C = map(int, input().split())
    ret = 0
    while True:
        if A%2!=0 or B%2!=0 or C%2!=0:
            break
        elif A==B and B==C:
            ret = -1
            break
        else:
            A, B, C = (B+C)//2, (C+A)//2, (A+B)//2
            ret += 1
    print(ret)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064