akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll A,B,C;
	while(cin>>A>>B>>C) {
		string ans = "No";
		if(A==B && A!=C || A==C && A!=B || C==B && A!=C) ans = "Yes";
		cout<<ans<<endl;
	}
	
	return 0;
}


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

using namespace std;

int main(int argc, char const *argv[]) {
    int n;
    std::string c;
    std::cin >> n >> c;
    std::vector<int> w(n), r(n);

    w[0] = (c[0] == 'W');
    for (int i = 1; i < n; i++)
        w[i] = w[i-1] + (c[i] == 'W');

    r[n-1] = (c[n-1] == 'R');
    for (int i = n-2; i >= 0; i--)
        r[i] = r[i+1] + (c[i] == 'R');

    int i = 0;
    for (; i < n; i++) {
        if (w[i] > r[i]) break;
    }
    std::cout << w[i-1] << '\n';
}






// int l = 0, r = n-1, cnt = 0;
// while (l < r) {
    //     while (c[l] != 'W') l++;
    //     while (c[r] != 'R') r--;
    //     cnt++;
    //     l++;
    //     r--;
    // }
    // std::cout << cnt << '\n';


Measured memory_bytes: 5236
/* 167a.c */
#include <stdio.h>

int main(void){
    char s[11];
    char t[12];
    int i=0;
    int count=0;
    scanf("%s %s",&s,&t);
    while(s[i]!='\0'){
        if(s[i]!=t[i]){
            count=1;
            break;
        }
        i++;
    }
    if(count==1){
        printf("No");
    }else{
        printf("Yes");
    }
    return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

void solve() {
    LL n,x;
    cin >> n >> x;
    VLL a(n);
    REP(i,0,n) cin >> a[i];
    LL ans = 0;
    REP(i,0,n) ans += a[i];

    VVLL dp(n,VLL(n));
    REP(i,0,n) {
        dp[i][0] = a[i];
        REP(j,1,n) {
            int t = (i - j + n) % n;
            dp[i][j] = min(dp[i][j-1], a[t]);
        }
    }
    REP(j,1,n) {
        LL sum = 0;
        REP(i,0,n) sum += dp[i][j];
        chmin(ans, sum + x * j);
        dump(sum);
    }

    cout << ans << endl;
}

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

Measured memory_bytes: 31616
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n;
string s;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);

    #ifdef Local
        freopen("../IO/int.txt","r",stdin);
        freopen("../IO/out.txt","w",stdout);
    #endif
    cin>>s;
    cin>>n;
    string ss2 = s + s;
    //cout<<ss2<<endl;
    ll ans1 = 0;
    for(ll i = 1; i < s.length(); i++){
        if(s[i] == s[i - 1]){
            ans1++;
            s[i] = '1';
        }
    }
    ll ans2 = 0;
    for(ll i = 1; i < ss2.length(); i++){
        if(ss2[i] == ss2[i - 1]){
            ans2++;
            ss2[i] = '1';
        }
    }

    if(ss2.back() != ss2[0]){
        ll ans = 0;
        ans += (n/2)*ans2;
        ans += (n % 2)*ans1;
        cout<<ans<<endl;
    }else{
        cout<<n*ans1 - (n - 1)*(2*ans1 - ans2)<<endl;
    }
    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
string t,ans;
char change(char k)
{
	if(k=='b') return 'd';
	if(k=='d') return 'b';
	if(k=='p') return 'q';
	if(k=='q') return 'p';
}
int main()
{
	cin>>t;
	int lent=t.length();
	ans=t;
	for(int i=0;i<lent;i++)
	{
		ans[i]=change(t[lent-i-1]);
	}
	if(t==ans) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}



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

mods = [0 for _ in range(M)]

x = X
f = False
res = 0
for i in range(N):
    if mods[x]:
        k = i
        l = i + 1 - mods[x]
        f = True
        break
    res += x
    mods[x] = i + 1
    x **= 2
    x %= M

if not f:
    res = 0
    for i in range(M):
        if mods[i]:
            res += i
    print(res)

else:
    x2 = x
    lsm = 0
    for i in range(k):
        if k - l <= i <= k - 1:
            lsm += x
        x **= 2
        x %= M
    loop, r = divmod(N - k, l)
    res += loop * lsm
    for i in range(r):
        res += x2
        x2 **= 2
        x2 %= M

    print(res)

Measured memory_bytes: 73780
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

class Dice
{
public:
    int label[6], tmp;

    void in()
    {
        rep(i, 6) scanf("%d", &label[i]);
    }

    void rollS()
    {
        tmp = label[0];
        label[0] = label[4];
        label[4] = label[5];
        label[5] = label[1];
        label[1] = tmp;
    }

    void rollN()
    {
        tmp = label[0];
        label[0] = label[1];
        label[1] = label[5];
        label[5] = label[4];
        label[4] = tmp;
    }

    void rollE()
    {
        tmp = label[0];
        label[0] = label[3];
        label[3] = label[5];
        label[5] = label[2];
        label[2] = tmp;
    }

    void rollW()
    {
        tmp = label[0];
        label[0] = label[2];
        label[2] = label[5];
        label[5] = label[3];
        label[3] = tmp;
    }

    void sideturn()
    {
        tmp = label[1];
        label[1] = label[2];
        label[2] = label[4];
        label[4] = label[3];
        label[3] = tmp;
    }
};

bool check2(Dice d1, Dice d2)
{
    bool c = true;
    FOR(i, 1, 5)
    {
        c = c && d1.label[i] == d2.label[i];
    }

    return c;
}

bool check1(Dice d1, Dice d2)
{
    bool b = false;

    if (d1.label[0] == d2.label[0] && d1.label[5] == d2.label[5])
    {
        rep(i, 4)
        {
            b = b || check2(d1, d2);
            d2.sideturn();
        }
    }
    return b;
}

bool isSame(Dice d1, Dice d2)
{
    bool a = false;

    a = a || check1(d1, d2);
    d2.rollN();
    a = a || check1(d1, d2);
    d2.rollE();
    a = a || check1(d1, d2);
    d2.rollE();
    a = a || check1(d1, d2);
    d2.rollE();
    a = a || check1(d1, d2);
    d2.rollN();
    a = a || check1(d1, d2);

    return a;
}

int main()
{
    int n;
    bool ans = false;
    scanf("%d", &n);
    Dice dice[n];
    rep(i, n) dice[i].in();

    rep(i, n)
    {
        FOR(j, i + 1, n)
        {
            ans = ans || isSame(dice[i], dice[j]);
        }
    }

    if (ans)
        printf("No\n");
    else
        printf("Yes\n");
}


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

vector<int> table(5);

for (int i = 0; i < 5; i++){
    cin >> table.at(i);
}

int ans = 0;

for (int i = 0; i < 5; i++){
    if(table.at(i) == 0){
        ans = i + 1;
    }
}

cout << ans << endl;

return 0;
}

Measured memory_bytes: 3620
const input = require("fs").readFileSync("/dev/stdin", "utf8")
;(input => {
    const rows = input.split('\n')
    var N = rows[0].split(' ').map(Number)[0]
    const M = rows[0].split(' ').map(Number)[1]
    const X = rows[1].split(' ').map(Number)

    X.sort((a, b) => a - b)

    const dp = []
    for (var i = 0; i < M - 1; i++) {
        dp[i] = X[i + 1] - X[i]
    }

    dp.sort((a, b) => a - b)
    N--
    while (N--) {
        dp.pop()
    }

    console.log(dp.length ? dp.reduce((a, b) => a + b) : 0)

})(input)


Measured memory_bytes: 28320
#include <cstdio>
#include <iostream>

using namespace std;

typedef unsigned long long ullong;

ullong power(ullong x, ullong n) {
	int num = 1000000007;
	if (n == 0)
		return 1;

	ullong res = power(x * x % num, n / 2);
	if (n % 2 == 0) {
		res = res % num;
	} else {
		res = res * x % num;
	}

	return res;
}

int main() {

	int m, n;
	scanf("%d %d", &m, &n);

	ullong result = power(m, n);
	cout << result << endl;

	return 0;
}

Measured memory_bytes: 3160
/*  AC祈願アンコウ
   　／￣＼
   ○    ／￣￣￣＼ヘ
    　 /・　 ・　 ＼>   
    ／￣￣￣＼　　  Ｖ| 
   ｜  ―――  ｜      ｜|
    ＼＿＿＿／　　  ∧|
    　　＼　　　　／
    　　　￣￣￣￣
*/

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

typedef int64_t ll;
//static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
#define ALL(x) (x).begin(),(x).end()
#define YESNO(x) puts((x)?"YES":"NO")
#define YesNo(x) puts((x)?"Yes":"No")

signed main(){
    vector<int> a;
    a.PB(0);
    int n;
    cin >> n;
    REP(i,n){
        int tmp;
        scanf("%d",&tmp);
        a.PB(tmp);
    }
    a.PB(0);
    int sum = 0,c = 0;
    REP1(i,SZ(a)-1){
        sum += abs(c-a[i]);
        c = a[i];
    }

    REP1(i,SZ(a)-2){
        int pre = a[i-1],cur = a[i],nxt = a[i+1];
        if(pre<=cur&&cur<=nxt||pre>=cur&&cur>=nxt) printf("%d\n",sum);
        else printf("%d\n",sum - 2 * min(abs(nxt-cur),abs(cur-pre))); 
    }

    return 0;
}


Measured memory_bytes: 1784
#include<bits/stdc++.h>
using namespace std;
int a[105];
int main()
{
	int n,i,ans=0;
	cin>>n;
	for(i=1;i<=n;i++)
	cin>>a[i];
	for(i=1;i<=n;i+=2)
	{
		if(a[i]%2==1)ans++;
	}
	cout<<ans;
} 

Measured memory_bytes: 3588
def main():
    import math

    K = int(input())

    total_ans = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            for k in range(1, K+1):
                total_ans += math.gcd(i, math.gcd(j, k))

    print(total_ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9184
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>

using namespace std;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,M;
	cin >> N >> M;
	int num = pow(2,M);
	int rslt = 1900 * num * M + 100 * (N-M) * num;
	cout << rslt << endl;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef long long ll;
typedef long long integer;
//////////////////////////////////////////////////
 /* AtCoder Beginner Contest 107 (๑•﹏•๑｀) */

int main(){
    int N,K;
    SCD2(N,K);
    vector<int> xleft;
    vector<int> xright;
    int zero = 0;

    REP(i,N){
        int x; SCD(x);
        if (x<0) xleft.PB(x);
        if (x>0) xright.PB(x);
        if (x==0) zero++;
    }

    sort(xleft.rbegin(),xleft.rend());

    int req = K;
    if (zero == 1) req--;

    int ans = 2000000000;
    FORq(i,0,req){ // i - left
        int nans = 0;
        if (i > xleft.size()) continue;
        if (req-i > xright.size()) continue;

        int nansa = 0;
        int nansb = 0;
        if (i != 0) nansa -= 2 * xleft[i-1];
        if (i != req) nansa += xright[req-i-1];

        if (i != 0) nansb -= xleft[i-1];
        if (i != req) nansb += 2 * xright[req-i-1];
        
        nans = min(nansa,nansb);
        ans = min(nans,ans);
    }

    PRINTD(ans);
}

Measured memory_bytes: 1020
N,L = map(int,input().split(' '))
lst = [i+L-1 for i in range(1,N+1)]
normal_ans = sum(lst)
count = 10000000
result = 0
for i in range(len(lst)):
    ans_lst =  lst.copy()
    del ans_lst[i]
    special_ans = sum(ans_lst)
    # print(special_ans,normal_ans-special_ans)
    if count >= abs(normal_ans-special_ans):
        count = abs(normal_ans-special_ans)
        result = special_ans
print(result)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	while(cin>>n,n){
		int cnt=0,a[25],all=32;
		for(int i=0;i<n;i++)cin>>a[i];
		bool turn=true;//true:?????????false:?¬????
		while(all>0){
			if(turn){
				all=all-(all-1)%5;
				if(all<0)all=0;
				cout<<all<<endl;
				turn=false;
			}else{
				all-=a[cnt];
				if(all<0)all=0;
				cout<<all<<endl;
				cnt++;
				if(cnt==n)cnt=0;
				turn=true;
			}
		}
	}
}

Measured memory_bytes: 1160
#include<iostream>
using namespace std;
int main(){
	int a,b,c,d,p;
	cin >> a >> b >> c >> d >> p;
	int cx =0;
	int cy =0;
	cx = a * p;
	if(p > c){
		cy = b + (p - c) * d;
	}
	else{
		cy = b;
	}
	if(cx < cy){cout << cx <<endl;}
	else{cout << cy <<endl;}
	return 0;
}


Measured memory_bytes: 3108
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	char ca[15];
	long long int a=0,b=0;
	bool s=false;
	cin>>ca;
	for(int i=0;i<strlen(ca);i++){
		a*=10;
		if(ca[i]=='/')continue;
		a+=(int)ca[i]-(int)'0';
	}
	b=(long long int)2019*1000*1000+4*1000+30;
	if(a<=b)cout<<"Heisei"<<endl;
	else cout<<"TBD"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

ll a[N];
int main()
{
	ll k, n;
	cin >> k >> n;
	for(int i = 1; i <= n; i ++)
	{
		cin >> a[i];
	}
	ll mn = 1e15;
	for(int i = 1; i <= n; i ++)
	{
		ll x = a[n] - a[i];
		if(i != 1)
		{
			x += k - a[n];
			x += a[i - 1];
		}
		umin(mn, x);
	}
	cout << mn;





	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)


void func(long long X){

    lli ans = 1;
    for(lli i=X;i>=2;i--){
        for(lli j=2;j<X;j++){
            lli now = j*j;
            while(now<i)now*=j;
            if(now == i){
                ans = max(ans,i);
            }
        }
    }
    cout<<ans<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long X;
    scanf("%lld",&X);
    func(X);
    return 0;
}


Measured memory_bytes: 256
// g++ -std=gnu++1y -O2 xxx.cpp

#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 N; cin>>N;
    vector<int> X(N);
    rep(i,N) cin>>X[i];

    int sum=accumulate(X.begin(),X.end(),0);
    int ave=round((double)sum/N);

    int ans=0;
    rep(i,N) ans+=pow(X[i]-ave,2);
    
    cout << ans << endl;

    return 0;
}

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

using namespace std;
int main(){
char tmp;
  map<char,int> mp;
  mp['N']=0;
  mp['S']=0;
  mp['E']=0;
  mp['W']=0;
  while(cin>>tmp){
  mp[tmp]++;
  }
  if((mp['N']&&mp['S']==0)
     ||(mp['S']&&mp['N']==0)
      ||(mp['W']&&mp['E']==0)
    ||(mp['E']&&mp['W']==0)){
     cout<<"No"<<endl;           
       }else{
    cout<<"Yes"<<endl;
    }



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mem(a, b) memset(a, b, sizeof(a))
#define INF 0X3f3f3f3f
const ll MAXN = 15000 + 7;
const ll MOD = 1e9 + 7;
//-------------------------------------------//
int a[MAXN];
int bol[10000];
int vis[10010];
set<int>s;
int main()
{
    int cnt=0;
    for(int i=2;i<=10000;i++)
    {
        int t=sqrt(i),flag=0;
        for(int j=2;j<=t;j++)
        {
            if(i%j==0)
            {
                flag=1;
                break;
            }
        }
        if(flag==0)
        bol[++cnt]=i;
    }
    int T,ex=0;
    scanf("%d",&T);
    for(int i=T;i>=0;i--)
    {
        scanf("%d",&a[i]);
        ex=__gcd(a[i],ex);
    }
    for(int i=1;i<=cnt;i++)
    {
        mem(vis,0);
        for(int j=T;j>=0;j--)
        {
            vis[j%(bol[i]-1)]+=a[j];
        }
        int flag=0;
        for(int j=0;j<=10000;j++)
        {
            if(vis[j]%bol[i]!=0)
            {
                flag=1;
                break;
            }
        }
        if(flag==0&&a[0]%bol[i]==0)
        {
            s.insert(bol[i]);
        }
    }
    ex=abs(ex);
    int t=sqrt(ex+1);
    for(int i=2;i<=t;i++)
    {
        if(ex%i==0)
        {
            s.insert(i);
            while(ex%i==0)
            ex/=i;
        }
    }
    if(ex!=1)
    s.insert(ex);
    for(auto i:s)
    {
        printf("%d\n",i);
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
#define PI acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define nl printf("\n")
#define sf scanf
#define pf printf
#define INF (ll)1e15
#define mod 1000000007

///#define isValid(n,m,nx,ny)nx>=0&&nx<n&&ny>=0&&ny<m
///int kx[]={1, 1, -1, -1, 2, 2, -2, -2}; //knight moves
///int ky[]={2,-2,  2, -2, 1,-1,  1, -1}; //knight moves
///int dx[]={1,-1,0,0,1,-1,1,-1};//eight direction
///int dy[]={0,0,1,-1,1,-1,-1,1};//eight direction
 
///using namespace __gnu_pbds;
using namespace std;
 
///inline double toRad(double deg){return deg*PI/180;}
///inline double toDeg(double rad){return rad*180/PI;}
///typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
 
const int S=3123;
bool sugar_can[S+5];
bool water_can[S+5];

bool Is_max(int sugar,int water_sugar,int s,int ws)
{
    if(sugar*ws<s*water_sugar)return true;
    return false;
}

int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    #endif
    int a,b,c,d,e,f;
    while(sf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)==6)
    {
        memset(sugar_can,false,sizeof sugar_can);
        memset(water_can,false,sizeof water_can);
        for(int i=0;i<=f;i++)
        {
            for(int j=0;j<=f;j++)
            {
                if(i*c+j*d<=f)sugar_can[i*c+j*d]=true;
                if(i*100*a+j*100*b<=f)water_can[i*100*a+j*100*b]=true;
            }
        }

        int water_sugar=100*a,sugar=0;
        for(int w=100*a;w<=f;w++)
        {
            for(int s=0;s<=f;s++)
            {
                if(water_can[w] && sugar_can[s] && (e*w)/100>=s && w+s<=f)
                {
                    if(Is_max(sugar,water_sugar,s,w+s))
                    {
                        water_sugar=w+s;
                        sugar=s;
                    }
                }
            }
        }
        pf("%d %d\n",water_sugar,sugar);
    }
    return 0;
}
 









 




























Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main(){
    map<tuple<int,int,int>,bool> mp;
    int n;cin >> n;
    int ans = 0;
    for(int a = 0;a < n;a++){
        int b;cin >> b;
        int c;cin >> c;
        int d;cin >> d;
        tuple<int,int,int> hoge = make_tuple(b,c,d);
        if(mp.find(hoge) != mp.end()){
            ans++;
            continue;
        }
        mp[make_tuple(b,c,d)]=true;
        mp[make_tuple(b,d,c)]=true;
        mp[make_tuple(c,b,d)]=true;
        mp[make_tuple(c,d,b)]=true;
        mp[make_tuple(d,c,b)]=true;
        mp[make_tuple(d,b,c)]=true;
    }
    cout<<ans<<endl;
}



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

using namespace std;

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

  vector<int> d(n);

  for(int i = 0; i < n; i++) cin >> d[i];

  sort(d.begin(), d.end());

  int maximum = d[0];
  int sum = 1;

  for(int i = 1; i < n; i++) {
    if(maximum < d[i]) {
      maximum = d[i];
      sum++;
    }
  }

  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main

{
	public static void main(String arg[])
	{
		Scanner sc = new Scanner(System.in);
		int a[]= new int [10];
		int b[]= new int [10];

		for(int i=0; i<10; i++)
			a[i]=sc.nextInt();
		for(int i=0; i<10; i++)
			b[i]=sc.nextInt();
		Arrays.sort(a);
		Arrays.sort(b);
		int suma = 0;
		int sumb = 0;
		for(int i=9;i>=7;i--)
		{
			suma+=a[i];
			sumb+=b[i];
		}
		System.out.println(suma+" "+sumb);
	}
}

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

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.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; 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(...) 0
#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

#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000000
#define ll long long
#define db double
#define str string
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Forrev(i,s,e) for (ll i=(s); i>=(e); i--)
#define all(v) v.begin(),v.end()

#define vll vector<ll>
#define vs vector<string>
#define mapll map<ll,ll>
#define pll pair<ll,ll>
#define initialise(a, x) memset(a, x, sizeof(a))
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll> ,greater<ll>>

#define ff first
#define ss second
#define endl "\n"
#define mp make_pair
const ll mod=1e9 + 7;

ll takemod(ll a) {
    return ((a%mod)+mod)%mod;
}

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

ll fast_exp(ll base, ll expo) {
    ll res=1;
    while(expo>0) {
        if(expo&1) res=(res*base)%mod;
        base=(base*base)%mod;
        expo>>=1;}
    return res;
}

ll modinv(ll a) {
    return takemod(fast_exp(takemod(a), mod-2));
}


signed main() 
{
    // fast_cin();
    // #ifndef ONLINE_JUDGE
    // freopen("C:/IO/in.txt", "r", stdin);
    // freopen("C:/IO/out.txt", "w", stdout);
    // #endif
    
    ll n;
    cin>>n;
    ll ans=n-1;
    For(i,1,sqrt(n)+1)
    {
        if(n%i==0)
        {
            ans=min(ans,i-1+(n/i)-1);
        }
    }
    cout<<ans<<endl;
    
    return 0;    
}

Measured memory_bytes: 256
package main

import(
	"bufio"
	"strconv"
	"fmt"
	"os"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readBigLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func checkBomb(h int, w int, arr [][]string) string {
	if arr[h][w] == "#" {
		return "#"
	}

	res := 0
	for i := h-1; i <= h+1; i++ {
		for j := w-1; j <= w+1; j++ {
			if arr[i][j] == "#" {
				res++
			}
		}
	}
	return strconv.Itoa(res)
}

func main() {
	sc.Split(bufio.ScanWords)

	h, w := nextInt(), nextInt()

	grid := make([][]string, h+2)
	grid[0] = make([]string, w+2)
	grid[h+1] = make([]string, w+2)

	for i := 0; i < h; i++ {
		row := strings.Split(nextLine(), "")
		tmp := make([]string, w+2)
		for j := 0; j < w; j++ {
			tmp[j+1] = row[j]
		}
		grid[i+1] = tmp
	}

	ans := ""
	for i := 1; i < h+1; i++ {
		tmp := ""
		for j := 1; j < w+1; j++ {
			tmp += checkBomb(i, j, grid)
		}
		ans += tmp + "\n"
	}
	fmt.Println(strings.TrimSuffix(ans, "\n"))
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define ll          long long
#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 hell        1000000007
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)
#define lb          lower_bound
#define ub          upper_bound

#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)
 
#define track(x)                 cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
 
#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))

#define MOD         1000000007
int mult(int a,int b, int p=MOD){return ((a%p)*(b%p))%p;}
int add(int a, int b, int p=MOD){return (a + b + p)%p;}
int fpow(int n, int k, int p = MOD) {int r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int b) {a = max(a, b); }
void self_min(int &a, int b) {a = min(a, b); }
void self_add(int &a, int b, int p = MOD) { a += b; if(a >= p) a -= p;}
void self_sub(int &a, int b, int p = MOD) { a -= b; if(a < 0) a += p;}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
const int INF = 1e9 + 5;
#define N	    	400001

ll type[N];
void solve(){
    ll n, k;
    cin>>n>>k;
    vector<pair<ll, ll>> v;
    ll sum, typeCnt = 0;
    sum = 0;
    rep(i, 0, n) {
        int t, val;
        cin>>t>>val;
        v.pb(mp(val, t));
    }
    sort(all(v)); reverse(all(v));
    rep(i, 0, k) {
        sum += v[i].x;
        if(!type[v[i].y]) {
            typeCnt++;
        }
        type[v[i].y]++;
    }
    ll ans = sum + typeCnt * typeCnt;
    vector<ll> rem;
    rev(i, k-1, 0) {
        if(type[v[i].y] != 1) {
            rem.pb(v[i].x);
            type[v[i].y]--;
        }
    }


    int ind = 0;
    rep(i, k, n) {
        if(!type[v[i].y] && ind < sz(rem)) {
            type[v[i].y]++;
            sum -= rem[ind++];
            sum += v[i].x;
            typeCnt++;
            ans = max(ans, sum + typeCnt * typeCnt);
        }
    }
    cout<<ans<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}


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

using namespace std;

const long long MOD = (long long)1e9 + 7;

long long kai[200001] = {0};

void kaijou_init(){
	kai[0] = 1;
	for(int i = 1; i <= 200001; i++){
		kai[i] = i * kai[i - 1] % MOD;
	}
}

long long kaijou(long long x){
	if(kai[0] == 0) kaijou_init();
	if(kai[x] > 0) return kai[x];
	return kai[x] = (x * kaijou(x - 1)) % MOD;
}

long long modpow(long long x, long long y){
	if(y == 0) return 1;
	if(y % 2 == 0){
		long long t = modpow(x, y / 2);
		return t * t % MOD;
	}else{
		long long t = modpow(x, (y - 1) / 2);
		return x * (t * t % MOD) % MOD;
	}
}

long long comb(long long x, long long y){
	long long resdiv = kaijou(y) * kaijou(x - y) % MOD;
	return kaijou(x) * modpow(resdiv, MOD - 2) % MOD;
}

int main(){
	long long n, m, ans = 1;
	cin >> n >> m;
	long long t = m;
	for(int i = 2; i <= t; i++){
		if(t % i == 0){
			long long cnt = 0;
			while(t % i == 0){
				t /= i;
				cnt++;
			}
			ans = (ans * comb(n + cnt - 1, cnt)) % MOD;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        mut n: [i32; 4],
    }

    n.sort();

    let ans = if n == [1, 4, 7, 9] { "YES" } else { "NO" };

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000002
long long ans = 0;
int get(vector<string> S){
	int H = S.size();
	int W = S[0].size();
	int ans = 0;
	for(int y0=0;y0<H;y0++){
		for(int x0=0;x0<W;x0++){
			for(int y1=0;y1<H;y1++){
				for(int x1=0;x1<W;x1++){
					for(int y2=0;y2<H;y2++){
						for(int x2=0;x2<W;x2++){
							if(x0==x1&&y0==y1)continue;
							if(abs(y0-y1)+abs(x0-x1)!=abs(y1-y2)+abs(x1-x2))continue;
							if(abs(y0-y1)+abs(x0-x1)!=abs(y0-y2)+abs(x0-x2))continue;
							if(S[y0][x0]!='#'||S[y1][x1]!='#'||S[y2][x2]!='#')continue;
							ans++;
							if(y0==4&&x0==23)cout<<x0<<','<<y0<<','<<x1<<','<<y1<<','<<x2<<','<<y2<<endl;
						}
					}
				}
			}
		}
	}
	return ans/6;
}

void calc(vector<string> S){
	int H = S.size();
	int W = S[0].size();
	
	vector<vector<int>> cnt(H,vector<int>(W,0));
	
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(S[i][j]=='#'){
				cnt[i][j]=1;
			}
			if(i!=0){
				if(j+1!=W)cnt[i][j]+=cnt[i-1][j+1];
			}
		}
	}
	
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			
			int y = i,x = j;
			while(true){
				y++,x++;

				if(y<0||y>=H||x<0||x>=W)break;
				if(S[i][x]=='#'&&S[y][j]=='#'){
					int d = abs(y-i);
					int a = i-1,b = j-d+1;
					if(b<0){
						a -= abs(b);
						b=0;
					}
					if(a>=0){
						ans += cnt[a][b];
						
					}
					
					a = i-d,b = j;
					if(a>=0){
						ans -= cnt[a][b];
					}

					
				}
			}
			
			
		}
	}
}

int main(){
	
	int H,W;
	cin>>H>>W;
	
	vector<string> S(H);
	for(int i=0;i<H;i++)cin>>S[i];
	

	
	//cout<<get(S)<<endl;
	
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			for(int t=i-1,b=i+1;t>=0&&b<H;t--,b++){
				if(S[t][j]=='#'&&S[b][j]=='#'){
					int k = b-i;
					if(j-k>=0)if(S[i][j-k]=='#')ans++;
					if(j+k<W)if(S[i][j+k]=='#')ans++;
				}
			}

			for(int l=j-1,r=j+1;l>=0&&r<W;l--,r++){
				if(S[i][l]=='#'&&S[i][r]=='#'){
					int k = r-j;
					if(i-k>=0)if(S[i-k][j]=='#')ans++;
					if(i+k<H)if(S[i+k][j]=='#')ans++;
				}
			}
			

			

		}
	}
	
	calc(S);
	reverse(S.begin(),S.end());
	calc(S);
	for(int i=0;i<H;i++)reverse(S[i].begin(),S[i].end());
	calc(S);
	reverse(S.begin(),S.end());
	calc(S);
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3972
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 200000000000
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 gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.second != b.second){
        return a.second < b.second;
        
    }else{
        return a.first < b.first;
    }
}
bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}

const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};
int main() {
    ll N;
    cin>>N;

    vector<ll> X(N);
    vector<ll> L(N);
    vector<Pi> XL(N);
    vector<Pi> SE(N);
    rep(i,N){
        cin>>X[i]>>L[i];

        SE[i] = mp(X[i]-L[i],X[i]+L[i]);
    }
 
    sort(all(SE),compare);
    ll now=-INF;
    ll ans=0;
    rep(i,N){
        if(SE[i].first >= now){
            ans++;
            now=SE[i].second;
        }
    }
 

    cout<<ans<<endl;

    return 0;
    

}

Measured memory_bytes: 7944
#include<iostream>
#include<cmath>

using namespace std;

int main(void){
  int a, b, bb;
  cin >> a >> b;
  bb = b;
  do a *= 10; while(bb /= 10);
  a += b;
  b = sqrt(a);
  cout << ((a == b * b) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    vector<int> l(3);
    cin >> l[0] >> l[1] >> l[2];
    sort(l.begin(), l.end(), greater<int>());
    int ab = l[0] - l[1], c = l[2] + ab;
    if(ab == 0 && c == l[0]){
        cout << 0 << endl;
    }else{
        int h = l[0] - c;
        if(h%2 == 1){
            cout  << ab + 2 + h/2 << endl;
        }else{
            cout << ab + h/2 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <map>
using namespace std;
map <int,int> ma;
int n,x,ans;
main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		if (!ma.count(x))
			ma[x]=1,ans++;
		else
		{
			if (ma[x]==1)
				ans--,ma[x]=0;
			else
			if (ma[x]==0)
				ans++,ma[x]=1;
		}
	}
	printf("%d\n",ans);
}

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

int w, h;
bool map[50][50];
int dx[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
int dy[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
int ans = 0;

void solve(int x, int y){
	map[x][y] = 0;

	for (int i = 0; i < 8; i++){
		int X = x + dx[i];
		int Y = y + dy[i];
		if (0 <= X&&X < w && 0 <= Y&&Y < h&&map[X][Y] != 0) solve(X, Y);
	}
}

int main(){
	while (cin >> w >> h, w + h != 0){
		ans = 0;
		for (int y = 0; y < h; y++){
			for (int x = 0; x < w; x++){
				cin >> map[x][y];
			}
		}

		for (int y = 0; y < h; y++){
			for (int x = 0; x < w; x++){
				if (map[x][y] == 1){
					solve(x, y);
					ans++;
				}
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1228
//
//  main.cpp
//  ProgrammingContestChallengeBook2
//
//  Created by Hisaki Kobayashi on 2020/04/04.
//  Copyright © 2020 Hisaki Kobayashi. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <string>
#include <bits/stdc++.h>
#include <stdlib.h>
//#include "mylibrary.hpp"

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

using namespace std;
int main(){
//    int N; cin >> N;
//
//    int hyaku=(N/100)%10,zyu=(N/10)%10,iti=N%10;
//
//    if(hyaku==7 || zyu == 7 || iti == 7)
//        cout << "Yes" << endl;
//    else{
//        cout << "No" << endl;
//    }
//
//
    
    
    long N; cin >> N;

    vector<int> A(7,0);

    int div=1;
    long sum=0;
    for(int i=1;i<=N;i++){
        if(i%3!=0 && i%5!=0){
            sum+=i;
        }
    }
    cout << sum << endl;

    
//    int a, b, c,K;
//      cin >> K;
//
//    a=100;
//    b=50;
//    c=7;
//
//     cout << "abcの最大公約数:" << gcd(gcd(a, b),c) << endl;
//
    
    
    return 0;
 
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define eps 1e-9
#define MOD 1000000007
#define INV_10 299473306
#define INF 1000000000
using namespace std;
int n, m, x;
int a[20][20];
int c[20];
vector<int>v;
bool found=false;
int mi=INF;
void solve(int step)
{
	if(step==n)
	{
		int cu[m];
		bool ok=true;
		for(int i = 0; i  <m; i++)
			cu[i]=0;
		int sum=0;
		for(int i = 0; i < v.size(); i++)
		{
			sum+=c[v[i]];
			for(int j = 0; j < m ; j++)
				cu[j]+=a[v[i]][j];
		}
		for(int i = 0; i < m && ok; i++)
		{
			if(cu[i] < x)
				ok=false;
		}
		if(ok)
		{
			found=true;
			mi=min(mi, sum);
		}
		return;
	}
	v.push_back(step);
	solve(step+1);
	v.pop_back();
	solve(step+1);
}
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> n >> m >> x;
	for(int i = 0; i  <n; i++)
	{
		cin >> c[i];
		for(int j = 0; j < m; j++)
			cin >> a[i][j];
	}
	solve(0);
	if(found)
		cout << mi << '\n';
	else
		cout << "-1\n";
}

Measured memory_bytes: 3660
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定 setprecision()
#include <list> //前後に数値を入れれる配列
#include <map> //map
#include <vector> //vecror

#define REP(i,m,n) for(ll i = (ll) (m);i < (ll) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = acos(-1); //円周率
ll mod = 1e9 + 7;


//提出コード↓

ll n,sum,r,g,b;
string s;




int main() {
	cin >> n >> s;
	rep(i, n) {
		if (s[i] == 'R') r++;
		else if (s[i] == 'G') g++;
		else b++;
	}
	sum = r * g * b;

	REP(i,1, n) {
		rep(j, n) {
			if (j + i * 2 < n) {
				if (s[j] != s[j + i] && s[j] != s[j + i * 2] && s[j + i] != s[j + i * 2]) {
					sum--;
				}
			}
		}
	}

	cout << sum << endl;

	return 0;
}



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

int main() {
 int a,b,k,cnt=0,ans;
 cin >> a >> b >> k;
  vector<int> num(101);
 for(int i=1;i<101;i++){
    if(a%i==0 && b%i==0){
      num[i]=i;
    }
 }

  for(int i=100;i>0;i--){
     if(num[i]!=0){
     cnt++;
        if(cnt==k){
         ans=num[i];
        }
     }
  }

  cout << ans << endl;
}

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

public class Solve
{
    static void Main(string[] args)
    {
        new ABC_E();
    }
}

public class ABC_E
{
    string[] s = new string[3];
    string[] abc = new string[3];
    int[] p = new int[] { 0, 1, 2 };

    const int MX = 2005;
    /// <summary>
    /// [1文字目index, 2文字目index, ずれ幅]
    /// </summary>
    bool[,,] d = new bool[3, 3, MX];

    int ans = MX * 3;

    public ABC_E()
    {
        In();

        do
        {
            s[0] = abc[p[0]];
            s[1] = abc[p[1]];
            s[2] = abc[p[2]];

            Slide(0, 1);
            Slide(1, 2);
            Slide(0, 2);

            for (int x = 0; x < MX; x++)
                for (int y = 0; y < MX; y++)
                {
                    if (!f(0, 1, x)) continue;
                    if (!f(1, 2, y)) continue;
                    if (!f(0, 2, x + y)) continue;
                    int now = 0;
                    now = Math.Max(now, s[0].Length);
                    now = Math.Max(now, x + s[1].Length);
                    now = Math.Max(now, x + y + s[2].Length);
                    ans = Math.Min(ans, now);
                }

        } while (NextPermutation(p));

        Console.WriteLine(ans);
    }

    bool f(int i, int j, int k)
    {
        if (k >= s[i].Length) return true;
        return d[i, j, k];
    }

    void Slide(int i, int j)
    {
        for (int k = 0; k < s[i].Length; k++)
        {
            d[i, j, k] = Check(i, j, k);
        }
    }

    /// <summary>
    /// 同じ位置に同じ文字があるか
    /// </summary>
    bool Check(int i, int j, int k)
    {
        for (int ni = k; ni < s[i].Length; ni++)
        {
            int nj = ni - k;
            if (nj >= s[j].Length) break;
            if (s[i][ni] == '?' || s[j][nj] == '?') continue;
            if (s[i][ni] != s[j][nj]) return false;
        }
        return true;
    }

    void In()
    {
        abc[0] = Console.ReadLine().Trim();
        abc[1] = Console.ReadLine().Trim();
        abc[2] = Console.ReadLine().Trim();
    }

    void swap(int[] nums, int i, int j)
    {
        var tmp = nums[i];
        nums[i] = nums[j];
        nums[j] = tmp;
    }

    void reverse(int[] nums, int start)
    {
        int i = start;
        int j = nums.Length - 1;
        while (i < j)
        {
            swap(nums, i, j);
            i++;
            j--;
        }
    }

    bool NextPermutation(int[] nums)
    {
        int i = nums.Length - 2;
        while (i >= 0 && nums[i + 1] < nums[i])
        {
            i--;
        }
        if (i >= 0)
        {
            int j = nums.Length - 1;
            while (j >= 0 && nums[j] <= nums[i])
            {
                j--;
            }
            swap(nums, i, j);
        }
        reverse(nums, i + 1);
        return (i >= 0);
    }
}

public class ABC_F
{
    public ABC_F()
    {

    }
}

Measured memory_bytes: 13240
#include <iostream>

using namespace std;

int main() {
	int k;
	cin >> k;
	int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	cout << a[k - 1] << endl;
	return 0;
}

Measured memory_bytes: 256