akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ld long double
#define mp make_pair

void print(auto &a)
{
    for (auto s: a) cout<<s<<' ';
    cout<<endl;
}

void get(vector<auto> &a)
{
    for (int i = 0; i<a.size(); i++) cin>>a[i];
}

const int p =  1e9 + 7;


int mul(int a, int b) {
    return (1LL * a%p * b%p) % p;
}

int add(int a, int b) {
    ll s = (a+b);
    s = s%p;
    if (s<0) s+=p; 
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}



vector<int> Z(string s)
{
int n = s.length();
vector<int> z(n);
int L = 0, R = 0;
for (int i = 1; i < n; i++) {
  if (i > R) {
    L = R = i;
    while (R < n && s[R-L] == s[R]) R++;
    z[i] = R-L; R--;
  } else {
    int k = i-L;
    if (z[k] < R-i+1) z[i] = z[k];
    else {
      L = i;
      while (R < n && s[R-L] == s[R]) R++;
      z[i] = R-L; R--;
    }
  }
}
return z;
}


vector<ll> good;
vector<ll> busy;

vector<ll> changer(int n, int pos)
{
    if (n==1) return {0};
    vector<ll> temp = changer(n-1, 0);
    for (int i = 0; i<temp.size(); i++) if (temp[i]>=pos) temp[i]++;
    vector<ll> res;
    for (int i = 0; i<temp.size(); i++) res.push_back(temp[i]);
    res.push_back(pos);
    for (int i = int(temp.size())-1; i>=0; i--) res.push_back(temp[i]);
    return res;
}

vector<ll> changer1(int n)
{
    if (n==1) return {0};
    vector<ll> res;
    for (int i = n-1; i>0; i--)
    {
        vector<ll> temp = changer(i, i-1);
        for (int j = 0; j<temp.size(); j++) res.push_back(temp[j]+(n-i));
        res.push_back(n-i-1);
    }
    res.push_back(n-1);
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    int n, a, b;
    cin>>n>>a>>b;
    if (n==1)
    {
        if (a==b) {cout<<"NO"; return 0;}
        else {cout<<"YES"<<endl<<a<<' '<<b; return 0;}
    }
    bitset<20> A(a);
    bitset<20> B(b);
    B^=A;
    b^=a;
    if (B.count()%2==0) {cout<<"NO"; return 0;}
    cout<<"YES"<<endl;
    for (int i = 0; i<n; i++) if (B[i]==0) good.push_back(1LL<<i); else busy.push_back(1LL<<i);
    //cout<<good.size()<<' '<<busy.size()<<endl;
    vector<ll> zeros = changer(good.size(), 0);
    //print(zeros);
    vector<ll> ones = changer1(busy.size());
    //print(ones);
    vector<ll> doit;
    for (auto it: ones)
    {
        for (auto it1: zeros) doit.push_back(good[it1]);
        doit.push_back(busy[it]);
    }
    for (auto it1: zeros) doit.push_back(good[it1]);
    ll current = a;
    cout<<current<<' ';
    for (auto it: doit) {current^=it; cout<<current<<' ';}
    
    
}

Measured memory_bytes: 2424
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    int c=0,c1=0,c2=0,c3=0;
    while(t--)
    {
    string s;
    cin>>s;
    
    if(s=="AC")
        c++;
    else if(s=="TLE")
        c1++;
    else if(s=="WA")
        c2++;
    else
        c3++;


}
cout<<"AC"<<" "<<"x"<<" "<<c<<"\n";
cout<<"WA"<<" "<<"x"<<" "<<c2<<"\n";
cout<<"TLE"<<" "<<"x"<<" "<<c1<<"\n";
cout<<"RE"<<" "<<"x"<<" "<<c3<<"\n";
}


Measured memory_bytes: 3584
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n = int(input())
    k = int(input())
    X = list(map(int, input().split()))

    ans = 0
    for i in range(n):
        ans += min(X[i], abs(X[i]-k))
    print(ans*2)


if __name__ == '__main__':
    main()


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

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

const int INF = 10000000;

using namespace std;

int main(){
    int N,X,Y; cin >>N>> X >> Y;
    X--;Y--;
    
    vector<int> ans(N,0);
    queue<int> q;
    
    vector<vector<int>> distance(N,vector<int>(N) );
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            distance[i][j] = INF;
        }
    }
    
    for(int i=0;i<N;i++){//Start point
        bool start_flag = true;
        while(true){
            int j;
            if(start_flag){
                distance[i][i]=0;
                start_flag=false;
                q.push(i);
                continue;
            }
            
            j = q.front();
            q.pop();
            
            if(j-1>=0  && distance[i][j-1] == INF){distance[i][j-1]=1+distance[i][j]; q.push(j-1);}
            if(j+1<N && distance[i][j+1] == INF){distance[i][j+1]=1+distance[i][j]; q.push(j+1);}
            if(j==X   && distance[i][Y] == INF){distance[i][Y]=1+distance[i][j];   q.push(Y);}
            if(j==Y   && distance[i][X] == INF){distance[i][X]=1+distance[i][j]; q.push(X);}
            
            if(q.empty())
                break;
        }
    }
    
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            ans[distance[i][j]]++;
        }
    }
    for(int k=1;k<N;k++){
        cout << ans[k]/2 << endl;
    }
//
//    for(int i=0;i<N;i++){
//        cout << "始点 : " << i << endl;
//        for(int j=0;j<N;j++){
//            cout << "("<<i<<","<<j<<") = " <<distance[i][j] << endl;
//        }
//    }

    
    return 0;
 
}


Measured memory_bytes: 16000
/*input
9
1 1
2 1
3 1
4 1
5 1
1 2
1 3
1 4
1 5
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> 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 emplace_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())
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 ld PI=acos(-1);
const ld eps=1e-9;
//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;
}

int x[maxn],y[maxn];
vector<pair<pii,int>> A;
vector<pair<pii,int>> B;

int dsu[maxn];
int sz[maxn];
int find(int u){
	if(u==dsu[u]) return u;
	return dsu[u]=find(dsu[u]);
}
vector<int> vx[maxn],vy[maxn];

void mrg(int u,int v){
	u=find(u);
	v=find(v);
	if(u==v) return;

	if(sz[u]<sz[v]) swap(u,v);
	sz[u]+=sz[v];
	dsu[v]=u;
	for(int i:vx[v]){
		vx[u].pb(i);
	}
	for(int i:vy[v]){
		vy[u].pb(i);
	}
}


int main(){
	IOS;
	int n;
	cin>>n;
	REP(i,n){
		cin>>x[i]>>y[i];
	}
	REP(i,n) A.pb(MP(x[i],y[i]),i);
	REP(i,n) B.pb(MP(y[i],x[i]),i);

	REP(i,n) dsu[i]=i,sz[i]=1;
	REP(i,n) vx[i].pb(x[i]),vy[i].pb(y[i]);

	sort(ALL(A));
	sort(ALL(B));

	REP(i,n-1){
		if(A[i].F.F==A[i+1].F.F){
			mrg(A[i].S,A[i+1].S);
		}
	}
	REP(i,n-1){
		if(B[i].F.F==B[i+1].F.F){
			mrg(B[i].S,B[i+1].S);
		}
	}
	
	ll ans=0;

	REP(i,n) if(dsu[i]==i){
		SORT_UNIQUE(vx[i]);
		SORT_UNIQUE(vy[i]);
		ans+=(ll)SZ(vx[i])*SZ(vy[i]);
	}
	cout<<ans-n<<'\n';

	return 0;
}


Measured memory_bytes: 34164
const lines=readlines(open("/dev/fd/0"))
input()=shift!(lines)
int(s::String)=parse(Int32,s)
intSub(s::SubString{String})=parse(Int32,s)
intLine()=map(intSub,split(input()))
function main()
    n,k=intLine()
    s=input()
    print(s[1:k-1],lowercase(s[k]),s[k+1:n])
end
main()

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N;
    Scd(N);
    static char s[555555];
    Scs(s);

    vector<set<int>> als(256);
    Rep(i,N){
        als[s[i]].insert(i);
    }
    Repe(al,'z'+1,'a'){
        als[al].insert(-1);
        als[al].insert(N+3777);
    }
    int Q;
    int z;
    int i,c;
    char cc[2];
    int l,r;
    int lx,rx;
    int cnt = 0;
    Scd(Q);
    Rep(q,Q){
        Scd(z);
        if( z == 1 ){
            Scd(i); Scs(cc);
            c = cc[0];
            i--;
            als[s[i]].erase(i);
            als[c]   .insert(i);
            s[i] = c;
        }else if( z == 2 ){
            Scd2(l,r);
            l--,r--;
            cnt = 0;
            Repe(al,'z'+1,'a'){
                lx = *als[al].upper_bound(l-1);
                rx = *als[al].lower_bound(r);
                // printf ("%d %d\n", lx, rx );
                if( lx > r || rx < l ) cnt;
                else cnt++;
            }
            printf ("%d\n", cnt );
        }
    }

    return 0;
}



Measured memory_bytes: 24192
import math

n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

a = []
for i in range(n-1):
    for j in range(i, n):
        a.append(((xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2)**(1/2))
print(2*math.factorial(n-1)*sum(a)/math.factorial(n))

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))

typedef long long lint;
typedef pair<int, int> pii;

int S;
lint N[9];
lint MOD;

void solve() {
	lint ans = 0;
	for_(i,0,32) {
		lint sum = 0;
		for_(j,0,8) sum += N[j] ^ ans;
		if ((sum & (1ll << i)) != (N[8] & (1ll << i))) ans |= 1ll << i;
	}
	printf("%x\n", ans);
}

int main() {
	cin >> S;
	for_(i,0,S) {
		for_(j,0,9) scanf("%x", &N[j]);
		solve();
	}
	return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
int main() {
    int N, x;
    cin >> N >> x;
    vector<int> a(N);
    for (int& i : a) cin >> i;
    vector<int> b(a);
    for (int i = 0; i < N - 1; i++) {
        if (a[i] + a[i + 1] <= x) continue;
        if (a[i] > x) a[i] = x;
         a[i + 1] -= min(a[i + 1], a[i] + a[i + 1] - x);
    }
    long long ans = 0LL;
    for (int i = 0; i < N; i++) ans += b[i] - a[i];
    cout << ans << endl;
}

Measured memory_bytes: 1024
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

class Program
{
    public static long Read()
    {
        return long.Parse(Console.ReadLine());
    }

    public static long[] Reads()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);

        var s = Reads();
        var A = s[0];
        var B = s[1];
        var T = s[2];

            Console.WriteLine(T/A*B);
        Console.Out.Flush();
    }
}

Measured memory_bytes: 13396
const main = H => {
    const r = []
    var count = 0
    for(var i = 0;i<=H.length;i++) {
            if(H[i] >= H[i+1]) {
                count++
            }else{
                r.push(count)
                count = 0
            }
        }   
    return r
}

const input = require('fs').readFileSync('/dev/stdin','utf8').split('\n')
const H = input[1].split(" ").map( x => Number(x))
console.log(Math.max(...main(H)))

Measured memory_bytes: 28620
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define rep(i,a) for(int i = 0;i < (a); i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)
#define repd(i,a,b) for(int i = (a); i >= (b); i--)
#define repit(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)
#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())
#define pb push_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;

ll n, m;
vector<ll> p;

double solve()
{
    return p[0] > 1 ? n / 2.0 : 0.0;
}

int main()
{
    while (cin >> n >> m && n) {
        p.clear();
        p.resize(m);
        rep(i,m) {
            cin >> p[i];
            p[i] = abs(p[i]);
        }
        sort(all(p));

        printf("%.10f\n", solve());
    }

    return 0;
}

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


const int INF = 1 << 28;
int dr[4] = {0, 0, -1, 1};
int dc[4] = {-1, 1, 0, 0};
int H, W, start, M;
char B[21][21];
vector<int> dests;
int dist[401][401];
int mem[1 << 10][10];


int dp(int mask, int from) {
    if (mask == 0) return dist[start][dests[from]];
    if (mem[mask][from] >= 0) return mem[mask][from];

    int ret = INF;
    REP(i, M) {
        if (mask & (1 << i)) {
            int tmp = from < M ? dist[dests[from]][dests[i]] : 0;
            tmp += dp(mask - (1 << i), i);
            ret = min(ret, tmp);
        }
    }

    return mem[mask][from] = ret;
}


int main() {
    while (true) {
        cin >> W >> H;
        if (W == 0) break;
        REP(i, H) REP(j, W) cin >> B[i][j];

        dests.resize(0);
        REP(i, H*W) REP(j, H*W) dist[i][j] = i == j ? 0 : INF;

        REP(i, H) REP(j, W) {
            if (B[i][j] == 'o') start = i * W + j;
            else if (B[i][j] == '*') dests.push_back(i * W + j);
            else if (B[i][j] == 'x') continue;
            REP(k, 4) {
                int ni = i + dr[k];
                int nj = j + dc[k];
                if (ni < 0 || ni >= H || nj < 0 || nj >= W)
                    continue;
                if (B[ni][nj] == 'x')
                    continue;
                dist[i * W + j][ni * W + nj] = 1;
            }
        }

        REP(i, H*W) REP(j, H*W) REP(k, H*W)
            dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);

        M = dests.size();
        REP(i, 1 << M) REP(j, M+1) mem[i][j] = -1;

        int ans = dp((1 << M) - 1, M);
        if (ans == INF) cout << -1 << endl;
        else cout  << ans << endl;
    }
}

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

#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define fp(i,a,b) for(int i=a ; i<b ; i++)
#define fn(i,a,b) for(int i=a ; i>=b ; i--)
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define all(x) x.begin(),x.end()

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

const int M=1e5+5;
const int INF=1e9;
const int MOD=1e9+5;

int n;
int cost[M],h[M];

int dp(int x){
  if (x == 1) return 0;
  if (x < 1) return INF;
  if (cost[x] != -1) return cost[x];
  cost[x] = min(dp(x-1) + abs(h[x]-h[x-1]) , dp(x-2) + abs(h[x]-h[x-2]));
  return cost[x];
}

int main(){

	fastio;
  cin >> n;
  fp(i,1,n+1) cin >> h[i];
  fp(i,0,n+1) cost[i] = -1;
  dp(n);
  cout << cost[n] << "\n";

	return 0;
}


Measured memory_bytes: 7532
/* Author - thiolhub */

#include <bits/stdc++.h>

using namespace std;

#define ll              long long int
#define ld              long double
#define db              double
#define pi              3.1415926535897932384626
#define PI              acos(-1.0)
#define endl            "\n"
#define mod             1000000007
#define mk              make_pair
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            ll t; cin>>t; while(t--)
#define sc(a)	        scanf("%lld",&a);
#define pr(a)	        printf("%lld\n",a)
#define f(i,a,n)		for(ll i=a;i<n;i++)
#define m(a)		    memset(a,0,sizeof(a))
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)




int main(){ FastIO;

int d,n;cin>>d>>n;
int s=pow(100,d);
if(n==100) cout<<(n+1)*s;
else cout<<n*s;

return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  string S;
  cin >> S;

  if (S == "Sunny") {
    cout << "Cloudy" << endl;
  } else if (S == "Cloudy") {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()



int main () {
    ll a;
    string b;
    cin >> a >> b;
    ll c = (b[0]-'0')*100 + (b[2]-'0')*10 + b[3]-'0';
    ll ans = a*c;
    ans /= 100;
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main(){
  int a,b,c;
  int n,temp;
  scanf("%d%d%d", &a, &b, &c);
  if(a<b){
    temp=a;
    a=b;
    b=temp;
  }
  if(b<c){
    temp=b;
    b=c;
    c=temp;
  }
  if(a<b){
    temp=a;
    a=b;
    b=temp;
  }
  printf("%d\n",10*a+b+c);
  

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
using namespace std;

typedef pair<int, string> is;

int main() {
    int n;
    while (cin >> n, n) {
        cin.ignore();
        map<string, int> dic;
        for (int i = 0; i < n; i++) {
            string line;
            getline(cin, line);
            while (true) {
                size_t pos = line.find_first_of(' ');
                string w = line.substr(0, pos);
                dic[w]++;
                if (pos == line.npos) {
                    break;
                }
                line.erase(0, pos + 1);
            }
        }
        string k;
        cin >> k;
        set<is, less<is> > ans;
        for (map<string, int>::iterator it = dic.lower_bound(k); it != dic.end() && k[0] == it->first[0]; it++) {
            ans.insert(make_pair(- it->second, it->first));
        }
        if (ans.empty()) {
            cout << "NA" << endl;
            continue;
        }
        int i = 0;
        for (set<is, less<is> >::iterator it = ans.begin(); it != ans.end() && i < 5; it++, i++) {
            if (i > 0) {
                cout << " ";
            }
            cout << it->second;
        }
        cout << endl;
    }
}

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

using namespace std;

int main(){
	ios::sync_with_stdio(false);
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	int val = 0;
	for(int i=0; i<n; i++){
		if(s[i] == 'I')
			val++;
		else
			val--;
		ans = max(ans, val);
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define pb push_back
# define ll long long
# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define DEBUG

using namespace std;

const int N = 1e5 + 7;
const int mod = 1e9 + 7;

int n, a, cnt[N], ans = 1;

int main()
{
    speed;
    /// Author: Dilshod--Imomov
    #ifdef DEBUGf
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif // DEBUG
    cin >> n;
    for ( int i = 0; i < n; i++ ) {
        cin >> a;
        cnt[a]++;
    }
    if ( n % 2 ) {
        if ( cnt[0] != 1 ) {
            cout << 0;
            return 0;
        }
        for ( int i = 2; i < n; i += 2 ) {
            if ( cnt[i] != 2 ) {
                cout << 0;
                return 0;
            }
            ans = ans * 2 % mod;
        }
        cout << ans;
    }
    else {
        for ( int i = 1; i < n; i += 2 ) {
            if ( cnt[i] != 2 ) {
                cout << 0;
                return 0;
            }
            ans = ans * 2 % mod;
        }
        cout << ans;
    }
}



Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

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

        long X = sc.nextLong();

        System.out.println(solve(X));
    }

    private static int solve(long X) {
        long current = 100;
        int year = 0;

        while(true) {
            current *= 1.01;
            year++;
            if (current >= X) break;
        }

        return year;
    }
}

Measured memory_bytes: 35784
#include<bits/stdc++.h>
using namespace std;
int n,q;
int a[100010];
int main(){
	int temp1,temp2;
	long long sum=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&temp1);
		a[temp1]++;		
		sum+=temp1;
	}
	scanf("%d",&q);
	for(int i=1;i<=q;i++){
		scanf("%d %d",&temp1,&temp2);
		sum+=(a[temp1]*(temp2-temp1));
		a[temp2]+=a[temp1];
		a[temp1]=0;
		printf("%lld\n",sum);
	}
	return 0;
} 

Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
const double EPS=1E-8;
////////////////////////////////////////



int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    
    string s;cin>>s;
    bool a[4];memset(a,false,sizeof(a));
    string t="EWNS";
    rep(i,0,s.size()-1){
        rep(j,0,3){
            if(s[i]==t[j]){
                a[j]=true;
            }
        }
    }
    if((a[0]^a[1])||(a[2]^a[3]))cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REPR(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define FOR(i, x, n) for (int i = x; i < (int)(n); ++i)
#define ALL(n) begin(n), end(n)
#define ll long long
#define INF 1e9
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    int ans = 0;
    for (int i = 1; i <= n; i += 2) {
        if (a[i - 1] % 2 == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int a[100002];
map <int,int> m;

int main()
{   
    int cant,minim=0;
    cin>>cant;
    for(int i=0;i<cant;i++)
    {
        cin >> a[i];
        m[a[i]]=i;
    }
    sort(a,a+cant);
    for(int i=0;i<cant;i++)
    {
        if(abs(m[a[i]]-i)%2)
        minim++;
    }
    cout<< minim/2 <<endl;
	//system("pause");
	return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MOD 1000000007
#define pb push_back
#define mp make_pair

void solve()
{
	int n, num;
	cin >> n;
	int a[n][3];
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			cin >> a[i][j];
		}
	}
	int dp[n][3] = {0};
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			if (i == 0)
			{
				dp[i][j] = a[i][j];
			}
			else
			{
				for (int k = 0; k < 3; k++)
				{
					if (j == k) continue;
					dp[i][k] = max(dp[i][k], dp[i - 1][j] + a[i][k]);
				}
			}
		}

	}
	int ans = 0;
	for (int i = 0; i < 3; i++)
	{
		ans = max(ans, dp[n - 1][i]);
	}
	cout << ans << "\n";
	// for (int i = 0; i < n; i++)
	// {
	// 	for (int j = 0; j < 3; j++)
	// 	{
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }
}

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

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

const int N = (int) 1e5 + 5;

string a, b, c;

int main() {
	a = "Sunny";
	b = "Cloudy";
	c = "Rainy";
	string s;
	cin >> s;
	if (s == a) return cout << b, 0;
	if (s == b) return cout << c, 0;
	if (s == c) return cout << a, 0;
	return 0;
}

Measured memory_bytes: 256
// ~maqsat~

// #pragma GCC target ("avx2")
// #pragma GCC optimize ("Ofast")
// #pragma GCC optimize ("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define F first
#define S second
#define in insert
#define pb push_back
#define eb emplace_back
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define count1 __builtin_popcountl
#define debug(x) cerr << (#x) << " = " << (x) << "\n"
#define ACCELERATE ios_base::sync_with_stdio(false),cin.tie(nullptr)
#define fre(f) if(fopen(f".in", "r")) freopen(f".in", "r", stdin),freopen(f".out", "w", stdout)
#define ever ;;

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
using db = double;
using ld = long double;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> inline void cmin(T &a, T b) { a = min(a, b); }
template <class T> inline void cmax(T &a, T b) { a = max(a, b); }

const int oo = 0x3f3f3f3f;
const ll N = 1e6 + 345;
const ll MOD = 998244353;
const ll INF = 1e15 + 9;
const db EPS = 1e-9;
const db PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

main() {
	fre("");
	ACCELERATE;

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

	int s = 1;
	int ans = 0;
	while (s < b) {
		s--;
		s += a;
		ans++;
	}

	cout << ans;
	return 0;
}
/*
 
*/


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>

bool prime[1000000];

int main()
{
	int a, d, n;

	for (int i = 0; i < 1000000; i++){
		prime[i] = true;
	}
	prime[0] = prime[1] = false;

	for (int i = 2; i * i < 1000000; i++){
		for (int j = i * i; j < 1000000; j += i){
			prime[j] = false;
		}
	}

	while (true){
		scanf("%d %d %d", &a, &d, &n);
		if (a == 0){
			break;
		}

		int cnt = 0;
		while (cnt != n){
			if (prime[a]){
				cnt++;
			}
			a += d;
		}

		printf("%d\n", a - d);
	}
	
	return (0);
}

Measured memory_bytes: 2160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

// 素因数分解
/*
 * [2]-> 5, [3] -> 5のとき N = 2^5 * 3^5
 */
template<typename T>
map<T, long long> factorize(T x) {
  map<T, long long> res;
  for (long long i = 2; i * i <= x; ++i) {
    while (x % i == 0) {
      x /= i;
      res[i] += 1;
    }
  }
  if (x != 1) res[x]++;
  return res;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  map<ll, ll> mp;
  rep(i, n) {
    cin >> a[i];
    for (auto it : factorize(a[i])) {
      mp[it.first] = max(it.second, mp[it.first]);
    }
  }

  ll L = 1;
  for (auto it : mp) {
    rep(i, it.second) {
      L *= it.first;
      L %= mod;
    }
  }

  ll ans = 0;
  for (auto&& it : a) {
    auto p = modinv(it, mod);
    ans += (L * p) % mod;
    ans %= mod;
  }

  cout << ans << endl;
}

Measured memory_bytes: 896
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

int main(){
    ll n, m; 
    cin >> n >> m;
    if(n==1 || m==1) {
        if(n==1 && m==1) cout << 1 << endl;
        else if(n==1 && m!=1) cout << m-2 << endl;
        else if(m==1 && n!=1) cout << n-2 << endl;
        else return 1;
    }
    else {
        cout << (n-2)*(m-2) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import kotlin.math.abs
import kotlin.math.ceil

private fun getInts(): IntArray {
    return readLine()!!.split(" ").map {it.toInt()}.toIntArray()
}

fun main() {
    val nk = getInts()
    val n = nk[0]
    val k = nk[1]
    val an = getInts()

    if (k==0){
        print(an.max())
        return
    }

    // バイナリサーチする。
    var left = 0
    var right = 1000000000
    while(true) {
        if (right - left <= 1) {
            print(right)
            return
        }
        val mid = (left + right) / 2
        val middleCuttingNum = totCut(an,mid)
        if (k >= middleCuttingNum) {
            // 中央も許容できる。
            right = mid
        } else {
            // 許容できない。
            left = mid
        }
    }
}

// カット回数
fun cuttingNum(loglength:Int,limitLength : Int) :Int {
    return ceil(loglength.toDouble()/ limitLength.toDouble()).toInt() - 1
}

fun totCut(arr :IntArray,input: Int): Int {
    return arr.map {
        cuttingNum(it,input)
    }.sum()
}

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

int main(){
    string S,C;
    cin >> S >> C;
    if(S[2] != C[0]){
        cout << "NO" << '\n';
    }else if(S[1] != C[1]){
        cout << "NO" << '\n';
    }else if(S[0] != C[2]){
        cout << "NO" << '\n';
    }else{
        cout << "YES" << '\n';
    }
    return 0;
}

Measured memory_bytes: 3488
def common():
   X = raw_input()
   Y = raw_input()
  
   s = [0 for i in range(len(Y)+1)]
 
   for j in range(0, len(X)):
      t = s + []
      for k in range(0, len(Y)):
         if X[j] == Y[k]:
            s[k+1] = t[k] + 1
         elif s[k+1] < s[k]:
            s[k+1] = s[k]
  
   return s[-1]
 
q = input()
for l in range(0, q):
  print common()

Measured memory_bytes: 6464
#include <iostream>
#include<cmath>
#include<string>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int A,B,C,D,result;
    cin>>A>>B>>C>>D;
    result = min(B,D) - max(A,C);
    if(result < 0)
        cout<<0<<endl;
    else
        cout<<result<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
const int mod=(int)1e9+7;
int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    int a,b;
    cin>>a>>b;
    if((a+b)%3==0||a%3==0||b%3==0) cout<<"Possible";
    else cout<<"Impossible";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int r, c;
	scanf("%d%d", &r, &c);
	int arr[r+1][c+1];
	int i, j;
	for (i=0; i<r; i++)
	{
		for (j=0; j<c; j++)
		{
			scanf("%d", &arr[i][j]);
		}
	}
	for (i=0; i<r; i++)
	{
		arr[i][c]=0;
		for (j=0; j<c; j++)
		{
			printf("%d ", arr[i][j]);
			arr[i][c]+=arr[i][j];
		}
		printf("%d\n", arr[i][c]);
	}
	for (j=0; j<c; j++)
	{
		arr[r][j]=0;
		for (i=0; i<r; i++)
		{
			arr[r][j]+=arr[i][j];
		}
		printf("%d ", arr[r][j]);
	}
	arr[r][c]=0;
	for (i=0; i<r; i++)
	{
		arr[r][c]+=arr[i][c];
	}
	printf("%d\n", arr[r][c]);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int tag[2000005];
int n;
void print()
{
    for(int j=0;j<n;j++)
    {
        if(j)cout<<' ';
        cout<<tag[j];
    }
    cout<<endl;
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>tag[i];
    print();
    for(int i=1;i<n;i++)
    {
        int key=tag[i];
        int j=i-1;
        while(key<tag[j]&&j>=0)
        {
            tag[j+1]=tag[j];
            j--;
        }
        tag[j+1]=key;
        print();
    }
}

Measured memory_bytes: 3092
/**
 *    author:  zjsdut
 *    created: 2020/03/28 20:23:27
 **/
#include <bits/stdc++.h>

using namespace std;

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

template <typename A, typename B> bool chkmin(A &a, const B &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}

template <typename A, typename B> bool chkmax(A &a, const B &b) {
  if (b > a) {
    a = b;
    return true;
  }
  return false;
}

template <typename T> istream &operator>>(istream &stream, vector<T> &vec) {
  for (auto &x : vec)
    stream >> x;
  return stream;
}

void scan() {}

template <class T, class... Args> void scan(T &a, Args &... rest) {
  cin >> a;
  scan(rest...);
}

using ll = long long;
using vl = vector<ll>;
using vb = vector<bool>;
using vi = vector<int>;
using pii = pair<int, int>;
template <typename T> using vv = vector<vector<T>>;
#define rng(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define up(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define down(i, b, a) for (int i = int(b); i >= int(a); i--)
#define TOKENPASTE(x, y) x##y
#define TOKENPASTE2(x, y) TOKENPASTE(x, y)
#define rep(n)                                                                 \
  for (int TOKENPASTE2(_iter_, __LINE__) = 0,                                  \
                               TOKENPASTE2(_num_, __LINE__) = (int)(n);        \
       TOKENPASTE2(_iter_, __LINE__) < TOKENPASTE2(_num_, __LINE__);           \
       ++TOKENPASTE2(_iter_, __LINE__))
#define FOR(x, cont) for (const auto &x : cont)
#define For(x, cont) for (auto &x : cont)
#define all(x) begin(x), end(x)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ep emplace
#define SZ(x) (int)(x).size()
#define UNIQ(vec) (vec).erase(unique(all(vec)), end(vec))
#define LB(cont, x) int(lower_bound(all(cont), x) - begin(cont))
#define UB(cont, x) int(upper_bound(all(cont), x) - begin(cont))

template <typename T>
ostream &operator<<(ostream &stream, const vector<T> &vec) {
  if (!vec.empty()) {
    stream << vec[0];
    for (size_t i = 1; i != vec.size(); ++i)
      stream << ' ' << vec[i];
  }
  return stream;
}

template <typename T> void print(const vector<T> &t) { cout << t << '\n'; }

template <typename T> void print(const vector<vector<T>> &t) {
  for (const auto &row : t) {
    print(row);
  }
}

template <typename T> void print(const T &t) { cout << t << ' '; }

template <typename T, typename... Args>
void print(const T &t, const Args &... rest) {
  print(t);
  print(rest...);
}

template <typename T> void println(const T &t) { cout << t << '\n'; }

template <typename T, typename... Args>
void println(const T &t, const Args &... rest) {
  print(t);
  println(rest...);
}

int main() {
#if defined LOCAL && !defined DUIPAI
  ifstream in("in.txt");
  cin.rdbuf(in.rdbuf());
#endif
  string s;
  scan(s);
  println(s[2] == s[3] && s[4] == s[5] ? "Yes" : "No");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define repp(i,k,n) for(ll i=k;i<n;i++)
#define all(x) x.begin(),x.end()
#define FAST ios::sync_with_stdio(0);cin.tie(0);
#define xx first
#define yy second
#define MOD 1000000007
#define pb push_back
typedef long long ll;
template <typename T>
void dbg(T t){cerr<<t<<endl ;}
template<typename T, typename... Args>
void dbg(T t, Args... args) {cerr << t <<" ";dbg(args...) ;}


int t[100000];
ll dp[100000];
int n,k;

ll slv(int i){
	if(i >= n) return INT_MAX;
	ll & ret = dp[i];
	if(ret != -1) return ret;
	if(i == n-1){
		return ret = 0;
	}
	if(i == n - 2){
		return ret = abs(t[i] - t[i+1]); 
	}
	ret = INT_MAX;
	rep(j,k){
		ret = min(ret,abs(t[i] - t[i+j+1])+slv(i+j+1));
	}	
	return ret;
}

int main(){
	FAST
	cin >> n >> k;
	rep(i,n) cin >> t[i];
	memset(dp,-1,sizeof(dp));
	cout << slv(0) << endl;
	return 0;
}


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

#define MAX 200000

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(void){

    int N,A[MAX],original_A[MAX],i,j,biggest,second_biggest;

    scanf("%d",&N);
    for(i = 0;i < N;i++){
        scanf("%d",&A[i]);
        original_A[i] = A[i];
    }

    qsort(A,N,sizeof(int),compare_int);
    biggest = A[N-1];
    second_biggest = A[N - 2];

    for(i = 0;i < N;i++){
        if(original_A[i] == biggest){
            printf("%d\n",second_biggest);
        }else{
            printf("%d\n",biggest);
        }
    }
    return 0;
}

Measured memory_bytes: 3116
#include <iostream>
#include <numeric>

#define REP(i, b) for (int i = 0 ; i < b ; i++ )

using namespace std;

int main() {
    int H, N;
    cin >> H >> N;
    int a[N];
    REP(i, N) {
        cin >> a[i];
    }
    if (H <= accumulate(a, a + N, 0)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}

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

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

   int point;
   for (int i=0; i<s.size()-1; i+=2) {
     if (s.substr(0, i/2) == s.substr(i/2, i/2)) point=i;
   }

   cout << point << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll d[300][300];
ll V;
vector<int> v;

void warshall_floyd(){
  rep(k,V){
    rep(i,V){
      rep(j,V)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
    }
  }
}

int main(){
  rep(i,300){
    rep(j,300){
      if(i!=j)d[i][j]=inf;
    }
  }
  ll m,R;
  cin >> V >> m >> R;
  ll r[R];
  rep(i,R){
    cin >> r[i];
    r[i]--;
  }
  ll a[m],b[m],c[m];
  rep(i,m){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;
    d[a[i]][b[i]]=min(d[a[i]][b[i]],c[i]);
    d[b[i]][a[i]]=min(d[b[i]][a[i]],c[i]);
  }
  warshall_floyd();
  ll ans=inf;
  rep(i,R){
    v.push_back(i);
  }
  do{
        ll temp=0;
    rep(i,R-1)temp+=d[r[v[i]]][r[v[i+1]]];
    ans=min(ans,temp);
  }while(next_permutation(v.begin(),v.end()));
  cout << ans << endl;
return 0;}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
//#include <cmath>
#include <cstdlib>

using namespace std;

int main(){

    int a,b,x;
    cin >> a >> b >> x;

    if(a <= x && x <= a+b) cout << "YES";
    else cout << "NO";


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 2000010;

// aのn乗を求める。計算量はO(logn)
ll modpow(ll a, ll n) {
    if(n == 0) {
        return 1;
    }
    if(n%2 == 1) {
        return (a * modpow(a, n-1))%mod;
    }
    return (modpow(a, n/2) * modpow(a, n/2))%mod;
}

ll inverse(ll a) {
    return modpow(a, mod-2);
}

ll inv[MAX_N];  // inv[i] : iの逆数のmod
ll fact[MAX_N];  // fact[i] : iの階乗のmod
ll invfact[MAX_N];

void init() {
    inv[0] = fact[0] = invfact[0] = 1;
    inv[1] = 1;
    for(ll i = 1; i < MAX_N; i++) {
        if(i >= 2) {
            inv[i] = mod - inv[mod%i]*(mod/i)%mod;
        }
        fact[i] = (i*fact[i-1])%mod;
        invfact[i] = inverse(fact[i]);
    }
}
 
ll Comb(ll n, ll r) {
    if(r < 0 || n < 0 || n < r) {
        return 0;
    }
    ll res = fact[n];
    res = (res * invfact[r])%mod;
    res = (res * invfact[n-r])%mod;
    return res;
}

//--- main関数でinit()を呼び出すのを忘れるな ---//
int main() {
    ll r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;

    init();

    ll ans = 0;
    exrep(i, r1, r2) {
        ans += Comb(i+1+c2, i+1) + mod - Comb(i+c1, i+1);
        ans %= mod;
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 47104
import java.io.PrintStream;
import java.util.Scanner;
public class Main {
    private static final PrintStream ps = System.out;
    private static final Scanner     sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        if (a[0] != 0) {
            ps.println(-1);
            return;
        }
        long count = 0;
        for (int i = 1; i < n; i++) {
            if (a[i] > a[i-1] + 1) {
                ps.println(-1);
                return;
                
            } else if (a[i] == a[i-1] + 1) {
                count++;
                
            } else {
                count += a[i];
            }
        }
        ps.println(count);
    }
}


Measured memory_bytes: 86816
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;

struct ans{
	int n;
	ans *next;
};

int main(){
	ans *start=new ans();
	start->next=NULL;
	ans *end=start;
	ans *buf;
	char s[20];
	char dir;
	char *ps;
	int **juel;
	int x=10,y=10;
	int state[21][21];
	int i,j,n,m,size;
	while(fgets(s,sizeof(s),stdin)){
		size=atoi(s);
		if(size==0) break;
		memset(state,0x00,sizeof(state));
		x=10;
		y=10;
		juel=new int*[size];
		for(i=0;i<size;i++){
			juel[i]=new int[2];
			fgets(s,sizeof(s),stdin);
			ps=strtok(s," ");
			juel[i][0]=atoi(ps);
			ps=strtok(NULL," ");
			juel[i][1]=atoi(ps);
		}
		fgets(s,sizeof(s),stdin);
		n=atoi(s);
		for(i=0;i<n;i++){
			fgets(s,sizeof(s),stdin);
			ps=strtok(s," ");
			dir=ps[0];
			ps=strtok(NULL," ");
			m=atoi(ps);
			if(dir=='N'){
				for(j=1;j<=m;j++) state[x][y+j]=1;
				y+=m;
			}
			else if(dir=='S'){
				for(j=1;j<=m;j++) state[x][y-j]=1;
				y-=m;
			}
			else if(dir=='E'){
				for(j=1;j<=m;j++) state[x+j][y]=1;
				x+=m;
			}
			else if(dir=='W'){
				for(j=1;j<=m;j++) state[x-j][y]=1;
				x-=m;
			}
		}
		for(i=0;i<size;i++){
			if(state[juel[i][0]][juel[i][1]]==0) break;
		}
		if(i==size) n=0;
		else n=1;
		buf=new ans();
		buf->n=n;
		buf->next=NULL;
		end->next=buf;
		end=buf;
		for(i=0;i<size;i++) delete [] juel[i];
		delete [] juel;
	}
	buf=start->next;
	while(buf!=NULL){
		if(buf->n==0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
		end=buf;
		buf=buf->next;
		delete end;
	}
	return 0;
}

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

int main(){
    int a,n,x = 0;
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> a;
        for(int k = 2;k <= sqrt(a);k++){
            if(a % k == 0){
              x++;
              break;
            }
        }
    }
    cout << n-x << endl;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N, Y;
  cin >> N >> Y;
  int c = 0;
  for (int a = 0; a <= N; a ++) {
    for (int b = 0; b <= N - a; b ++) {
      int total = 10000 * a + 5000 * b + 1000 * (N - a - b);
      if (total == Y) {
        cout << a << " " << b << " " << N - a - b << endl;
        c ++;
      }
      if (c == 1) break; 
    }
    if (c == 1) break;
  }
  if (c == 0) cout << "-1 -1 -1" << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define mod 1000000007
#define lol 200005
#define debug(x) cout<<#x<<" is "<<x<<endl;
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=b;i>=a;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vp vector<pair<double,double>>
#define vpp vector<pair<int, pair<int,int>>>
#define pp pair<int,int>

string lcs(string s, string t)
{
   int n = s.length();
   int m = t.length();

   int dp[n+1][m+1];

   ffor(i,0,n+1) dp[i][0]=0;
   ffor(i,0,m+1) dp[0][i]=0;

   ffor(i,1,n+1)
   {
   	 ffor(j,1,m+1)
   	 {
   	 	if(s[i-1]==t[j-1])
   	 		dp[i][j]=dp[i-1][j-1]+1;
   	 	else
   	 		dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
   	 }
   }

   string temp;
   int i=n,j=m;
   while(i>0 && j>0)
   {
   	  if(s[i-1] == t[j-1])
   	  {
   	  	temp+=s[i-1];
   	  	i--,j--;
   	  }
   	  else if(dp[i-1][j]>dp[i][j-1])
   	  	 i--;
      else 
      	 j--;
   }
   reverse(temp.begin(),temp.end());
   
   return temp;
}

int main()
{
   string s,t;
   cin>>s>>t;
   cout<<lcs(s,t);
}

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

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int n; cin >> n;
    int cnt = 0;
    for (int i = 1; i < n; i++) {
        cnt += n/i;
        if(n%i==0) {
            cnt --;
        }
    }
    cout << cnt;
    return 0;
} 

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  int A, B, C, D;
  ci(A, B, C, D);
  int a, b;
  a = min(A, B);
  b = min(C, D);
  co(a + b);
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	char a[4];
	char b[4];
	int i;

		
	scanf("%s", &a); 
	scanf("%s", &b);
	

	if (a[0] == b[2]&&b[0]==a[2]&&a[1]==b[1])
		printf("YES\n");
	else
		printf("NO\n");
	
	return 0;
}

Measured memory_bytes: 128