akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;


int main(){
  long long int X;
  cin >> X;
  long long int num_500 = X/500;
  X -= num_500 * 500;
  long long int num_5 = X/5;
  cout << num_500*1000 + num_5*5 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
     
#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair
     
using namespace std;
     
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector <vi> g(n + 1);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].pb(v);
    g[v].pb(u);
  }
  vector <bool> vis(n + 1, false);
  int cnt = 0;
  function <void(int)> dfs = [&] (int u) -> void {
    cnt += 1;
    vis[u] = true;
    for (int v: g[u]) if (not vis[v]) dfs(v);
  };
  int ans = 0;
  for (int u = 1; u <= n; u++) {
    if (vis[u]) continue;
    cnt = 0;
    dfs(u);
    ans = max(ans, cnt);
  }
  cout << ans << '\n';
  return (0);
}


Measured memory_bytes: 26628
N = int(input())
S = input()
b = [0 for i in range(N+1)]
w = [0 for i in range(N+1)]
for i in range(N):
  b[i+1] = b[i] + (1 if S[i]=="#" else 0)
for i in range(N, 0, -1):
  w[i-1] = w[i] + (1 if S[i-1]=="." else 0)
print(min([b[i]+w[i] for i in range(N+1)]))

Measured memory_bytes: 27172
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

long double L;
cin >> L;
long double R = L/3;
cout << fixed << setprecision(10) << R*R*R << endl;

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define pii pair < int, int >
typedef vector<int> vi;
typedef   long long ll;
const int mod =1e9+7;
int used[1000005];
void solve(){
	int n;
	cin>>n;
	vi a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}		
	sort(all(a));
	int ans=0;
	for(int i=0;i<n;i++){
		int ok=1;
		int x=a[i];
		if(i+1<n){

			if(a[i+1]==a[i])ok=0,used[a[i]]=1;
			if(!ok)continue;
		}
		for(int j=1;j*j<=x;j++){
			if(x%j==0){
				if(used[j]){
					ok=0;
					break;
				}
				if(x/j!=j){
					if(used[x/j]){
						ok=0;
						break;
					}
				}
			}
		}
		used[a[i]]=1;
		//if(ok)cout<<a[i]<<' ';
		ans+=ok;
	}
	cout<<ans;
}


int main(){
	Red;
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}

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

signed main(){
  signed long long int A;
  cin >> A;
  long double B;
  cin >> B;
  signed long long int C;
  C=B/1;
  long double D;
  D=B-C;
  signed long long int E;
  E=A*C;
  long double F;
  F=A*D;
  unsigned long long int G;
  G=E+F;
  cout << G << endl;
}

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

int main() {
	int N;
	cin >> N;
	vector<bool> Direction(N,false);
	for (int i = 0; i < N; i++) {
		char c;
		cin >> c;
		Direction[i] = c == 'W';
	}
	int sum = 0;
	for (int i = 1; i < N; i++) if (!Direction[i]) sum++;
	int min = sum;

	for (int i = 1; i < N; i++) {
		if (Direction[i - 1]) sum++;
		if (!Direction[i]) sum--;
		min = min > sum ? sum : min;
	}
	cout << min;
}

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

int main(void){
  int a, b, c, d;
  double e;
  cin >> a >> b;
  c = a / b;
  d =  a % b;
  e = (double)a / b;
  cout << c << " "<< d << " " << fixed << setprecision(8) << e << endl;
  return 0;
}



Measured memory_bytes: 3268
#include <stdio.h>
#include <cstdio>
#include <vector>
#include <iostream>
#include <string.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

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

int main(){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (abs(c - a) <= d)cout << "Yes" << "\n";
	else {
		if (abs(a-b) <= d && abs(c - b) <= d)cout << "Yes" << "\n";
		else cout << "No" << "\n";
	}

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int t, h, m, s;
    cin >> t;
    h = t / 3600;
    m = (t % 3600) / 60;
    s = t - (h * 3600 + 60 * m);
    printf("%d:%d:%d\n", h, m, s);
}


Measured memory_bytes: 3176
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

int main() {
  ll N, D;
  cin >> N >> D;
  ll x = D + D + 1;

  cout << (N + x - 1) / x << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    int N, M; cin >> N >> M;
    if(N==M) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>

struct Point { double x, y; };

void koch(int n, Point a, Point b) {
	if (n == 0)return;

	Point s, t, u;
	double th = M_PI*60.0 / 180.0;

	s.x = (2.0*a.x + 1.0*b.x) / 3.0;
	s.y = (2.0*a.y + 1.0*b.y) / 3.0;
	t.x = (1.0*a.x + 2.0*b.x) / 3.0;
	t.y = (1.0*a.y + 2.0*b.y) / 3.0;
	u.x = (t.x - s.x)*cos(th) - (t.y - s.y)*sin(th) + s.x;
	u.y = (t.x - s.x)*sin(th) + (t.y - s.y)*cos(th) + s.y;

	koch(n - 1, a, s);
	printf("%.8f %.8f\n", s.x, s.y);
	koch(n - 1, s, u);
	printf("%.8f %.8f\n", u.x, u.y);
	koch(n - 1, u, t);
	printf("%.8f %.8f\n", t.x, t.y);
	koch(n - 1, t, b);
}

int main() {
	Point a,b;
	int n;

	scanf("%d", &n);

	a.x = 0;
	a.y = 0;
	b.x = 100;
	b.y = 0;

	printf("%.8f %.8f\n", a.x, a.y);
	koch(n, a, b);
	printf("%.8f %.8f\n", b.x, b.y);

	return 0;
	}

Measured memory_bytes: 2680
n=int(input())
x=list(map(int,input().split()))
sum0=10000000000000000

for i in range(1,101):
  sum1=0
  for j in range(n):
    sum1 += (x[j]-i)**2
    
  sum0=min(sum0,sum1)
    
print(sum0)


Measured memory_bytes: 3316
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    val B = readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    val C = readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    A.sort()
    B.sort()
    C.sort()


    fun lowerBound(list: IntArray, trg: Int) : Int {
        var ok = list.size
        var ng = -1

        while (Math.abs(ok - ng) > 1) {
            val mid = (ok + ng) / 2
            if (list[mid] >= trg) {
                ok = mid
            } else {
                ng = mid
            }
        }
        return ok
    }

    val bToC = IntArray(N)

    for (i in 0 until N) {
        val b = B[i]
        val index = lowerBound(C, b + 1)
        val counts = N - index
        bToC[i] = counts
    }
    val cumBtoC = LongArray(N + 1)
    cumBtoC[0] = 0
    for (i in 0 until N) {
        cumBtoC[i+1] = cumBtoC[i] + bToC[i]
    }

    var answer = 0L
    for (i in 0 until N) {
        val a = A[i]
        val index = lowerBound(B, a + 1)
        answer += (cumBtoC[N] - cumBtoC[index])
    }
    println(answer)
}


Measured memory_bytes: 107664
#include <cmath>
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

static vector<int64_t> monsters;

bool enough(int64_t num, int64_t a, int64_t b)
{
  int64_t extra_damages = 0;

  for (uint32_t i = 0; i < monsters.size(); i++) {
    if (monsters[i] > num * b) {
      extra_damages += ceil((monsters[i] - num * b) / (double)(a - b));
    }
  }
  return extra_damages <= num;
}

int32_t main()
{
  int64_t num, center, around;
  cin >> num >> center >> around;

  int64_t m = 0;
  for (int64_t i = 0; i < num; i++) {
    int64_t val;
    cin >> val;
    monsters.push_back(val);
    m = max(m, val);
  }

  int64_t l = 0, r = (m / around) + 1;
  while (l + 1 < r) {
    int64_t c = (l + r) / 2;
    if (enough(c, center, around)) {
      r = c;
    } else {
      l = c;
    }
  }

  cout << r << endl;

  return 0;
}


Measured memory_bytes: 1400
#include<stdio.h>
int main(void)
{
	int h,s=0,n,k,t=0,i,flg;
	while(1){
		flg=0;
		scanf("%d",&n);
		if(n==0)break;
		s=n;
		for(i=0;i<n;i++){
			scanf("%d",&k);
//			printf("%d\n",k);
			if(k==0){
				s=s-1;
			}
			if(k>=2){
				flg=1;
			}
		}
		if(flg==1){
			printf("%d\n",s+1);
		}
		else{
			printf("NA\n");
		}
		t=0;
	}
	return 0;
}

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

int main() {
  int n;
  cin>>n;
  vector<char> vec(n);
  bool ans=false;
  for(int i=0;i<n;i++){
    cin>>vec[i];
  }
  for(int i=0;i<n;i++){
    if(vec[i]=='Y'){
      ans=true;
    }
  }
  if(ans){
    cout<<"Four"<<endl;
  }
  else{
    cout<<"Three"<<endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

static class Program
{
    static int popcount(int n)
    {
        int count = 0;
        while (n > 0)
        {
            if ((n & 1) != 0) { ++count; }
            n /= 2;
        }
        return count;
    }

    static int f(int n)
    {
        if (n == 0) { return 0; }
        return f(n % popcount(n)) + 1;
    }

    static int mod(int a, int b)
    {
        return (a % b + b) % b;
    }

    static IEnumerable<int> Solve(int N, string X)
    {
        int C = X.Count(x => x == '1');
        var memo = new[] {
            new int[N],
            new int[N],
        };
        if (C - 1 > 0) { memo[0][0] = 1 % (C - 1); }
        if (C + 1 > 0) { memo[1][0] = 1 % (C + 1); }
        for (int i = 1; i < N; ++i)
        {
            if (C - 1 > 0) { memo[0][i] = (memo[0][i - 1] * 2) % (C - 1); }
            if (C + 1 > 0) { memo[1][i] = (memo[1][i - 1] * 2) % (C + 1); }
        }
        var sum = new int[2];
        for (int i = 0; i < N; ++i)
        {
            int j = N - i - 1;
            if (X[j] == '1')
            {
                if (C - 1 > 0) { sum[0] = (sum[0] + memo[0][i]) % (C - 1); }
                if (C + 1 > 0) { sum[1] = (sum[1] + memo[1][i]) % (C + 1); }
            }
        }
        var ans = new int[N];
        for (int i = 0; i < N; ++i)
        {
            int j = N - i - 1;
            if (X[i] == '1')
            {
                if (C - 1 > 0)
                {
                    ans[i] = f(mod(sum[0] - memo[0][j], C - 1)) + 1;
                }
                else
                {
                    ans[i] = 0;
                }
            }
            else
            {
                if (C + 1 > 0)
                {
                    ans[i] = f(mod(sum[1] + memo[1][j], C + 1)) + 1;
                }
                else
                {
                    ans[i] = 0;
                }
            }
        }
        return ans;
    }

    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string X = Console.ReadLine();
        foreach (var ans in Solve(N, X))
        {
            Console.WriteLine(ans);
        }
    }
}


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


using namespace std;


int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<long long int>>cost( N, vector<long long int>( N, LLONG_MAX / 6 ) );
	for( size_t i = 0; i < N; i++ ) {
		cost[i][i] = 0;
	}
	long long int ans = 0;
	map<pair<long long int, long long int>, long long int>memo;
	for( int i = 0; i < M; i++ ) {
		long long int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		if( a == b ) {
			ans++;
		} else {
			if( cost[a][b] != LLONG_MAX / 6 ) {
				ans++;
			}
			cost[a][b] = min( cost[a][b], c );
			cost[b][a] = cost[a][b];
			memo[make_pair( a, b )] = cost[a][b];
		}
	}
	for( size_t k = 0; k < N; k++ ) {
		for( size_t i = 0; i < N; i++ ) {
			for( size_t j = 0; j < N; j++ ) {
				cost[i][j] = min( cost[i][j], cost[i][k] + cost[k][j] );
				cost[j][i] = cost[i][j];
			}
		}
	}
	for( auto i : memo ) {
		if( cost[i.first.first][i.first.second] != i.second ) {
			ans++;
		}
	}
	cout << ans << endl;
}

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

int main() {
    // int n, m;
    // scanf("%d%d", &n, &m);
    // vector<vector<int>> a(n, vector<int>(m));
    // rep(i, n) {
    //     rep(j, m) {
    //         scanf("%d", &a[i][j]);
    //     }
    // }
    // vector<int> b(m);
    // rep(i, m) {
    //     scanf("%d", &b[i]);
    // }

    // vector<int> c(n);
    // rep(i, n) {
    //     int sum = 0;
    //     rep(j, m) {
    //         sum += a[i][j] * b[j];
    //     }
    //     c[i] = sum;
    //     printf("%d\n", c[i]);
    // }
    int n, m, l;
    scanf("%d%d%d", &n, &m, &l);
    vector<vector<int>> a(n, vector<int>(m));
    rep(i, n) {
        rep(j, m) {
            scanf("%d", &a[i][j]);
        }
    }
    vector<vector<int>> b(m, vector<int>(l));
    rep(i, m) {
        rep(j, l) {
            scanf("%d", &b[i][j]);
        }
    }

    vector<vector<long>> c(n, vector<long>(l));
    rep(i, n) {
        rep(j, l) {
            long sum = 0;
            rep(k, m) {
                sum += a[i][k] * b[k][j];
            }
            c[i][j] = sum;
            printf("%ld", c[i][j]);
            if (j != l-1) printf(" ");
        }
        printf("\n");
    }
}


Measured memory_bytes: 3408
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

class node{
public:
	int sum[11];
	int lazy[11];
	node(){
		for(int i=0;i<10;i++){
			sum[i]=0;
			lazy[i]=0;
		}
	}
};

int n,q;
int f[100001],t[100001];
vector<int> G[100001];
bool used[100001];
node seg[1<<20];
int cnt=0;
int wid=1;

void dfs(int v){
	used[v]=true;
	f[v]=cnt++;
	for(int i=0;i<G[v].size();i++){
		if(!used[G[v][i]]){
			dfs(G[v][i]);
		}
	}
	t[v]=cnt++;
}

int tmp[11];

inline void lazy_evaluate_node(int k){
	memset(tmp,0,sizeof(tmp));
	for(int i=0;i<10;i++){
		tmp[seg[k].lazy[i]]+=seg[k].sum[i];
	}
	for(int i=0;i<10;i++){
		seg[k].sum[i]=tmp[i];
	}
	if(k+1<wid){
		for(int i=0;i<10;i++){
			tmp[i]=seg[k*2+1].lazy[i];
		}
		for(int i=0;i<10;i++){
			seg[k*2+1].lazy[i]=seg[k].lazy[tmp[i]];
		}
		for(int i=0;i<10;i++){
			tmp[i]=seg[k*2+2].lazy[i];
		}
		for(int i=0;i<10;i++){
			seg[k*2+2].lazy[i]=seg[k].lazy[tmp[i]];
		}
	}
	for(int i=0;i<10;i++){
		seg[k].lazy[i]=i;
	}
}

inline void lazy_update_node(int k){
	for(int i=0;i<10;i++){
		seg[k].sum[i]=seg[k*2+1].sum[i]+seg[k*2+2].sum[i];
	}
}

void add(int k,int a){
	k+=wid-1;
	seg[k].sum[0]+=a;
	while(k>0){
		k=(k-1)/2;
		seg[k].sum[0]=seg[k*2+1].sum[0]+seg[k*2+2].sum[0];
	}
}

void update(int f,int t,int a,int b,int k=0,int l=0,int r=wid){
	lazy_evaluate_node(k);
	if(r<=a || b<=l)return;
	if(a<=l && r<=b){
		seg[k].lazy[f]=t;
		lazy_evaluate_node(k);
		return;
	}
	update(f,t,a,b,k*2+1,l,(l+r)/2);
	update(f,t,a,b,k*2+2,(l+r)/2,r);
	lazy_update_node(k);
}

int query(int x,int y,int a,int b,int k=0,int l=0,int r=wid){
	lazy_evaluate_node(k);
	if(r<=a || b<=l)return 0;
	if(a<=l && r<=b){
		int res=0;
		for(int i=x;i<=y;i++){
			res+=seg[k].sum[i];
		}
		return res;
	}
	int vl=query(x,y,a,b,k*2+1,l,(l+r)/2);
	int vr=query(x,y,a,b,k*2+2,(l+r)/2,r);
	lazy_update_node(k);
	return vl+vr;
}

int main(void){
	scanf("%d%d",&n,&q);
	for(int i=0;i<n-1;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		G[u].push_back(v);
	}
	memset(used,false,sizeof(used));
	dfs(0);
	while(wid<cnt+1)wid*=2;
	for(int i=0;i<wid*2-1;i++){
		for(int j=0;j<10;j++){
			seg[i].sum[j]=0;
		}
	}
	for(int i=0;i<n;i++){
		add(f[i],1);
	}
	for(int i=0;i<q;i++){
		int type,r,x,y;
		scanf("%d%d%d%d",&type,&r,&x,&y);
		if(type==1){
			int res=query(x,y,f[r],t[r]);
			printf("%d\n",res);
		}else{
			update(x,y,f[r],t[r]);
		}
	}
	return 0;
}

Measured memory_bytes: 102752
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

	ll n;
	cin >> n;
	vector<ll>a(n);
	vector<pair<ll,ll>>bucket(100010);
	rep(i, n)cin >> a[i];
	rep(i, bucket.size())bucket[i] = make_pair(0, i);
	for (ll i = 0;i < n;i++) {
		bucket[a[i] + 1].first++;
		bucket[a[i]].first++;
		if(a[i]>0)bucket[a[i] - 1].first++;
	}
	sort(all(bucket));
	cout << bucket[bucket.size()-1].first << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <sstream>
#include <vector>
#include <string>
#include <iomanip>
#include <bitset>
#define INF	100000000
#define pb	push_back
#define fi first
#define sec second
#define SS stringstream
using namespace std;
typedef pair<int, int> P;
typedef long long int	ll;

string str;

int main(){
	getline(cin, str);
	for(int i = 0; i < str.size()-4; i++){
		if(str[i] == 'a' && str[i+1] == 'p' && str[i+2] == 'p' && str[i+3] == 'l' && str[i+4] == 'e'){
			str[i] = 'p'; str[i+1] = 'e'; str[i+2] = 'a'; str[i+3] = 'c'; str[i+4] = 'h';
		}
		else if(str[i] == 'p' && str[i+1] == 'e' && str[i+2] == 'a' && str[i+3] == 'c' && str[i+4] == 'h'){
			str[i] = 'a'; str[i+1] = 'p'; str[i+2] = 'p'; str[i+3] = 'l'; str[i+4] = 'e';
		}
	}
	cout << str << endl;
}

Measured memory_bytes: 1168
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B = il()
    for n in range(1010):
        if int(n*0.08) == A and int(n*0.1) == B:
            print(n)
            exit()
    else:
        print(-1)



if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(1000000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    n = int(input())
    a = list(map(int,input().split()))
    l = [0]*n
    r = [0]*n
    for i in range(n):
        if i == 0:
            l[0] = a[0]
            r[n-1] =a[n-1]
        else:
            l[i] = gcd(a[i],l[i-1])
            r[n-i-1] = gcd(a[n-i-1],r[n-i])
    if n > 2:
        ans = max(r[1],l[n-2])
    else:
        ans = max(a)
    for i in range(1,n-1):
        ans = max(ans,gcd(l[i-1],r[i+1]))

    print(ans)
if __name__ == "__main__":
    main() 
    
#endline===============================================
    

Measured memory_bytes: 24152
package main

import (
	f "fmt"
	"strconv"
	"strings"
)

func main() {

	var a, b int
	f.Scan(&a, &b)

	i := strings.Repeat(strconv.Itoa(a), b)
	j := strings.Repeat(strconv.Itoa(b), a)



	if i <= j {
		f.Println(i)
	} else if j < i {
		f.Println(j)
	}
	

}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    int ans = (c-a+b > 0 ? c-a+b : 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  ll A, B; cin >> A >> B;
  ll a = (A * A) - (B * B);
  ll b = 2 * (A - B);
  if (a % b == 0) cout << (a / b) << endl;
  else cout << "IMPOSSIBLE" << endl;
  
}

Measured memory_bytes: 256
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include <random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
//#define double long double
//#define double float
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200060;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;

int A[500050];
bool fl[500050];
void solve() {
	string S; cin >> S;
	int N = S.size();
	vector<int>id;
	if (N == 1) {
		print(1);
		return;
	}
	REP(i, N) {
		if (i == 0) {
			if (S[i] == '<') {
				fl[0] = true;
				id.push_back(i);
			}
		}
		else if (i == N - 1) {
			if (S[i] == '>') {
				fl[N] = true;
				id.push_back(N);
			}
		}
		else {
			if (S[i] == '>'&&S[i + 1] == '<') {
				fl[i + 1] = true;
				id.push_back(i + 1);
			}
		}
	}

	for (auto s : id) {
		//print(s);
		A[s] = 0;
		int l = s;
		while (l - 1 >= 0 && S[l - 1] == '>') {
			l--;
			A[l] = max(A[l], A[l + 1] + 1);
		}
		int r = s;
		while (r + 1 <= N && S[r] == '<') {
			r++;
			A[r] = max(A[r], A[r - 1] + 1);
		}
	}
	int ans = 0;
	REP(i, N + 1) {
		//pe(A[i]);
		ans += A[i];
	}//cout << endl;
	print(ans);
}

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

	solve();
}


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

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int yen;
	ll points = 0;
	cin >> yen;
	int rem = yen%500;
	if (rem%5 != 0) rem = rem - rem%5;
	points = ((yen/500)*1000) + rem;
	cout << points;
}


Measured memory_bytes: 256
N=int(input())
S=input()
res=0

for i in range(N):
    S1=S[:i]
    S2=S[i:]
    se=set()
    t=0
    for j in S2:
        if j in S1 and not(j in se):
            se.add(j)
            t+=1
    res=max(res,t)
print(res)


Measured memory_bytes: 39024
#include<iostream>
#include<vector>
using namespace std;
int n,m;
int a[100005];
bool vis[100005];
vector<int> g[100005];
int tot=0;
void dfs(int u)
{
    bool f=1;
    vis[u]=1;
    for(int i=0;i<g[u].size();i++)
    {
        int v=g[u][i];
        if(a[v]>=a[u])
            f=0;
        if(!vis[v])
            dfs(v);
    }
    if(f)
        tot++;
}
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=m;i++)
    {
        int u,v;
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    for(int i=1;i<=n;i++)
    {
        if(!vis[i])
            dfs(i);
    }
    cout<<tot;
    return 0;
}

Measured memory_bytes: 10000
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int main() {
	speed;
	int a, b, k;
	cin >> a >> b >> b >> b >> b >> k;
	if (b - a > k)cout<<":(";
	else cout<<"Yay!";
	ed;
	return 0;
}


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

int X[100];

int main() {
    int N, M;
    double P;
    while (cin >> N >> M >> P, N) {
        P /= 100;
        int sum = 0;
        for (int i = 0; i < N; i++) {
            cin >> X[i];
            sum += 100 * X[i];
        }
        M--;
        if (X[M] == 0) {
            cout << 0 << endl;
        } else {
            cout << int(sum * (1.0 - P) / X[M] + 1e-9) << endl;
        }
    }
}

Measured memory_bytes: 3044
#include<bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
#ifdef KEV
#define DE(i, e) cerr << #i << ' ' << i << e
void debug(auto L, auto R) { while (L < R) cerr << *L << " \n"[L+1==R], ++L; }
#else
#define DE(...) 0
void debug(...) {}
#endif
const int maxn = 300010;
int n, a[maxn];
signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n;
	for (int i = 0;i < n;++i)
		cin >> a[i];
	ll res = 0;
	for (int i = 0;i < n;++i) {
		res += a[i] >> 1;
		if (a[i]&1 && a[i+1])
			++res, --a[i+1];
	}
	cout << res << '\n';
}


Measured memory_bytes: 4044
N,D = list(map(int, input().split())) 
X = []
Y = []
for i in range(N):
    X_i,Y_i = list(map(int, input().split()))
    X.append(X_i)
    Y.append(Y_i)
#print("X:{}".format(X))
#print(f"Y:{Y}")

pick = 0
for i in range(N):
    if (X[i] * X[i] + Y[i] * Y[i]) <= D*D:
        pick += 1
    else:
        pick += 0
print(pick)

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

int main() {
  int n,y=0;
  string s;
  cin >> n;
  for( ; n>0; n--){
    cin >> s;
    if(s!="Y") continue;
    else y=1;
  }
  if(y==1) cout << "Four" <<endl;
  else cout <<"Three" << endl;
}
  
      


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

int main()
{
    int A, B;
    cin >> A >> B;
    if (A == B)
    {
        cout << "Draw" << endl;
        return 0;
    }
    else if (A < B)
    {
        if (A == 1)
        {
            cout << "Alice" << endl;
            return 0;
        }
        else
        {
            cout << "Bob" << endl;
            return 0;
        }
    }
    else if (B == 1)
    {
        cout << "Bob" << endl;
        return 0;
    }
    else
    {
        cout << "Alice" << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <iostream>

int main(int argc, char ** argv)
{
  int n;
  std::cin >> n;

  int expect = 1;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int temp = 0;
    std::cin >> temp;

    if (temp == expect) {
      expect++;
    } else {
      ans++;
    }
  }

  if (ans == n) {
    std::printf("-1\n");
  } else {
    std::printf("%d\n", ans);
  }
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
using namespace std;
int main() {
    string num;
    
    while(cin >> num){
        if(num == "0"){
            break;
        }else{
            int sum = 0;
    for(int i = 0; i < num.length(); i++){
        sum = (num[i] - '0') + sum;
    }
            cout << sum << endl;
        }
    }
	return 0;
}

Measured memory_bytes: 3144
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<bitset>
#include<utility>
#include<sstream>
#include<iomanip>
using namespace std;

#define ll long long
#define MP make_pair

int main(void) {
	int n,x,l[101];
	int d[101]={};
	cin>>n>>x;
	int i,num=1;
	for (i = 0; i < n; i++) {
		cin>>l[i];
	}

	for (i = 0; i <= n; i++) {
		if(i>0){
			d[i]=d[i-1]+l[i-1];
			num++;
		}
		if(d[i]>x){
			num--;
			break;
		}
	}
	cout<<num<<"\n";


	return 0;
}


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

#define f(x, y, z) for (int x = (y), __ = (z); x < __; ++x)
#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define mst(x, a) memset(x, a, sizeof(x))

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
const int INF = 1 << 27;
const ll LLINF = (ll)1 << 60;
const ll MOD = 1e9+7;

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

int main() {
  int N;
  scanf("%d", &N);
  vector<vector<int>> a(N, vector<int>(N));
  f(i, 0, N) {
    f(j, 0, N) {
      scanf("%d", &a[i][j]);
    }
  }

  int size = 1 << N;
  vector<ll> cost(size, 0);
  for (int mask = 1; mask < size; mask++) {
    for (int i = 0; i < N; i++) {
      for (int j = i + 1; j < N; j++) {
        if ((mask & (1 << i)) and (mask & (1 << j))) {
          cost[mask] += a[i][j];
        }
      }
    }
  }

  // dp[mask]: max score only consider these rabbits
  vector<ll> dp(size, 0);
  dp[0] = 0;
  for (int mask = 1; mask < size; mask++) {
    int submask = mask;
    do {
      dp[mask] = max(dp[mask], cost[submask] + dp[mask ^ submask]);
      submask = (submask - 1) & mask;
    } while (submask);
  }

  printf("%lld\n", dp[size - 1]);
}


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

int main() {
  long N;
  cin >> N;
  long ans = 2e18;
  for (int i = 1; i <= N - 1; i++) {
    int A = i;
    int B = N - i;
    int a = 0;
    while (A) a += A % 10, A /= 10;
    int b = 0;
    while (B) b += B % 10, B /= 10;
    ans = min(ans, (long)a + b);
  }
  cout << ans << "\n";
}

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

int main(){
    int n, m, x, y;
    cin >> n >> m >> x >> y;

    int xb, yb, tmp;
    xb = x;
    for(int i=0;i<n;i++){
        cin >> tmp;
        if(tmp > xb)
            xb = tmp;
    }

    yb = y;
    for(int i=0;i<m;i++){
        cin >> tmp;
        if(tmp < yb)
            yb = tmp;
    }

    if(xb+1 <= yb)
        cout << "No War" << endl;
    else
        cout << "War" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef complex<double> P;
static const double EPS = 1e-8;
static const int INF = (int)1e8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) for (int i=0; i<(int)(n); ++i)
#define FOREQ(i,k,n) for (int i=(k); i<=(int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FIND(m,w) ((m).find(w)!=(m).end())
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int main(void){
  int N;
  while(cin>>N,N){
    int Mx=1,mx=0,My=1,my=0;
    vector<PII> point(N);
    REP(i,N-1){
      int n,d;
      cin>>n>>d;
      point[i+1] = PII(point[n].first+dx[d],point[n].second+dy[d]);
      Mx = max(point[i+1].first+1,Mx);
      mx = min(point[i+1].first,mx);
      My = max(point[i+1].second+1,My);
      my = min(point[i+1].second,my);
    }
    printf("%d %d\n",Mx-mx,My-my);
  }
  return 0;
}

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

int main() {
  string s;
  cin >> s;
  bool N = false;
  bool S = false;
  bool W = false;
  bool E = false;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'N') {
      N = true;
    }
    if (s[i] == 'S') {
      S = true;
    }
    if (s[i] == 'W') {
      W = true;
    }
    if (s[i] == 'E') {
      E = true;
    }
  }
  if (N == S && W == E) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>

using namespace std;

void input(int a[]);

void sum(int a[], int b[]);

int main()
{
	int n, a[4]={0}, b[4] = {0};
	cin >> n;
	for(int i = 0; i < n; i++){
		input(a);
		input(b);
		sum(a, b);
	}
	return 0;
}

void input(int a[])
{
	string str;
	cin >> str;
	for(int j = 0; j < 4; j++){
			a[j] = 0;
		}
	for(int i = 0; i < str.length(); i++){
		if(isdigit(str[i])){
			if(str[i+1] == 'm') a[0] = str[i]-'0';
			else if(str[i+1] == 'c') a[1] = str[i]-'0';
			else if(str[i+1] == 'x') a[2] = str[i]-'0';
			else if(str[i+1] == 'i') a[3] = str[i]-'0'; 
			i++;
		} else {
			if(str[i] == 'm') a[0] = 1;
			else if(str[i] == 'c') a[1] = 1;
			else if(str[i] == 'x') a[2] = 1;
			else if(str[i] == 'i') a[3] = 1;
		}
	}
	return;
}

void sum(int a[], int b[])
{
	char MCXI[5] = {"mcxi"};
	int ans_keisu[4]={0};
	for(int i = 3; i >= 0; i--){
		ans_keisu[i] = a[i] + b[i];
		if(ans_keisu[i] > 9){
			a[i-1] += ans_keisu[i] / 10;
			ans_keisu[i] = ans_keisu[i] % 10;
		}
	}
	for(int i = 0; i < 4; i++){
		if(ans_keisu[i] == 0) continue;
		else if(ans_keisu[i] == 1){
			cout << MCXI[i];
		} else {
			cout << ans_keisu[i] << MCXI[i];
		}
	}
	cout << endl;
	return;
}

Measured memory_bytes: 1204
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const double pi=acos(-1);





int main() 
{
  ll K,A,B; cin>>K>>A>>B;
  if(B-A<=2) {cout<<K+1<<endl; return 0;}
  K-=(A-1);
  ll ans=A;
  ans+=(B-A)*(K/2)+K%2;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<string>
#include<iomanip>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007
#define MAXS(x,y) (x = max(x,y))
#define MINS(x,y) (x = min(x,y))

using namespace std;

typedef long long int ll;

const ll INF=(ll)1e18;

int N,M;
vector<vector<pair<int, int> > > e;
vector<bool> visited;
vector<ll> pos;

void dp(int n, int p){
//  cout << n << " " << p << endl;
  if(visited[n]){
    if(pos[n] != p){
      cout << "No" << endl;
      exit(0);
    }else{
      return;
    }
  }

  pos[n] = p;
  visited[n] = true;
  REP(i,e[n].size()){
    dp(e[n][i].first, p + e[n][i].second);
  }

}

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

  e.resize(N+1);
  visited.resize(N+1);
  pos.resize(N+1);

  REP(i,M){
    int l,r,d;

    cin >> l >> r >> d;
    e[l].push_back(make_pair(r,d));
    e[r].push_back(make_pair(l,-d));
  }
  
  FOR(i,1,N+1){
    if(visited[i])continue;
    dp(i,0);
  }

  cout << "Yes" << endl;

}

Measured memory_bytes: 11392
N=int(input())
if N%2==0:
  print(-1)
elif N%5==0:
  print(-1)
else:
  ans=1
  a=7
  num=7
  while(num%N!=0):
    a=(a*10)%N
    num=(num+a)%N
    ans+=1
  print(ans)
  


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

#ifdef _DEBUG
inline void dump() { cerr << endl; }
template<typename Head> void dump(Head&& head) { cerr << head; dump(); }
template<typename Head, typename... Tail> void dump(Head&& head, Tail&&... tail) { cerr << head << ", "; dump(forward<Tail>(tail)...); }
#define debug(...) do {cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; dump(__VA_ARGS__); } while (false)
#else
#define dump(...)
#define debug(...)
#endif

template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;

ll gcd(ll a, ll b){return b==0 ? a : gcd(b, a%b);}
ll lcm(ll a, ll b){return a / gcd(a,b) * b;}

int main()
{
  ll n; cin>>n;
  vector<ll> t(n);
  rep(i, n) cin>>t[i];

  ll ans = 1;
  rep(i, n) ans = lcm(ans, t[i]);
  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int idade;
		Scanner scanner = new Scanner(System.in);
		idade = scanner.nextInt();
		if(idade == 7) {
			System.out.println("YES\n");
		} else if (idade == 5){
			System.out.println("YES\n");
		} else if (idade == 3) {
			System.out.println("YES\n");
		}else
			System.out.println("NO\n");
	}

}


Measured memory_bytes: 21716
n,k = map(int, input().split())

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy > 0:
        out = str(X_dumy % n) + out
        X_dumy = int(X_dumy / n)
    return out


x2 = Base_10_to_n(n, k)
print(len(x2))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
const int MOD=1000*1000*1000+7,N=300005;
using namespace std;
typedef long long ll;
ll f[N];
ll h,w,a,b;
ll P(ll a,ll b){
    ll ans=1;
    while(b){
        if(b%2)ans=(ans*a)%MOD;
        a=(a*a)%MOD;
        b/=2;
    }
    return ans;
}
ll WAYS(ll n,ll k){
    ll cnt=f[n];
    cnt=(cnt*P(f[k],MOD-2))%MOD;
    cnt=(cnt*P(f[n-k],MOD-2))%MOD;
    return cnt;
}
int main()
{f[0]=1;
    for(int i=1;i<N;i++)f[i]=(f[i-1]*i)%MOD;
    cin>>h>>w>>a>>b;
    ll ans=0;
    for(int i=b;i<w;i++){
        ll c=h-a;
        ll v1=WAYS(c+i-1,c-1);
        ll v2=WAYS(a+w-i-2,a-1);
        ans=(ans+v1*v2)%MOD;
    }
    cout<<ans<<'\n';
    return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<char>> A(N, vector<char>(N));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cin >> A.at(i).at(j);
    }
  }
  vector<vector<char>> B(M, vector<char>(M));
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < M; j++) {
      cin >> B.at(i).at(j);
    }
  }
  for (int i = 0; i + (M - 1) < N; i++) {
    for (int j = 0; j + (M - 1) < N; j++) {
      bool b = 1;
      for (int k = 0; k < M; k++) {
        for (int l = 0; l < M; l++) {
          if (A.at(i + k).at(j + l) != B.at(k).at(l)) b = 0;
        }
      }
      if (b) return cout << "Yes" << "\n", 0;
    }
  }
  cout << "No" << "\n";
}

Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
using namespace std;
using ll = long long;

int main() {
	ll a, b, x;
	cin >> a >> b >> x;
	ll aa = a / x, bb = b / x;
	ll ans = bb - aa;
	if (a%x == 0)ans++;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// nichijou
#define REP(i,a,b) for (int i(a), _B(b); i < _B; ++i)
#define RP(i,n) REP(i,0,n)
#define PER(i,a,b) for(int i((a)-1), _B(b); i >= _B; --i)
#define PR(i,n) PER(i,n,0)
#define REP1(i,a,b) REP(i,a,(b)+1)
#define RP1(i,n) REP1(i,1,n)
#define PER1(i,a,b) PER(i,(a)+1,b)
#define PR1(i,n) PER1(i,n,1)
#define DO(n) REP(__i,0,n)
template<typename T>
void cmax(T & a, T b) {a = max(a, b);}
template<typename T>
void cmin(T & a, T b) {a = min(a, b);}

// data type
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define F first
#define S second

// STL container
typedef vector<int> vi;
typedef vector<ll> vll;
#define SZ(a) ((int)a.size())
#define ALL(a) a.begin(), a.end()
#define CLR(a) a.clear()
#define BK(a) (a.back())
#define FT(a) (a.front())
#define DB(a) a.pop_back()
#define DF(a) a.pop_front()
#define PB push_back
#define EB emplace_back

/* I gave you my heart and then you turned around. */
void _BG(const char * s) {}
template<typename T, typename ... TT>
void _BG(const char * s,T a, TT...b)
{
	for (int c = 0; *s && (c || *s != ','); ++s) {
		cerr<<*s;
		switch (*s) {
		case '(':
		case '[':
		case '{':
			++c;
			break;
		case ')':
		case ']':
		case '}':
			--c;
			break;
		}
	}
	cerr<<" = "<<a;
	if (*s) {
		cerr<<", ";
		_BG(++s,b...);
	} else
		cerr<<endl;
}
#define BG(...) do { \
	cerr << __PRETTY_FUNCTION__ << ':' << __LINE__ << ": "; \
	_BG(#__VA_ARGS__,__VA_ARGS__); \
} while(0)

/* Reading input is now 20% cooler! */
bool RD(void) {return true;}
bool RD(char & a) {return scanf(" %c", &a) == 1;}
bool RD(char * a) {return scanf("%s", a) == 1;}
bool RD(double & a) {return scanf("%lf", &a) == 1;}
bool RD(int & a) {return scanf("%d", &a) == 1;}
bool RD(ll & a) {return scanf("%lld", &a) == 1;}

template<typename T, typename ... TT>
bool RD(T & a, TT & ...  b) {return RD(a) && RD(b...);}

/* Do princesses dream of magic sheep? */
#define RI(a) int a; RD(a)
#define RII(a,b) RI(a); RI(b)
#define RIII(a,b,c) RI(a); RII(b,c)
#define RIIII(a,b,c,d) RI(a); RIII(b,c,d)

/* For it's time for you to fulfill your output. */
void PT(const char a) {putchar(a);}
void PT(const char * a) {fputs(a, stdout);}
void PT(char * a) {fputs(a, stdout);}
void PT(const double a) {printf("%.16f", a);}
void PT(const int a) {printf("%d", a);}
void PT(const ll a) {printf("%lld", a);}

/* The line will last forever! */
template<char sep = ' ',char end = '\n'>
void PL(void) {if (end) PT(end);}
template<char sep = ' ',char end = '\n',typename T, typename ... TT>
void PL(const T a, const TT ...  b) {PT(a); if (sizeof...(b) && sep) PT(sep); PL<sep,end>(b...);}

/* Good Luck && Have Fun ! */
int main()
{
	long long n,a,b;
	RD(n,a,b);
	if (a > b)
		PL(0);
	else if (n == 1)
		PL(a == b);
	else
		PL((b-a)*(n-2)+1);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAXW 100001
#define INF lint_MAX
#define lint long long int
using namespace std;

lint n, w, v, p, maior;
lint dp[MAXW];

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin >> n >> w;
    
    for(lint i = 0; i <= w; i++){
    	dp[i] = 0;
    }
    
    cin >> p >> v;
    
    for(lint i = p; i <= w; i++){
    	dp[i] = v;
    }
    
    for(lint i = 1; i < n; i++){
    	cin >> p >> v;
    	for(lint j = w; j >= p; j--){
    		lint z = j - p;
    		dp[j] = max(dp[z] + v, dp[j]);
    	}
    }
    
    maior = 0;
    for(lint i = 0; i <= w; i++){
    	maior = max(maior,dp[i]);
    }
    
    cout << maior << '\n';
    
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define msg(x) debug() << x
#define int long long
const int xx = 2e5;
const int MOD = 1e9 + 7;
bool cmp(const pair<int,int>&a , const pair<int,int>&b){
  if(a.second != b.second) return a.second < b.second;
  return a.first < b.first;
}
signed main(){
  ios::sync_with_stdio(false);cin.tie(0);
  int n , k;
  cin >> n >> k;
  int edge = (n-1) * (n-2) / 2;
  if(k > edge){
    cout << -1 << '\n';
    return 0;
  }
  vector<pair<int,int>>vp;
  for(int i=2;i<=n;i++){
    vp.emplace_back(1,i);
  }
  bool x = false;
  for(int i=2;i<=n-1;i++){
    for(int j = i + 1;j<=n;j++){
      if(edge == k){
        x = true;
        break;
      }
      vp.emplace_back(i,j);
      edge--;
    }
    if(x)break;
  }
  cout << (int)vp.size() << '\n';

  for(auto i : vp){
    cout << i.first <<" " << i.second << '\n';
  }
}

Measured memory_bytes: 512