akhauriyash/Code-Regression huggingface dataset:
/**
	������������ Author : Avi J Patel ������������
	������������ University : DA-IICT ������������
**/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair 
#define mt make_tuple
#define N 100000
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define large 10000000000000001

#define For(i,m,n) for(long long i=m;i<n;i++)
#define st(x) sort(x.begin(),x.end())
#define re(x,i) reverse(x.begin()+i,x.end())
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 
/*void calc()
{
	for(int i=0;i<2005;i++)
	{
		a[i][0]=1;
		a[i][i]=1;
		for(int j=1;j<i;j++)
		{
			a[i][j]=(a[i-1][j-1]+a[i-1][j])%MOD;	
		}
	}
}*/

int main()
{
	string s;
	cin>>s;
	vector<string> a;
	int i=0,n=s.size();
	while(i<s.size())
	{
		string t="";
		while(s[i]=='R')
		{
			t+=s[i];
			i++;
		}
		while(i<n && s[i]=='L')
		{
			t+=s[i];
			i++;
		}
		a.pb(t);
	}
	for(i=0;i<a.size();i++)
	{
		int r=a[i].size();
		for(int j=0;j<a[i].size()-1;j++)
		{
			if(a[i][j]==a[i][j+1])
			{
				cout<<"0 ";
			}
			else
			{
				if(r%2==0)
				{
					cout<<r/2<<" "<<r/2<<" ";
				}
				else if(r%2==1 && j%2==1)
				{
					cout<<r/2<<" "<<r/2+1<<" ";
				}
				else
				{
					cout<<r/2+1<<" "<<r/2<<" ";
				}
				j++;
			}
		}
		if(a[i][a[i].size()-1]==a[i][a[i].size()-2])
		{
			cout<<"0 ";
		}
	}
	return 0;
}











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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s; cin>>s;
	for (int i=0; i<s.size()-1; i++)
		if(s[i]==s[i+1]) {
			cout<<"Bad\n";
			return 0;
		}
	cout<<"Good\n";
	return 0;
}

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

int main(){
  int N, A, B, C, D;
  cin >> N;
  A = N / 1000;
  B = (N / 100) - 10 *A;
  C = (N / 10) - 100*A - 10*B;
  D = N - 1000*A - 100*B - 10*C;

  if(A == B && B == C){
    cout << "Yes" << endl;
  }
  
  else if(B == C && C == D){
    cout << "Yes" << endl;
  }
  
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <utility>
using namespace std;

int A, B;

int main(){
    scanf("%d %d", &A, &B);
    
    if(A%2==1 && B%2==1){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;

int N, M, L;
int G[310][310];
int P[310][310];
void warshall() {
	REP(i, N) {
		REP(j, N) {
			REP(k, N) {
				G[j][k] = min(G[j][k], G[j][i] + G[i][k]);
			}
		}
	}
}
void pwarshall() {
	REP(i, N) {
		REP(j, N) {
			REP(k, N) {
				P[j][k] = min(P[j][k], P[j][i] + P[i][k]);
			}
		}
	}
}

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

	cin >> N >> M >> L;
	REP(i, N) {
		REP(j, N)G[i][j] = INF + 10;
	}
	REP(i, M) {
		int a, b, c;
		cin >> a >> b >> c;
		a--;
		b--;
		if (c > L)continue;
		G[a][b] = c;
		G[b][a] = c;
	}

	warshall();
	REP(i, N) {
		REP(j, N) {
			if (G[i][j] <= L)P[i][j] = 1;
			else P[i][j] = INF;

		}
	}

	pwarshall();
	
	int q;
	cin >> q;
	REP(i, q) {
		int s, t;
		cin >> s >> t;
		s--;
		t--;

		if (P[s][t] == INF)cout << -1 << endl;
		else cout << P[s][t] - 1 << endl;

	}

	return 0;
}



Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>  // std::setprecision()
#include <set>

using namespace std;
using ll = long long;
#define rep(i,a,b) for(ll i=(a); i<(b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define pai 3.14159265358979323846
ll gcd(ll a, ll b){if (a%b == 0)  return(b);else  return(gcd(b, a%b));}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */
void printVec(std::vector<char> &vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}
 
int main() {
    ll d,t,s;
    cin >> d >> t >>s;
    if ((double)d/s <= t ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3100
#include <stdio.h>

int main()
{
  int a, b, c;
  int w, h;

  scanf("%d %d %d", &a, &b, &c);
  if ( a > b ) {
	  w = b;
	  if ( a > c) {
	      h = c;
	  } else {
		  h = a;
	  }
  } else {
	  w = a;
	  if ( b > c) {
	      h = c;
	  } else {
		  h = b;
	  }
  }
  printf("%d\n", (w * h)/2);
  return 0;
}


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

typedef long long ll;
typedef vector<ll> vll;
const ll MOD = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    string a;
    unordered_map<char, int> hashMap(26);
    for (auto c : s) {
        if (hashMap.find(c) != hashMap.end()) {
            ++hashMap[c];
        } else {
            hashMap[c] = 1;
        }
    }
    int ans = 0;
    int cur = 0;
    set<char> st;
    for (int i = 1; i < n - 1; ++i) {
        st.clear();
        cur = 0;
        a += s[i - 1];
        --hashMap[s[i - 1]];
        for (auto c : a) {
            if (st.find(c) == st.end()) {
                if (hashMap.find(c) != hashMap.end() && hashMap[c] > 0) {
                    ++cur;
                }
                st.insert(c);
            }
        }
        ans = max(cur, ans);
    }
    cout << ans << endl;
    return 0;
}

static int speedUp = []() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
}();

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

using namespace std;

int main(void) {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for(int i=0; i<N; i++) {
        cin >> A[i];
    }

    for(int i=K; i<N; i++) {
        if(A[i] > A[i-K]) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4032
#include <bits/stdc++.h>
#include <set>
#include <numeric>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;
 
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }


// const double PI = acos(-1);
// int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
// int a[12][12];

void solve() {
  int n,k; cin >> n >> k;
  vector<int> x(n);
  rep(i,n) cin >> x[i];
  int ans =0;
  rep(i,n) {
    ans += min(2*abs(0-x[i]),2*abs(k-x[i]));
  }
  cout << ans << endl;
}


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


Measured memory_bytes: 256
#include <stdio.h>

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

int main(void) {
	char input[40];
	int i,count;
	while(1) {
		scanf("%s",input);
		if(input[0]=='#' && input[1]==0)break;
		for(i=1,count=0;input[i];i++) {
			if(db[input[i-1]-'a']!=db[input[i]-'a'])count++;
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main(){
	int n;
	string s;
	cin>>n>>s;
	int x=0;
	int max=x;
	for(int i=0;i<n;i++){
		if(s[i] == 'I')
		x++;
		else 
		x--;
		if(max<x)
		max=x;
		
	}
	cout<<max;
	return 0;
}

Measured memory_bytes: 256
A,B=map(int, input().split())

if 0 <=A<=100 and 2<=B<=1000:
    if B%2 == 1:
        print("ERROR")
        exit()
    else :
        if A <=5 :
            fare=0
        elif 6<=A<=12 :
            fare=B//2
        else:
            fare=B
else:
    print("ERROR")
    exit()

print(fare)

Measured memory_bytes: 3060
//




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


#define spdio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pp pop_back()
#define pf push_front
#define ppf pop_front()
#define ff first
#define ss second
#define mp make_pair
#define fr(i,j,n) for(ll i=j; i<n; i++)
#define rfr(i,j,n) for(ll i=n-1; i>=j; i--)
#define pll pair<ll,ll>
#define plb pair<ll,bool>
#define psl pair<string,ll>
#define psb pair<string,bool>
#define srt(v) sort((v).begin(),(v).end())
#define ub(v,val) upper_bound((v).begin(),(v).end(),(val))-(v).begin()
#define lb(v,val) lower_bound((v).begin(),(v).end(),(val))-(v).begin()


typedef long double ld;
typedef long long int ll;


//getline(cin,string);
const ll inf = (ll) 1e18 + 19;
const ll mod = (ll) 1e9  +  7;




void cazz() {
    ll t=1,i=0,j,n;
    //cin>>t;
    while(t--) {
        cin>>n;
        ll cnt=0;
        fr(i,1,n) {
            ll val=(n/i);
            cnt+=val;
            if((n%i)==0) cnt-=1;
        }
        cout<<cnt<<"\n";
    }
}




int main() {
    spdio;
	cazz();
	return 0;
}


Measured memory_bytes: 3652
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <sstream>
#include <cassert>
#include <queue>
#include <bitset>
#include <ctime>
using namespace std;
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define db(v) cerr << #v << " = " << v << endl
#define pb push_back
#define sz(x) ((int)x.size())
#define fst first
#define snd second
typedef long long ll;
typedef pair<int, int> ii;
const int MAXN = 100050;

int n, q, A[MAXN], x;
ll add[MAXN], alt[MAXN];

ll suf(int p){
	return add[n]-add[p];
}

int main(){
	while(scanf("%d %d", &n, &q) >= 1){
		memset(add, 0, sizeof(add));
		memset(alt, 0, sizeof(alt));
		forn(i, n){
			scanf("%d", &A[i]);
			add[i+1] = add[i] + A[i];
			alt[i+1] = (i?alt[i-1]:0)+A[i];
		}
		forn(z, q){
			scanf("%d", &x);
			ll ans = 0;
			int a = -1;
			int b = (int)2e9 + 9901;
			while(b - a > 1){
				int c = a + (b - a) / 2;
				
				int left = x - (c+1)/2;
				int right = x + 1 + c/2;
				int itl = lower_bound(A, A+n, left) - A;
				int itr = lower_bound(A, A+n, right) - A;
				ii aoki = {itl, itr}; int len = (itr-itl);
				ii taka = {n-len, n};
				//~ printf("[%d, %d) = ranges [%d, %d), [%d, %d)\n", left, right, aoki.fst, aoki.snd, taka.fst, taka.snd);
				// take care of case both empty sets...
				ii inter = {max(aoki.fst, taka.fst), min(aoki.snd, taka.snd)};
				int dif = inter.snd - inter.fst;
				//~ printf("DIF = %d\n", dif);
				if(len == 0){
					a = c;
				} else if(dif >= 1){
					b = c;
					if(dif == 1 && len == 1){
						if(!ans) ans = alt[n];
					}
				} else if(dif == 0){
					//~ printf("[%d, %d) vs [%d, %d) = %lld + %lld\n", aoki.fst, aoki.snd, taka.fst, taka.snd, alt[aoki.fst], suf(taka.fst));
					ans = alt[aoki.fst] + suf(taka.fst);
					break;
				} else if(dif == -1){
					ans = (add[aoki.fst]-alt[aoki.fst]) + suf(taka.fst-1);
					break;
				} else {
					a = c;
				}
			}
			printf("%lld\n", ans);
		}
	}	
	return 0;
}


Measured memory_bytes: 3712
while True:
    m,n = map(int,input().split())
    sw = []
    bw = []
    if m == 0 and n == 0:
        break
    for i in range(2*n-1):
        if i % 2 == 0:
            sw.append(list(map(int,input().split())))
        else:
            bw.append(list(map(int,input().split())))
    flag = [[0 for i in range(m)] for j in range(n)]
    l = [(0,0,1)]
    res = 0
    while l:
        bf = l.pop(0)
        if bf[0] == n-1 and bf[1] == m-1:
            res = bf[2]
            break
        flag[bf[0]][bf[1]] = 1
        if 1 <= bf[0] and bw[bf[0]-1][bf[1]] == 0 and flag[bf[0]-1][bf[1]] == 0:
            flag[bf[0]-1][bf[1]] = 1
            l.append((bf[0]-1,bf[1],bf[2]+1))
        if bf[1] < m-1 and sw[bf[0]][bf[1]] == 0 and flag[bf[0]][bf[1]+1] == 0:
            flag[bf[0]][bf[1]+1] = 1
            l.append((bf[0],bf[1]+1,bf[2]+1))
        if 1 <= bf[1] and sw[bf[0]][bf[1]-1] == 0 and flag[bf[0]][bf[1]-1] == 0:
            flag[bf[0]][bf[1]-1] = 1
            l.append((bf[0],bf[1]-1,bf[2]+1))
        if bf[0] < n-1 and bw[bf[0]][bf[1]] == 0 and flag[bf[0]+1][bf[1]] == 0:
            flag[bf[0]+1][bf[1]] = 1
            l.append((bf[0]+1,bf[1],bf[2]+1))
    print(res)

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

int main() {
  string s,t,u;
  int a,b;

  cin >> s >> t;
  cin >> a >> b;
  cin >> u;
  
  if(u==s){a--;}
  if(u==t){b--;}
  
  cout << a << " " << b << endl;
}

Measured memory_bytes: 384
def getlist():
	return list(map(int, input().split()))
INF = float("inf")

#初期化
N, M = getlist()
L = [[INF]  * (2 ** N) for i in range(M + 1)]
for i in range(M + 1):
	L[i][0] = 0

#計算
for i in range(M):
	a, b = getlist()
	c = getlist()
	C = 0
	for j in c:
		C += 2 ** (j - 1)
	for j in range(2 ** N):
		if L[i][j] != INF:
			L[i + 1][j | C] = min(L[i + 1][j | C], L[i][j] + a)
			L[i + 1][j] = min(L[i + 1][j], L[i][j])

if L[-1][-1] == INF:
	print(-1)
else:
	print(L[-1][-1])

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

int main() {
    int a,b;
    int sum=0;
    cin >> a >> b;
    if(a>=b){sum+=a;a--;}
    else{sum+=b;b--;}
    if(a>=b){sum+=a;a--;}
    else{sum+=b;b--;}
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String input = sc.next();

		if( (input.charAt(0) == input.charAt(1) && input.charAt(1) == input.charAt(2))
				|| (input.charAt(1) == input.charAt(2) && input.charAt(2) == input.charAt(3)) )
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}

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

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

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

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

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

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

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

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

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

}


Measured memory_bytes: 22484
n,k,s = gets.chop.split.map(&:to_i)

ans = [0]*n

# if s == 1
#   ans = [2]*n
#   puts ans
#   exit
# end
#
#
# if n == k
#   ans = [s]*n
#   puts ans
#   exit
# end
#
# if k == 0
#   ans = [s-1]*n
#   puts ans
#   exit
# end

if s == 1000000000
  tmp = s-1
else
  tmp = s+1
end



n.times do |i|
  if i < k
    ans[i] = s
  else
    ans[i] = tmp
  end
end

puts ans


Measured memory_bytes: 3580
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (unsigned int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD =  1000000007 ;
const int INF = 2000000000;


    ll A,B,C,D;
    string S,T;
    ll X[100];
int main(){
    cin>>X[0]>>X[1]>>X[2];
    sort(X,X+3);

    cout<<-X[0]+X[2]<<endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll arr[10005]={0};
int main()
{
	ll num;
	cin>>num;
	for(int i=1;i<=100;i++){
		for(int j=1;j<=100;j++){
			for(int k=1;k<=100;k++){
				ll ans=i*i+j*j+k*k+i*j+i*k+j*k;
				if(ans<=10000)
				arr[ans]++;
			}
		}
	}
	for(int i=1;i<=num;i++){
		cout<<arr[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3704
#include <stdio.h>
 
using namespace std;
 
int main(){
    int n,m,l;
    scanf("%d %d %d",&n,&m,&l);
    int A[n][m],B[m][l];
    long long int C[n][l];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < l; j++){
            C[i][j] = 0;
        }
    }
 
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            scanf("%d",&A[i][j]);
        }
    }
    for(int i = 0; i < m; i++){
        for(int j = 0; j < l; j++){
            scanf("%d",&B[i][j]);
        }
    }
 
    for(int i = 0; i < n; i++){
        for(int k = 0; k < l; k++){
            for(int j = 0; j < m; j++){
                C[i][k] += A[i][j]*B[j][k];
            }
        }
    }
 
    for(int i = 0; i < n; i++){
        for(int j = 0; j < l-1; j++){
            printf("%lld ",C[i][j]);
        }
        printf("%lld\n",C[i][l-1]);
    }
}


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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    bool ans = true;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            ans &= (s[i] != 'L');
        } else {
            ans &= (s[i] != 'R');
        }
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  rep(i,N) cin >> h[i];
  int ans = 0;
  rep(i,N) if(h[i] >= K) ans++;
  cout << ans << endl;
  return 0;
}


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

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

	long long a[300000];
	for (int i = 0; i < 3*n; ++i){
		cin>>a[i];
	}
	sort(a,a+3*n,greater<int>());

	long long ans=0;

	int i=1;
	while(n){
		ans+=a[i];
		n--;
		i+=2;
	}

	cout<<ans<<endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mst(a, b) memset((a), (b), sizeof(a))
#define mp(a, b) make_pair(a, b)
#define pi acos(-1)
#define pii pair<int, int>
#define pb push_back
const int INF = 0x3f3f3f3f;
const double eps = 1e-10;
const int maxn = 3e3 + 7;
const int maxm = 5e5 + 10;
int dp[maxn][maxn], path[maxn][maxn];
char x[maxn], y[maxn];
int lcs(int m, int n)
{
    mst(dp, 0);
    for (int i = 1; i <= m; ++i)
    {
        for (int j = 1; j <= n; ++j)
        {
            if (x[i - 1] == y[j - 1])
            {
                dp[i][j] = dp[i - 1][j - 1] + 1;
                path[i][j] = 1;
            }
            else if (dp[i - 1][j] > dp[i][j - 1])
            {
                dp[i][j] = dp[i - 1][j];
                path[i][j] = 2;
            }
            else
            {
                dp[i][j] = dp[i][j - 1];
                path[i][j] = 3;
            }
        }
    }
    return dp[m][n];
}
void output(int i, int j)
{
    if (i == 0 || j == 0)
        return;
    if (path[i][j] == 1)
    {
        output(i - 1, j - 1);
        cout << x[i - 1];
    }
    else if (path[i][j] == 2)
        output(i - 1, j);
    else
        output(i, j - 1);
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    mst(path,0);
    cin >> x >> y;
    int m = strlen(x);
    int n = strlen(y);
    int ans=lcs(m, n);
    if (ans)
    output(m, n);
    cout<<endl;
    return 0;
}

Measured memory_bytes: 71040
#include <stdio.h>

int main(void) {
	int n,i,j,k,x;
	int count=0;
	while(1){
	count = 0;
	scanf("%d %d",&n,&x);
	if(n==0&&x==0){
	break;
	}
	for(i=1;i<=n;i++){
		for(j=i+1;j<=n;j++){
			for(k=j+1;k<=n;k++){
				if(i+j+k==x){
					count++;
				}
			}
		}
	}
	printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 600
N, M = map(int, input().split())

S = [[0]*2 for i in range(N)]
for i in range(N):
    S[i] = list(map(int, input().split()))
     
S = sorted(S)

quantitys = 0
total = 0

for i in range(N):
    # 【根本註】この for 文の中がソースコードの変更点となります。
    # ここまでのコードで、二次元配列 S に「エナジードリンクが安い順」に
    # 金額と本数のセットを格納できているわけですから、あとは「その店で何本買えばよいか？」
    # を計算し、for 文を使わずに普通の数式ベースで金額・本数の計算を行ってしまうのが正しい方法となります。
    
    #【根本註】必要な本数 M から「今何本購入しているか」を表す quantitys を引くことで、
    # 「あと何本購入する必要があるか」を表す変数 need を計算します。
    need = M - quantitys

    #【根本註】この変数 need：「あと何本必要か」が、今参照している店の在庫本数：S[i][1] 以上ならば、
    # その店の在庫を全部購入することができるはずです。（在庫を全部買うと、残りが 0 本ちょうどか 1 本以上に
    # なります）
    if(need - S[i][1])>=0:
        # 【根本註】そのため、この場合は S[i][1] 本のエナジードリンクを S[i][0] 円で買ったものとして、
        # quantitys には S[i][1] を足し、金額の合計 total には S[i][0] * S[i][1] の 金額 × 本数 の合計額を
        # 足してしまいます。こうすることで、従来は購入する本数分だけ回していた for 文の処理を全て削減し、
        # 1 本の数式に落とし込むことができ、処理にかかる時間を非常に大きく削減することが可能になるのです。
        quantitys += S[i][1]
        total += S[i][0] * S[i][1]

    #【根本註】一方で、変数 need：「あと何本必要か」が、今参照している店の在庫本数：S[i][1] より少なければ、
    # その店では need 本だけ購入すれば、必要な本数ちょうどに揃えることが可能になります。
    else:
        # 【根本註】同様に、この場合は need 本のエナジードリンクを S[i][0] 円で買ったものとして、
        # quantitys には need を足し、金額の合計 total には S[i][0] * need の 金額 × 本数 の合計額を
        # 足してしまいます。
        quantitys += need
        total += S[i][0] * need

    #【根本註】ここまでの処理を終えた段階で、もし M （必要本数）から quantities（購入済の本数）を引いた値が
    # ゼロになったならば、必要な本数を買い揃えることができたということになりますから、ループを終了します。
    if M-quantitys == 0:
        break

print(str(total))


Measured memory_bytes: 28588
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <climits>

#define F first
#define S second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())


//INT_MAX
//INT_MIN
//LLONG_MAX
//LLONG_MIN
//DBL_MIN
//DBL_MAX
//LDBL_MIN
//LDBL_MAX

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int w, h, n;
    cin >> w >> h >> n;
    int x, y, a;
    int max_x, min_x, max_y, min_y;
    max_x = w;
    min_x = 0;
    max_y = h;
    min_y = 0;
    for (int i = 0; i < n; i++) {
        cin >> x >> y >> a;
        if (a == 1 && min_x < x) {
            min_x = x;
        }else if (a == 2 && max_x > x){
            max_x = x;
        }else if (a == 3 && min_y < y){
            min_y = y;
        }else if(a == 4 && max_y > y){
            max_y = y;
        }
    }
    if(max_x - min_x < 0 || max_y - min_y < 0){
        cout << 0 << endl;
    }else{
        cout << (max_x - min_x) * (max_y - min_y) << endl;
    }
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;

int w,h;

int main() {
    while(1){
        cin >> w >> h;

        if (w==0 && h==0){
            return 0;
        }

        vector<vector<vector<pair<int,int>>>> G(h, vector<vector<pair<int,int>>>(w));

        int wall;
        REP(i,2*h-1){
            if(i%2==0){//横の壁
                REP(j,w-1){
                    cin >> wall;
                    if (wall == 0){
                        G[i/2][j].push_back(make_pair(i/2,j+1));
                        G[i/2][j+1].push_back(make_pair(i/2,j));
                    }
                }
            }else{//縦の壁
                REP(j,w){
                    cin >> wall;
                    if (wall == 0){
                        G[i/2][j].push_back(make_pair(i/2+1,j));
                        G[i/2+1][j].push_back(make_pair(i/2,j));
                    }
                }
            }
        }

        queue<pair<int,int>> q;
        q.push(make_pair(0,0));
        vector<vector<int>> dist(h,vector<int>(w,-1));
        dist[0][0] = 1;
        bool finished = false;
        while(!q.empty()){
            auto v = q.front();
            q.pop();

            if (v.first == h-1 && v.second == w-1){
                cout << dist[v.first][v.second] << endl;
                finished = true;
                break;
            }

            for (auto next: G[v.first][v.second]){
                if(dist[next.first][next.second] == -1){
                    dist[next.first][next.second] = dist[v.first][v.second]+1;
                    q.push(next);
                }
            }

        }
        if (!finished){
            cout << 0 << endl;
        }

    }

    return 0;
}



Measured memory_bytes: 3132
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <iostream>
#include <string>
#include<algorithm>
#include<map>
#include <vector>
#include <cassert>
#include<cmath>
using namespace std;

int main() {
	int i, j,k;
	int l[2000] = {};
	int r[2000] = {};
	int N;
	cin >> N;
	int sum = 0;
	for (i = 0; i < N; ++i) {
		cin >> l[i] >> r[i];
	}
	for (i = 0; i < N; ++i) {
		sum += r[i] - l[i] + 1;
	}
	cout << sum;

}

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

int main() {
    int N;
    std::cin >> N;
    
    bool found_Y = false;
    char temp;
    for (int i=0; i<N; ++i) {
        std::cin >> temp;
        if (temp=='Y') {
            found_Y = true;
            break;
        }
    }
    std::cout << (found_Y ? "Four" : "Three") << std::endl;
}

Measured memory_bytes: 256
#include <iostream> 
using namespace std;
 
int main(){
	int H, W;
	cin >> H >> W;
	char alphabets[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			string input;
			cin >> input;
			if(input == "snuke"){
				cout << alphabets[j] << i + 1 << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

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

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

int k (int n, int i) {
	return ((n / (int)pow(10, i)) % 10);
}
char op (bool i) {
	return i ? '+' : '-';
}
int main(void)
{
	int n, a;
	cin >> n;
	rep (i, (1 << 3)) {
		a = n / 1000;
		rep (j, 3) {
			a += ((i & (1 << j)) ? 1 : -1) * k(n, j);
		}
		if (a == 7) {
			cout << k(n, 3) 
			<< op(i & (1 << 2)) << k(n, 2) 
			<< op(i & (1 << 1)) << k(n, 1) 
			<< op(i & (1 << 0)) << k(n, 0) 
			<< "=7" << endl;
			break;
		} 
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <assert.h>
#include <cstdio>

// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

inline bool chmin(ll &a, ll b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

inline bool chmax(ll &a, ll b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

//桁数取得
template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}
//整数乗
ll llpow(ll a, ll n)
{
    if (n == 0)
    {
        return 1;
    }
    else
    {
        ll rep = a;
        for (ll i = 1; i < n; i++)
        {
            rep *= a;
        }
        return rep;
    }
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

template <typename T>
T amarinasi(T a, T b)
{
    if (a % b == 0)
    {
        return a / b;
    }
    else if (a % b > 0)
    {
        return a / b + 1;
    }
    else
    {
        return a / b - 1;
    }
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------
const double pi = 3.14159265358979323846264;

int main()
{
    ll h, w;
    cin >> h >> w;
    for (ll i = 0; i < h; i++)
    {
        string s;
        cin >> s;
        cout << s << endl;
        cout << s << endl;
    }
}


Measured memory_bytes: 3656
n=input()
a=""
b=""
l=len(n)
for i in range(l):
    if i%2==0:
        a+="0"
        b+="1"
    else:
        a+="1"
        b+="0"
a_ans=0
b_ans=0
for j in range(l):
    if a[j]!=n[j]:
        a_ans+=1
    else:
        b_ans+=1
print(min(a_ans,b_ans))
    

Measured memory_bytes: 3316
from collections import Counter as C

n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
c = C(a)

res = 0
d = (dict(c))
for k in list(c):
    #print(k,d[k])
    if d[k]<k:
        res += d[k]
    else:
        res += d[k] - k
print(res)


Measured memory_bytes: 22128
#include<iostream>

using namespace std;

int main(void)
{
	double w;
	while(cin>>w)
	{
		if(w<=48)cout<<"light fly";
		else if(w<=51)cout<<"fly";
		else if(w<=54)cout<<"bantam";
		else if(w<=57)cout<<"feather";
		else if(w<=60)cout<<"light";
		else if(w<=64)cout<<"light welter";
		else if(w<=69)cout<<"welter";
		else if(w<=75)cout<<"light middle";
		else if(w<=81)cout<<"middle";
		else if(w<=91)cout<<"light heavy";
		else cout<<"heavy";
		cout<<endl;
	}
}

Measured memory_bytes: 1220
#include "bits/stdc++.h"
#define ll long long
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef pair<ll, ll> pairs;
typedef pair<ll, pairs> tpl;
ll dp[101][100001], a[1001], sum, mod = (ll)1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n, k;
    cin >> n >> k;
    for (ll i = 0; i < n; i++)
        cin >> a[i];
    for (ll i = 0; i <= a[0]; i++)
        dp[0][i] = 1;
    for (ll i = 1; i < n; i++)
    {
        ll pre[k + 1];
        pre[0] = dp[i - 1][0];
        for (ll j = 1; j <= k; j++)
            pre[j] = (pre[j - 1] + dp[i - 1][j]) % mod;
        for (ll j = 0; j <= k; j++)
        {
            //dp[i][j]=dp[i-1][j]+dp[i-1][j-1]+.....+dp[j-a[i]];
            if (j > a[i])
                dp[i][j] = (pre[j] - pre[max(0LL, j - a[i] - 1)] + mod) % mod;
            else

                dp[i][j] = pre[j];
        }
    }
    cout << dp[n - 1][k];
}

Measured memory_bytes: 82428
#include<bits/stdc++.h>
using namespace std;
int main() {
	int X;
	cin >> X;
	vector<bool> expo(X + 1);
    
	expo[1] = 1;
	for (int b = 2; b <= X; b++) {
		int v = b * b;
		while (v <= X) {
			expo[v] = 1;
			v *= b;
		}
	}
	for (int i = X; i >= 1; i--) {
		if (expo[i]) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


w,h = list(map(int, input().split()))
p = [None]*(w+h)
for i in range(w):
    p[i] = (int(input()), 0)
for j in range(h):
    p[w+j] = (int(input()), 1)
p.sort()
nums = [h+1,w+1]
ans = 0
i = 0
es = 0
while es<(h+1)*(w+1)-1:# and nums[0]<w+1 and nums[1]<h+1:
    v, d = p[i]
    if nums[d]==0:
        pass
    else:
        ans += v * nums[d]
        es += nums[d]
        nums[int(not d)] -= 1
    i += 1
#     print(ans, nums)
print(ans)

Measured memory_bytes: 76844
mod = 10 ** 9 + 7
n = gets.to_i

fac = [1]
1.upto(n+1) {|i| fac << fac.last * i % mod}

b = "111011100110101100101000000101".reverse
x = fac.last
r_fac = [1]
b.each_char do |c|
    r_fac[0] = r_fac[0] * x % mod if c == "1"
    x = x ** 2 % mod
end

n.times {|i| r_fac.unshift(r_fac.first * (n - i + 1) % mod)}
r_fac.unshift(1)

s = t = 0
jud = Array.new(n+1,-1)
gets.split.map(&:to_i).each_with_index do |e,i|
    if jud[e] == -1
        jud[e] = i
    else
        s = jud[e] + n - i
    end
end

1.upto(n+1) do |i|
    if i == 1
        puts n
    else
        ans = fac[n+1] * r_fac[i] % mod * r_fac[n-i+1] % mod

        x = 0
        if s >= i - 1
            x = fac[s] * r_fac[i-1] % mod * r_fac[s-i+1] % mod
        end
        ans = (ans - x) % mod

        puts ans
    end
end

Measured memory_bytes: 14148
#include <iostream>
using namespace std;
#pragma warning (disable: 4996)

char c[3009][3009];
long long H, W;
long long V1[3009][3009];
long long V2[3009][3009];

int main() {
	scanf("%lld%lld", &H, &W);
	for (int i = 0; i < H; i++) {
		scanf("%s", &c[i]);
		for (int j = 0; j < W; j++) {
			if (c[i][j] == 'O') V1[i][j]++;
			if (c[i][j] == 'I') V2[i][j]++;
		}
	}

	for (int i = H - 1; i >= 0; i--) {
		for (int j = W - 1; j >= 0; j--) V1[i][j] += V1[i][j + 1];
	}
	for (int i = H - 1; i >= 0; i--) {
		for (int j = W - 1; j >= 0; j--) V2[i][j] += V2[i + 1][j];
	}

	long long ans = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (c[i][j] == 'J') ans += V1[i][j] * V2[i][j];
		}
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 153020
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <sstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll a[2020];
ll b[2020][2020];
const ll INF = 1e18;
int main()
{
	int n;
	ll x;
	scanf("%d%lld",&n,&x);
	for(int i = 1;i <= n;i++){
		scanf("%lld",&a[i]);
	}
	for(int i = 1;i <= n;i++){
		for(int j = 0;j < n;j++){
			if(j == 0) b[j][i] = a[i];
			else if(i-j>0) b[j][i] = min(a[i-j],b[j-1][i]);
			else b[j][i] = min(a[n-(j-i)],b[j-1][i]);
		}
	}
	ll ans = INF;
	for(int k = 0;k < n;k++){
		ll res = 0;
		for(int i = 1;i <= n;i++){
			res += b[k][i];
		}
		ans = min(ans,res + k*x);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 31872
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using uint = uint32_t;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	ll a, b, c;
	cin >> a >> b >> c;
	cout << (a/b+!!(a%b))*c << '\n';

	return 0;
}


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

// int/long:            -2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:      -9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define MOD 1000000007

#define Rep0(i, n)      for (auto i=0; i<n; i++)
#define Rep1(i, n)      for (auto i=1; i<=n; i++)
#define Sort(P) sort(P.begin(), P.end())
#define Rev(P)  reverse(P.begin(), P.end())

int     main() {
        int L, R, d;
        cin >>L >>R >>d;
        cout <<R/d-(L-1)/d <<endl;
        return 0;
}

Measured memory_bytes: 3632
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <memory.h>



using namespace std;
static const double EPS = 1e-9;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,n) for(int i=0;i<(int)n;++i)
#define FORNUM(p, x) for (int num = p; num < (int)(x); ++num)
#define FORI(p, x) for (int i = p; i < (int)(x); ++i)
#define FORJ(p, x) for (int j = p; j < (int)(x); ++j)
#define FORK(p, x) for (int k = p; k < (int)(x); ++k)
#define FORL(p, x) for (int l = p; l < (int)(x); ++l)

typedef pair<int,int>P;
#define INF 1000000000
 
struct edge { 
	int from, to; 
	edge (int from, int to){
		this->from=from; this->to=to;
	}
};
 
int V,E;
typedef vector<edge> edges;
vector<edges> G;


int n;
ll a[105];

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

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

int main(){
	cin >> n;
	FORI(0, n) {
		cin >> a[i];
	}
	ll ans = 1LL;
	FORI(0, n) {
		ans = lcm(ans, a[i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
use proconio::*;
use std::cmp::max;
use std::collections::BinaryHeap;

#[fastout]
fn main() {
    input! {
        d: usize,
        c: [i64; 26],
        s: [[i64; 26]; d],
    };

    let mut lasts = [-1; 26];
    let mut t = vec![26; d];
    let depth = 22;
    for i in 0..d {
        let mut max_score = -10000000;
        for j in 0..26 {
            let tmp = search(i, j, &c, &s, &mut lasts, depth, d, 0, 6);
            if tmp > max_score {
                max_score = tmp;
                t[i] = j;
            }
        }
        lasts[t[i]] = i as i64;
    }

    for &a in &t {
        println!("{}", a + 1);
    }
}

fn calc_score(i: usize, j: usize, c: &Vec<i64>, s: &Vec<Vec<i64>>, lasts: &mut [i64; 26]) -> i64 {
    let mut res = s[i][j];
    let tmp = lasts[j];
    lasts[j] = i as i64;

    for j in 0..26 {
        let i = i as i64;
        let last = lasts[j];
        res -= c[j] * (i - last);
    }

    lasts[j] = tmp;
    res
}

fn search(
    i: usize,
    t: usize,
    c: &Vec<i64>,
    s: &Vec<Vec<i64>>,
    lasts: &mut [i64; 26],
    depth: usize,
    d: usize,
    cscore: i64,
    l: usize,
) -> i64 {
    if depth == 0 || i == d - 1 {
        return calc_score(i, t, &c, &s, lasts) + cscore;
    }

    let l = max(1, l - 1);
    let mut max_score = -1000000;
    let tmp_last = lasts[t];
    lasts[t] = i as i64;
    let tmp_score = calc_score(i, t, &c, &s, lasts);
    let mut cands = BinaryHeap::new();
    cands.reserve(26);
    for j in 0..26 {
        let tmp_score = calc_score(i + 1, j, &c, &s, lasts);
        cands.push((tmp_score, j));
    }
    let w = if l > 1 { 2 } else { 1 };
    for &(_, j) in cands.iter().take(w) {
        let tmp = search(i + 1, j, &c, &s, lasts, depth - 1, d, cscore + tmp_score, l);

        if tmp > max_score {
            max_score = tmp;
        }
    }

    lasts[t] = tmp_last;
    max_score + cscore
}


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

using namespace std;

int main()
{
	int n, w;
	cin >> n >> w;
	vector<pair<int, int>> v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i].first >> v[i].second;
	}

	vector<vector<long long>> dp(n + 1, vector<long long>(w + 1));
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= w; j++) {
			if (j - v[i - 1].first < 0) {
				dp[i][j] = dp[i - 1][j];
			}
			else {
				dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - v[i - 1].first] + v[i - 1].second);
			}
		}
	}
	cout << dp[n][w] << endl;

	return 0;
}

Measured memory_bytes: 80256
#include<iostream>
#include<vector>

using namespace std;


int main(){
    int N,t,ans=1e9;
    cin >> N;
    vector<int> V(N,0);
    for(int i=0;i<N;i++){
        cin >> V[i];
    }
    for(int i=0;i<101;i++){
        t=0;
        for(auto v:  V){
            t += (v-i)*(v-i);
        }
        if (t<=ans){
            ans=t;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
n = int(input())

def divisor(n):
  i = 2
  count = 0
  divs = []
  while n != 1:
    if n % i:
      if count :
        divs.append(count)
        count = 0
      i+= 1
    else:
      n = n //i
      count += 1
      if n == 1:
        divs.append(count)
  ans = 1
  for d in divs:
    ans *= (d + 1)
  return ans

count = 0
for i in range(1,n+1,2):
  if divisor(i) == 8:
    count += 1
print(count)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

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; }

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    int n,k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<ll> s,t;
    rep(i,n){
        cin >> a[i];
        if(a[i] < 0)t.push_back(a[i]);
        else s.push_back(a[i]);
    }
    int S = s.size();
    int T = t.size();
    bool ok = false;
    if(S > 0){
        if(n == k ) ok = (T%2 == 0);
        else ok = true;

    }else {
        ok = (k%2==0);
    }

    ll ans = 1;
    if(!ok){
        sort(ALL(a),[](int x,int y){
            return abs(x) < abs(y);
        });
        rep(i,k){
            ans *= a[i];
            ans %= mod;
        }
    }else {
        sort(s.begin(),s.end());
        sort(t.rbegin(),t.rend());
        if(k%2 == 1){
            ans *= s.back();s.pop_back();
        }
        vector<ll> p;
        while(s.size()>=2){
            ll x = s.back();s.pop_back();
            x *= s.back();s.pop_back();
            p.push_back(x);
        }
        while(t.size()>=2){
            ll x = t.back();t.pop_back();
            x *= t.back();t.pop_back();
            p.push_back(x);
        }
        sort(p.rbegin(),p.rend());
        rep(i,k/2){
            ans *= (p[i]%mod);
            ans %= mod;
        }
    }
    cout << (ans%mod + mod) % mod << endl;
}


Measured memory_bytes: 8252
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

    x /= 200;

    cout << 10 - x << endl;
    return 0;}

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

using namespace std;

#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF (1 << 30)

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

struct edge { int to, cost; };

int N, M, dist[100001];
vector<edge> G[100001];
bool went[100001];

bool dfs(int v, int n) {
	went[v] = true;
	dist[v] = n;

	bool res = true;
	rep(i, G[v].size()) {
		if (!went[G[v][i].to]) res &= dfs(G[v][i].to, n + G[v][i].cost);
		else if (dist[G[v][i].to] != n + G[v][i].cost) res = false;
	}
	return res;
}

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

	cin >> N >> M;
	rep(i, M) {
		int a, b, d;
		cin >> a >> b >> d;
		G[a].push_back(edge{ b, d });
		G[b].push_back(edge{ a, -d });
	}
	memset(went, false, sizeof(went));
	rep(i, N) {
		if (!went[i + 1] && !dfs(i + 1, 0)) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 16640
#include "bits/stdc++.h"
using namespace std;


int bit_cnt(int bit) {
    int cnt = 0;
    for(int i=0; i<5; ++i) {
        if(bit&(1<<i)) ++cnt; 
    }
    return cnt;
}

// mapにでもぶち込めばよくね??
// 5種類の文字から3文字選ぶ組み合わせ * 各文字から1つ選ぶ組み合わせ
int main(){

    // cout << bit_cnt(0b11001) << endl;
    // cout << bit_cnt(0b11000) << endl;
    // cout << bit_cnt(0b00001) << endl;
    // cout << bit_cnt(0b11111) << endl;
    // cout << bit_cnt(0b00000) << endl;

    int N; cin >> N;
    map<char, long long> march;
    march['M']=0;
    march['A']=0;
    march['R']=0;
    march['C']=0;
    march['H']=0;

    int apper;
    for(int i=0; i<N; ++i) {
        string s;
        cin >> s;
        if(s[0]=='M') ++march['M'];
        else if(s[0]=='A') ++march['A'];
        else if(s[0]=='R') ++march['R'];
        else if(s[0]=='C') ++march['C'];
        else if(s[0]=='H') ++march['H'];
    }

    long long res = 0;
    for (int bit=0; bit<(1<<5);++bit) {
        long long tmp = 0;
        if(bit_cnt(bit)==3) {
            long long tmp_2 = 1;
            if(bit&0b10000) tmp_2 *= march['M'];
            if(bit&0b01000) tmp_2 *= march['A'];
            if(bit&0b00100) tmp_2 *= march['R'];
            if(bit&0b00010) tmp_2 *= march['C'];
            if(bit&0b00001) tmp_2 *= march['H'];
            tmp = tmp_2;
        }    
        res += tmp;
    }

    cout << res << endl;
}

Measured memory_bytes: 256