akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define int         long long
#define ld          long double
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define sd(t)       scanf("%d",&(t))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define hii         cout << "hii" << endl
#define okay        cout << "okay" << endl
#define hey         cout << "hey" << endl
const int INF = 1e12;
const int MOD = 1e9+7;
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.x << ' ' << v.y; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.x << "=>" << i.y << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE
 
clock_t time_p=clock();
void starboy1299()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
 
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("jjj.txt", "w", stdout);
    #endif
}

const int N = 2e4+10;

void solve(){  

    int n;
    cin >> n;

    vi v1, v2;
    rep(i, 0, n){
        int a, b;
        cin >> a >> b;
        v1.pb(a+b);
        v2.pb(a-b);
    }
        
    sort(all(v1));
    sort(all(v2));

    int ans = abs(v1[n-1]-v1[0]);
    ans = max(ans, abs(v2[n-1]-v2[0]));
    cout << ans << endl;
}              


int32_t main(){
    fast();
    int t = 1;
    // cin>> t;
    for(int i=1; i<=t; i++){
        // cout << "Case #" << i << ": ";
        solve();
    }
    starboy1299();
}

Measured memory_bytes: 6684
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;

int a[31][100005];
int b[100005];

int main()
{
    int n, c;
    cin >> n >> c;
    for (int i = 0; i < n; ++i)
    {
        int s, t, x;
        cin >> s >> t >> x;
        a[x][s]++;
        a[x][t + 1]--;
    }
    for (int j = 1; j <= c; ++j)
        for (int i = 1; i <= 100000; ++i)
            a[j][i] += a[j][i - 1];

    int sol = 0;
    for (int i = 1; i <= 100000; ++i)
    {
        for (int j = 1; j <= c; ++j)
            a[j][i] = min(1, a[j][i]),
                b[i] += a[j][i];
        sol = max(sol, b[i]);
    }
    cout << sol;
}


Measured memory_bytes: 12416
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int compare(const void *a, const void *b){return *(long *)a - *(long *)b;}
int sqs(long a[],long n,long s){
    if(s==4){qsort(a,n,sizeof(long),compare);}
    return 0;
}


int main(void){
    long n,i;
    scanf("%ld",&n);
    long a[n],b[n];
    for(i=0;i<n;i++){
        scanf("%ld",&a[i]);
        b[i]=a[i];
    }
    sqs(b,n,4);
    //printf("%ld",a[n-1]);
    for(i=0;i<n;i++){
        printf("%ld\n",b[n-1]==a[i]?b[n-2]:b[n-1]);
    }
    return 0;
}


Measured memory_bytes: 4860
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

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

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

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

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

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


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

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

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

int main(){
ll n;
cin>>n;
pair<pair<string,ll>,ll>data[n];
string s;
ll p;
for(ll i=0;i<n;i++){
    cin>>s>>p;
    p*=-1;
    data[i]=make_pair(make_pair(s,p),i);
}
sort(data,data+n);
for(ll i=0;i<n;i++){
    cout<<data[i].second+1<<endl;;
}
}










Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int n, par[15];
set<string> S;

void dfs(int cur){
    if(cur == n){
        string s;
        char c[n];
        rep(i, n) c[i] = 'z';
        char t = 'a';
        rep(i, n){
            if(par[i] == i) c[i] = t++;
            c[i] = c[par[i]];
            s += c[i];
        }
        S.insert(s);
    }
    else{
        rep(i, cur+1){
            par[cur] = i;
            dfs(cur+1);
        }
    }
}

int main(){
    scanf("%d", &n);
    par[0] = 0;
    dfs(1);
    for(auto &s: S) cout << s << "\n";
}

Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;

int main()
{
    int N, K;
    cin >> N >> K;
    vint A(N);
    int index = 0;
    rep(i, N)
    {
        cin >> A[i];
        if (A[i] == 1)
            index = i + 1;
    }
    cout << (N + K - 3) / (K - 1);
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main()
{

map<ll,ll> mp;
map<ll,ll>::iterator it;
int n;
cin>>n;


for(int i=0;i<n;i++)
{
    
    ll x;
    cin>>x;
    mp[x]++;
}


int ans=0;


for(it=mp.begin();it!=mp.end();it++)
{
    
    if(it->second>it->first) ans+=abs(it->second-it->first);
    else if(it->second<it->first) ans+=it->second;
}

cout<<ans;
}

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

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

    vector<vector<double>> dp(N+1, vector<double>(N+1, 0.0));
    vector<double> p(N+1, 0.0);

    for (int i = 1; i <= N; ++i)
    {
        double tmp;
        cin >> tmp;
        p.at(i) = tmp;
    }

    dp.at(0).at(1) = 1;
    dp.at(0).at(0) = 1;
/*
    dp.at(1).at(1) = dp.at(0).at(1) * p.at(1);
    dp.at(1).at(0) = dp.at(0).at(0) * (1-p.at(1));

    dp.at(2).at(2) = dp.at(1).at(1) * p.at(2);
    dp.at(2).at(1) = dp.at(1).at(0) * p.at(2) + dp.at(1).at(1) * (1-p.at(2));
    dp.at(2).at(0) = dp.at(1).at(0) * (1-p.at(2));

    dp.at(3).at(3) = dp.at(2).at(2) * p.at(3);
    dp.at(3).at(2) = dp.at(2).at(1) * p.at(3) + dp.at(2).at(2) * (1-p.at(2));
    dp.at(3).at(1) = dp.at(2).at(0) * p.at(3) + dp.at(2).at(1) * (1-p.at(2));
    dp.at(3).at(0) = dp.at(2).at(0) * (1-p.at(3));
*/
    for (int i = 1; i <= N; ++i)
    {
        dp.at(i).at(i) = dp.at(i-1).at(i-1) * p.at(i);
        for (int j = 1; j < i; ++j)
        {
            dp.at(i).at(j) = dp.at(i-1).at(j-1) * p.at(i) + dp.at(i-1).at(j) * (1-p.at(i));
        }
        dp.at(i).at(0) = dp.at(i-1).at(0) * (1-p.at(i));
    }

    double ans = 0;
    for (int j = N/2+1; j <= N; ++j)
    {
        ans += dp.at(N).at(j);
    }

    cout << fixed << std::setprecision(18) << ans << endl;

    return 0;
}



Measured memory_bytes: 70656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

#define FOR(i,n) for(int i = 0; i < n; i++)
#define FORa(i,a,b) for(int i = a; i < b; i++)
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
#define SORT(a,n) sort(begin(a), begin(a) + n)
#define VSORT(v) sort(v.begin(), v.end())
#define MAX 1000000
#define ll long long
#define LOW(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define UP(s) transform(s.begin(),s.end(),s.begin(),::toupper)

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

int main() {
	int n, answer = 0;
	cin >> n;
	
	vector<int> v(n);
	FOR(i,n) cin >> v[i];
	
	for(int i = 2; i < n; i++) {
		for(int j = 1; j < i; j++) {
			for(int k = 0; k < j; k++) {
				int a = v[i], b = v[j], c = v[k];
				
				if(a != b && a != c && b != c)
					if(a + b > c && a + c > b && b + c > a) answer++;
			}
		}
	}
	
	cout << answer << endl;
	
	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll k;
    cin>>k;
    ll tmp=7%k;
    rep(1,i,(ll)1e6){
        if(tmp==0){
            cout<<i;
            return 0;
        }
        tmp=(tmp*10+7)%k;
    }
    cout<<-1;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    int n; cin >> n;
    P<P<string, int>, int> p[n];
    for(int i = 0; i < n; i++){
        string s; cin >> s;
        int point; cin >> point;
        p[i] = make_pair(make_pair(s, -point), i);
    }


    sort(p, p + n);
    for(int i = 0; i < n; i++){
        cout << p[i].second + 1 << endl;
    }


    return 0;
}


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

int main()
{
	long long X;
	cin >> X;

	long long ans = (X /500 * 1000);
	ans += ((X % 500) / 5) *5 ;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
n,x = map(int,input().split())
lista = [int(i) for i in input().split()]
lista.append(x)
lista.sort()
def gcd(a,b):
    if a<b:
        a,b = b,a
    if a%b==0:
        return b
    else:
        return gcd(b,a%b)

ans = lista[1]-lista[0]
for i in range(1,n+1):
    ans = gcd(ans,lista[i]-lista[i-1])

print(ans)

Measured memory_bytes: 62576
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M);
  vector<ll> C(M);
  for(int i=0; i<M; i++){
    cin >> A[i] >> B[i] >> C[i];
    A[i]--; B[i]--;
  }
  vector<ll> V(N);
  for(int i=0; i<N; i++)
    if(i == 0)
      V[i] = 0;
    else
      V[i] = -(1LL << 50);
  for(int i=0; i<N; i++){
    for(int j=0; j<M; j++){
      int src = A[j];
      int dst = B[j];
      if(V[dst] < V[src] + C[j])
	V[dst] = V[src] + C[j];
    }
  }
  // for(int i=0; i<N; i++)
  //   cout << V[i] << ' ';
  // cout << endl;

  vector<bool> ok(N, true);
  for(int j=0; j<M; j++){
    int src = A[j];
    int dst = B[j];
    if(V[src] + C[j] > V[dst])
      ok[dst] = false;
    if(!ok[src])
      ok[dst] = false;
  }

  if(ok[N-1])
    cout << V[N-1] << endl;
  else
    cout << "inf" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    char ch;
    while((ch = getchar()) != EOF){
        if((ch>=97)&&(ch<=122))
        printf("%c", ch-32);
        else if((ch>=65)&&(ch<=90))
        printf("%c", ch+32);
        else printf("%c", ch);
    }

    return 0;
}


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

using namespace std;

int main() {
	int H, W;
	cin >> H >> W;
	string *pic = new string[H];

	for (int i = 0; i < H; i++) {
		cin >> pic[i];
	}

	string frame = string(W + 2, '#');

	cout << frame << endl;
	for (int i = 0; i < H; i++) {
		cout << "#" << pic[i] << "#" << endl;
	}
	cout << frame << endl;
}

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

int main() {

	int n, m, x, ans = 100000000;
	cin >> n >> m >> x;
	vector<int> c(n), num(m, 0);
	vector<vector<int>> a(n, vector<int>(m));
	for(int i = 0; i < n; ++i) {
		cin >> c[i];
		for(int j = 0; j < m; ++j) {
			cin >> a[i][j];
			num[j] += a[i][j];
		}
	}
	for(int i = 0; i < m; ++i) {
		if(num[i] < x) {
			cout << -1 << endl;
			return 0;
		}
	}
	for(int i = 0; i < 1 << n; ++i) {
		int mon = 0, ok = 0;
		vector<int> sum(m, 0);
		for(int j = 0; j < n; ++j) {
			if((i >> j) & 1) {
				mon += c[j];
				for(int k = 0; k < m; ++k)
					sum[k] += a[j][k];
			}
		}
		for(int k = 0; k < m; ++k) {
			if(sum[k] >= x)
				++ok;
		}
		if(ok == m)
			ans = min(ans, mon);
	}
	cout << ans << endl;
	//*/
}

Measured memory_bytes: 3644
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#include <fstream>
#define rep(i, n) for (int i = 0; i < n; i++)
#define pi 3.14159265358979323846
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b)
{
  ll r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}

int main()
{

  int n; cin >> n;
  if (n==1){
    cout << "Hello World" << endl;
  } else {
    int a,b; cin >> a >> b;
    cout << a+b << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
int main(){
    char ch;
    stack<int> st1;
    stack<pair<int,int>> st2;
    int ans = 0;
    for(int i=0;cin>>ch;i++){
        if(ch=='\\') st1.push(i);
        else if(ch=='/'&&!st1.empty()){
            int j = st1.top();
            st1.pop();
            int num = i-j;
            ans+=num;
            while(!st2.empty()&&st2.top().first>j){
                num+=st2.top().second;
                st2.pop();
            }
            st2.push(make_pair(j,num));
        }
    }

    vector<int> rt;
    while(!st2.empty()){
        rt.push_back(st2.top().second);
        st2.pop();
    }
    cout<<ans<<endl;
    cout<<rt.size();
    for(int i = rt.size()-1;i>=0;--i){
        cout<<" "<<rt[i];
    }
    cout<<endl;
}


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

int main()
{
    int A[10];
    for (int i = 0; i < 10; i++) {
        cin >> A[i];
    }
    sort(A, A + 10);
    cout << A[9] << endl << A[8] << endl << A[7] << endl;
    return 0;
}

Measured memory_bytes: 3108
#!/usr/bin/env python3
import math
import itertools
k = int(input())
ans = 0

for a in range(1,k+1):
    for b in range(1,k+1):
        d = math.gcd(a,b)
        for c in range(1,k+1):
            e = math.gcd(d,c)
            ans += e
print(ans)

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

using namespace std;

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

const int N = (int)1e5 + 7;
const int inf = (int)1e9 + 7;
const ll linf = (ll)1e18;

int a, b, c, d;

int main(){
  cin >> a >> b >> c >> d;
  cout << max(0, min(b, d) - max(a, c));

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;

long long gcd(long long a, long long b) { // 2つの場合の最大公約数
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}
 
long long gcd_vec(vector<long long> const &A) { // N個の要素に対する最大公約数
    int size = (int)A.size();
    long long ret = A[0];
    for (int i = 1; i < size; i++) {
        ret = gcd(ret, A[i]);
    }
    return ret;
}

int main() {

int N;
ll A,B;
cin>>A>>B;
cout<<A*B/gcd(A,B)<<endl;



return 0;
}

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

using namespace std;

typedef long long ll;

#define MOD (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()

ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}



int main()
{



bool dp[80][80][13000];

memset(dp,false,sizeof(dp));


ll h,w;
cin>>h>>w;

vector<vector<ll>>a(h,vl(w));

vector<vector<ll>>b(h,vl(w));


for(int i=0;i<h;i++)
{
  for(int j=0;j<w;j++)
    {
      cin>>a[i][j];
    }
}

for(int i=0;i<h;i++)
{
  for(int j=0;j<w;j++)
    {
      cin>>b[i][j];
    }
}

dp[0][0][abs(a[0][0]-b[0][0])]=true;

for(int i=0;i<h;i++)
{
  for(int j=0;j<w;j++)
  {
    for(int k=0;k<13000;k++)
    {
      if(dp[i][j][k]==true)
      {
        if(i<h-1)
        {
        ll temp=abs(a[i+1][j]-b[i+1][j]);
          dp[i+1][j][abs(k+temp)]=true;
          dp[i+1][j][abs(k-temp)]=true;
        }

        if(j<w-1)
        {
        ll temp=abs(a[i][j+1]-b[i][j+1]);
          dp[i][j+1][abs(k+temp)]=true;
          dp[i][j+1][abs(k-temp)]=true;
        }
      }
    }
  }
}


for(int k=0;k<13000;k++)
{
  if(dp[h-1][w-1][k]==true)
  {
    cout<<k<<"\n";
    return 0;
  }
}



return 0;

}


Measured memory_bytes: 81664
l, r = gets.chomp.split.map(&:to_i)
min = 1145141919810
(l..[l+2019, r].min - 1).each do |i|
	(i+1..[l+2019,r].min).each do |j|
		mod = i * j % 2019
		min = mod if min > mod 
	end
end
puts min



Measured memory_bytes: 14204
def solve(A, x):
    i = 0
    total = 0
    res = 0
    for j in range(N):
        total += A[j]
        while total > x:
            total -= A[i]
            i += 1
        res += j - i + 1
    return res


N, Q = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
X = [int(x) for x in input().split()]

for x in X:
    print(solve(A, x))



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

typedef long long ll;

ll convert(string b)
{
	ll res = 0;
	for (int i = 0; i < b.length(); i++)
	{
		if( b[i] == '.' ) continue;
		res = res * 10 + b[i] - '0';
	}
	return res;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a;
	string b;
	cin >> a >> b;
	ll c = convert(b);
	ll res = (a * c) / 100;
	cout << res << '\n';
	return 0;
}


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

#define fst() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define FOR(i,a,b) for(i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef long double ld;

int main()
{
  fst();
  int i,n,a[2][100],s=0,m=0,j;
  cin>>n;
  for(i=0;i<n;i++) cin>>a[0][i];
  for(i=0;i<n;i++) cin>>a[1][i];
  for(i=0;i<n;i++)
  {
    s=0;
    for(j=0;j<=i;j++) s+=a[0][j];
    for(j=i;j<n;j++) s+=a[1][j];
    m=max(m,s);
  }
  cout<<m<<endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
p = list(map(int,input().split()))
ans = 0
for i in range(1,n-1):
    if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):
        ans += 1
print(ans)

Measured memory_bytes: 3060
n = int(input())
s = str(input())

mod = 10**9 +7

d = {}
for i in range(n):
    if s[i] not in d:
        d[s[i]] = 1
    else:
        d[s[i]] += 1

ans = 1
for v in d.values():
    ans *= (v+1)
    ans %= mod
ans -= 1
print(ans%mod)


Measured memory_bytes: 39280
#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long int
#define MOD 1000000007
#define P pair<ll,ll>
#define INF 1000000000000000000

//using namespace atcoder;
using namespace std;

int main(void){
  ll n;
  cin >> n;
  
  ll sum = 0;
  vector<ll> t(n);
  for (int i = 0; i < n; i++){
    cin >> t[i];
    sum += t[i];
  }
  ll m;
  cin >> m;
  
  for (int i = 0; i < m; i++){
    ll p, x;
    
    cin >> p >> x;
    p--;
    cout << sum + x - t[p] << endl;
  }
  
  

  return 0;
}


Measured memory_bytes: 3592
import numpy as np
import math

N, K = map(int, input().split())

ans = 0

for i in range(1, N+1):
    if (i < K):
        t = math.ceil(np.log2(K / i))
        ans += (1 / N) * np.power(0.5, t)
    else:
        ans += 1 / N

print(ans)



Measured memory_bytes: 12488
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		String NY[] = scanner.nextLine().split(" ",0);
		int N = Integer.parseInt(NY[0]);
		int Y = Integer.parseInt(NY[1]);
		int x = -1;
		int y = -1;
		int z = -1;

		for(int i = 0; i <= N; i++){
			//System.out.println((N - i) + " "+ i + " "+ 0 + " " + ((N - i) * 10000 + i * 5000));
			if((N - i) * 10000 + i * 5000 == Y){
				x = N - i;
				y = i;
				z = 0;
				break;
			}else{
				for(int j = 1; j <= i; j++){
					//System.out.println((N - i) + " "+ (i - j) + " "+ j + " " + ((N - i) * 10000 + (i - j) * 5000 + j * 1000));
					if((N - i) * 10000 + (i - j) * 5000 + j * 1000 == Y){
						x = N - i;
						y = i - j;
						z = j;
						break;
					}
				}
			}
		}
		System.out.println(x + " " + y + " " + z);
	}

}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if (a + b > c + d) {
    cout << "Left" << endl;
  }
  else if (a + b == c + d) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  lint n, p; cin >> n >> p;
  string s; cin >> s;
  if(p == 2 or p == 5) {
    lint ans = 0;
    for (int i = 0; i < n; i++) {
      int num = (int)(s[i] - '0');
      if (num % p == 0) {
        ans += i + 1;
      }
    }
    cout << ans << endl;
    return 0;
  }
  reverse(ALL(s));
  lint num = 0;
  map<lint, lint> mp;
  mp[0]++;
  lint k = 1;
  for(int i = 0; i < n; i++) {
    num += k * (lint)(s[i] - '0');
    num %= p;
    k *= 10;
    k %= p;
    mp[num]++;
  }

  lint ans = 0;
  for(auto x : mp) {
    lint val = x.second;
    ans += val * (val - 1) / 2;

    // if(x.first == 0) ans += val;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1028
from sys import stdin,stdout
from collections import defaultdict
import math
#input=stdin.readline
#def print(x):stdout.write(str(x)+'\n')
x,n,d=map(int,input().split())
ans=x
if x>0:
    if x-n*d<0:
        c=x//d
        n=n-c
        ans=x-c*d
        a=abs(ans-d)
        b=ans
        if n%2==0:
            print(b)
        else:
            print(a)
    else:
        print(x-n*d)
elif x==0:
    if n%2==0:
        print(x)
    else:
        print(x+d)
else:
    if x+n*d>0:
        c=abs(x)//d
        n=n-c
        ans=x+c*d
        a=ans+d
        b=abs(ans)
        if n%2==0:
            print(b)
        else:
            print(a)
    else:
        print(abs(x+n*d))

Measured memory_bytes: 9472
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.PriorityQueue;

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskC {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			char[] s = in.next().toCharArray();
			int i = 0;
			int j = s.length - 1;
			int count = 0;
			while (i < j) {
				if (s[i] == s[j]) {
					i++;
					j--;
				} else if (s[i] == 'x' && s[j] != 'x') {
					count++;
					i++;
				} else if (s[i] != 'x' && s[j] == 'x') {
					count++;
					j--;
				} else {
					out.println(-1);
					return;
				}
			}
			out.println(count);
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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

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

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

	}
}

Measured memory_bytes: 25172
#include <iostream>
#include<string.h>
#include<algorithm>
#include<math.h>

using namespace std;

int main() {
	string s;
	cin >> s;
	int N = s.size();
	int st,en,ans=0;
	bool AAA = false;

	for (int i = 0; i < N; ++i) {

		if (AAA==false && s[i] == 'A') {
			st = i;
			AAA = true;	
		}
		if (s[i] == 'Z') {
			en = i;	
		}
	}
	ans = en - st + 1;
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
//Code by ASIM FOIZE AIMON
//CSE'19;CUET
//avoid copy paste//Hit the frined button
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define precise cout.precision(10); cout << fixed;
#define endl "\n"
#define int int64_t
#define ll long long
#define yes printf("YES\n")
#define no printf("NO\n")

int32_t main()
{
    /*#ifndef ONLINE_JUDGE
        freopen("/media/AIMON/SSDVol/Progs/CodeForces/input.txt", "r", stdin);
        freopen("/media/AIMON/SSDVol/Progs/CodeForces/output.txt", "w", stdout);
    #endif*/
    ll a[10001],n,i,j,c=0,s=0,t,m,p,x,y,z,k;
    cin>>x;
    if(x==0)
        cout<<1<<endl;
    else if(x==1)
        cout<<0<<endl;
}


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

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

    int n, m;
    cin >> n >> m;

    int r = m % n;
    if(r == 0){
        int ans = m / n;
        cout << ans << endl; 
        return 0;
    }

    for(int i = m / n; i >= 1; i--){
        if((m - i) % i == 0){
            cout << i << endl;
            return 0;
        }
    }
    cout << 1 << endl;

    return 0;
}

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

int main() {
    string S;
    cin >> S;
    int n = S.length() - 1;
    for (int bit = 0; bit < (1<<n); ++bit) {
        int res = stoi(S.substr(0,1));
        for (int i = 0; i < n; ++i){
            if (bit & (1<<i)) res += stoi(S.substr(i+1,1));
            else res -= stoi(S.substr(i+1,1));
        }
        if (res == 7) {
            string ans;
            ans += S.substr(0,1);
            for (int i = 0; i < n; ++i) {
                if (bit & (1<<i)) ans += "+" + S.substr(i+1,1);
                else ans += "-" + S.substr(i+1,1);
            }
            ans += "=7";
            cout << ans << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<stack>
#include<algorithm>
#include<queue>
#include<cmath>
#include<numeric>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<iomanip>
#include<functional>
#include<bitset>

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

using namespace std;
typedef long long ll;

int main(){
    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++){
        if(i%2==0) continue;
        int count=0;
        for(int j=1;j<=i;j++){
            if(i%j==0) count++;
        }
        if(count==8) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define sz(arr) (int)(arr).size()
#define rng(arr) arr.begin(), arr.end()
#define show(x) cout << #x << " = " << x << endl;

using namespace std;
typedef long long ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main() {
  Cin(ll, a, b, c);
  if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
    puts("0");
    return;
  }
  cout << min({b * c, a * c, a * b}) << endl;
}

int main() {
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long INT;
double PI = 3.14159265;

const long long INF = 1LL << 60;


int main() {
    int a[300010] = {},n;
    INT sum=0;

    cin >> n;

    rep(i, n * 3)cin >> a[i];

    sort(a, a + n * 3,greater<int>());

    rep(i, n)sum += a[i * 2 + 1];

    cout << sum << endl;

  return 0;
}

Measured memory_bytes: 1408
import heapq

N, M = map(int, input().split())
A = [int(a) * (-1) for a in input().split()]

B_array = []
for _ in range(M):
    B, C = map(int, input().split())
    B_array.append([C * (-1), B])
B_array.sort()

cnt = 0
i = 0
B_list = []
while cnt < N and i < M:
    B_list.extend([B_array[i][0]] * B_array[i][1])
    cnt += B_array[i][1]
    i += 1

A.extend(B_list)
heapq.heapify(A)

ans = 0
for _ in range(N):
    ans += heapq.heappop(A)
        
print(ans * (-1))

Measured memory_bytes: 28360
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> PLL;
#define chmax(x, y) do { x = max(x, y); } while(0)
#define chmin(x, y) do { x = min(x, y); } while(0)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<ll>(a); i < static_cast<ll>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
template<typename T>
using reversed_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T> >;

struct T {
  string s;
  ll open, close;
  T(string s, ll open, ll close) : s(s), open(open), close(close) {}
};

ll N;
vector<T> v, v1, v2;

signed main() {
  cin >> N;
  rep(i, N) {
    string s;
    cin >> s;
    ll close = 0, open = 0;
    for (auto c : s) {
      if (c == '(') open++;
      if (c == ')') {
        if (open > 0) open--;
        else close++;
      }
    }
    //cout << s << " " << open << " " << close << endl;
    if (open > close)
      v1.emplace_back(s, open, close);
    else
      v2.emplace_back(s, open, close);
  }

  sort(begin(v1), end(v1), [](const auto &l, const auto &r) {
      return l.close < r.close;
      });
  sort(begin(v2), end(v2), [](const auto &l, const auto &r) {
      return l.open > r.open;
      });

  v.insert(v.end(), v1.begin(), v1.end());
  v.insert(v.end(), v2.begin(), v2.end());

  ll open = 0;
  for (auto b : v) {
    if (open < b.close) {
      cout << "No" << endl;
      return 0;
    }
    open -= b.close;
    open += b.open;
  }

  if (open == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 120480
#include <cstdio>
#include <vector>
#include <queue>
#define pb push_back
std::priority_queue<int, std::vector<int>, std::greater<int> > que; 
std::vector<int> pos[200005]; 
int rem[200005];
int main()
{
	// freopen("ARC076-F.in", "r", stdin); 
	int n, m; 
	scanf("%d%d", &n, &m); 
	for (int i = 0; i < n; i++)
	{
		int l, r; 
		scanf("%d%d", &l, &r); 
		pos[l].pb(r); 
	}
	int l = 0; 
	for (int i = 0; i <= m; i++)
	{
		for (int x : pos[i])
		{
			if (l < i)
			{
				que.push(x); 
				l++; 
				continue; 
			}
			if (que.empty() || x <= que.top())
				rem[x]++; 
			else
			{
				rem[que.top()]++;
				que.pop(); 
				que.push(x); 
			}
		}
	}
	int r = m + 1, ans = rem[m + 1]; 
	for (int i = m; i; i--)
	{
		while (rem[i])
		{
			if (i < r && l + 1 < r)
				r--; 
			else
				ans++; 
			rem[i]--; 
		}
	}
	printf("%d\n", ans);
	return 0; 
}


Measured memory_bytes: 10108
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <queue>
#include <stack>
#define s(n) scanf("%d",&n);
#define sl(n) scanf("%lld",&n);
#define p(n) printf("%d",n);
#define pl(n) printf("%lld",n);
#define pr printf("\n");
#define LL long long
using namespace std;

const int maxn=1e5+5;
int num[maxn];

struct Node{
    LL x;
    LL y;
}a[60],b[60];

int main(){
    LL n,m;
    sl(n);sl(m);
    for(LL i=0;i<n;i++){
        sl(a[i].x);sl(a[i].y);
    }
    for(LL i=0;i<m;i++){
        sl(b[i].x);sl(b[i].y);
    }
    for(int i=0;i<n;i++){
        LL Min=0x3f3f3f3f;
        LL temp=-1;
        for(int j=0;j<m;j++){
            if(abs(a[i].x-b[j].x)+abs(a[i].y-b[j].y) < Min){
                Min = abs(a[i].x-b[j].x)+abs(a[i].y-b[j].y);
                temp = j+1;
            }
        }
        pl(temp);pr;
    }
    return 0;
}


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  
  int cnt = 0;
  for(int i = 0; i < n; i++){
    s = s.substr(i);
    auto m = s.find("ABC");
    if(m == string::npos){
      break;
    }
    cnt++;
    i = ((int) m) + 2; 
  }
  cout << cnt << endl;
}

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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
const   int            infi = numeric_limits<int>::max();
const   double         eps = 0;
const   int            ms  = 0;

int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, n)cin >> p[i];
    int ma = 0;
    rep(i, n)ma = max(p[i], ma);
    int s = 0;
    rep(i, n)s+=p[i];
    cout << s - ma / 2 << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <sstream>
#include <numeric>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>

///////////////////////////////////////////////////////////////
// namespace
///////////////////////////////////////////////////////////////
using namespace std;
// namespace mp = boost::multiprecision;

///////////////////////////////////////////////////////////////
// types
///////////////////////////////////////////////////////////////
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
// using mpi = mp::cpp_int;
// using mpf = mp::number<mp::cpp_dec_float<1024>>;

///////////////////////////////////////////////////////////////
// mod https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a
///////////////////////////////////////////////////////////////
// ll MOD = 1000000007;
//
// ll mod(long long val) {
//     long long res = val % MOD;
//     if (res < 0) res += MOD;
//     return res;
// }
//
// ll modinv(ll a) {
//     ll b = MOD, u = 1, v = 0;
//     while (b) {
//         ll t = a / b;
//         a -= t * b; swap(a, b);
//         u -= t * v; swap(u, v);
//     }
//     u %= MOD;
//     if (u < 0) u += MOD;
//     return u;
// }
//
// const int MAX = -1;
// ll fac[MAX], finv[MAX], inv[MAX];
// void com_init() {  // initialize nCk table with O(N)
//     fac[0] = fac[1] = 1;
//     finv[0] = finv[1] = 1;
//     inv[1] = 1;
//     for (int i = 2; i < MAX; i++){
//         fac[i] = fac[i - 1] * i % MOD;
//         inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
//         finv[i] = finv[i - 1] * inv[i] % MOD;
//     }
// }
// ll com(int n, int k){  // nCk
//     if (n < k) return 0;
//     if (n < 0 || k < 0) return 0;
//     return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
// }


int main() {
    ll n;
    cin >> n; --n;
    cout << n * (n + 1) / 2 << endl;
    return 0;
}


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

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);

		int N = sc.nextInt();
		int Y = sc.nextInt();

		int r10000 = -1;
		int r5000 = -1;
		int r1000 = -1;

		for (int x = 0; x <= N; x++) {
			for (int y = 0; x + y <= N; y++) {
				int z = N - x - y;
				int total = 10000*x + 5000*y + 1000*z;
				if (total == Y) {
					r10000 = x;
					r5000 = y;
					r1000 = z;
				}
			}
		}

		System.out.println(r10000 + " " + r5000 + " " + r1000);

	}


	static class FastScanner {

		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;

	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

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

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

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

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

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }

	}


}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define FI(i,a,b) for(int i=(a);i<=(b);++i)
#define FD(i,b,a) for(int i=(b);i>=(a);--i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;
constexpr LL inv(LL x, LL m) { return x > m ? inv(x % m, m) : x > 1 ? inv(m % x, m) * (m - m / x) % m : x; }
constexpr LL mpow(LL a, LL k, LL m) { LL r(1); for (a %= m; k; k >>= 1, a = a * a % m) if (k & 1)r = r * a % m; return r; }

const int N = 100005;
int n, q, A[N];
LL S[N], F[N];

int main() {
    cin >> n >> q;
    FI(i, 1, n) scanf("%d", &A[i]);
    FI(i, 1, n) S[i] = S[i - 1] + A[i];
    F[1] = A[1];
    FI(i, 2, n) F[i] = F[i - 2] + A[i];
    while (q--) {
        int x;
        scanf("%d", &x);
        auto check = [&](int cnt) {
            int l = n - cnt + 1;
            if (A[l] < x) return false;
            int dis = A[l] - x;
            int pos = x - dis;
            int L = lower_bound(A + 1, A + 1 + n, pos) - A;
            if (l - L + 1 < cnt) return false;
            return true;
        };
        int l = 0, r = n + 1;
        while (l + 1 < r) {
            int m = (l + r) >> 1;
            if (check(m)) l = m;
            else r = m;
        }
        LL sum = S[n] - S[n - l] + F[n - l - l];
        printf("%lld\n", sum);
    }
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main()
{
   char a;
   cin>>a;
   if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
   {
     cout<<"vowel";
   }
   else
   {
       cout<<"consonant";
   }


    return 0;
}


Measured memory_bytes: 256