akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

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

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

int main() {
  // 前処理
  COMinit();

  ll n,k;
  cin>>n>>k;

  for(int i=1;i<=k;i++){
    ll r=k-i;
    ll m=n-k-i+1;
    ll sum=COM(r+i-1,i-1)*COM(m+i,i)%MOD;
    cout<<sum<<endl;
  }
  return(0);
}


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

int main(){
	int n, k;
	while(cin >> n >> k, n){
		vector<int> v(n);
		for(int i = 0; i < n; ++i){
			v[i] = i + 1;
		}

		int p = 0;
		while(v.size() > 1){
			p = (p + k - 1) % v.size();
			v.erase(v.begin() + p);
		}
		cout << v[0] << '\n';
	}
}

Measured memory_bytes: 1216
#include <climits>
#include <cstring>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <unordered_set>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <fstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define f first
#define s second

#define MM INT_MAX/5
#define MIM INT_MIN/2

int di[] = { 1,-1,0,0 };
int dj[] = { 0,0,1,-1 };

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define v vector
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize


const int MAX_N = 2e5;
ll BIT[1 + MAX_N];
v<ll> height;
v<ll> values;

void update(int idx, ll val) {
	for (; idx < MAX_N; idx = idx | (idx + 1)) {
		BIT[idx] = max(BIT[idx], val);
	}
}


ll query(int r) {
	ll ret = 0;
	ll val;
	for (; r >= 0; r = (r & (r + 1)) - 1) {
		ret = max(ret, BIT[r]);
	}
	return ret;
}

bool byHeight(int x, int y) {
	return height[x] < height[y];
}



int main()
{
	int N;
	cin >> N;
	height.assign(N+1, 0), values.assign(N+1, 0);
	for (int i = 0; i < N; i++)
		cin >> height[i];
	for (int i = 0; i < N; i++)
		cin >> values[i];
	v<int> indexes;
	for (int i = 0; i < N; i++) {
		indexes.push_back(i);
	}
	sort(indexes.begin(), indexes.end(), byHeight);
	int h1;
	for (int i : indexes) {
		update(i, query(i) + values[i]);
	}
	cout << query(N - 1);
}
 

Measured memory_bytes: 5876
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

void solve();
int main() {
	solve();
#ifdef DBG
	while (true);
#endif
}

void solve() {
	char s[5002];
	int k, len, index[5001];
	scanf("%s %d", s + 1, &k);

	s[0] = 0;
	index[0] = 0;
	for (len = 1; s[len] != 0; len++)
		index[len] = len;

	sort(index, index + len, [s](int a, int b) {
		while (true) {
			if (s[a] != s[b])
				return s[a] < s[b];
			a++, b++;
		}
	});

	int offset = 0;
	for (int i = 1; i <= len; i++) {
		int match = 0;
		while (s[index[i] + match] == s[index[i - 1] + match])
			match++;
		if (k <= offset + (len - index[i]) - match) {
			s[index[i] + match + (k - offset)] = 0;
			printf("%s\n", s + index[i]);
			break;
		}
		offset += (len - index[i]) - match;
	}
}

Measured memory_bytes: 384
n, m, l = gets.split.map(&:to_i)

a = n.times.map { gets.split.map(&:to_i) }
b = m.times.map { gets.split.map(&:to_i) }
b_t = b.transpose

a.each do |ai|
  row = b_t.map do |bj|
    ai.zip(bj).map {|i, j| i * j }.inject(:+)
  end
  puts row.join(' ')
end

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

int main() {
  int a, b, c, d;
  
  cin >> a;
  
  b = (a / 100) %2 ;
  c = (a / 10) % 2;
  d = a % 2;
  
  cout << b + c + d << endl;
}

Measured memory_bytes: 256
from collections import defaultdict
n = int(input())
s = input()
l=1
tmp = 0
while(l<n):
    dd = set()
    dd2 = set()
    for i in range(0, l):
        dd.add(s[i])
    for i in range(l, n):
        dd2.add(s[i])
    tmp = max(tmp, len(dd&dd2))

    l+=1
print(tmp)


Measured memory_bytes: 3316
from sys import stdin


def main():
    readline = stdin.readline
    read = stdin.read
    N, Q = map(int, readline().split())
    S = readline().strip()
    *LR, = map(lambda x: int(x) - 1, read().split())
    AC = []
    pre = None
    cnt = 0
    for c in S:
        if c == "A":
            pre = "A"
        elif pre == "A" and c == "C":
            cnt += 1
            pre = None
        elif pre == "A":
            pre = None
        AC.append(cnt)
    for l, r in zip(*[iter(LR)] * 2):
        print(AC[r] - AC[l])
    return


main()


Measured memory_bytes: 23648
#include <iostream>

using namespace std;

int H, W;
char map[8][8];
char used[8][8];

int main(void)
{
	cin >> H >> W;
	for(int y = 0; y < H; y++){
		for(int x = 0; x < W; x++){
			cin >> map[x][y];
		}
	}
	
	int cx = 0, cy = 0;
	while(1){
		used[cx][cy] = true;
		if(cx < W-1 && map[cx+1][cy] == '#') cx++;
		else if(cy < H-1 && map[cx][cy+1] == '#') cy++;
		else break;
	}
	
	for(int x = 0; x < W; x++){
		for(int y = 0; y < H; y++){
			if(map[x][y] == '#' && !used[x][y]){
				cout << "Impossible" << endl;
				return 0;
			}
		}
	}
	cout << "Possible" << endl;
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>){
    val line: String = readLine() as String
    val nm=line.split(" ")
    val n = nm[0].toInt()
    val k = nm[1].toInt()
    var count:Long = 0
    for(b in k+1..n){
        count+=(n/b)*(b-k)
        if(n%b-k+1>0){
            count +=( n%b-k+1)
        }
    }
    if(k==0)count-=n
    print(count)
}

Measured memory_bytes: 36332
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<math.h>
#include<cstring>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;

void generate(vector<int> &vec, int i){
    int j = i;
    rep(i,vec.size()){
        switch (j) {
            case 0:
                //ゼロはじまり
                vec.at(i) = 0;
                j++;
                break;
            case 1: vec.at(i) = 1;
                j--;
                break;
        }
    }
}

int solve(vector<int> vec1,vector<int> vec2){
    int count = 0;
    rep(i,vec1.size()){
        count += abs(vec1.at(i) - vec2.at(i));
    }
    
    return count;
}

int main() {
    
    string S;
    cin >> S;
    
    vector<int> origin(S.size());
    
    rep(i,S.size()){
        switch (S.at(i)) {
            case '0': origin[i] = 0;
                break;
            default: origin[i] = 1;
                break;
        }
    }
    
    vector<int> op1(S.size()),op2(S.size());
    
    generate(op1,0);
    generate(op2,1);
    
    cout << min(solve(op1,origin), solve(op2,origin)) << endl;
}


Measured memory_bytes: 3200
n = int(input())
a = list(map(int,input().split(" ")))

o = []

for b in [-1,1]:
    c = 0
    s = [0]*n
    for i in range(0,n):
        s[i] = a[i] + (i and s[i-1])
        if s[i] == 0 or s[i] < 0 < b or b < 0 < s[i]:
            c += abs(s[i] - b)
            s[i] = b
        b *= -1
    o.append(c)

print(min(o))

Measured memory_bytes: 14212
/// Swift5 -> Swift2.2

extension String {
    // split(separator:maxSplits:omittingEmptySubsequences:)
    func split(separator separator: Character) -> [String] {
        return self.characters.split(separator).map(String.init)
    }
}
extension Array {
    // init(repeating:count:)
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
    // lastIndex(where:)
    func lastIndex(where predicate: (Element) -> Bool) -> Int? {
      	for i in stride(from: count - 1, through: 0, by: -1) {
          	if predicate(self[i]) {
              	return i
            }
        }
      	return nil
    }
}
extension Array where Element: Comparable {
    // sorted()
    func sorted() -> [Element] {
        return self.sort( { $0 < $1 } )
    }
    // max()
    func max() -> Element? {
        guard self.count > 0 else { return nil }
        return self.reduce(self.first!) { return Swift.max($0, $1) }
    }
}
extension String {
    // Sequence#enumerated()
  	// public func enumerate<Seq : SequenceType>(base: Seq) -> EnumerateSequence<Seq>
    func enumerated() -> EnumerateSequence<[Character]> {
        return Array(self.characters).enumerate()
    }
}
// stride(from:through:by:)
func stride(from start: Int, through end: Int, by stride: Int) -> StrideThrough<Int> {
    return start.stride(through: end, by: stride)
}
// stride(from:to:by)
func stride(from start: Int, to end: Int, by stride: Int) -> StrideTo<Int> {
    return start.stride(to: end, by: stride)
}

/// end


let input = readLine()!.split(separator: " ").map { Int($0)! }
let a = input[0]
let b = input[1]

let diff = b - a
let lengthOfEast = (diff + 1) * diff / 2

print(lengthOfEast - b)


Measured memory_bytes: 4208
use std::io;

fn gets() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let line = gets();
    let mut it = line.trim().split_whitespace();
    let a = it.next().unwrap().parse::<i32>().unwrap();
    let op = it.next().unwrap();
    let b = it.next().unwrap().parse::<i32>().unwrap();
    if op == "+" {
        println!("{}", a + b);
    } else {
        println!("{}", a - b);
    }
}


Measured memory_bytes: 4352
#D
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
A.pop()

count = 0
result = 0

for i in A:
    count += 1
    if count == 1:
        result += i
    elif count < len(A):
        result += i * 2
        count += 1
    elif count == len(A):
        result += i
    else:
        break 

    
print(result)

Measured memory_bytes: 31000
W=str(input())
Sw=list(W)
Sw.append(" ")
Sw.insert(0," ")
Lw=list(W.upper())
Lw.append(" ")
Lw.insert(0," ")
x=0
while True:
    T=str(input())
    if T=='END_OF_TEXT':
        break
    elif T.find(Sw[1])==-1 and T.find(Lw[1])==-1:
        pass
    else:
        t=list(T)
        t.append(" ")
        t.insert(0," ")
        for i in range(len(t)):
            if t[i]==Sw[0] or t[i]==Lw[0]:
                if i+len(Sw)>len(t):
                    break
                else:
                    for j in range(len(Sw)):
                        y=0
                        if t[i+j]!=Sw[j] and t[i+j]!=Lw[j]:
                            break
                        else:
                            y+=1
                    x+=y
print(x)


Measured memory_bytes: 5564
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main(){
   int n, k;
   cin >>n >> k;
   if(n%k==0) cout << 0 << endl;
   else cout << 1 << endl;
}


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

using namespace std;
typedef long long ll;

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

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

int main() {
  ll A; cin >> A;
  ll B; cin >> B;
  ll C; cin >> C;
  ll D; cin >> D;
  ll CD = lcm(C, D);
  ll AC = (A-1)/C;
  ll AD = (A-1)/D;
  ll ACD = (A-1)/CD;
  ll BC = B/C;
  ll BD = B/D;
  ll BCD = B/CD;
  cout << (B-BC-BD+BCD) - (A-AC-AD+ACD) + 1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

VI a,v;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    a.resize(n);
    REP(i,n) cin >> a[i];
    reverse(ALL(a));

    // lis
    REP(i,n) {
        if(v.size()==0) v.push_back(a[i]);
        else {
            if(v.back()<=a[i]) v.push_back(a[i]);
            else {
                *upper_bound(ALL(v),a[i])=a[i];
            }
        }
    }
    cout << v.size() << '\n';
    return 0;
}

Measured memory_bytes: 1276
#include <iostream>

using namespace std;

int main()
{	
	int W, H, x, y, r;
	
	cin >> W >> H >> x >> y >> r;

	if ((0 <= (x-r) && (x+r) <= W) && (0 <= (y-r) && (y+r) <= H)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}


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

using namespace std;

typedef long long LL;
#define N 300000

const LL mod=1000000007;
LL n,m,p,ans,f[N];
char s[N];

void upd(LL &x,LL y){x=(x+y)%mod;}

int main(){
	scanf("%lld%lld%s",&n,&m,s+1);
	if (s[1]=='B') for (LL i=1;i<=m;++i) s[i]=s[i]=='B'?'R':'B';
	p=n;
	ans=1;
	for (LL i=1,j=0,fst=0;i<=m;++i){
		if (s[i]=='R') ++j;
		else{
			ans=0;
			if (!fst) p=min(p,j&1?j:j+1);
			fst=1;
			if (j&1) p=min(p,j);
			j=0;
		}
	}
	if (!ans&&(n&1)){puts("0"); return 0;}
	if (ans){
		ans=0;
		f[1]=1;
		for (LL i=2;i<=n;++i) f[i]=(f[i-1]+f[i-2])%mod;
		upd(ans,f[n]+f[n-1]*2);
	}
	else{
		p=(p+1)/2;
		f[0]=1;
		for (LL i=1,j=0,k=0;i<=n/2;++i){
			upd(k,f[i-1]);
			if (j<i-p){upd(k,-f[j]); ++j;}
			upd(f[i],k);
		}
		for (LL i=2;i<=n&&i<=p*2;i+=2) upd(ans,i*f[(n-i)/2]);
	}
	printf("%lld\n",(ans+mod)%mod);
	
	return 0;
}
			

Measured memory_bytes: 2048
import java.util.*;
import static java.lang.System.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		B(sc);
	}
	
	public static void A(Scanner sc) {
		int a = sc.nextInt();
		int b = sc.nextInt();
		if((a*b)%2==1) out.println("Odd");
		else out.println("Even");
	}
	
	public static void B(Scanner sc) {
		String s1 = sc.next();
		String s2 = sc.next();
		int x = Integer.parseInt(s1+s2);
		for(int i=0;Math.pow(i,2)<=x;i++) {
			if(Math.pow(i, 2)==x) {
				out.println("Yes");
				return;
			}
		}
		out.println("No");
	}
}

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

using ll = long long;

int main() {
    ll N, T;
    cin >> N >> T;
    ll off = 0;
    ll ans = 0;
    for(int i = 0; i < N; i++) {
        int t;
        cin >> t;
        if(off <= t) ans += T;
        else ans += (t + T - off);
        off = t + T;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<iomanip>

using namespace std;
const double Rad_to_deg = 45.0/atan(1.0);
int main() {
	double a, b, c;
	cin>>a>>b>>c;
	double d = sqrt(a*a + b*b - 2*a*b*cos(c/Rad_to_deg));

	cout<<fixed<<setprecision(5)<<a*b*0.5*sin(c/Rad_to_deg)<<endl;
	cout<<fixed<<setprecision(5)<<a+b+d<<endl;
	cout<<fixed<<setprecision(5)<<(a*b*sin(c/Rad_to_deg))/a<<endl;
	//cout<<cos(c/Rad_to_deg);
	return 0;
}


Measured memory_bytes: 3564
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, A: "List[int]"):
    if sum(A) > N:
        print(-1)
        return 

    print(N-sum(A))
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()


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

Measured memory_bytes: 256
ans = []
while True:
    n = input()
    if n == 0:
        break
    c = 1
    N = n*n
    circle = [0]*N
    p = (N+1)/2-1
    while c <= N:
        if p == N:
            p = 1
        elif p % n == 0:
            p += 1
        elif p+n > N:
            p -= (N-n-1)
        else:
            p += n+1
        
        if circle[p-1] != 0:
            while circle[p-1] != 0:
                if p == N-n+1:
                    p = n
                elif p-1 % n == 0:
                    p += (n*2 -1)
                elif p+n > N:
                    p -= N - n + 1
                else:
                    p += n-1

        circle[p-1] = c
        c += 1
    p = 0
    temp = ''
    while p*n != N:
        temp += ''.join(map(lambda x:str(x).rjust(4),circle[n*p:n*(p+1)]))
        temp += '\n'
        p += 1
    ans.append(temp.rstrip())
for i in ans:
    print i

Measured memory_bytes: 4272
# -*- coding:utf-8 -*-

def solve():
    N = int(input())
    A = list(map(int, input().split()))

    # 累積和で解く
    # ruiseki[i] := i番目までの累積和(0 <= i <= N-1)
    ruiseki = [0] * N
    ruiseki[0] = A[0]
    for i in range(1, N):
        ruiseki[i] = ruiseki[i-1] + A[i]
    
    min_diff = float("inf") # xとyの最小差
    for i in range(0, N-1):
        x = ruiseki[i]
        y = ruiseki[N-1] - ruiseki[i]
        min_diff = min(min_diff, abs(x-y))
    
    print(min_diff)

if __name__ == "__main__":
    solve()


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

int main()
{
    int N, M;
    int K[10];
    int S[10][10];
    int P[10];
    int i, j, k;
    int x;
    int count;

    cin >> N >> M;
    for(i = 0; i < M; i++) {
        cin >> K[i];
        for(j = 0; j < K[i]; j++) {
            cin >> S[i][j];
        }
    }
    for(i = 0; i < M; i++) {
        cin >> P[i];
    }

    count = 0;
    for(i = 0; i < (1<<N); i++) {
        //cout << "i: " << i << endl;
        for(j = 0; j < M; j++) {
            //cout << "j: "<< j << endl;
            x = 0;
            for(k = 0; k < K[j]; k++) {
                //cout << "i: " << i << "  -  S[j][k]" << S[j][k] << endl;
                if((i & (1<<(S[j][k]-1))) != 0) {
                    x += 1;
                }
            }
            if(P[j] != x%2) {
                break;
            }
        }
        if(j == M) {
            count += 1;
        }
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
const int nmax=1e5+10;
int main(){
	int n;
	scanf("%d",&n);
	vector<pair<int,int> > ans;
	for(int i=1;i<=n;i++){
		int tmp;scanf("%d",&tmp);
		ans.push_back(make_pair(tmp,i));
	}
	sort(ans.begin(),ans.end());
	for(auto it=ans.begin();it!=ans.end();it++){
		printf(it==ans.begin()?"%d":" %d",it->second);
	}
	return 0;
}

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

using namespace std;

const int MAX_N=2e5+20,MAX_M=2e5+20;
int a[MAX_M],b[MAX_M];
bool c[MAX_N],d[MAX_N];

int main()
{
    //INPUT
    int n,m;
    cin >> n >> m;
    for(int i=0;i<m;i++)
    {
        cin >> a[i] >> b[i];
    }
    //SOLVE
    for(int i=0;i<m;i++)
    {
        if(a[i]==1)
        {
            c[b[i]]=1;
        }
        else if(a[i]==n)
        {
            d[b[i]]=1;
        }
        if(b[i]==1)
        {
            c[a[i]]=1;
        }
        else if(b[i]==n)
        {
            d[a[i]]=1;

        }
    }
    bool ans=0;
    for(int i=2;i<n;i++)
    {
        if(c[i]==1 && d[i]==1)
        {
            ans=1;
        }
    }
    //OUTPUT
    cout << (ans ? "POSSIBLE":"IMPOSSIBLE");
}


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

ll ogcd(ll a,ll b){
    if(a<b)return ogcd(b,a);
    if(a%b != 0){
        return ogcd(b,a%b);
    }else{
        return b;
    }
}

int main() {
    ll n;
    std::cin >>n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    
    map<ll,ll> cou;
    
    
    for (int i = 0; i < n; i++) {
        for (int j = 2; j <= 1000; j++) {
            ll current = 0;
            while(a[i]%j==0){
                current++;
                a[i]/=j;
            }
            if( cou[j] < current ){
                cou[j] = current;
            }
        }
    }
    ll result = 1;
    for (auto e : cou) {
        result *= pow(e.first,e.second);
    }
    std::cout << result << std::endl;
}



Measured memory_bytes: 3348
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

int main(){
  int N; cin >> N; ll a[N];
  rep(i, N){
    cin >> a[i];
  }
  sort(a, a+N); ll pm = 0, mp = 0;
  if(N%2){
    rep(i, N){
      if(i<N/2) pm-=(2*a[i]);
      else if(i==N/2 || i==(N+1)/2) pm+=a[i];
      else pm+=(2*a[i]);
    }
    rep(i, N){
      if(i<N/2 - 1) mp-=(2*a[i]);
      else if(i==N/2 - 1 || i==N/2) mp-=a[i];
      else mp+=(2*a[i]);
    }
    //cout << mp <<  " " << pm << endl;
    cout << max(pm, mp) << endl; return 0;
  }
  rep(i, N){
    if(i<N/2 - 1) mp-=(2*a[i]); 
    else if(i==N/2 - 1) mp-=a[i];
    else if(i==N/2) mp+=a[i];
    else mp+=(2*a[i]);
  }
  cout << mp << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n, A[101], ca = 0, i, temp=0;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> A[i];
	}
	for (i = 0; i < n; i++) {
		if (1 == A[i]) {
			ca++;
			temp = max(temp, ca);
		}
		else {
			ca = 0;
		}
	}
	printf("%d\n", temp+1);
	return EXIT_SUCCESS;
}




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



int main(){
    string S;
	cin>>S;
	bool app[26];
	for (int i = 0; i < 26; ++i) {
		app[i] = false;
	}
	for (int i = 0; S[i] != '\0'; ++i) {
		app[S[i] - 'a'] = true;
	}
	for (int i = 0; i < 26; ++i) {
		if (!app[i]) {
			printf("%c\n", (char)(i + 'a'));
			return 0;
		}
	}
	puts("None");
	return 0;
}

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

#define TIMES(cnt,s,e) for(int cnt=s; cnt<e; ++cnt)



int main(void){

	int h,w;
	string s;

	cin >> h >> w;
	TIMES(i,0,h) {
		TIMES(j,0,w) {
			cin >> s;
			if(s == "snuke") {
				cout << (char)(65+j) << i+1 << endl;				
			}		
		}
	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string a,b;cin>>a>>b;
	for(int i=0;i<min(a.size(),b.size());i++){
		cout<<a[i]<<b[i];
	}if(a.size()!=b.size()){
		cout<<a[a.size()-1]<<endl;
	}else{
		cout<<endl;
	}
}

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

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }
const int INF = 0x3f3f3f3f;

int main() {
	for (int N, M; cin >> N >> M&&N;) {
		vector<int> maxi(N), mini(N);
		rep(i, 0, M) {
			int S, k; cin >> S >> k;
			if (k == 1) {
				int c; cin >> c; c--;
				mini[c] += S;
				maxi[c] += S;
			}
			else {
				rep(j, 0, k) {
					int c; cin >> c; c--;
					maxi[c] += S;
				}
			}
		}
		using P = pair<int, int>;
		vector<P> maxi2(N), mini2(N);
		rep(i, 0, N) {
			maxi2[i] = P(maxi[i], i);
			mini2[i] = P(mini[i], i);
		}
		sort(all(maxi2));
		reverse(all(maxi2));
		sort(all(mini2));

		int ans = 0;
		rep(i, 0, 2)rep(j, 0, 2) {
			if (mini2[i].second == maxi2[j].second)
				continue;
			chmax(ans, maxi2[j].first - mini2[i].first + 1);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3204
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;

class EdgeData//辺
{
  internal int cap, flow;
  public EdgeData(){}
  public EdgeData(int cap, int flow)
  {
    this.cap = cap;
    this.flow = flow;
  }
}

class EdmondsKerp
{
  enum Color {White, Gray, Black}
  int n;
  int INFTY = int.MaxValue;
  EdgeData[,] G;
  int[] parent;
  int[] minCap;
  Color[] color;
 
  public EdmondsKerp(int V)
  {
    n = V;
    G = new EdgeData[n, n];
    for (int i = 0; i < n; i++)
    {
      for (int j = 0; j < n; j++)
      {
        G[i, j] = new EdgeData();
      }
    }
    parent = new int[n];
  }
 
  public void AddEdge(int from, int to, int cap)//辺を加える。引数は、始点、終点、容量。
  {
    G[from, to] = new EdgeData(cap, 0);
    G[to, from] = new EdgeData(0, cap);
  }
 
  public int MaxFlow(int s, int t)//最大流を求める
  {
    int maxFlow = 0;
    while (BFS(s, t))
    {
      maxFlow += minCap[t];
      int v = t;
      while (v != s)
      {
        int u = parent[v];
        G[u, v].flow += minCap[t];
        G[v, u].flow -= minCap[t];
        G[u, v].cap -= minCap[t];
        G[v, u].cap += minCap[t];
        v = u;
      }
    }
    return maxFlow;
  }

  private bool BFS(int s, int t)
  {
    minCap = Enumerable.Repeat(INFTY, n).ToArray();
    color = new Color[n];
    Queue<int> que = new Queue<int>();
    que.Enqueue(s);
    color[s] = Color.Gray;
 
    while (que.Count > 0)
    {
      int v = que.Dequeue();
      for (int u = 0; u < n; u++)
      {
        if (color[u] == Color.White && G[v, u].cap > 0)
        {
          minCap[u] = Math.Min(minCap[v], G[v, u].cap);
          parent[u] = v;
          color[u] = Color.Gray;
          if (u == t) return true;
          que.Enqueue(u);
        }
      }
    }
    return false;
  }
}
 
class Program
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int V = int.Parse(input[0]);
    int E = int.Parse(input[1]);
    EdmondsKerp EK = new EdmondsKerp(V);//グラフの作成（引数は頂点数）
 
    for (int i = 0; i < E; i++)
    {
      input = Console.ReadLine().Split(' ');
      int u = int.Parse(input[0]);
      int v = int.Parse(input[1]);
      int c = int.Parse(input[2]);
      EK.AddEdge(u, v, c);//辺を加える（始点、終点、容量）
    }
    Console.WriteLine(EK.MaxFlow(0, V-1));//引数は始点と終点。最大流を求める。
  }
}



Measured memory_bytes: 20656
n,k=gets.split.map &:to_i
a=gets.split.map &:to_i
b=a.map {|x|(x+k-1)%k}
s=0
m={0=>[-1]}
ans=0
b.each_with_index {|x,i|
  s=(s+x)%k
  if m.key?(s) then
    idx = m[s].bsearch_index {|j| i-j<k}
    if idx != nil then
      ans += m[s].length - idx
    end
    m[s] << i
  else
    m[s] = [i]
  end
}
puts ans


Measured memory_bytes: 38668
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

vector<int> dx{1, 0, -1, 0, 1, -1, 1, -1};
vector<int> dy{0, 1, 0, -1, -1, 1, 1, -1};

vector<vector<int>> g;
int w, h;

vector<vector<bool>> seen;
void dfs(int x, int y){
  seen[y][x] = true;
  for(int i = 0; i < 8; ++i){
    int nx = x + dx[i];
    int ny = y + dy[i];
    if(nx < 0 || w <= nx || ny < 0 || h <= ny)continue;
    else if(!g[ny][nx])continue;
    else if(seen[ny][nx])continue;
    dfs(nx, ny);
  }
}

int main(){
  while(true){
    cin >> w >> h;
    if(w == 0 && h == 0)return 0;
    g = vector<vector<int>>(h, vector<int>(w));
    for(int i = 0; i < h; ++i){
      for(int j = 0; j < w; ++j){
        cin >> g[i][j];
      }
    }

    seen = vector<vector<bool>>(h, vector<bool>(w, false));
    int cnt = 0;
    for(int i = 0; i < h; ++i){
      for(int j = 0; j < w; ++j){
        if(seen[i][j])continue;
        if(!g[i][j])continue;
        dfs(j, i);
        ++cnt;
      }
    }

    cout << cnt << endl;
  }

  return 0;
}



Measured memory_bytes: 3152
<?php

while (($line = trim(fgets(STDIN))) !== '-1 -1 -1') {
    sscanf($line, '%d %d %d', $h, $m, $s);
    $max = 2 * 60 * 60;
    $now = $h * 60 * 60 + $m * 60 + $s;
    $diff = $max - $now;
    for ($i = 0; $i < 2; $i++) {
        $diff *= $i > 0 ? 3 : 1;
        $h = (int)($diff / (60 * 60));
        $m = (int)($diff % (60 * 60) / 60);
        $s = (int)($diff % (60 * 60) % 60);
        printf("%02d:%02d:%02d\n", $h, $m, $s);
    }
}

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

using namespace std;

int main(void) {
  int n, c, k;
  cin >> n >> c >> k;
  int t[n];
  for(int i = 0; i < n; i++) {
    cin >> t[i];
  }

  sort(t, t + n);

  int cur = 0;  // いま先頭にいる人
  int ans = 0;  // 必要なバスの台数
  while(cur < n) {
    int nex = cur;  // 今来たバスに何人乗るか
    // 空港に到着する人数, バスの定員, 怒り出す時間と次の客が到着する時間をチェック
    while(nex < n && nex - cur < c && t[nex] - t[cur] <= k) {
      nex++;
    }
    ans++;
    cur = nex;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cmath>
#include<complex>
#include<vector>
using namespace std;
typedef complex<int> xy_t;
int main()
{
  int n;
  double x,y,sum = 0.0;
  cin >> n;
  vector<xy_t> p(n);
  for( int i = 0; i < n; ++i){
    cin >> x >> y;
    p[i] = xy_t(x,y);
  }
  for( int i = 0; i + 2 < n; ++i){
    xy_t a = p[0],b = p[i + 1],c = p[i + 2];
    sum += ((conj(b - a)*(c - a)).imag())/2.0;
  }
  printf("%.1f\n",abs(sum));
}

Measured memory_bytes: 1244
using System;
using System.Linq;
using System.Collections.Generic;


namespace Test1 {

    class ClassMain {

        public static bool[] primes = Enumerable.Repeat(true, 123456 * 2 + 1).ToArray();

        public static void sieve() {
            primes[0] = false; primes[1] = false;
            for (int i = 2; i < primes.Length/2+1; i++) {
                if (primes[i]) {
                    for (int j = 2; j * i < primes.Length; j++) {
                        primes[i * j] = false;
                    }
                }
            }
        }


        public static void Main(String[] args) {
            sieve();

            string line;
            while ((line = Console.ReadLine()) != null) {
                //int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                //int n = ints[0]; 
                int n = int.Parse(line);                
                if(n==0){break;}
                //int m = ints[1];
                
                int cnt = 0;
                for (int i = n + 1; i <= 2 * n; i++) {
                    if (primes[i]) { cnt++; }
                }
                Console.WriteLine(cnt);
                



            }   
        }   
    }
}

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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	int n, m, a[100001] = {}, y[100001] = {0, 1};
	cin >> n >> m;
	rep(i, m) cin >> a[i];
	int next = a[0], it = 0;
	rep(i, n){
		bool danger = false;
		if(i + 1 == next){
			danger = true;
			if(it + 1 < m) next = a[++it];
		}
		if(!danger)
			if(i == 0)
				y[2] = 1;
			else
				y[i + 2] = (y[i] + y[i + 1]) % 1000000007;
		else
			y[i + 2] = 0;
	}
	// rep(i, n) cout << y[i + 2] << " ";
	cout << y[n + 1] << endl;
	return 0;
}

Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	s := nextLine()

	count := 0
	for i := 0; i <= n-3; i++ {
		if s[i:i+3] == "ABC" {
			count++
		}
	}
	fmt.Println(count)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define SZ(x) int(x.size())
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

const ll inf = 1e18;
ll n, s;

bool check(ll b) {
    ll aux = n, sum = 0;
    while (aux) {
        sum += aux % b;
        aux /= b;
    }
    return sum == s;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    cin >> n >> s;
    
    if (n == s) {
        cout << n+1 << endl;
        return 0;
    }
    
    ll ans = inf;
    
    for (ll b = 2; b <= n/b; ++b) {
        if (check(b)) {
            ans = b;
            break;
        }
    }
    
    for (ll d = 1; d <= (n-s)/d; ++d) {
        if ((n-s) % d == 0) {
            ll b = d + 1;
            if (check(b)) ans = min(ans, b);
            b = (n-s)/d + 1;
            if (check(b)) ans = min(ans, b);
        }
    }
    
    if (ans == inf) cout << "-1\n";
    else cout << ans << endl;
}


Measured memory_bytes: 3632
#pragma comment(linker, "/STACK:500000000")
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <time.h>
#include <queue>
#include <utility>
#include <vector>
using namespace std;

#define y0 y0ChloeGraceMoretz
#define y1 y1ChloeGraceMoretz
typedef long long ll;
int nextInt() { int n; scanf("%d", &n); return n; }
ll nextLong() { ll n; scanf("%lld", &n); return n; }
const double PI = acos(-1.0);
const double EPS = 1e-9;
const int INF = (int)2e9;
const int MOD = (int)1e9 + 7;


int main() {
	//freopen("in.txt", "rt", stdin);
	//freopen("out.txt", "wt", stdout);
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
		printf("0\n");
	} else {
		printf("%lld\n", min((ll)a * b, min((ll)a * c, (ll)b * c)));
	}
	return 0;
}

Measured memory_bytes: 256
for _ in [0] * int(raw_input()):
  h, m = map(int, raw_input().split(':'))
  x = abs(h*60 - m*11)
  if x>360:
    x=720-x
  if x<60:
    print 'alert'
  elif 180<=x:
    print 'safe'
  else:
    print 'warning'

Measured memory_bytes: 4200
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<stack>
#include<queue>

using namespace std;

struct Rect{int h; int w_pos;}; //w_position

int main(){
	int c[1401][1401];
	int t1[1401];
	int H,W;
	int ans=0,sbans;
	scanf("%d %d",&H,&W);
	for(int i=0;i<=H;i++) c[i][0]=0;
	for(int i=0;i<=W;i++) c[0][i]=0;
	for(int i=0;i<=W;i++) t1[i]=0;
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			scanf("%d ",&c[i][j]);
			if(c[i][j]==0) c[i][j]=1;
			else c[i][j]=0;
		}
	}
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			if(c[i][j]==1)
			c[i][j]=c[i-1][j]+1;
			else
			c[i][j]=0;
		}
	}
	for(int i=1;i<=H;i++){
		stack<Rect> s;
		sbans=0;
		for(int j=1;j<=W+1;j++){
			Rect rect;
			rect.h = c[i][j];
			rect.w_pos = j;
			if(s.empty()) s.push(rect);
			else{
				if(s.top().h < rect.h) s.push(rect);
				else if(s.top().h > rect.h){
					int t=j;
					while(!s.empty() && s.top().h >= rect.h){
						Rect pre=s.top();
						s.pop();
						int area=pre.h * (j-pre.w_pos);
						sbans = max(sbans,area);
						t=pre.w_pos;
					}
					rect.w_pos=t;
					s.push(rect);
				}
			}
		}
		ans=max(ans,sbans);
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 10876
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<iostream>
#include<ctime>
#include<cstdlib>
#define MP make_pair
#define fi first
#define se second 
#define pb push_back
#define rep(i,a,b) for(i=a;i<=b;i++)
using namespace std;
const int N=610;
bool vis[N][N];
int col[N][N];int f[N][N];
int sz[5];
vector<pair<int,int> > fob;
int n,m;

void dfs(int x,int y){
	int i,dx,dy;
	vis[x][y]=1;
	rep(i,0,(int)fob.size()-1){
		dx=x+fob[i].fi;
		dy=y+fob[i].se;
		if(0<=dx&&dx<2*n&&0<=dy&&dy<2*n&&!vis[dx][dy]){
			col[dx][dy]=col[x][y]^1;
			dfs(dx,dy);
		}
	}
}

void work(int D,int B){
	register int i,j;
	fob.clear();
	memset(vis,0,sizeof(vis));
	memset(col,0,sizeof(col));
	rep(i,0,2*n-1) rep(j,0,2*n-1) if(i*i+j*j==D){
		fob.pb(MP(i,j));
		fob.pb(MP(-i,j));
		fob.pb(MP(i,-j));
		fob.pb(MP(-i,-j));
	}
	rep(i,0,2*n-1)	rep(j,0,2*n-1) if(!vis[i][j]) dfs(i,j);
	rep(i,0,2*n-1)	rep(j,0,2*n-1) if(col[i][j]) f[i][j]^=B;
}

void print(int ty){
	int cnt=0;
	int i,j;
	rep(i,0,2*n-1)	rep(j,0,2*n-1) if(f[i][j]==ty){
		cnt++;
		printf("%d %d\n",i,j);
		//cerr<<cnt<<endl;
		if(cnt==n*n)	return;
	}
} 

int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	//srand(20010102);
	register int i,j;
	int D;
	scanf("%d",&n);
	scanf("%d",&D);work(D,1);
	scanf("%d",&D);work(D,2);
	rep(i,0,2*n-1)	rep(j,0,2*n-1)	sz[f[i][j]]++;
	rep(i,0,3)	if(sz[i]>=n*n)	{print(i);return 0;}
	return 0;
}
























Measured memory_bytes: 20992
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

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

//最大公約数
long gcd(long a, long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}

//最小公倍数
long lcm(long a, long b){
	return (a*b) / gcd(a,b);
}

typedef long long ll;

ll a[300001];

int main(){
	ll n;
	
	cin >> n;
	
	REP(i,3*n){
		scanf("%lld", &a[i]);
	}
	
	sort(a,a+3*n);
	
	ll i = 3*n;
	
	ll ans = 0;
	
	REP(i,n){
		ans += a[3*n - (i+1)*2];
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 2560
h, w = [int(i) for i in input().split()]
squares = [list(input()) for _ in range(h)]

ans = 0
h_cnts = [0] * w
for i in reversed(range(0, h)):
    o_cnt = 0
    for j in reversed(range(0, w)):
        if squares[i][j] == 'I':
            h_cnts[j] += 1
        elif squares[i][j] == 'O':
            o_cnt += 1
        else:
            ans += h_cnts[j] * o_cnt
print(ans)


Measured memory_bytes: 85288
package main

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

// input に使うやつ
var rdr = bufio.NewReaderSize(os.Stdin, 10000)

func readLine() string {
	buf := make([]byte, 0, 10000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

// string から int へ
func atoi(s string) int {
	i, _ := strconv.Atoi(s)
	return i
}

// 一つの文字を int として読み込み
func readInt() int {
	return atoi(readLine())
}

// 複数の文字を int のスライスとして読み込み
func readInts() []int {
	in := readLine()
	ins := strings.Split(in, " ")
	out := make([]int, len(ins))
	for i, v := range ins {
		out[i] = atoi(v)
	}
	return out
}

// sortしたスライスを返す
func sorted(a []int) []int {
	b := make([]int, len(a))
	copy(b, a)
	sort.Ints(b)
	return b
}

// 逆順のsort
func reverse(a []int) []int {
	b := make([]int, len(a))
	copy(b, a)
	sort.Sort(sort.Reverse(sort.IntSlice(b)))
	return b
}

func main() {
	n := readInt()

	var c int
	for i := 1; i <= n; i++ {
		s := strconv.Itoa(i)
		if len(s)%2 != 0 {
			c++
		}
	}

	fmt.Println(c)
}


Measured memory_bytes: 1152
n=(int)(input())
a=input().split()
for i in range(n):
  a[i]=(int)(a[i])
  
sum=0
cur_height=a[0]
for i in range(1,n):
  if cur_height>a[i]:
    sum+=cur_height-a[i]
  else:
    cur_height=a[i]
    
print(sum)
  

Measured memory_bytes: 25068
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    set<int> st;
    for(int i = 0; i < 3; ++i) {
        cin >> n;
        st.insert(n);
    }
    if(st.size() == 2) puts("Yes");
    else puts("No");
    return 0;
}

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

using namespace std;

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

    vector<int> w;
    int temp;

    for(int i=0; i<n; i++)
    {
        cin>>temp;
        w.push_back(temp);
    }

    int minn = 1e9;
    int suml, sumr;
    for(int i=0; i<=n; i++)
    {
        suml = accumulate(w.begin(), w.begin()+i, 0);
        sumr = accumulate(w.begin()+i, w.end(), 0);
        //cout<<suml<<" "<<sumr<<endl;
        minn = min(minn, abs(suml-sumr));
    }

    cout<<minn;

    return 0;
}

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

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

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int str[100];
	int count;
	int i,N;
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf(" %d",&str[i]);
		
	}
	for(i=N-1;i>=1;i--)
	{
		printf("%d ",str[i]);
	}
	printf("%d\n",str[0]);
	return 0;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

int main() {
    lint N, X, M;
    cin >> N >> X >> M;

    vector<int> t(M, -1);
    vector<lint> S = {X};
    t[X] = 0;

    lint A = X;    
    for_(i,0,M) {
        A = (A * A) % M;
        if (t[A] == -1) {
            S.push_back(A);
            t[A] = i + 1;
        }
        else {
            break;
        }
    }

    int piv = t[A];
    lint ans = 0;
    int rep = (int)min(N, (lint)piv);
    for_(i,0,rep) ans += S[i];

    // cerr << ans << " " << A << " " << piv << " " << S.size() << endl;

    if (N - piv > 0) {
        N -= piv;
        int m = S.size() - piv;
        lint tmp = N / m;
        // cerr << N << " " << m << " " << tmp << endl;
        for_(i,piv,(int)S.size()) ans += S[i] * tmp;
        tmp = N % m;
        for_(i,piv,piv+(int)tmp) ans += S[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 4208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

const int PN = 2e6;
bool isprime[PN + 5];
vector<long long> prime;
void primechk() {
	for (int i = 2; i <= PN; i++) isprime[i] = true;
	for (long long i = 2; i <= PN; i++)
		if (isprime[i]) {
			prime.push_back(i);
			for (long long j = i * i; j <= PN; j += i)
				isprime[j] = false;
		}
}

map<ll, ll> mp;

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

	ll N; cin >> N;

	for (ll p : prime) {
		int cnt = 0;
		while (N % p == 0) N /= p, cnt++;
		if (cnt) mp[p] = cnt;
	}
	if (N != 1) mp[N] = 1;

	ll ans = 0;
	for (auto p : mp) {
		int cnt = p.second;
	//	cout << p.first << ' ' << p.second << '\n';
		for (int i = 1; cnt > 0; i++) {
			if (cnt - i < 0) break;
			cnt -= i;
			ans++;
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 7252
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  scanf("%d",&n);
  string s;
  cin>>s;
  map<char,int> mp;
  int cnt=0,ans=0;
  for(int i=0;i<n-1;i++){
    mp.clear();
    cnt=0;
    for(int j=0;j<=i;j++)
      mp[s[j]]++; 
    for(int j=i+1;j<n;j++)
      if(mp[s[j]]!=0)
        {cnt++;
         mp[s[j]]=0;}
      ans=max(ans,cnt);
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef long long int ll;

int main()
{
	ll N,a,sum=0;
	cin>>N;
	vector<ll>A(N);
	map<ll,ll>kai;
	for(ll i=0;i<N;i++)
	{
		cin>>A[i];
		sum+=kai[A[i]];
		kai[A[i]]++;
	}
	for(ll i=0;i<N;i++)
	{
		cout<<sum-kai[A[i]]+1<<endl;
	}
}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  string s; cin >> s;

  if(s.size()==2 && s[0] == s[1]){
    cout << s.size() << endl;
    return 0;
  }
  
  //rep(i,s.size()){
  while(true){
    auto end = s.end()-1;
    s.erase(end);
    int n = s.size();
    string left = "";
    string right = "";
    
    if(s.size()%2!=0) continue;
    
    /*left = s.substr(0,s.size()/2);
      right = s.substr(s.size()/2,s.size());*/
    
    rep(j,s.size()/2) left+=s[j];
    //for(int j = s.size()/2;j<s.size();j++) right+=s[j];
    for(int j = n/2;j<n;j++) right+=s[j];
    
    if(left==right && s.size()%2==0){
      cout << s.size() << endl;
      return 0;
    }
  }
  
  return 0;
}


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

typedef long long int ll;
typedef pair<ll, ll> pii;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fo(i,a,b) for(ll i = a; i<=b;i+=1)
#define rf(i,a,b)  for(ll i=a;i>=b;i--)
#define vll vector<ll>
#define sz(a) ll(a.size())
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front 
#define MAXN 100010
#define MOD 1000000007
#define mod 998244353
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define debug(x) cout << '>' << #x << ':' << x << " ";
#define nl '\n'
#define INF 1000000000000000000
#define IO                 \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0);
#define int long long int

void solve(){
    int k;
    cin >> k;
    f(i, 0, k){
        cout << "ACL";
    }
}
main()
{
    IO;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
	int T = 1;
    // cin >> T;
    fo(c, 1, T){
        solve();
        // cout<<"Case #"<<c<<": ";
    }
    return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;
public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int a = 0;
    
    while(n>0){
      n = n/k;
      a++;
    }
    System.out.println(a);
  }
}

Measured memory_bytes: 21972
#line 1 "test/DPL_5_K.test.cpp"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/library/7/DPL/5/DPL_5_K"
#line 1 "macro/macros.hpp"



#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;

template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

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

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;

const double PI = acos(-1.0);

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";


#line 3 "test/DPL_5_K.test.cpp"

/*
@title 玉区別しない、箱区別しない、1個以内(0 or 1)
@category 写像12相
*/
int main(){
    int n, k;
    cin >> n >> k;
    cout << ((n <= k) ? 1: 0) << endl;
}



Measured memory_bytes: 3216