akhauriyash/Code-Regression huggingface dataset:
import math
import pprint
import fractions
import collections
import itertools
from decimal import *
from collections import deque
from bisect import *
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a=deque()
b=deque()
mula=[0]*(N+1)
mulb=[0]*(M+1)
for i in range(N):
    mula[i+1]=mula[i]+A[i]
for i in range(M):
    mulb[i+1]=mulb[i]+B[i]
#print(mula,mulb)
ans=0
for i in range(N+1):
    cnt = 0
    timeb=K-mula[i]
    cnt=cnt+i
    #print(timeb)
    #print(bisect(mulb,timeb))
    if bisect(mulb,timeb)-1>=0:
        cnt=cnt+bisect(mulb,timeb)-1
        ans=max(ans,cnt)
print(ans)



Measured memory_bytes: 115816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int t, n;
string s;
int main(){
	cin >>s;
	int ok = 0;
	for(int i = 0; i < s.length() &&!ok; i++){
		if(s[i] == '7')
			ok = 1;
	}
	if(ok)
		cout << "Yes\n";
	else
		cout << "No\n";
	return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_h(const vector<T>& c, int n=INT_MAX)
{ rep(i, min(n, (int)c.size())) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define D1(a) cout<<#a<<":"<<a<<"\n"
#define D2(a,b) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<endl 
#define D3(a,b,c) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl 
#define MOD 1000000007

int main()
{
    int K, T; cin >> K >> T;
    int ma = 0;
    rep(i, T) {
        int a; cin >>a;
        chmax(ma, a);
    }
    cout << max(0, ma-1 - (K-ma)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0; i<(n); ++i)
#define rep1(i,n) for(ll i=1; i<=(n); ++i)
#define repi(i,a,b) for(ll i=a; i<=(b); ++i)
#define rrep(i,n) for(ll i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define print(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
using Edge = pair<ll,ll>;
using Graph = vector<vector<Edge>>;
typedef pair<ll,ll> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll devc(ll x, ll y){return 1 + (x-1)/y;}

ll solve(ll N){
    ll ans = 0;
    return ans;
}

int main(){
    ll a,b; cin >> a >> b;
    if(a > b) swap(a,b);
    string ans = "";
    rep(i,b){
        ans += to_s(a);
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
 
string s;
 
int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s;
	if (s[0] == s[2]) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
n,m,c = map(int,input().split())
B = list(map(int,input().split()))
ans = 0
for i in range(n):
    A = list(map(int,input().split()))
    s = c
    for j in range(m):
        s += A[j]*B[j]
    if s > 0:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i=(a); i<(b); i++)

int main() {
  int K,S;
  cin >> K >> S;
  int ans = 0;
  FOR(x,0,K+1) {
    FOR(y,0,K+1) {
      if ((0 <= S-x-y) && (S-x-y <= K)) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3604
s=list(input())

num_g=num_p=0
answer=0
for i in range(len(s)):
  if num_g==num_p:
    num_g+=1
    if s[i]=="p":
      answer-=1
  else:
    num_p+=1
    if s[i]=="g":
      answer+=1

print(answer)

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

int main()
{
	long long n,x=0;
	cin>>n;
	for(int i=1;i<=10000000;i++)
	{
		x=(x*10+7)%n;
		if(x==0)
		{
		  cout<<i;
		  return 0;	
		}
	}
	
	cout<<"-1";
	
	return 0;
	
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#include <numeric> 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define int long long int
#define mod 1000000007
#define INT_BITS 16
#define inf 1000000099
#define watch(x) cout<<(#x)<<"="<<(x)<<"\n" 
//__builtin_popcount()


int32_t main()
{
  
   
        int a,b,c,k;
        cin>>a>>b>>c>>k;
        if(k<=a)
        {
          cout<<k<<endl;
        }
        else
        {
          if(k<=a+b)
            cout<<a<<endl;
          else
          {int x=k-a-b;
            cout<<a-x<<endl;
          }
        }
   

   return 0;
}


Measured memory_bytes: 3636
N, = map(int, input().split())
H = list(map(int, input().split()))

DP = [0] * N

for i in range(1, N):
    DP[i] = min(abs(H[i] - H[max(i - 1, 0)]) + DP[max(i - 1, 0)], abs(H[i] - H[max(i - 2, 0)]) + DP[max(i - 2, 0)])

print(DP[N - 1])

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

struct edge{
	ll v,idx,w;
};

ll N,M;
vector<ll> D;
vector<edge> es[200010];
ll res[200010],resC[200010];
bool solved[200010];

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

  cin>>N>>M;
  D.resize(N);
  rep(i,N)cin>>D[i];
  rep(i,M){
  	ll u,v;
  	cin>>u>>v;
  	u--;v--;
  	if(D[u]<D[v]||(D[u]==D[v]&&u<v))swap(u,v);
  	es[u].push_back((edge){v,i,D[u]});
  	res[i]=D[u];
  }
  priority_queue<P,vector<P>,greater<P>> que;
  rep(i,N){
  	que.push(P(D[i],i));
  }
  while(que.size()){
  	P p=que.top(); que.pop();
  	ll v=p.se;
  	ll d=p.fi;
  	bool ok=true;
  	for(edge e : es[v]){
  		if(!solved[e.v]&&D[e.v]!=d){
  			ok=false;
  		}
  	}
  	if(!ok){
  		cout<<-1<<endl;
  		return 0;
  	}
  	if(es[v].size()==0){
  		continue;
  	}
  	bool col=false;
  	for(edge e : es[v]){
  		solved[e.v]=true;
  		if(resC[e.v]==0)col=true;
  	}
  	resC[v]=col;
  	solved[v]=true;
  }
  rep(i,N){
  	if(!solved[i]){
  		cout<<-1<<endl;
  		return 0;
  	}
  }
  rep(i,N){
  	if(resC[i]==0)cout<<"W";
  	else cout<<"B";
  }
  cout<<"\n";
  rep(i,M){
  	cout<<res[i]<<"\n";
  }

  return 0;
}


Measured memory_bytes: 18544
import java.util.*;

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


        int left  = 0 ;
        int right = W ;
        int down  = 0 ;
        int up    = H ;


        for(int i = 0 ; i < N ; i ++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            int a = sc.nextInt();

            switch( a ){
                case 1:
                    if( x >= left ){
                        left = x ;
                    }
                    break;

                case 2:
                    if( x <= right ){
                        right = x ;
                    }
                    break;
                case 3:
                    if( y >= down ){
                        down = y ;
                    }
                    break;
                case 4:
                    if( y <= up ){
                        up = y ;
                    }
                    break;
            }
        }

        int result = 0;
        if(left < right && down < up){
            result = (right - left) * ( up - down ) ;
        }

        System.out.println(result);

    }
}


Measured memory_bytes: 21972
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

int main(){
  long long n,a,b,cnt=0ll,sub=0ll;
  cin >> n;
  vector<long long> v(n);
  for(int i=0;i<n;i++){
    cin >> a >> b;
    v[i]=a+b;
    sub+=b;
  }
  sort(v.begin(),v.end());
  reverse(v.begin(),v.end());
  for(int i=0;i<n;i++){
    if(i%2==0)cnt+=v[i];
  }
  cout << cnt-sub << endl;
  return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}

signed main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a != c) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") // wonderful

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

#define forn(i, a, n) for (int i = (a); i < (int)n; i++)
#define trav(x, arr) for (auto &x : arr)
#define sz(x) (int)x.size()
#define Matrix(m, h, w) = std::vector<vector<int>> m(h, vector<int> (w)); 
using ll = long long;

#define vi vector<int>
#define vl vector<long>
#define vll vector<ll>

// benq
const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 100001;


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


    int n; cin >> n;

    int res = 0;

    while (n > 0) n -= 1000;
    cout << abs(n);


    return 0;
}

Measured memory_bytes: 3604
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)

	schedule := make([][]int, N)
	var t, x, y int
	for i := 0; i < N; i++ {
		fmt.Scan(&t, &x, &y)
		schedule[i] = []int{t, x, y}
	}

	fmt.Println(abc086c(N, schedule))
}

func abc086c(N int, schedule [][]int) string {
	var t, x, y, t1, x1, y1 int
	var buft, bufx, bufy int
	var res int
	for i := 0; i < N; i++ {
		t1 = schedule[i][0]
		x1 = schedule[i][1]
		y1 = schedule[i][2]
		buft = t1 - t
		bufx = x1 - x
		bufy = y1 - y
		res = buft - bufx - bufy
		if res >= 0 && res%2 == 0 {
			t1 = t
			x1 = x
			y1 = y
			continue
		} else {
			return "No"
		}
	}
	return "Yes"
}


Measured memory_bytes: 8448
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

class UnionFind {
	vector<int>par, high;
public:
	UnionFind(int n) {
		par = high = vector<int>(n);
		for (int i = 0; i < n; i++)par[i] = i;
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (high[x] > high[y])par[y] = x;
		else {
			par[x] = y;
			if (high[x] == high[y])high[y]++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};
int t[100000];
int main() {
	int n, m; scanf("%d%d", &n, &m);
	memset(t, -1, sizeof(t));
	UnionFind uf(n);
	rep(i, n) {
		int k; scanf("%d", &k);
		rep(j, k) {
			int l; scanf("%d", &l); l--;
			if (~t[l])uf.unite(t[l], i);
			t[l] = i;
		}
	}
	rep(i, n) {
		if (!uf.same(0, i)) {
			puts("NO"); return 0;
		}
	}
	puts("YES");
}

Measured memory_bytes: 1408
/*input
5
CHOKUDAI
RNG
MAKOTO
AOKI
RINGO
*/
#include <iostream>
#include <cmath>
using namespace std;
typedef unsigned long long ull;
int main()
{
	int n;
	cin>>n;
	int arr[5];
	for(int i=0;i<5;arr[i++]=0);
	while(n--)
	{
		string s;
		cin>>s;
		if (s[0]=='M')
			arr[0]++;
		if (s[0]=='A')
			arr[1]++;
		if (s[0]=='R')
			arr[2]++;
		if (s[0]=='C')
			arr[3]++;
		if (s[0]=='H')
			arr[4]++;
	}
	// sort(arr,arr+5);
	// int arr1[5];
	// for(int i=0;i<5;i++)
	// 	arr1[i] = arr[5-i-1];
	ull count = 0;
	for(int i=0;i<5;i++)
	{
		for(int j=i+1;j<5;j++)
		{
			ull c = 0;
			for(int k=j+1;k<5;k++)
			{
				if(arr[k]>0)
					c = c+arr[k];
			}
			count+= arr[i]*arr[j]*c;
		}
	}
	cout<<count;


}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int k;
  cin >> k;
  string s;
  cin >> s;
  for(int i = 0; i < s.size(); i++){
    if(i < k) cout << s.at(i);
    else{ 
      cout << "...";
      break;
    }
  }
} 

Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
using namespace std;
int main(){

    int n,i;
    int A[1000];
    int B[1000];
    int p=0;
    cin>>n;

    for(i=0;i<n;i++){
        cin>>A[i];
        B[i]=A[i];
    }

    sort(B,B+n);

    for(i=0;i<n;i++){
        if(A[i]!=B[i]){
            p++;
        }
    }

    if(p==2||p==0){
        cout<<"YES";
    }else{
        cout<<"NO";
    }

}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  vector<int> h(N);
  rep(i, N) cin >> h[i];

  std::sort(h.begin(), h.end());
  int mn = 1000000000;
  rep(i, N - (K - 1))
  {
    int diff = h[i + K - 1] - h[i];
    if (mn > diff)
      mn = diff;
  }

  cout << mn << endl;

  return 0;
}


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

using namespace std;

int main()
{
   int a, b;
   char c;
   scanf("%d %c %d",&a,&c,&b);
   if(c=='+')
   {
      cout<<a+b;
   }
   else if(c=='-')
   {
       cout<<a-b;
   }
   return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
//#include <intrin.h>

#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 300005
#define inf 2000000000
#define EPS 1e-6
#define MOD (ll)1e15
#define __builtin_popcount(x) __popcnt(x)

using namespace std;

typedef long long ll;
typedef pair<double, double> pr;
typedef pair<pair<int, int>, int> tup;

double find_r(double x, double y, vector<pr> &p)
{
	double l = 0, r = 1000;
	while (abs(r - l) > 1e-7) {
		double m = (l + r) / 2;

		bool ok = 1;
		fore(i, 0, p.size())
		{
			if ((x - p[i].first) * (x - p[i].first) + (y - p[i].second) * (y - p[i].second) - m * m > 0)
				ok = 0;
		}

		if (ok)
			r = m;
		else
			l = m;
	}

	return r;
}

double find_x(double y, vector<pr> &p)
{
	double l = 0, r = 1000;
	while (r - l > EPS) {
		double m1 = l + (r - l) / 3,
			m2 = r - (r - l) / 3;
		if (find_r(m1, y, p) > find_r(m2, y, p))
			l = m1;
		else
			r = m2;
	}
	return r;
}

inline void solve()
{
	int n;
	cin >> n;
	vector<pr> v(n);
	fore(i, 0, n)
		cin >> v[i].first >> v[i].second;

	double mn = 1e18;
	double y = 0;
	double l = 0, r = 1000;

	for (double x = l; x <= r; x += 0.2)
	{
		double rr = find_r(find_x(x, v), x, v);
		if (rr < mn)
		{
			mn = rr;
			y = x;
		}
	}
	for (double x = y - 0.1; x <= y + 0.1; x += 0.005)
	{
		double rr = find_r(find_x(x, v), x, v);
		if (rr < mn)
		{
			mn = rr;
			y = x;
		}
	}
	for (double x = y - 0.001; x <= y + 0.001; x += 0.0005)
	{
		double rr = find_r(find_x(x, v), x, v);
		if (rr < mn)
		{
			mn = rr;
			y = x;
		}
	}
	for (double x = y - 0.0001; x <= y + 0.0001; x += 0.00005)
	{
		double rr = find_r(find_x(x, v), x, v);
		if (rr < mn)
		{
			mn = rr;
			y = x;
		}
	}
	for (double x = y - 0.00001; x <= y + 0.00001; x += 0.000005)
	{
		double rr = find_r(find_x(x, v), x, v);
		if (rr < mn)
		{
			mn = rr;
			y = x;
		}
	}
	for (double x = y - 0.000001; x <= y + 0.000001; x += 0.0000005)
	{
		double rr = find_r(find_x(x, v), x, v);
		if (rr < mn)
		{
			mn = rr;
			y = x;
		}
	}

	cout << fixed << setprecision(6) << mn;
}

int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
}


Measured memory_bytes: 256
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    s = input()
    n = len(s)
    if n%2==0:
        for _ in range(200):
            s = s[:n-2]
            n = len(s)
            if s[:n//2]==s[n//2:]:
                print(n)
                exit()
    else:
        s = s[:n-1]
        for _ in range(200):
            s = s[:n-1]
            n = len(s)
            if s[:n//2]==s[n//2:]:
                print(n)
                exit()


if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <cmath>

using namespace std;

int main(int argc, char *argv[]) {
  double n;
  while (cin >> n) {
    if (n <= 48.0) {
      cout << "light fly" << endl;
    } else if (n <= 51.0) {
      cout << "fly" << endl;
    } else if (n <= 54.0) {
      cout << "bantam" << endl;
    } else if (n <= 57.0) {
      cout << "feather" << endl;
    } else if (n <= 60.0) {
      cout << "light" << endl;
    } else if (n <= 64.0) {
      cout << "light welter" << endl;
    } else if (n <= 69.0) {
      cout << "welter" << endl;
    } else if (n <= 75.0) {
      cout << "light middle" << endl;
    } else if (n <= 81.0) {
      cout << "middle" << endl;
    } else if (n <= 91.0) {
      cout << "light heavy" << endl;
    } else {
      cout << "heavy" << endl;
    }
  }
  return 0;
}

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

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

ll dx[2] = {1, 0};
ll dy[2] = {0, 1};

const ll mod = 1e9+7;

int main(){
    int h, w; cin >> h >> w;
    vector<vector<ll> > dp(h, vector<ll>(w, 0));
    dp[0][0] = 1LL;
    vector<string> lis(h);
    REP(i, 0, h){cin >> lis[i];}
    REP(i, 0, h){
        REP(l, 0, w){
            REP(k, 0, 2){
                int nx = i+dx[k], ny = l+dy[k];
                if(nx >= 0 && ny >= 0 && nx < h && ny < w && lis[nx][ny] == '.'){
                    dp[nx][ny] = (dp[nx][ny] + dp[i][l]) % mod;
                }
            }
        }
    }
    cout << dp[h-1][w-1];
}

Measured memory_bytes: 9088
#include <vector>
#include <cstdint>
#include <array>
#include <iostream>
using namespace std;
constexpr uint64_t mod = 1e9 + 7;
constexpr uint64_t mod_pow(uint64_t num, uint64_t p) {
  uint64_t ans = 1;
  num %= mod;
  while (0 < p) {
    if (p & 1) {
      ans = (ans * num) % mod;
    }
    num = (num * num) % mod;
    p >>= 1;
  }
  return ans;
}

template <int N> constexpr array<uint64_t, N + 1> factorial_table() {
  array<uint64_t, N + 1> ans;
  ans[0] = 1;
  for (uint64_t i = 1; i <= N; i++)
    ans[i] = i;
  for (uint64_t i = 2; i <= N; i++) {
    ans[i] = (ans[i] * ans[i - 1]) % mod;
  }
  return ans;
}

template <int N>
constexpr array<uint64_t, N + 1> inv_table(const array<uint64_t, N + 1>& fct) {
  array<uint64_t, N + 1> ans;
  ans[N] = mod_pow(fct[N], mod - 2);
  for (int i = N - 1; 0 <= i; i--)
    ans[i] = ((uint64_t)ans[i + 1] * (i + 1)) % mod;
  return ans;
}

template <typename table>
uint64_t comb(const table &factorial, const table &inv, uint64_t m, uint64_t n) {
  if (m == 0 || n == 0)
    return 1;
  return (((uint64_t)factorial[n + m - 1] * inv[n]) % mod) * inv[m - 1] % mod;
}

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

  auto facts = factorial_table<200001>();
  auto invs = inv_table<200001>(facts);

  size_t n, m;
  cin >> n >> m;
  vector<pair<int, int>> factors;
  for (int i = 2;; ++i) {
    int num = 0;
    while (m % i == 0) {
      num++;
      m /= i;
    }
    if (0 < num) {
      factors.push_back(make_pair(i, num));
    }
    if (m == 1) {
      break;
    }
  }
  if (factors.size() == 0) {
    cout << "1\n";
  } else {
    int ans = 1;
    for (size_t i = 0; i < factors.size(); ++i) {
      int count = factors[i].second;
      ans = (ans * comb(facts, invs, n, count)) % mod;
    }
    cout << ans << "\n";
  }
}


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

using namespace std;

int main(){
  int n, k;
  cin >> n >> k;
  vector<double> p(n);
  for(auto&& x:p){
    cin >> x;
    x = (x + 1) / 2;
  }
  double m = 0;
  for(int i=0;i<k;i++)m += p[i];
  double t = m;
  for(int i=0;i<n-k;i++){
    t -= p[i];
    t += p[k+i];
    m = max(m, t);
  }
  cout << fixed << setprecision(12) << m << endl;
}


Measured memory_bytes: 1792
/**
 *    author:  [itmo] enot.1.10
 *    created: 03.04.2017 20:47:57       
**/
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(),a.end()
#define pw(x) (1LL<<(x))

using namespace std;

typedef long long ll;
typedef double dbl;
typedef vector<int> vi;
typedef pair<int, int> pi;

const int inf = 1.01e9;
const dbl eps = 1e-9;

/* --- main part --- */

const int N = 2e5 + 10;
const int mod = 1e9 + 7;


namespace math
{
    const int N = 3e5 + 10;
    
    int fact[N];
    int revfact[N];

    int revx[N];

    void init()
    {
        fact[0] = 1;
        for (int i = 1; i < N; ++i) fact[i] = fact[i - 1] * (ll)i % mod;
        revfact[0] = revfact[1] = 1;
        revx[1] = 1;
        for (int i = 2; i < N; ++i)
        {
            int c = mod / i + 1;
            revx[i] = revx[c * i - mod] * (ll)c % mod;
            revfact[i] = revfact[i - 1] * (ll)revx[i] % mod;
        }
    }

    int cnk(int n, int k)
    {
        if (k < 0 || k > n) return 0;
        return fact[n] * (ll)revfact[n - k] % mod * revfact[k] % mod;
    }
}


pi a[N];
int n;

int X, Y;

int id[N];
int one[N];
int intotal[N];


int last = 0;
int cnt[N];



int main()
{
    #ifdef home
        assert(freopen("1.in", "r", stdin));
        assert(freopen("1.out", "w", stdout));
    #endif
    math::init();

    scanf("%d%d%d", &n, &X, &Y);
    forn(i, n) scanf("%d%d", &a[i].F, &a[i].S);
    sort(a, a + n);
    forn(i, n)
    {
        int j = i + 1;
        while (j < n && a[j].F == a[i].F) ++j;
        
        id[i] = ++last;
        one[last] = i;
        for (int k = i + 1; k < j; ++k)
        {
            if (a[i].S + a[k].S <= X) id[k] = id[i];
            else
            {
                id[k] = ++last;
                one[last] = k;
            }
        }
        i = j - 1;
    }

    int badcolor = -1;
    forn(_, 2)
    {
        int x = -1;
        forn(i, n) if (a[i].F != badcolor && (x == -1 || a[i].S < a[x].S))
        {
            x = i;
        }
        if (x == -1) break;

        if (badcolor == -1) intotal[id[x]] = 1;
        forn(i, n) if (a[i].F != a[x].F && a[i].S + a[x].S <= Y) intotal[id[i]] = 1;

        badcolor = a[x].F;
    }

    map<int, int> M;
    forn(i, n) if (intotal[id[i]]) M[a[i].F] += 1;

    int res = 1;
    int total = 0;

    for (pi z : M)
    {
        int x = z.S;
        res = res * (ll)math::cnk(total + x, x) % mod;
        total += x;
    }

    printf("%d\n", res);
        
    #ifdef home
        eprintf("time = %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
    #endif
    return 0;
}


Measured memory_bytes: 13440
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define mod 1000000007

int N,K;

signed main(){
    scanf("%lld %lld",&N,&K);
    int ans=0;
    for(int i=K;i<=N+1;i++){
        ans+=(N-(i-1))*i+1;
        ans%=mod;
    }
    printf("%lld\n",ans);
    return 0;
}


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

int main() {
    int h, w, len[505][505]; // (i,j)より上に.が連続していくつあるか
    int L[505], R[505]; // L[i]=len[j-1]<len[i](j<=i)となる最大のj, R[i]=len[i]>len[j](i<j)となる最小のj
    string s[505];
    while(cin >> h >> w, h){
        for(int i=0;i<h;i++) cin >> s[i];
        for(int i=0;i<=h;i++) fill(len[i], len[i]+w+1, 0);
        // len
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(s[i][j] == '.'){
                    len[i+1][j] = len[i][j]+1;
                }
            }
        }
        int ans = 0;
        stack<int> st;
        for(int i=1;i<=h;i++){
            // L
            while(!st.empty())st.pop();
            for(int j=0;j<=w;j++){
                while(!st.empty() && len[i][j] <= len[i][st.top()]){
                    st.pop();
                }
                if(st.empty()) L[j] = 0;
                else L[j] = st.top()+1;
                st.push(j);
            }
            while(!st.empty())st.pop();
            // R
            for(int j=w;j>=0;j--){
                while(!st.empty() && len[i][j] <= len[i][st.top()]){
                    st.pop();
                }
                if(st.empty()) R[j] = w;
                else R[j] = st.top();
                st.push(j);
            }
            // 面積計算
            for(int j=0;j<w;j++){
                ans = max(ans, len[i][j]*(R[j]-L[j]));
            }
        }
        cout << ans << endl;
    }
    return 0;
}


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

using ll=long long;
using P =pair<int,int>;

int main() {

  int n,m;
  cin>>n>>m;
  vector<P> p(m);
  rep(i,m) cin>>p[i].first>>p[i].second;
  rep(x,1000){
    int keta=1;
    int nx =x/10;
    vector<int> d(1,x%10);
    while(nx){
      keta++;
      d.push_back(nx%10);
      nx/=10;
    }
    if(keta!=n)continue;
    bool ok=true;
    reverse(d.begin(),d.end());
    rep(i,m){
      if(d[p[i].first-1]!=p[i].second)ok=false;
    }
    if(ok){
      cout<<x<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
  return 0;

}




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

int a[50];
int main() {
	int n;
	while (cin >> n, n) {
		rep(i, n)scanf("%d", &a[i]);
		int i = 0;
		while (i < n) {
			int back = a[i];
			for (; i < n - 1; i++) {
				if (a[i + 1] - a[i] != 1)break;
			}
			if (back == a[i])cout << a[i];
			else cout << back << '-' << a[i];
			if (i < n - 1)cout << ' ';
			i++;
		}
		cout << endl;
	}
}

Measured memory_bytes: 3128
//
// Created by ss250251 on 2/16/2020.
//

#include<bits/stdc++.h>
using namespace std;
#define INF 1e18L + 7
#define MOD 1e9+7
template <typename T>
void max_self(T&a,T b){
    a = max(a,b);
}
template <typename T>
void min_self(T&a,T b){
    a = min(a,b);
}
template <typename T>
void add_self(T&a,T b){
    a +=b;
    if(a>=1e9+7){
        a-=(1e9+7);
    }
}
template <typename T>
void sub_self(T&a,T b){
    a -=b;
    if(a<0){
        a+=(1e9+7);
    }
}

int main(){
    int n,k;
    cin>>n>>k;
    vector<int>dp(k+1);
    dp[0]=1;
    for(int i=0;i<n;i++){
        int cap;
        scanf("%d",&cap);
        vector<int>pref_vec(k+1);
        for(int base = k;base>=0;base--){
            int L= base+1;
            int R= base+min(cap,k-base);
            int tmp = dp[base];
            if(L<=R){
                add_self(pref_vec[L], tmp);
                if(R+1<=k){
                    sub_self(pref_vec[R+1],tmp);
                }
            }
//            for(int i=L;i<=R;i++){
//                add_self(dp[i], tmp);
//            }
        }
        int running_sum = 0;
        for(int i=0;i<=k;i++){
            add_self(running_sum, pref_vec[i]);
            add_self(dp[i], running_sum);
        }
    }
    printf("%d",dp[k]);
}

Measured memory_bytes: 1024
A, B, C = list(map(int, input().split()))
K = int(input())

def dfs(k, a, b, c):
	if k == 0:
		if b > A and c > b:
			return True
		else:
			return False

	if dfs(k - 1, a * 2, b, c):
		return True

	if dfs(k - 1, a, b * 2, c):
		return True

	if dfs(k - 1, a, b, c * 2):
		return True

	return False

r = dfs(K, A, B, C)
if r:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#define ll long long
#define pq priority_queue
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};

int main(){
    ll N,sum=0;
    cin>>N;
    for(ll i=1;i*i<=N;i++){
        if(N%i==0&&i<N/i-1) sum+=N/i-1;
    }
    cout<<sum<<endl;
}


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

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		int a = Integer.parseInt(strArr[0]);
		int b = Integer.parseInt(strArr[1]);
		if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
			System.out.println("Possible");
		else
			System.out.println("Impossible");
	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {

	}
}


Measured memory_bytes: 21076
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
using namespace std;
//typedef __int64 LL;
//typedef long long int LL;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef pair<int,int> P;
//typedef pair<LL,LL> PL;

const int MOD=1000000007;
int INF=100100100;
int main(){
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	int po=0;
	if(a[0]==a[1])po++;
	if(a[1]==a[2])po++;
	if(po%2==1)cout<<"Yes"<<"\n";
	else cout<<"No"<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
using namespace std;
int n,k;
string cards[10];
bool used[10];
map<string,int>memo;
void func(int m,string str){
    if(m==k){
        memo[str]=1;
        return;
    }

    for(int i=0;i<n;i++){
        if(!used[i]){
            string _str=str+cards[i];
            used[i]=true;
            func(m+1,_str);
            used[i]=false;
        }
    }

}
int main(){
    while(cin>>n>>k,n or k){
        for(int i=0;i<n;i++)cin>>cards[i];
        fill(used,used+10,false);
        memo.clear();
        func(0,"");
        cout<<memo.size()<<endl;
    }
}

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

int main() {
  int A, B;
  cin >> A >> B;
  int N =0;
  for (int i=A ;i <=B;i++) {
    if (i%10000/1000 ==i%100/10 &&i/10000 == i%10){
      N++;
    }
  }
  cout << N <<endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    ll n,x,y;
    cin >> n;
    vector<pair<ll, ll>> a(n);
    rep(i, n){
        cin >> x >> y;
        a[i] = make_pair(x, y);
    }
    sort(a.begin(), a.end(),greater<>());
    cout << a[0].first + a[0].second << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
using namespace std;

int main() {
  int n;
  
  while(cin >> n) {
    cin.ignore();
    for(int I=0; I<n; I++) {
      string Arr;
      getline(cin, Arr);
      unsigned sz = Arr.size();
      set<string> s;
      string tr1, tr2, ntr1, ntr2;
      // divide loop
      for(unsigned i=1; i<=sz-1; i++) {
	// reverse
	for(int j=0; j<2; j++) {
	  for(int k=0; k<2; k++) {
	    tr1 = Arr.substr(0,i);
	    tr2 = Arr.substr(i);
	    if(j) reverse(tr1.begin(), tr1.end());
	    if(k) reverse(tr2.begin(), tr2.end());
	    // merge
	    ntr1 = tr1 + tr2;
	    ntr2 = tr2 + tr1;
	    // set
	    s.insert(ntr1);
	    s.insert(ntr2);
	  }
	}
      }
  
      cout << s.size() << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 1292
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
public class Main {
	public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		int H=nextInt();
		int W=nextInt();
		int M=nextInt();
		int h[]=new int[H];
		int w[]=new int[W];
		int Y[]=new int[M];
		int X[]=new int[M];
		boolean A[]=new boolean[H];
		boolean B[]=new boolean[W];
		long hmax=0,wmax=0,sum=0,hans=0,wans=0;
		for(int i=0;i<M;i++){
			int y=nextInt()-1;
			int x=nextInt()-1;
			Y[i]=y;X[i]=x;
			h[y]++;w[x]++;
			if(h[y]>hmax){
				hmax=h[y];
			}
			if(w[x]>wmax){
				wmax=w[x];
			}
		}
		for(int i=0;i<M;i++){
			if((wmax==w[X[i]]&&hmax==h[Y[i]])){
				sum++;
			}
			if(A[Y[i]]==false&&h[Y[i]]==hmax){
				hans++;A[Y[i]]=true;
			}
			if(B[X[i]]==false&&w[X[i]]==wmax)
				wans++;B[X[i]]=true;
		}
		if(sum>=hans*wans)
			hmax--;
		System.out.println(hmax+wmax);
	}
	public static long lmod(long i, long j) {
	     return (i%j)<0?(i%j)+0+(j<0?-j:j):(i%j+0);
	 }
	static boolean isOK(int index,int key,int[]a){
		if (a[index]>=key) return true;
	    else return false;
	}
	static int binary_search(int key,int[] a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
}



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

int main(){
 long long N,M,l,r,c,lm,rm,ans,k;
  cin>>N>>M;
  k=0;
  int s=0;
  ans=0;
  vector<long long>A(N),B(M),C(M);
  vector<pair<long long,long long>> pair(M);
    for(int i=0;i<N;i++){
   cin>>A[i];
  }
  sort(A.begin(),A.end());
      for(int i=0;i<M;i++){
   cin>>B[i]>>C[i];
    pair[i]=make_pair(C[i],B[i]);
  }
    sort(pair.begin(),pair.end());
  reverse(pair.begin(),pair.end());
      for(int i=0;i<M;i++){
            for(int j=0;j<pair[i].second;j++){
   if(A[k]>=pair[i].first){
goto good;
   }
	 else{
       A[k]=pair[i].first;
       k++;
     }
  }
  }
  good:
  for(int i=0;i<N;i++){
   ans+=A[i];
  }
 
       cout<<ans<<endl;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const int INF = 1000000000; // 10^9
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    ll X;
    cin >> X;
    ll ans = 0;
    ll base = 100;
    for(ll i = 0; i < 1e19; i++) {
        base *= 1.01;
        // cout << i << endl;
        ans++;
        if (base >= X){
            break;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3624
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

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

    std::vector<uint64_t> T;
    for (size_t i = 0; i < N; ++i) {
        uint64_t t;
        std::cin >> t;
        T.push_back(t);
    }

    auto r = std::accumulate(std::begin(T), std::end(T), 1ULL, [](uint64_t acc, uint64_t v) {
            return boost::math::lcm(acc, v);
        });

    std::cout << r << std::endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
namespace std 
{
    class Test 
    {
        static void Main(string[] args) {
             List<int> ary_a = new List<int>();
            List<string> ary_op = new List<string>();
            List<int> ary_b = new List<int>();
       
            while(true) {
                var input = Console.ReadLine().Split(' ');
                var a = int.Parse(input[0]);
              string op = input[1];
                var b = int.Parse(input[2]);
        
                if( op == "?") break;
       
                ary_a.Add(a);
                ary_op.Add(op);
                ary_b.Add(b);
            }
    
            for (int i= 0; i < ary_a.Count; i++) {
            if(ary_op[i] == "+") Console.WriteLine(ary_a[i] + ary_b[i]);
            else if (ary_op[i] == "-")  Console.WriteLine(ary_a[i] - ary_b[i]);
            else if (ary_op[i] == "*")  Console.WriteLine(ary_a[i] * ary_b[i]);
             else {Console.WriteLine(ary_a[i]/ ary_b[i]);}
            
            }
        }
    }
}



Measured memory_bytes: 17948
a=int(input())
b=int(input())
c=int(input())
x=int(input())
count=0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                count += 1
print(count)


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

int main(){
  string N;
  cin >> N;
  
  for(int i=0; i<(int)N.size(); i++){
    if('7' == N.at(i)){
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  cout << "No" << endl;
}

Measured memory_bytes: 3572
//package com.atcoder.contest171.a;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        String s = fs.next();
        if(Character.isUpperCase(s.charAt(0))){
            System.out.println('A');
        }else{
            System.out.println('a');
        }
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

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

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

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

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


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder num = new StringBuilder();
            int sum = 0;

            string input;

            while ((input = Console.ReadLine()) != null)
            {
                input += " ";

                for (int i = 0; i < input.Length; i++)
                {
                    if (input[i] >= '0' && input[i] <= '9')
                    {
                        num.Append(input[i]);
                    }
                    else if (!string.IsNullOrEmpty(num.ToString()))
                    {
                        sum += int.Parse(num.ToString());
                        num = new StringBuilder();
                    }
                }
            }
            Console.WriteLine(sum);
        }
    }
}

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

int main()
{
  ll M;
  scanf("%lld",&M);
  ll D;
  scanf("%lld",&D);

  int ans = 0;
  for (int i=1; i<=M; i++) {
    for (int j=1; j<=D; j++) {
      int a = j%10;
      int b = j/10%10;
      if (i == a*b && a>=2 && b>=2) ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int h,m,s;
	scanf("%d",&s);
	if(s<60)
	{
		printf("0:0:%d\n",s);
	}
	else if(s<3600)
	{
		m=s/60;
		s=s%60;
		printf("0:%d:%d\n",m,s);
	}
	else if(s>=3600)
	{
		m=s/60;
		s=s%60;
		h=m/60;
		m=m%60;
		printf("%d:%d:%d\n",h,m,s);
	}
}

Measured memory_bytes: 2684
#include<stdio.h>
#include<stdlib.h>
int main(){
  long long  n,a,b,c,d,i;
  scanf("%lld %lld %lld %lld %lld",&n,&a,&b,&c,&d);
  b=labs(b-a);
  n--;
  for(i=0;i<n;i++){
    if(d*(n-i)-i*c>=b&&b>=c*(n-i)-i*d)break;
  }
  printf("%s\n",i-n?"YES":"NO");
  return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

map<ll, ll> sosuCount;
void decompositPrime(ll n) {
  // 割る数の初期値
  ll a = 2;
  // √n ≧ a ( n ≧ a * a ) の間ループ処理
  while (n >= a * a) {
    // a で割り切れたら、a は素因数
    // そして、割られる数を a で割る
    // a で割り切れなかったら、 a を 1 増加させる
    if (n % a == 0) {
      // printf("%d * ", a);
      // cout << a << " ";
      sosuCount[a]++;
      n /= a;
    } else {
      a++;
    }
  }
  // 最後に残った n は素因数
  // printf("%ld\n", n);
  // cout << n << endl;
  sosuCount[n]++;
}

signed main() {
  ll A;
  cin >> A;
  decompositPrime(A);

  ll ans = 0;
  for (auto a : sosuCount) {
    ll kosu = a.second;
    ll temp = 1;
    // debug(kosu);
    if (a.first == 1) {
      continue;
    }
    while (kosu >= temp) {
      kosu -= temp;
      temp++;
      ans++;
    }
  }
  COUT(ans);
  return 0;
}

Measured memory_bytes: 3708
fn gcd(a: usize, b: usize) -> usize {
    if b > a {
        gcd(b, a)
    } else if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn solve() {
    let n: usize = read();
    let a: Vec<usize> = (0..n).map(|_| read::<usize>()).collect();
    let mut m = a[0];
    for i in 1..n {
        m = gcd(m, a[i]);
    }
    println!("{}", m);
}

fn main() {
    let stack_size = 104_857_600;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min, Reverse};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


Measured memory_bytes: 2256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> l4;
#define pb push_back
#define mp make_pair



int main()
{
  vector<ll> cnt(26, 0);
  int n;
  string s;
  cin >> n >> s;
  assert(n == s.length());
  for (auto e : s) ++cnt[e-'a'];
  const int mod = 1e9+7;
  ll ans = 1;
  for (auto e : cnt) ans = ans * (1+e) % mod;
  ans = ((ans-1)%mod+mod)%mod;
  printf("%lld\n", ans);
}


Measured memory_bytes: 512