akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iomanip>
#include <iterator>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <climits>
#include <string>
#include <set>
#include <numeric>
#include <bitset>
#include <cmath>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <numeric>
#include <vector>
#include <cassert>
#include <ctime>

using namespace std;
 
#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define FORi(i,a,b) for(int i=int(a);i<=int(b);i++)
#define FOR(i,n) FORi(i,1,n)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
 
using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;
using pii=pair<int, int>;
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto& p: c) os << p << " ";
	return os<<']';
}
 
void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}
 
 
template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}
 
 
constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;
constexpr int maxn=300;

int n;

ll mm[maxn][maxn];

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

	while(cin>>n) {
		rep(i, n) rep(j, n) cin>> mm[i][j];
		int flag =true;
		ll zong = 0;

		for(int i = 0; i < n && flag; i++) 
			for(int j = i+1; j < n&&flag; j++)  {
				if(i == j ) {
					if(mm[i][j] != 0) flag = false;
				} else {
					int len = mm[i][j];
					for(int k = 0; k < n && flag; k++) if(k == i || k == j) continue;
					else if(mm[i][j] > mm[i][k] + mm[k][j]) flag = false;
					else if(mm[i][j] == mm[i][k]+mm[k][j]) len = 0;
					zong += len;
				}
			}
		if(!flag) cout << -1 << endl;
		else cout << zong << endl;
	}
	return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll         long long
#define fl(i,n)    for(i=0;i<n;i++)
#define fld(i,a,b) for(i=a;i>b;i--)
#define fli(i,a,n) for(i=a;i<n;i++)
#define inp(i,a,n) for(i=0;i<n;i++) {cin>>a[i];}
#define op(i,a,n)  for(i=0;i<n;i++) {cout<<a[i]<<" ";}
#define pb         push_back
#define mp         make_pair
#define F          first 
#define S          second
#define mod        998244353
#define all(x)     x.begin(),x.end()    
#define speedup    ios_base::sync_with_stdio(false),cin.tie(0)
using namespace std;
void comp() {
	ll i,j,k,m,n,l;
	string s;
	cin>>s;
	n=s.length();
	if(s[n-1]=='3') {
		cout<<"bon\n";
	}
	else if(s[n-1]=='0' || s[n-1]=='1' || s[n-1]=='6' || s[n-1]=='8' ) {
		cout<<"pon\n";
	}
	else {
		cout<<"hon\n";
	}
}

int main() {
    speedup;
    ll i=0,t;
    t=1;
    //cin>>t;
    while(t--) {
        comp();
    }
    return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n,m;
  cin >> n >> m;
  vll a(n);
  REP(i, n)
    cin >> a[i];

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

  ll oklim = 0;
  ll nglim = 1e11;
  while(nglim-oklim>1){
    ll midlim = (oklim+nglim)/2;

    ll sum = 0;
    REP(i, n){
      if(a[i]+a[n-1]<midlim)
        continue;
      auto it = lower_bound(a.begin(), a.end(), midlim-a[i]);
      sum += a.end()-it;
    }
    if(sum>=m)
      oklim = midlim;
    else
      nglim = midlim;
  }


  vll cum(n+1, 0);
  REP(i, n)
    cum[i+1] = cum[i]+a[i];

  ll ans = 0;
  ll more = 0;
  REP(i, n){
    if(a[i]+a[n-1]<oklim)
      continue;
    auto it = upper_bound(a.begin(), a.end(), oklim-a[i]);
    ll ok = it-a.begin();
    ans += cum[n]-cum[ok];
    ans += (n-ok)*a[i];
    more += n-ok;
  }
  ans += oklim*(m-more);

  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <iostream>
#include <ctime>
using namespace std;
#define _LL long long
#define rep(i, n) for (_LL i = 0; i < (_LL)(n); i++)
#define vecrep(itr, v) for (auto itr = (v).begin(); itr != (v).end(); itr++)

int main()
{
    int n;
    cin >> n;
    vector<int> l;
    rep(i, n)
    {
        int t; cin >> t; l.push_back(t);
    }

    _LL ans = 0;
    sort(l.begin(), l.end());
    for(int a = 0; a < n; a++)
        for(int b = a + 1; b < n; b++)
        {
            int lb = l[b] - l[a];
            int ub = l[a] + l[b];
            int lbindex = upper_bound(l.begin(), l.end(), lb) - l.begin();
            int ubindex = lower_bound(l.begin(), l.end(), ub) - l.begin();
            if( b + 1 < ubindex )
            {
                ans += ubindex - max(lbindex, b + 1);
            }
        }

    cout << ans;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 1e5 + 123;
int n, par[N], sz[N];

struct pt {
	int x, y, ind;
	bool operator < (const pt & p) {
		return x < p.x;
	}
};
pt p[N];

struct edge {
	int x, y, w;
	bool operator < (const edge & e) {
		return w < e.w;
	}
};
vector <edge> v;

void make_set(int x) {
	par[x] = x;
	sz[x] = 1;
}

int find_set(int x) {
	if (x == par[x]) return x;
	return par[x] = find_set(par[x]);
}

bool union_set(int x, int y) {
	x = find_set(x), y = find_set(y);
	if (x == y) return false;
	if (sz[x] < sz[y])
		swap(x, y);
	par[y] = x;
	sz[x] += sz[y];
	return true;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> p[i].x >> p[i].y, p[i].ind = i;
		make_set(i);
	}
	sort(p, p + n);
	edge t;
	for (int i = 1; i < n; i++) {
		t.x = p[i - 1].ind, t.y = p[i].ind;
		t.w = min(abs(p[i - 1].x - p[i].x), abs(p[i - 1].y - p[i].y));
		v.pb(t);
	}
	for (int i = 0; i < n; i++) swap(p[i].x, p[i].y);
	sort(p, p + n);
	for (int i = 0; i < n; i++) swap(p[i].x, p[i].y);
	for (int i = 1; i < n; i++) {
		t.x = p[i - 1].ind, t.y = p[i].ind;
		t.w = min(abs(p[i - 1].x - p[i].x), abs(p[i - 1].y - p[i].y));
		v.pb(t);
	}
	sort(all(v));
	ll res = 0;
	for (int i = 0; i < (int)v.size(); i++) {
		if (union_set(v[i].x, v[i].y))
			res += v[i].w;
	}
	cout << res;
}


Measured memory_bytes: 8340
import collections
cc = collections.Counter()
for _ in range(int(raw_input())): 
	s = raw_input()
	cc[s[0]] +=1	

def dfs(i, total ,cumul, cc, k, s):
	if i == len(s):
		if k == 0:
			total[0] += cumul
		return 

	if k:
		dfs(i+1, total, cumul * cc[s[i]], cc,k - 1, s)
	dfs(i+1, total, cumul, cc, k, s)

total = [0]
dfs(0, total, 1 , cc, 3, 'MARCH')
print total[0]

Measured memory_bytes: 78948
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define loop(i,a,b) for(ll i=a; i<b; i++)
#define revloop(i,a,b) for(ll i=a; i>=b; i--)
#define pb push_back
#define vl vector<ll>
#define vvl vector<vl>
#define pl pair<ll,ll>
#define vpl vector<pl>
#define all(c) (c).begin(), (c).end()
#define sz(a) ((a).size())
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i!=(c).end(); i++))
#define mp make_pair
#define ss second
#define ff first
const ll INF = 1e13;
const ll N = 200001;
const ll mod=998244353;
bool prime(ll x)
{
	if(x<2) return false;
	for(ll i=2; i*i<=x; i++) if(x%i==0) return false;
	return true;
}
vl fac(N);
void fact()
{
	fac[0]=1;
	loop(i,1,N) fac[i]=(fac[i-1]*i)%mod;
}
void solve()
{
  ll n,W;
  cin>>n>>W;
  ll w[n], v[n];
  ll sum=0;
  loop(i,0,n)
  {
  	 cin>>w[i]>>v[i];
  	 sum+=v[i];
  }
  vl dp(sum+1,INF);
  dp[0]=0;
  loop(i,0,n)
  {
  	revloop(j,sum-v[i],0)
  	{
  		dp[j+v[i]] = min(dp[j+v[i]],w[i]+dp[j]);
	}
  }
  ll ans = 0;
  loop(i,0,dp.size())
  {
  	if(dp[i]<=W) ans = max(ans,i);
  }
  cout<<ans;
}

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

Measured memory_bytes: 2560
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int N; cin >> N;
    vector<pair<pair<string, int>, int>> P(N);
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> P[i].first.first >> a;
        P[i].first.second = -a, P[i].second = i;
    }
    sort(P.begin(), P.end());
    for (int i = 0; i < N; ++i) cout << P[i].second + 1 << endl;
}


Measured memory_bytes: 3540
L = [[[0] * 10 for i in range(3)] for j in range(4)]
n = int(input())
for i in range(n):
  b, f, r, v = list(map(int, input().split()))
  L[b - 1][f - 1][r - 1] += v
for i in range(4):
  for j in range(3):
    for k in range(10):
      print(" {}".format(L[i][j][k]), end = "")
    print()
  if i + 1 != 4:
    print("#" * 20)



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

const int N = 1e5 + 100;

int n, fa[N], fb[N], is_odd[2][N];

struct Edge {
	int e, *h, *nx, *to, V, E;
	Edge(int V, int E):V(V), E(E) {
		e = 0;
		h = new int [V];
		nx = new int [E];
		to = new int [E];
		memset(h, -1, 4 * V);
	}
	~Edge() {
		delete h;
		delete nx;
		delete to;
	}
	void clear() {
		e = 0;
		memset(h, -1, 4 * V);
	}
	void add(int u, int v) {
		to[e] = v, nx[e] = h[u], h[u] = e++;
		to[e] = u, nx[e] = h[v], h[v] = e++;
	}
} *tr, *bi;

int dfs(int u, int f) {
	vector<int> odd_son;
	for (int i = tr->h[u]; i != -1; i = tr->nx[i]) {
		int v = tr->to[i];
		if (v != f) {
			v = dfs(v, u);
			if (v != 0)
				odd_son.push_back(v);
		}
	}
	if (!is_odd[0][u])
		odd_son.push_back(u);
	for (int i = 0; i < (int)odd_son.size() - 1; i += 2) {
		bi->add(odd_son[i], odd_son[i + 1]);
	}
	return odd_son.size() % 2 == 0 ? 0 : odd_son.back();
}

bool vis[N], col[N];

void coloring(int u, int c) {
	vis[u] = true;
	col[u] = c;
	for (int i = bi->h[u]; i != -1; i = bi->nx[i]) {
		int v = bi->to[i];
		if (!vis[v])
			coloring(v, c ^ 1);
	}
}

int main() {
#ifdef lol
	freopen("f.in", "r", stdin);
	freopen("f.out", "w", stdout);
#endif

	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &fa[i]);
		if (fa[i] != -1) {
			is_odd[0][fa[i]] ^= 1;
		}
	}
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &fb[i]);
		if (fb[i] != -1)
			is_odd[1][fb[i]] ^= 1;
	}
	for (int i = 1; i <= n; ++i) {
		if (is_odd[0][i] ^ is_odd[1][i]) {
			puts("IMPOSSIBLE");
			return 0;
		}
	}
	tr = new Edge(n + 1, (n + 1) * 2);
	bi = new Edge(n + 10, (n + 10) * 4);
	int rt;
	for (int i = 1; i <= n; ++i) {
		if (fa[i] == -1) {
			rt = i;
			continue;
		}
		tr->add(i, fa[i]);
	}
	dfs(rt, -1);
	tr->clear();
	for (int i = 1; i <= n; ++i) {
		if (fb[i] == -1) {
			rt = i;
			continue;
		}
		tr->add(i, fb[i]);
	}
	dfs(rt, -1);
	for (int i = 1; i <= n; ++i)
		if (!vis[i]) {
			coloring(i, 1);
		}
	puts("POSSIBLE");
	for (int i = 1; i <= n; ++i) {
		if (is_odd[0][i]) {
			printf("%d ", 0);
		} else {
			printf("%d ", col[i] ? 1 : -1);
		}
	}
	puts("");

	return 0;
}

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

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

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

const int N = 100010;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 97;
const ull BS1 = 10000019ULL;
const int INF = (1 << 29);

template < class T > inline void fastScan(T &x){
    register char c = getchar();
    int neg = 0; x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-') { neg = 1; c = getchar(); }
    for(   ; c > 47 && c < 58; c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(neg) x = -x;
}

// OrderedSet
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template < typename T > using ordered_set = tree < T, null_type, greater < T >, rb_tree_tag, tree_order_statistics_node_update >;

//typedef uint64_t hash_t;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//const int HASH_COUNT = 2;
//const hash_t HASH_P = (uint32_t)-13337;
//uniform_int_distribution<hash_t> MULT_DIST(0.25 * HASH_P, 0.75 * HASH_P);
//const hash_t HASH_MULT[HASH_COUNT] = {MULT_DIST(rng), MULT_DIST(rng)};

ll a, b;
char s[10];

int main(){
  cin >> a >> s;
  b = 0;
  for(int i = 0; s[i]; i++){
    if(s[i] == '.') continue;
    b = b * 10 + (s[i] - '0');
  }
  ll ans = ll(a * b) / 100ll;
  printf("%lld\n", ans);
}


Measured memory_bytes: 3800
import sys
input = sys.stdin.readline
from collections import deque
from heapq import heappush, heappop, heapify
    
def prim(V, E, v=0):
    # E[v] = (cost, u)
    
    visited = [False] * V
    visited[v] = True
    count = V-1
    
    dist = [float('inf')] * V
    dist[v] = 0
    
    q = list(E[v])
    heapify(q)
    
    for c, u in E[v]: dist[u] = c
    
    while count and q:
        c, v = heappop(q)

        if visited[v]: continue
    
        visited[v] = True
        count -= 1
        
        for c, u in E[v]:
            if visited[u]: continue
            dist[u] = min(dist[u], c)
            heappush(q, (dist[u], u))
    
    return dist

def main():
    V, e = map(int, input().split())
    E = [[] for i in range(V)]
    
    for i in range(e):
        v, u, c = map(int, input().split())
        E[v].append((c, u))
        E[u].append((c, v))

if __name__ == '__main__':
    V, e = map(int, input().split())
    
    E = deque(deque() for i in range(V))
    
    for i in range(e):
        v, u, c = map(int, input().split())
        
        E[v].append((c, u))
        E[u].append((c, v))
        
    print(sum(prim(V, E)))
        


Measured memory_bytes: 40028
#include<stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

int sumOfArray(int *a,int n){
	int cnt = 0;
	for(int i=0;i<n;i++){
		cnt+=a[i];
	}
	return cnt;
}

void revStr(char *str){
	for(int i=0;i<strlen(str)/2;i++){
		char a = str[i];
		str[i]=str[strlen(str)-i-1];
		str[strlen(str)-i-1]=a;
	}
}


int main(){
	int N;
	scanf("%d",&N);
	int K;
	scanf("%d",&K);
	int x[N];
	for(int i=0;i<N;i++){
		scanf("%d",&x[i]);
	}
	
	int cnt = 0;
	
	for(int i=0;i<N;i++){
		int a = 1000;
		if(a>x[i])a=x[i];
		if(a>K-x[i])a=K-x[i];
		a*=2;
		cnt+= a;
	}
	printf("%d",cnt);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
	string s;
	cin >> s;
 
	bool svn=false;
	for (int i=0; i<3; i++) {
		if (s[i]=='7') svn=true;
	}
	if (svn) cout << "Yes" << endl;
	else cout << "No" <<endl;
}

Measured memory_bytes: 3600
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, string> pls;

int main()
{
	int A, B;
	cin >> A >> B;
	if (((A + B) % 3 == 0) || A % 3 == 0 || B % 3 == 0)
		cout << "Possible" << endl;
	else
		cout << "Impossible" << endl;

	return 0;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
s=[2,3,4,5,6,7,8,9,10,11,12,13,1]
if s.index(a)==s.index(b):
    print('Draw')
elif s.index(a)>s.index(b):
    print('Alice')
else:
    print('Bob')

Measured memory_bytes: 3060
#include<stdio.h>
    int main()
    {
        int a,b;
        // スペース区切りの整数の入力
        scanf("%d %d",&a,&b);

        if(b%a == 0){
    printf("%d",a+b);
  }else{
    printf("%d",b-a);
  }
        return 0;
    }

Measured memory_bytes: 128
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef pair<int,int> P;
int a,w,s,e,n;
char m[1001];
int main()
{
	scanf("%s",m);
	a=strlen(m);
	for(int i=0;i<a;i++){
		if(m[i]=='W') w++;
		if(m[i]=='S') s++;
		if(m[i]=='E') e++;
		if(m[i]=='N') n++;
	}
	if( (!(!w)) == !e  ||  (!(!s)) == !n ) puts("No");
	else puts("Yes");
}

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

int main(){
    int n, x;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i){
        cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    if (n % 2 == 1){
        x = b[n / 2] - a[n / 2] + 1;
    }
    else {
        int A, B;
        A = a[n / 2] + a[n / 2 - 1];
        B = b[n / 2] + b[n / 2 - 1];
        x = B - A + 1;
    }
    cout << x << endl;
}

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

#define double long double
#define int long long
#define vec vector
#define pb push_back
#define unset unordered_set
#define ii pair<int, int>
#define X first
#define Y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first,l.second+r.second};
} 
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

inline int Pow(int a, int k) {
  int s = 1; 
  for(; k; k >>= 1) {
    k & 1 ? s = 1LL * s * a % MOD : 0;
    a = 1LL * a * a % MOD;
  }
  return s;
}

// Init variables here
const int N = 1e6 + 7;

void input() {
  //freopen("??.in", "r", stdin);
  //freopen("??.out", "w", stdout);
}

void preprocess() {
}

void debug() {
  //  44gg
  if (true) {
  
  }
}


void solve() {
  preprocess();
  // 50gg
  int a, b;
  cin >> a >> b;
  cout << max(a + b, max(a * 2 - 1, b * 2 - 1)) << endl;
  //debug();
  // read the question correctly (is y a vowel?)
  // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
}

void output() {

}

#undef int
int main() {
#define int long long
	ios_base::sync_with_stdio(false);
	cin.tie();
  //auto beginProgram = chrono::steady_clock::now();

  //int t; cin >> t;
  //while (t--) 
  {
    input();
    solve();
    output();
  }

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] a = new Integer[n];
        Arrays.setAll(a, i -> Integer.parseInt(sc.next()));
        sc.close();

        // 主処理
        int[] color = new int[8];
        int over = 0;
        for (int i = 0; i < a.length; i++) {
            if (a[i] < 400) {
                color[0] = 1;
            } else if (a[i] < 800) {
                color[1] = 1;
            } else if (a[i] < 1200) {
                color[2] = 1;
            } else if (a[i] < 1600) {
                color[3] = 1;
            } else if (a[i] < 2000) {
                color[4] = 1;
            } else if (a[i] < 2400) {
                color[5] = 1;
            } else if (a[i] < 2800) {
                color[6] = 1;
            } else if (a[i] < 3200) {
                color[7] = 1;
            } else {
                over++;
            }
        }
        int sum = Arrays.stream(color).sum();
        int min = Math.max(1, sum);
        int max = sum + over;

        String result = min + " " + max;

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 26836
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main(){
    int n,q;
    scanf(" %d %d", &n, &q);

    set<int> u;
    map<int,vector<int>> IN,OUT;
    rep(i,n){
        int s,t,x;
        scanf(" %d %d %d", &s, &t, &x);
        IN[s-x].pb(x);
        OUT[t-x].pb(x);

        // printf(" [%d %d)\n", s-x,t-x);
        u.insert(s-x);
        u.insert(t-x);
    }

    set<int> ASK;
    rep(i,q){
        int d;
        scanf(" %d", &d);
        ASK.insert(d);
        u.insert(d);
    }

    set<int> X;
    for(int i:u){
        for(int j:OUT[i]) X.erase(j);
        for(int j:IN[i]) X.insert(j);

        if(ASK.count(i)){
            int ans = -1;
            if(!X.empty()) ans = *X.begin();
            printf("%d\n", ans);
        }
    }
    return 0;
}


Measured memory_bytes: 154368
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;

ll n,m;
ll ans=0;
vector <vector<ll>> bulb;
vector <ll> arr;

void func(vector<ll> b){
	if (b.size() == n){
		for (int z=0;z<m;z++){
			ll temp = 0;
			for (int x=0;x<bulb[z].size();x++){
				if (b[bulb[z][x]-1]) temp++;
			}
			if (arr[z] == 0 && temp % 2 == 1) return;
			if (arr[z] == 1 && temp % 2 == 0) return;
		}
		ans++;
		return;
	}
	b.push_back(0);
	func(b);
	b.erase(b.end()-1);
	b.push_back(1);
	func(b);
}

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cin >> n >> m;
    bulb.resize(m);
    arr.resize(m);
    for (int z=0;z<m;z++){
    	ll temp;
    	cin >> temp;
    	for (int x=0;x<temp;x++){
    		ll k; cin >> k;
    		bulb[z].push_back(k);
    	}
    }
    for (int z=0;z<m;z++){
    	cin >> arr[z];
    }
    vector <ll> em;
    func(em);
    cout << ans << endl;
    cin >> n;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sz(a) int((a).size())
#define int long long
#define Int int32_t
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pii pair< int , int >
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define bitcnt(n) __builtin_popcountll(n)
#define setpre(n) cout << fixed << setprecision(n)
#define tr(c) for(auto x : c )cout << x << " ";
#define ol(c , s , e ) for(int pos=s; pos<e ; pos++) cout << c[pos] << " ";
#define inf 2e18;
#define PI acos(-1)
const int M = 1000000007;
const int N=2e5+5;
//#define local
#ifdef local
template<typename... T >
void bug(T... __VA_ARGS__) {
    ((cerr << __VA_ARGS__ << " ") , ...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", bug(__VA_ARGS__) , cerr << endl;
#endif
void solve()
{
    double r;
    cin >> r;
    double cur = 2*r*PI;
    setpre(20) << cur << endl;
}

signed main()
{
    int tc=1 , i ,j;
//    cin >> tc;
    for(int t = 1 ; t <= tc ; t++)
    {
        solve();
    }
}


Measured memory_bytes: 3772
/*
[abc105] C - Base -2 Number
*/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_K = 32;

int N;

string solve() {
    bitset<MAX_K> ans;
    int n = N;

    int k;
    for (k = 0; n != 0; k++) {
        if (n & 1) {
            n--;
            ans.set(k);
        }
        n /= -2;
    }
    int len = max(1, k);

    string ans_str = ans.to_string().substr(MAX_K - len, len);

    return ans_str;
}

int main() {
    cin >> N;

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 256
s = list(input())
l = ['C','O','D','E','F','E','S','T','I','V','A','L','2','0','1','6']
c = 0

for i in range(len(s)):
    if s[i] != l[i]:
        s[i] = l[i]
        c = c + 1

print(c)

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

int main() {
	
	int n, a[100005], x;
	long long sum = 0;
	
	cin>>n>>x;
	for(int i=0; i<n; i++){
		cin>>a[i];
	}
	
	if(a[0] > x){
		int tmp = a[0];
		a[0] = x;
		sum += tmp - x;
	}
	for(int i=0; i<n-1; i++){
		if(a[i] + a[i+1] > x){
			int tmp = a[i+1];
			a[i+1] = x - a[i];
			sum += tmp - (x - a[i]);
		}
	}

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

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(1){
    if(x->right==NIL)break;
    x=x->left;
  }
  return x;
}

Node treeMaximum(Node x){
  while(1){
    if(x->right==NIL)break;
    x=x->right;
  }
  return x;
}

Node treeSearch(Node u, int k){
  while(u!=NIL && k!=u->key){
    if(k< u->key) u=u->left;
    else u=u->right;
  }
  return u;
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right!=NIL)
    return treeMinimum(x->right);
  y=x->parent;
  while(y!=NIL && x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left==NIL || z->right==NIL)y=z;
  else y=treeSuccessor(z);
  if(y->left!=NIL)x=y->left;
  else x=y->right;
  if(x!=NIL) x->parent=y->parent;
  if(y->parent==NIL){
    root=x;
  }
  else{
    if(y==y->parent->left)
      y->parent->left=x;
    else y->parent->right=x;
  }
  if(y!=z){
    z->key=y->key;
  }
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while(1){
    if(x==NIL)break;
    y=x;
    if(z->key<x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent = y;
  if(y == NIL){
    root = z;
  }
  else{
    if(z->key < y->key){
      y->left = z;
    }
    else{
      y->right = z;
    }
  }
  
}

void inorder(Node u){
  if(u!=NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}
void preorder(Node u){
  if(u!=NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
}

Node find(Node u,int k){
  while(1){
    if(u==NIL || k==u->key)break;
    if(k<u->key){
      u=u->left;
    }
    else u=u->right;
  }
  return u;
}

int main(){
  int n, i, x;
  char com[20];
  Node min,max;
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20552
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T, typename U> istream & operator>>(istream & s, pair<T, U> & p) { return (s >> p.FI >> p.SE); }
template<typename T, typename U> ostream & operator<<(ostream & s, pair<T, U> const & p) { return (s << p.FI << " " << p.SE); }

int main() {
	IN(int, n, m);
	vector<pair<int, int>> v;
	if(n % 2 == 0) {
		inc1(i, n / 4) { v.EB(i, n / 2 - (i - 1)); }
		inc1(i, (n - 1) / 2 - (n / 4)) { v.EB(n / 2 + i, n - i); }
	} else {
		inc1(i, n / 2) { v.EB(i, n - i); }
	}
	inc(i, m) { OUT(v[i]); }
}


Measured memory_bytes: 4320
N = int(input())
Hs = list(map(int, input().split()))

if(N == 1):
    print("Yes")
    exit()

for i in reversed(range(N - 1)):
    if(Hs[i+1] - Hs[i] >= 0):
        continue

    elif(Hs[i+1] - Hs[i] == -1):
        Hs[i] -= 1
        continue

    else:
#        print(Hs)
        print("No")
        exit()

#print(Hs)
print("Yes")

Measured memory_bytes: 20504
from functools import lru_cache
import sys

sys.setrecursionlimit(10**6)

N = int(input())
h = list(map(int, input().split()))

# @lru_cache(maxsize=None)
# def recur(i):
#     if i == N - 1:
#         return 0
#     return min(abs(h[i] - h[i + 1]) + recur(i + 1), abs(h[i] - h[min(N - 1, i + 2)]) + recur(min(N - 1, i + 2)))
#
# print(recur(0))

dp = [float("inf")]*(N + 2)
dp[0] = 0
for i in range(N - 1):
    dp[i + 1] = min(dp[i + 1], abs(h[i] - h[i + 1]) + dp[i])
    if i < N - 2:
        dp[i + 2] = min(dp[i + 2], abs(h[i] - h[i + 2]) + dp[i])

print(dp[N - 1])


Measured memory_bytes: 14532
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
// clang-format on

int a, b, c;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b >> c;

  if (b - a == c - b) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


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

const int maxn = 5005;

int n, m;
int a[maxn], b[maxn];
int pos[maxn][1002];
int pre[1002];

int main() {
    ///freopen("test.txt", "r", stdin);
    ios_base::sync_with_stdio(0);

    cin >> n >> m;
    for (int i = 1; i <= n; i ++) {
        cin >> a[i];
        pre[a[i]] = i;
        pos[i][a[i]] = pre[a[i]];
        for (int j = 0; j < 1001; j ++) if(j != a[i]) pos[i][j] = pos[i - 1][j];
    }
    for (int i = 1; i <= m; i ++) {
        cin >> b[i];
    }
    ///cout << pre[]
    ///cout << pos[4][3] << endl;
    int res = 0;
    for (int i = 1; i <= m; i ++) {
        int cur = n;
        for (int j = i; j >= 1; j --) {
            cur = pos[cur][b[j]] - 1;
            if(cur == -1) break;
            res = max(res, i - j + 1);
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 20820
import queue
import math
import copy
"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""

(N,X,D) = (int(i) for i in input().split(" "))
mp = {}
if D == 0:
	if X == 0:
		ans = 1
	else:
		ans = N+1
else:
	for i in range(N+1):
		md = (i*X)%D
		if not md in mp:
			mp[md] = []
		k = i*(i-1)//2
		mp[md].append([k+(((i*X)-md)//D),0])
		k = (N*2-i-1)*i//2
		mp[md].append([k+(((i*X)-md)//D)+1,1])
	#print(mp)
	ans = 0
	for k in mp.keys():
		s = sorted(mp[k])
		#print(s)
		md = 0
		bef = 0
		for t in s:
			if md > 0:
				ans += t[0] - bef
			bef = t[0]
			if t[1] == 0:
				md += 1
			else:
				md -= 1
print(ans)

Measured memory_bytes: 97964
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function main()
  A,B,C = parseMap(split(readline()))
  K = parseInt(readline())
  ta = zeros(K+1)
  tb = zeros(K+1)
  tc = zeros(K+1)
  for i in 1:K+1
    ta[i] = A*2^(i-1)
    tb[i] = B*2^(i-1)
    tc[i] = C*2^(i-1)
    #println("$i")
  end
  if minimum(ta) > maximum(tb)
      println("No")
  elseif minimum(tb) > maximum(tc)
      println("No")
  elseif minimum(ta) > maximum(tc)
      println("No")
  else
      tmp = 0 ; j = 1
      while tmp == 0
        if tb[j] > ta[1]
          tmp = 1
        else
          j += 1
        end
      end
      tmp = 0 ; m = 1
      while tmp == 0
        if tc[m] > tb[j]
          tmp = 1
        else
          m += 1
        end
      end
      if j+m-2 > K
         println("No")
      else
         println("Yes")
      end
      #println("ta=$ta")
      #println("tb=$tb")
      #println("tc=$tc")
      #println("j=$j,m=$m")

  end
#  if mod(a,1000) != 0
#    println(1000-mod(a,1000))
#  else
#    println(0)
#  end
end
main()

Measured memory_bytes: 175436
#include<bits/stdc++.h>
#define REP(i,first,last) for(int i=first;i<=last;++i)
#define DOW(i,first,last) for(int i=first;i>=last;--i)
using namespace std;
const int MAXN=2e5+5;
int n,m;
int T;
struct Edge
{
	int to,next;
}edge[MAXN*2];
int edge_cnt=0;
int edge_head[MAXN];
#define FOR(now) for(int edge_i=edge_head[now];edge_i;edge_i=edge[edge_i].next)
#define TO edge[edge_i].to
#define VAL edge[edge_i].val
void AddEdge(int form,int to)
{
	edge[++edge_cnt].to=to;
	edge[edge_cnt].next=edge_head[form];
	edge_head[form]=edge_cnt;
}
void YES()
{
	printf("YES\n");
}
void NO()
{
	printf("NO\n");
}
void read(int &a)
{
	scanf("%d",&a);
}
void work()
{

}
int siz[MAXN];
void DFS(int now=1)
{
	siz[now]=0;
	FOR(now)
	{
		DFS(TO);
		siz[now]++;
	}
}
int main()
{
	scanf("%d",&n);
	int a;
	REP(i,2,n)
	{
		scanf("%d",&a);
		AddEdge(a,i);
	}
	DFS();
	REP(i,1,n)
	{
		printf("%d\n",siz[i]);
	}
	return 0;
}

Measured memory_bytes: 16220
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
const int INF=1e9+7;

int main(){
  string a,b,c;cin>>a>>b>>c;
  int A=0,B=0,C=0;
  char now='a';
  while(A<=a.size()&&B<=b.size()&&C<=c.size()){
    if(now=='a'){
      now=a[A];A++;
    }
    else{
      if(now=='b'){
        now=b[B];B++;
      }
      else{now=c[C];C++;}
    }
  }
  if(A==a.size()+1){cout<<"A"<<endl;}
  else{
    if(B==b.size()+1){cout<<"B"<<endl;}
    else{cout<<"C"<<endl;}
  }
}


Measured memory_bytes: 256
#! env python
# -*- coding: utf-8 -*-

import os
import sys

# at_coder.ABC086C_Traveling
# Date: 2019/06/02
# Filename: ABC086C_Traveling 

__author__ = 'acto_mini'
__date__ = "2019/06/02"


def main():
    # 作業ディレクトリを自身のファイルのディレクトリに変更
    os.chdir(os.path.dirname(os.path.abspath(sys.argv[0])))

    t, x, y = [0], [0], [0]

    # 整数の入力
    num = int(input())

    for i in range(num):
        a, b, c = map(int, input().split())
        t.append(a)
        x.append(b)
        y.append(c)

    can = True
    for i in range(num):
        dt = t[i + 1] - t[i]
        dist = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
        if (dt < dist):
            can = False
        if (dt % 2 != dist % 2):
            can = False

    if can:
        print("Yes")
    else:
        print("No")

    return


if __name__ == '__main__':
    main()


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

int main(){
  int N,i=0;

  cin >> N;

  string result = "No";

  while(i*7 <= N){
    if((N-i*7) % 4 == 0){
      result = "Yes";
    }
    i += 1;
  }

  cout << result << endl;

  return 0;
}

Measured memory_bytes: 256
public class Main{
    public static void main(String args[]){
        java.util.Scanner sc = new java.util.Scanner(System.in);
        int[] h = new int[10];
        for(int i=0;i<10;i++){
            h[i] = sc.nextInt();
        }
        java.util.Arrays.sort(h);
        for(int i=h.length-1;i>=7;i--){
            System.out.println(h[i]);
        }
    }
}

Measured memory_bytes: 17168
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
int main()
{
  ll n,k;cin >> n >> k;
  ll res = 0;
  for(ll b = 1;b <= n;++b) {
    ll tmp = n/b * max((ll)0, b-k) + max((ll)0, n%b - k + 1);
    res += tmp;
  }
  if(k == 0) res = n*n;
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0:i < (n);i++)
typedef long long ll;
using namespace std;
int main(){
  int a,b,total=0;
  cin >> a >> b;
  total = a;
  int tap = 1;
  if(b==1) { cout << 0 << endl;return 0;}
  while(total < b){
  total+=(a-1);
  tap++;
  }
  cout <<  tap << endl;
}


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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 
#define N 111111

const int INF = 1 << 30 ;
typedef long long ll ;
typedef pair < int , int > pii ;

ll a[N] ;


int main() {
 //   #ifndef ONLINE_JUDGE
    // for getting input from input.txt
  //freopen("input.txt", "r", stdin);
    // for writing output to output.txt
 // freopen("output.txt", "w", stdout);
  //  #endif

  int n, k;
  ll ans = (1LL<<60) , l, r  ;
  scanf("%d %d" ,&n ,&k) ;

  for(int i =0 ;i<n ;i++){
    scanf("%lld" , &a[i]) ;
  }

  for(int i = 0 ;i<n-k+1 ;i++){
    l = a[i] ;
    r = a[i+k-1] ;

    ans = min(ans , min(abs(l),abs(r)) + abs(l-r)) ;
  }
  cout << ans << '\n' ;

  return 0 ;
}

Measured memory_bytes: 1024
n = int(input())
xyn = []
for _ in range(n):
    x, y = map(int, input().split())
    xyn.append([x,y])
import itertools
ls = list(itertools.permutations(range(1, n+1)))


leng=0

for i in ls:
    for j in range(len(i)-1):
        z=i[j]
        a=i[j+1]
        leng += ((xyn[z-1][0]-xyn[a-1][0])**2+(xyn[z-1][1]-xyn[a-1][1])**2)**0.5

ans = leng/len(ls)
print(ans)


Measured memory_bytes: 13820
import java.util.*;

import static java.lang.System.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();

        int ans = dfs(N, 0);
        out.println(ans);
    }

    // orgを10倍したときにintに収まらなくなる可能性があるのでlong org
    public static int dfs(long N, long org) {
        if (N < org) { return 0;}

        int ret = 0;
        if(have753(org)){ ret++; }

        int[] nums = {7, 5, 3};
        for (int num : nums) {
            ret += dfs(N, org * 10 + num);
        }
        return ret;
    }

    public static boolean have753(long num){
        boolean[] isExists = new boolean[10];
        while(num > 0){
            int rest = (int)(num % 10);
            num = num / 10;
            isExists[rest] = true;
        }

        return isExists[3] & isExists[5] & isExists[7];
    }
}


Measured memory_bytes: 26068
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
 
template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

vector<pii> ans;
int n; 

void add(int a,int b){
	ans.pb(mp(a,b));
}

int main(){
	read(n);
	if(n<=2)return puts("No"),0;
	int k=log(n+0.1)/log(2);
	if(n==(1<<k))return puts("No"),0;
	add(1,2),add(2,3),add(3,n+1);
	add(n+1,n+2),add(n+2,n+3);
	for(int k=4;k<n;k+=2)
		add(1,k),add(k,k+1),
		add(1,n+k+1),add(n+k+1,n+k);
	if(n%2==0){
		int p=__builtin_ctz(n);
		int t=n-(1<<p);
		add(n,1<<p);
		add(n*2,n+t+1);
	}
	puts("Yes");
	for(auto x:ans)
		printf("%d %d\n",x.fi,x.se);
	return 0;
}

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

int Mint(int a, int b){
    int k = a / b;
    int res = a - b * k;
    if(res < 0) res += abs(b);
    return res;
}

int Dint(int a, int b){
    return (a - Mint(a,b)) / b;
}

int main(){
    ll N; cin >> N;
    string S;
    const int mod = -2;
    if(N == 0){
        cout << 0 << endl;
        return 0;
    }
    while(N != 0){
        S.push_back('0' + Mint(N, mod) );
        N = Dint(N, mod);
    }
    reverse(S.begin(), S.end());
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define all(v) (v).begin(), (v).end()
using namespace std;
const int N = 1e3 + 5;

void solve()
{

    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    ll m = x / d;
    ll n = min(m, k);
    k -= n;
    x -= n * d;
    if(k&1)
    {
        cout<<abs(x-d);

    }
    else
    {
        cout<<x;
    }
}


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


    int TESTS = 1;
    // cin >> TESTS;
    while(TESTS--)
    {
        solve();
        cout << endl;

    }
    return 0;
}

Measured memory_bytes: 3544
// 154 B

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>
#include <iomanip>
#include <climits>
#include <string>

using namespace std;
using p = pair<int, int>;
const int ll[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

void show(vector<vector<int>> v){
    cout << endl;
    for(int i=0; i<v.size(); i++){
        for(int j=0; j<v.at(i).size(); j++){
            int tmp = v.at(i).at(j);
            if(tmp < 100) cout << setw(3) << tmp << " ";
            else cout << "INF ";
        }
        cout << endl;
    }
} 

int main(){
    int h, w;
    cin >> h >> w;
    char c;
    vector<vector<bool>> s(w, vector<bool>(h));
    vector<p> v;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> c;
            if(c == '.'){
                s.at(j).at(i) = true;
                v.push_back(pair<int, int> (j, i));
            }else if(c == '#'){
                s.at(j).at(i) = false;
            }
        }
    }
    int ans=0;
    for(p p_buf: v){
        int s_x = p_buf.first, s_y = p_buf.second, max_cost = 0;
        vector<vector<int>> cost_map(w, vector<int>(h, INT_MAX/2));
        cost_map.at(s_x).at(s_y) = 0;
        queue<p> que;
        que.push(p (s_x, s_y));
        while(!que.empty()){
            p p_now = que.front();
            int x = p_now.first, y = p_now.second;
            que.pop();
            int now_cost = cost_map.at(x).at(y) + 1;
            for(int i=0; i<4; i++){
                int n_x = x + ll[i][0], n_y = y + ll[i][1];
                if(n_x<0 || n_x>=w || n_y<0 || n_y>=h)continue;
                if(s.at(n_x).at(n_y) && now_cost < cost_map.at(n_x).at(n_y)){
                    cost_map.at(n_x).at(n_y) = now_cost;
                    que.push(p (n_x, n_y));
                    if(max_cost < now_cost) max_cost = now_cost;
                }
            }
        }
        if(ans < max_cost) ans = max_cost;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    string S; cin >> S;
    vector<int> cnt(4, 0);
    for (int i = 0; i < S.size(); i++) {
        if (S.at(i) == 'N') {
            cnt.at(0)++;
        } else if (S.at(i) == 'E') {
            cnt.at(1)++;
        } else if (S.at(i) == 'S') {
            cnt.at(2)++;
        } else {
            cnt.at(3)++;
        }
    }
    if (cnt.at(0) * cnt.at(2) > 0 || (cnt.at(0) == 0 && cnt.at(2) == 0)) {
        if (cnt.at(1) * cnt.at(3) > 0 || (cnt.at(1) == 0 && cnt.at(3) == 0)) {
            cout << "Yes" << endl;
        } else cout << "No" << endl;
    } else cout << "No" << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define int long long
using pii=std::pair<int,int>;
using namespace std;

string s;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> s;
    int cnt = 0, ans = 0;
    for(int i = 0; i < s.length(); i++)
    {
        if(s[i] == 'R')
            cnt++;
        else
        {
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    ans = max(ans, cnt);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3608