akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int H, W, n; cin >> H >> W >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int grid[H][W];
    pii pos(0, 0);
    rep(i, n){
        int color = i + 1;
        rep(j, a[i]){
            int h = pos.first, w = pos.second;
            //cout << "h;" << h << " w:" << w << " color:" << color << ln;
            grid[h][w] = color;
            if(h%2==0){
                if(w==W-1) pos.first++;
                else pos.second++;
            }else{
                if(w==0) pos.first++;
                else pos.second--;
            }   
        }
    }

    rep(i, H){
        rep(j, W){
            cout << grid[i][j];
            if(j!=W-1) cout << " ";
        }
        cout << ln;
    }
}




Measured memory_bytes: 384
#include<bits/stdc++.h>
#define U [1<<17]={}
typedef long long L;using namespace std;map<L,L> path U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c,p,r;char s U;
L D(L a){Z[a]=1;for(map<L,L>::iterator I=path[a].begin();I!=path[a].end();I++){L d=I->first;if(d-P[a]){P[d]=a;E[d]=E[a]+1;C[d]=I->second;D(d);Z[a]+=Z[d];!H[a]|Z[H[a]]<Z[d]?H[a]=d:0;}}}
L G(L a){r=A[a]+A[P[a]]+C[a];return r%k?r:0;}
L M(L i){return i?B[i]+M(i-(i&-i)):0;}
L S(L x,L i){for(x=G(x)-M(i+1)+M(i++);i<1<<17;B[i]+=x,i+=i&-i);}
main(){for(cin>>n>>k;++p<n;)cin>>a>>b>>c,path[a][b]=path[b][a]=c;
       for(D(c=p=0);p<n;p++)if(!p|H[P[p]]-p)for(a=p;!c|a;S(a=H[a],O[a]=c++))X[a]=p;
       for(cin>>a;cin>>s>>a>>b;)if(*s&2){
           for(c=0;p=X[a],n=X[b],p-n;a=P[p])E[p]<E[n]?swap(p,n),swap(a,b),0:0,c+=M(O[a])-M(O[p])+G(p);cout<<c+abs(M(O[a])-M(O[b]))<<endl;}
       else A[a]+=b,S(H[a],O[a]),a?S(a,O[a]-1):0;}

Measured memory_bytes: 33384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s;
	int a = -1, z;
	FOR(i, s.size()) {
		if (s[i] == 'A' && a == -1) a = i;
		else if (s[i] == 'Z') z = i;
	}
	cout << z-a+1 << endl;
	return 0;
}

Measured memory_bytes: 720
import std.stdio;

void main() {
    int n, m, q;
    readf(" %s %s %s", &n, &m, &q);

    auto ans = new int[][](n, n);
    foreach (_; 0..m) {
        int l, r;
        readf(" %s %s", &l, &r);
        foreach (i; --r..n)
            ans[l - 1][i]++;
    }
    foreach_reverse (i; 0..n - 1)
        foreach (j; i..n)
            ans[i][j] += ans[i + 1][j];

    foreach (_; 0..q) {
        int pi, qi;
        readf(" %s %s", &pi, &qi);
        ans[--pi][--qi].writeln;
    }
}


Measured memory_bytes: 1916
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
 
using namespace std;
 
int32_t main ()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);

	string s;
	cin>>s;
	int len=s.length();
	if(s[len-1]!='s')cout<<s<<'s'<<endl;
	else cout<<s<<"es"<<endl;	
	
	return 0;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
const int maxn=100010;
struct box{
    int flag=0;
    int remain=0;
}b[maxn];

void set_remain(box a[],int n){
    for(int i=1;i<=n;i++){
        a[i].remain=1;
    }
}
int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    set_remain(b,n);
    b[1].flag=1;
    for(int i=0;i<m;i++){
        int temp1,temp2;
        scanf("%d %d",&temp1,&temp2);
        b[temp1].remain--;
        b[temp2].remain++;
        if(b[temp1].flag==1) {
            b[temp2].flag=1;
            if (b[temp1].flag == 1 && b[temp1].remain == 0) {
                b[temp1].flag = 0;
            }
        }
    }
    int sum=0;
    for(int i=1;i<=n;i++){
        if(b[i].flag==1&&b[i].remain!=0){
            sum++;
        }
    }
    printf("%d",sum);
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>

using namespace std;

int main(){
  string str;

  cin >> str;

  int n;

  cin >> n;



  for(int i=0;i<n;i++){
      string order,replace;
      int a,b;
      cin >> order >> a >> b;
      if(order == "replace") cin >> replace;

      if(order == "replace") str.replace(a,b-a+1,replace);
      else if(order == "reverse") {
        string reverse;
        reverse = str.substr(a,b-a+1);
        for(int j=0;j<b-a+1;j++){
          str[a+j] = reverse[b-a-j];
        }
      }
      else if(order == "print") cout << str.substr(a,b-a+1) << endl;
  }

  return 0;
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define rep(i, l, r) for(int i = (l), i##end = (r);i <= i##end;++i)
using std::cin; using std::cout;
const int maxn = 101;
typedef long long ll;
const int mod = 1e9 + 7;
void reduce(int & x) {
	x += x >> 31 & mod;
}
int n, a[maxn];
int f[maxn][maxn][maxn];
int main() {
	std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	rep(i, 1, n + n - 1) cin >> a[i];
	std::sort(a + 1,a + n + n);
	f[n][1][0] = 1;
	for(int i = n - 1;i >= 1;--i) {
		int a0 = a[i] != a[i + 1], a1 = a[n + n - i] != a[n + n - i - 1];
		rep(l, 0, n + n - 1) rep(r, 0, n + n - 1 - l) {
			reduce(f[i][l + a0][r + a1] += f[i + 1][l][r] - mod);
			rep(d, 1, l + a0 - 1) reduce(f[i][l + a0 - d][r + a1 + 1] += f[i + 1][l][r] - mod);
			rep(d, 1, r + a1) reduce(f[i][l + a0 + 1][r + a1 - d] += f[i + 1][l][r] - mod);
		}
	}
	int ans = 0;
	rep(l, 0, n + n - 1) rep(r, 0, n + n - 1 - l) reduce(ans += f[1][l][r] - mod);
	cout << ans << '\n';
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = int_fast64_t;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  ll x;
  cin >> x;
  ll ans = 1;
  while((ans * x) % 360 != 0) ans++;
  cout << ans << "\n";
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;



void solve()
{
	string str;
	cin >> str;

	int cnt = 0, ans = 0;
	lop(i, 0, 3)
	{
		ans = max(ans, cnt);
		if ( str[i] == 'R' ) cnt++;
		else cnt = 0;
		ans = max(ans, cnt);
	}
	ans = max(ans, cnt);
	cout << ans << endl;

}

int32_t main()
{
	ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);

	int test = 1;
	// cin >> test;
	while (test--)solve();


}





















Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>

using namespace std;
	
	
class Hoge{
			
		int iN,iK;
		string s0,s1,stemp;
		int* pnum;
			
		public:
			Hoge(int);
		void check();
									
		virtual ~Hoge(){	
						delete [] pnum;
						}
};


Hoge::Hoge(int i0){
							
							//i0=3;
							//cout<<"i0?"<<endl;
							cin>>s0;
							iN=s0.length();
							pnum=new int[4];
							
						for(int icount=0;icount<4;icount=icount+2){
							//cout<<icount<<endl;
							stemp=s0.substr(icount,2);	
							//cout<<stemp<<endl;
							
							pnum[icount]=atoi(stemp.c_str());
							
							
						}
						//	cout<<"pnum[0]="<<pnum[0]<<endl;
						//	cout<<pnum[0]+1<<endl;
			}//end Hoge
void Hoge::check(){
		//	cout<<pnum[2]<<endl;
				if(pnum[0]>12||pnum[0]==0){
						//		cout<<"hoge"<<endl;
					if(pnum[2]>12||pnum[2]==0){
			
								cout<<"NA"<<endl;
				
										
				}//2nd if
				
				else{
						cout<<"YYMM"<<endl;
				}
			
			}//1st if
			
		
		else if(pnum[2]>12||pnum[2]==0){
		
						cout<<"MMYY"<<endl;
		
		}
	 	else{
	
						cout<<"AMBIGUOUS"<<endl;
			}
			
					
				
					}//endfunc
					





int main()
{
	
	Hoge* ph0=new Hoge(0);
	//ph0->convert();
	ph0->check();
	//ph0->input();
	//ph0->output(3);
	//ph0->output0(3);
	
	

	
	//cout<<ph0->getichange()<<endl;
	
	
	delete ph0;
	
	
}

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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (n % 2){
        cout << "No" << endl;
        return 0;
    }
    bool flag = true;
    for (int i = 0; i < n / 2; i++){
        if (s[i] != s[i + n / 2]) flag = false;
    }
    if (!flag) cout << "No" << endl;
    else cout << "Yes" << endl;
}

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

using std::scanf;
using std::printf;
using std::max;
using std::min;
using std::pair;
using std::make_pair;

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

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

#define AL16 __attribute__((aligned(16)))

namespace sparse_table{
  const int ST_MAX = 5000;
  const int ST_K = 13;  // 2^12 = 4096 < 5000
  const int ST_2K = 4096;
  unsigned long long st[ST_K][ST_MAX + ST_2K/2];

  short mylog[ST_MAX+1];
  void precalc(){
    // mylog[0] = 0;
    mylog[1] = 0;
    FOR(i,2,ST_MAX+1)mylog[i]=mylog[i/2]+1;
  }

  inline unsigned long long zip(unsigned int v,unsigned int p){
    return ((unsigned long long)v<<32) | ((unsigned long long)p);
  }
  const int MASK = 4294967295;
  inline void unzip(long long z,unsigned int &v,unsigned int &p){
    v = (unsigned int)(z>>32);
    p = (unsigned int)(z&MASK);
  }

  // O(nlogn)
  void init(int n, int *arr){
    REP(i,n)st[0][i] = zip((unsigned int)(arr[i]),(unsigned int)i);
    FOR(i,n,ST_MAX)st[0][i] = 0;
    int base = 1;
    FOR(k,1,ST_K){
      REP(i,ST_MAX)st[k][i] = max(st[k-1][i], st[k-1][i+base]);
      base <<= 1;
    }
  }
  // O(1)
  // [l,r)
  long long rmq(int l,int r){
    int lg = mylog[r-l];
    return max(st[lg][l], st[lg][r-(1<<lg)]);
  }
}

int n,m;
long long a[5000];
int b[200][5000];

long long imos[5004][5004];
pair<short,short> stack[5000];
int stack_tail;

int main(){
  scanf("%d%d",&n,&m);
  REP(i,n-1)scanf("%lld",a+i+1);
  REP(i,n)REP(j,m)scanf("%d",&b[j][i]);
  // REP(i,n-1)a[i+1] = 1;
  // REP(i,n)REP(j,m)b[j][i] = 1;

  REP(i,n-1)a[i+1] += a[i];
  
  sparse_table::precalc();

  REP(i,m){
    sparse_table::init(n, b[i]);
    stack_tail = 0;
    stack[stack_tail++] = make_pair<short,short>(0,n);
    REP(_,n){
      // printf("stacktail %d\n",stack_tail);
      stack_tail--;
      int l = stack[stack_tail].first;
      int r = stack[stack_tail].second;
      // printf("(l,r) = (%d,%d)\n",l,r);
      unsigned int v,p;
      sparse_table::unzip(sparse_table::rmq(l,r), v, p);
      // printf("(v,p) = (%u,%u)\n",v,p);
      imos[l  ][p] += v;
      imos[p+1][p] -= v;
      imos[l  ][r] -= v;
      imos[p+1][r] += v;
      if(l<p)stack[stack_tail++] = make_pair<short,short>(l,p);
      if(p+1<r)stack[stack_tail++] = make_pair<short,short>(p+1,r);
    }
  }

  REP(i,n)REP(j,n)imos[i][j+1] += imos[i][j];
  REP(i,n)REP(j,n)imos[i+1][j] += imos[i][j];

  long long ans = 0;
  REP(i,n)FOR(j,i,n)chmax(ans,imos[i][j]-a[j]+a[i]);
  printf("%lld\n",ans);
}


Measured memory_bytes: 200192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    string s, t;
    cin >> s >> t;
    ll count = 0, n = s.length(), m = t.length();
    vector<vector<ll> > a(26);
    rep(i, n) {
        a[s[i] - 'a'].push_back(i+1);
    }
    ll index = 0;
    rep(i, m) {
        if(a[t[i] - 'a'].size() == 0) {
            cout << -1 << endl;
            return 0;
        }
        else {
            // -------------- 二分探索 --------------------
            // 解の存在範囲を初期化
            ll ti = t[i] - 'a';
            // -------------- 標準ライブラリ --------------------
            auto position = upper_bound(a[ti].begin(), a[ti].end(), index);
            ll low_idx = distance(a[ti].begin(), position);
            //cout << (char) (ti + 'a') << " :" << a[ti][low_idx] << " index:" << index << " low_idx:" << low_idx << endl;
            if(low_idx == a[ti].size()) {
                count++;
                index = a[ti][0];
            }
            else {
                index = a[ti][low_idx];
            }
        }
    }
    cout << count * n + index << endl;
}

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

typedef vector<int> vec;

int main () {
    int N, M, a, b;
    cin >> N >> a >> b >> M;

    map<int,int> A;

    for (int i = 0; i < M; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        
        if (x == 0) {
            int Y, Z;
            if (A.find(y) != A.end()) Y = A[y];
            else Y = a + (y - 1) * b;
            if (A.find(z) != A.end()) Z = A[z];
            else Z = a + (z - 1) * b;
            
            A[y] = Z;
            A[z] = Y;
        } else {
            int Y, Z;
            if (A.find(z) != A.end()) Z = A[z];
            else Z = a + (z - 1) * b;
            
            A[y] = Z;
        }
    }

    int k;
    cin >> k;
    if (A.find(k) != A.end()) cout << A[k] << endl;
    else cout << a + (k - 1) * b << endl;
    
    return 0;
}

Measured memory_bytes: 1200
# coding: utf-8
# Your code here!

H, W=map(int, input().split())
S=["" for i in range(H)]
for i in range(H):
    S[i] = input()

def ncell(i, j):
    DX = [i-1, i, i+1, i-1, i+1, i-1, i, i+1]
    DY = [j-1, j-1, j-1, j, j, j+1, j+1, j+1]
    XX = []
    YY = []
    for k in range(8):
        if (0<=DX[k]<=H-1 and 0<=DY[k]<=W-1):
            XX.append(DX[k]); YY.append(DY[k])
    return [XX, YY]
for i in range(H):
    st = ""
    for j in range(W):
        if S[i][j] == ".":
            dd = ncell(i, j)
            dx = dd[0]; dy = dd[1];
            m = 0
            for k in range(len(dx)):
                if S[dx[k]][dy[k]] == "#":
                    m += 1
            st += str(m)
        else:
            st += "#"
    print(st)

    


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;

int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n,k;
	cin>>n;
	string s;
	cin>>s;
	cin>>k;
	char c=s[k-1];

	for(int i=0; i<n; i++) {
		if(s[i]!=c) {
			s[i]='*';
		}
	}
	cout<<s<<endl;

	return 0;
}


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

const ll MAX = 200000;
const ll INF = 1001001001;
const ll MOD = 1000000007;
const double PI=3.1415926535897932;

ll N, ans=0, tmp=0;
vector<ll> A;

signed main(){
    cin >> N;
    for(int i=0;i<N;i++) {
        ll a;
        cin >> a;
        A.push_back(a);
    }
    for(int i=0;i<N;i++) {
        for(int j=i+1;j<N;j++) {
            for(int l=j+1;l<N;l++) {
                if(A[i]==A[j]||A[j]==A[l]||A[l]==A[i]) continue;
                tmp = max(A[i], A[j]);
                tmp = max(tmp, A[l]);
                ll sum=0;
                if(tmp!=A[i]) sum+=A[i];
                if(tmp!=A[j]) sum+=A[j];
                if(tmp!=A[l]) sum+=A[l];
                if(sum>tmp) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BAcrostic solver = new BAcrostic();
        solver.solve(1, in, out);
        out.close();
    }

    static class BAcrostic {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int w = in.nextInt();
            for (int i = 0; i < s.length(); i += w) {
                out.print(s.charAt(i));
            }
            out.println();
        }

    }
}



Measured memory_bytes: 22228
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<iterator>
#include<algorithm>
#include<functional>

typedef long long ll;
typedef std::pair<int, int> work;

struct solver_abc_137_d {
	/*
	A_i 日後に報酬 B_i
	M 日後に得られる最大値

	M - 1 日目から戻っていく
	「まだ請けていない仕事のうち、(間に合うもので)報酬が最大のもの」
	を逆向きに探して請けていけばよい。

	A_i で全部ソートしておく
	%B_i を使った priority_queue を用いる%
	請けたインデックスを消し、間に合う %日付% B_i を A_i を見て加える
	*/

	ll run(int N, int M, std::vector<work> &_dat) {
		std::vector<work> works = _dat;

		// works は日付小さい順
		auto smaller_day = [](const work & left, const work &right) { return left.first < right.first; };
		std::sort(works.begin(), works.end(), smaller_day);

		// あとは、dat の index のみを扱う
		// auto greater_reward = [&](int left, int right) { return works[left].second > works[right].second; };
		std::priority_queue<int, std::vector<int>, std::less<int> > p_queue;

		int next_add_begin = 0;
		// std::vector<int> indexes;
		ll sum_rewords = 0;

		for(int day = M -1; day >= 0; --day) {
			// std::cerr << "day:\t" << day << std::endl;
			// add available works
			while(next_add_begin < N && day + works[next_add_begin].first <= M) {
				// indexes.push_back(next_add_begin);
				// std::cerr << "push: " << next_add_begin << "\t" << works[next_add_begin].first << "\t" << works[next_add_begin].second << std::endl;
				p_queue.push(works[next_add_begin].second);
				next_add_begin++;
			}

			// choose best work
			if( ! p_queue.empty() ) {
				// std::cerr << "pop: " << p_queue.top() << std::endl;
				sum_rewords += p_queue.top();
				p_queue.pop();
			}
		}

		return sum_rewords;
	}
};

int main(void) {
	solver_abc_137_d solver;
	int N, M, A, B;
	std::vector<work> works;
	work t;

	std::cin >> N >> M;
	for(int i = 0; i < N; ++i) {
		std::cin >> A >> B;
		t.first = A;
		t.second = B;
		works.push_back(t);
	}

    std::cout << solver.run(N, M, works) << std::endl;

	return 0;
}


Measured memory_bytes: 2676
/***********************************************
#
#      Filename: c.cpp
#
#        Author: Comsyl - ylsong15@fudan.edu.cn
#   Description: ---
#        Create: 2017-05-28 09:54:39
***********************************************/
#include <iostream>
using namespace std;
int N, M, Q;
char bar[2010][2010];
int node[2010][2010];
int e1[2010][2010];
int e2[2010][2010];

int calNode(int x1, int y1, int x2, int y2) {
    if (!x1 && !y1) return node[x2][y2];
    return node[x2][y2] - node[x2][y1-1] - node[x1-1][y2] + node[x1-1][y1-1];
}

int calEdge(int x1, int y1, int x2, int y2) {
    int r1, r2;
    if (y1 == 0) 
        r1 = e1[x2][y2] - e1[x1][y2];
    else
        r1 = e1[x2][y2] - e1[x2][y1-1] - (e1[x1][y2] - e1[x1][y1-1]);

    if (x1 == 0)
        r2 = e2[x2][y2] - e2[x2][y1];
    else
        r2 = e2[x2][y2] - e2[x1-1][y2] - (e2[x2][y1] - e2[x1-1][y1]);
    return r1 + r2;
}

void setIndex() {
    node[0][0] = (bar[0][0] == '1') ? 1 : 0;
    for (int j = 1; j < M; ++ j) {
        node[0][j] = node[0][j-1] + ((bar[0][j] == '1') ? 1 : 0);
    }
    for (int i = 1; i < N; ++ i) {
        for (int j = 0; j < M; ++ j) {
            if (j == 0) {
                node[i][j] = node[i-1][j];
            } else {
                node[i][j] = node[i-1][j] + node[i][j-1] - node[i-1][j-1];
            }
            if (bar[i][j] == '1') 
                ++ node[i][j];
        }
    }
    for (int j = 0; j < M; ++ j) e1[0][j] = 0;
    for (int j = 0; j < M; ++ j) {
        for (int i = 1; i < N; ++ i) {
            if (j == 0) {
                e1[i][j] = e1[i-1][j];
            } else {
                e1[i][j] = e1[i][j-1] + (e1[i-1][j] - e1[i-1][j-1]);
            }
            if (bar[i][j] == '1' && bar[i-1][j] == '1')
                ++ e1[i][j];
        }
    }

    for (int i = 0; i < N; ++ i) e2[i][0] = 0;
    for (int i = 0; i < N; ++ i) {
        for (int j = 1; j < M; ++ j) {
            if (i == 0) {
                e2[i][j] = e2[i][j-1];
            } else {
                e2[i][j] = e2[i-1][j] + (e2[i][j-1] - e2[i-1][j-1]);
            }
            if (bar[i][j] == '1' && bar[i][j-1] == '1')
                ++ e2[i][j];
        }
    }
}

int main()
{
    cin >> N >> M >> Q;
    for (int i = 0; i < N; ++ i) {
        cin >> bar[i];
    }
    setIndex();
    while (Q --) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        --x1, --y1, --x2, -- y2;
        cout << calNode(x1, y1, x2, y2) - calEdge(x1, y1, x2, y2) << endl;
    }
    return 0;
}


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

int main() {
  int s;
  cin >> s;
  int x = s / 100;
  int y = s % 100;
  
  bool check1 = 0;
  bool check2 = 0;
  
  if (y > 0 && y < 13) check1 = 1;
  
  if (x > 0 && x < 13) check2 = 1;
  
  if (check1 == 1 && check2 == 1) {
    cout << "AMBIGUOUS";
  }
  else if (check1 == 1 && check2 == 0) {
    cout << "YYMM";
  }
  else if (check1 == 0 && check2 == 1) {
    cout << "MMYY";
  }
  else cout << "NA";
  
}

Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
    int n;
    int y;
    cin>>n;
    cin>>y;
    y/=1000;
    int a,b,c;
    a=-1;
    b=-1;
    c=-1;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n&&i+j<=n;j++){
            if(9*i+4*j+n==y){
             a=i;b=j;c=n-a-b;
                 }
             }
            }
            cout<<a<<" "<<b<<" "<<c<<" "<<endl;
    return 0;
}


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

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

	set<int> st;
	st.insert(1e9+1);
	while(q--){
		int query,y;cin>>query>>y;
		if(query==0){
			// insert
			st.insert(y);
			cout<<(st.size()-1)<<endl;
		}else if(query==1){
			cout<<(st.find(y)!=st.end()?1:0)<<endl;
		}else if(query==2){
			st.erase(y);
		}else{
			int r;cin>>r;
			for(auto it=st.lower_bound(y);it!=st.upper_bound(r);++it){
				cout<<*it<<endl;
			}
		}
	}
  return 0;
}



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

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

vector<ll> a;

void dfs(ll i,int depth){
    if(depth==11)return ;
    ll b = (i % 10) - 1;
    ll c = b+1;
    ll d = c+1;
    if(b>=0){
        dfs(i*10 + b,depth + 1);
        a.push_back(i*10 + b);
    }
    dfs(i*10 + c ,depth + 1);
    a.push_back(i*10 + c);
    if(d <=9){
        dfs(i*10 + d, depth + 1);
        a.push_back(i*10 + d);
    }
}
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll k;
    cin >> k;
    for(ll i = 1;i<=9;i++){
        a.push_back(i);
        dfs(i,1);
    }
    sort(ALL(a));
    cout << a[k-1] << endl;
}

Measured memory_bytes: 10220
#include<iostream>
#include<cstdio>
#define pq priority_queue
using namespace std;
char s1[105],s2[105];
int n;
bool ok(int x)
{
    for(int i=0;i+x<n;i++)
    {
        if(s1[i+x]!=s2[i])
            return 0;
    }
    return 1;
}
int main()
{
    int ans;
    while(cin>>n)
    {
        ans=2*n;
        getchar();
        for(int i=0;i<n;i++)
            scanf("%c",s1+i);
        getchar();
        for(int i=0;i<n;i++)
            scanf("%c",s2+i);
        for(int i=0;i<n;i++)
        {
            if(ok(i))
            {
                ans=n+i;
                break;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


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

int main() 
{
  string s;
  cin >> s;
  for (int i = 0; i < 3; i++) {
    if (s[i] == '1') {
      s[i] = '9';
    }else if (s[i] == '9') {
      s[i] = '1';
    }
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
N,M,K = map(int,input().split())
mod = 998244353

m = 2*(10**5) +10 
fac = [1]*m
ninv = [1]*m
finv = [1]*m
for i in range(2,m):
    fac[i] = fac[i-1]*i%mod
    ninv[i] = (-(mod//i)*ninv[mod%i])%mod
    finv[i] = finv[i-1]*ninv[i]%mod

def comb(n,k):
    return (fac[n]*finv[k]%mod)*finv[n-k]%mod

ans = 0
for i in range(K+1):
    ans += (comb(N-1,i)*M%mod)*pow(M-1,N-i-1,mod)
    ans %= mod
print(ans)

Measured memory_bytes: 32632
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using P = pair<ll,ll>;
using um = unordered_map<ll,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=(ll)1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll A;
    cin >> A;
    ll B;
    cin >> B;
    ll C;
    cin >> C;
    prt(max({A,B,C})-min({A,B,C}));
    return 0;
}



Measured memory_bytes: 3604
S=input()
y=int(S[0:4])
m=int(S[5:7])
d=int(S[8:])

if y<2019:
    print('Heisei')
elif y>2019:
    print('TBD')
else:
    if m<=4:
        print('Heisei')
    else:
        print('TBD')


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

using ll=long long;

int main(){
    int A, B; cin >> A >> B;
    int H, M; cin >> H >> M;
    double a, b;
    double pi=acos(-1);
    a=(H%12)*pi/6+(M/60.0)*pi/6;
    b=M*pi/30;
    double res;
    double c=a-b;
    res=sqrt(pow(A,2)+pow(B,2)-2.0*A*B*cos(c));
    printf("%.9f\n",res);
    return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
#define ll long long 
#define hell 1000000007
#define F first
#define re 15000000
#define S second
#define pb push_back
#define all(a)  (a).begin(),(a).end()
#define rep(i,a,b) for(ll int i = a;i<b;i++)
#define pi 3.1415926536
#define Mod 998244353
//char a[2000][2000];
using namespace std;
bool check(ll m,ll k,ll n,ll a ,ll b){
  ll rem = n-m;
  if( k > rem*b + a*m)
      return 1;
  else
    return 0;

}
int getMod(string s,int k){
  ll sum = 0;
  for(int i = 0;i<s.size();i++){
    sum = sum*10+(s[i]-'0');
    sum = sum%k;
  }
  return sum%k;

}
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);            
    //std::setprecision(20);    
    int tests=1;
      //freopen("input.txt", "r", stdin);   
     // cin>>tests;
  while(tests--)
    {
      int n;
      cin>>n;
      ll a[n+1];  
      a[0] = -1;
      ll sum = 0;
      for(int i = 1;i<=n;i++){
        cin>>a[i];
        sum = sum + a[i];

      }
      //cout<<sum;
      ll res = 0;
      for(int i = 1;i<n;i=i+2){
       // cout<<i;
        res = res+2*a[i];
      }

      vector<ll> ans(n+1);
      ans[0] = -1;
      ans[n] = sum-res;
      ll prev = ans[n];
      for(int i = n-1;i>=1;i--){
        ans[i] = 2*a[i]-prev;
        prev = ans[i];
      }
      for(int i=1;i<=n;i++)
        cout<<ans[i]<<" ";


    }
    
}

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

int main(){
  string N;
  cin >> N;
  int L=N.size();
  int topn=N.at(0)-'0';
  int ans;
  int flag=0;
  for(int i=1; i<L; i++){
    if(N.at(i)=='9') flag++;
  }
  if(L==1) ans=topn;
  else if(flag==L-1) ans=9*(L-1)+topn;
  else ans = (topn-1) + 9*(L-1);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N_PRIME 1000000007
#define ll int64_t

#define MAX_N 100008

int N;
int x;
int arr[2*MAX_N-1];
bool dig[2*MAX_N-1];

void show(){
    cout << "Yes" << endl;
    for(int i = 0 ; i < 2*N - 1 ;i++){
        cout << arr[i] << endl;
    }
}

void fill(){
    int now_number = 1;
    
    for(int i = 0 ; i < 2 * N - 1 ; i++ ){
        if( arr[i] != 0 )continue;
        
        while(dig[now_number])now_number++;
        
        dig[now_number]=true;
        arr[i] = now_number;
    }
}

int main(void){
    
    cin >> N;
    cin >> x;
    for(int i = 0 ; i < 2*MAX_N - 1 ; i++ ){
        dig[i] = false;
        arr[i] = 0;
    }
    
    
    
    if( x == 1 || x == 2 * N - 1 ){
        cout << "No" << endl;
        return 0;
    }else{
        if( N == 2 ){
            if( x == 2 ){
                cout << "Yes" << endl;
                cout << 1 << endl;
                cout << 2 << endl;
                cout << 3 << endl;
                return 0;
            }else{
                cout << "No" << endl;
                return 0;
            }
        }
        
        
        if( x == 2 ){
            arr[N-1] = x;
            arr[N  ] = x+1;
            arr[N-2] = x-1;
            arr[N-3] = x+2;
            
            for(int i = x - 1 ; i <= x+2 ; i++ )
                dig[i] = true;
            fill();
            show();
            return 0;
        }else{
            arr[N-1] = x;
            arr[N  ] = x+1;
            arr[N-2] = x-1;
            arr[N+1] = x-2;
            
            for(int i = x - 2 ; i <= x+1 ; i++ )
                dig[i] = true;
            fill();
            show();
            return 0;
        }
    }
    return 0;
}



Measured memory_bytes: 2560
#include <iostream>

int main() {
    while( true ) {
        int h , w ;
        std::cin >> h >> w ;
        if( h == 0 && w == 0 ) {
            break ;
        } else {
            for( int i = 0 ; i < h ; i++ ) {
                for( int ii = 0 ; ii < w ; ii++ ) {
                    std::cout << "#" ;
                }
                std::cout << std::endl ;
            }
            std::cout << std::endl ;
        }
    }
}


Measured memory_bytes: 3104
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = INF;
        int N = sc.nextInt();
        int[] X = new int[N];
        for(int i=0;i<N;i++){
            X[i]=sc.nextInt();
        }
        for(int k=0;k<=100;k++){
            int tmp=0;
            for(int i=0;i<N;i++){
                tmp+=(X[i]-k)*(X[i]-k);
            }
            ans=Math.min(ans,tmp);
        }
        System.out.println(ans);
    }

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


Measured memory_bytes: 23252
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) { if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(DUMPALL_ITR, (q).size()) { cerr << (q)[DUMPALL_ITR] << (DUMPALL_ITR == DUMPALL_ITR_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    // インタラクティブ問題では除去した方がいいかも
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll x; cin >> x;
    ll un = x / 100;
    ll md = x % 100;

    cout << (md <= un * 5) << endl;
    
}

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

int main() {
  string  s;
  cin >> s;
  int ans = 700;
  for(int i = 0; i < 3; i++){
    if(s.at(i) == 'o' ){
      ans += 100;
    }
  }
  cout << ans <<endl;
}


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

int main(){
	bool x[4][13]={0};
	int number,n,i,j;
	char mark;
	
	cin >> n;
	for(i=0;i<n;i++){
		cin >> mark >> number;
		if(mark=='S'){
			x[0][number]=1;
		}else if(mark=='H'){
			x[1][number]=1;
		}else if(mark=='C'){
			x[2][number]=1;
		}else if(mark=='D'){
			x[3][number]=1;
		}
	}
	for(j=0;j<4;j++){
		for(i=1;i<=13;i++){
			
			if(x[j][i]==0){
				if(j==0){
					cout << "S " << i << endl;
				}else if(j==1){
					cout << "H " << i << endl;
				}else if(j==2){
					cout << "C " << i << endl;
				}else if(j==3){
					cout << "D " << i << endl;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3036
str = gets.chomp
size = str.size
indexes = (1...size).to_a
numbers = (0..(size + 1)).flat_map do |combination_cnt|
  indexes.combination(combination_cnt).collect.flat_map do |divide_indexes|
    divide_indexes.reverse.inject([str]) do |array, idx|
      strnum = array.shift
      [strnum[0...idx], strnum[idx..-1]] + array
    end
  end
end

puts numbers.each_with_object(Hash.new(0)) {|e, h| h[e] += 1 }.map { |strnum, num| strnum.to_i * num }.inject(&:+)

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

// clang-format off
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(NULL)
#define forn(i, x, y) for(int i = x; i < y; i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
// clang-format on

const long long INF = 1LL << 60;
const int MAX_V = 100001;

int main()
{
  IOS;

  ll N, W;
  cin >> N >> W;
  vector<ll> w(N), v(N);
  forn(i, 0, N) cin >> w[i] >> v[i];

  vector<vector<ll>> dp(N + 1, vector<ll>(MAX_V, INF));
  dp[0][0] = 0;

  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < MAX_V; j++)
    {
      dp[i + 1][j] = dp[i][j];
      if (j >= v[i])
        chmin(dp[i + 1][j], w[i] + dp[i][j - v[i]]);
    }
  }

  ll res = 0;
  for (int j = 0; j < MAX_V; j++)
  {
    if (dp[N][j] <= W)
      res = j;
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 83156
/*
 * main.c
 *
 *  Created on: 2019/04/13
 *      Author: family
 */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

char S[100001] = {0};

int main()
{
    int ans = 0;
    int len = 0;
    int i = 0;
    char prev = 0;
    scanf("%s", S);

    prev = S[0];
    len = strlen(S);
    for(i = 1; i < len; i++) {
        if(prev == S[i]) {
            if(prev == '0') {
                S[i] = '1';
            } else {
                S[i] = '0';
            }
            ans++;
        }
        prev = S[i];
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		ArrayList<Integer> one = nextIntArray();
		int A = one.get(0);
		int B = one.get(1);
		int X = one.get(2);
		if(A > X || A + B < X){
			myout("NO");
		}else{
			myout("YES");
		}
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 32576
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 300005;
const int mod = 1000000007;

struct ST {
  int l,r,val;
}st[maxn*4];
void build(int id, int l, int r){
  st[id].l=l,st[id].r=r,st[id].val = 0;
  if(l==r)return;
  int m = (l+r)>>1;
  build(id<<1,l,m);
  build(id<<1|1,m+1,r);
}
void up(int id){
  st[id].val = max(st[id<<1].val, st[id<<1|1].val);
}
void add(int id, int pos, int val){
  if(st[id].l==st[id].r){
    st[id].val = max(st[id].val, val);
    return;
  }
  int m = (st[id].l+st[id].r)>>1;
  if(pos<=m)add(id<<1,pos,val);
  else add(id<<1|1,pos,val);
  up(id);
}
int query(int id, int l, int r){
  if(st[id].l==l&&st[id].r==r){
    return st[id].val;
  }
  int m=(st[id].l+st[id].r)>>1;
  if(r<=m)return query(id<<1,l,r);
  else if(l>m)return query(id<<1|1,l,r);
  return max(query(id<<1,l,m),query(id<<1|1,m+1,r));
}

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n,m;
  cin>>n>>m;
  int ret = 0;
  build(1,1,maxn-4);
  for(int i=1;i<=n;i++){
    int x;
    cin>>x;
    x++;
    int l = max(1, x-m);
    int r = min(maxn-4, x+m);
    int tt = query(1, l,r);
    ret = max(ret, tt+1);
    add(1, x, tt+1);
  }
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 15920
#include <bits/stdc++.h>
#define endl '\n';

typedef long long ll;

using namespace std;

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

    const string YES = "Yes";
    const string NO  = "No";
    int ans[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    int x, y;

    cin >> x >> y;

    if (ans[x] == ans[y]) {
        cout << YES;
    } else {
        cout << NO;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int a=0,b=0,c=0,d=0,e=0,k=0;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    scanf("%d",&d);
    scanf("%d",&e);
    scanf("%d",&k);
    if (e-a>k)
    {printf(":(\n");}
    else {printf("Yay!\n");}
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
const ll MOD = 1e9+7;
ll fast_exp(ll base, ll exp)
{
  ll res=1;
  while(exp>0)
    {
      if(exp%2==1) res=(res*base)%MOD;
      base=(base*base)%MOD;
      exp/=2;
    }
  return res%MOD;
}

ll getInverse(ll n)
{
  return fast_exp(n, MOD-2) ;
}

ll divide(ll a, ll b)
{
  a=a%MOD ;
  b=b%MOD ;
  return (a*(getInverse(b)%MOD))%MOD ;
}
const int MAXN = 200005;
ll phi[MAXN];
vi prime;
void find_totient() 
{
    int i, j;
    FOR0(i, MAXN)
        phi[i] = i;
    FOR(i, 2, MAXN)
    {
        if(phi[i] == i)
        {
            phi[i] = i-1;
            for(j = 2*i; j < MAXN; j += i)
            {
                phi[j] = (phi[j]/i)*(i-1);
            }
        }
    }
}
int main()
{
    she_told_me_dont_worry
    ll n, k;
    cin>>n>>k;
    ll i, j;
    find_totient();
    ll ans = 0;
    FOR(j, 1, k+1)
    {
        ll cur = phi[j];
        ll base = k/j;
        base = fast_exp(base, n);
        cur *= base;
        cur %= MOD;
        ans += cur;
        ans %= MOD;
    }
    cout<<ans<<endl;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 5332
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MAX = 17;
const double EPS = 1e-8;
const int MOD = 1000 * 1000 * 1000 + 7;


VI A;
int cur;

void rec(LL x)
{
    if (x == 1)return ;
    int val = ++cur;
    if (x & 1)
    {
        A.PB(val);
        rec(x-1);
    }
    else
    {
        rec(x/2);
        A.PB(val);
    }
}


int main()
{
    LL n;
    cin >> n;
    rec(n+1);
    int k = SZ(A);
    RFOR(i, k+1, 1)
        A.PB(i);
    cout << SZ(A) << endl;
    FOR(i, 0, SZ(A))cout << A[i] << " ";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> int_pair;
typedef pair<ll,ll> ll_pair;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
const ll inf =1e9+7;
const ll N=100001;
ll k,a[N],nmax,nmin;

int main(){
	cin>>k;
	FOR(i,0,k)cin>>a[i];
	nmax=2;
	nmin=2;
	FOR(i,0,k){
		nmax=nmax/a[k-i-1]*a[k-i-1]+a[k-i-1]-1;
		if(nmin%a[k-i-1]!=0)nmin=(nmin/a[k-i-1]+1)*a[k-i-1];
	}
	ll nmi,nma;
	nmi=nmin;
	nma=nmax;
	FOR(i,0,k){
		nmi=nmi/a[i]*a[i];
		nma=nma/a[i]*a[i];
	}
	if(nmi!=2||nma!=2){
		cout<<-1<<endl;
		return 0;
	}
	cout<<nmin<<" "<<nmax<<endl;
	return 0;
}

Measured memory_bytes: 1024