akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807;
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }


int main() {
	int N;
	scanf("%d", &N);
	int *A = (int*)malloc(sizeof(int)*N);
	int cnt = 0, tmp = 0, ans = 0;
	for (int i = 0; i < N; i++) {
		cnt = 0;
		scanf("%d", &A[i]);
		while (A[i] % 2 == 0) {
			cnt++;
			A[i] = A[i] / 2;
		}
		tmp += cnt;
	}
	ans = tmp;
	printf("%d\n", ans);

#ifdef DEBUGF
	getch();
#endif
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

//マクロ
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main()
{
  int n;
  cin >> n;
  int cur = 1;
  ll ans = 0;
  bool hasOne = false;
  rep(i, n)
  {
    int input;
    cin >> input;
    if (input == 1)
    {
      hasOne = true;
    }
    if (input != cur)
    {
      ans++;
    }
    else
    {
      cur++;
    }
  }
  if (hasOne)
  {
    cout << ans << endl;
  }
  else
  {
    cout << -1 << endl;
  }
  return 0;
}

Measured memory_bytes: 760
#include<stdio.h>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(j,m) for(int (j)=0;(j)<(m);(j)++)
#define max(x,y) x>y?x:y

int main() {
  int h,w,m;
  scanf("%d %d %d", &h,&w,&m);
  int hc[600000] = {0};
  int wc[600000] = {0};
  int hset[600000] = {0};
  int wset[600000] = {0};

  int bh,bw;
  rep(i,m){
    scanf("%d %d", &bh,&bw);
    bh--;
    bw--;
    hc[bh] += 1;
    wc[bw] += 1;
    hset[i] = bh;
    wset[i] = bw;
  }

  int maxh = -1;
  int maxw = -1;
  int maxb = -1;

  rep(i,h){
    maxh = max(maxh,hc[i]);
  }
  rep(i,w){
    maxw = max(maxw,wc[i]);
  }
  rep(i,m){
    maxb = max(maxb,hc[hset[i]] + wc[wset[i]]);
  }

  long long int hmc = 0, wmc = 0, bmc = 0;

  rep(i,h){
    if(maxh == hc[i]) hmc++;
  }
  rep(i,w){
    if(maxw == wc[i]) wmc++;
  }
  rep(i,m){
    if(maxb == hc[hset[i]] + wc[wset[i]]) bmc++;
  }

  int ans = maxh + maxw;

  if(maxb == maxh + maxw){
    if(bmc == hmc * wmc){
      ans--;
    }
  }

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

  return 0;
}


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

int main()
{
  ll n; cin >> n;
  ll m; cin >> m;
  priority_queue<ll> pq;
  for (int i=0; i<n; i++){
    int t; cin >> t;
    pq.push(t);
  }

  while (m > 0) {
    ll t = pq.top();
    pq.pop();
    t /= 2;
    pq.push(t);
    m--;
  }

  ll sum = 0;
  while (!pq.empty()) {
    ll t = pq.top();
    pq.pop();
    sum += t;
  }
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define lli long long int
#define floop(a,b,c) for(lli a=b;a<c;a++)
#define bloop(a,b,c) for(lli a=b;a>=c;a--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vt vector
#define MAX 1000000007
using namespace std;
lli t,h,w,m;
lli i,j,k;
int main(){
        cin>>h>>w;
        string s[h];
        floop(i,0,h){
              cin>>s[i];
        }
        lli ans[h][w];
        bool flag1=true;
        floop(i,0,w){
            if(s[0][i]=='.'){
            	if(flag1==true) ans[0][i]=1;
            	else ans[0][i]=0;
            }
            else if(s[0][i]=='#'){
                ans[0][i]=0;
                flag1=false;
            }
        }
        flag1=true;
        floop(i,0,h){
            if(s[i][0]=='.'){
            	if(flag1==true) ans[i][0]=1;
            	else ans[i][0]=0;
            }
            else if(s[i][0]=='#'){
                ans[i][0]=0;
                flag1=false;
            }
        }
        floop(i,1,h){
              floop(j,1,w){
                    if(s[i][j]=='#') ans[i][j]=0;
                    else ans[i][j]=((ans[i-1][j]+ans[i][j-1])%MAX);
              }
        }
        /*floop(i,0,h){
        	  floop(j,0,w){
        	  		cout<<ans[i][j]<<" ";
        	  }
        	  cout<<endl;
        }*/
        cout<<ans[h-1][w-1];
        return 0;
}


Measured memory_bytes: 9088
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

int main(){
  long long int N;
  std::string str_tmp;
  std::vector<std::string> S;

  scanf("%lld", &N);
  for(long long int i = 0; i < N; i++){
    std::cin >> str_tmp;
    S.push_back(str_tmp);
  }

  std::sort(S.begin(), S.end());

  /*std::cerr << "Sorted S:";
  for(long long int i = 0; i < N; i++){
    std::cerr << S[i] << std::endl;
  }*/

  std::vector<long long int> start, count;
  
  long long int i_tmp = 0;
  long long int count_tmp = 1;
  long long int count_max = 1;
  start.push_back(i_tmp);
  count.push_back(count_tmp);
  for(long long i = 1; i < N; i++){
    if(S[i] == S[start[i_tmp]]){
      count[i_tmp]++;
      count_max = std::max(count_max, count[i_tmp]);
    }
    else{
      i_tmp++;
      count_tmp = 1;
      start.push_back(i);
      count.push_back(count_tmp);
    }
  }

  std::cerr << "Answer: " << std::endl;
  for(long long int i = 0; i < count.size(); i++){
    if(count[i] == count_max){
      std::cout << S[start[i]] << std::endl;
    }
  }

  return 0;
}


Measured memory_bytes: 19184
#include <bits/stdc++.h>
#define MOD 1000000007LL
#define INF 1000000000LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

struct edge{
	int t,c;
	edge(){}
	edge(int tt,int cc){
		t=tt;
		c=cc;
	}
};

vector<edge> G[20];

int n,m;
int a[500];
int b[500];
int c[500];
int dp[1<<15][15];
int cost[1<<15];
int dp2[1<<15][15];
int bits[1<<15];
int node[15];
int node2[15];

int main(void){
	int s=n,t=s+1;
	scanf("%d%d",&n,&m);
	int sum=0;
	for(int i=0;i<m;i++){
		scanf("%d%d%d",&a[i],&b[i],&c[i]);
		a[i]--;
		b[i]--;
		sum+=c[i];
		G[a[i]].push_back(edge(b[i],c[i]));
		G[b[i]].push_back(edge(a[i],c[i]));
	}
	for(int i=0;i<(1<<n);i++){
		for(int j=0;j<n;j++){
			if(!(i>>j & 1))continue;
			for(int k=0;k<G[j].size();k++){
				int nv=G[j][k].t;
				if(nv>j && ((i>>nv) & 1)){
					cost[i]+=G[j][k].c;
				}
			}
		}
	}
	memset(dp,-1,sizeof(dp));
	dp[1][0]=0;
	for(int i=0;i<(1<<n);i++){
		for(int j=0;j<n;j++){
			if(dp[i][j]>=0){
				for(int k=0;k<G[j].size();k++){
					int nv=G[j][k].t;
					int nc=G[j][k].c;
					if(!(i>>nv & 1)){
						int nbit=i+(1<<nv);
						dp[i+(1<<nv)][nv]=max(dp[i+(1<<nv)][nv],dp[i][j]+nc);
					}
				}
			}
		}
	}
	int res=0;
	for(int i=0;i<(1<<n);i++){
		if(!(i>>0 & 1))continue;
		if(!(i>>(n-1) & 1))continue;
		if(dp[i][n-1]==-1)continue;
		int cnt=0;
		int cnt2=0;
		for(int j=0;j<n;j++){
			if(i>>j & 1){
				node[cnt++]=j;
			}else{
				node2[cnt2++]=j;
			}
		}
		for(int j=0;j<(1<<cnt2);j++){
			bits[j]=0;
			for(int k=0;k<cnt2;k++){
				if((j>>k) & 1){
					bits[j]+=1<<node2[k];
				}
			}
			for(int k=0;k<=cnt;k++){
				dp2[j][k]=-1;
			}
		}
		dp2[0][0]=0;
		for(int j=0;j<cnt;j++){
			for(int k=0;k<(1<<cnt2);k++){
				if(dp2[k][j]>=0){
					for(int l=k;l<(1<<cnt2);l=((l+1)|k)){
						int rest=l-k;
						int bit=bits[rest]+(1<<node[j]);
						dp2[l][j+1]=max(dp2[l][j+1],dp2[k][j]+cost[bit]);
					}
				}
			}
		}
		if(dp[i][n-1]>=0 && dp2[(1<<cnt2)-1][cnt]>=0)res=max(res,dp[i][n-1]+dp2[(1<<cnt2)-1][cnt]);
	}
	printf("%d\n",sum-res);
	return 0;
}

Measured memory_bytes: 2816
#include <iostream>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
  int H,W;
  while(1){
  cin >> H >> W;
  if(H==0 && W==0)
    break;
  REP(i,H){
    REP(j,W){
      if(i%2==0 && j%2==0)
        cout << "#";
      else if(i%2!=0 && j%2!=0)
        cout << "#";
      else
        cout << ".";
    }
    cout << endl;
  }
  cout << endl;
  }
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
/*	#include <boost/math/common_factor.hpp>  boost::math::lcm(10,20) ---> use it to find lcm.*/
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//typedef long long ll;
#define int long long 
#define PI pair<int , int >
#define mpr make_pair
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define debug() cout << "Hi" << endl	// write debug(); in main()
const int MOD = 1e9+7;
const int MAXN = 1e5+3;
const int inf = 2e9;
int max(int a,int b){	if(a > b)return a; else return b; }
int min(int a, int b){	if(a < b)return a; else return b; }
/*		0. Go to main function first.
		1. Take all the inputs................................................
		2. Check Once whether the graph given is directed or undirected.......
		3. Tree can also be undirected.
		4. Whenever you do multiplication and division in the same line, beware.
*/
void solve(){
	int x;
	cin >> x;
	int ans = 0;
	ans += (1000 * (x/500) );
	x = x%500;
	ans += (5 * (x/5) );
	cout << ans << endl;
}
/*	memset() can be used to set all values as 0 or -1 for integer data types.*/

int32_t main(){
	IO;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#endif // ONLINE_JUDGE
	// std::cout << std::setprecision(12); std::cout << std::fixed;
	int t;
	// cin >> t;
	t = 1;
	while(t--){
		solve();
	}
	return 0;
}


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

using ll = long long int;

const ll MAXN = 3001;
ll S[MAXN][MAXN];
ll dp[MAXN][MAXN][4];

int main()
{
    ll R, C, K;
    cin >> R >> C >> K;

    for (ll i=0;i<K;++i)
    {
        ll x, y;
        cin >> y >> x;
        cin >> S[x][y];
    }

    ll ans = 0;

    const auto update = [&ans](auto* dst, auto src)
    {
        *dst = max(*dst, src);
        ans = max(ans, *dst);
    };

    for (ll y=1;y<=R;++y)
    for (ll x=1;x<=C;++x)
    for (ll k=1;k<=3;++k)
    {
        update(&dp[x][y][k], dp[x - 1][y][k]);
        update(&dp[x][y][k], dp[x - 1][y][k - 1] + S[x][y]);
        update(&dp[x][y][k], dp[x][y - 1][3] + S[x][y]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 355048
#include <iostream>
#include <map>

using namespace std;

int main(int argc, char const *argv[])
{
    int X, N;
    cin >> X >> N;
    map<int, int> cnt;
    int in;
    for (int i = 0; i < N; i++)
    {
        cin >> in;
        cnt[in]++;
    }

    int ans;
    int i = 0;
    while (1)
    {
        if (cnt[X - i] == 0)
        {
            ans = X - i;
            break;
        }
        if (cnt[X + i] == 0)
        {
            ans = X + i;
            break;
        }
        i++;
        
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3596
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
  int n, maxi = 0;
  map<string, int> m;
  string s;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (m.find(s) != m.end()) {
      m[s]++;
      maxi = max(maxi, m[s]);
    } else {
      m.insert({s, 1});
      maxi = max(maxi, 1);
    }
  }
  map<string, int>::iterator it = m.begin();
  while (it != m.end()) {
    if (it->second == maxi) {
      cout << it->first << endl;
    }
    it++;
  }
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string S;
    cin >> S;
    int yy = 10 * (S[0] - '0') + S[1] - '0';
    int mm = 10 * (S[2] - '0') + S[3] - '0';
    if(yy == 0 && mm == 0)
    {
        cout << "NA" << endl;
    }
    else if (yy == 0 && mm > 0 && mm <= 12)
    {
        cout << "YYMM" << endl;
    }
    else if (yy == 0 && mm > 12)
    {
        cout << "NA" << endl;
    }
    else if (yy > 12 && mm == 0)
    {
        cout << "NA" << endl;
    }
    else if (yy <= 12 && mm == 0)
    {
        cout << "MMYY" << endl;
    }
    else if (yy <= 12 && mm <= 12)
    {
        cout << "AMBIGUOUS" << endl;
    }
    else if (yy > 12 && mm <= 12)
    {
        cout << "YYMM" << endl;
    }
    else if (yy <= 12 && mm > 12)
    {
        cout << "MMYY" << endl;
    }
    else
    {
        cout << "NA" << endl;
    }
}


Measured memory_bytes: 256
/*
Original problem: https://atcoder.jp/contests/dp/tasks/dp_o
Author: sammochen
*/

#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;

#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)

#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef vector<ll> VLL;
typedef vector<int> VI;

const ll mod = 1e9+7;

namespace SOLVE {
	void addmod(ll & a, ll b) {
		a += b;
		if (a >= mod) {
			a -= mod;
		}
	}
	void main() {
		int n;
		cin >> n;

		vector < VI > x(n, VI(n));
		REP(i, 0, n) {
			REP(j, 0, n) {
				cin >> x[i][j];
			}
		}

		// dp[mask] is how many ways to satisfy up to i with this mask remaining
		VLL dp(1 << n);

		dp[(1 << n) - 1] = 1; // there is 1 way of satisfying 0 people with 111..111 remaining
		REP(i, 0, n) { // for every person
			VLL temp(1 << n);
			REP(mask, 0, (1 << n)) {
				// if (dp[mask]) exists, iterate through and update dp[updatedmask]
				if (dp[mask]) {
					for (int next = 0; next < n; next++) {
						if (x[i][next] && ((1 << next) & mask)) {
							addmod(temp[mask & (~(1 << next))], dp[mask]);
						}
					}
				}
			}
			dp = temp;
		}

		cout << dp[0] << endl;
	}
}


signed main() {
	int t;
	t = 1;
	// cin >> t;
	while (t--) {
		SOLVE::main();
	}

	return 0;
}

Measured memory_bytes: 33024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
#define mod 1e9 + 7;
ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}


int main()
{
	ios_base::sync_with_stdio(false);

	ll n; bool chk = false;
	cin >> n;
	if (n == 0) {
		cout << 0 << endl;
		return 0;
	}
	string s; ll x = 1;
	while(n) {
		if (n % (abs(x) * 2)) {
			s += '1';
			n -= x;
		}
		else {
			s += '0';
		}
		x *= -2;
	}
	reverse(all(s));
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//template to keep things straight
 
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define sc(n) scanf("%d",&n)
#define scL(n) scanf("%lld",&n)
 
//#define cinL(n) scanf("%lld",&n)
//#define coutL(n) printf("%lld ",n);
 
#define pr(n) printf("%d\n",n);
#define prL(n) printf("%lld\n",n);
#define newl printf("\n")
//#define mp make_pair
#define pb push_back
#define pf pop_front
#define in insert
#define ll long long 
#define F first
#define S second
//#define MOD 100000000
#define mp make_pair
using namespace std;
#define tv(container, it)  for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define boost  ios::sync_with_stdio(false)//;cin.tie(0)
#define MOD 1000000007

int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	cout<<a+b+c-max(a,max(b,c))<<"\n";
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,m,a[10000],b,t[10000],x=0,y,i,j;
	scanf("%d %d", &n, &m);
	for(i=0; i<n; i++)
	{
		scanf("%d", &a[i]);
		t[i]=0;
	}
	for(i=0; i<m; i++)
	{
		scanf("%d", &b);
		for(j=0; j<n; j++)
		{
			if(b>=a[j])
			{
				t[j]++;
				break;
			}
		}
	}
	for(i=0; i<n; i++)
	{
		if(x<t[i])
		{
			x=t[i];
			y=i+1;
		}
	}
	printf("%d\n", y);
	
	return 0;
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
typedef long long ll;

using namespace std;

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define ALL(a)              a.begin(), a.end()
#define ALLN(a, n)          (a, a+n)
#define MAX                 10000007
#define MIN                 -10000007



              
int main()
{
  ios::sync_with_stdio(0);
    cin.tie(0);
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
      
    int t;
    t=1;
     //  cin>>t;
    while(t--){
         //  int n,c=0;
       /*     cin>>n;
            ll a[n];
            REP(i,0,n-1) cin>>a[i];  
            sort(a,a+n);
            REP(i,0,n-1){
                REP(j,i+1,n-1){
                    REP(k,j+1,n-1){
                        //if(i!=j&&j!=k&&i!=k){
                            if(a[i]+a[j]>a[k]&&a[i]!=a[j]&&a[j]!=a[k]&&a[i]!=a[k]){
                                c++;
                            } 
                        //}
                    }
                }
            }
            cout<<c;
*/
           string s;
            cin>>s;
            int maxx=0,n=s.size();
            int j=0;
            REP(i,0,2){
                if(s[i]=='R'){
                    j=i;
                    while(s[i]=='R'){
                        i++;
                        if(i==n) break;
                    }
                    maxx=max(maxx,i-j);
                    j=i;
                }
            }
            cout<<maxx;

             }
             cerr<<"Time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
    return 0;
}


Measured memory_bytes: 3840
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>
#include <bitset>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

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

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n;
    cin >> n;
    --n;
    ll ans = 0;
    for(int i = 1; i <= n; ++i) ans += n / i;
    cout << ans << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 3644
# include <algorithm>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <string>
# include <vector>

using namespace std;
typedef long long ll;

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

    int n; cin >> n;
    vector<int> a(n), b(n), c(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    for (int i = 0; i < n; i++) cin >> c[i];
    sort(a.begin(), a.end());
    sort(c.begin(), c.end());
    ll ans = 0;
    for (int& bi : b) {
        ll ac = lower_bound(a.begin(), a.end(), bi) - a.begin();
        ll cc = c.end() - upper_bound(c.begin(), c.end(), bi);
        ans += ac * cc;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  int N, M, K;
  cin >> N >> M >> K;

  if (K == 0) {
    cout << "Yes" << endl;
    return 0;
  } else if (K % N == 0 && K / N <= M) {
    cout << "Yes" << endl;
    return 0;
  } else if (K % M == 0 && K / M <= N) {
    cout << "Yes" << endl;
    return 0;
  }

  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
      int tmp = N * M - i * j - (N - i) * (M - j);
      if (tmp == K) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
def solve():
    S = input()
    l = int(S[:2])
    r = int(S[2:])
    
    if 1 <= l <= 12:
        if 1 <= r <= 12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1 <= r <= 12:
            return 'YYMM'
        else:
            return 'NA'

print(solve())

Measured memory_bytes: 3060
#ifndef CLASS_MODINT
#define CLASS_MODINT

#include <cstdint>

template<std::uint32_t mod>
class modint {
private:
	std::uint32_t n;
public:
	modint() : n(0) {};
	modint(std::int64_t n_) : n((n_ >= 0 ? n_ : mod - (-n_) % mod) % mod) {};
	static constexpr std::uint32_t get_mod() { return mod; }
	std::uint32_t get() const { return n; }
	bool operator==(const modint& m) const { return n == m.n; }
	bool operator!=(const modint& m) const { return n != m.n; }
	modint& operator+=(const modint& m) { n += m.n; n = (n < mod ? n : n - mod); return *this; }
	modint& operator-=(const modint& m) { n += mod - m.n; n = (n < mod ? n : n - mod); return *this; }
	modint& operator*=(const modint& m) { n = std::uint64_t(n) * m.n % mod; return *this; }
	modint operator+(const modint& m) const { return modint(*this) += m; }
	modint operator-(const modint& m) const { return modint(*this) -= m; }
	modint operator*(const modint& m) const { return modint(*this) *= m; }
	modint inv() const { return (*this).pow(mod - 2); }
	modint pow(std::uint64_t b) const {
		modint ans = 1, m = modint(*this);
		while (b) {
			if (b & 1) ans *= m;
			m *= m;
			b >>= 1;
		}
		return ans;
	}
};

#endif // CLASS_MODINT

#include <vector>
#include <iostream>
using namespace std;
using modulo = modint<998244353>;
int main() {
	int N; long long A, B, K;
	cin >> N >> A >> B >> K;
	vector<modulo> fact(N + 1);
	fact[0] = 1;
	for (int i = 1; i <= N; ++i) fact[i] = fact[i - 1] * i;
	modulo ans = 0;
	for (int i = 0; i <= N; ++i) {
		long long rem = K - A * i;
		if (rem < 0 || rem > B * N || rem % B != 0) continue;
		rem /= B;
		ans += fact[N] * fact[i].inv() * fact[N - i].inv() * fact[N] * fact[rem].inv() * fact[N - rem].inv();
	}
	cout << ans.get() << endl;
	return 0;
}

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

int main() {
  int k;
  cin >> k;
  rep(i, k) cout << "ACL";
  cout << endl;
  return 0;
}

Measured memory_bytes: 3624
# x: heads, y: legs
x, y = map(int, input().split())

tmp_legs = x * 4
diff = tmp_legs - y

if diff < 0:
    print("No")
    exit()
elif diff == 0:
    print("Yes")
    exit(0)

head_crane = diff//2

if diff/2 - head_crane != 0:
    print("No")
    exit()
elif head_crane > x:
    print("No")
    exit()

print("Yes")

Measured memory_bytes: 9040
import java.util.*;
 
	public class Main {
		public static void main(String[] args) {
      	Scanner sc = new Scanner(System.in);
      
      	int N  =sc.nextInt();
       	int M  =sc.nextInt();
          
          List<Integer> n = new ArrayList<>();
          
          for(int i=0; i<N; i++){
          n.add(sc.nextInt());
          }

          double sum = 0;
          for(int i=0; i<N; i++){
          sum += n.get(i);
          }
 
          double a = sum/(4*M);
          int count = 0;
          for(int i=0; i<N; i++){
            if(n.get(i)>=a){
            count++;
            }
           
          }
          if(M<=count){
          System.out.println("Yes");
          }
          else{
          System.out.println("No");
          }
        }
    }


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

int main(void)
{
  while (1) {
    int g, m;
    int table[1001] = {};
    table[0] = 1;

    cin >> m; if (!m) break;
    for (int i=0; i<m; i++) {
      int a, b; cin >> a >> b;
      for (int j=1000; j>=0; j--) {
	if (!table[j]) continue;
	for (int k=1; k<=b; k++) {
	  if (j+a*k > 1000) break;
	  table[j+a*k] += table[j];
	}
      }
    }

    cin >> g;
    for (int i=0; i<g; i++) {
      int n; cin >> n;
      cout << table[n] << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int A[20];
int x[20][20], y[20][20];
int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		for (int j = 0; j < A[i]; j++) {
			cin >> x[i][j] >> y[i][j];
			x[i][j]--;
		}
	}
	int ans = 0;
	for (int bit = 0; bit < (1 << N); bit++) {
		int tmp = bit;
		vector<int> V;
		int info[20] = { 0 };
		for (int i = 0; i < N; i++) {
			info[i] = 0;
			if (tmp % 2 == 1) {
				V.push_back(i);
				info[i] = 1;
			}
			tmp /= 2;
		}
		bool out = false;
		for (int s : V) {
			for (int i = 0; i < A[s]; i++) {
				int p = x[s][i];
				if (info[p] != y[s][i]) {
					out = true;
					break;
				}
			}
		}
		if (out) continue;
		ans = max((int)V.size(), ans);
	}
	cout << ans << endl;
}

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


class Era{
public:
  string name;
  int s,e;
  
  bool operator<(const Era & e)const{
    return s < e.s;
  }

  Era(string str,int a,int b):name(str),s(a),e(b){}
  Era();
};

Era:: Era(){
}


void func(vector<Era>& era,int n){
  int a;
  cin >> a;
  for(int i = 0 ; i < n ; i++){
    if(era[i].s < a && a <= era[i].e){
      cout << era[i].name << ' ' << a - era[i].s << endl;
      return ;
    }
  }
  cout << "Unknown" << endl;
  return;
}


int main(){
  int n,q;
  while(1){
    cin >> n >> q;
    if(n == 0 && q == 0)break;
    vector<Era> era(n);
    for(int i = 0 ;i < n ;i++){
      string str;
      int a,b;
      cin >> str >> a >> b;
      era[i] = Era(str,b-a,b);
    }
    sort(era.begin(), era.end());
    for(int i = 0 ; i < q ; i++){
      func(era,n);
    }
  }
  return 0;
}

Measured memory_bytes: 0
use std::io::*;

macro_rules! input {
	(source = $s:expr, $($r:tt)*) => {
		let mut iter = $s.split_whitespace();
		input_inner!{iter, $($r)*}
	};
	($($r:tt)*) => {
		let mut s = {
			use std::io::Read;
			let mut s = String::new();
			std::io::stdin().read_to_string(&mut s).unwrap();
			s
		};
		let mut iter = s.split_whitespace();
		input_inner!{iter, $($r)*}
	};
}

macro_rules! input_inner {
	($iter:expr) => {}; // nothing
	($iter:expr, ) => {}; // nothing

	($iter:expr, $var:ident : $t:tt $($r:tt)*) => { // match
		let $var = read_value!($iter, $t);
		input_inner!{$iter $($r)*}
	};
}

macro_rules! read_value {
	($iter:expr, ( $($t:tt),* )) => { // comma
		( $(read_value!($iter, $t)),* )
	};

	($iter:expr, [ $t:tt ; $len:expr ]) => { // a0, a1, ...
		(0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
	};

	($iter:expr, chars) => { //string0, string1, ...
		read_value!($iter, String).chars().collect::<Vec<char>>()
	};

	($iter:expr, usize1) => { // 0 -> 1
		read_value!($iter, usize) - 1
	};

	($iter:expr, $t:ty) => { // iter types t and next parsing
		$iter.next().unwrap().parse::<$t>().expect("Parse error")
	};
}

fn main () {
	input!{
		a : i32,
		b : i32,
		t : i32
	}
	println!("{}", t / a * b);
}

Measured memory_bytes: 4352
#include <iostream>

int main()
{
	int X = 0;
	std::cin >> X;

	int fiveHundred = X / 500;
	int five = (X - (fiveHundred * 500)) / 5;

	std::cout << fiveHundred * 1000 + five * 5 << "\n";

	return 0;
}

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

using namespace std;

template< class T >
struct BinaryIndexedTree
{
  vector< T > data;

  BinaryIndexedTree(int sz)
  {
    data.assign(++sz, 0);
  }

  T sum(int k)
  {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x)
  {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};

int main()
{
  string s;
  int k;

  cin >> s;
  cin >> k;

  int sz = (int) s.size();
  queue< int > que[26];
  BinaryIndexedTree< int > bit(sz);
  for(int i = 0; i < sz; i++) {
    que[s[i] - 'a'].push(i);
    bit.add(i, 1);
  }

  string t;
  for(int i = 0; i < sz; i++) {
    for(int j = 0; j < 26; j++) {
      if(que[j].empty()) continue;
      int idx = que[j].front();
      if(bit.sum(idx) - 1 <= k) {
        k -= bit.sum(idx) - 1;
        bit.add(idx, -1);
        que[j].pop();
        t += (char) (j + 'a');
        break;
      }
    }
  }

  cout << t << endl;
}

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

int main()
{
  int a, b;
  int x=1;
  int ret;

  ret=scanf("%d", &a);
  ret=scanf("%d", &b);
/*
  while (b-a>0){
    ++x;
    b=b-a+1;
  }
*/
  x=(b-1)/(a-1);
  if ((b-1)>(a-1)*x){
    ++x;
  }
  printf("%d\n", x);

  return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<long long>> VVLL;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) (a).begin(),(a).end()

const int MOD = 1000000007;

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

void debug(VI &arr){
	int n=arr.size();
	rep(i,n){
		cout<<arr.at(i)<<endl;
	}
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

void debug(VVLL &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout<<board.at(i).at(j)<<" ";
		}
		cout<<endl;
	}
}

void debug(VS &board){
	int h = board.size();
	rep(i,h){
		cout<<board.at(i)<<endl;
	}
	return;
}

LL gcd(LL a,LL b){
	return b==0?a:gcd(b,a%b);
}

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

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	int n,m;
	cin>>n>>m;
	int s=0;
	rep(i,m){
		int a;
		cin>>a;
		s+=a;
	}
	if(s<=n){
		cout<<n-s<<endl;
	}else{
		cout<<-1<<endl;
	}
	return 0;
}


Measured memory_bytes: 3644
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCorder1
{
	class Program
	{
		static void Main(string[] args)
		{
			Test(Console.ReadLine().ToList());
		}

		private static void Test(IEnumerable<char> s)
		{
			var ls = new List<int>();

			do
			{
				var r = s.TakeWhile(t => t == 'R').Count();
				var l = s.Skip(r).TakeWhile(t => t == 'L').Count();
				int h = (r + l) / 2;
				var e = (r + l) % 2 == 0;
				ls.AddRange(Enumerable.Repeat(0, r - 1)
					.Append(e ? h : h + (r % 2))
					.Append(e ? h : h + (l % 2))
					.Concat(Enumerable.Repeat(0, l - 1)));

				s = s.Skip(r + l);
			} while (s.Any());

			for (int i = 0; i < ls.Count() - 1; i++)
			{
				Console.WriteLine($"{ls[i]} ");
			}

			Console.WriteLine($"{ls[ls.Count() - 1]}");
		}
	}
}

Measured memory_bytes: 46684
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for(int i = 1; i < s.size(); i++){
    string x_pre,y_pre,x,y;
    x_pre = s.substr(0,i); y_pre = s.substr(i);
    
    //重複削除
    sort(x_pre.begin(),x_pre.end());
    unique_copy(x_pre.begin(),x_pre.end(),back_inserter(x));
   
    sort(y_pre.begin(),y_pre.end());
    unique_copy(y_pre.begin(),y_pre.end(),back_inserter(y));
    
    int count = 0;
    for(int j = 0; j < x.size();j++){
      bool check = false;
      for(int k = 0; k < y.size();k++){
        if(x[j] == y[k]) check = true;
      }
      if(check) count++;
    }
    ans = max(ans,count);
  }
  
  cout << ans;
  return 0;
}

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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

////////////////////////////////////////////////////////////////////

const int N = 1e5 + 5;

vector<int> G[N];
int C[N], M[3];

bool DFS(int v, int c = 1) {
	C[v] = c;
	M[c]++;
	bool f = true;
	for (int u : G[v]) {
		if (C[u] && C[u] != 3 - c) f = false;
		else if (C[u] == 0) f &= DFS(u, 3 - c);
	}
	return f;
}

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n, m; cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int v, u; cin >> v >> u;
		G[v].push_back(u);
		G[u].push_back(v);
	}
	bool f = DFS(1);
	if (!f) die(1LL * n * (n - 1) / 2 - m);
	cout << 1LL * M[1] * M[2] - m << endl;

	return 0;
}


Measured memory_bytes: 6912
#include <bits/stdc++.h> 
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  cout<<max(0,c-(a-b))<<endl;
}

Measured memory_bytes: 256
from sys import stdin


def dfs(g, seen, n):
    all_seen = True

    for si in seen:
        if si == False:
            all_seen = False

    if all_seen:
        return 1

    ans = 0

    for m in g[n]:
        if seen[m]:
            continue

        seen[m] = True
        ans += dfs(g, seen, m)
        seen[m] = False

    return ans


def main():
    n, m = map(int, stdin.readline().split())
    ab = [map(int, stdin.readline().split()) for _ in range(m)]
    g = [[] for _ in range(n)]
    for abi in ab:
        a, b = abi
        g[a - 1].append(b - 1)
        g[b - 1].append(a - 1)
    seen = [False for _ in range(n)]
    seen[0] = True

    ans = dfs(g, seen, 0)

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main()
{
        //input->compute->output//
        string A, B, C;
        cin >> A >> B >> C;

        char dif = 'A' - 'a';

        cout << char(A[0] + dif) << char(B[0] + dif) << char(C[0] + dif) << endl;

        return 0;
}


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

int main() {
  int n, m, k, a, b, i, j, max = 0;
  long AS[200001], BS[200001];

  cin >> n >> m >> k;

  AS[0] = BS[0] = 0;
  for(i=0; i<n; i++){
    cin >> a;
    AS[i+1] = AS[i] + a;
  }
  for(i=0; i<m; i++){
    cin >> b;
    BS[i+1] = BS[i] + b;
  }

  j = m;
  for(i=0; i<=n; i++){
    if(AS[i]>k) break;
    for(; AS[i]+BS[j] > k; j--);
    if (i + j > max)
      max = i+j;
  }
  cout << max << endl;
  return 0;
}


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

int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int num[3];
    rep(i,3) cin >> num[i];
    
    sort(num, num+3);
    
    int d = (num[2] - num[1]) + (num[2] - num[0]);
    
    if(d % 2 == 0){
        cout << d / 2 << endl;
    }
    else {
        cout << d / 2 + 2 << endl;
    }
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for (int i = n - 1; i >= 0; i--)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

#define INF bit(60)
#define pb push_back
#define mod 1000000007

using namespace std;
using uif = uint_fast64_t;
using ll = long long int;
using tTree = __gnu_pbds::tree<ll, __gnu_pbds::null_type, less<ll>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

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

#define FACSIZE 200002

ll invfac[FACSIZE];
ll fac[FACSIZE];

template <class T>
bool chmax(T &, const T &);
template <class T>
bool chmin(T &, const T &);
ll gcd(ll, ll);
ll powLL(ll x, ll y);

ll mod_pow(ll, ll);
ll mod_add(ll, ll);
ll mod_mul(ll, ll);
ll mod_div(ll, ll);
ll comb(ll, ll);
void make_fact(ll);
void make_invfact(ll);
void fact_init();

int main(void)
{
  ll n, m;
  cin >> n >> m;
  if (n == m)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}

ll mod_pow(ll x, ll r)
{
  if (r == 0)
    return 1;
  else if (r == 1)
    return x % mod;
  else if (r % 2 == 0)
  {
    ll t = mod_pow(x, r / 2) % mod;
    return mod_mul(t, t);
  }
  else
  {
    ll t = mod_pow(x, r / 2) % mod;
    ll k = mod_mul(t, t);
    return (k % mod) * (x % mod);
  }
}
ll mod_add(ll a, ll b)
{
  return ((a % mod) + (b % mod)) % mod;
}

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

ll mod_div(ll a, ll b)
{
  return mod_mul(a, mod_pow(b, mod - 2));
}

void fact_init()
{
  make_fact(FACSIZE - 1);
  make_invfact(FACSIZE);
}

void make_fact(ll n)
{
  fac[0] = 1;
  rep(i, n)
  {
    fac[i + 1] = mod_mul(fac[i], i + 1);
  }
}

void make_invfact(ll n)
{
  invfac[n] = mod_pow(fac[n], mod - 2);
  for (int i = n - 1; i >= 0; i--)
  {
    invfac[i] = mod_mul(invfac[i + 1], i + 1);
  }
}

ll comb(ll n, ll r)
{

  return mod_mul(mod_mul(fac[n], invfac[r]), invfac[n - r]);
}
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;
}

ll qp(ll a, ll b)
{
  ll ans = 1LL;
  do
  {
    if (b & 1LL)
      ans = 1LL * mod_mul(ans, a) % mod;
    a = 1LL * mod_mul(a, a) % mod;
  } while (b >>= 1LL);
  return ans;
}
ll qp(ll a, ll b, ll mo)
{
  ll ans = 1LL;
  do
  {
    if (b & 1LL)
      ans = 1LL * (ans % mo) * (a % mo);
    a = 1LL * (a % mo) * (a % mo);
  } while (b >>= 1LL);
  return ans;
}
ll gcd(ll a, ll b)
{
  return b ? gcd(b, a % b) : a;
}
ll powLL(ll x, ll y)
{
  ll ans = 1LL;
  for (ll i = 0LL; i < y; i++)
    ans *= x;
  return ans;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define INF 2 << 29
int MIN(int a,int b){return (a<b)?a:b;}
int main(){
    char s[32];
    int min=INF;
    int i;
    scanf("%s",s);
    for(i=2;s[i];i++){
        min=MIN(min,abs(((s[i]-'0')+(s[i-1]-'0')*10+(s[i-2]-'0')*100)-753));
    }
    printf("%d\n",min);
    return 0;
}

Measured memory_bytes: 128
import fractions

N = int(input())
nums = list(map(int, input().split()))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

num = nums[0]
for i in range(N - 1):
    num = lcm(num, nums[i + 1])
print(sum([num // i for i in nums]) % (10 ** 9 + 7))

Measured memory_bytes: 264672
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll n,k;
	cin>>n>>k;
	ll fac=0,fac1=0;
	for(ll i=1;i<=n;i++)
	{
		if((2*i)%k==0&&(i%k!=0))
			fac1++;
		if(i%k==0)
			fac++;
	}
	ll ans=0;
	if(k%2==0)
	{
		if(fac>=3)
			ans+=(fac*(fac-1)*(fac-2));
		if(fac>=2)
			ans+=3*(fac*(fac-1));
		ans+=fac;
		if(fac1>=3)
			ans+=(fac1*(fac1-1)*(fac1-2));
		if(fac1>=2)
			ans+=3*(fac1*(fac1-1));
		ans+=fac1;
	}
	else
	{
		if(fac>=3)
			ans+=(fac*(fac-1)*(fac-2));
		if(fac>=2)
			ans+=3*(fac*(fac-1));
		ans+=fac;
	}
	cout<<ans<<endl;
}

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

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

  bool flg=false;
  for(int i=1; i<=b; i++){
    if(a*i%b==c){
      flg=true;
      break;
    }
  }

  if(flg)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace __gnu_pbds;
using namespace std;
/*
int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};
*/
#define ull unsigned long long int
#define ll long long int
#define MAX 1000000007
//1e9+7
#define pll pair<ll,ll>
#define pii pair<int,int>
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FO ifstream fin("a.in");ofstream fout("a.out");
#define TEST int testcase;cin>>testcase;while(testcase--)
#define FTEST int testcase;fin>>testcase;while(testcase--)
#define all(x) (x).begin(),(x).end()
#define mset0(x) memset((x), 0, sizeof((x)));
#define mset1(x) memset((x), -1, sizeof((x)));
#define endl "\n"
#define plll pair<ll,pll>
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
FO
struct Data{
    int in;string str;int val;


};

bool cmp(Data d1,Data d2){
    if(d1.str==d2.str){
        return(d1.val>d2.val);
    }
    else return(d1.str<d2.str);

}
void solve(){
    int n;
    cin>>n;
    vector<Data> v;
    Data d;
    for(int i=0;i<n;i++){
        string s;
        int a;
        cin>>s>>a;
        d.in=i;
        d.str=s;
        d.val=a;
        v.push_back(d);
    }
    sort(v.begin(),v.end(),cmp);
    for(auto vv:v) cout<<vv.in+1<<endl;






    return;
}
int main(){
    IO
    //TEST
    solve();
    return(0);
}


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

int main() {
  int n,k;
  cin>>n>>k;
  int sum=1;
  for(int i=0;i<n;i++){
    if(sum<k){
      sum*=2;
    }
    else{
      sum+=k;
    }
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r);
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r);
template <class T1, class T2>
void vadd(vector<T1> &v, T2 x);

#define int long long int

void solve(long long K)
{
  set<int> y;
  rep(i, 9) y.insert(i + 1);
  vector<int> buf;
  rep(i, 10) buf.push_back(i + 1);
  for (int i = 0; i < buf.size() && i < 3 * K; i++)
  {
    lli s = buf[i];
    lli nxt = s * 10ll;
    buf.push_back(nxt + (s % 10));
    if (s % 10 > 0)
    {
      buf.push_back(nxt + (s % 10) - 1);
    }
    if (s % 10 < 9)
    {
      buf.push_back(nxt + (s % 10) + 1);
    }
  }
  sort(buf.begin(), buf.end());
  buf.erase(std::unique(buf.begin(), buf.end()), buf.end());
  cout << buf[K - 1] << endl;
}

signed main()
{
  long long K;
  scanf("%lld", &K);
  solve(K);
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2>
bool chmin(T1 &l, const T2 &r)
{
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2>
bool chmax(T1 &l, const T2 &r)
{
  return (l < r) ? (l = r, true) : false;
}

template <class T1, class T2>
void vadd(vector<T1> &v, T2 x)
{
  for (auto &s : v)
    s += T2(x);
}


Measured memory_bytes: 10092
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int X=sc.nextInt();
        int ansA=0;
        int ansB=0;
        Out:
        for(int A=0;A<300;A++){
            for(int B=-300;B<300;B++){
                if(A*A*A*A*A - B*B*B*B*B == X){
                    ansA=A;
                    ansB=B;
                    break Out;
                }
            }
        }
        System.out.println(ansA+" "+ansB);
    }
}

Measured memory_bytes: 38908