akhauriyash/Code-Regression huggingface dataset:
using namespace std;
#include <iostream>/*{{{*/
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

#include <bits/stdc++.h>

#define rep(i, x) for(int i = 0; i < (int)(x); i++)
#define reps(i,x) for(int i = 1; i <= (int)(x); i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define foreach(x,a) for(auto& (x) : (a) )
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
// dump macro{{{
// http://www.creativ.xyz/dump-cpp-652
#define DUMPOUT cerr // 変数ダンプ先。coutかcerr

#define DEBUG_ // 提出時はコメントアウト
#ifdef DEBUG_
#define DEB
#else
// DEB と打つとデバッグ時以外はコメントアウトになる
#define DEB /##/
#endif

// 変数ダンプ用マクロ。デバッグ時以外は消滅する
// 引数はいくつでもどんな型でも可（ストリーム出力演算子があればOK）
#define dump(...) DEB DUMPOUT<<"  "; \
DUMPOUT<<#__VA_ARGS__; \
DUMPOUT<<":=> "; \
dump_func(__VA_ARGS__); DUMPOUT<<"in ["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl;

// デバッグ用変数ダンプ関数
void dump_func() {
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail)
{
    DUMPOUT << head;
    if (sizeof...(Tail) == 0) {
        DUMPOUT << " ";
    }
    else {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i<vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}/*}}}*/
#define debug(x)                 cerr << __LINE__ << ": " << #x << " -> " << x << '\n'
#define debug2(x, y)             cerr << __LINE__ << #x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define debug3(x, y, z)          cerr << __LINE__ << #x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define debug4(a, b, c, d)       cerr << __LINE__ << #a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define debug5(a, b, c, d, e)    cerr << __LINE__ << #a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define debug6(a, b, c, d, e, f) cerr << __LINE__ << #a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define db_2d(d,n,m) rep(i,n){rep(j,m){ cerr << (d)[i][j] << (((j)==(m-1))?"\n":" "); }}
#define db_1d(d,n) rep(i,n){cout << d[i] << (((i)==(n-1))?"\n":" ") << __LINE__}
#define INF 999999999
#define MOD 1000000007
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<pii,vii,greater<pii> > spq;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};/*}}}*/

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

  if(b-a==c-b)cout << "YES" << endl;
  if(b-a!=c-b)cout << "NO" << endl;

  return 0;
}


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

const int MOD = 1e9 + 7;
vector<int> fact(1e7, 1);

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

int add(int a, int b) {
    return (a + b) % MOD;
}

int mul(int a, int b) {
    return (a * b) % MOD;
}

int div(int b) {
    return pw(b, MOD - 2) % MOD;
}

void solve() {
    for (int i = 2; i < 1e7; ++i) {
        fact[i] = fact[i - 1] * i % MOD;
    }
    int i, j;
    cin >> i >> j;
    int x = (2 * i - j) / 3, y = (2 * j - i) / 3;
    //cout << 2 * i - j << " " << 2 * j - j << "\n";
    if ((2 * i - j) % 3 != 0 || (2 * j - i) % 3 != 0 || x < 0 || y < 0) {
        cout << "0\n";
        return;
    }
    cout << mul(fact[x + y], mul(div(fact[x]), div(fact[y]))) % MOD << "\n";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}





Measured memory_bytes: 78336
n = int(input())
a = n % 10
list_hon = [2,4,5,7,9]
list_pon = [0,1,6,8]
list_bon = [3]
if a in list_hon:
  print("hon")
elif a in list_pon:
  print("pon")
else:
  print("bon")

Measured memory_bytes: 9184
N = int(input())
p = list(map(int, input().split()))
p_T = []
for i, v in enumerate(p, 1):
    if i == v:
        p_T.append(True)
    else:
        p_T.append(False)

cnt = 0
for i in range(N):
    if p_T[i]:
        if i == N - 1:
            cnt += 1
        else:
            cnt += 1
            p_T[i] = False
            p_T[i + 1] = False

print(cnt)

Measured memory_bytes: 14008
import itertools


N,M,R = map(int, input().split())
rs = list(map(int, input().split()))

INF = float("inf")
es = [[INF for _ in range(N)]  for _ in range(N)]
for i in range(N):
  es[i][i] = 0

for _ in range(M):
  a,b,c = map(int, input().split())
  es[a-1][b-1] = c
  es[b-1][a-1] = c



for k in range(N):
  for i in range(N):
    for j in range(N):
      es[i][j] = min(es[i][j], es[i][k] + es[k][j])

ans = INF
for route in itertools.permutations(rs):
  tmp = 0
  for a,b in zip(route, route[1:]):
    tmp += es[a-1][b-1]
  ans = min(ans, tmp)

print(ans)

Measured memory_bytes: 72536
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;
#pragma endregion

#pragma region const
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#pragma endregion

#pragma region util
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
#pragma endregion

#pragma region init
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

int main()
{
	i64 x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> x1 >> y1 >> x2 >> y2;

	x3 = x2 - (y2 - y1);
	y3 = y2 + (x2 - x1);
	x4 = x1 - (y2 - y1);
	y4 = y1 + (x2 - x1);

	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
	return 0;
}


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

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl

int main() {
  int A[5];
  FOR(i, 0, 5) cin >> A[i];

  int max_digit = 9;
  int max_index = 0;
  FOR(i, 0, 5) {
    if (A[i] % 10 != 0 && A[i] % 10 < max_digit) {
      max_digit = A[i] % 10;
      max_index = i;
    }
  }

  int rep = 0;

  FOR(i, 0, 5) {
    if (i == max_index)
      rep += A[i];
    else {
      rep += ((A[i] + 9) / 10) * 10;
    }
  }

  cout << rep << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
A = [x * 2 for x in A]

x = 0
for i in range(N):
    x = A[i] - x
x = x // 2

ans = []
for i in range(N):
    ans.append(x)
    x = A[i] - x

print(*ans)


Measured memory_bytes: 14028
N = int(input())
s = "357"
cnt = 0
for i in range(1,10):
    for j in range(3**i):
        n = j
        t = ""
        for k in range(i):
            t+=s[n%3]
            n//=3
        if len(set(t))!=3:continue
        if int(t)<=N:cnt+=1
print(cnt)

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

#define ALL(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0, __##i##_length = (n); i < __##i##_length; i++)
#define rep_reverse(i, n) for (ll i = (n)-1; 0 < i; i--)
#define FOR(i, from, to) for (ll i = (from), __##i##_end = (to); i < __##i##_end; i++)
#define FOR_REVERSE(i, from, to) for (ll i = (to)-1, __##i##_end = (from); __##i##_end <= i; i--)
#define foreach(e, v) for (const auto e : (v))
#define vfree(v) std::vector<int>().swap(v)
#define DEBUG(x) cout << #x << " = " << (x) << endl

using namespace std;
typedef int64_t ll;
typedef vector<ll> llv;
typedef vector<llv> llvv;

int main()
{
  ll N,Q;
	string s;
	cin >> N >> Q;
	cin >> s;
  llv sum(s.size()+1,0);
  bool prev_is_a = false;
  rep(i,s.size())
  {
    sum[i+1] = sum[i];
    if (s[i] == 'A')
    {
      prev_is_a = true;
      continue;
    }
    if (s[i] == 'C' && prev_is_a)
    {
      prev_is_a = false;
      sum[i+1] += 1;
      continue;
    }
    prev_is_a = false;
  }

  //foreach(x,sum)
	//  cout << x << " ";
	//cout << endl;
	
	rep(xxx,Q)
	{
	  ll L,R;
	  cin >> L >> R;
	  cout << sum[R] - sum[L] << endl;
	}
	

	return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
static const double EPS = 1e-8;
typedef long long ll;

int N, M, L, K[2000], S[100001];
const ll INF = 1000000000000000000LL;
ll sum[100001];
static ll dp[2000][2001];

int main()
{
	scanf("%d%d%d", &N, &M, &L);
	for (int i = 0; i < N; ++i)
		scanf("%d", K + i);
	for (int i = 0; i < M; ++i)
		scanf("%d", S + i);
	sort(K, K + N);

	sum[0] = 0;
	for (int i = 1; i <= M; ++i)
		sum[i] = sum[i-1] + S[i-1];

	for (int i = 0; i < 2000; ++i)
		for (int j = i; j < 2001; ++j)
			dp[i][j] = INF;

#define seg_sum(a, b) ((sum[b] - sum[a-1]) / L)
	dp[0][0] = 0;
	for (int i = 0; i < N-1; ++i)
	{
		for (int j = i + 1; j < N; ++j)
			dp[i][j] = min(dp[i][j], dp[i][j-1] + seg_sum(K[j-1], K[j]));
		for (int j = i + 1; j < N-1; ++j)
			dp[j][j+1] = min(dp[j][j+1], dp[i][j] + seg_sum(K[i], K[j+1]));
	}
	ll ans = INF;
	for (int i = 0; i < N-1; ++i)
		ans = min(ans, dp[i][N-1] + seg_sum(K[i], K[N-1]));
	cout << ans << endl;

	return 0;
}

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll N = (ll)5e5 + 2;
const ll MOD = (ll)1e9 + 7;
const ll MOD1 = (ll)998244353;
const ll inf = (ll)1e18 + 6;

template <class T>
bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template <class T>
bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

ll add(ll x, ll y)
{
    x += y;
    if (x >= MOD)
        return x - MOD;
    return x;
}

ll sub(ll x, ll y)
{
    x -= y;
    if (x < 0)
        return x + MOD;
    return x;
}

ll mult(ll x, ll y)
{
    return (x * y) % MOD;
}

ll bin_pow(ll x, ll p)
{
    if (p == 0)
        return 1;
    if (p & 1)
        return mult(x, bin_pow(x, p - 1));
    return bin_pow(mult(x, x), p / 2);
}

ll rev(ll x)
{
    return bin_pow(x, MOD - 2);
}

int main()
{

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(20);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif
    ll n;
    cin >> n;
    map<ll, ll> M;
    forn(i, n - 1)
    {
        ll x;
        cin >> x;
        M[x]++;
    }
    for1(i, n) cout << M[i] << "\n";
}


Measured memory_bytes: 16152
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='C')
		{
			for(int j=i+1;j<s.size();j++)
			{
				if(s[j]=='F')
				{
					cout<<"Yes"<<endl;
					return 0;
				}
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
 
  while(1) {
 
    int n;
    cin >> n;
    if(n == 0) break;
 
    int min = 1000000;
    int fee;
    for(int i=0;i<=n/200+1;i++) {
      for(int j=0;j<=n/300+1;j++) {
    for(int k=0;k<=n/500+1;k++) {
      if(i*200+j*300+k*500 == n) {
        fee = i*380 + j*550 + k*850;
        if(i>=5) fee += ((i/5)*5*380)*0.8 -(i/5*5*380);
        if(j >=4)fee += ((j/4)*4*550)*0.85 -(j/4*4 * 550);
        if(k>=3) fee += ((k/3)*3*850)*0.88 -(k/3*3 * 850);
        //cout <<i<<"*"<<j<<"*"<<k<<"="<< fee << endl;
        if(min > fee) min = fee;
      }
    }
      }
    }
 
    cout << min << endl;
  }
 
  return 0;
 
}


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

using namespace std;

#define pb(x) push_back(x)
#define ull unsigned long long int
#define ll long long int
#define m_p(x,y) make_pair(x,y)

void showVec(vector<ll> &v) {
    for(auto it:v) {
        cout << it << endl;
    }
}

void fastIO() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int main() {
    fastIO();
    int mod = 1e9 + 7;
    int n;
    cin >> n;
    vector<ll> v(n);
    vector<ll> pref(n);
    cin >> v[0];
    pref[0] = v[0];
    for(int i=1;i<n;i++) {
        cin >> v[i];
        pref[i] = v[i] + pref[i-1];
        pref[i] %= mod;
    }
    ll res = 0;
    for(int i=1;i<n;i++) {
        res += pref[i-1] * v[i];
        res %= mod;
    }
    cout << res << "\n";




    return 0;
}

Measured memory_bytes: 6376
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int N;
  cin >> N;
  int A[110];
  for(int i = 0; i < N; i++) cin >> A[i];
  
  //最大値と最小値の差を計算する．
  int mx = A[0];
  int mn = A[0];
  for(int i = 0; i < N; i++)
  {
    if(mn > A[i]) mn = A[i];
    if(mx < A[i]) mx = A[i];
  }
  cout << mx - mn << endl;
}

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

ll N;


int main(){

	cin >> N;

	ll max_div = 1;
	for (ll i=2; i*i<=N; i++) {
		if (N % i == 0) {
			max_div = i;
		}
	}

	ll ans = max_div + (N / max_div) - 2;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define hell 1000000007  
#define hell2 998244353 
#define pi 3.14159265358979323846

int spf[10000001];
void spfsieve(int n){
    spf[1]=1;
    rep(i,2,n){
        if(spf[i]==0){
            for(int j=i;j<=n;j+=i)
                if(spf[j]==0) spf[j]=i;
        }
    }
}

int solve(){   
    spfsieve(10000001);
    int n,ans=0;
    cin>>n;
    rep(i,1,n+1){
        int k=i,p,r=1;
        while(k>1){
            int t=0;
            p=spf[k];
            while(k%p==0) t++,k=k/p;
            r=r*(t+1);
        }
       // cout<<r<<" ";
        ans+=(r*i);
    }
    cout<<ans;
    return 0;   
}
 
signed main(){
    IOS;
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 81768
#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
using namespace std;

// _________コーディングはここから！！___________
template <typename T = long long, const int sz = 5 * 1000000> struct IO {
    char reader[sz], writer[sz];
    char *now, *now2 = writer;
    IO() {
        reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
        now = reader;
    }
    inline T read() {
        while(*now && *now <= 32) now++;
        if(*now == '-') {
            now++;
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return -res;
        } else {
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return res;
        }
    }
    inline string read_str() {
        string res;
        while(*now and *now != '\n' and *now != ' ') res += *now++;
        now++;
        return res;
    }
    inline void write(T x, char margin = ' ') {
        if(x == 0) {
            putchar('0');
            putchar(margin);
            return;
        }
        if(x < 0) {
            putchar('-');
            x = -x;
        }
        while(x) {
            *now2 = '0' + x % 10;
            now2++;
            x /= 10;
        }
        do {
            now2--;
            putchar(*now2);
        } while(now2 != writer);
        putchar(margin);
    }
    inline void write_str(string s, char margin = ' ') {
        for(auto c : s) putchar(c);
        putchar(margin);
    }
};
IO<int> io;
int n, m, k,i;
constexpr int MAX = 1e9 + 1;
constexpr int N = 200010;
int a[N], b[N];
int nn,now,ans;
main() {
    n = io.read(), m = io.read(), k = io.read();
    nn = n;
    rep(i, n) {
        a[i + 1] = io.read() + a[i];
        if(a[i + 1] > k) {
            nn = i;
            ++i;
            for(; i < n; ++i) {
                while(*io.now && *io.now <= 32) io.now++;
                while('0' <= *io.now and *io.now <= '9') io.now++;
            }
            break;
        }
    }
    rep(i, m) {
        b[i + 1] = io.read() + b[i];
        if(b[i + 1] > k) {
            m = i;
            break;
        }
    }
    now = nn;
    ans = now;
    for(i = 1; i <= m; i++) {
        while(b[i] + a[now] > k) now--;
        ans = max(ans, i + now);
    }
    io.write(ans);
}


Measured memory_bytes: 7956
x = raw_input().split()
a = x[0]
b = x[1]
c = x[2]

A = 0 

for i in range(int(a),int(b)+1):
	if int(c) % int(i) ==0:
		A += 1
	elif int(c) % int(i) != 0:
		A += 0
print A

Measured memory_bytes: 6548
// #define _GLIBCXX_DEBUG
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using pll = pair<ll, ll>; using vl = vector<ll>; using vvl = vector<vl>; using vb = vector<bool>; using vvb = vector<vb>;
#define rep0(TMS) for (int CNT = 0; CNT < (int)(TMS); CNT++)
#define rep(CNT, GOAL) for (int CNT = 0; CNT < (int)(GOAL); CNT++)
#define rep2(CNT, START, GOAL) for (int CNT = (int)(START); CNT < (int)(GOAL); CNT++)
#define rep3(CNT, START, GOAL) for (int CNT = (int)(START); CNT > (int)(GOAL); CNT--)
#define all(CONT) begin(CONT), end(CONT)
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
void prec(const int &DIG) { cout << fixed << setprecision(DIG); cerr << fixed << setprecision(DIG); }
template <typename T> void CERR(const T &ELEM) { cerr << ELEM; }
#define dbl(OBJ) cerr << #OBJ << ": "; CERR(OBJ); cerr << "\n"
template <typename T, typename ...Ts> void CERR(const T &FIRST, const Ts &...REST) { CERR(FIRST); cerr << ", "; CERR(REST...); }
#define dbs(...) cerr << "(" << #__VA_ARGS__ << "): ("; CERR(__VA_ARGS__); cerr << ")\n"
#define itrep(ITR, CONT) for (auto ITR = begin(CONT); ITR != end(CONT); ITR++)
template <typename T> void CERR(const vector<T> &VEC) { cerr << "{ "; itrep(ITR, VEC) { CERR(*ITR); cerr << ", "; } cerr << "}"; }
#define YN(FLG) cout << (FLG ? "YES" : "NO") << "\n"
#define Yn(FLG) cout << (FLG ? "Yes" : "No") << "\n"
#define yn(FLG) cout << (FLG ? "yes" : "no") << "\n"

// #include <atcoder/all>

// using namespace atcoder;

// const ll INF = LONG_LONG_MAX;
const int INF = INT_MAX;
// const ll MOD = 1000000007; // 998244353;

int main() {
	int N; cin >> N;
	int c = 0;
	rep0(N) {
		int a, b; cin >> a >> b;
		if (a == b) c++;
		else c = 0;
		if (c == 3) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 3648
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
typedef stack<ll> ST;
typedef queue<ll> QUE;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

struct edge{int to,num;};
int N; vector<vector<edge>> G;vector<P> pre; mat pass;
void DFS(int s,int p){
    each(t,G[s]){
        if(t.to==p) continue;
        pre[t.to]={s,t.num};
        DFS(t.to,s);
    }
}

int main(){
    cin>>N;
    G.resize(N+1);
    rep(i,N-1){
        int a,b; cin>>a>>b;
        G[a].pb({b,i});
        G[b].pb({a,i});
    }
    int M; cin>>M;
    vec u(M),v(M);
    pre.resize(N+1); pass.resize(M);
    rep(i,M){
        cin>>u[i]>>v[i];
        DFS(u[i],0);
        int t=v[i];
        while(t!=u[i]){
            pass[i].pb(pre[t].nd);
            t=pre[t].st;
        }
    }
    ll ans=0;
    vector<bool> b(N-1,false);
    rep(bit,1<<M){
        int count=0,n=0;
        rep(i,M){
            if(bit & (1<<i)){
                n++;
                int k=SZ(pass[i]);
                rep(j,k){
                    if(!b[pass[i][j]]){
                        count++;
                        b[pass[i][j]]=true;
                    }
                }
            }
        }
        if(n%2==0) ans+=pow(2,N-1-count);
        else       ans-=pow(2,N-1-count);
        fill(all(b),false);
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int D; cin >> D;
	vector<int> c(26, 0);
	rep (i, 26){
		cin >> c[i];
	} // end rep
	vector<vector<int>> s(D, vector<int>(26, 0));
	rep (i, D){
		rep (j, 26){
			cin >> s[i][j];
		} // end rep
	} // end rep

	vector<int> t(D+1, 0);
	rep (i, D){
		cin >> t[i+1];
		t[i+1]--;
	} // end rep

    vector<set<int>> st(26);
    rep (i, 26){
        st[i].insert(0);
        st[i].insert(D+1);
    } // end rep
    vector<int> sat(D+1, 0);
    vector<int> last(26, 0);

    for (int d = 1; d <= D; d++){
        st[t[d]].insert(d);
        sat[d] = sat[d-1] + s[d-1][t[d]];
        last[t[d]] = d;
        rep (j, 26){
            sat[d] -= (d - last[j]) * c[j];
        } // end rep
    } // end for

    int M; cin >> M;
    vector<int> ans(M+1, 0);
    ans[0] = sat[D];

    rep (i, M){
        int d, q; cin >> d >> q;
        q--;
        int p = t[d];
        st[p].erase(d);

        auto itrp = st[p].lower_bound(d), itrq = st[q].lower_bound(d);
        int rp = *itrp, rq = *itrq;
        itrp--; itrq--;
        int lp = *itrp, lq = *itrq;

        int diff = s[d-1][q] - s[d-1][p];
        diff -= (d - lp) * (rp - d) * c[p];
        diff += (d - lq) * (rq - d) * c[q];
        ans[i+1] = ans[i] + diff;

        t[d] = q;
        st[q].insert(d);
    } // end rep

    for (int i = 1; i <= M; i++){
        cout << ans[i] << endl;
    } // end for

	return 0;
}


Measured memory_bytes: 3664
N, M = map(int, input().split())
ps = [input().split() for i in range(M)]

ac = 0
wa = [0 for i in range(N)]
ansed = set()
for psn in ps:
    if psn[1] == 'AC':
        if psn[0] not in ansed:
            ac += 1
            ansed.add(psn[0])
    else:
        if psn[0] not in ansed:
            wa[int(psn[0])-1] += 1
for i in range(N):
    if str(i+1) not in ansed:
        wa[i] = 0

print(ac, sum(wa))

Measured memory_bytes: 39264
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int64_t i=0; i<(int64_t)(n); i++)
#define all(v) v.begin(), v.end()
int64_t power(int x, int n){
  int64_t x_mod[32]; x_mod[0] = x%998244353;
  rep(i, 31) x_mod[i+1] = (x_mod[i]*x_mod[i])%998244353;
  bitset<32> bit(n);
  int ans = 1;
  rep(i, 32) if(bit.test(i)) ans = (ans*x_mod[i])%998244353;
  return ans;
}

//e
int main(){
  
  int N, M, K; cin >> N >> M >> K;
  
  vector<int64_t> k(K+1), nCi(K+1);
  nCi[0] = 1;
  int64_t m=1, n=1;
  
  rep(i, K+1) {
    if(i!=0){
    int64_t n_ ;
    m *= N-i; m %= 998244353;
    n *= i; n %= 998244353;
    n_ = power(n, 998244351);
    nCi[i] = (m*n_) % 998244353;
    }
  }
    
  rep(i,K+1){
    k[i] = nCi[i] * M;
    k[i] %= 998244353;
    k[i] *= power(M-1, N-1-i);
    k[i] %= 998244353;
  }
  
  int64_t ans=0;
  rep(i, K+1){
    ans += k[i];
    ans %= 998244353;
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 6288
W, H, N = map(int, input().split(' '))

points = [tuple(map(int, input().split(' '))) for _ in range(N)]

bottom = 0
left = 0
top = H
right = W

D_LEFT = 1
D_RIGHT = 2
D_BOTTOM = 3
D_TOP = 4

for x, y, direction in points:
    if direction == D_RIGHT:
        right = min(right, x)
    elif direction == D_LEFT:
        left = max(left, x)
    elif direction == D_BOTTOM:
        bottom = max(bottom, y)
    elif direction == D_TOP:
        top = min(top, y)

print(max(0, (right - left)) * (max(0, (top - bottom))))


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
using namespace std;
#define endl "\n"
#define MOD 1000000007
#define pb push_back
#define fo(i,s,e) for(i=s;i<e;i++)
//               When something is important enough, you do it even if the odds are not in your favor.

int main(){   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    // code goes here
    double l;cin>>l;
    cout<<fixed<<setprecision(10)<<l*l*l/27;
    return 0;
}


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << ""; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

map<ll, ll> prime_factor(ll n) {
	map<ll, ll> res;
	for (int i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			++res[i];
			n = n / i;
		}
	}
	if (n != 1) {
		res[n] = 1;
	}
	return res;
}

signed main() {
	ll n;

	cin >> n;

	vector<ll> v(n + 1, 1);

	FOR(i, 1, n + 1) {
		for (auto p : prime_factor(i)) {
			v[p.first] += p.second;
		}
	}

	ll ans = 1;

	REP(i, n + 1) {
		ans *= v[i];
		ans %= MOD;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog oi.ender-zzm.pro
*/
#include <bits/stdc++.h>
using namespace std;

template<class T>
inline void read(T &a) {
    register T x = 0, flag = 1;
    register char ch;
    while (!isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), isdigit(ch = getchar()));
    a = x * flag;
}

template <class T>
inline void write(T x) {
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10); 
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define For(i, a, b) for (int i = (a); i <= (b); i++) 
#define Rep(i, a, b) for (int i = (a); i >= (b); i--) 
#define For_edge(x) for (int i = head[x]; i; i = net[i])
#define mem0(a) memset(a, 0, sizeof a)

#define int long long
int N;
int CNT(int cnt) {
	int ans = 0;
	while (cnt >= (ans + 1)) {
		ans ++;
		cnt -= ans;
	}
	return ans;
}
int ans;
signed main() {
	read(N);
	int res = N;
	for (int i = 2; i * i <= N; i++) {
		if (res % i == 0) {
			int cnt = 0;
			while(res % i == 0) {
				cnt ++;
				res /= i;
			}
			ans += CNT(cnt);
		}
	}
	if (res > 1) ans ++;
	cout << ans;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long LL;
const int maxn = 2e5 + 100;
LL Plus[maxn*4], Minus[maxn*4], tag[maxn*4];
inline LL abs(LL x) { return x < 0 ? -x : x; }
inline void Puttag(int o, LL v){
    Plus[o] += v;
    Minus[o] += v;
    tag[o] += v;
}
inline void Pushdown(int o){
    if(!tag[o]) return;
    Puttag(o*2, tag[o]);
    Puttag(o*2+1, tag[o]);
    tag[o] = 0;
}
inline void Maintain(int o){
    Plus[o] = min(Plus[o*2], Plus[o*2+1]);
    Minus[o] = min(Minus[o*2], Minus[o*2+1]);
}
inline bool Cut(int x) { return false; }
inline bool Check(int x) { return true; }
inline void Change(int o, int l, int r, int L, int R, LL v){
    if(L > r || R < l || Cut(o)) return;
    if(L <= l && r <= R && Check(o)){
        Puttag(o, v); return;
    }
    int mid = (l+r)/2; Pushdown(o);
    Change(o*2, l, mid, L, R, v);
    Change(o*2+1, mid+1, r, L, R, v);
    Maintain(o);
}
inline long long Query(int o, int l, int r, int L, int R, int ty){
    if(L > r || R < l || Cut(o)) return 1e18;
    if(L <= l && r <= R){
        return ty ? Plus[o] : Minus[o];
    }
    int mid = (l+r)/2; Pushdown(o);
    LL ans = 1e18;
    ans = min(Query(o*2+1, mid+1, r, L, R, ty), Query(o*2, l, mid, L, R, ty));
    Maintain(o);
    return ans;
}
inline void Insert(int o, int l, int r, int k, LL v, int ty){
    if(l == r) {
        if(ty) Plus[o] = v; else Minus[o] = v;
        return;
    }
    int mid = (l+r)/2; Pushdown(o);
    if(k <= mid) Insert(o*2, l, mid, k, v, ty);
    else Insert(o*2+1, mid+1, r, k, v, ty);
    Maintain(o);
}

int N, Q, A, B;
int x[maxn];
int main(){
    //freopen("a.txt", "r", stdin);
    scanf("%d %d %d %d", &N, &Q, &A, &B);
    for(int i = 1; i <= Q; i++) scanf("%d", &x[i]);
    x[0] = B;
    // dp[i][x] = dp[i-1][x] + ||
    // dp[i][x[i-1]] = all(dp[i-1][x]+|x-x[i]|)
    // x < x[i] -> dp[i-1][x] + x[i] - x
    // x > x[i] -> dp[i-1][x] + x - x[i]
    memset(Plus, 1, sizeof(Plus));
    memset(Minus, 1, sizeof(Minus));
    Insert(1, 1, N, A, A, 1);
    Insert(1, 1, N, A, -A, 0);
    for(int i = 1; i <= Q; i++){
        LL ans = 1e18;
        ans = min(ans, Query(1, 1, N, 1, x[i], 0) + x[i]);
        ans = min(ans, Query(1, 1, N, x[i]+1, N, 1) - x[i]);
        Change(1, 1, N, 1, x[i-1]-1, abs(x[i] - x[i-1]));
        Change(1, 1, N, x[i-1]+1, N, abs(x[i] - x[i-1]));

        Insert(1, 1, N, x[i-1], ans + x[i-1], 1);
        Insert(1, 1, N, x[i-1], ans - x[i-1], 0);
    }
    LL ans = 1e18;
    for(int i = 1; i <= N; i++){
        ans = min(ans, Query(1, 1, N, i, i, 0) + i);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 19840
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  unordered_map<string, int> mp;
  int n;
  cin >> n;
  rep(i, n) {
    string s;
    cin >> s;
    mp[s]++;
  }
  int m;
  cin >> m;
  rep(j, m) {
    string t;
    cin >> t;
    mp[t]--;
  }
  int ans = 0;
  for(auto x : mp) ans = max(x.second, ans);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
field = ["#"*(W+2)]
field += ["#"+input()+"#" for _ in range(H)]
field += ["#"*(W+2)]
dp = [[0]*(W+2) for _ in range(H+2)]
dp[1][1] = 1

#i,jへの最短経路の個数
for i in range(H+2):
  for j in range(W+2):
    if field[i][j] == ".":
      dp[i][j] = max(dp[i-1][j] + dp[i][j-1],dp[i][j])
    
print(dp[H][W]%1000000007)

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

int f(int x){
  int ans=0;
  for(int i=1; ;++i){
    ans += i;
    if(x == ans) return i;
    else if(x < ans) return i-1;
  }
}

int main(){
  ll n;
  cin >> n;
  if(n == 1){ cout << 0 << endl; return 0;}
  int ans = 0;
  int sn = sqrt(n);
  for(int i=2; i<sn; ++i){
    int cnt = 0;
    while(n%i == 0){
      ++cnt;
      n /= i;
    }
    ans += f(cnt);
    //cout << i << " " << cnt << endl;
  }
  if(n>1)cout << ans+1 << endl;
  else cout << ans << endl;
}

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

typedef long long int int64;

typedef struct sushi{
  int t,d;
} node;

int cmpSushi(const void *a,const void *b){
  return -(((node *)a)->d-((node *)b)->d);
}

void run(void){
  int n,k;
  scanf("%d%d",&n,&k);
  node *a=(node *)calloc(n,sizeof(node));
  int i;
  for(i=0;i<n;i++) scanf("%d%d",&a[i].t,&a[i].d);
  qsort(a,n,sizeof(node),cmpSushi);
  int *used=(int *)calloc(n+1,sizeof(int));
  int *stack=(int *)calloc(n,sizeof(int));
  int top=0;
  int cnt=0;
  int64 sum=0;
  for(i=0;i<k;i++){
    sum+=a[i].d;
    if(used[a[i].t]){
      stack[top++]=a[i].d;
    } else {
      used[a[i].t]=1;
      cnt++;
    }
  }
  int64 max=sum+(int64)cnt*cnt;
  for(i=k;i<n && top>0;i++){
    if(used[a[i].t]) continue;
    used[a[i].t]=1;
    sum+=a[i].d-stack[--top];
    cnt++;
    if(max<sum+(int64)cnt*cnt) max=sum+(int64)cnt*cnt;
  }
  printf("%lld\n",max);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define sz(x) (int)x.size()
#define int long long
typedef pair<int,int>pii;
const int mxN=1e4+10,mxA=1e6+10,M=1e9+7;
int mod(int a,int M){int ret=a%M;if(ret<0)ret+=M;return ret;}
int exp(int a,int b,int M){
    if(b==0LL)return 1LL;
    if(b==1LL)return mod(a,M);

    int t=exp(a,b/2,M);
    if(b&1)return mod(a*mod(t*t,M),M);
    return mod(t*t,M);
}

int n,x;
int v[mxN],p[mxA];
int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>v[i];
        x=v[i];
        for(int i=2;i*i<=x;i++){
            int cnt=0;
            if(x%i==0){
                while(x%i==0){
                    cnt++;
                    x/=i;
                }
                p[i]=max(p[i],cnt);
            }
        }
        if(x>1)p[x]=max(p[x],1LL);
    }
    int k=1LL;
    for(int i=2;i<=mxA;i++){
        while(p[i]--)k=mod(k*i,M);
    }
    int ans=0LL;
    for(int i=0;i<n;i++){
        ans=mod(ans+k*exp(v[i],M-2,M),M);
    }
    cout<<ans;

}

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

using namespace std;

#define ll long long

int main() {

	ios::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	int t = n % 10;
	if(t == 2 || t == 4 || t == 5 || t == 7 || t == 9) cout << "hon\n";
	else if(t == 3) cout << "bon\n";
	else cout << "pon\n";

	return 0;
}


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

int main()
{
int n;cin>>n;
double a[n];
for(int i=0;i<n;i++)
	cin>>a[i];
 double sum=0;
for(int i=0;i<n;i++)
	sum+=(1/a[i]);
printf("%.14f",1/sum);
return 0;
}


Measured memory_bytes: 256
import itertools
N, M = map(int, input().split())
edge = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = map(int, input().split())
    edge[a].append(b)
    edge[b].append(a)


def isOK(seq):
    s = 1
    for t in seq:
        if t in edge[s]:
            s = t
        else:
            return False
    return True


ans = 0
for seq in itertools.permutations(range(2, N + 1)):
    if isOK(seq):
        ans += 1

print(ans)


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

typedef long long lint;

int main(){
    string s;
    cin >> s;

    for(int i=0;i<s.size()-1;i++){
        if(s[i]==s[i+1]){
            cout << (i+1) << ' ' << (i+2) << endl;
            return 0;
        }
        if(i<s.size()-2 && s[i]==s[i+2]){
            cout << (i+1) << ' ' << (i+3) << endl;
            return 0;
        }
    }
    cout << "-1 -1" << endl;
    return 0;
}//

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int dp[4001][4001],d[4001][4001];
void A(int& x,int v){
 x+=v;
 if(x>=MOD)x-=MOD;
 if(x<0)x+=MOD;
}
int a[SIZE],b[SIZE];
int main(){
 DRI(n);
 REP(i,n){RII(a[i],b[i]);d[2000+a[i]][2000+b[i]]++;dp[2000-a[i]][2000-b[i]]++;}
 int an=0;
 REP(i,4001)REP(j,4001){
  if(i)A(dp[i][j],dp[i-1][j]);
  if(j)A(dp[i][j],dp[i][j-1]);
  an=(an+dp[i][j]*(LL)d[i][j])%MOD;
 }
 MS0(dp);
 dp[0][0]=1;
 REP(i,4001)REP(j,4001){
  if(i)A(dp[i][j],dp[i-1][j]);
  if(j)A(dp[i][j],dp[i][j-1]);
 }
 REP(i,n)A(an,-dp[a[i]*2][b[i]*2]);
 if(an&1)an=(an+MOD)/2;
 else an/=2;
 printf("%d\n",an);
 return 0;
}

Measured memory_bytes: 87680
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
vector<int> v[200005];
vector<int> vis(200005);
int cnt=0;

void dfs(int node)
{
    cnt++;
    vis[node]=1;
    for(auto it:v[node])
    {
        if(vis[it]==0)
        dfs(it);
    }
}

int main() {
	
	int n,m;
	cin>>n>>m;
	
	for(int i=0;i<m;i++)
	{
	    int x,y;
	    cin>>x>>y;
	    v[x].push_back(y);
	    v[y].push_back(x);
	}
	
	vector<int> grp;
	for(int i=1;i<=n;i++)
	{
	    if(vis[i]==0)
	    {
	        cnt=0;
	        dfs(i);
	        grp.push_back(cnt);
	    }
	}
	
	sort(grp.rbegin(),grp.rend());
	cout<<grp[0];
}


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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n, i##_len=(n); i>=0; i--)
#define FOR(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 

int main(){
    int N;
    cin >> N;
    vector<ll>A(N + 1);
    REP(i, N + 1) cin >> A.at(i);
    vector<ll>B(N);
    REP(i, N) cin >> B.at(i);

    ll sum = 0;
    REP(i, N){
        ll x = min(A.at(i), B.at(i));
        ll y = min(A.at(i + 1), max(B.at(i) - A.at(i), (ll)0));
        sum += x + y;
        A.at(i) -= x;
        A.at(i + 1) -= y;
    }

print(sum);
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

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

	int a, b, c;
	cin >> a >> b >> c;

	if (a <= c && c <= b) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
int main()
{
    long long int n,a,b;
    scanf("%lld%lld%lld",&n,&a,&b);
    if((a > b) || (n == 1 && a != b))
        printf("0");
    else printf("%lld",(n-1)*(b-a)+(a-b)+1);
    return 0;
}

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

#define what_is(x) cerr << #x << " is " << x << endl;

const ll LMAX = (1LL<<61);
const int IMAX = (1<<29);
const int BIG = 104206970;
const int PRIME = 104206969;

const int N = 52;
const ll MOD = 1e9+7;

bool mines[N][N];

int main () {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	// cout.precision(9); cout << fixed;
	int h, w; cin >> h >> w;
	for (int i = 1; i <= h; i++) {
		string s; cin >> s;
		for (int j = 1; j <= w; j++) {
			mines[i][j] = (s[j-1] == '#' ? 1 : 0);
		}
	}

	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (mines[i][j]) {
				cout << '#';
			} else {
				int count = 0;
				for (int ii = -1; ii <= 1; ii++)
					for (int jj = -1; jj <= 1; jj++)
						if (not (ii == 0 and jj == 0))
							count += mines[i+ii][j+jj];
				cout << count;
			}
		}
		cout << endl;
	}

	return 0;
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define fin(name) freopen(name, "r", stdin)
#define fout(name) freopen(name, "w", stdout)
#define I(x, a) for(auto x : a)
#define F(i, l, r) for(auto i = l; i < r; ++i)
#define E(i, l, r) for(auto i = l; i <= r; ++i)
#define DF(i, l, r) for(auto i = l; i >= r; --i)
#define clean(a) memset((a),0,sizeof (a))
#define sync ios_base::sync_with_stdio(0);cin.tie(0)
#define all(x) (x).begin(),(x).end()
#define ret return
#define cont continue
#define brk break
#define ins insert
#define sz(a) ((int)(a).size())

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

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)1e9 + 7;
const dbl eps = (dbl)1e-8;
const int maxn = (int)1e3 + 5;
const dbl pi = acos(-1);

ll suf[maxn];
ll a[maxn];
ll d[maxn][maxn];
vector <int> o;
int n;

void restore(int l, int r, int k) {
	if (l == r)
		return;
	suf[r] = d[r][r];
	suf[r - 1] = -linf;
	DF(i, r - 2, l)
		suf[i] = max(d[i][r], suf[i + 2]);

    E(i, l + 1, r - 1) {
    	if (d[l][r] == d[l][i - 1] + suf[i + 1]) {
    		for (int j = i; j < r; j += 2) {
    			if (d[l][r] == d[l][i - 1] + d[j + 1][r]) {
					restore(l, i - 1, k);
					E(q, 1, (j - i) / 2)
						o.pb(k + 3);
					restore(j + 1, r, k + 2);
					o.pb(k + 2);
					return;
    			}
    		}
    	}
    }
}

int main() {
//    fin("t.in");
    sync;
    cin >> n;
    E(i, 1, n) {
    	cin >> a[i];
    }
    E(i, 0, n)
    	E(j, 0, n)
    		d[i][j] = -linf;
    E(len, 1, n) {
    	if (len % 2 == 0)
    		cont;
    	E(l, 1, n - len + 1) {
    		int r = l + len - 1;
    		if (l == r) {
    			d[l][r] = a[l];
    			cont;
    		}
    		suf[r] = d[r][r];
    		suf[r - 1] = -linf;
    		DF(i, r - 2, l)
    			suf[i] = max(d[i][r], suf[i + 2]);
    		E(i, l + 1, r - 1)
    			d[l][r] = max(d[l][r], d[l][i - 1] + suf[i + 1]);
    	}
    }
    ll ans = -linf;
    int ansl = -1, ansr = -1;
    E(l, 1, n) {
    	E(r, l, n) {
    		if (d[l][r] > ans || (d[l][r] == ans && r - l < ansr - ansl)) {
    			ansl = l; ansr = r;
    			ans = d[l][r];
    		}
    	}
    }
    cout << ans << endl;
    DF(i, n, ansr + 1)
    	o.pb(i);
    E(i, 1, ansl - 1)
    	o.pb(1);
    restore(ansl, ansr, 0);
    cout << sz(o) << endl;
//    assert(sz(o) == )
    I(x, o)
    	cout << x << "\n";
    return 0;
}

Measured memory_bytes: 8192