akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
#include<cstring>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int main(){
	int n;
	long long sum=1;
	cin>>n;
	vector<ll>a(n);
	rep(i,n){
		cin>>a[i];
		if(a[i]==0){
			cout<<0;
			return 0;
		}
	}
	rep(i,n){
		if(a[i]<=1000000000000000000/sum){
			sum*=a[i];
		}else{
			cout<<-1;
			return 0;
		}
	}
	cout<<sum;


	return 0;
}

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

int main()
{
  int x, y, tmp;
  int ans;
   
  while (scanf("%d %d", &x, &y) != EOF) {
    x = abs(x);
    y = abs(y);
    if (x + y == 1) {
      ans = 1;
    } else if (!(x % 2) && !(y % 2)) {
      ans = x + y;
    } else if ((x % 2) && (y % 2)) {
      ans = x + abs(y - 1);
    } else {
      if (!x || !y) {
        ans = x + y + 1;
      } else {
        ans = x + y;
      }
    }
    printf("%d\n", ans);
  }
  
  return 0;
}



Measured memory_bytes: 2100
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();

		int cnt = 0;
		boolean bo = true;
		for (int i = a; i <= b; i++) {
			String s = String.valueOf(i);
			for (int j = 0; j < s.length() / 2; j++) {
				if (s.charAt(j) == s.charAt(s.length() - 1 - j)) {
					continue;
				} else {
					bo = false;
					break;
				}
			}
			if (bo) {
				cnt++;
			}
			bo = true;
		}
		
		System.out.println(cnt);

	}
}


Measured memory_bytes: 27348
import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	for(int i=a;;i++) {
		int e=i;
		int b=e%10;
		e/=10;
		int c=e%10;
		e/=10;
		int d=e%10;
		if(b==d&&c==d) {
			System.out.println(i);
			break;
		}
	}
	scan.close();
}
}


Measured memory_bytes: 22868
#ifndef ___GEOMETRY_LIBRARY
#define ___GEOMETRY_LIBRARY

#include <vector>
#include <algorithm>

template<class type>
class point2d {
public:
	type x, y;
	point2d() : x(type(0)), y(type(0)) {};
	point2d(type x_, type y_) : x(x_), y(y_) {};
	bool operator==(const point2d& p) { return x == p.x && y == p.y; }
	bool operator!=(const point2d& p) { return x != p.x || y != p.y; }
	point2d& operator+=(const point2d& p) { x += p.x; y += p.y; return *this; }
	point2d& operator-=(const point2d& p) { x -= p.x; y -= p.y; return *this; }
	point2d& operator*=(type val) { x *= val; y *= val; return *this; }
	point2d& operator/=(type val) { x /= val; y /= val; return *this; }
	point2d operator+(const point2d& p) const { return point2d(*this) += p; }
	point2d operator-(const point2d& p) const { return point2d(*this) -= p; }
	point2d operator*(type val) const { return point2d(*this) *= val; }
	point2d operator/(type val) const { return point2d(*this) /= val; }
	type norm() const { return x * x + y * y; }
	type abs() const { return type(std::sqrt(x * x + y * y)); }
	long double fabs() const { return std::sqrt((long double)(x * x + y * y)); }
	type dot(const point2d& p) const { return x * p.x + y * p.y; }
	type cross(const point2d& p) const { return x * p.y - y * p.x; }
	int ccw(const point2d& p1, const point2d& p2) const {
		// Centering at point p, p1 -> p2 is COUNTER-CLOCKWISE : (1)
		// Centering at point p, p1 -> p2 is CLOCKWISE : (-1)
		// Collinear with order p1 -> p -> p2 : (2)
		// Collinear with order p -> p1 -> p2 : (-2)
		// Collinear with order p -> p2 -> p1 : (0)
		point2d pr1 = p1 - point2d(*this);
		point2d pr2 = p2 - point2d(*this);
		if (pr1.cross(pr2) != 0) return pr1.cross(pr2) > 0 ? 1 : -1;
		if (pr1.dot(pr2) < 0) return 2;
		return pr1.norm() < pr2.norm() ? -2 : 0;
	}
};

template<class type>
class segment2d {
public:
	point2d<type> p1, p2;
	segment2d() : p1(point2d<type>()), p2(point2d<type>()) {};
	segment2d(const point2d<type>& p1_, const point2d<type>& p2_) : p1(p1_), p2(p2_) {};
	type norm() const { return (p1 - p2).norm(); }
	type abs() const { return (p1 - p2).abs(); }
	long double fabs() const { return (p1 - p2).fabs(); }
};

// FIND THE INTERSECTION POINT OF "LINE" S1 AND S2
template<class type>
point2d<type> intersect_point(const segment2d<type>& s1, const segment2d<type>& s2) {
	point2d<type> vec = s1.p2 - s1.p1;
	type d1 = vec.cross(s2.p1 - s1.p1);
	type d2 = vec.cross(s2.p2 - s1.p1);
	return s2.p1 + (s2.p2 - s2.p1) * d1 / (d1 - d2);
}

#endif // ___GEOMETRY_LIBRARY

#include <iostream>
using namespace std;
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int q;
	cin >> q;
	cout.precision(15);
	for (int i = 0; i < q; ++i) {
		segment2d<double> s1, s2;
		cin >> s1.p1.x >> s1.p1.y >> s1.p2.x >> s1.p2.y >> s2.p1.x >> s2.p1.y >> s2.p2.x >> s2.p2.y;
		point2d<double> ans = intersect_point(s1, s2);
		cout << ans.x << ' ' << ans.y << "\n";
	}
	return 0;
}


Measured memory_bytes: 3304
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    vector<int> a(n), b;
    for(int i = 0; i < n; i++) cin >> a[i];
    string s; cin >> s;
    auto check = [&](int x){
        vector<int> c = a;
        for(int & v : c) v = v >= x;
        vector<int> kind, size;
        for(int i = 0, j = 0; i < n; i = j){
            while(j < n && c[i] == c[j]) j++;
            kind.push_back(c[i]);
            size.push_back(j - i);
        }
        size[0] += n;
        size.back() += n;
        int sz = kind.size();
        vector<int> nxt(sz), prv(sz);
        set<pair<int,int>> vals[2];
        for(int i = 0; i < sz; i++){
            nxt[i] = i + 1;
            prv[i] = i - 1;
            vals[kind[i]].insert({size[i], i});
        }
        auto aug = [&](int p){
            if(prv[p] >= 0) nxt[prv[p]] = nxt[p];
            if(nxt[p] < sz) prv[nxt[p]] = prv[p];
        };
        int delta[2] = {};
        int len = s.size();
        for(int i = 0; i < len; i++){
            int p = s[i] == 'm';
            delta[p]--;
            delta[p^1]++;
            while(!vals[p].empty()){
                int x, y; tie(x, y) = *vals[p].begin();
                if(x + delta[p] > 0) break;
                vals[p].erase(vals[p].begin());
                vals[p ^ 1].erase({size[prv[y]], prv[y]});
                vals[p ^ 1].erase({size[nxt[y]], nxt[y]});
                size[prv[y]] += size[nxt[y]] + delta[p ^ 1];
                vals[p ^ 1].insert({size[prv[y]], prv[y]});
                aug(y);
                aug(nxt[y]);
            }
            if(kind[0] != p){
                vals[kind[0]].erase({size[0], 0});
                size[0]--;
                vals[kind[0]].insert({size[0], 0});
            }
        }
        int has = 0;
        for(int i = 0; i < sz; i = nxt[i]){
            has += size[i] + delta[kind[i]];
            if(has > n) return kind[i];
        }
        return 0;
    };
    b = a;
    sort(b.begin(), b.end());
    b.erase(unique(b.begin(), b.end()), b.end());
    int len = b.size();
    int lo = 0, hi = len - 1, ans = 0;
    while(lo <= hi){
        int mid = (lo + hi)>>1;
        if(check(b[mid])) ans = mid, lo = mid + 1;
        else hi = mid - 1;
    }
    cout << b[ans] << endl;
    return 0;
}

Measured memory_bytes: 4732
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int _b=(b),i=(a);i<_b;++i)
#define ROF(i,b,a) for(int _a=(a),i=(b);i>_a;--i)
#define REP(n) for(int _n=(n);_n--;)
#define _1 first
#define _2 second
#define PB(x) push_back(x)
#define SZ(x) int((x).size())
#define ALL(x) (x).begin(),(x).end()
#define MSET(m,v) memset(m,v,sizeof(m))
#define MAX_PQ(T) priority_queue<T>
#define MIN_PQ(T) priority_queue<T,vector<T>,greater<T>>
#define IO(){ios_base::sync_with_stdio(0);cin.tie(0);}
#define nl '\n'
#define cint1(a) int a;cin>>a
#define cint2(a,b) int a,b;cin>>a>>b
#define cint3(a,b,c) int a,b,c;cin>>a>>b>>c
typedef long long LL;typedef pair<int,int> PII;
typedef vector<int>VI;typedef vector<LL>VL;typedef vector<PII>VP;
template<class A,class B>inline bool mina(A &x,const B &y){return(y<x)?(x=y,1):0;}
template<class A,class B>inline bool maxa(A &x,const B &y){return(x<y)?(x=y,1):0;}
 
#define MAXN ()
 
int D[10];
 
int main()
{
	IO();
	cint2(N,K);
	REP(K)
	{
		cint1(a);
		D[a] = 1;
	}
 
	for(int n = N; 1; ++n)
	{
		int a = n;
		int v = 1;
		while(a > 0)
		{
			int d = a % 10;
			a /= 10;
			if(D[d])
			{
				v = 0;
				break;
			}
		}
		if(v)
		{
			cout << n << nl;
			return 0;
		}
	}
 
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";
/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, E, F, K,L, W, H, P, Q, R, X, Y;
  ll ans;
  string S, T;
  cin >> S;
  if (S == "Sunny") cout << "Cloudy" << endl;
  else if (S == "Cloudy") cout << "Rainy" << endl;
  else if (S == "Rainy") cout << "Sunny" << endl;




}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{

    long long a,b,c,d,i;
 cin>>a>>b;
cin>>c>>d;
while(1)
{
    c=c-b;
    if(c<=0)
    {
        cout<<"Yes"<<endl;
        break;
    }
    a=a-d;
    if(a<=0)
    {
        cout<<"No"<<endl;
        break;
    }

}

}


Measured memory_bytes: 3596
#include<stdio.h> 
int main(){ 
    int n,i,max,a,x,sum=0,fsum;
    scanf("%d",&n);
    for(i=0,a=0,max=a;i<n;i++){
        scanf("%d",&x);
        sum+=x;
        if(x>max){
            max=x;
            
        }
        
    }
    fsum=sum-(max/2);
    printf("%d",fsum);
    
    
    
     return 0; 
    }

Measured memory_bytes: 1720
#include <iostream>
#include <unordered_set>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    unordered_set<char> d;
    for (int i = 0; i < k; ++i) {
        char c;
        cin >> c;
        d.insert(c);        
    }

    for (int i = n; ; ++i) {
        int m;
        for (m = i; m > 0; m /= 10) {
            char c = m % 10 + '0';
            if (d.find(c) != d.end()) {
                break;
            }
        }
        if (m == 0) {
            cout << i << '\n';
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
from collections import Counter


N = int(input())
S = [input() for _ in range(N)]

c = Counter(S)

max_ = 0

x = []
for k, v in c.items():
    max_ = max(max_, v)
    x.append([k, v])

x.sort(key=lambda x: (-x[1], x[0]))


for k, v in x:
    if v == max_:
        print(k)

    if v != max_:
        exit()


Measured memory_bytes: 68332
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);

		int W,H,N;
		W = sc.nextInt();
		H = sc.nextInt();
		N = sc.nextInt();

//		System.out.println("");
//		System.out.println(W+" "+ H + " " + N);

		int x[] = new int[N];
		int y[] = new int[N];
		int a[] = new int[N];

		int xy[][] = new int[H][W];

		for(int i=0; i<N; i++){
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
			a[i] = sc.nextInt();
		}

		for(int i=0; i<N; i++){

//			System.out.print(x[i]+" "+ y[i] + " " + a[i] +" -> ");

			int temp = 0;
			if(a[i] == 1){
				for(int j=0;j<H;j++){
					for(int k=0; k<x[i];k++){
						xy[j][k] = 1;
						temp++;
					}
				}
			}
			else if(a[i] == 2){
				for(int j=0;j<H;j++){
					for(int k=x[i]; k<W;k++){
						xy[j][k] = 1;
						temp++;
					}
				}

			}
			else if(a[i] == 3){
				for(int j=0;j<y[i];j++){
					for(int k=0;k<W;k++){
						xy[j][k] = 1;
						temp++;
					}
				}

			}
			else {
				for(int j=y[i]; j<H; j++){
					for(int k=0;k<W;k++){
						xy[j][k] = 1;
						temp++;
					}
				}
			}
//			System.out.println("temp="+temp);

		}


		int ttl=0;
		for(int i=0; i<H; i++){
			for (int j=0; j<W; j++){
				ttl = ttl + xy[i][j];
//				System.out.print("xy["+i+"]["+j+"] = "+xy[i][j]+" ");
			}
//			System.out.println("");
		}

		System.out.println(W*H-ttl);





	}
}


Measured memory_bytes: 11040
n = int(input())
nodes = [[] for _ in range(n)]
length = [-1]*n
for _ in range(n-1):
    ui, vi, wi = list(map(int, input().split()))
    nodes[ui-1].append((vi-1, wi%2))
    nodes[vi-1].append((ui-1, wi%2))

stack = []
stack.append(nodes[0][0])
while stack:
    current = stack.pop(-1)
    if length[current[0]] != -1:
        continue
    length[current[0]] = current[1]
    for nextnode in nodes[current[0]]:
        if length[nextnode[0]] != -1:
            continue
        stack.append([nextnode[0],(current[1]+nextnode[1])%2])
for i in length:
    print(i)

Measured memory_bytes: 39500
object Main extends App {
  var get = readLine
  var a,b,sum,sum2 = 0
  var white = '0'
  var black = '1'
  for(i <- 0 until get.size){
    if(white != get(i))
    	sum = sum + 1
    if(white=='0') {
      white='1'
    }
    else {
      white='0'
    }
    if(black != get(i))
    	sum2 = sum2 + 1
    if(black=='0') {
      black='1'
    }
    else {
      black='0'
    }
  }
  println(math.min(sum,sum2))
}

Measured memory_bytes: 27200
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define RFOR(i, a, b) for(int i = a; i >= b; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
const int INF = 1e9;
typedef long long ll;
using namespace std;
typedef pair<int, int> P;
int main() {
    int H, W;
    cin >> H >> W;
    char map[H][W];
    int reached[H][W];
    int dx[] = {1, 0, -1, 0};
    int dy[] = {0, 1, 0, -1};
    int sharp_cnt = 0;
    REP(i, H) {
        REP(j, W) {
            cin >> map[i][j];
            reached[i][j] = -1;
            if(map[i][j] == '#') sharp_cnt++;
        }
    }
    int gx = W - 1;
    int gy = H - 1;
    queue<P> q;
    q.push(P(0, 0));
    reached[0][0] = 0;
    bool flag = false;
    while(q.size()) {
        P p = q.front();
        q.pop();
        int py = p.first;
        int px = p.second;
        if(px == gx && py == gy) {
            flag = true;
            break;
        }
        REP(i, 4) {
            int nx = px + dx[i];
            int ny = py + dy[i];
            if(nx >= 0 && nx < W && ny >= 0 && ny < H && map[ny][nx] == '.' && reached[ny][nx] == -1) {
                q.push(P(ny, nx));
                reached[ny][nx] = reached[py][px] + 1;
            }
        }
    }
    if(reached[gy][gx] == -1) cout << -1 << endl;
    else cout << (H*W - reached[gy][gx] - sharp_cnt - 1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))
#define MINC(c, x) (c = min(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

const ll INF = 1e9;

template<typename F> double bsearch(double ok, double ng, ll loop, F f) {
	REP(i, loop) {
		double middle = (ok + ng) / 2;
		(f(middle) ? ok : ng) = middle;
	}
	return ok;
}


int main() {
	#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
	#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);
	ll a, b, c; cin >> a >> b >> c;
	using P = tuple<ll, ll, ll>;
	set<P> dict;
	dict.insert(P{a,b,c});
	ll cnt = 0;
	REP (i, TEN(6)) {
		if (a%2 == 1 || b%2 == 1 || c%2 == 1) {
			cout << cnt << endl;
			return 0;
		}
		cnt++;
		ll d = (b + c) / 2;
		ll e = (a + c) / 2;
		ll f = (a + b) / 2;
		if (dict.find(P{d,e,f}) != dict.end()) {
			cout << -1 << endl;
			return 0;
		}
		dict.insert(P{ d,e,f });
		a = d, b = e, c = f;
	}
	cout << -1 << endl;
	return 0;
}


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

int main(){
	int x, a, b;
	cin >> x >> a >> b;
	if(abs(x-a)<abs(x-b))	cout << "A" << endl;
	if(abs(x-a)>abs(x-b))	cout << "B" << endl;
	
	return 0;
}


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

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vi h(n);
    for (int i=0; i<n; i++) {
        cin >> h[i];
    }
    vi dp(n);
    dp[n-2] = abs(h[n-1] - h[n-2]);
    for (int i=n-3; i>=0; i--) {
        dp[i] = min(dp[i+1]+abs(h[i]-h[i+1]),
                    dp[i+2]+abs(h[i]-h[i+2]));
    }
    cout << dp[0] << '\n';
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n, m, q;
    cin >> n >> m >> q;
    vector<vector<int>> vlr(n+1,vector<int>(n+1));

    REP(i,m) {
        int l, r;
        cin >> l >> r;
        vlr[l][r]++;
    }

    vector<vector<int>> slr(n+1,vector<int>(n+1));
    FOR(i,1,n+1) FOR(j,1,n+1) {
        slr[i][j] = slr[i][j-1] + vlr[i][j]; 
    }


    REP(i,q) {
        int l, r;
        cin >> l >> r;
        int ans = 0;
        FOR(i,l,r+1) ans += slr[i][r] - slr[i][l-1];
        cout << ans << '\n';
    }

    return 0;
}

Measured memory_bytes: 2944
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
#define ll long long
const int maxlg=65;
const int maxn=2e5+5;
int jp[maxlg][maxn];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n; ll k;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>jp[0][i];
    for(int lg=1;lg<=60;lg++)
        for(int i=1;i<=n;i++)
            jp[lg][i]=jp[lg-1][jp[lg-1][i]];
    int cur=1;
    for(int lg=0;lg<=60;lg++)
        if((k>>lg)&1)
            cur=jp[lg][cur];
    cout<<cur<<"\n";
    return 0;
}


Measured memory_bytes: 51312
object Main extends App {
  val input = scala.io.StdIn.readLine().split(" ").map(_.toInt)
  val N = input(0)
  val total = input(1)

  for (x <- 0 to N; y <- 0 to N - x) {
    val z = N - x - y
    if (x * 10000 + y * 5000 + z * 1000 == total) {
      println(s"$x $y $z")
      sys.exit
    }
  }
  println(s"-1 -1 -1")
}


Measured memory_bytes: 27464
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define f(i,a,b) for(int i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define all(a) a.begin(),a.end()
#define size(s) s.size()
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using si = stack<LL>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using v_pi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

#pragma endregion 

/*****************************************************************************/

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

	double a, b;
	cin >> a >> b;
	cout << fixed << setprecision(10) << a / b;
	return 0;
}

Measured memory_bytes: 256
H, X = map(int, input().split())
h, w = map(int, input().split())

l = [[0 for i in range(X)] for j in range(H)]

for i in range(h):
    for j in range(X):
        l[i][j]=1

for i in range(H):
    for j in range(w):
        l[i][j]=1
        
print(sum(x.count(0) for x in l))

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

typedef long long ll;
const int N = 55;
const int M = 1000000007;

int n, m;
int a[N];
ll dp[N][N][N * N];

int main() {
  while (~scanf("%d%d", &n, &m)) {
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    dp[0][0][0] = 1;
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j <= i; j++) {
        for (int k = N * N - 1; k >= 0; k--) {
          dp[i][j][k] += dp[i - 1][j][k];
          if (j && k >= a[i]) { dp[i][j][k] += dp[i - 1][j - 1][k - a[i]]; }
        }
      }
    }
    ll sum = 0;
    for (int j = 1; j <= n; j++) {
      sum += dp[n][j][m * j];
    }
    printf("%lld\n", sum);
  }
}


Measured memory_bytes: 71808
#include <bits/stdc++.h>
using namespace std;
 
#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	string s;
  cin >> s;
  if(s[2] == s[3] && s[4] == s[5]){
    cout << "Yes" <<endl;
  }else{
cout << "No" << endl;
    }
}
  

Measured memory_bytes: 3580
import java.util.Arrays;
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String[] tmp = scanner.nextLine().split(" ");
		int n       = Integer.parseInt(tmp[0]);
		int m       = Integer.parseInt(tmp[1]);
		int x       = Integer.parseInt(tmp[2]);

		int[][] cst = new int[n][m + 1];
		for(int i = 0; i < cst.length; i++) {
			String[] temp = scanner.nextLine().split(" ");

			for(int j = 0; j < temp.length; j++) {
				cst[i][j] = Integer.parseInt(temp[j]);
			}
		}

		int[] lst   = new int[m];
		Arrays.fill(lst, 0);
		boolean flg = true;
		int ans     = Integer.MAX_VALUE;
		int amo     = 0;

		for(int i = 0; i < 1 << n;i++) {

			//lstへの数値入力
			for(int j = 0; j < cst.length; j++) {
				if(((i >> j) & 1) == 1) {
					amo += cst[j][0];

					for(int k = 0; k < m; k++) {
						lst[k] += cst[j][k+1];
					}
				}
			}

			//x以上か判定
			for(int a : lst) {
				if(a < x) {
					flg = false;
					break;
				}
			}

			//最小か判定
			ans = flg ? Math.min(ans, amo) : ans;

			flg = true;
			amo = 0;
			Arrays.fill(lst, 0);
		}

		if(ans == Integer.MAX_VALUE) {
			System.out.println(-1);
		}else {
			System.out.println(ans);
		}

	}
}

Measured memory_bytes: 36708
N = int(input())
char = [i for i in range(97, 97+26)]
a_n = 96
base = 26
base_list = []
ans = ''

while N > 0:
    add = N % 26
    if add==0:
        add=26
    ans += chr(a_n+add)
    N = (N-1) // 26
#     # base_list += [base]
#     # base = base + base*26

# base = 26
# # cumsum = 0
# for b in enumerate(base_list):
#     ans += chr(a_n+(N%base))
#     N = (N-base)
#     base = base*26
#     # print(N)
# ans += chr(a_n+N%base)
# print(base_list)
print(ans[::-1])
# if N < 

Measured memory_bytes: 61776
n, c, k=map(int,input().split())
bus=1
pssgr=0
fst_pssgr=0
t_lst=[]
for i in range(n):
    t=int(input())
    t_lst.append(t)

t_lst.sort()

for i in range(n):
    if t_lst[i]-t_lst[fst_pssgr]>k:
        bus+=1
        pssgr=1
        fst_pssgr=i
        continue
    pssgr+=1
    if pssgr==c and i<n-1:
        bus+=1
        pssgr=0
        fst_pssgr=i+1

print(bus)

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

int main(){
    char x;
    cin >> x;
    char y;
    cin >> y;
    if(x > y) cout << ">" << endl;
    if(x == y) cout << "=" << endl;
    if(x < y) cout << "<" << endl;
}


Measured memory_bytes: 256
import sys


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


sys.setrecursionlimit(1000000)
mod = 1000000007


# A
def A():
    return


# B
def B():
    n, k = LI()
    h = LI()
    ans = 0
    for i in h:
        if i >= k:
            ans += 1
    print(ans)
    return


# C
def C():
    return


# D
def D():
    return


# E
def E():
    return


# F
def F():
    return


def resolve():
    B()
    return


# Solve
if __name__ == "__main__":
    B()

Measured memory_bytes: 49904
#include <iostream>
#include <cmath>
#include <algorithm>
#include<cmath>
#include <vector>
typedef long long ll;
using namespace std;
int dp[100005] , vis[100005];
vector<int>graph[100005];
void dfs(int node)
{
    vis[node] = 1;
    for (auto child : graph[node])
    {
        if (!vis [child])
            dfs(child);
        dp[node] = max(dp[child] + 1, dp[node]);
    }
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, e,ans=0,u,v;
    cin >> n >> e;
    while (e--)
    {
        cin >> u >> v;
        graph[u].push_back(v);
    }
    for (int i = 1; i <= n; i++)
    {
        if (!vis[i])
            dfs(i);
    }
    for (int i = 1; i <= n; i++)
        ans = max(dp[i], ans);
    cout << ans;
    return 0;
}

Measured memory_bytes: 8576
#include<iostream>
#include<tuple>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
using namespace std;

#define INF ((int)(1e9))
#define MAX 110000

int n, k, a, q;
set<int> se;

int main(){
	cin>>n;
	
	for(int i = 0; i < n; i++){
		cin>>a;
		se.insert(a);
	}
	
	cin>>q;
	
	for(int i = 0; i < q; i++){
		cin>>k;
		cout<<se.count(k)<<endl;
	}
	return 0;
}


Measured memory_bytes: 7756
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cstring>
using namespace std;
typedef long long ll;
#define mod 2147493647
#define maxn 20007
#define maxm 200007
int aa; char ch; int F() {
	while (ch = getchar(), ch < 48 || ch>57); aa = ch - 48;
	while (ch = getchar(), ch > 47 && ch < 58)aa = aa * 10 + ch - 48; return aa;
}
struct edge {
	int u = 0, v = 0, next = -1;
	edge() {}
	edge(int u, int v) :u(u), v(v) {}
	bool operator <(const edge &a) const {
		if (this->u == a.u)
			return this->v < a.v;
		return this->u < a.u;
	}
};
int fi[maxn];
edge G[maxm];
int id = 0, id1 = 0, id2 = 0;
int vis[maxn];
int fa[maxn];
int dfn[maxn];
int low[maxn];
int nn[maxn];
edge ee[maxm];
void dfs(int u) {
	static int counter = 0;
	int children = 0;
	vis[u] = 1;
	dfn[u] = low[u] = ++counter;

	for (int p = fi[u]; G[p].v != 0; p = G[p].next) {
		int v = G[p].v;
		if (!vis[v]) {
			children++;
			fa[v] = u;
			dfs(v);

			low[u] = min(low[u], low[v]);
			if (fa[u] == 0 && children > 1) {
				nn[u] = 1;
			}
			if (fa[u] != 0 && low[v] >= dfn[u]) {
				nn[u] = 1;
			}
			if (low[v] > dfn[u]) {
				if (u > v)
					ee[id2++] = edge(v, u);
				else
					ee[id2++] = edge(u, v);
			}
		}
		else if (v != fa[u]) {
			low[u] = min(low[u], dfn[v]);
		}
	}
}
int main() {
	int n, m;
	n = F(), m = F();
	int u, v;
	memset(vis, 0, sizeof vis);
	for (int i = 0; i < m; i++) {
		u = F(), v = F();
		G[++id].next = fi[u], G[id].v = v, fi[u] = id;
		G[++id].next = fi[v], G[id].v = u, fi[v] = id;
	}
	fa[1] = 0;
	dfs(1);
	printf("%d\n",id2);
	return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>; // グラフ型
using pint = pair<int, int>;

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> D(K);
    vector<int> P(N, 1);
    vector<vector<int>> A(vector<int>);
    REP(i, K)
    {
        int d;
        cin >> d;
        REP(j, d)
        {
            int a;
            cin >> a;
            a--;
            P[a] = 0;
        }
    }
    int ans = 0;
    REP(i, N)
    {
        ans += P[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main() {
  vector<int> n(3);
  cin >> n[0] >> n[1] >> n[2];
  sort(n.begin(), n.end());
  int d = n[2] - n[1];
  n[0] += d;
  if ((n[2] - n[0]) % 2 == 0) {
    cout << d + (n[2] - n[0]) / 2;
  } else {
    cout << d + (n[2] + 1 - n[0]) / 2 + 1;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<functional>
#include<unordered_map>
#include<map>
#include<tuple>
#include<utility>
using namespace std;
int main(int argc, char *argv[])
{
  string s;
  cin >> s;
  const int n = s.size();
  vector<int> ds;
  int sum = 0;
  long long prod = 1;
  for(int i = 0; i < n; i++) {
    ds.push_back(s[i]-'0');
    sum += ds.back();
    prod *= (ds.back() + 1);
  }
  // struct myhash : public std::unary_function<pair<long long,int>, std::size_t> {
  //   std::size_t operator()(const pair<long long,int>& k) const {
  //     return ((std::get<0>(k) & 0xffffffff) + ((std::get<0>(k) >> 32) & 0xffffffff))  + std::get<1>(k);
  //   }
  // };
  // vector<vector<unordered_map<pair<long long,int>,long long,myhash>>> mem(n+1, vector<unordered_map<pair<long long,int>,long long,myhash>>(10*n));
  vector<vector<map<pair<long long,int>,long long>>> mem(n+1, vector<map<pair<long long,int>,long long>>(10*n));

  function<long long(int,int,long long,int)> rec = [n,sum,prod,&ds,&rec,&mem](int k, int s, long long p, int cmp) {
    auto pcmp = make_pair(p,cmp);
    auto it = mem[k][s].find(pcmp);
    if(it != mem[k][s].end()) return it->second;
    long long cnt = 0;
    if(k == n) {
      if(s < sum
         || ((s == sum) && (p < prod))
         || ((s == sum) && (p == prod) && (cmp < 0))) cnt = 1;
      else cnt = 0;
    } else {
      // k-th digit
      for(int d = 0; d < 10; d++) {
        if(s + d > sum) break; // no more
        int dd = d - ds[k];
        if(dd < 0) dd = -1;
        if(dd > 0) dd = 1;
        cnt += rec(k+1, s+d, p*(d+1), cmp == 0 ? dd : cmp);
      }
    }
    mem[k][s][pcmp] = cnt;
    return cnt;
  };
  cout << rec(0, 0, 1, 0) << endl;
  
  return 0;
}




Measured memory_bytes: 55200
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


ll bit[300010][70];
ll sbit[300010][70];

class DXorSum4 {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll mod = 1e9+7;
        int n;
        in >> n;
        vector<ll> a(n, 0);
        rep(i, n){
            in >> a[i];
            for(int j=0; j<60; j++){
                if(a[i] & 1LL<<j) bit[i][j] = 1LL;
                else bit[i][j] = 0LL;
            }
        }
        Fill(sbit[0], 0LL);
        rep(i, n){
            rep(j, 60) {
                sbit[i + 1][j] = sbit[i][j] + bit[i][j];
            }
        }

        ll res = 0;
        reps(i, 1, n-1){
            ll sum = 0;
            rep(j, 60){
                ll bnum = sbit[n][j] - sbit[i][j];
                if(a[i-1] & 1LL << j){
                    bnum = n - i - bnum;
                }
                res += (1LL << j) % mod * bnum;
                //out << (1LL << j) << endl;
                res %= mod;
            }
            res %= mod;
        }

        out << res << endl;
	}
};


int main() {
	DXorSum4 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 330752
#include <iostream>

int main()
{
    int N;
    std::cin >> N;

    while (N > 0) {
        if (N % 10 == 7) {
            std::cout << "Yes";
            return 0;
        }
        N /= 10;
    }
    std::cout << "No";

    return 0;
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll N;
    string S;
    cin >> N;
    vector<ll> x(N),y(N);
    REP(i,N){
        cin >> x.at(i) >> y.at(i);
    }

    vector<ll> a(N),b(N);
    REP(i,N){
        a.at(i) = x.at(i) + y.at(i);
        b.at(i) = x.at(i) - y.at(i);
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    ll tmp1 = a.at(N - 1) - a.at(0);
    ll tmp2 = b.at(N - 1) - b.at(0);

    cout << max(tmp1,tmp2) << endl;


}


Measured memory_bytes: 9528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
vector<string> v;
ll nn;
void dfs(string s,ll n){
if(s.size()==nn)v.push_back(s);
else{
  rep(i,n){
    char b='a'+i;
    dfs(s+b,n);
  }
    char b='a'+n;
    dfs(s+b,n+1);
}
}

int main()
{
cin >> nn ;
dfs("a",1);
sort(v.begin(),v.end());
for(auto an:v)cout << an << endl;
return 0;
}

Measured memory_bytes: 7796
#include<stdio.h>
int main(){
        int H[300],W[300],i=0,j,k;

        while(1){
        scanf("%d%d",&H[i],&W[i]);
        if(H[i]==0&&W[i]==0){
            break;
        }
        i++;
    }

    i=0;
    while(H[i]!=0&&W[i]!=0||H[i]!=0&&W[i]==0||H[i]==0&&W[i]!=0){
        for(j=0;j<H[i];j++){
            for(k=0;k<W[i];k++){
                if(j%2==0&&k%2==0||j%2!=0&&k%2!=0){
                    printf("#");
                }else{
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
        i++;
    }

    return 0;

}

Measured memory_bytes: 572
#include <iostream>
using namespace std;
#define NIL -1
#define MAX 26

struct Node {
    int p, l, r;
};
Node T[MAX];

// Preorder Tree Walk
void preParse(int id) {
    if (id == NIL) return;
    cout << " " << id;
    preParse(T[id].l);
    preParse(T[id].r);
}

// Inorder Tree Walk
void inParse(int id) {
    if (id == NIL) return;
    inParse(T[id].l);
    cout << " " << id;
    inParse(T[id].r);
}

// Postorder Tree Walk
void postParse(int id) {
    if (id == NIL) return;
    postParse(T[id].l);
    postParse(T[id].r);
    cout << " " << id;
}

void printTree(int r) {
    cout << "Preorder" << endl;
    preParse(r);
    cout << endl;
    cout << "Inorder" << endl;
    inParse(r);
    cout << endl;
    cout << "Postorder" << endl;
    postParse(r);
    cout << endl;
}

int main() {
    int n, id, l, r, i;

    cin >> n;
    for (i=0; i < n; i++) T[i].p = T[i].l = T[i].r = NIL;
    
    for (i=0; i < n; i++) {
        cin >> id >> l >> r;
        T[id].l = l;
        T[id].r = r;
        if (l != NIL) T[l].p = id;
        if (r != NIL) T[r].p = id;
    }

    for (i=0; i < n; i++) {
        if (T[i].p == NIL) r = i;
    }
    printTree(r);

    return 0;
}


Measured memory_bytes: 3084
n = int(input())
a = [int(input()) for i in range(n)]

sorted_a = list(sorted(a,reverse=True))

ans_a = []

for i in a:
    if i == sorted_a[0]:
        ans_a.append(sorted_a[1])
    
    else:
        ans_a.append(sorted_a[0])

for i in ans_a:
    print(i)

Measured memory_bytes: 15724
#include<bits/stdc++.h>
using namespace std ;
int main() {
    
    int N , A , B ;
    cin >> N >> A >> B ;
    if(A + B <= N )
        cout<<min(A , B)<<" "<<0<<endl;
    else cout<<min(A,B)<<" "<<A+B-N<<endl;
    return 0 ;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

ll N,T;
ll A[3010];
ll B[3010];
ll dp[3010][3010][2];

int main ()
{
    cin >> N >> T;
    REP(i,N) cin >> A[i] >> B[i];

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 3010; j++) {
            for (int k = 0; k < 2; k++) {
                dp[i + 1][j][k] = dp[i][j][k];
            }
        }
        for (int j = 0; j <= T; j++) {
            dp[i + 1][j][1] = max(dp[i + 1][j][1], dp[i][j][0] + B[i]);
            if (j - A[i] >= 0) {
                dp[i + 1][j][0] = max(dp[i][j - A[i]][0] + B[i], dp[i + 1][j][0]);
                dp[i + 1][j][1] = max(dp[i][j - A[i]][1] + B[i], dp[i + 1][j][1]);
            }
        }
    }

    ll ans = 0;
    for (int i = 0; i < T; i++) {
        ans = max(ans, dp[N][i][0]);
        ans = max(ans, dp[N][i][1]);
    }

    cout << ans << endl;

    return 0;
}


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

  string s,str;
  int sum = 0;
  while(cin >> s){
    str = s;
    for(int i=0;i<(str.size()-1-i);i++) swap(str[i],str[str.size()-1-i]);
    if(str==s) sum++;

  }
  cout << sum << endl;
  return (0);
}

Measured memory_bytes: 3012
import std.stdio,std.string,std.conv,std.algorithm;
void main(){
	while(1){
		auto rd = readln().chomp();
		if(rd){
			auto v = to!double( rd );
			auto t = v/9.8;
			auto y = 4.9*t*t;
			for(int i=1;i<100000;i++){
				if( y <= 5*i-5 ){
					writeln(i);
					break;
				}
			}
		}else{
			break;
		}
	}
}

Measured memory_bytes: 1068
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(n==0) 
			break;
		int da[22][22]={};
		int x,y;
		for(int i=0;i<n;i++){
			cin>>x>>y; 
			da[y][x]=1;
		}
		int m;
		cin>>m;
		char v;
		int l;
		int nx=10,ny=10;
		for(int i=0;i<m;i++){
			cin>>v;
			cin>>l;
			if(v=='N'){
				for(int j=1;j<=l;j++)
					da[ny+j][nx]=0;
				ny+=l;
			}
			if(v=='E'){
				for(int j=1;j<=l;j++)
					da[ny][nx+j]=0;
				nx+=l;
			}
			if(v=='S'){
				for(int j=1;j<=l;j++)
					da[ny-j][nx]=0;
				ny-=l;
			}
			if(v=='W'){
				for(int j=1;j<=l;j++)
					da[ny][nx-j]=0;
				nx-=l;
			}
		}
		for(int i=0;i<22;i++){
			for(int j=0;j<22;j++){
				if(da[i][j]==1){
					cout<<"No"<<endl;
					j=30; 
					i=30;
					break;
				}
			}
			if(i==21)
				cout<<"Yes"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1156
/*
	Auth: Loxilante
	Time: 2020/09/19
	Prog: ABC179B
	Lang: cpp
*/
#ifdef ONLINE_JUDGE
#pragma GCC optimize("O3")
#endif
#include <bits/extc++.h>
#define rep(i, l, r) for(int i = l; i < r; i++)
#define hrp(i, l, r) for(int i = l; i <= r; i++)
#define rev(i, r, l) for(int i = r; i >= l; i--)
#define ms(n, t) memset(n, t, sizeof(n))
#define pb push_back
#define int ll
#ifndef JOEON
#define D(...) 97
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn = int> inline tn next(void) { tn k; cin>>k; return k; }
const int U = 105;
int a[U], b[U];
signed main(void)
{
	clock_t Begin = clock();

	#ifdef JOEON
//		freopen("C:\\Users\\Joeon\\Desktop\\IN.txt", "r", stdin);
//		freopen("C:\\Users\\Joeon\\Desktop\\OUT.txt", "w", stdout);
	#endif
	
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n = next(), ans = 0;
	rep(i, 0, n) cin>>a[i]>>b[i];

	rep(i, 0, n-2)
	{
		if (a[i] == b[i] && a[i+1] == b[i+1] && a[i+2] == b[i+2]) {cout<<"Yes"<<endl; return 0;}
	}
	cout<<"No"<<endl;
	
	clock_t InputFinished = clock();
	
	
	
	clock_t End = clock();
	
	D((double)(End-Begin)/CLOCKS_PER_SEC);
	D((double)(End-InputFinished)/CLOCKS_PER_SEC);
	
	return 0;
}
/*

 */

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

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

//動的計画法で役に立つ関数
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; }

//最大公約数と最小公倍数
ll gcd(ll a, ll b) {
    if(b==0)return a;
    return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a/g*b;
}

vector<vector<long long> > comb(int n) {
  vector<vector<long long> > v(n + 1,vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  
    int N; cin >> N;
    VI A(N);
    REP(i,N)
    {
        cin >> A[i];
    }
    int max_l=-INF;

    VI L(N), R(N);
    REP(i,N-1)
    {
        if (i==0)
        {
        L[i+1] = A[0];
        R[i+1] = A[N-1];
        }
        else
        {
            L[i+1] = gcd(L[i], A[i]);
            R[i+1] = gcd(R[i], A[N-1-i]);
        }
        L[0] = A[N-1];
        R[0] = A[0];
    }
    REP(i,N)
    {
        chmax(max_l, (int)gcd(L[i], R[N-i-1]));
    }
    cout << max_l << endl;
    //PRINT(L);cout << endl;
    //PRINT(R);cout << endl;
    return 0;
}



Measured memory_bytes: 1408
n=int(input())

l=list()
c=0
if n==0:
  l.append(0)
while n!=0:
  if n%2:
    l.append(1)
    n -= -1 if c%2 else 1
  else:
    l.append(0)
  n //= 2
  c += 1

for i in reversed(l):
  print(i, end='')

print()


Measured memory_bytes: 3060
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

#define rep(i,n) for(int i=0; i < n; i++)
using ll =  long long;
using namespace std;

map<int, bool> check;

int main()
{
    bool flag;
    int x;
    cin >> x;
    while(true)
    {
        flag = false;
        for (int i = 2; i < x; i++)
        {
            if (x % i == 0)
            {
                flag = true;
                break;
            }
        }
        if (flag == false) break;
        else x++;
    }
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
/***********************************************

    Md. Shahid-ul Islam
    Department of CSE, DIU
    fb- facebook.com/shahid.cse46

    CF Handle- ShA_hiD
    Vjudge Handle- shahid109514
    UVa Handle- shahid85

    Problem Name-
    Problem Link-

***********************************************/

#include <bits/stdc++.h>

using namespace std;

/****************** TypeDef *******************/

typedef unsigned int ui;
typedef long long int ll;
typedef long int l;
typedef unsigned long long int llu;
typedef float fl;
typedef double db;
typedef vector <int> vi;
typedef vector <long> vl;
typedef vector <long long> vll;

/***************** Define *********************/

#define maxn 1000000
#define pi acos(-1)
#define PI 3.14159
#define printf pf

/**********************************************/

int main()
{
    int a, b, k, m, count = 0;
    cin >> a >> b >> k;

    if(a > b) m = a;
    else m = b;

    for(int i = m; i > 0; i--)
    {
        if(a%i == 0 && b%i == 0){
			count++;
			if(k==count)
			{
                cout << i << endl;
                break;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256