akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
#define rep(i, s, n) for(i64 i=(s); i < (n); ++i)
using namespace std;
using i64 = long long;
using pii = pair<int, int>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD  = int(1e9) + 7;

signed main()
{
  int n, i;
  cin >> n >> i;
  cout << (n - i + 1) << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <functional> //sort(A,A.end(),greater<int>());???????????????
#include <queue>
#include <stack>
#include <vector>

#define INF 10 << 10

int a[100001];

int main() {
	int n, k;
	while (cin >> n >> k && n != 0 && k != 0) {
		memset(a, 0, sizeof(a));
		for (int i = 1; i <= n; ++i) {
			cin >> a[i];
			a[i] += a[i - 1];
		}
		int ans = 0;
		for (int i = 0; i < n - k; ++i) {
			ans = max(ans, a[i + k] - a[i]);
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3356
#include<bits/stdc++.h>
using namespace std;
const int N=500005;
char s[N];
int n;
int fail[N],fail2[N];
int kmp(int* feil)
{
	int m=strlen(s),i,j=feil[0]=-1;
	for(int i=0;i<m;i++)
	{
		for(;~j&&s[j]!=s[i];j=feil[j]);
		feil[i+1]=++j;
	}
	return m;
}
bool isok(int i,int f)
{
	return i%(i-f)!=0||f==0;
}
int main()
{
	scanf("%s",s);
	n=strlen(s);
	kmp(fail);
	if(isok(n,fail[n]))
	{
		printf("1\n1\n");
		return 0;
	}
	if(n-fail[n]==1)
	{
		printf("%d\n1\n",n);
		return 0;
	}
	reverse(s,s+n);
	kmp(fail2);
	int ret=0;
	for(int i=1;i<n;i++)
		if(isok(i,fail[i])&&isok(n-i,fail2[n-i]))
			ret++;
	printf("%d\n%d\n",2,ret);
	return 0;
}


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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int h, n;
    cin >> h >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i] >> b[i];
    }
    vector<int> dp(11000, INF);
    dp[0] = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < h; j++)
        {
            dp[min(j + a[i], h)] = min(dp[min(j + a[i], h)], dp[j] + b[i]);
        }
    }
    cout << dp[h] << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>
#include <complex>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }

typedef long long ll;
typedef double D;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }

ll sti(string s) {
	ll len = s.length();
	if (len < 1) return 0;
	return (s[len - 1] - '0') + 10 * (sti(s.substr(0, len - 1)));
}

/***
split by t
***/
vcs splitAll(string s, string t) {
	vcs r;
	for (int p = 0; (p = s.find(t)) != s.npos;) {
		r.pb(s.substr(0, p));
		s = s.substr(p + t.size());
	}
	r.pb(s);
	return r;
}


int vals[100][100];
int N;

int dp[100][100];

int solve() {
	minit(dp, -1);
	
	dp[0][50] = vals[0][50];
	for_(i, 0, N) {
		for_(j, 0, 100) {
			if (dp[i][j]<0) continue;
			if (vals[i+1][j-1]>0) dp[i+1][j-1] = max(dp[i+1][j-1], dp[i][j] + vals[i+1][j-1]);
			if (vals[i+1][j+1]>0) dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + vals[i+1][j+1]);
		}
	}
	
	return dp[N-1][50];
}

int main() {
	minit(vals, -1);
	
	string in; int prev_len = 0;
	int i = 0, j = 50;
	while (1) {
		getline(cin, in);
		if (in=="") break;
		
		vcs input = splitAll(in, ",");
		
		int len = (int)input.sz;
		j = 51 - len;
		
		for_(k, 0, len) {
			vals[i][j] = sti(input[k]);
			j += 2;
		}
		
		i++;
	}
	
	N = i;
	
	cout << solve() << endl;
	
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int main(){
  long n; cin>>n;
  cout<<n<<':';
  
  long x=n;
  
  while(x%2==0){cout<<' '<<2;x/=2;}
  
  for(int i=3;i*i<=n;i+=2){
    while(x%i==0){
      cout<<' '<<i;
      x/=i;
    }
  }
  if(x!=1)cout<<' '<<x;
  cout<<endl;
}



Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
	int n;
	cin>>n;
	vector<int>a(n+2);
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int pre[n+1], post[n+2];
	pre[0] = 0;
	for(int i=1;i<=n;i++)
	{
		pre[i] = max(pre[i-1], a[i]);
	}
	post[n+1] = 0;
	for(int i=n;i>0;i--)
		post[i] = max(post[i+1], a[i]);

	int b[n+1];
	for(int i=1;i<=n;i++)
	{
		b[i] = max(pre[i-1], post[i+1]);
		cout<<b[i]<<" ";
	}
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
const int mod=1e9+7;
int a[maxn];
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    printf("%d\n",(c-1)/max(a,b)+1);
}


Measured memory_bytes: 256
import math

a, b = input().strip().split(' ')
a, b = [int(a), int(b)]

if b - a < 0:
    ans = 1
else:
    n = b - a
    ans = 1
    while n > 0:
        n = n + 1 - a
        ans = ans + 1

if b == 1:
    ans = 0
print(ans)



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

int gcd (int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

int main () {
  int N;
  cin >> N;
  vector<int> a(N, 0);
  rep(i, N) cin >> a[i];
  vector<int> l(N), r(N);
  rep(i, N-1) l[i+1] = gcd(l[i], a[i]);
  for (int i = N-1; i >= 1; i--) r[i-1] = gcd(r[i], a[i]);
  int ans = 1;
  rep(i, N) ans = max(ans, gcd(l[i], r[i]));
  cout << ans << endl;
}

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#include<iomanip>
#define BUG puts("no bug")
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define ll long long
#define ull unsigned long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define PER(a,b,c) for(int a=b;a>=c;a--)
#define lb(a) (a&(-a))
#define pp (p<<1)
#define ppp (p<<1|1)
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
using namespace std;
const int MAXN=1e6+5;
int n,m,t;
int v[MAXN];
char s[MAXN];
int main(){
    cin>>n;
    REP(i,1,n-1){
        int a;
        sci(a);
        v[a]++;
    }
    REP(i,1,n)cout<<v[i]<<endl;
}

Measured memory_bytes: 4036
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9 + 7;
pair<ll, ll>s4[4] = {{ -1, 0}, {1, 0}, {0, -1}, {0, 1}};
pair<ll, ll>s8[8] = {{ -1, -1}, { -1, 0}, { -1, 1}, {0, -1}, {0, 1}, {1, 1}, {1, 0}, {1, -1}};

void judge() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void solve() {
    int x, n;
    cin >> x >> n;
    int a[n];
    map<int , int>m;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        m[a[i]]++;
    }

    int ans;
    int res;
    int dist = 0;
    int d = 0;
    for (int i = x; i <= 202; i++) {
        if (m.find(i) == m.end()) {
            ans = i;
            dist = i - x;
            break;
        }
    }
    for (int i = x - 1; i >= -202; i--) {
        if (m.find(i) == m.end()) {
            res = i;
            d = x - i;
            break;
        }
    }
    //cout << dist << " " << d << nl;
    if (n == 0) {
        cout << x; return;
    }
    if (d > dist) {
        cout << ans << nl;
    }
    else if (d < dist) {
        cout << res << nl;
    }
    else {
        cout << min(res, ans) << nl;
    }


}

signed main() {
    judge();
    boost;
    solve();
}


Measured memory_bytes: 3664
let is_palindrome s =
  let n = String.length s in
  Array.fold_left ( && ) true @@
  Array.init (n / 2) @@ fun i -> s.[i] = s.[n - i - 1]

let () =
  let s = read_line () in
  let n = String.length s in
  print_endline @@
  if
    is_palindrome s &&
    is_palindrome (String.sub s 0 ((n - 1) / 2)) &&
    is_palindrome (String.sub s ((n + 1) / 2) ((n - 1) / 2))
  then "Yes"
  else "No"


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int h,w;
    cin>>h>>w;
    int c[10][10];
    vector<vector<int>>a(h,vector<int>(w));
    rep(i,10)rep(j,10){
        cin>>c[i][j];
    }
    rep(i,h)rep(j,w){
        cin>>a[i][j];
    }
    rep(k,10)rep(i,10)rep(j,10){
        c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
    }
    int ans=0;
    rep(i,h)rep(j,w){
        if(a[i][j]!=1&&a[i][j]!=-1)ans+=c[a[i][j]][1];
    }
    cout<<ans<<endl;
}

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

int n;
int alice, bob;

int main(){
    cin >> n;
    vector<int> a(n,0);
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end(), std::greater<int>());
    for(int i = 0; i < n; i++){
        if(i % 2 == 0){
            alice = alice + a[i];
        }else{
            bob = bob + a[i];
        }
    }
    cout << alice - bob << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cmath>
#include <climits>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

#define cin_desync()                      \
	do {                                  \
		ios_base::sync_with_stdio(false); \
		cin.tie(0);                       \
	} while (0)                           \

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}

#else
#define trace(...)
#endif // ifndef ONLINE_JUDGE

typedef long double ld;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int max_N = 2e3 + 10;
int A[max_N];

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

    for (int i = 1; i <= N; ++i) {
        cin >> A[i];
    }

    int ans = 1e9 + 42;
    for (int i = 1; i <= N; ++i) {
        int y = A[i];

        vector< vector<int> > comp;
        vector< int > curr;
        for (int j = 1; j <= N; ++j) {
            if (A[j] < y) {
                if (!curr.empty()) {
                    comp.push_back(curr);
                    curr.clear();
                }
            } else {
                curr.push_back(A[j]);
            }
        }
        if (!curr.empty()) {
            comp.push_back(curr);
        }

        for (auto &c : comp) {
            sort(c.begin(), c.end());
        }

        int low = y, high = 1e9 + 5, best = -1;
        while(low <= high) {
            int mid = (low + high) >> 1;

            int cnt = 0;
            for (auto &c : comp) {
                for (int i = 0; i + K - 1 < c.size() && c[i] <= mid; ++i) {
                    ++cnt;
                }
            }

            if (cnt < Q) {
                low = mid + 1;
            } else {
                best = mid;
                high = mid - 1;
            }
        }

        if (best != -1) {
            ans = min(ans, best - y);
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); 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; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
// const ll mod = 1000000007;
const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"

ll f(ll x,ll C,ll S,ll F){
    if(x<=S)return S+C;  
    if(x%F==0)return x+C;
    return x/F*F+F+C;
}

bool solve(){
    ll n;cin>>n;
    vector<ll>C(n-1),S(n-1),F(n-1);
    rep(i,n-1)cin>>C[i]>>S[i]>>F[i];

    rep(i,n){
        ll x=0;
        for(int j=i;j<n-1;j++)x=f(x,C[j],S[j],F[j]);
        cout<<x<<endl;
        // cout<<endl;
    }

    return false;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout<<fixed<<setprecision(30);
    solve();
}


Measured memory_bytes: 256
#include<stdio.h>
int main ()
{
    int a,b,s,d;
    char op;
    scanf ("%d %c %d",&a,&op,&b);
    if (op=='+')
    {
        s=a+b;
        printf ("%d\n",s);
    }
    else if(op=='-')
         {
             d=a-b;
        printf ("%d\n",d);
    }
    return 0;

}


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

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

long ans = 0;
for (int i = 0; i < N; ++i) {
  int left = min(A[i],B[i]);
  ans += left;
  A[i] -= left;
  B[i] -= left;
  int right =  min(A[i+1],B[i]);
  ans += right;
  A[i+1] -= right;}
cout << ans  << '\n';
return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;
ll MOD = 1000000007;

// a^p
// 2^3 = 2 * 2^2
// 2^2 = 2 * (2^1)
// 2^1 = 2
ll modpow(ll a, ll p, ll mod) {
  if (p == 0) return 1;

  if (p % 2 == 0) {
    ll half = modpow(a, p / 2, mod) % mod;
    return half * half % mod;
  } else {
    return a * modpow(a, p - 1, mod) % mod;
  }
}

// nCa を求める
ll modCombination(ll n, ll a, ll mod) {
  if (n - a < a) {
    return modCombination(n, n - a, mod);
  }

  ll denominator = 1;  // 分母
  ll numerator = 1;    // 分子

  for (ll i = 0; i < a; i++) {
    denominator *= a - i;
    numerator *= n - i;
    denominator %= mod;
    numerator %= mod;
  }

  return numerator * modpow(denominator, mod - 2, mod) % mod;
}

class UnionFind {
 private:
  vector<ll> parents;

 public:
  UnionFind(ll n) : parents(n, -1) {}

  bool issame(ll x, ll y) { return root(x) == root(y); }

  bool merge(ll x, ll y) {
    if (issame(x, y)) return false;

    ll rx = root(x);
    ll ry = root(y);
    if (parents[rx] > parents[ry]) swap(rx, ry);
    // サイズ情報を更新
    parents[rx] += parents[ry];
    // yの親を更新
    parents[ry] = rx;

    return true;
  }

  ll size(ll x) { return -parents[root(x)]; }

 private:
  ll root(ll x) {
    if (parents[x] < 0) return x;
    // 根の親の値に木の(-)サイズの情報を入れる
    return parents[x] = root(parents[x]);
  }
};

int main() {
  cout << fixed << setprecision(15);

  ll N, M;
  cin >> N >> M;

  vector<ll> S(M);
  vector<ll> C(M);

  for (ll i = 0; i < M; i++) {
    cin >> S[i] >> C[i];
  }

  vector<ll> digit(N, -1);

  ll ans = -1;
  ll ok = true;
  for (ll i = 0; i < M; i++) {
    ll index = S[i] - 1;
    if (digit[index] != -1 && digit[index] != C[i]) {
      ok = false;
      break;
    }
    digit[index] = C[i];
  }

  if (ok == true) {
    if (digit[0] == 0 && N != 1) {
      cout << -1 << endl;
    } else {
      if (digit[0] == -1) {
        if (N == 1) {
          digit[0] = 0;
        } else {
          digit[0] = 1;
        }
      }
      for (ll i = 0; i < N; i++) {
        if (digit[i] == -1) {
          digit[i] = 0;
        }
      }

      ll ans = 0;
      for (auto d : digit) {
        // cout << d << endl;
        ans = 10 * ans + d;
      }

      cout << ans << endl;
    }
  } else {
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import sys
import numpy as np
def main():
    input = sys.stdin.readline
    KX = list(map(int, input().split()))
    K = KX[0]
    X = KX[1]

    low = X - K + 1
    up = X + K - 1

    if low <= -1000000:
        low = -1000000
    if up >= 1000000:
        up = 1000000

    ary = np.arange(start=low, step=1, stop=up+1)
    ary = ary.astype("str")
    li = list(ary)
    ans = " ".join(li)

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 12504
#include "bits/stdc++.h"
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    int count = 0;
    count += a;
    if (b < a) count--;
    printf("%d\n", count);
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include<cstdio>
#include <vector>
#include<queue>
#include<limits.h>
#include<string.h>
#include<functional>
using namespace std;

signed main() {
	int w, h, x, y, r; cin >> w >> h >> x >> y >> r;
	if (x - r >= 0 && x + r <= w&&y - r >= 0 && y + r <= h)puts("Yes");
	else puts("No");
}

Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstdio>
using namespace std;


int main(void){
  int N, sum = 0;
  cin >> N;
  for(int i=0;i<N;i++){
    int val;
    cin >> val;
    int j;
    for(j=2;j<=sqrt(val) + 1;j++){
      if(val % j == 0){
        break;
      }
    }
    if(j == sqrt(val) + 1 || j > sqrt(val)){
      sum++;
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1160
using System;
using System.Linq;

class Program {
    static void Main(string[] args) {
        int a = Cin.Ni();
        int b = Cin.Ni();

        if (a == b) {
            Console.WriteLine("Draw");
        } else {
            if (a == 1) {
                Console.WriteLine("Alice");
            } else if (b == 1) {
                Console.WriteLine("Bob");
            } else {
                Console.WriteLine(a > b ? "Alice" : "Bob");
            }
        }

    }
}


public class Cin {
    private static string[] s = new string[0];
    private static int i = 0;

    private static char[] cs = new char[] { ' ' };

    public static string Next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return Next();
    }

    public static int Ni() {
        return int.Parse(Next());
    }

    public static long NextLong() {
        return long.Parse(Next());
    }

    public static double NextDouble() {
        return double.Parse(Next());
    }

}


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

const int INF = 1000000000;

int main(){
    while (true){
        int n,m;
        cin >> n >> m;

        if(n==0 && m==0) break;

        int C[100][100];
        int T[100][100];

        for(int i=0; i<m; i++){
            for(int j=0; j<m; j++){
                if(i == j){
                    C[i][j] == T[i][j] == 0;
                }
                else{
                    C[i][j] = T[i][j] = INF;
                }
            }
        }

        for(int i=0; i<n; i++){
            int a,b,c,t;
            cin >> a >> b >> c >> t;

            C[a-1][b-1] = C[b-1][a-1] = c;
            T[a-1][b-1] = T[b-1][a-1] = t;
        }


    for(int k=0; k<m; k++){
        for(int i=0; i<m; i++){
            for(int j=0; j<m; j++){
                if(C[i][j]>C[i][k]+C[k][j]){
                        C[i][j] = C[i][k]+C[k][j];
                }
                if(T[i][j]>T[i][k]+T[k][j]){
                        T[i][j] = T[i][k]+T[k][j];
                }
            }
        }
    }

    
    int k;
    cin >> k;

    for(int i=0; i<k; i++){
        int p,q,r;
        cin >> p >> q >> r;

        if(r == 0){
            cout << C[p-1][q-1] << endl;

        }
        else{
            cout << T[p-1][q-1] << endl;
        }
    }
    
    }
    return 0;
}


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

typedef long long ll;

void swap (ll &a, ll &b) {
  ll tmp;
  tmp = a;
  a = b;
  b = tmp;
}

int main(void) {
  long long int a, b; 
  cin >> a >> b;

  if (a < b) {
    swap(a, b);
  }

  long long int k = a-b;

  if (k % 2 == 0) {
    cout << b + k/2 << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <stack>
#pragma GCC optimize(3 , "Ofast" , "inline")
using namespace std ;
typedef long long ll ;
const double esp = 1e-6 , pi = acos(-1) ;
typedef pair<int , int> PII ;
const int N = 1e5 + 10 , INF = 0x3f3f3f3f , mod = 1e9 + 7;
int in()
{
  int x = 0 , f = 1 ;
  char ch = getchar() ;
  while(!isdigit(ch)) {if(ch == '-') f = -1 ; ch = getchar() ;}
  while(isdigit(ch)) x = x * 10 + ch - 48 , ch = getchar() ;
  return x * f ;
}
int main()
{
  ll t = 0 ;
  ll ans;
  cin >> ans ;
  ll res = 100 ;
  while(1)
   {
     res = (ll)res * 1.01 ;
     t ++ ;
     if(res >= ans)
      {
        cout << t << endl ;
        return 0 ;
      }
   }
  return 0 ;
}
/*
*/


Measured memory_bytes: 3632
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
#include <iterator> 
using namespace std;

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)

#define nl '\n'
#define ioi exit(0);


#define PI 3.14159265

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)1e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};

struct node{
	int x, y, z;
	mutable int w;
	node() {
		x = -1, y = -1, z = -1;
	}
	bool operator<(const node& nod) const{
		if (this->x == nod.x) {
			if (this->y == nod.y){
				return this->z < nod.z;
			}
			return this->y < nod.y;
		}
		return this->x < nod.x;
	}
};

bool vis[20];
int n, m, x, ans;
int c[20];
int tab[20][20];
void solve(int k) {
	if (k == 0) {
		int cust = 0;
		for (int i = 1; i <= n; i++) {
			if (vis[i])
				cust += c[i];
		}

		bool ok = true;
		for (int j = 1; j <= m; j++) {
			int sum = 0;
			for (int i = 1; i <= n; i++) {
				if (vis[i]) {
					sum += tab[i][j]; 
				}
			}
			if (sum < x)
				ok = false;
		}
		//~ cout<< ans<< " "<< cust<<endl;
		if (ok)
			ans = min(ans,cust);
		return;
	}
	vis[k] = true;
	solve(k-1);
	vis[k] = false;
	solve(k-1);
}
int main() {
	ans = inf;
	clr(vis,false);
	cin>> n >> m >> x;
	
	for (int i = 1; i <= n; i++) {
		cin >> c[i];
		for (int j = 1; j <= m; j++) {
			cin>> tab[i][j];
		}
	}
	solve(n);
	if (ans == inf)
		cout<<-1;
	else
		cout<<ans;
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long; using ll = long long; using ld = long double;
using pi = pair<int, int>; using pll = pair<ll, ll>;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
template<typename T> using minQ = priority_queue<T, vector<T>, greater<T>>;

#define endl '\n'
#define ALL(a)       (a).begin(),(a).end()
#define FOR(i,a,b)   for(ll i = (ll)(a); i < (ll)(b); ++i)
#define FORO(i,a,b)  for(ll i = (ll)(a); i <= (ll)(b); ++i)
#define RFOR(i,a,b)  for(ll i = (ll)(b) - 1; i >= (ll)(a); --i)
#define RFORO(i,a,b) for(ll i = (ll)(b); i >= (ll)(a); --i)
#define REP(i,n)     for(ll i = 0; i < (ll)(n); ++i)
#define REPO(i,n)    for(ll i = 1; i <= (ll)(n); ++i)
#define RREP(i,n)    for(ll i = (ll)(n) - 1; i >= 0; --i)
#define RREPO(i,n)   for(ll i = (ll)(n); i >= 1; --i)
#define SORT(a)      sort(ALL(a))
#define UNIQ(a)      a.erase(unique(ALL(a)), a.end())
#define SUNIQ(a)     SORT(a), UNIQ(a)
#define MINI(a,b)    a=min(a,(b))
#define MAXI(a,b)    a=max(a,(b))

const ll mod = 1e9 + 7;
const int INF = 1e9 + 10;
const ll LINF = 1000000000000000000ll;
const ld eps = 1e-8;
const ld PI = acosl(-1);

ll Nll() { ll a; cin >> a; return a; }
ld Nld() { ld a; cin >> a; return a; }
int Ni() { int a; cin >> a; return a; }
char Nc() { char a; cin >> a; return a; }
string Ns() { string a; cin >> a; return a; }

template <typename T>
void O(const T &a) { cout << a << endl; }
template <typename T>
void O(T &&a) { cout << a << endl; }
template <typename T>
void Os(const vector<T> &v) { REP(i, v.size() - 1) cout << v[i] << " \n"[i + 1 == (ll)v.size()]; }
template <typename T>
void Os(vector<T> &&v) { REP(i, v.size() - 1) cout << v[i] << " \n"[i + 1 == (ll)v.size()]; }
template <typename T>
void Is(vector<T> &v) { for (auto& t : v) cin >> t; }

void yes(bool f) { cout << (f ? "yes" : "no") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }

struct Edge {
	int from, to;
	Edge() {}
	Edge(int f, int t) : from(f), to(t) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void solve();

int main() { ios::sync_with_stdio(false), cin.tie(0); cout << fixed << setprecision(20); solve(); }

//-----------------------------------------------template-------------------------------------------------------------

//-----------------------------------------------library-------------------------------------------------------------

void solve()
{
	string s = Ns();
	string res;
	for (int i = 0; i < (int)s.size(); i += 2) {
		res.push_back(s[i]);
	}
	O(res);
}


Measured memory_bytes: 592
#include <stdio.h>
#include <stdlib.h>

#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

void enqueue(P);
P dequeue();
int isEmpty();
int isFull();

P Q[LEN+1];
int head, tail, n;

int main()
{
  int i, q, total = 0;
  P pc;
  
  scanf("%d %d", &n, &q);

  for ( i = 0; i < n; i++ ){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
    tail++;
  }

  /* プロセスを実行 */
  while(1)
    {
      /*実行するプロセスを取り出す*/
      pc = dequeue();

      /* 処理実行 */
      total += q;
      pc.t -= q;

      /*そのプロセスの実行が終了した場合 */
      if( pc.t <= 0 )
	{
	  total += pc.t;
	  printf("%s %d\n", pc.name, total);
	}
      else
	{
	  /*実行が終了しなかった場合 */
	  enqueue(pc);
	}

      /*全ての処理が終了した場合*/
      if( head == tail )
	break;
    }

  
  return 0;
}

/* Queueにデータを挿入する関数 */
void enqueue(P x)
{
  /* キューが満杯であるか判定 */
  if( isFull())
    {
      fprintf(stderr, "Error! Overflow\n");
      exit(3);
    }
  Q[tail] = x;
  tail = (tail+1) % LEN;
}

/* Queueからデータを取り出す関数 */
P dequeue(void)
{
  P x;
  
  /* キューが空であるか判定 */
  if( isEmpty() )
    {
      fprintf(stderr, "Underflow\n");
      exit(3);
    }
  x = Q[head];
  head = (head+1) % LEN;

  return x;
}

int isEmpty()
{
  return head == tail;
}

int isFull()
{
  return head == (tail+1) % LEN;
}



Measured memory_bytes: 11852
#include <cstdio>
#include <cstring>
using namespace std;

#define iter(i, n) for (int i = 1; i <= n; ++i)
#define iter_r(i, n) for (int i = n; i >= 1; --i)

#define NR 501000

int a[NR], n, p[NR];
char s[NR];

void inc() {
	++a[n];
	iter_r(i, n) {
	//	printf("!!%d %d\n", i, a[i]);
		if (a[i] >= 10) {
			a[i] -= 10;
			++a[i - 1];
		} else {
			for (int j = i; j <= n; ++j)
				p[j] = (a[j] == a[j - 1] ? p[j - 1] : j);
			break;
		}
	}
}

int main() {
	scanf("%s", s + 1);
	n = strlen(s + 1);
	a[0] = -1;
	iter(i, n) {
		a[i] = s[i] - '0';
		p[i] = (a[i] == a[i - 1] ? p[i - 1] : i);
	}

	int lst = 0, ans = 0;
	iter(i, n) {
		if (a[i] > a[i + 1] || i == n) {
			//printf("!%d %d %d %d\n", i, a[i], a[i-1], ans);
			if (p[i] != i) {
				for (int j = p[i]; j <= i; ++j) {
					for (; i < n && a[i] <= a[i + 1]; ++i)
						;
					bool exit = false;
					if (a[j] != a[i] || i == n) exit = true; 
					inc(); ++ans;
					if (exit) break;

				}
			} else {
				inc(); ++ans; 
			}
			
		}
	}

	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 4608
/**
*    author:  boutarou
*    created: 15.08.2020 21:46:03
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
using ll = long long;
using P = pair<ll, ll>;

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

int main() {
    ll h, w;
    ll K;
    cin >> h >> w >> K;
    vector<vector<ll>> c(h, vector<ll>(w, 0));
    rep(i, K) {
        ll R, C, V;
        cin >> R >> C >> V;
        R--, C--;
        c[R][C] = V;
    }
    vector<vector<vector<ll>>> dp(h, vector<vector<ll>>(w, vector<ll>(4, 0)));
    dp[0][0][1] = c[0][0];
    rep(i, h) {
        rep(j, w) {
            if (i == 0 && j == 0) continue;
            rep(k, 4) {
                if(k == 0) {
                    if (i != 0) {
                        rep(l, 4) {
                            chmax(dp[i][j][k], dp[i - 1][j][l]);
                        }
                    }
                    if (j != 0) chmax(dp[i][j][k], dp[i][j - 1][k]);
                }
                else {
                    if (i != 0) {
                        rep(l, 4) {
                            chmax(dp[i][j][k], dp[i - 1][j][l] + c[i][j]);
                        }
                        chmax(dp[i][j][k], dp[i - 1][j][k]);
                    }
                    if (j != 0) {
                        chmax(dp[i][j][k], dp[i][j - 1][k]);
                        chmax(dp[i][j][k], dp[i][j - 1][k - 1] + c[i][j]);
                    }
                }
            }
        }
    }
    ll ans = 0;
    rep(i, 4) {
        chmax(ans, dp[h - 1][w - 1][i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 706076
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
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 main(int argc, char const *argv[]) {
  int n, k, r, s, p;
  cin >> n >> k >> r >> s >> p;
  string t;
  cin >> t;
  ll rec = 0;
  rep(i,sz(t)){
    if (t[i] == 'r') rec += p;
    else if(t[i]=='s') rec += r;
    else rec += s;
  }
  rep(i,sz(t)-k){
    if(t[i]==t[i+k]){
      t[i + k] = 'x';
      if (t[i] == 'r') rec -= p;
      else if(t[i]=='s') rec -= r;
      else rec -= s;
    }
  }
  cout << rec << endl;
  return 0;
}

Measured memory_bytes: 3764
N = int(input())
List = list(map(int,input().split()))
found = True
A = []
B =[]
for i in range(N):
    a = N - i
    k = N // a
    c = 0
    for j in range(1,k):
        c += A[N - (j+1)*a]
    b = (List[a-1]-c)%2
    A.append(b)
    if b == 1:
       B.append(a) 
print(sum(A))
print(*B)



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

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

int main() {
  ll n, ans = 0;
  cin >> n;
  vector<ll> a(n);
  vector<int> cnt(1000005, 0);
  rep(i, n) cin >> a[i], cnt[a[i]]++;

  vector<bool> d(1000005, true);

  for (int i = 1; i <= 1000005; ++i)
    if (0 < cnt[i]) {
      if (1 < cnt[i]) d[i] = false;
      for (int j = 2 * i; j <= 1000005; j += i) d[j] = false;
    }

  for (auto x : a)
    if (d[x]) ans++;

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


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod = int(1e9)+7;
using P = pair<ll,ll>;

int main(){
    ll n;cin >>n;
    vector<ll>k(60,1);
    for (int i = 1; i < 60; ++i) {
        k[i]+=k[i-1]+i+1;
    }
    map<ll,int>co;
    for(ll p=2;p*p<=n;p++){
        while(n%p==0){
            co[p]++;
            n/=p;
        }
    }
    if(n!=1)co[n]++;
    ll ans=0;
    for(auto p:co){
//        cout <<p.first<<" "<<p.second<<endl;
        bool flg=true;
        for (int i = 1; i <= 60; ++i) {
            p.second-=i;
            if(p.second<0)break;
            ans++;
        }
    }
    cout <<ans <<endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int a[103]={0};
int main()
{
	int x,n;
	cin>>x>>n;
	for(int i=0;i<n;i++)
	{
		int y;
		cin>>y;
		a[y]=-1;
	}
	int mn=10000000,ab,ans=10000;
	for(int i=0;i<103;i++)
	{
		if(a[i]==-1)continue;
		if(!a[i])
		ab = fabs(x-i);
		if(ab<mn)
		{
			mn=ab;
			ans=i;
		}	
	}

	cout<<ans;

}

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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    string s1, s2, s3;
    cin >> s1 >> s2;

    // 処理
    s3 = s1 + s1;

    // 出力
    if (s3.find(s2) == -1) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
//
//  Created by Vijay Bhati on 19/02/20.
//  Copyright © 2019 Vijay Bhati. All rights reserved.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <map>
#include <sstream>
#include <set>
#include <iomanip>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <cstdio>
#include <cmath>
#include <climits>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cassert>
#include <memory>
#define ll long long
#define ull unsigned long long
#define pi acos(-1.0)
#define rf freopen("in.txt", "r", stdin);
#define ld long double
#define all(v) v.begin(),v.end()
#define pb push_back
#define P pair<ll, ll>
#define ff first
#define ss second
#define F first
#define S second
#define MOD 1000000007
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)

using namespace std;

ll max(ll a, ll b) {
    return a > b ? a : b;
}

ll min(ll a, ll b) {
    return a > b ? b : a;
}

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

ll find_power(ll a, ll b) {
    ll ans = 1;
    while (b > 0) {
        if (b & 1) {
            ans = (ans * a) % 1000000007;
        }
        b = b >> 1;
        a = (a * a) % 1000000007;
    }
    return ans;
}


int main() {
#ifdef __APPLE__
    const clock_t begin_time = clock();
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    
    ll n, k, weight, cost, mx = INT_MIN;
    cin >> n >> k;
    
    ll dp[k+1];
    
    memset(dp, INT_MIN, sizeof(dp));
    dp[0] = 0;
    
    for (ll i = 0; i < n; i++) {
        cin >> weight >> cost;
        for (ll j = k; j >= weight; j--) {
            dp[j] = max(dp[j], dp[j-weight] + cost);
        }
    }
    
    for (auto x: dp) {
        mx = max(mx, x);
    }
    
    cout << mx << endl;
    
    
#ifdef __APPLE__
    cout << endl;
    cout << "Time : ";
    cout << float( clock () - begin_time ) / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}


Measured memory_bytes: 1024
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

n=int(input())
t0=int(input())
if n==1:
    print(t0)
else:
    t1=int(input())
    t_lcm=lcm(t0,t1)
    for i in range(n-2):
        t2=int(input())
        t_lcm=lcm(t_lcm,t2)
    print(t_lcm)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F(i,s,e) for(ll i=s;i<e;++i)

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

    ll sum=0;
    F(a,1,n){
        sum += (n-1)/a;
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

ll r, c;
ll calc(ll x, ll y){
	ll ret;
	if(x == 0){
		if(y == 0){
			ret = 0;
		}else{
			ret = r * 2 + c * 2 - y;
		}
	}else if(x == r){
		ret = r + y;
	}else{
		if(y == 0) ret = x;
		else ret = r * 2 + c - x;
	}
	return ret;
}
bool check(ll x, ll y){
	if(x == 0 || x == r || y == 0 || y == c) return true;
	return false;
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> r >> c >> n;
    vector<pair<ll,ll> > v;
    for(int i=0;i<n;i++){
    	ll x, y, a, b, num1, num2;
    	cin >> x >> y >> a >> b;
    	if(check(x, y) && check(a, b)){
    		num1 = calc(x, y);
    		num2 = calc(a, b);
    		if(num1 > num2) swap(num1, num2);
    		v.push_back({num1, num2});
    	}
    }
    sort(be(v));
    deque<ll> dq;
    for(auto& i: v){
    	while(!dq.empty() && i.first > dq.front()) dq.pop_front();
    	if(!dq.empty() && i.second > dq.front()){
    		cout << "NO" << endl;
    		return 0;
    	}
    	dq.push_front(i.second);
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 2548
import sys
# sys.stdin = open('input.txt')

k = int(input())
string = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'
s = [i for i in map(int, string.split(', '))]
print(s[k-1])

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

int main() {
    int N; cin >> N;
    int c = 0; bool ok = false;
    rep(i, N) {
        int a, b; cin >> a >> b;
        if (a == b) {
            c++;
            if (c >= 3) ok = true;
        }
        else {
            c = 0;
        }
    }
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
using namespace std;
int main()
{
    int a,b,c,d,e,f;
    cin>>a>>b>>c;
    d=a+b;
    if (c>d or c<a)
    {
        cout<<"NO";
        return 0;
    }
    else if (d==c or (d>c && c>=a))
    {
        cout<<"YES";
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
   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; }
    const int MAX =200002;
const int MOD =1000000007;

     signed main(){
        int h,w,d;
        cin>>h>>w>>d;
        pair<int,int> p[h*w];
        int a;
        for(int i=0;i<h;i++)for(int j=0;j<w;j++){
            cin>>a;
            p[a-1]={i,j};
        }
        int s[h*w]={};
        for(int i=d;i<h*w;i++)s[i]=s[i-d]+abs(p[i].first-p[i-d].first)+abs(p[i].second-p[i-d].second);
        int q,l,r;
        cin>>q;
        for(int i=0;i<q;i++){
            cin>>l>>r;l--;r--;
            cout<<s[r]-s[l]<<endl;
        }

   }
     


 


 






    





      

        


Measured memory_bytes: 5752
p = [(-1,2,4,1,3,-1),
     (3,-1,0,5,-1,2),
     (1,5,-1,-1,0,4),
     (4,0,-1,-1,5,1),
     (2,-1,5,0,-1,3),
     (-1,3,1,4,2,-1)]

d1 = list(map(int, input().split()))
top, front, right = d1[0], d1[1], d1[2]
d2 = list(map(int, input().split()))
da1 = {v: k for k, v in enumerate(d1)}
da2 = {v: k for k, v in enumerate(d2)}
boo = True if len(da1) == 6 and len(da2) == 6 else False
if boo:
    x, y = da2[top], da2[front]
    adjacent = {v: k for k, v in da2.items()}
    try:
        if right == adjacent[p[x][y]]:
            print("Yes")
        else:
            print("No")
    except KeyError:
        print("No")

else:
    db1 = [(k, v) for k, v in enumerate(d1)]
    db2 = [(k, v) for k, v in enumerate(d2)]
    for m in range(5, 1, -1):
        if db1[m][1] != db1[m-1][1]:
            x, y = db1[m][0], db1[m-1][0]
            t1, f1, r1 = db1[m][0], db1[m-1][0], db1[p[x][y]][0]
            break
        else:
            t1, f1, r1 = 0, 0, 0
    for m in range(5, 1, -1):
        if db2[m][1] != db2[m-1][1]:
            x, y = db2[m][0], db2[m-1][0]
            t2, f2, r2 = db2[m][0], db2[m-1][0], db2[p[x][y]][0]

    if t2 == r1 and r2 == t1:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 7896
#include <stdio.h>

int main(){
  int n, m, i, sum = 0, count = 0;
  scanf("%d %d", &n, &m);
  int a[n - 1];
  for(i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }

  double vote = (double)sum/(4*(double)m);
  
  for(i = 0; i < n; i++) {
  	if (a[i] >= vote)
      count++;
  }
  
  if (count >= m)
    printf("Yes");
  else
    printf("No");
  
  return(0);
}


Measured memory_bytes: 1728
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!

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

    #pragma GCC target("popcnt")

    string to_string(const string& s) { return '"' + s + '"'; }
    void debug_out() { cout << endl; }
    template <typename Head, typename... Tail>
    void debug_out(Head H, Tail... T) { cout << " " << to_string(H); debug_out(T...); }
    #ifdef LOCAL
        #define debug(...) cout << "#" << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
    #else
        #define debug(...) 3;
    #endif

    #define fast_io ios_base::sync_with_stdio(false); \
                    cin.tie(nullptr); cout.tie(nullptr);
    using ld = long double;  using ui = uint_fast32_t;
    using ll = int_fast64_t; using ul = uint_fast64_t;

// -----------------------------------------------------------------------------

const int N = 100 + 5;
const int V = 1e3 + 5;
const int W = 1e9 + 5;
const int TV = N * V;
const ll INF = ll(N) * W;
int n, c;
ll dp[TV];

void solve() {
    cin >> n >> c;
    fill_n(dp, TV, INF);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        int w, v;
        cin >> w >> v;
        for (int j = TV - 1; j >= v; --j) {
            dp[j] = min(dp[j], dp[j - v] + w);
        }
    }
    for (int j = TV - 1; j >= 0; --j) {
        if (dp[j] <= c) {
            cout << j << '\n';
            return;
        }
    }
}

// -----------------------------------------------------------------------------

int main() {
    fast_io; int t = 1;
    // cin >> t;
    // precompute();
    for (int i = 1; i <= t; ++i) solve();
}

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

#define ll       long long
#define vi       vector<long long>
#define pb       push_back
#define all(v)   v.begin(),v.end()
#define mod      1000000007
#define inf      1e18

using namespace std;

ll n, k;
vi v;
ll dp[100005];

int solve(int n)
{
	if (n <= 1)
		return 0;
	if (dp[n] != -1)
		return dp[n];

	dp[n] = inf;
	for (int i = 1; i <= k; i++)
	{	if (n - i >= 1)
			dp[n] = min(dp[n], solve(n - i) + abs(v[n - i] - v[n]));
		else break;
	}
	return dp[n];


}


int main()
{



	cin >> n >> k;
	v.pb(-1);
	for (int i = 1; i <= n; i++)
	{	ll x;
		cin >> x;
		v.pb(x);
		dp[i] = -1;
	}


	cout << solve(n);
}

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

using namespace std;

int main()
{
 	int n;
  cin>>n;
  if(n==1)
  {
      cout<<1<<endl;
      return 0;
  }
  pair<int,int> MAX={0,0};
  for(int i=2; i<=n; i+=2)
  {
    int tmp=i;
    int cnt=0;
    while(tmp%2==0 && tmp>0)
    {
      tmp/=2;
      cnt++;
    }
    if(MAX.first<cnt)
    {
        MAX.first=cnt;
        MAX.second=i;
    }
  }
  cout<<MAX.second<<endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
class c
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var d = Array.ConvertAll(Console.ReadLine().Split(), int.Parse).OrderBy(f => f).ToArray();
        Console.WriteLine(d[n / 2] - d[n / 2 - 1]);
    }
}

Measured memory_bytes: 21856