akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, m, n) for(ll i = m; i > n; i--)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define lmax(x, y) max<ll>(x, y)
#define lmin(x, y) min<ll>(x, y)
#define tmax(x, y, z) lmax((x), lmax((y), (z)))
#define tmin(x, y, z) lmin((x), lmin((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; };
// struct edge{ ll to, cost; };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<edge>;  // 辺
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//cout << fixed << setprecision(10);
// priority_queue<ll, vector<ll>, greater<ll>> pq;


int main(){
    ll d, t, s; cin >> d >> t >> s;
    if(s*t >= d) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3628
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<vector>
using namespace std;
#define MAX_N 100001
#define INF 1000000000000000000#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<vector>
using namespace std;
#define MAX_N 100001
#define INF 1001001001001001001
#define REP(i,COUNT) for(int i=0;i<(int)(COUNT);i++)
typedef pair<int, int> P;
typedef long long int ll;
struct edge{
  ll to, cost;
};
typedef vector<vector<edge> > AdjList;
AdjList graph;
vector<ll> dist;
bool bellman_ford(int n,int s){
  dist = vector<ll>(n,INF);
  dist[s] = 0;
  REP(i,n)REP(v,n)REP(k,graph[v].size()){
    edge e = graph[v][k];
    if(dist[v] != INF && dist[e.to] > dist[v] + e.cost){
      dist[e.to] = dist[v] + e.cost;
      if(i == n - 1 && e.to == n - 1) return true;
    }
  }
  return false;
}

int main()
{
  ll N,M,a,b,c;
  cin >> N >> M;
  graph = vector<vector<edge> >(N,vector<edge>());
  REP(i,M){
    cin >> a >> b >> c;
    a--;b--;
    graph[a].push_back((edge){b,-c});
  }
  if(bellman_ford(N,0)){
    cout << "inf" << endl;
  }else{
    cout << -dist[N-1] << endl; 
  }
 
  return 0;
}


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

int main()
{
    int num=0, numa=0, numb=0, numc=0, numd=0;
    string str,stra, strb, strc;
    cin >> numa >> numb >> numc;
    int ans = min(numa+numb,numb+numc);
    ans = min(ans,numa+numc);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int dp[45];
 
main(){
  int i;
  dp[0] = dp[1] = 1;
  for(i=2;i<=44;i++) dp[i] = dp[i-1] + dp[i-2];
  scanf("%d", &i);
  printf("%d\n", dp[i]);
  return 0;
}


Measured memory_bytes: 2108
// abc138_a
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  int a;
  string s;
  cin >> a >> s;
  cout << ((a < 3200) ? "red" : s) << endl;
  return 0;
}


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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N, K;
    cin >> N >> K;
    vector<int> D(K);
    for (int i = 0; i < K; i++) {
        cin >> D[i];
    }

    for (int i = N; i < 1000000; i++) {
        string s = to_string(i);
        bool ok = true;
        for(int j = 0; j < s.size(); j++) {
            for (int k = 0; k < D.size(); k++) {
                if (s[j]- '0' == D[k]) {
                    ok = false;
                }
            }
        }
        if (ok) {
            cout << s << endl;
            return;
        }
    }
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e6+5;
string s;
ll dp[N][2],n;
ll solve(ll idx,ll carry){
    if(idx==n)return carry;
    ll &ans=dp[idx][carry];
    if(ans!=-1)return ans;
    ans = 1e15;
    ll val = s[idx]-'0'+carry;
    if(val<10)ans=min(ans,solve(idx+1,0)+val);
    ans=min(ans,solve(idx+1,1)+10-val);
    return ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>s;
    n=s.size();
    reverse(s.begin(),s.end());
    memset(dp,-1,sizeof(dp));
    cout<<solve(0,0);
}


Measured memory_bytes: 63900
import java.util.Arrays;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[3];
        for (int i = 0; i < 3; i++)
            a[i] = Integer.parseInt(sc.next());
        Arrays.sort(a);
    System.out.print(a[0] + " ");
    System.out.print(a[1] + " ");
    System.out.println(a[2]);
    }
}


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

signed main()
{
  int N;
  string s;
  int cnt[128] {};

  cin >> N >> s;
  for (char c : s) {
    cnt[c] += 1;
  }

  i64 ans = 1;
  rep(i, 'a', 'z'+1) {
    ans = ans * (cnt[i] + 1) % MOD;
  }
  cout << ans - 1 << endl;

  return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
int main() {
ll n,a,b;
cin >> n >> a >> b;
string s;
cin >> s;
ll domestic=0;
ll global=0;
ll qual_domestic=0;
ll qual_global=0;
for(ll i=0;i<n;i++){
    if(s[i]=='a'){
        domestic++;
        if(qual_domestic+qual_global<a+b){
            qual_domestic++;
            cout << "Yes" << endl;
        }
        else cout << "No" << endl;
    }
    else if(s[i]=='b'){
        global++;
        if(qual_domestic+qual_global<a+b && global<=b){
            qual_domestic++;
            cout << "Yes" << endl;
        }
        else cout << "No" << endl;
    }
    else cout << "No" << endl;
}
}



Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
ll BASE_NUM = 1000000007;

int main()
{
    // 整数の入力
    ll N,M;
    cin >> N >> M;
    vector<ll> WAs(N, 0), ACs(N, 0);
    for(int i = 0;i< M;i++){
        ll p;
        string s;
        cin >> p >> s;
        p--;
        if (s == "AC"){
            ACs[p]+= 1;
        }else{
            if (ACs[p] == 0){
                WAs[p] += 1;
            }
        }
    }

    ll wa,ac;
    ac = 0;
    wa = 0;
    for(int i = 0; i< N;i++){
        if(ACs[i] > 0){
            ac++;
            wa += WAs[i];
        }
    }
    cout << ac << " " << wa << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[214514],cnt[35];
ll ans[214514];
int main(){
	ll n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		for(int j=0;j<32;j++){
			ll x=(1ll<<j);
			if(x&a[i])cnt[j]++;
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<32;j++){
			ll x=(1ll<<j);
			if(cnt[j]%2){
				ans[i]+=(a[i]&x)^x;
			}
			else ans[i]+=(a[i]&x);
		}
		cout<<ans[i]<<' ';
	}
	return 0;
}


Measured memory_bytes: 6664
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    private static final PrintWriter sysout = new PrintWriter(System.out, false);

    private static StringTokenizer buffer;

    private static String readLine() {
        buffer = null;
        try {
            return br.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    private static String read() {
        if (buffer == null || !buffer.hasMoreTokens()) {
            buffer = new StringTokenizer(readLine());
        }
        return buffer.nextToken();
    }

    private static int readInt() {
        return Integer.parseInt(read());
    }

    private static int[] readIntArray(int loop) {
        int[] result = new int[loop];
        for (int i = 0; i < loop; i++) {
            result[i] = readInt();
        }
        return result;
    }

    private static int[] splitInt() {
        String[] tmp = read().split("");
        int[] result = new int[tmp.length];
        for (int i = 0, n = tmp.length; i < n; i++) {
            result[i] = Integer.parseInt(tmp[i]);
        }
        return result;
    }

    private static long readLong() {
        return Long.parseLong(read());
    }

    private static double readDouble() {
        return Double.parseDouble(read());
    }

    public static void main(String[] args){
        run();
    }

    private static void run() {
        String[] input = readLine().split("");
        int count = 0;
        if (input[0].equals("1")) count++;
        if (input[1].equals("1")) count++;
        if (input[2].equals("1")) count++;
        System.out.println(count);
    }
}


Measured memory_bytes: 21204
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  string S;
  int64_t K;
  cin >> S >> K;
  const int64_t N = static_cast<int64_t>(S.length());

  if (S == string(N, S[0])) {
    cout << N * K / 2 << endl;
    return 0;
  }

  int64_t count_1 = 0;
  int64_t renzoku = 1;
  for (int64_t i = 1; i < N; ++i) {
    if (S[i - 1] == S[i]) {
      ++renzoku;
    } else {
      count_1 += renzoku / 2;
      renzoku = 1;
    }
  }
  if (renzoku > 0) {
    count_1 += renzoku / 2;
    renzoku = 1;
  }

  int64_t count_2 = 0;
  string SS = S + S;
  for (int64_t i = 1; i < 2 * N; ++i) {
    if (SS[i - 1] == SS[i]) {
      ++renzoku;
    } else {
      count_2 += renzoku / 2;
      renzoku = 1;
    }
  }
  if (renzoku > 0) {
    count_2 += renzoku / 2;
    renzoku = 1;
  }

  int64_t result;
  result = count_1 + (count_2 - count_1) * (K - 1);

  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x, y, z) max((x), max((y), (z)))
#define tmin(x, y, z) min((x), min((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
using Graph = vector<vector<ll>>;
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//cout << fixed << setprecision(10);


int main(){
    string s;
    cin >> s;
    if(s.size() == 2) cout << s << endl;
    else{
        reverse(all(s));
        cout << s << endl;
    }
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 

vll dp(100100);

ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n,m;
  	ci(n>>m);
  priority_queue<ll> A;
  FOR(i,0,n){
    ll a;
    	ci(a);
    A.push(a);
  }
  
  FOR(i,0,m){
    ll a=A.top();
    A.pop();
    a/=2;
    A.push(a);
  }
  ll ans=0;
  FOR(i,0,n){
    ll a=A.top();
    A.pop();
    ans+=a;
  }
  co(ans)
}

Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int a,b,k=0;
  cin >> a >> b;
  bool flag = false;
  for(k=1;k<max(abs(a),abs(b));++k){
    if(abs(a-k)==abs(b-k)){
      flag = true;
      break;
    }
  }
  if(!flag){
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
  cout << k << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pi pair<int,int>
#define ll long long
#define rep(i,a,b) for(int i=int(a); i<=int(b);i++)
#define repv(vec,v) for(v=(vec).begin(); v!=(vec).end();v++)
#define sz(vec) (int)(vec).size()
#define PB push_back
#define F first()
#define S second()


int main(){
	string s;
	cin >> s;
	if(s[0] == s[1] && s[1] == s[2])
		cout << "No";
	else
		cout << "Yes";
	
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>

int spos, mpos;
char sentou[333333];
char matubi[333333];

int main(void) {
	int i, Q;
	int hanten = 0;
	if (scanf("%114513s", matubi) != 1) return 1;
	mpos = (int)strlen(matubi);
	if (scanf("%d", &Q) != 1) return 1;
	for (i = 0; i < Q; i++) {
		int T, F;
		char C[4];
		if (scanf("%d", &T) != 1) return 1;
		if (T == 1) {
			hanten = !hanten;
		} else if (T == 2) {
			if (scanf("%d%3s", &F, C) != 2) return 1;
			if (F == (hanten ? 2 : 1)) {
				sentou[spos++] = C[0];
			} else {
				matubi[mpos++] = C[0];
			}
		}
	}
	if (hanten) {
		for (i = mpos - 1; i >= 0; i--) {
			putchar((unsigned char)matubi[i]);
		}
		puts(sentou);
	} else {
		for (i = spos - 1; i >= 0; i--) {
			putchar((unsigned char)sentou[i]);
		}
		puts(matubi);
	}
	return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<random>
#include<map>
#include<queue>
using namespace std;


int main(){

  long long int n, a, b;
  cin >> n >> a >> b;
  vector<long long int> x(n, 0);
  for(int i=0; i<n; i++) cin >> x[i];

  long long int ans = 0;
  for(int i=1; i<n; i++){
    long long int tmp = a * ( x[i] - x[i-1] );
    ans += min( tmp, b );
  }
  cout << ans << endl;


  return 0;
}








// EOF


Measured memory_bytes: 1024
// BROWNIE TK

#include <bits/stdc++.h>

typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#define pb push_back
#define popb pop_back
#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en
#define le length()
#define mp make_pair
#define mt make_tuple
#define F first
#define S second

#define forz(i, n) for (int i = 0; i < n; i++)
#define bui(i, m, n) for (int i = m; i < n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)
#define mui(i, m, n) for (int i = n - 1; i >= m; i--)
#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

using namespace std;

/*STD fucntions*/
lli power(lli x,lli y,lli p)
{
	lli res=1;
	x=x%p;
	while(y>0)
	{
		if(y&1)
			res=(res*x)%p;
		//y must be even now
		y=y>>1; //y=y/2
		x=(x*x)%p;
	}
	return res;
}
lli gcd(lli a, lli b)
{
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
lli lcm(lli a, lli b)
{ return a * b / gcd(a, b); }
lli max(lli a, lli b) 
{
  if (a > b)
    return a;
  return b;
}
lli min(lli a, lli b) 
{
  if (a < b)
    return a;
  return b;
}
lli bins(lli arr[], lli l, lli r, lli x)
{
  if (r >= l) {
    lli mid = l + (r - l) / 2;
    if (arr[mid] == x)
      return mid;
    if (arr[mid] > x)
      return bins(arr, l, mid - 1, x);
    return bins(arr, mid + 1, r, x);
  }
  return -1;
}
lli modi(lli a,lli m)
{
// fermat little thm where m is prime
return power(a,m-2,m);
}
/*CODE BEGINS*/
const int INF=1e9+5;
int main()
{
 kira;
 lli n;
 cin>>n;
 vector<lli>dp(3);
 forz(i,n)
 {
   vector<lli>dp1(3,0);
   vector<lli>c(3,0);
   forz(j,3)
     cin>>c[j];
   forz(k,3)
    forz(j,3)
    {
      if(j!=k)
      dp1[j]=max(dp1[j],dp[k]+c[j]);
    }
  dp=dp1;
 }
 cout<<max({dp[0],dp[1],dp[2]});
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
using ll = long long;
using ld = long double;
const int MOD = 1e9+7;
const int N = 205, X = 1e5+10;

int n, x;
int s[N];
int dp[2][X]; // dp[i][j] = # of ways to end with j, last mod i

void add(int& a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> x;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  sort(s, s + n, greater<int>());
  dp[0][x] = 1;
  for (int i = 0; i < n; i++) {
    memset(dp[1], 0, sizeof dp[1]);
    // take self
    for (int j = 0; j <= x; j++) {
      add(dp[1][j%s[i]], dp[0][j]);
    }
    // don't take self
    for (int j = 0; j <= x; j++) {
      add(dp[1][j], (ll) dp[0][j] * (n - i - 1) % MOD);
    }
    swap(dp[0], dp[1]);
  }
  int ans = 0;
  for (int i = 0; i < s[n-1]; i++) {
    add(ans, (ll) i * dp[0][i] % MOD);
  }
  cout << ans << nl;
  return 0;
}


Measured memory_bytes: 1152
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>
#include<stack>
#include<iomanip>

using namespace std;

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPL(i,a,n) for(ll i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SRTVG(v) sort(v.begin(),v.end(),greater<>())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef pair<int,int> Pii;
typedef vector<int> Vi;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}




int atcoder(){
    ll k,a,b;
    cin>>k>>a>>b;
    if(b<=a+2 || k<a){cout<<k+1<<ENT;return 0;}

    ll ans=a;
    k -= (a-1);
    if(k%2==0) ans += (b-a)*(k/2);
    else ans += (b-a)*(k/2)+1;
    
    
    cout<<ans<<ENT;
    return 0;
}


signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    atcoder();
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main(){
ll N, Ans = 0, count = 0, M, m;cin >> N;
vector<ll> V(N);

rep(i, 0, N){

    cin >> V[i];

    if(V[i] < 0){count++;Ans -= V[i];}

    else Ans += V[i];

    if(abs(V[i]) < M){M = abs(V[i]);m = i;}

}

if(count%2 == 0)cout << Ans;

else{
    
    if(V[m] < 0)cout << Ans + 2*V[m];

    else cout << Ans - 2*V[m];

}

}

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

using namespace std;

int x, y;
map<pair<int, int>, int> dp;

int check(int a, int b){
    if(a==0 and b==0)
        return 1;

    if(dp.find(make_pair(a, b))!=dp.end())
        return dp[make_pair(a,b)];

    int ans = 0;

    if(a-1>=0 and b-2>=0)
        ans = max(ans, check(a-1, b-2));
    if(a-1>=0 and b-4>=0)
        ans = max(ans, check(a-1, b-4));

    return dp[make_pair(a,b)] = ans;
}

int main () {
    ios_base::sync_with_stdio(false);
    cin >> x >> y;


    cout << (check(x, y) ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 3700
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <map>
#include <functional>
#include <limits>
#include <set>
#include <stack>
#include <cctype>
#define rep(i,a,b) for((i)=a;i<(int)(b);i++)

#define AAA (1000000007) 


using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pairII;


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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll powD(ll a, ll b) {
	ll ans = 1;
	a %= AAA;
	for (int i = 0; i < b; i++)
	{
		ans *= a;
		ans %= AAA;
	}
	return ans;
}



int main() {
	int i, j, k;

	int N, M, K;
	int X, Y;
	cin >> X >> Y;
	rep(i, 0, X + 1) {
		rep(j, 0, X - i+1) {
			k = X - i - j;
			if (10000 * i + 5000 * j + 1000 * k == Y) {
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1\n";

	return 0;
}

Measured memory_bytes: 3520
#include<stdio.h>

int main()
{
    int n, a, b;
    scanf("%d %d %d", &n, &a, &b);

    if((b-a)%2 == 0){
        printf("Alice");
    }else{
        printf("Borys");
    }

    printf("\n");

    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <ctype.h>
 
int main(void) {
	char w[11], t[1001];
	int ans = 0;
	int i;
	
	scanf("%s", w);
	
	for (i = 0; w[i] != '\0'; i++) w[i] = tolower(w[i]);
	
	while (scanf("%s", t), strcmp(t, "END_OF_TEXT")){
		for (i = 0; t[i] != '\0'; i++) t[i] = tolower(t[i]);
		
		if (strcmp(t, w) == 0) ans++;
	}
	
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
long long a[200005], p[200005];
int main(){
    int n;
    long long sum=0;
    scanf("%d", &n);
    for(int i=0; i<n; ++i){
            scanf("%I64d", &a[i]);
            if(i) p[i]=p[i-1]+a[i];
            else p[i]=a[i];
    }
    long long sol=p[n-1];
    for(int i=0; i<n; ++i){
        long long t=p[n-1]-2*p[i];
        t= t>0 ? t: -t;
        if(t<sol) sol=t;
    }
    printf("%I64d", sol);
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    vector<int> A(N);
    rep(n,0,N) cin>>A.at(n);
    int Q; cin>>Q;
    vector<pair<int,int>> BC;
    rep(q,0,Q){
        int b,c; cin>>b>>c;
        BC.emplace_back(b,c);
    }

    vector<int> Cnt(100001,0);
    int64_t ans=0;
    for(auto a:A){
        Cnt.at(a)++;
        ans+=a;
    }

    rep(q,0,Q){
        int b,c; tie(b,c)=BC.at(q);
        ans+=(c-b)*Cnt.at(b);
        Cnt.at(c)+=Cnt.at(b);
        Cnt.at(b)=0;

        cout<<ans<<endl;
    }
}

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

using namespace std;

int main(void) {
  int N; cin >> N;
  int num[N+1], A[N];
  memset(num, 0, sizeof(num));

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

  long long Ttl = 0;
  for (int i = 0; i < N; i++) {
    if (num[i+1]) {
      Ttl += (num[i+1]-1LL) * num[i+1] / 2;
    }
  }

  for (int i = 0; i < N; i++) {
    cout << Ttl - num[A[i]] + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 4096
import math
from numba import jit
from numba import prange

K = int(input())


@jit(parallel=True)
def apt(N):
    cnt = 0
    for i in prange(1, K+1):
        for j in prange(1, K + 1):
            for k in prange(1, K + 1):
                cnt += math.gcd(k, math.gcd(i, j))
    return cnt


print(apt(K))


Measured memory_bytes: 113176
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< long long > vll;
typedef pair< int,int > ii;
typedef long long ll;
#define sz(a) int((a).size())
#define pb push_back
#define mp  make_pair
#define mod 1000000007
#define mod2 998244353
#define all(c) c.begin(),c.end()
#define tr(c,i) for(typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c,x) (c.find(x) != c.end())
#define cpresent(c,x) (find(all(c),x) != c.end())
#define rep(i, a, b) for (int i = (a); i <= int(b); i++)
#define fo(i,n) for(ll i=0;i<n;i++)
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
#define nl "\n"
vi g[100004];
void ipgraph(int n, int m);
void dfs(int u, int par);
ll gcd (ll a, ll b);
unsigned long long factorial[1000004]; 
//___________________________________________
 unsigned long long power(unsigned long long x,int y,int p)
{unsigned long long res=1;x=x%p;while(y>0){if(y&1)
res=(res*x)%p;y=y>>1;x=(x*x)%p;}
return res;}
//____________________________________________
unsigned long long modInverse(unsigned long long n,int p)
{return power(n,p-2,p);}
//_____________________________________________
unsigned long long nc(unsigned long long n,int r,int p)
{if(r==0)
return 1;return(factorial[n]*modInverse(factorial[r],p)%p*modInverse(factorial[n-r],p)%p)%p;}



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
    int t=1;
    //cin>>t;
    while(t--){
      string s;
      cin>>s;
      if(s[s.length()-1]=='s'){
          s+= "es";
      }
      else{
          s+= "s";
      }
      cout<<s<<nl;
    }

    


	return 0;
}


void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

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

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
    u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

    /*factorial[0] = 1; 
    for (int i = 1; i <= n; i++) {
        factorial[i] = (factorial[i - 1] * i) % mod; 
    }*/


Measured memory_bytes: 5988
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <math.h>
using namespace std;

int main()
{
	int a, b, t;
	cin >> a >> b >> t;
	int sum = (t + 0.5) / a;
	cout << sum * b << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include <set>
#include<iomanip>
#include<map>
#include<unordered_map>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

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


int main(void)
{

	int n;
	cin >> n;
	ll ans = 0;
	vector<int> a(n + 1);
	vector<int>b(n);

	rep(i, n + 1) cin >> a[i];
	rep(i, n) cin >> b[i];


	for (int i = 0; i < n; i++)
	{
		int mons = 0;
		mons= min(b[i], a[i]);
		b[i] -= mons;
		ans += mons;
		mons = 0;
		if (b[i] > 0)
		{
			mons = min(b[i], a[i + 1]);
			a[i + 1] -= mons;
			ans += mons;
			mons = 0;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 1024
use proconio::{fastout, input};

struct UnionFind {
    parent: Vec<usize>,
    rank: Vec<usize>,
}

impl UnionFind {
    fn new(n: usize) -> UnionFind {
        let mut parent = vec![];
        for x in 0..n {
            parent.push(x);
        }
        UnionFind {
            parent: parent,
            rank: vec![0; n],
        }
    }

    fn find(&mut self, x: usize) -> usize {
        if self.parent[x] == x {
            x
        } else {
            self.parent[x] = self.find(self.parent[x]);
            self.parent[x]
        }
    }

    fn unite(&mut self, x: usize, y: usize) {
        let x = self.find(x);
        let y = self.find(y);
        if x == y {
            return;
        }
        if self.rank[x] < self.rank[y] {
            self.parent[x] = y;
        } else {
            self.parent[y] = x;
            if self.rank[x] == self.rank[y] {
                self.rank[x] += 1;
            }
        }
    }

    fn same(&mut self, x: usize, y: usize) -> bool {
        self.find(x) == self.find(y)
    }
}

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        friends: [(usize, usize); m],
    }

    let mut uf = UnionFind::new(n);
    for (a, b) in friends {
        let a = a - 1;
        let b = b - 1;
        uf.unite(a, b);
    }

    let mut groups = vec![0u64; n];
    for x in 0..n {
        let p = uf.find(x);
        groups[p] += 1;
    }

    let ans = groups.iter().max().copied().unwrap();
    println!("{}", ans)
}


Measured memory_bytes: 10820
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  long long x,y;
  cin>>x>>y;
  if(x<=y){
  cout<<0<<endl;
  }
  else{
  vector<int>z(x);
  for(int i=0;i<x;i++){
  cin>>z.at(i);
  }
  sort(z.begin(),z.end());
  for(int j=0;j<y;j++){
  z.pop_back();
  }
  long long sum=0;
  for(int k=0;k<z.size();k++){
  sum+=z.at(k);
  }
  cout<<sum<<endl;
  }
}

Measured memory_bytes: 1024
n = input()
s = 0
while n > 0:
	n -= 1
	a = input()
	if a == 1:
		pass
	elif a == 2:
		s += 1
	elif (a%2 == 1):
		for i in xrange(3, (int(a**0.5)+1), 2):
			if a%i==0:
				break	
		else:
			s += 1		
print s

Measured memory_bytes: 4296
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int c=0;
  long long ans=0;
  string s;
  cin>>s;
  for(int i=0;i<s.length();i++)
  {
    if(s[i]=='A') c++;
    else if(s[i]=='B')
    {
      if(s[i+1]=='C')
      {
        ans+=c;
        i++;
      }
      else c=0;
    }
    else c=0;          
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 640
#include<cstdio>

int main(){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    for(int i = 1; i <= a; i++){
        for(int j = 1; j <= b; j++){
            int u = 0;
            if(j>c) u = !u;
            if(i>d) u = !u;
            printf("%d",u);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 1152
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
#define mod 1000000007
//#define mod 998244353
#define inf 1000000000
#define pr1(a) cout << a << endl
#define pr2(a,b)cout << a <<  " " <<b<< endl
#define pr3(a,b,c) cout << a <<" " << b << " " << c << endl

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

int gcd(int a, int b){
    if(b==0)return a;
    gcd(b,a%b);
}
const int maxn = 2*1e3 +10;

int a[maxn][maxn], ans[maxn];

void solve(){
    int n,x,y;
    cin >> n >> x >> y;

    for(int i = 1;i<=n;i++){
        for(int j = 1;j<=n;j++){
            a[i][j] = abs(i-j);
        }
    }

    a[x][y] = 1;
    a[y][x] = 1;

    for(int i =1;i<=n;i++){
        for(int j = 1;j<=n;j++){
            a[i][j] = min(a[i][j], a[i][x]+1+a[y][j]);
            a[i][j] = min(a[i][j], a[i][y]+1+a[x][j]);
        }
    }
    
    for(int i = 1;i<=n;i++){
        for(int j =1;j<=n;j++){
            ans[a[i][j]]++;
        }
      
    }

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

signed main() 
{   
    IOS;
    int t = 1;
    //cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 


Measured memory_bytes: 31744
/*input
10 7 3 4
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

ll inv(ll n){
	if(n==1) return 1;
	return (MOD-MOD/n)*inv(MOD%n)%MOD;
}

vector<ll> u,v;
int main()
{
	IOS;
	ll n,m,a,b;
	cin>>n>>m>>a>>b;

	{
		ll cur=1;
		REP(i,n-a){
			u.pb(cur);
			cur=cur*(b+i)%MOD*inv(i+1)%MOD;
		}
	}
	{
		ll cur=1;
		REP(i,a){
			cur=cur*(a+m-b-1-i)%MOD;
			cur=cur*inv(i+1)%MOD;
		}
		for(int i=a;i<n;i++){
			v.pb(cur);
			cur=cur*inv(i+1)%MOD;
			cur=cur*(i+m-b)%MOD;
		}
	}
	reverse(ALL(v));
	ll ans=0;
	REP(i,SZ(u)){
		ans+=v[i]*u[i]%MOD;
		if(ans>=MOD) ans-=MOD;
	}
	cout<<ans;

	return 0;
}


Measured memory_bytes: 2548
s = gets.chomp

r = s.split('dreameraser')
  .map { |e| e.split('dreamerase') }.flatten
  .map { |e| e.split('dreamer') }.flatten
  .map { |e| e.split('dream') }.flatten
  .map { |e| e.split('eraser') }.flatten
  .map { |e| e.split('erase') }.flatten

if r.empty?
  puts 'YES'
else
  puts 'NO'
end


Measured memory_bytes: 5372
/*input
1 100 2 10
*/
#include <bits/stdc++.h>

using namespace std;

int a,b,c,d;

int main(){
	cin >> a >> b >> c >> d;
	if(abs(c-a) <= d) cout << "Yes";
	else if(abs(a-b) <= d && abs(b-c) <= d) cout << "Yes";
	else cout << "No";
	cout << endl;
	return 0;
}

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

typedef long long ll;

#define        optimize           ios::sync_with_stdio(0); cin.tie(0);
#define PI    acos(-1.0)
#define pb push_back
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define RESET(a, b) memset(a, b, sizeof(a))
#define pii pair <int, int>
#define gcd(a, b) __gcd(a, b)
#define min3(a, b, c) min(c, min(a, b))
#define max3(a, b, c) max(c, max(a, b))

#define        MX        3005
#define        MOD       1000000007

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

int H, W;
bool visited[MX][MX];

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

ll dp[MX][MX];
string str[MX];

bool valid(int x, int y)
{
    return x < H && x >= 0 && y < W && y >= 0 && str[x][y] != '#';
}
int main()
{
    optimize
    cin>>H>>W;

    for(int i = 0; i < H; i++) cin>>str[i];

    dp[0][0] = 1;
    queue <pii> q;
    q.push({0, 0});

    while(!q.empty()){
        int x = q.front().first;
        int y = q.front().second;
        q.pop();
        visited[x][y] = 1;
        for(int i = 0; i < 2; i++){
            int X = x+dx[i], Y = y+dy[i];

            if(valid(X, Y)){
                dp[X][Y] = modAdd(dp[X][Y], dp[x][y]);
                if(!visited[X][Y]){
                    q.push({X, Y});
                    visited[X][Y] = 1;
                }
            }
        }
    }
    cout<<dp[H-1][W-1]<<endl;
}


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

int main(){
	int n, a;
	cin >> n >> a;
	if(n%500 <= a)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
//http://mujin-pc-2017.contest.atcoder.jp/tasks/mujin_pc_2017_a

#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int base = (int)1e9+7;

int n,ans=1;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
   // freopen("in.txt","r",stdin);
    cin>>n;
    for (int i=1;i<=n;i++) {
        int x;
        cin>>x;
        if (x<2*i-1) {
            ans = (1ll*ans*i)%base;
            i--;
            n--;
        }
    }
    for (int i=1;i<=n;i++) ans = (1ll*ans*i)%base;
    cout<<ans;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  long double t, x;
  cin >> t >> x;
  cout << fixed << setprecision(9) << t/x << endl;

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;


int main(void)
{
	int A, B; cin >> A >> B;

	rep(i, 1, 1300) {
		if ((int)(i*0.08) == A && (int)(i*0.1) == B) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0;i<n;i++)
using namespace std;
 
int main(){
    long long N,temp;
    vector<long long> A(100000*3,0);          //配列の宣言
 
    cin >> N;
 
    rep(i,N-1){
        cin >> temp;
        A[temp-1]++;
    }
 
    rep(i,N){
        cout << A[i] << " ";
    }
    
}

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

int main(){
  int N;
  cin >>N;
  int count=0;
  vector<int>p(N);

  for(int i=0;i<N;i++){
    cin>>p[i];
  }
  for(int i=0;i<N-1;i++){
    if(!(p[i]==i+1)){
      count++;
    }
  }
  if(count<=2){
    cout<<"YES"<<endl;
    return 0;
  }
  cout<<"NO"<<endl;
  return 0;

}

    

Measured memory_bytes: 256
#include <stdio.h>
  int d[50];

  int nach(int n){
  if(n==0||n==1)return d[n]=1;
  if(d[n]!=-1)return d[n];
  return d[n]=nach(n-1)+nach(n-2);
  }

  int main(){
  int n,i;
  for(i=0;i<50;i++)d[i]=-1;

  scanf("%d",&n);
  printf("%d\n",nach(n));

  return 0;
  }

Measured memory_bytes: 596
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=400+10;

int n,c[N][4]; ll h[N],v[4];
map<ll,int> M;

void add(ll s,int w) {
	for (int i=0;i<4;++i)
		M[s]+=w,s=(s>>10ll)|((s&1023ll)<<30ll);
}

ll Ui(int* a) {
	ll res=0;
	for (int i=0;i<4;++i) res|=1ll*a[i]<<(i*10ll);
	return res;
}

int main() {
	n=read();
	for (int i=1;i<=n;++i)
		for (int j=0;j<4;++j) c[i][j]=read();
	for (int i=1;i<=n;++i) h[i]=Ui(c[i]),add(h[i],1);
	ll ans=0;
	for (int i=1;i<=n-5;++i) {
		add(h[i],-1);
		for (int j=i+1;j<=n;++j) {
			add(h[j],-1);
			for (int p=0;p<4;++p) {
				int flag=1;
				for (int q=0;q<4;++q) {
					int tmp[]={c[i][q],c[j][(7+p-q)%4],c[j][(6+p-q)%4],c[i][(q+1)%4]};
					v[q]=Ui(tmp);
					if (!M.count(v[q])) { flag=0; break; }
				}
				if (!flag) continue;
				ll now=1; 
				for (int q=0;q<4;++q) now*=M[v[q]],add(v[q],-1);
				ans+=now;
				for (int q=0;q<4;++q) add(v[q],1);
			}
			add(h[j],1);
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
const int mod = 1000000007;
const int max_n = 200005;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    string s,t;cin>> s >>t;
    vvl dp(s.size()+1,vl(t.size()+1,inf));
    dp[0][0]=0;
    repl(i,-1,(ll)s.size()){
        repl(j,-1,(ll)t.size()){
            if(i==-1&&j==-1)continue;
            if(i>=0&&j>=0){
                if(s[i]==t[j])chmin(dp[i+1][j+1],dp[i][j]);
                else chmin(dp[i+1][j+1],dp[i][j]+1);
            }
            if(j>=0)chmin(dp[i+1][j+1],dp[i+1][j]+1);
            if(i>=0)chmin(dp[i+1][j+1],dp[i][j+1]+1);
        }
    }
    cout << dp[s.size()][t.size()] <<endl;
}


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

int main() {
  int w, a, b;
  cin >> w >> a >> b;
  
  if (w+a<b){
    cout << b-(w+a) << endl;
  }else if(b+w<a){
    cout << a-(w+b) << endl;
  }else{
    cout << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 256