akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int d;
  cin >> d;
  int c[26];
  for(int i = 0; i < 26; i++) {
    cin >> c[i];
  }
  vector<vector<int>> s(d, vector<int>(26));
  for(int i = 0; i < d; i++) {
    for(int j = 0; j < 26; j++) {
      cin >> s[i][j];
    }
  }
  vector<int> t(d);
  for(int i = 0; i < d; i++) {
    cin >> t[i];
    t[i]--;
  }
  vector<int> last(26, 0);
  int score = 0;
  for(int i = 0; i < d; i++) {
    score += s[i][t[i]];
    last[t[i]] = i + 1;
    for(int j = 0; j < 26; j++) {
      score -= c[j] * ((i + 1) - last[j]);
    }
    cout << score << endl;
  }
  return 0;
}

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

int main() {
  int N,S,p,A ;
  cin >> N ;
  A=N;
  S=0;
  p=100000000;
  
  for (int i=0;i<9;i++){
    S += N/p ;
    N -= (N/p)*p ;
    p /= 10 ;
  }
  if (A%S==0){
    cout << "Yes" <<endl;
  }
  else {
    cout << "No" <<endl;
  }
 
}


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

const int N = 1e5 + 10;
long long ans, a[N], b[N];
int n;
vector<int> v;

bool cmp(int i, int j){
	return ((a[i] + b[i]) > (a[j] + b[j]));
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	cin >> n;
	
	for (int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	
	for (int i = 0; i < n; i++)
		v.push_back(i);
	sort(v.begin(), v.end(), cmp);
	
	for (int i = 0; i < n; i++){
		if(i % 2 == 0)
			ans += a[v[i]];
		else
			ans -= b[v[i]];
	}
	
	cout << ans;
}

Measured memory_bytes: 2428
h, w, m = map(int, input().split())
h_cnt = [0 for _ in range(h)]
w_cnt = [0 for _ in range(w)]
xs = []
ys = []
for _ in range(m):
    y, x = map(int, input().split())
    y -= 1
    x -= 1
    h_cnt[y] += 1
    w_cnt[x] += 1
    xs.append(x)
    ys.append(y)
h_max = max(h_cnt)
w_max = max(w_cnt)
h_max_induce = {i: v for i, v in enumerate(h_cnt) if v == h_max}
w_max_induce = {i: v for i, v in enumerate(w_cnt) if v == w_max}

cnt = 0
for i in range(m):
    x = xs[i]
    y = ys[i]
    if x in w_max_induce and y in h_max_induce:
        cnt += 1
if cnt == len(h_max_induce.keys())*len(w_max_induce.keys()):
    print(h_max+w_max-1)
else:
    print(h_max+w_max)




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

using namespace std;

char field[50][50];
int mines[50][50];
int mr[8] {-1, -1, -1, 0, 0, 1, 1, 1};
int mc[8] {0, -1, 1, 1, -1, 0, -1, 1};

int r, c;

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    
    (cin >> r >> c).get();
    
    for (int i = 0; i < r; ++i)
    {
        for (int j = 0; j < c; ++j)
            field[i][j] = cin.get();
        cin.get();
    }
    
    for (int k = 0; k < r; ++k)
    {
        for (int s = 0; s < c; ++s)
        {
            if (field[k][s] == '#')
                continue;
            
            int cnt = 0;
            
            for (int x = 0; x < 8; ++x)
            {
                int nr = k + mr[x], nc = s + mc[x];
                if (nr < 0 || nc < 0 || nr >= r || nc >= c)
                    continue;
                
                if (field[nr][nc] == '#')
                    ++cnt;
            }
            
            mines[k][s] = cnt;
        }
    }
    
    for (int a = 0; a < r; ++a)
    {
        for (int b = 0; b < c; ++b)
        {
            if (field[a][b] == '.')
                cout << mines[a][b];
            else
                cout << field[a][b];
        }   
        cout << '\n';
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
int main() {
 int d;
 priority_queue<int> qu;
 for (int i=0;i<10;i++) { cin >> d; qu.push(d);}
 for (int i=0;i<3;i++) { cout << qu.top() << endl; qu.pop(); }
 return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<pair<int, int>> res;
  
  sort(a.begin(), a.end());
  int smallest = a[0];
  int biggest = a[a.size() - 1];
  for (int i = 1; i < n - 1; i++){
    if (a[i] < 0){
      res.pb({biggest, a[i]});
      biggest -= a[i];
    }else{
      res.pb({smallest, a[i]});
      smallest -= a[i];
    }
  }
  cout << biggest - smallest << endl;
  rep(i, (int)res.size()) cout << res[i].first << ' ' << res[i].second << endl;
  cout << biggest << ' ' << smallest << endl;
}

Measured memory_bytes: 4712
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

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

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll i,j,x,N,cnt=0;
  cin>>N;
  vec e,o;
  pvec ve,vo;
  rep(i,N){
    cin>>x;
    if(i%2){
      e.pb(x);
    }else{
      o.pb(x);
    }
  }
  e.pb(0);o.pb(0);
  vsort(e);
  vsort(o);
  rep1(i,e.size()){
    if(e[i]==e[i-1]){
      ve[ve.size()-1].first++;
    }else{
      ve.pb(datas(1,e[i]));
    }
  }
  rep1(i,o.size()){
    if(o[i]==o[i-1]){
      vo[vo.size()-1].first++;
    }else{
      vo.pb(datas(1,o[i]));
    }
  }
  vrsort(ve);vrsort(vo);
  ve.pb(datas(0,0));
  vo.pb(datas(0,0));
  i=j=0;
  if(ve[i].second==vo[j].second){
    if(ve[i].first-ve[i+1].first<vo[j].first-vo[j+1].first){i++;}
    else{ j++;}
  }
  cout<<N-ve[i].first-vo[j].first<<endl;
  return 0;
}

Measured memory_bytes: 3312
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
using namespace std;
int main(){
    int n,h;
    int a[100001]={};
    int b[100001]={};
    cin>>n>>h;
    int m=0;
    for(int i = 0;i<n;i++){
        cin>>a[i]>>b[i];
        if(a[i]>m){
            m=a[i];
        }
    }
    long long int ans = 0;
    sort(b,b+n);
    for(int i = n-1;i>=0;i--){
        if((m<b[i])&&(h>0)){
            h-=b[i];
            ans++;
        }else{
            break;
        }
    }
    if(h>0){
       if(h%m==0){
        ans+=h/m;
        }else{
        ans+=h/m+1;
        }
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vll = vector<vector<ll> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using the = pair<int, int>;
using lthe = pair<ll, ll>;

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

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,1,0,-1 };

int main()
{
    int a, b;
    cin >> a >> b;
    int k;
    cin >> k;
    Vi Ans;


    int s = b - a +1;

    if (s <= 2 * k) {
        for (int i = a; i <= b; i++) {
            cout << i << endl;
        }
        return 0;
    }



    for (int i = 0; i < k; i++) {
        Ans.push_back(a);
        a++;
    }
    for (int i = 0; i < k; i++) {
        Ans.push_back(b);
        b--;
    }
    sort(Ans.begin(), Ans.end());
    for (int u : Ans) {
        cout << u << endl;
    }
}


Measured memory_bytes: 256
import Data.List
main = do
  getLine
  s <- getLine
  print $ solve s 0 0

solve :: String -> Int -> Int -> Int
solve []       _   max = max
solve ('I':as) now max
  | now + 1 > max = solve as (now + 1) (now + 1)
  | otherwise     = solve as (now + 1) max
solve ('D':as) now max = solve as (now - 1) max


Measured memory_bytes: 380
#include <bits/stdc++.h>  // ver2.3.1
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define COUNT(a,k) upper_bound(ALL(a),k)-lower_bound(ALL(a),k)
#define BIGGER(a,k) a.end()-upper_bound(ALL(a),k)
#define SMALLER(a,k) lower_bound(ALL(a),k)-a.begin()
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Pii pair<int,int>
#define VPii vector<Pii>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define itos to_string
#define stoi stoll
#define FI first
#define SE second
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define cyes cout<<"yes"<<endl
#define cno cout<<"no"<<endl
#define _ <<' '<<
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vin(a) rep(iI,0,a.size())cin>>a[iI]
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lY,0,a.size()){if(!a[lY].empty()){Vout(a[lY]);}else cout<<endl;}
#define VPout(a) rep(lX,0,a.size())cout<<a[lX].FI<<' '<<a[lX].SE<<endl
#define Verr(a) rep(iZ,0,a.size()-1)cerr<<a[iZ]<<' ';cerr<<a.back()<<endl
#define VVerr(a) rep(J,0,a.size()){if(!a[J].empty()){Verr(a[J]);}else cerr<<'.'<<endl;}
#define VPerr(a) rep(iX,0,a.size())cerr<<a[iX].FI<<' '<<a[iX].SE<<endl
#define INF 3000000000000000000  //  3.0*10^18(MAXの1/3くらい)
#define MAX LLONG_MAX
#define PI 3.141592653589793238462
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int scomb(int n, int r){if((n-r)<r)r=n-r;  //  nCr (小さい場合)
int a=1;for(int i=n;i>n-r;--i){a=a*i;}for(int i=1;i<r+1;++i){a=a/i;}return a;}
int comb(int n, int r){if((n-r)<r)r=n-r;  //  nCr (%MOD)
int a=1;for(int i=n;i>n-r;--i){a=a*i%MOD;}for(int i=1;
i<r+1;++i){a=a*mypow(i,MOD-2,MOD)%MOD;}return a%MOD;}
int stpow(int n){  //  階乗(%MOD)
if(n==0)return 1;int a=1;rep(i,1,n+1)a=a*i%MOD;return a;}
Vi stpowV(){Vi a(100001);  //  階乗配列(%MOD)
a[0]=1;repeq(i,1,100000)a[i]=a[i-1]*i%MOD;return a;}
void press(auto &v){v.erase(unique(ALL(v)),v.end());}  //  圧縮



signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  string s;
  cin >> s;
  if(s=="SAT") cout << 1 << endl;
  if(s=="FRI") cout << 2 << endl;
  if(s=="THU") cout << 3 << endl;
  if(s=="WED") cout << 4 << endl;
  if(s=="TUE") cout << 5 << endl;
  if(s=="MON") cout << 6 << endl;
  if(s=="SUN") cout << 7 << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <sstream>
#include <limits.h>
using namespace std;

int main()
{
    int x,n;
    cin >> x >> n;
    std::vector<int> p;
    for(int i=0; i<n; i++){
        int tmp;
        
        cin >> tmp;
        p.push_back(tmp);
    }
    if(n == 0){
        cout << x << endl;
        return 0;
    }
    for(int i=0; i<=100; i++){
        int tmp = x-i;
        //cout << tmp << endl;
        if(tmp >= 0){
        std::vector<int>::iterator itr = std::find(p.begin(), p.end(), tmp);
        if(itr == p.end()){
            cout << tmp << endl;
            return 0;
        }
        }
        
        tmp = x+i;
        //cout << tmp << endl;
        if(tmp <= 101){
        std::vector<int>::iterator itr = std::find(p.begin(), p.end(), tmp);
        if(itr == p.end()){
            cout << tmp << endl;
            return 0;
        }
        }
    }
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define pob pop_back
#define vl vector<ll>
#define mp make_pair
#define sz size()
#define fast ios::sync_with_stdio(0)
#define maxx 100005
#define edge pair<ll,ll>
using namespace std;


int main()
{
	ll n,a,b;
	cin>>n>>a>>b;
	ll x;
	x=n/(a+b);
	x=a*x;
	ll p;
	p=n%(a+b);
	if(p<=a)
	{
		x=x+p;
	}
	else
	x=x+a;
	cout<<x;
	
}

Measured memory_bytes: 256
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; }

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using ll=long long;
const ll MOD=1e9+7;
const int INF=1<<30;

int dp[3][100000];
int v[3][100000];

int main(){
  int N;
  cin >> N;
  rep(j,N){
    cin >> v[0][j] >> v[1][j] >> v[2][j];
  }
  dp[0][0]=v[0][0];
  dp[1][0]=v[1][0];
  dp[2][0]=v[2][0];
  for(int j=0;j<N;j++){
    for(int i=0;i<3;i++){
      for(int k=0;k<3;k++){
        if(i!=k){
          chmax(dp[i][j+1],dp[k][j]+v[i][j+1]);
        }
      }
    }
  }
  int ans=max(dp[0][N-1],max(dp[1][N-1],dp[2][N-1]));
  cout << ans << endl;
  
  
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,ans=0;
    cin>>a>>b;

if(a<=0&&b>=0||a==0||b==0){
        cout<<"Zero"<<endl;
    }else if(b<0&&(a-b)%2==0){
        cout<<"Negative"<<endl;
    }else{
        cout<<"Positive"<<endl;
    } 

}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        System.out.println((a + b +  1) / 2);
    }


    public static void main(String[] args){
        new Main().solve();
    }
}


Measured memory_bytes: 35552
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ulli unsigned long long int
#define what_is(x) cerr << #x << " is " << x << endl;
#define pi 2*acos(0.0)
#define F  first
#define S  second
//#define endl '\n'
#define all(x) x.begin(),x.end()
using namespace std;
const lli INF = 1e18L+5;
/*
lli power(lli x,lli y)
{
    lli res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}
*/
int main()
{
//cout.precision(10);
//cout.setf(ios::fixed,ios::floatfield);
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   //freopen("input1.txt","r",stdin);
   //freopen("outputmid1.txt","w",stdout);
	lli T=1;
    //cin>>T;
	while(T--)
	{
		string s;
		cin>>s;
		if(s=="Sunny")
		cout<<"Cloudy"<<endl;
		else if(s=="Cloudy")
		cout<<"Rainy"<<endl;
		else if(s=="Rainy")
		cout<<"Sunny"<<endl;
	}
}
/*
6
0 8 13 14 17 19
*/


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

int main() {
  int N;
  cin >> N;
  map<string,int> A;
  for(int i=0;i<N;i++){
   string sub;
    cin >> sub;
    A[sub]=++A[sub];
  }
    
  printf("AC x %d\n",A["AC"]);
  printf("WA x %d\n",A["WA"]);
  printf("TLE x %d\n",A["TLE"]);
  printf("RE x %d\n",A["RE"]);
  
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << c << " " << a << " " << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 8000 + 10;
int n, x, y;
char s[maxn];
vector<int> a, b, c;
bool check(int x, vector<int> & a)
{
	bitset<maxn << 1> mask;
	mask[maxn] = 1;
	for(auto v : a)
		mask = (mask << v) | (mask >> v);
	if(0 <= x + maxn && x + maxn < (maxn << 1))
		return mask[x + maxn];
	else
		return 0;
}
int main()
{
	scanf("%s", s + 1);
	n = strlen(s + 1);
	int l = 0;
	while(l <= n)
	{
		int r = l + 1;
		while(r <= n && s[r] == 'F')
			++r;
		a.push_back(r - l - 1);
		l = r;
	}
	scanf("%d%d", &x, &y);
	x -= a[0];
	for(int i = 1; i < a.size(); ++i)
		if(i & 1)	
			b.push_back(a[i]);
		else
			c.push_back(a[i]);
	if(check(y, b) && check(x, c))
		puts("Yes");
	else
		puts("No");
	return 0;
}
		
	

Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 100000000
#define INF 1000000000000000000
#define MOD 1000000007
#define mod 1000000007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    ll n;cin>>n;
    V<tuple<ll,ll,char,ll,string>>aa;
    for(ll i=0;i<n;i++){
        ll a,b,c;char d;string e;
        cin>>a>>b>>d>>c>>e;
        aa.pb(make_tuple(a,b,d,c,e));
    }
    sort(all(aa));
    for(ll i=0;i<n;i++){
        ll a=get<0>(aa[i]);
        ll b=get<1>(aa[i]);
        char d=get<2>(aa[i]);
        ll c=get<3>(aa[i]);
        string e=get<4>(aa[i]);
        cout<<a<<" "<<b<<" "<<d<<" "<<c<<" "<<e<<Endl;
    }
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------















































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

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

typedef long long int ll;

//const ll INF=(ll)1e18;
const int INF=(1<<30);

int main(){
  int N;
  cin >> N;
  vector<int> h(N);
  REP(i,N){
    cin >> h[i];
  }

  vector<int> dp(N,INF);
  dp[0]=0;
  REP(i,N){
    if(i+1<N){
      dp[i+1] = min(dp[i] + abs(h[i]-h[i+1]), dp[i+1]);
    }
    if(i+2<N){
      dp[i+2] = min(dp[i] + abs(h[i]-h[i+2]), dp[i+2]);
    }
  }
  cout << dp[N-1] << endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

using namespace std;
typedef long long ll;

const int N_MAX = 200000;
int N;
bool used[N_MAX];
int idx[N_MAX];
vector<int> vs;
vector<int> buf;
vector<int> G[N_MAX];
vector<int> G_inv[N_MAX];
vector<vector<int>> ans;

void clear(){
    for(int i = 0; i < N; i++) used[i] = false;
}

void dfs1(int v){
    used[v] = true;
    for(int i = 0; i < G[v].size(); i++){
        if(!used[G[v][i]]) dfs1(G[v][i]);
    }
    vs.push_back(v);
}

void dfs2(int v, int k){
    used[v] = true;
    idx[v] = k;
    for(int i = 0; i < G_inv[v].size(); i++){
        if(!used[G_inv[v][i]]) dfs2(G_inv[v][i], k);
    }
    buf.push_back(v);
}

void scc(){
    for(int i = 0; i < N; i++){
        if(!used[i]) dfs1(i);
    }
    clear();
    int cur = 0;
    for(int i = vs.size()-1; i >= 0; i--){
        if(!used[vs[i]]) {
            dfs2(vs[i], cur);
            cur++;
            ans.push_back(buf);
            buf.clear();
        }
    }
}

ll X[1000], Y[1000];
ll D;

int scc_idx[2000];


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int n; cin >> n >> D;
    N = 2*n;
    for(int i = 0; i < n; i++) cin >> X[i] >> Y[i];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i == j) continue;
            ll d1 = abs(X[i]-X[j]);
            ll d2 = abs(X[i]-Y[j]);
            
            if(d1 < D && d2 < D) {
                G[i].push_back(n+i);
                G_inv[n+i].push_back(i);
            }else if(d1 < D){
                G[i].push_back(j+n);
                G_inv[j+n].push_back(i);
            }else if(d2 < D){
                G[i].push_back(j);
                G_inv[j].push_back(i);
            }

            ll d3 = abs(Y[i]-X[j]);
            ll d4 = abs(Y[i]-Y[j]);
            if(d3 < D && d4 < D) {
                G[n+i].push_back(i);
                G_inv[i].push_back(n+i);
            }else if(d3 < D){
                G[n+i].push_back(j+n);
                G_inv[j+n].push_back(n+i);
            }else if(d4 < D){
                G[n+i].push_back(j);
                G_inv[j].push_back(n+i);
            }
        }
    }
    scc();
    for(int idx = 0; idx < ans.size(); idx++){
        for(int i : ans[idx]){
            scc_idx[i] = idx;
        }
    }
    for(int i = 0; i < n; i++){
        if(scc_idx[i] == scc_idx[i+n]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for(int i = 0; i < n; i++){
        if(scc_idx[i] < scc_idx[i+n]){
            cout << Y[i] << endl;
        }else{
            cout << X[i] << endl;
        }
    }
}


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

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

const int MAX = 510000; //nCrのr
//const ll INF = (ll)1e18 + 1;

#include <cassert>

class mint {
public:
    long long x;
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    //mint operator-() const{ return mint(-x);}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

};

template<class T>
struct combination {
    vector<T> fac, facn, finv, inv;
    combination(long long n):fac(MAX), facn(MAX), finv(MAX), inv(MAX) {
      assert(n < MOD);
      fac[0] = fac[1] = 1;
      facn[1] = n;
      finv[0] = finv[1] = 1;
      inv[1] = 1;
      for (int i = 2; i < MAX; ++i){
        fac[i] = fac[i - 1] * i;
        facn[i] = facn[i - 1] * (n - i + 1);
        inv[i] = mint(MOD) - inv[MOD%i] * (MOD / i);
        finv[i] = finv[i - 1] * inv[i];
      }
    }
    T com(long long n, long long k) {
      if (k < 0 || k > n) return 0;
      return facn[k] * finv[k];
    }
    T fact(ll n){
      if (n < 0) return 0;
      return facn[n];
    }
};

int main(){
  ll n, a, b; cin >> n >> a >> b;
  combination<mint> C(n);
  mint ans = mint(2).pow(n) - 1;

  ans -= C.com(n, a);
  ans -= C.com(n, b);
  cout << ans.x << endl;
}


Measured memory_bytes: 16256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int a[105];

int main(){
    scanf("%d",&n);
    ll sum=0;
    for (int i=1;i<=n;i++) scanf("%d",&a[i]),sum+=a[i];
    ll mx=1e9;
    int ans=0;
    for (int i=1;i<=n;i++)
    {

        if (abs(a[i]*n-sum)<mx)
        {
            mx=abs(a[i]*n-sum);
            ans=i;
        }
    }

    printf("%d\n",ans-1);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,c,k,total=0;
    cin>>a>>b>>c>>k;
    while(k>0)
    {
    	if(k>a)
    	{
    		total+=a;
    		k-=a;
		}
		else
		{
			total+=k;
			break;
		}
		if(k>b)
		{
			k-=b;
		}
		else
		break;
		total-=k;
		break;
	}
	cout<<total;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)    FOR (i,0,n)
#define ALL(f,x,...) ([&](decltype((x)) ALL) {\
return (f)(begin(ALL), end(ALL), ## __VA_ARGS__); })(x)

using namespace std;
using ll = int64_t;

vector<ll> A;

int f(int start, int end, int bk)
{
    ll mn = INT64_MAX;

    int idx = 0;
    bool flg = false;
    FOR(i, bk, end)
    {
        ll lv = start == 0 ? A[i] : A[i] - A[start - 1];
        ll rv = A[end] - A[i];
        if (abs(lv - rv) < mn)
        {
            mn = abs(lv -rv);
            idx = i;
            flg = true;
        }
        else if (flg) break;
    }

    return idx;
}

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

    A.resize(N);

    ll bk = 0;
    int now;
    REP(i, N)
    {
        cin >> now;
        A[i] = bk + now;
        bk = A[i];
    }

    ALL(sort, A);

    ll sm = INT64_MAX;
    int l = 0;
    int r = 0;
    FOR(i, 1, N - 2)
    {
        l = f(0, i, l);
        if (r < i + 1) r = i + 1;
        r = f(i + 1, N - 1, r);
        ll P = A[l];
        ll Q = A[i] - P;
        ll R = A[r] - A[i];
        ll S = A[N - 1] - A[r];
        ll mx = max(max(max(P, Q), R), S);
        ll mn = min(min(min(P, Q), R), S);
        if (mx - mn < sm)
        {
            sm = mx - mn;
        }
    }

    cout << sm << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define maxn 262144
using namespace std;
int read(){
	int x=0,c;while(!isdigit(c=getchar()));
	while(x=x*10+c-'0',isdigit(c=getchar()));
	return x;
}
int ans[maxn],num[maxn][2],n,a[maxn];
void marge(int x,int y){
	if(num[x][0]==num[y][0]&&num[x][1]==num[y][1])return;
	if(num[x][0]==num[y][0]){num[x][1]=a[num[x][1]]<a[num[y][1]]?num[y][1]:num[x][1];return;}
	if(a[num[x][0]]>a[num[y][0]])
		num[x][1]=a[num[x][1]]<a[num[y][0]]?num[y][0]:num[x][1];
	else{
		int tmp=num[x][0];
		num[x][0]=num[y][0];
		num[x][1]=a[tmp]>a[num[y][1]]?tmp:num[y][1];
	}
}
int main(){
	n=read();
	for(int i=0;i<1<<n;i++)a[i]=read(),num[i][0]=i,num[i][1]=1<<n;
	for(int i=1;i<1<<n;i++){
		for(int j=0;j<n;j++)
			if(i&(1<<j))marge(i,i-(1<<j));
	}
//	printf("%d %d\n",num[(1<<n)-1][0],num[(1<<n)-1][1]);
	for(int i=1;i<(1<<n);i++){
		ans[i]=max(ans[i-1],a[num[i][0]]+a[num[i][1]]);
		printf("%d\n",ans[i]);
	}
	return 0;
}

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

using namespace std;

int main() {
  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define st(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())
int inf = 1000000007;
i64 giant = 4000000000000000000;

using namespace std;

int main() {
	int n, d;
	cin >> n >> d;
	int s = d * 2 + 1;
	int ans = n / s;
	if (n % s != 0)ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
/*
	Nishant Singh
	nishant.ns19
*/
#include <bits/stdc++.h>
#include <functional> 
#include <iostream> 

// ******** Big Integer ********
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// #define ll1024  int1024_t
// ******** Big Integer ********

// ******** Using PBDS ********
// #include <ext/pb_ds/assoc_container.hpp> // Common file 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// ******** Using PBDS ********

using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vll vector<ll>
#define vec vector
#define setcount(x) __builtin_popcountll(x)
#define f first
#define s second
#define mp make_pair
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define REV(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define in insert
#define init(x,a) memset(x,a,sizeof(x))
#define all(c) c.begin(),c.end()
#define pq priority_queue
#define ffl fflush(stdout)
#define mset multiset
#define out(x) cout<<#x<<" = "<<" "<<x<<"\n";
#define ub upper_bound
#define lb lower_bound 
#define ln "\n"
#define Y "YES"
#define N "NO"
ll const mod=1e9 + 7;
ll const inf=2e18;

// ******** Using PBDS ********
// typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
//              tree_order_statistics_node_update> 
//                 os; 
// ******** Using PBDS ********

inline ll add(ll a,ll b) 
{ 
	return (a%mod + b%mod + mod)%mod; 
}

inline ll mul(ll a,ll b) 
{ 
	return (a%mod * b%mod + mod)%mod; 
}

inline ll sub(ll a,ll b) 
{ 
	return (a%mod - b%mod + mod)%mod; 
}

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

ll modexp(ll x, ll n){
	if(n==0){
		return 1;
	}
	else if(n&1){
		return (modexp((x*x)%mod, n/2)%mod * x%mod)%mod;
	}
	else{
		return (modexp((x*x)%mod, n/2)%mod);
	}
}

ll modinv(ll n)
{
	return modexp(n,mod-2);
}

// ******** GLOBAL VARIABLES ********


// ******** GLOBAL VARIABLES ********

void solve(){
	ll k;
	cin>>k;
	ll ans=0;
	FOR(i,1,k)
	{
		FOR(j,1,k)
		{
			FOR(l,1,k)
			{
				ans=ans+(gcd(gcd(i,j),l));
			}
		}
	}
	cout<<ans;

}  

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T=1;
	// cin>>T; 	
	for(int t=1;t<=T;t++)
	{
		// cout<<"Case #"<<t<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep2(i, l, r) for (ll i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL; // VL a(n);
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VL> VLL; // VII a(n,VI(m)) n * m
typedef pair<ll, ll> PL;
typedef map<ll, ll> MP; // MP a;
typedef vector<pair<ll, ll>> PS; // PS a(n);

template <class T, class U>
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)

int main() {
  ll n,k,m,x=0,y=0,z=0,cnt=0,h=0,w=0,sum=0,ans=0,Max=-1, Min=3e9+1;
  string s,t;
  cin >> n;
  VS a(n);
  rep(i,n) {
    cin >> a[i];
    if(a[i]=="AC"){
      x++;
    }
    if(a[i]=="WA"){
      y++;
    }if(a[i]=="TLE"){
      z++;
    }if(a[i]=="RE"){
      h++;
    }
  }
  cout << "AC x " << x << endl;
  cout << "WA x " << y << endl;
  cout << "TLE x " << z << endl;
  cout << "RE x " << h << endl;
  return 0;
}

Measured memory_bytes: 6424
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
 
using namespace std;

 
const int MAX_N = int(1e6) + 10;
long long int MOD=1e9+7;
const long long int INF=1e18;
 
typedef long long int ll;
typedef unsigned long long int llu;
 
 
 
inline ll mul(ll a,ll b){
 
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll c=a*b;
    c=(c+MOD)%MOD;
    return c;
}
inline ll add(ll a,ll b){
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll ans=(a+b);
    ans=(ans+MOD)%MOD;
    return ans;
}
ll power(ll a,ll b,ll c=0){
    ll ans=1;
    while(b){
        if(b&1){
            ans=mul(ans,a);
        }
        a=mul(a,a);
        b=b/2;
    }
    return ans;
}
 
  
 
 
#define all(x) (x).begin(),(x).end()




//s.reserve(32768); //updated !
//s.max_load_factor(0.25);



ll a[30005];
ll dp[30005];



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


   MOD=998244353LL;

   dp[0]=power(2LL,n*1LL,MOD);
   ll inversess=power(2LL,MOD-2,MOD);

   for(int i=0;i<n;i++){
    cin>>a[i];
    for(int j=s;j>=a[i];j--){
        dp[j]=add(dp[j],mul(dp[j-a[i]],inversess));
    }
   }

   cout<<dp[s]<<endl;



   
   
    
}


 
    



    



    
    
    




    


    

    






    
    

    
 
    
 

 
 
    
 
 


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

#ifdef DEBUG
#define debug(x) cout << #x << ": " << x << endl
#else
#define debug(x)
#endif

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPS(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()

#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;

const ll INF = 1e18;
const ll MOD = 1e9+7;

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


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int A, B, C; cin >> A >> B >> C;
    int K; cin >> K;
    int ans = 0;

    ans += min(A, K);
    K -= ans;
    K -= B;
    if(K <= 0) cout << ans << endl;
    else cout << ans - K << endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
#ifdef LOCAL_TEST
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    ll n, a, b;
    cin >> n >> a >>b;
    cout << min(a*n, b) << endl;
    return 0;
}

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

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

long long gcd(long long a, long long b){
    if (a < b) swap(a, b);
    return b ? gcd(b, a % b) : a;
}

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

//--------------------------- Solve ---------------------------//

void solve() {
    int N; cin >> N;
    long long ans = 1;
    for (int i = 0; i < N; i++) {
        long long t; cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3644
class Node
  attr_accessor :key, :parent, :left, :right
  def initialize(key)
    @key = key
  end
end

n = gets.to_i
heap = []
gets.split.map(&:to_i).each{ |i| heap << Node.new(i) }
heap.unshift nil
(1..n).each do |i| 
  heap[i].parent = heap[i/2] if i > 0 
  heap[i].left = heap[2*i] if n >= 2*i
  heap[i].right = heap[2*i+1] if n >= 2*i+1
end
(1..n).each do |i|
 print "node #{i}: key = #{heap[i].key},"
 print " parent key = #{heap[i].parent.key}," if heap[i].parent
 print " left key = #{heap[i].left.key}," if heap[i].left
 print " right key = #{heap[i].right.key}," if heap[i].right
 print " "
 puts
end

Measured memory_bytes: 8760
import math

N = int(input())
A, T = [0 for i in range(N)], [0 for i in range(N)]
T[0], A[0] = map(int, input().split())

for i in range(1, N):
  dt, da = map(int, input().split())
  for j in range(max(A[i-1]//da, T[i-1]//dt)-1, max(A[i-1]//da, T[i-1]//dt)+3):
    if A[i-1] <= j * da and T[i-1] <= j * dt:
      n = j
      break
      
  T[i], A[i] = dt * n, da * n

print(A[N-1] + T[N-1])

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

long long dp[100][100][5000]; long long n, k, x[100];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++)cin >> x[i]; dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < 5000; k++) {
        if (dp[i][j][k] == 0)continue;
        dp[i + 1][j+1][k + x[i]] += dp[i][j][k];
        dp[i + 1][j][k] += dp[i][j][k];
      }
    }
  }
  long long sum = 0;
  for (int i = 1; i <= n; i++)sum += dp[n][i][k*i];
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 151808
n,n_pairs = map(int,input().split())
p_ls = list(map(int, input().split()))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

    def union(self, x, y):
        '''
        注意：0-idx
        '''
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

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

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

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

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

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

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

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

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

uf = UnionFind(n)
for i in range(n_pairs):
    x,y = map(int,input().split())
    uf.union(x-1,y-1)

ans = 0
for i in range(n):
    if uf.same(i,p_ls[i]-1):
        ans += 1
print(ans)



Measured memory_bytes: 84752
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



int popcount32(unsigned int x) {
	x = x - ((x >> 1) & 0x55555555);
	x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
	x = (x + (x >> 4)) & 0x0F0F0F0F;
	x = x + (x >> 8);
	x = x + (x >> 16);
	return x & 0x0000003F;
}



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


	int n;
	cin >> n;
	rep(i, n-1) {
		for (int j = i + 1; j < n; j++) {
			int p = i ^ j;
			int d;
			rep(k, 10) {
				if (p >> k &1) {
					d = k;
					break;
				}
			}

			cout << d + 1;
			if (j + 1 < n)cout << ' ';
		}
		cout << endl;
	}


	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll h, w, k;
  cin >> h >> w >> k;
  ll x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  x1--, x2--, y1--, y2--;
  vector<string> s(h);
  REP(i, h) { cin >> s[i]; }
  vector<vector<ll>> dist(h, vector<ll>(w, -1));
  queue<P> q;
  q.push({x1, y1});
  dist[x1][y1] = 0;
  vector<ll> d = {0, 1, 0, -1};

  while (!q.empty()) {
    P p = q.front();
    q.pop();
    ll cx = p.first, cy = p.second;

    REP(i, 4) {
      FOR(j, 1, k + 1) {
        ll nx = cx + j * d[i], ny = cy + j * d[i ^ 1];
        if (nx < 0 || nx >= h || ny < 0 || ny >= w) {
          break;
        }
        if (s[nx][ny] == '@') {
          break;
        }
        if (dist[nx][ny] != -1 && dist[nx][ny] <= dist[cx][cy]) {
          break;
        }

        if (dist[nx][ny] == -1) {
          dist[nx][ny] = dist[cx][cy] + 1;
          q.push({nx, ny});
        }
      }
    }
  }
  cout << dist[x2][y2] << endl;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n;
	cin>>n;
	map<int,int>cnt;
	char c;
	for(int i=0;i<n;++i){
		cin>>c;
		++cnt[c-'a'];
	}
	int64_t ans=1,mod=1e9+7;
	for(auto&i:cnt)ans=(ans*(i.second+1))%mod;
	cout<<ans-1<<"\n"s;
}

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

int main(){
//srandom((unsigned long)time(NULL));

long long n;
cin>>n;
//vector<tuple<long long,long long,long long>> a;
vector<long long> cnt;
for(long long i=0;i<100000;i++){
    cnt.emplace_back(0);
}

for(long long i=0;i<n;i++){
    long long x;
    cin>>x;
    if(x>1)cnt[x-2]++;
    if(x>0)cnt[x-1]++;
    cnt[x]++;
}
long long ans=0;
for(long long i=0;i<100000;i++){
    ans=max(ans,cnt[i]);
}


cout<<ans<<endl;


return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};

int main(){
    int n, q; 
    cin >> n >> q;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> pi(n+1, -1);//a[i]が前に出てきたindex
    vector<vector<int>> ps(n);
    rep(i,n){
        int l = pi[a[i]];
        if(l != -1) ps[l].push_back(i);
        pi[a[i]] = i;
    }

    vector<vector<P>> querys(n);
    rep(qi,q){
        int l, r;
        cin >> l >> r;
        --l, --r;
        querys[l].emplace_back(r, qi);
    }
    vector<int> ans(q);
    BIT<int> d(n);
    for(int x = n-1; x >= 0; --x){
        //x左端, r右端
        for(int y : ps[x]) d.add(y, 1);
        for(P q : querys[x]){
            int r = q.first, i = q.second;
            ans[i] = (r - x + 1) - d.sum(r);
        }
    }
    rep(i,q) cout << ans[i] << endl;
}

Measured memory_bytes: 59928