akhauriyash/Code-Regression huggingface dataset:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    H, W, N = LI()

    # 黒マス1個が影響を与える3x3領域の数は9個
    # 黒マスごとに周りの各3x3に対して黒マス数をインクリメントすればよい
    cnt = collections.Counter()
    for _ in range(N):
        a, b = LI_()
        for i, j in itertools.product(range(-1, 2), repeat=2):
            c, d = a + i, b + j
            if 1 <= c < H - 1 and 1 <= d < W - 1:
                cnt[(c, d)] += 1

    ans = collections.Counter(cnt.values())
    print((H - 2) * (W - 2) - sum(list(ans.values())))
    for i in range(1, 10):
        print(ans[i])

if __name__ == '__main__':
    resolve()


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

int main(){
  int N;
  double M; 
  cin >> N >> M;
  vector<int> A(N);
  double sum = 0;
  rep(i, N){
    cin >> A[i];
    sum += A[i];
  }
  
  int count = 0;
  rep(i, N){
    if (A[i] >= (sum / (4 * M))) count++;
  }
  
  
  if (count >= M) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int month = (s[5] - '0') * 10 + s[6] - '0';

    if (month <= 4) {
        cout << "Heisei\n";
    } else {
        cout << "TBD\n";
    }

    return 0;
}

Measured memory_bytes: 760
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {


    int n = 0;
    int k = 0;
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
      String[] tmp = br.readLine().split("\\s");
      n = Integer.parseInt(tmp[0]);
      k = Integer.parseInt(tmp[1]);
    } catch(IOException e) {
      e.printStackTrace();
      System.exit(1);
    }

    long quotient = k;
    quotient *= (long)Math.pow(k-1, n-1);
    System.out.print(quotient);
  }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
int x=1;
long long po(int n)
{
	if(n==0)
	return 1;
	return n*po(n-1)%1000000007;
}


int main(void)
{
    int n,m;
    cin >> n>>m;
    if(abs(n-m)>=2){
	    cout<<0<<endl;
    return 0;
    }
    if(abs(n-m)==1){
	 cout<<po(n)*po(m)%1000000007<<endl;
	 return 0;
    }
    if(abs(n-m)==0){
    cout<<po(n)*po(m)*2%1000000007<<endl;
    return 0;
    }
    return 0;
}


Measured memory_bytes: 1792
from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10


def main():
    H, W = map(int, input().split())
    N = int(input())
    a_list = list(map(int, input().split()))
    c_list = []
    for i, a in enumerate(a_list, start=1):
        c_list += [i] * a

    ans = [[0] * W for _ in range(H)]
    for i, c in enumerate(c_list):
        h = i // W
        if h % 2 == 0:
            ans[h][i % W] = c
        else:
            ans[h][-(i % W + 1)] = c

    for line in ans:
        print(*line)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4340
#include <iostream>

using namespace std;

int main()
{
    string st1, st2;
    cin >> st1;
    cin >> st2;
    int cnt = 0;

    for(int i = 0; i < 3; i++)
    {
        if(st1[i] == st2[i])
            cnt++;
    }
    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << (b - a) * (b - a + 1) / 2 - b;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    cout << (10000 - n) % 1000 << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main()
{
	int m, f, r, t;
	while(true)
	{
		cin >> m >> f >> r;
		if( -1 == m && -1 == f && -1 == r )
			break;

		if( m == -1 || f == -1 ){
			cout << "F\n";
			continue;
		}
		
		t = m + f;
		if( t >= 80 ) cout << "A\n";
		else if( t >= 65 && t < 80 ) cout << "B\n";
		else if( t >= 50 && t < 65 ) cout << "C\n";
		else if( t >= 30 && t < 50 ){
			if( r >= 50 ) cout << "C\n";
			else		  cout << "D\n";
		}
		else cout << "F\n";
	}
	return 0;
}

Measured memory_bytes: 1120
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int con;
    if(a > b){
      con = b;
      b = a;
      a = con;
    }
    if(b > c){
      con = c;
      c = b;
      b = con;
    }
    if(a > b){
      con = b;
      b = a;
      a = con;
    }
    System.out.println(a + " " + b + " " + c);
  }
}

Measured memory_bytes: 26148
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll p,q,r;
  cin>>p>>q>>r;
  ll ans=p+q;
  ans=min(ans,q+r);
  ans=min(ans,r+p);
  cout<<ans<<endl;
}


Measured memory_bytes: 256
s = str(input())
if len(s)%2 == 1:
    print("No")
    exit()
for i in range(0,len(s),2):
    if s[i] == 'h' and s[i+1] == 'i':
        continue
    else:
        print("No")
        exit()
print("Yes")
# n = int(input())
# ans = 0

# for i in range(n):
#     print(i)


# print(ans)


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

const int mod = pow(10,9) + 7;

long long my_pow(int n,int k){
    long long res;

    if(k == 0)
        return 1;

    else if(k == 1)
        return n;

    else if(k % 2 == 0){
        res = my_pow(n,k/2);
        res = res * res;
    }
    else
        res = n * my_pow(n,k-1);

    return res % mod;
}

int main(){

    long long N;
    cin >> N;

    long long res = my_pow(10,N) - 2*my_pow(9,N) + my_pow(8,N);
    res %= mod;
    res = (res + mod) % mod;
    cout << res;
    return 0;
}

Measured memory_bytes: 3532
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define REPP(i,l,r,c) for (int i=l;i<r;i+=c)
#define REP(i,l,r) REPP(i,l,r,1)
#define REPS(i,l,r) REP(i,l,r+1)
#define FOR(i,n) REP(i,0,n)
#define FORS(i,n) REPS(i,1,n)
#define REPD(i,l,r) for (int i=r-1;i>=l;i--)
#define FORD(i,n) REPD(i,0,n)
#define FOREACH(x,v) for(auto x:v)
using namespace std;

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

const int INF=1E9;
const ll INFLL=1E15;
const double INFD=1E9;
const ll MOD=1E9+7;
const double EPS=1E-9;
const double PI=acos(-1.0);

inline bool between(int x,int l,int r) {
	return (l<=x && x<=r);
}

ll n,m;
ll A[100010];


int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>n>>m; FOR(i,n) cin>>A[i];
	ll ans=0; if (A[0]>m) ans+=A[0]-m, A[0]=m;
	REP(i,1,n) if (A[i]+A[i-1]>m) ans+=A[i]+A[i-1]-m, A[i]=m-A[i-1]; cout<<ans<<endl;
	return 0;	
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(){
    int a,b,c,x;
    cin >> a >> b >> c;
    if (a>b){
        x=a;
        a=b;
        b=x;
    }if (b>c){
        x=b;
        b=c;
        c=x;
    }if (a>b){
        x=a;
        a=b;
        b=x;
    } 
    cout << a << " " << b << " " << c <<endl;
    return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;





void Main(){

  int A,N;cin>>N>>A;

  cout<< ( N%500 <=A ? "Yes" : "No" )<<"\n";

}


//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int N, W,w,v;
    const int z=100*1000+1;
    cin>>N>>W;
    vector<long long>  dp(z+1,100000000001);
    dp[0]=0;
    for(int j=0;j<N;++j)
    {
        cin>>w>>v;
        for(int i=z;i>=v;--i)  dp[i]=min(dp[i],dp[i-v]+w);
    }
    for(int i=z;i>=0;--i)  if(dp[i]<=W)
    {
        printf("%d",i);
        return 0;
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>

struct UnionFind {
    std::vector<int> par, sz;
    int gnum;

    explicit UnionFind(int n)
        : par(n), sz(n, 1), gnum(n) {
        std::iota(par.begin(), par.end(), 0);
    }

    int find(int v) {
        return (par[v] == v) ? v : (par[v] = find(par[v]));
    }

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

        if (sz[u] < sz[v]) std::swap(u, v);
        sz[u] += sz[v];
        par[v] = u;
        --gnum;
    }

    bool same(int u, int v) { return find(u) == find(v); }
    bool ispar(int v) { return v == find(v); }
    int size(int v) { return sz[find(v)]; }
};

void solve() {
    std::string s;
    std::cin >> s;

    int n = s.length();
    std::vector<int> ds(n + 1, 0);
    for (int i = 0; i <= n; ++i) {
        int j = n - i - 1;
        if (j <= i) break;

        ds[i] = (int)s[i] - (int)s[j];
        if (ds[i] < 0) ds[i] += 26;
    }

    UnionFind uf(n + 1);
    int m;
    std::cin >> m;
    while (m--) {
        int l, r;
        std::cin >> l >> r;
        --l, --r;

        bool lbig = l > n - l - 1,
             rbig = r > n - r - 1;
        l = std::min(l, n - l - 1);
        r = std::min(r, n - r - 1);

        if (lbig && rbig) {
            std::swap(l, r);
            ++r;
        } else if (!lbig && rbig) {
            if (l > r) std::swap(l, r);
        } else {
            ++r;
        }
        uf.unite(l, r);
    }

    std::vector<int> nxt(n + 1, -1);
    {
        std::vector<int> prev(n + 1, -1);
        for (int i = n; i >= 0; --i) {
            int id = uf.find(i);
            nxt[i] = prev[id];
            prev[id] = i;
        }
    }

    std::vector<int> red(n + 1, 0);
    int d = 0;
    for (int i = 0; i < n; ++i) {
        (d += red[i]) %= 26;

        if (i == n - i - 1) d = 0;
        if (i >= n - i - 1) break;

        (ds[i] += d) %= 26;
        if (nxt[i] == -1) continue;

        int nd = 26 - ds[i];
        red[nxt[i]] += 26 - nd;
        (d += nd) %= 26;
        ds[i] = 0;
    }

    std::cout << (d == 0 && std::all_of(ds.begin(), ds.end(),
                                        [](auto x) { return x == 0; })
                      ? "YES"
                      : "NO")
              << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}


Measured memory_bytes: 2384
"use strict";
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

var re = /\s+|$/;
reader.on('close', () => {
    const n = Number(lines[0]);
    var a = lines[1].trim().split(re).map(Number);
    var min, max, sum;

    [min, max, sum] = aux(a);
    console.log(min.toString()+' '+max.toString()+' '+sum.toString());
});

function aux(a)
{
    return [Math.min(...a), Math.max(...a), a.reduce((s,x)=>s+x)];
}


Measured memory_bytes: 20352
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int myfind(int a, vector<int>& relation) {
    if (relation[a] == a) return a;
    int res = myfind(relation[a], relation);
    relation[a] = res;
    return res;
}

void myunion(int a, int b, vector<int>& relation) {
    int ta = myfind(a, relation);
    int tb = myfind(b, relation);
    if (ta == tb) return;
    relation[ta] = tb;
}


int main() {
    int n, m;
    cin >> n >> m;
    vector<int> v(n + 1, 0);
    vector<int> relation(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        // cin >> v[i];
        scanf("%d", &v[i]);
        relation[i] = i;
    }
    for (int i = 0; i < m; i++) {
        int a, b;
        // cin >> a >> b;
        scanf("%d%d", &a, &b);
        myunion(a, b, relation);
    }
    vector<vector<int>> um(n + 1, vector<int>(0));
    for (int i = 1; i <= n; i++) {
        int t = myfind(i, relation);
        um[t].push_back(i);
    }
    int res = 0;
    for (int i = 1; i <= n; i++) {
        if (um[i].size() == 0) continue;
        vector<int> nodes = um[i];
        unordered_map<int, int> c;
        // vector<int> c(n + 1, 0);
        for (auto node : nodes) {
            c[node]++;
            if (c[node] == 2) res++;
            c[v[node]]++;
            if (c[v[node]] == 2) res++;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 11332
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define EPS 1e-10
using namespace std;
typedef long long ll;
struct Point{
	double x,y;
	Point(double x = 0.0,double y = 0.0): x(x),y(y) {}
	Point operator + (Point p){
		return Point(x + p.x,y + p.y);
	}
	Point operator - (Point p){
		return Point(x - p.x,y - p.y);
	}
	Point operator * (double lambda){
		return Point(x * lambda,y * lambda);
	}
	Point operator / (double lambda){
		return Point(x / lambda,y / lambda);
	}
	double norm(){
		return x * x + y * y;
	}
	double abs_(){
		return sqrt(norm());
	}
	bool operator == (const Point &p)const
	{
		return abs(x - p.x) < EPS && abs(y - p.y) < EPS;
	}
	bool operator < (const Point &p)const
	{
		if(abs(x - p.x) < EPS) return y < p.y;
		else return x < p.x;
	}
};
typedef Point Vector;
struct Segment{
	Point p1,p2;
	Segment(Point p1 = Point(),Point p2 = Point()): p1(p1),p2(p2) {}
};
typedef Segment Line;
struct Circle{
	Point c;
	double r;
	Circle(Point c = Point(),double r = 0.0): c(c),r(r) {}
};
typedef vector<Point> Polygon;
double dot(Vector a,Vector b){
	return a.x * b.x + a.y * b.y;
}
double det(Vector a,Vector b){
	return a.x * b.y - b.x * a.y;
}
bool vertical(Line l1,Line l2){
	return abs(dot(l1.p2 - l1.p1,l2.p2 - l2.p1)) < EPS;
}
bool parallel(Line l1,Line l2){
	return abs(det(l1.p2 - l1.p1,l2.p2 - l2.p1)) < EPS;
}
Point proj(Point p,Line l){
	Vector a = l.p2 - l.p1;
	double r = dot(a,p - l.p1) / a.norm();
	return l.p1 + a * r;
}
int main(){
	Line l; Point p;
	scanf("%lf%lf%lf%lf",&l.p1.x,&l.p1.y,&l.p2.x,&l.p2.y);
	int t;
	scanf("%d",&t);
	while(t--){
		scanf("%lf%lf",&p.x,&p.y);
		Point A = proj(p,l);
		printf("%.10f %.10f\n",A.x,A.y);
	}
	return 0;
}



Measured memory_bytes: 3252
N, K = gets.split.map &:to_i
MOD = 10**9 + 7

(1..K).each{|n|
  blue_box = n
  blue = K - n
  red_box = blue_box + 1
  red = (N - K) - (n - 1)
  # p [blue, red]
  blue_way = [*1..blue+blue_box-1].combination(blue).size 
  red_way = [*1..red+red_box-1].combination(red).size
  p blue_way % MOD * red_way % MOD
}

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

int main()
{
    int r,c;cin>>r>>c;
    int d[r+1][c+1]={};
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            cin>>d[i][j];
            d[i][c]+=d[i][j];
            d[r][j]+=d[i][j];
            d[r][c]+=d[i][j];
        }
    }
    for(int i=0;i<r+1;i++){
        for(int j=0;j<c+1;j++){
            cout<<d[i][j];
            if(j<c)cout<<" ";
        }
        cout<<endl;
    }

}


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

using namespace std;

int main(void)
{
  int n,m; cin>>n>>m;
  int count=0;
  vector<int> array1(n+m);
  vector<int> array2(n+m);
  
  for(int i=0;i<n;i++){
    array1[i]=i*2+2;
    array2[i]=i*2+2;
  }
  
  for(int i=0;i<m;i++){
    array1[n+i]=i*2+1;
    array2[n+i]=i*2+1;
  }
  
  for(int i=0;i<n+m;i++){
    for(int j=i;j<n+m;j++){
      if((array1[i]+array2[j])%2==0){count++;}
    }
  }
  
  cout<<count-n-m<<endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define VAR(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    VAR(i64, x, y);
    if (x % y == 0) {
        print(-1);
    } else {
        print(x);
    }

    return 0;
}


Measured memory_bytes: 256
import sys
class Node:
    __slots__ = ['key', 'left', 'right']
    def __init__(self, key):
        self.key = key
        self.left = self.right = None

root = None
def delete(target):
    def remove_node(p, c, a):
        if p.left == c:
            p.left = a
        else:
            p.right = a
    p, c = None, root
    while c.key != target:
        p, c = c, c.left if target < c.key else c.right
    if c.left is None:
        remove_node(p, c, c.right)
    elif c.right is None:
        remove_node(p, c, c.left)
    elif c.right.left is None:
        c.right.left = c.left
        remove_node(p, c, c.right)
    else:
        g = c.right
        while g.left.left:
            g = g.left
        c.key = g.left.key
        g.left = g.left.right

def find(target):
    result = root
    while result and target != result.key:
        result = result.left if target < result.key else result.right
    if result is None:
        return False
    else:
        return True

def insert(key):
    global root
    y = None  # xの親
    x = root
    while x:
        y = x
        x = x.left if key < x.key else x.right
    if y is None:  # Tが空の場合
        root = Node(key)
    elif key < y.key:
        y.left = Node(key)
    else:
        y.right = Node(key)

def in_order(node):
    if node is None:
        return ''
    return in_order(node.left) + f' {node.key}' + in_order(node.right)
def pre_order(node):
    if node is None:
        return ''
    return f' {node.key}' + pre_order(node.left) + pre_order(node.right)
input()
for e in sys.stdin:
    if e[0] == 'i':
        insert(int(e[7:]))
    elif e[0] == 'd':
        delete(int(e[7:]))
    elif e[0] == 'f':
        print('yes' if find(int(e[5:])) else 'no')
    else:
        print(in_order(root))
        print(pre_order(root))


Measured memory_bytes: 56372
#include <stdio.h>
int main()
{
  int N,A,B;
  scanf("%d", &N); 
  if(N==1){
    puts("Hello World");}
  else if(N==2){ 
    scanf("%d", &A);
    scanf("%d", &B);
    printf("%d", A+B);}
  return 0;
}

Measured memory_bytes: 128
#C問題
S=str(input())
Slist=list(S)
Slen=len(Slist)
count=0
mae=""
for i in range(Slen):
    if i == 0:
        mae=Slist[0]
    else:
        if Slist[i] == mae:
            pass
        else:
            mae=Slist[i]
            count+=1
print(count)

Measured memory_bytes: 3956
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

struct Solver {
	void solve() {
		int N;
		cin >> N;

		int C[4] = {};
		for( int i = 0; i < N; ++i ) {
			string s;
			cin >> s;
			if( s == "AC" ) { C[0] += 1; }
			else if( s == "WA" ) { C[1] += 1; }
			else if( s == "TLE" ) { C[2] += 1; }
			else if( s == "RE" ) { C[3] += 1; }
		}

		cout << "AC x " << C[0] << endl;
		cout << "WA x " << C[1] << endl;
		cout << "TLE x " << C[2] << endl;
		cout << "RE x " << C[3] << endl;
	}
};

int main() {
	ios::sync_with_stdio( false );
	cout << fixed << setprecision( 10 );
	Solver().solve();
	return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
string s,t,ans="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
bool flag;
void Main(){    
    cin>>s>>t;
    vector<string> kouho;
    ll n=s.size();
    s+="*******************************************************";
    For(i,0,n){
        flag=true;
        For(j,i,i+t.size()){
            if(s.at(j)==t.at(j-i)||s.at(j)=='?'){
                continue;
            }
            else{
                flag=false;
                break;
            }
        }
        if(flag){
            string S="";
            For(j,0,i){
                if(s.at(j)=='?') S+='a';
                else S+=s.at(j);
            }
            S+=t;
            For(j,i+t.size(),n){
                if(s.at(j)=='?') S+='a';
                else S+=s.at(j);
            }
            kouho.push_back(S);
        }
    }
    if(kouho.size()){
        for(auto i:kouho){
            //cout<<i<<endl;
            ans=min(ans,i);
        }
    }
    else ans="UNRESTORABLE";
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}


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

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  int count = 0;
  for(int i = 0; i < m; ++i){
    int x; cin >> x;
    count += x;
  }
  if(count > n){
    cout << -1 << endl;
  }
  else{
    cout << n - count << endl;
  }
}

Measured memory_bytes: 3624
_, n = map(int,input().split())
itv = []
for i in range(n):
    a,b = map(int, input().split())
    itv.append([b, a])

itv.sort()

ans, x = 0, 0
for [b, a] in itv:
    if a > x:
        ans += 1
        x = b - 1

print(ans)


Measured memory_bytes: 58840
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#include <numeric>
#define IINF 1000000000
#define INF 3223372036854775807
#define MOD 1000000007
#define mod 1000000007
#define INT_MAX_ 2147483647
#define EPS (1e-10)
#define REP(i, a, n) fo-r (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
//#define rep(i,n)for (ll i = 0; i < (ll)(n); i++)
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
#define me memset
#define bit(n,k) ((n>>k)&1)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define invp(a,p)pom(a,p-2,p)
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp1(pair<ll,ll> a,pair<ll,ll> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se>b.se;
}
ll cmp(ll a,ll b){
    return abs(a)<abs(b);
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_t=clock();
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //------------------------------
    ll a,b;cin>>a>>b;
    if(a*b==15){
        cout<<"*"<<endl;
    }
    else if(a+b==15){
        cout<<"+"<<endl;
    }
    else cout<<"x"<<endl;
    //------------------------------
    //fclose(stdin);
    //fclose(stdout);
    //ll end_t=clock();cout<<"time="<<end_t-begin_t<<"ms"<<endl;
    //------------------------------- 
    return 0;
}
//----------------------------------------------------------------------






















































Measured memory_bytes: 3656
import numpy as np
a1 = np.array(list(map(int, input().split())))
a2 = np.array(list(map(int, input().split())))
a3 = np.array(list(map(int, input().split())))
a = np.concatenate([a1, a2, a3], axis=0)
n = int(input())
b = 0
for i in range(n):
  b = int(input())
  a = np.where(a == b, 0, a)

a = a.reshape((3, 3))
if (a[0,0] == 0 and a[0,1] == 0 and a[0,2] == 0):
  print('Yes')
  exit()
if (a[1,0] == 0 and a[1,1] == 0 and a[1,2] == 0):
  print('Yes')
  exit()
if (a[2,0] == 0 and a[2,1] == 0 and a[2,2] == 0):
  print('Yes')
  exit()
if (a[0,0] == 0 and a[1,0] == 0 and a[2,0] == 0):
  print('Yes')
  exit()
if (a[0,1] == 0 and a[1,1] == 0 and a[2,1] == 0):
  print('Yes')
  exit()
if (a[0,2] == 0 and a[1,2] == 0 and a[2,2] == 0):
  print('Yes')
  exit()
if (a[0,0] == 0 and a[1,1] == 0 and a[2,2] == 0):
  print('Yes')
  exit()
if (a[0,2] == 0 and a[1,1] == 0 and a[2,0] == 0):
  print('Yes')
  exit()
print('No')


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

int main() {
  int a=0,b=0,c=0,d=0,N;
  cin>>N;
  rep(i,N){
    string S;
    cin>>S;
    if(S=="AC") a++;
    if(S=="WA") b++;
    if(S=="TLE") c++;
    if(S=="RE") d++;
  }
  cout<<"AC x "<<a<<endl;
  cout<<"WA x "<<b<<endl;
  cout<<"TLE x "<<c<<endl;
  cout<<"RE x "<<d<<endl;
  
}


Measured memory_bytes: 3624
#include <cassert>
#include <cstdio>

int main() {
    float a, b, c, d, e, f;
    while(~scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)) {
        float det = a*e - b*d;
        assert(det != 0);
        float inv[2][2] = { {e / det, -b / det}, {-d / det, a / det} };
        printf("%.3f %.3f\n", (inv[0][0] * c + inv[0][1] * f), (inv[1][0] * c + inv[1][1] * f));
    }
}

Measured memory_bytes: 1068
S = input() 
l = len(S)
before = S[0]
count = 1
i = 1
while i < l:
    tmp = i
    for j in range(i+1,l+1):
        if S[i:j] != before:
            #print(S[i:j],i,j)
            count = count + 1
            before = S[i:j]
            i = j
            break
    if i == tmp:
        break
print(count)

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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    vector<bool> prime(A.back()+1, true);
    int cnt = 0;
    for (int i = 0; i < N; ++i) {
        if (i > 0 && A[i] == A[i-1]) continue;
        if (i + 1 < N && A[i] == A[i+1]) {
            int k = A[i];
            while (k <= A.back()) {
                prime[k] = false;
                k += A[i];
            }
            continue;
        }
        if (prime[A[i]]) {
            cnt++;
            int k = A[i];
            while (k <= A.back()) {
                prime[k] = false;
                k += A[i];
            }
        }
    }
    cout << cnt << endl;

}


Measured memory_bytes: 4008
S = input()
A = [0, 0, 0, 0]
for i in range(len(S)):
  if S[i] == "N":
    A[0] = 1
  elif S[i] == "S":
    A[1] = 1
  elif S[i] == "E":
    A[2] = 1
  else:
    A[3] = 1
if A[0] ^ A[1] == A[2] ^ A[3] == 0:
  print("Yes")
else:
  print("No")

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

int main(){
  int N, X;
  cin >> N >> X;
  vector<int> Ls(N);
  for(int i = 0; i < N ;i++){
    cin >> Ls.at(i);
  }
  
  int D = 0;
  int ans = 1;
  for(int i = 0; i < N ;i ++){
    D = D + Ls.at(i) ;
    if(D <= X) ans++;
  }
  
  cout << ans << endl;
  return 0; 
}

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

int main() {

    int N;
    cin >> N;

    vector<int> P(1e4);
    rep(i, N) cin >> P[i];
    vector<int> Q(1e4);
    rep(i, N) cin >> Q[i];

    vector<int> v;
    rep(i, N) v.push_back(i+1);

    int a, b;
    int i = 0;
    do {
        bool p_ok = true;
        bool q_ok = true;
        rep(j, N) {
            if (v[j] != P[j]) p_ok = false;
            if (v[j] != Q[j]) q_ok = false;
        }
        if (p_ok) a = i;
        if (q_ok) b = i;
        i++;
    } while(next_permutation(v.begin(), v.end()));

    cout << abs(a-b) << endl;

    return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
struct multi {
  ll first;
  ll second;
  ll third;
  multi(ll first, ll second, ll third)
      : first(first), second(second), third(third) {}
};
bool multicomp(const multi &a, const multi &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vl D(N);
  REP(i, N) cin >> D[i];
  sort(ALL(D));
  cout << D[N / 2] - D[(N / 2) - 1] << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll> ;
#define all(v) v.begin(),v.end()
 
int main(){
  ll A,B,C,K;cin>>A>>B>>C>>K;
  ll ans=0;
  if(K<=A) ans = K;
  else if(K<=B) ans=A;
  else if(K>=A+B) ans = A - (K-A-B);
  cout<<ans<<endl;
}

Measured memory_bytes: 3612
import sys
from operator import itemgetter
def input(): return sys.stdin.readline().rstrip()

class BinaryIndexedTree:  # 0-index !!!
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)  # 内部的には1-indexで扱う

    def add(self, i, x):  # 0-index
        i += 1  # 内部的には1-indexで扱う
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    def sum(self, i):  # 0-index  sum of [0,i)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def query(self, l, r):  # 0-index  sum of [l,r)
        return self.sum(r) - self.sum(l)

# ---------------------- #

n, q = (int(x) for x in input().split())
C = list(int(x) - 1 for x in input().split())
LR = [tuple(int(x) for x in input().split()) for _ in range(q)]

bit = BinaryIndexedTree(n)
color_right_index = [-1] * n
queries = [(i, l - 1, r - 1) for i, (l, r) in enumerate(LR)]
queries.sort(key=itemgetter(2))
ANS = [0] * q
k = 0
for i, l, r in queries:
    while k <= r and k <= n:
        color = C[k]
        if color_right_index[color] != -1:
            bit.add(color_right_index[color], -1)
        color_right_index[C[k]] = k
        bit.add(k, 1)
        k += 1
    ANS[i] = bit.query(l, r + 1)

for ans in ANS:
    print(ans)


Measured memory_bytes: 265380
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;


const ll mod = 1000000007;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
// bool debug=false;

/*---------------------------------------------------*/

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

//lcm
int lcm(int a,int b){
  if ( ( 0 == a ) || ( 0 == b ) )
    return 0;
  
  return ((a / gcd(a, b)) * b); 
}

const int MAX = 1005;

vector<int> G[MAX];
int match[MAX];
bool used[MAX];

void init() {
  for(int i = 0; i < MAX; i++) {
    G[i].clear();
    match[i] = -1;
    used[i] = false;
  }
}

bool dfs(int v) {
  used[v] = true;
  for(int i = 0; i < G[v].size(); i++) {
    int u = G[v][i], w = match[u];
    if(w < 0 || !used[w] && dfs(w)){
      match[v] = u;
      match[u] = v;
      return true;
    }
  }
  return false;
}

int bipartite_matching(int& m, int& n) {
  int ret = 0;
  for(int v = 0; v < m + n; v++) {
    if(match[v] < 0) {
      memset(used, 0, sizeof(used));
      if(dfs(v)) ret++;
    }
  }
  return ret;
}

void solve(int& m, int& n) {
  init();
  vector<int> b(m), r(n);
  for(int i = 0; i < m; i++) cin >> b[i];
  for(int i = 0; i < n; i++) cin >> r[i];
  for(int i = 0; i < m; i++) {
    for(int j = 0; j < n; j++) {
      int x = gcd(b[i], r[j]);
      if(x != 1) {
	G[i].push_back(m + j);
	G[m + j].push_back(i);
      }
    }
  }
  cout << bipartite_matching(m, n) << endl;
}

int main(){
  int m, n;
  while(cin >> m >> n) {
    if(m == 0 && n == 0) break;
    solve(m, n);
  }
}



Measured memory_bytes: 4916
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] line1 = br.readLine().split(" ");
    int indexToConvert = Integer.parseInt(line1[1]);
    
    String str = br.readLine();
    char[] chars = str.toCharArray();
    chars[indexToConvert-1] = Character.toLowerCase(chars[indexToConvert-1]);
    
    System.out.println(new String(chars));
  }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int mod = 1e9 + 7;
const int inf = 2e18;

signed main() {
    int N, K;
    cin >> N >> K;
    vector<int> p(N);
    cin >> p;
    vector<double> expected(1001, 0);
    double base = 0;
    for (int i = 1; i <= 1000; i++) {
        base += (double)i;
        expected[i] = (base / i);
    }
    vector<double> cumulative(N + 1, 0);
    for (int i = 1; i <= N; i++) {
        cumulative[i] = cumulative[i - 1] + expected[p[i - 1]];
    }
    double ans = 0;
    for (int i = 0; i + K <= N; i++) {
        ans = max(ans, cumulative[i + K] - cumulative[i]);
    }
    cout << fixed << setprecision(10) << ans << endl;
}

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

using namespace std;

#define ll long long
#define ld long double

ll q,h,s,d,n, ans;

int main() {
	cin >> q >> h >> s >> d >> n;

	h = min(h, 2*q);
	s = min(s, 2*h);
	d = min(d, 2*s);

	ans += (n/2)*d;
	if(n%2) ans+=s;

	cout << ans << endl;
}

Measured memory_bytes: 256
s = input()
t = input()
dp = [[0] * (len(s)+1) for _ in range(len(t)+1)]
for i in range(1, len(t)+1):
    ti = t[i-1]
    dp[i] = dp[i-1][:]
    for j in range(1, len(s)+1):
        if ti == s[j-1]:
            dp[i][j] = dp[i-1][j-1] + 1
        else:
            dp[i][j] = max(dp[i][j-1], dp[i-1][j])

ans = ''
sl = len(s)
tl = len(t)
while sl > 0 and tl > 0:
    if s[sl-1] == t[tl-1]:
        sl -= 1
        tl -= 1
        ans = s[sl] + ans
        continue
    if dp[tl][sl] == dp[tl][sl-1]:
        sl -= 1
    elif dp[tl][sl] == dp[tl-1][sl]:
        tl -= 1
print(ans)


Measured memory_bytes: 166280
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;

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

	//もしQが1であれば、Hello Worldと出力する。
	if (Q == 1) {
		cout << "Hello World" << endl;
	}
	//もしQが2であれば、A,Bを入力から受け取り、A+Bを出力する。
	else if (Q == 2) {
		int A, B;
		cin >> A >> B;

		int ans = A + B;
		cout << ans << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,x;
    cin >> a >> b >> x;
    if(a <= x && x <= (a+b)) cout <<"YES" << endl;
    else cout << "NO" << endl;
    
    
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define ALL(x)					(x).begin(),(x).end()
#define REP(i, n)				for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF						(int)2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int N;
	cin >> N;
	vector<int> P(N), Q(N);
	REP(i, N) cin >> P[i];
	REP(i, N) cin >> Q[i];

	// idx
	vector<int> pemiVal(N);
	REP(i, N) pemiVal[i] = i + 1;

	// 順列
	int idx = 1;
	int pNo = 0;
	int qNo = 0;
	do {
		if (P == pemiVal) pNo = idx;
		if (Q == pemiVal) qNo = idx;
		idx++;
	} while (next_permutation(pemiVal.begin(), pemiVal.end()));

	cout << abs(pNo - qNo) << endl;
	return 0;
}


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


void solve(long long N, std::vector<long long> a){
    vector<int> score(9, 0);
    int kami_cnt = 0;
    for(auto i: a){
        if(i < 400) score[0] = 1;
        else if(i >= 400 && i < 800) score[1] = 1;
        else if(i >= 800 && i < 1200) score[2] = 1;
        else if(i >= 1200 && i < 1600) score[3] = 1;
        else if(i >= 1600 && i < 2000) score[4] = 1;
        else if(i >= 2000 && i < 2400) score[5] = 1;
        else if(i >= 2400 && i < 2800) score[6] = 1;
        else if(i >= 2800 && i < 3200) score[7] = 1;
        else{
            score[8] = 1;
            kami_cnt += 1;
        }
    }
    cout << max(score[8], accumulate(score.begin(), score.end()-1, 0)) << " " << accumulate(score.begin(), score.end()-1, 0)+kami_cnt << endl;
}


int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, std::move(a));
    return 0;
}


Measured memory_bytes: 3688
#include<stdio.h>
#define N 100
int main(){
  int i,j,n,k,u,v,M[N][N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j){
        printf(" ");
      }
      printf("%d",M[i][j]);
    }
    printf("\n");
  }
  return 0;
}

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

int main() {
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
  int a,b;
  cin>>a>>b;
  int64_t c=1;
  int d=max(a,b);
  int e=min(a,b);
  rep(i,d){
    c=c*10;
  }
  c=((c-1)/9)*e;
  cout<<c;
}

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

int main(){
  
  int h, w;
  cin >> h >> w;
  
  vector<string> A(h);
  
  for(int i = 0; i < h; i++){
    cin >> A.at(i);
  }
  for(int i = 0; i < w + 2; i++){
   cout << "#";
  }
  cout << endl;
  
  for(int i = 0; i < h; i++){
    cout << "#" << A.at(i) << "#" << endl;
  }
  for(int i = 0; i < w + 2; i++)
    cout << "#";
  cout << endl;
}

Measured memory_bytes: 3580
$n = scalar(<>) - 0 ;
my @d = ();
$#d = $n - 1;
foreach my $i (0..($n-1)){
  my ($a,$b,$c) = map { $_ - 0 } split(/\s+/o,scalar(<>));
  if( $i == 0 ){
    $d[$i]->{a} = $a;
    $d[$i]->{b} = $b;
    $d[$i]->{c} = $c;
  } else {
    $d[$i]->{a} = mx( $d[$i-1]->{b} + $a , $d[$i-1]->{c} + $a );
    $d[$i]->{b} = mx( $d[$i-1]->{a} + $b , $d[$i-1]->{c} + $b );
    $d[$i]->{c} = mx( $d[$i-1]->{a} + $c , $d[$i-1]->{b} + $c );
  }
}

my $r = mx( mx( $d[$n-1]->{a} , $d[$n-1]->{b} ), $d[$n-1]->{c} );
print "$r\n";
exit(0);

sub mx {
  my $x = shift;
  my $y = shift;
  return ( $x > $y ? $x : $y );
}


Measured memory_bytes: 31108