akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> edge; // u, w
const ll N = 1e5 + 100, inF = 1e9;

ll n, u, v, w, sz[N], child[N];
ll S, mini = inF;
vector<edge> nei[N];

void dfs(int v, int par = -1) {
	sz[v] = 1;
	child[v] = -1;
	for (edge e: nei[v])
		if(e.first != par) {
			ll u = e.first, w = e.second;
			dfs(u, v);
			sz[v] += sz[u];
			if(child[v] == -1 || sz[u] > sz[child[v]])
				child[v] = u;
			S += w * min(sz[u], n - sz[u]) * 2;
		}
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		cin >> u >> v >> w;
		nei[--u].push_back(edge(--v, w));
		nei[v].push_back(edge(u, w));
	}
	dfs(0);
	for (int v = 0; v < n; v++)
		if(2 * sz[v] > n && (child[v] == -1 || 2 * sz[child[v]] <= n)) {
			if(child[v] != -1 && 2 * sz[child[v]] == n) {
				for (edge e: nei[v])
					if(e.first == child[v])
						mini = min(mini, e.second);
				continue;
			}
			for (edge e: nei[v])
				mini = min(mini, e.second);
		}
	cout << S - mini;
	return 0;
}

Measured memory_bytes: 16128
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;


enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int[] a = readln.split.to!(int[]);
    a.sort();
    writeln(a == [1, 4, 7, 9] ? "YES" : "NO");
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

const int MAX=10000;
int main(){
	int an,bn,r;
	while(cin>>an>>bn>>r,an&&bn){
		vvi a(MAX,vi());
		REP(i,an){
			int x,y;
			cin>>x>>y;
			a[x].push_back(y);
		}
		REP(i,MAX){
			sort(ALL(a[i]));
		}
		ll ans=0;
		REP(i,bn){
			int xb,yb;
			cin>>xb>>yb;
			FOR(dx,-4*r,4*r+1){
				int x=xb+dx;
				if(x>=0&&x<MAX){
					vi::iterator it=lower_bound(ALL(a[x]),yb-4*r);
					for(;it!=a[x].end()&&*it-yb<=4*r;it++){
						int dy=*it-yb;
						if(sqrt((double)(dx*dx+dy*dy))<4*r+EPS){
							ans++;
						}
					}
				}
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1860
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long
#define MOD 1000000007

ll gcd(ll a, ll b){
	while(b)b^=a^=b^=a%=b;
	return b;
}

ll power(ll a, ll b, ll mod){
	ll ret = 1;
	while(b){
		if(b&1) ret = ret*a % mod;
		a = a*a % mod;
		b >>= 1;
	}
	return ret;
}
int n;
vector<int> v[200100];

struct node{
	int x, dist;
	node(){}
	node(int x, int dist){
		this->x =x;
		this->dist = dist;
	}
	bool operator()(node &a, node &b){
		return a.dist > b.dist;
	}
};
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int m;cin>>n>>m;
	for(int i=1; i<=m; i++){
		int x, y;
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}

	priority_queue<node, vector<node>, node> q;
	q.push(node(1, 0));
	int vis[200100] = {0};
	int dist[200100] ;

	for(int i=1; i<=n; i++)dist[i] = INT_MAX;
	dist[1] = 0;
	while(q.size()){
		node top = q.top();q.pop();
		if(vis[top.x])continue;
		vis[top.x] = 1;
		for(int i=0 ; i<v[top.x].size(); i++){
			int y = v[top.x][i];
			if(dist[y] > top.dist+1){
				dist[y] = top.dist+1;
				q.push(node(y, dist[y]));
			}
		}
	}
	if(dist[n] == 2)cout<<"POSSIBLE\n";
	else cout<<"IMPOSSIBLE\n";
	return 0;
}

Measured memory_bytes: 14704
#include<bits/stdc++.h>
using namespace std;
int n,B[100005],a[100005],len;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    B[1]=-a[1],len=1;
    for(int i=2;i<=n;i++){
      if(-a[i]>=B[len]) B[++len]=-a[i];
      else{
        int pos=upper_bound(B+1,B+len,-a[i])-B;
        B[pos]=-a[i];
      }
    }
    cout<<len<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
int main(){
  int c=0;
  char a[3];
  cin >> a[0] >> a[1] >> a[2];
  rep(i,3){
    if(a[i]=='R') c++;
  }
  if(c==3) {
    cout << 3 << endl;
    return 0;
  }
  else if(c==2){
    if(a[0]=='R' && a[2]== 'R') cout << 1 << endl;
    else cout << 2 << endl;
  }
  else if(c==1) cout << 1 << endl;
  else cout << 0 << endl;
}

                      

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int sqnorm(vector<int> x, vector<int> y){
    int ret=0;
    for(int i=0; i<(int)x.size(); i++){
        ret+=(x[i]-y[i])*(x[i]-y[i]);
    }
    return ret;
}

vector<int> square(int N){
    vector<int> ret(N+1,0);
    for(int i=0; i<=N; i++){
        ret[i]=i*i;
    }
    return ret;
}

bool judge(int N, vector<int> &sq){
    for(int i=0; i<(int)sq.size(); i++){
        if(N==sq[i]){
            return true;
        }
    }
    return false;
}

int main(){
    int N, D;
    cin >> N >> D;
    vector<vector<int>> X(N,vector<int>(D,0));
    for(auto &rows:X){
        for(auto &x:rows){
            cin >> x;
        }
    }

    vector<int> sq=square(1000);
    int ans=0;
    for(int i=0; i<N; i++){
        for(int j=0; j<i; j++){
            int t=sqnorm(X[i],X[j]);
            if(judge(t,sq)){
                ans++;
            }
        }
    }
    cout << ans << endl;
}

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

int N;
vector<int> edges[200000];
int ans[200000];

map<pair<int, int>, int> memo;
int rec(int i, int p, int c){
    if(memo.count({i, c})) return memo[{i, c}];
    int ret = 1;
    for(int j : edges[i]) if(j != p && j < c) ret += rec(j, i, c);
    memo[{i, c}] = ret;
    return ret;
}

void dfs(int i, int p, int mx1, int mx2){
    if(i != 0){
        ans[i] = ans[p] + rec(i, p, mx1);
        if(i < mx2) ans[i] -= rec(i, p, mx2);
    }
    for(int j : edges[i]) if(j != p) dfs(j, i, max(i, mx1), mx1);
}

int main(){
    cin >> N;
    for(int i=0; i<N-1; i++){
        int a, b;
        cin >> a >> b;
        edges[a-1].push_back(b-1);
        edges[b-1].push_back(a-1);
    }

    dfs(0, -1, 0, 0);

    for(int i=1; i<N; i++) cout << ans[i] << " \n"[i==N-1];
    return 0;
}

Measured memory_bytes: 47744
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String t = scan.nextLine();
		StringBuffer rs = new StringBuffer(s);
		StringBuffer rt = new StringBuffer(t);
		rs = rs.reverse();
		rt = rt.reverse();
		char[] cs = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			cs[i] = rs.charAt(i);
		}
		
		char[] ct = new char[t.length()];
		for (int i = 0; i < t.length(); i++) {
			ct[i] = rt.charAt(i);
		}
		int X = Integer.MAX_VALUE;
		for (int i = 0; i <= s.length()-t.length(); i++) {
			boolean f = true;
			for (int j = 0; j < t.length(); j++) {
				if (cs[i+j] != '?' && cs[i+j] != ct[j]) {
					f = false;
					break;
				}
			}
			if (f) {
				X = i;
				break;
			}
		}
		if (X == Integer.MAX_VALUE) {
			System.out.println("UNRESTORABLE");
			return;
		}
		for (int i = 0; i < s.length(); i++) {
			if (cs[i] == '?') {
				cs[i] = 'a';
			}
		}
		for (int i = X; i < t.length()+X; i++) {
			cs[i] = ct[i-X];
		}
		for (int i = s.length()-1; i >= 0; i--) {
			System.out.print(cs[i]);
		}
		System.out.println("");
	}
}


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

#define fi first
#define se second
#define eb emplace_back
#define FOR(i, a, b) for(int i = a; i < (int) b; i++)
#define FORD(i, a, b) for(int i = a; i >= (int) b; i--)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vpii> vvpii;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef vector<pi64> vpi64;

int main () {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  string w;
  cin >> n >> w;
  stack<char> ans;
  FOR (i, 0, n) {
    if (ans.empty() || ans.top() != w[i]) {
      ans.push(w[i]);
    }
  }
  cout << (int) ans.size() << '\n';
  return 0;
}

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

using namespace std;

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

    string buff;
    int num_AC = 0;
    int num_WA = 0;
    int num_TLE = 0;
    int num_RE = 0;

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

        if(buff == "AC")      { ++num_AC;}
        else if(buff == "WA") { ++num_WA;}
        else if(buff == "TLE") { ++num_TLE;}
        else if(buff == "RE") {++num_RE;}
    }

    cout << "AC x " << num_AC << endl;
    cout << "WA x " << num_WA << endl;
    cout << "TLE x " << num_TLE << endl;
    cout << "RE x " << num_RE << endl;

    return 0;    
}

Measured memory_bytes: 3628
#include <iostream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

string hantei(string line);

int main(void){
	string line;
	vector<string> result;
	while (getline(cin, line)){
		if (line == "."){
			return 0;
			//break;
		}
		cout << hantei(line) << endl;
		//result.push_back(hantei(line));
	}
	/*
	vector<string>::iterator it = result.begin();
	while( it != result.end()){
	cout << *it << endl;
	++it;
	}
	*/
	return 0;
}

string hantei(string line){
	stack<char> left;
	stack<char> right;

	for (int i=0; i<line.size(); ++i){
		if ((line[i] == '(') || (line[i] == '[')){
			left.push(line[i]);
		}
		if ((line[i] == ')') || (line[i] == ']')){
			right.push(line[i]);
		}
		if (!left.empty()){
			if ((left.top() == '(') && (line[i] == ')')){
				left.pop();
				right.pop();
			}
			else if ((left.top() == '[') && (line[i] == ']')){
				left.pop();	
				right.pop();
			} 
		}
	}
	if (left.empty() && right.empty()){
		return "yes";
	}
	else{
		return "no";
	}
}

Measured memory_bytes: 1184
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


inf = 10 ** 18
mod = 10 ** 9 + 7

D = ir()
c = lr()
d = [0 for i in range(26)]
s = [lr() for i in range(D)]

for k in range(1,D+1):
    now = -1
    pre = -inf
    for i in range(26):
        total = s[k-1][i]
        sumc = 0
        for j in range(26):
            if j != i:
                sumc += c[j]*(k-d[j])
        total-=sumc
        if total > pre:
            pre = total
            now = i
    print(now+1)
    d[now] = k

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
#define PER(i,n) for(int i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


struct UnionFind { // UnionFindTree
  vector<int> d;
  UnionFind(int n): d(n,-1) {}
  int find(int x) {
    if(d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return false;
    if(-d[x] < -d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -d[find(x)]; }
};


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

  int n;
  cin >> n;
  vi x(n), y(n);
  rep(i,n) cin >> x[i] >> y[i];
  int ans = inf;
  rep(i,n) {
    rep(j,n) {
      int dix = x[i] - x[j];
      int diy = y[i] - y[j];
      UnionFind u(n);
      rep(k,n) {
        rep(l,n) {
          if(x[k] - x[l] == dix && y[k] - y[l] == diy) {
            u.unite(k,l);
          }
        }
      }
      set<int> st;
      rep(k,n) {
        st.insert(u.find(k));
      }
      ans = min(ans, sz(st));
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
from datetime import datetime as dt
import heapq
X,Y,Z,K = list(map(int,input().split(" ")))
As = list(map(int,input().split(" ")))
As.sort(reverse=True)
Bs = list(map(int,input().split(" ")))
Bs.sort(reverse=True)
Cs = list(map(int,input().split(" ")))
Cs.sort(reverse=True)

a = 0
b = 0
c = 0
se = set()
nums = []
num = As[a] + Bs[b] + Cs[c]
heapq.heappush(nums,(-num,(a ,b,c)))
# se.add((a ,b,c))
for _ in range(K):
    while True:
        temp = heapq.heappop(nums)
        num = temp[0]
        a,b,c = temp[1]
        if temp[1] in se:
            pass
        else:
            se.add(temp[1])
            break
    print(-num)
    #次のステップ
    if a + 1 < X:
        num = As[a + 1] + Bs[b] + Cs[c]
        heapq.heappush(nums,(-num,(a + 1,b,c)))
    if b + 1 < Y:
        num = As[a ] + Bs[b + 1] + Cs[c]
        heapq.heappush(nums,(-num,(a ,b + 1,c)))
    if c + 1 < Z:
        num = As[a] + Bs[b ] + Cs[c + 1]
        heapq.heappush(nums,(-num,(a ,b,c + 1)))




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

int main() {
	int n;
	cin>>n;
	long long a[100]={0},i;
	a[1]=2,a[2]=1;
	for(i=3;i<=87;i++)
	    a[i]=a[i-1]+a[i-2];
	cout<<a[n+1];
	return 0;
}

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

int cnt[3] = { 0 };
int w, h;
int mx[] = { -1,0,1,0};
int my[] = { 0,1,0,-1};
vector<string> area;

void dfs(int x,int y,char color){
	for (int i = 0; i < 4; i++){
		int nextx = x + mx[i];
		int nexty = y + my[i];
		//b,w,.?????????????????????????????????????§????
		if (nextx >= 0 && nextx < w &&
			nexty >= 0 && nexty < h){
			if (area[nexty][nextx] != 'B' &&
				area[nexty][nextx] != 'W' &&
				area[nexty][nextx] != 'G'){

				//???????????????????????´???
				if (color == 'W'){
					if (area[nexty][nextx] == 'w') continue;
					if (area[nexty][nextx] == 'b'){
						area[nexty][nextx] = 'G';
						cnt[2]++;
						cnt[0]--;
					}
					else if (area[nexty][nextx] == '.'){
						area[nexty][nextx] = 'w';
						cnt[1]++;
					}
					dfs(nextx, nexty, color);
				}
				//????????´???
				else{
					if (area[nexty][nextx] == 'b') continue;
					if (area[nexty][nextx] == 'w'){
						area[nexty][nextx] = 'G';
						cnt[2]++;
						cnt[1]--;
					}
					else if (area[nexty][nextx] == '.'){
						area[nexty][nextx] = 'b';
						cnt[0]++;
					}
					dfs(nextx, nexty, color);
				}
			}
		}
	}
}

int main(){
	while (1){
		cin >> w >> h;
		if (w == 0 && h == 0) break;
		//?????????
		for (int i = 0; i < 3; i++){
			cnt[i] = 0;
		}
		//??\???
		for (int i = 0; i < h; i++){
			string input;
			cin >> input;
			area.push_back(input);
		}
		//??¢?´¢?????????????????????????????¨???????§?????????????
		for (int i = 0; i < h; i++){
			for (int j = 0; j < w; j++){
				if (area[i][j] == 'W'){
					dfs(j, i, 'W');
				}
				else if (area[i][j] == 'B'){
					dfs(j,i,'B');
				}
			}
		}
		cout << cnt[0] << " " << cnt[1] << endl;
		area.clear();
	}
}

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

int main(){
  int n,k;cin>>n>>k;
  vector<int> p(n);
  for(int i=0;i<n;i++)cin>>p[i];
  
  sort(p.begin(),p.end());
  
  int ans=0;
  for(int i=0;i<k;i++)ans+=p[i];
  cout<<ans<<endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

int main(){
  int l,r,d;
  cin>>l>>r>>d;
  int ans=0;
  for(int i=l;i<=r;i++){
    if(i%d==0) ans++;
  }
  cout<<ans<<endl;
}

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

int main(){
    int n,k;
    cin>>n>>k;
    long double ans=0;
    REP(i,n){
        int cnt=0;
        int t=i;
        while(t<k){
            t*=2;
            cnt++;
        }
        ans += 1.0/n*pow(0.5,cnt);
    }
    cout<<fixed<<setprecision(20)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cstring>
#include<string>
#include<iomanip>
#include<map>
#include<fstream>
#include<queue>
#include<set>
#include<deque>

using namespace std;

int main()
{
	int a[2000];
	int n, z, w;
	cin >> n >> z >> w;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	if (n == 1) {
		cout << abs(a[0] - w);
	}
	else {
		cout << max(abs(a[n - 1] - w), abs(a[n - 2] - a[n - 1]));
	}
}

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define vi vector<int>

#define ll long long
#define vl vector<ll>
#define vll vector<vl>

const int INF = 1e9;

int ans[510][510];

int main() {
	int n;
	cin >> n;
	int conf=0;
	rep(kt, 10)
	{
		int d=(1 << kt);
		rep(i, n)
		{
			rep(j, n)
			{
				if((i & d)!=(j & d))
				{
					if(ans[i][j]==0)
					{
						ans[i][j]=kt+1;
						conf++;
					}
				}
			}
		}
		if(conf==n*(n-1)) break;
	}
	rep(i, n-1)
	{
		for(int j=i+1; j<n; j++)
		{
			cout << ans[i][j];
			if(j==n-1) cout << endl;
			else cout << ' ';
		}
	}
	return 0;
}

Measured memory_bytes: 1536
a,b=map(int,input().split())

heightl=[]
height=0
for i in range(1,1000):
    height+=i
    heightl.append(height)
#print(heightl)
for i in range(1000):
    cur=heightl[i]
    nex=heightl[i+1]
    if cur>a:
        if nex-b==cur-a:
            ans=cur-a
            break
print(ans)

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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))

#define INTSPACE 12
char _buf[INTSPACE*1000000 + 3];

int loadint() {
    if (fgets(_buf, INTSPACE+3, stdin)==NULL) return 0;
    return atoi(_buf);
}

int loadvec(vector<int>& v, int N=-1) {
    if (N == -1) {
        N = loadint();
        if (N==0) return 0;
    }
    int bufsize = INTSPACE*N + 3;
    if (fgets(_buf, bufsize, stdin)==NULL) return 0;
    v.resize(N);

    int i=0;
    bool last = false;
    for (char *p=&_buf[0]; ;) {
        char *q = p;
        while (*q > ' ') ++q;
        if (*q == 0x0D || *q == 0x0A) last = true;
        *q = 0;
        v[i++] = atoi(p);
        if (last || i == N) break;
        p = q+1;
    }
    // assert(i <= N);
    return i;
}

ll solve(int N, int T, vi& t) {
    // vector<int> w(N);
    ll ans = 0;
    rep(i, N-1) {
        ans += (ll)min(t[i+1] - t[i], T);
    }
    ans += T; // w[N-1] = T;
    // cerr << w << endl;

    return ans;
}

int main() {
    vi t(2);
    loadvec(t, 2);
    int N=t[0], T=t[1];
    t.resize(N);
    loadvec(t, N);
    cout << solve(N,T,t) << endl;
    return 0;
}


Measured memory_bytes: 2944
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

string T[3] = {"Sunny", "Cloudy", "Rainy"};
int main(){

	int N;
	cin >> N;

	cout << fixed << setprecision(7) <<  double((N-1)/2+1)/double(N) <<endl;

  return 0;
}




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

int main() {
	int A, B, C, X;
	int count = 0;

	std::cin >> A;
	std::cin >> B;
	std::cin >> C;
	std::cin >> X;

	for (int i = 0; i <= A; i++)
		for (int j = 0; j <= B; j++)
			for (int k = 0; k <= C; k++)
				if (X == 500 * i + 100 * j + 50 * k)
					count++;

	std::cout << count << std::endl;

	return 0;
}

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

int main(){
    int h, w;
    //for(i = 0; i <= n; i ++ 1){
    while(1){ 
        cin >> h >> w ; 
        if(h == 0 & w == 0)
            break; 
        for(int j = 0; j < h; j ++){ 
            for(int i = 0; i < w; i ++){
                cout << "#";
            }
            cout << "\n";
        }
    cout << "\n";
    }
return 0;
}

Measured memory_bytes: 1120
// In the name of God
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <iomanip>
#include <ctime>
#include <queue>
using namespace std;

template <typename T>
T next_int() {  
    T x = 0, p = 1;
    char ch;
    do { ch = getchar(); } while(ch <= ' ');
    if (ch == '-') {
        p = -1;
        ch = getchar();
    }
    while(ch >= '0' && ch <= '9') {
        x = x * 10 + (ch - '0');
        ch = getchar();
    }
    return x * p;
}

const int max_n = (int)3e5 + 227 + 1;
const int max_int = (int)1e9 + 227 + 1;
const int mod = (int)1e9 + 7;

template<typename T>
T binpow(T n, T s)
{
    if (s <= 0)
        return 1LL;
    if (s % 2 == 0){
        T b = binpow(n, s / 2);
        return ( 1LL * b * b ) % mod;
    } else {
        return (1LL* binpow(n, s - 1) * n) % mod;
    }
}

long long ob[max_n];
long long f[max_n];

long long C(int n, int m) {
    if(n < m) return 0;
    return (f[n] * ob[m] % mod) * ob[n - m] % mod;
}

long long fe(long long a, long long b) {
    return C(a + b - 2, a - 1);
}

int main() {
//    freopen(".in", "r", stdin);

    for(int i = 0; i < max_n; i++) {
        if(i) f[i] = f[i - 1] * i % mod; else f[i] = 1;

        ob[i] = binpow<long long>(f[i], mod - 2);
    }

    long long h = next_int<long long>();
    long long w = next_int<long long>();
    long long a = next_int<long long>();
    long long b = next_int<long long>();

    long long ans = 0;
    for(int i = 1; i <= h - a; i++) {
        int x = i;
        int y = b;

        ans = (ans + fe(x, y) * fe(h - i + 1, w - b)) % mod;
    }

    cout << ans << "\n";
}


Measured memory_bytes: 4992
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
public class Main {
	static FastScanner stdIn=new FastScanner();
	public static void main(String[] args) {
		long N=stdIn.nextLong();
		long ans=0;
		if(N%2==1)
			System.out.println(0);
		else{
			long b=5;
			while(b<=N){
				ans+=N/b/2;
				b*=5;
			}
			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define VMAX 100000
#define MAXLOOP 200000000
void solve(long long N, long long W, vector<long long> w, vector<long long> p){
  long long vmax = (MAXLOOP/N)/8;
  vector<vector<long long>> dp(N, vector<long long>(vmax+1, LLONG_MAX));
  dp[0][0] = 0;
  dp[0][p[0]] = w[0];

  for(long long i = 1; i < N; i++) {
    for(long long j = 0; j <= vmax; j++) {
      long long source = j - p[i];
      if(source < 0 || dp[i-1][source] == LLONG_MAX) {
        dp[i][j] = dp[i-1][j];
        continue;
      }

      dp[i][j] = min(dp[i-1][j], dp[i-1][source] + w[i]);
    }
  }


  #ifdef DEBUG
  for(long long i = 0; i < N; i++) {
    for(long long j = 0; j <= VMAX; j++) {
      if(dp[i][j] != LLONG_MAX) {
        cout << "[" << i << "][" << j << "]=" << dp[i][j] << " ";
      }
    }

    cout << endl;
  }
  #endif

  for(long long j = vmax; j >= 0; j--) {
    if(dp[N-1][j] <= W) {
      cout << j << endl;
      break;
    }
  }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long W;
  scanf("%lld",&W);
  vector<long long> ws;
  vector<long long> ps;
  long long w, p;
  for(int i = 0 ; i < N ; i++){
    cin >> w >> p;
    ws.push_back(w);
    ps.push_back(p);
  }
    solve(N, W, std::move(ws), std::move(ps));
    return 0;
}


Measured memory_bytes: 390912
#include<iostream>
#include<cstdio>
#include<cstring>
#include <fstream>
#include<string>
#include<sstream>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
#include <math.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const long long int MOD = 1000000007;
const int INF = 1000000007;
const double EPS = 1e-10;
const double PI = 3.14159265359;
const int N = 100005;
//cout << fixed << std::setprecision(9)
//--------------------------
 
ll dp[N][2];
vector<int> edge[N];
int n, u, v;
 
void dfs(int x, int last)
{
	dp[x][0] = dp[x][1] = 1;
	for (auto to : edge[x]) {
		if (to == last) continue;
		dfs(to, x);
		dp[x][0] = dp[x][0] * ((dp[to][0] + dp[to][1]) % MOD) % MOD;
		dp[x][1] = dp[x][1] * dp[to][0] % MOD;
	}
}
 
int main()
{
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		cin >> u >> v;
		edge[u].push_back(v);
		edge[v].push_back(u);
	}
 
	dfs(1, -1);
	cout << (dp[1][0] + dp[1][1]) % MOD << endl;
 
	return 0;
}

Measured memory_bytes: 17600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    vector<ll> siz(3);
    REP(i,3)cin >> siz[i];
    sort(ALL(siz),greater<>());
    cout << (siz[0]%2?siz[1]*siz[2]:0) << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <random>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0)
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

string s;
int main() {
  cin >> s;
  lli n = s.size();
  lli ans = 0;
  for (lli l=0, r=n-1; l<r;) {
    if (s[l] == s[r]) {
      ++l; --r;
    } else if (s[l] != s[r]) {
      if (s[l] == 'x') {
        ++l; ++ans;
      } else if (s[r] == 'x') {
        --r; ++ans;
      } else {
        cout << -1 << endl; return 0;
      }
    }
  }

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


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; 
	cin >> N; 
	long long int A[100010] = {}; 
	long long int S = 0; 
	for(int i = 0; i < N; i++){
		cin >> A[i]; 
		S += A[i]; 
	}
	A[N] = A[0]; 
	bool possible = true; 
  	long long int sum = (long long) N * (N + 1) / 2; 
	if(S % sum != 0) possible = false; 
	else{
		long long int T = S / sum; // 操作回数
		for(int i = 0; i < N; i++){
			long long int a = T - (A[i+1] - A[i]); 
			if(a < 0 || a % (long long) N != 0){
				possible = false; break;
			}
		}
	}
	if(possible) cout << "YES" << endl;
	else cout << "NO" << endl; 
}

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

using namespace std;


int counter(int x){
	if (x==0) return 0;
	return counter(x >> 1) + (x & 1);
}
void solve(){

int N;
cin >> N;
int A[20],x[20][20],y[20][20];

	
	for (int i = 1; i <= N; i++)
	{
		cin >> A[i];
		for (int j = 1; j <= A[i]; j++)
		{
			cin >> x[i][j] >> y[i][j];
		}
	}
	int ans = 0;
	for (int bits = 1; bits < (1 << N); bits++)
	{
		bool ok = true;
		for (int i = 1; i <= N; i++)
		{
			if (!(bits & (1 << (i-1)))) continue;
			for (int j = 1; j <= A[i]; j++)
			{
				if (((bits >> (x[i][j]-1)) & 1 ) ^ y[i][j]) ok = false;	
			}
		}
		if(ok) ans = max(ans,counter(bits));
	}
	cout << ans << endl;
	return;
}

int main(){
	solve();
}




Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<cfloat>
using namespace std;
int mod = 1e9+7;
long long int inf = 1e18;

bool c(int l, int r){
  return l%2 < r%2;
}

int main() {
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end(), c);
  int cnt = 0;
  if( a[0]%2 != a[1]%2 ){
    a[1]++;
    a[2]++;
    cnt++;
  }else if( a[1]%2 != a[2]%2 ){
    a[0]++;
    a[1]++;
    cnt++;
  }

  while(true){
    if( a[0] == a[1] && a[1] == a[2] ) break;

    sort(a.begin(), a.end());
    a[0] += 2;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}

//


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include <stdlib.h>
int gcd(int a,int b){
    int r;
    r=a%b;
    while (r!=0) {
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}
int main(void){
    int K,ab,SUM=0;
    scanf("%d",&K);
    for (int a=1; a<=K; a++) {
        for (int b=1; b<=K; b++) {
            if (a>=b) {
                ab=gcd(a,b);
            }
            else{
                ab=gcd(b,a);
            }
            for (int c=1; c<=K; c++) {
                if (ab>=c) {
                    SUM+=gcd(ab,c);
                }
                else{
                    SUM+=gcd(c,ab);
                }
            }
        }
    }
    printf("%d\n",SUM);
    return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
map<long long,long long>m;
int main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long N,K;
    cin>>N>>K;
    long long a,b;
    for(long long i=0;i<N;++i)
    {
        cin>>a>>b;
        m[a]+=b;
    }
    long long sum=0;
    for(auto j:m)
    {
        if(sum+j.second>=K)
        {
            cout <<j.first<<endl;
            return 0;
        }
        else
        {
            sum+=j.second;
        }
    }
    return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

typedef unsigned long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

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

const double PI = acos(-1.0);
const LL INF = 1e9 + 7;
const LL LINF = INF * INF;
int x[100000];
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt" , "r" , stdin);
	int n , k;
	cin >> n >> k;
	int ans = INF;
	for(int i = 0; i < n; i++)
	{
		cin >> x[i];
	}
	for(int i = 0; i < n - k + 1; i++)
	{
		int x1 = x[i];
		int x2 = x[i + k - 1];
		if(x1 < 0 && x2 < 0 || x1 >= 0 && x2 >= 0)
		{
			ans = min(ans , max(abs(x1) , abs(x2)));
		}
		else
		{
			ans = min(ans , min(abs(x1) * 2 + abs(x2) , abs(x1) + abs(x2) * 2));
		}
	}
	cout << ans;
	//cout << "BUILDED" << endl;
	return 0;
}


Measured memory_bytes: 640
h,w,k = map(int, input().split())
s = []
st = 0
zero = [0 for i in range(h)]
z = 0
for i in range(h):
  t = input()
  st += t.count('#')
  zero[i] = t.count('#')
  s.append(t)

cake = 0
ans = [[0 for j in range(w)] for i in range(h)]
for i in range(h):
  if zero[i] == 0:
    continue
  cake += 1
  t = 0
  for j in range(w):
    if s[i][j] == '#':
      t += 1
      if t >= 2:
        cake += 1
    ans[i][j] = cake
for i in range(h-1):
  if zero[i+1] != 0:
    continue
  if ans[i][0] == 0:
    continue
  for j in range(w):
    ans[i+1][j] = ans[i][j]
for i in range(h-1,0,-1):
  if zero[i-1] != 0:
    continue
  for j in range(w):
    ans[i-1][j] = ans[i][j]

for i in range(h):
  print (*ans[i])

Measured memory_bytes: 12644
import collections

def read():
    N = int(input().strip())
    S = list()
    for i in range(N):
        has_nodes = list(input().strip())
        s = list()
        for i, has_node in enumerate(has_nodes):
            if has_node == '1':
                s.append(i)
        S.append(s)
    return N, S

def bfs(start, V, graph):
    q = collections.deque()
    q.appendleft(start)
    depth = [-1] * V
    depth[start] = 0
    while len(q) > 0:
        s = q.pop()
        for t in graph[s]:
            if depth[t] == -1:
                depth[t] = depth[s] + 1
                q.appendleft(t)
    return depth

def argsort(seq):
    return sorted(range(len(seq)), key=seq.__getitem__)

def make_groups(V, depth):
    max_depth = max(depth)
    groups = dict()
    for v in range(V):
        d = depth[v]
        if d in groups.keys():
            groups[d].append(v)
        else:
            groups[d] = [v]
    return groups

def has_edge_in_sibling_nodes(V, graph, depth):
    for i in range(V):
        for j in range(i+1, V):
            if depth[i] == depth[j]:
                if j in graph[i]:
                    return True
    return False


def solve(N, S):
    # 全ての頂点に対してbfs、条件を満たす最大の深さを出力
    max_depth = -1
    for i in range(N):
        depth = bfs(i, N, S)
        if not has_edge_in_sibling_nodes(N, S, depth):
            max_depth = max(max_depth, max(depth) + 1)
    return max_depth

if __name__ == '__main__':
    inputs = read()
    print("%d" % solve(*inputs))


Measured memory_bytes: 42736
#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
void solve()
{
   ll x;
   cin>>x;
   
   ll ans;
   if(x<600)
   ans=8;
   else if(x<800)
   ans=7;
   else if(x<1000)
   ans=6;
   else if(x<1200)
   ans=5;
   else if(x<1400)
   ans=4;
   else if(x<1600)
   ans=3;
   else if(x<1800)
   ans=2;
   else 
   ans=1;
   
   cout<<ans<<endl;
}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     
//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();
  
//Good Bye!
    return 0;
}

Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderCs
{
    class Program
    {
        static void Main()
        {

            var Arg = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var M = Arg[1];

            var Ranking = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            Array.Sort(Ranking);
            Array.Reverse(Ranking);

            var SumVote = Ranking.Sum();
            Console.WriteLine((Ranking[M - 1] * (4 * M) < SumVote  ? "No" : "Yes"));


        }

    }
}


Measured memory_bytes: 13396
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

int main()
{
	int n, a, b;
	cin >> n >> a >> b;

	cout << min(n * a, b) << endl;
}

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

int main()
{
    int r, g, b;
    
    while(cin >> r >> g >> b)
    {
        int sum = 0;
        sum += 10*g + b;
        string ans = "NO";
        if(sum % 4 == 0)
        {
            ans = "YES";
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
N = int(input())
h = list(map(int,input().split()))

dp = []

for i in range(N):
	dp.append(float("inf"))

for i in range(N):
	if i ==0:
		dp[i] = 0
	else:
		dp[i] = min(dp[i],dp[i-1]+abs(h[i]-h[i-1]))
		if i > 1:
			dp[i] = min(dp[i], dp[i-2]+abs(h[i]-h[i-2]))

print(dp[-1])

Measured memory_bytes: 13928
import java.util.*;
import java.util.stream.IntStream;

public class Main {
    static int n;
    static List<Node> nodes;
    static int[] l;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        nodes = new ArrayList<>();
        for (int i = 0; i < n + 1; i++) {
            nodes.add(new Node(i));
        }
        for (int i = 0; i < n - 1; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            nodes.get(a).next.add(nodes.get(b));
            nodes.get(b).next.add(nodes.get(a));
        }
        Deque<Integer> q = new ArrayDeque<>();
        q.add(1);
        l = new int[n + 1];
        l[1] = 1;
        while (q.size() > 0) {
            int next = q.poll();
            for (Node node : nodes.get(next).next) {
                if (l[node.num] != 0) continue;
                l[node.num] = l[next] + 1;
                q.add(node.num);
            }
        }
        int leaf = 0;
        int max = 0;
        for (int i = 0; i < n+1; i++) {
            if(max < l[i]) {
                max = l[i];
                leaf = i;
            }
        }
        l = new int[n + 1];
        l[leaf] = 1;
        q.add(leaf);
        while (q.size() > 0) {
            int next = q.poll();
            for (Node node : nodes.get(next).next) {
                if (l[node.num] != 0) continue;
                l[node.num] = l[next] + 1;
                q.add(node.num);
            }
        }
        int size = 0;
        for (int i = 0; i < n+1; i++) {
            size = Math.max(size, l[i]);
        }
        if ((size + 1) % 3 == 0) {
            System.out.println("Second");
        } else {
            System.out.println("First");
        }
    }

    static class Node {
        public int num;
        public List<Node> next;

        public Node(int num) {
            this.num = num;
            next = new ArrayList<>();
        }
    }
}


Measured memory_bytes: 160128
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  ll n;
  cin >> n;
  ll a[3][n];
  for (int i=0; i<3; ++i) {
    for (ll j=0; j<n; ++j) cin >> a[i][j];
  }
  sort(a[0], a[0]+n);
  sort(a[1], a[1]+n);
  sort(a[2], a[2]+n);
  ll dp[3][n];
  for (int i=0; i<3; ++i) {
    for (ll j=0; j<n; ++j) dp[i][j] = 0;
  }
  for (ll i=0; i<n; ++i) dp[0][i] = 1;
  for (int i=1; i<3; ++i) {
    ll sum = 0, piv = 0;
    for (ll j=0; j<n; ++j) {
      while (true) {
        if (piv == n || a[i-1][piv] >= a[i][j]) break;
        sum += dp[i-1][piv];
        piv++;
      }
      dp[i][j] = sum;
    }
  }
  ll ans = 0;
  for (ll i=0; i<n; ++i) ans += dp[2][i];
  cout << ans << endl;
  return 0;
}


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

int main(void) {
	int x, y;
	cin >> x >> y;

	if (2*x<=y && 4 * x >= y && y%2==0) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

			


	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<ll, ll, ll> T;

string s;

int main(void){
    
    cin >> s;
    
    for(int i = s.size() - 1; i >= 0; --i){
        string temp = s.substr(i);
        if(temp == "dream" || temp == "dreamer" || temp == "erase" || temp == "eraser") s = s.substr(0, i);
    }
    printf("%s\n", (s.size()) ? "NO" : "YES");
    
    return 0;
}

Measured memory_bytes: 512