akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  string s;
  cin >> s;
  rep(i,sz(s)) {
    if((i+1) % 2 == 1) {
      if(!(s[i] == 'R' || s[i] == 'U' || s[i] == 'D')) {
        cout << "No" << endl;
        return 0;
      } 
    } else {
      if(!(s[i] == 'L' || s[i] == 'U' || s[i] == 'D')) {
        cout << "No" << endl;
        return 0;
      } 
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

LL N, A, B, C, D;
string S, T;

int main() {
	cin >> N >> A >> B >> C >> D;
	--A; --B; --C; --D;
	//N += 2;
	N++;
	cin >> S;
	S.push_back('#');
	S.push_back('#');
	for (int i = min(A, C); i < max(A, C); ++i) {
		if (S[i] == '#' && S[i + 1] == '#') {
			cout << "No" << endl;
			return 0;
		}
	}
	for (int i = min(B, D); i < max(B, D); ++i) {
		if (S[i] == '#' && S[i + 1] == '#') {
			cout << "No" << endl;
			return 0;
		}
	}
	if ((A - B) * (C - D) > 0LL) {
		cout << "Yes" << endl;
		return 0;
	}
	for (int i = 0; i < N; ++i) {
		if (S[i] == '#' || S[max(0, i - 1)] == '#' || S[i + 1] == '#') {
			T.push_back('#');
		}
		else {
			T.push_back('.');
		}
	}
	LL L = max(0LL, max(A, B));//min(min(A, B), min(C, D));
	LL R = min(N, min(C, D));// max(max(A, B), max(C, D));
	/*while (L > 0 && (S[L] == '.' || S[L - 1] == '.')) {
		--L;
	}
	while (R < N && (S[R] == '.' || S[R + 1] == '.')) {
		++R;
	}*/
	bool ok = false;
	for (int i = L; i <= R; ++i) {
		if (T[i] == '.') {
			ok = true;
		}
	}
	if (ok) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 776
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <numeric>
using namespace std;

#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rept(i,k,n) for(long long i = (k); i < (long long)(n); i++)
#define All(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(),v.end())
#define Rsort(v) sort(v.begin(),v.end(),[](auto a, auto b) { return a > b; })
#define Reverse(v) reverse(v.begin(),v.end())
#define MAX 1000000007
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<long long,long long> Pll;
typedef tuple<int,int,int> Tii;

template <typename T>
ostream& operator<<(ostream& s, const vector<T> &vec){
    for(int i=0;i<vec.size();i++){
        if(i) s << ',';
        else s << '{';
        s <<setw(2)<< vec[i];
    }
    s << '}' << endl;
    return s;
}


int main(){
    int n;
    cin>>n;
    vector<Pii> xy(n);
    vector<int> ad(n),sb(n);
    rep(i,n){
        int x,y;
        cin>>x>>y;
        ad[i]=x+y;
        sb[i]=x-y;
    }
    Sort(ad);
    Sort(sb);
    int ma = ad.back()-ad[0];
    int ms = sb.back()-sb[0];
    cout<<max(ma,ms)<<endl;
    return 0;
}

Measured memory_bytes: 6424
/*
 * 0299.cc: Railroad II
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_M = 10000;
const int INF = 1 << 30;

/* typedef */

typedef vector<int> vi;

/* global variables */

vi ds;

/* subroutines */

/* main */

int main() {
  int n, m, p;
  cin >> n >> m >> p;

  for (int i = 0; i < m; i++) {
    int di;
    cin >> di;
    di = (di - p + n) % n;
    ds.push_back(di);
    ds.push_back(di - n);
  }
  ds.push_back(0);
  sort(ds.begin(), ds.end());
  int dn = ds.size();
  //for (int i = 0; i < dn; i++) printf("%d ", ds[i]); putchar('\n');

  int mind = INF;

  for (int i = 0, j = m; j < dn; i++, j++) {
    int di = ds[i], dj = ds[j];
    int d0 = (dj - di) + dj;
    int d1 = (dj - di) - di;
    if (mind > d0) mind = d0;
    if (mind > d1) mind = d1;
  }
  printf("%d\n", mind * 100);
  return 0;
}

Measured memory_bytes: 1328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a, sq, b, summ;

int main() {
cin >> a;
sq = sqrt(a);
for (ll i = 1; i <= sq; i++){
	if (a%i == 0){
		b = a/i;
		if (summ == 0){
			summ = b+i;
			}
		summ = min(summ, b+i);
		}
	}
	if (summ == 0){
		cout << a-1; return 0;
		}else{
			cout << summ-2;
			}
		
	//cout << '\n' << sq;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    rep(i,m) cin >> a[i];
    int suma = 0;
    rep(i,m){
        suma += a[i];
    }
    int ans = n-suma;
    if(ans < 0) ans = -1;
    cout << ans << endl;
}


Measured memory_bytes: 3632
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
# print(s,t)
if "".join(s) < "".join(t):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 68360
import sys
import fractions
import bisect
input=sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort()
b.sort()
c.sort()

ans = 0
k = 0
for j in b:
    ai = bisect.bisect_left(a, j)
    ci = n - bisect.bisect_right(c, j)
    ans += ai * ci
print(ans)


Measured memory_bytes: 24620
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#include <queue>
#include <string.h>
#include <bitset>

#define ll long long int
#define ld long double
#define rep(i,n) for(int i = 0;i < n;i++)
#define rep1(i,n) for(int i = 1;i < n;i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "
#define all(x) x.begin(),x.end()
#define allr(x) x.begin(),x.end(),greater<int>()
#define P pair<ll,ll>
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1ll << 60
#define PI 3.14159265359

using namespace std;

ll gcd(ll x,ll y){

	if(x == 0){

		return y;

	}
	else if(y == 0){

		return x;

	}

	if(x < y){

		return gcd(x,y%x);

	}
	else{

		return gcd(y,x%y);

	}
}

int main(){

	ll a,b;
	cin >> a >> b;

	ll tmp = gcd(a,b);

	map<ll,ll> m;

	ll ans = 1;
	ll flag;

	while(tmp != 1){

		flag = 0;

		for(ll i = 2;i <= sqrt(tmp);i++){

			while(tmp%i == 0){
				tmp/=i;
				flag = 1;
			}

			if(flag == 1){
				ans++;
				break;
			}
			
		}

		if(flag == 0){
			ans++;
			break;
		}

	}

	cout << ans << endl;

	return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;

// ===============================================================================

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int count = 1, ans = 0;
  for (int i = 0; i < n; i++) {
    if (v[i] == v[i + 1]) {
      count++;
    } else {
      ans += count / 2;
      count = 1;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if(a < b && b < c) {
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 26240
S=gets.chomp
x=['A','C','G','T']
streak=0
max_streak=0
for i in 0...S.size do
    max_streak=[streak,max_streak].max
    if x.include?(S[i]) then
        streak+=1
    else
        streak=0
    end
end
max_streak=[streak,max_streak].max
p max_streak

Measured memory_bytes: 1788
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			
			HashSet<String> set = new HashSet<String>();
			for(int i = 0; i < N; i++) {
				set.add(sc.next());
			}
			
			System.out.println(set.size());
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}


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

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,r,n) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

#define cout cout << setprecision(12)

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using pq = priority_queue<ll>;

template < typename T >
inline void dbg(T a) { cout << a << ' ' << endl; }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/

int main() {
    cin >> n >> m >> k;
	dbg((n!=k ? '1' : '0'));
}


Measured memory_bytes: 768
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("trapv")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
const ll mod = 7 * 17 * (1 << 23) + 1;
const ll inf = 1e18;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() { //DINIC ORZ
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n, ans;
	cin >> n;
	ans = n+1;
	for(ll i = 1; i*i <= n; i++) {
		if(n%i) continue;
		ans = min(ans, i + (n/i));
	}
	cout << ans-2;
}


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

int main()
{
    int n,i,out = 0;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        out = out^a[i];
    }
    for(i=0;i<n;i++) printf("%d ",out^a[i]);
    return 0;
}


Measured memory_bytes: 3252
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        String s = new Scanner(System.in).next();
        int b = s.indexOf('A');
        int e = s.lastIndexOf('Z');
        s = s.substring(b,e+1);
        System.out.println(s.length());
    }
}

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


int main()
{
    int a,b,c;
    while(cin>>a>>b>>c)
        {
            if(b+c-a>0)
                cout<<b+c-a<<endl;
            else
                cout<<"0"<<endl;
        }
    return 0;
}



Measured memory_bytes: 256
n,y=list(map(int,input().split()))

for i in range(n+1):
    for j in range(n+1-i):
        res=y-10000*i-5000*j-1000*(n-i-j)
        if res==0:
            print('{} {} {}'.format(i,j,n-i-j))
            exit(0)

print('-1 -1 -1')

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

int main()
{
  int N, cnt = 0;
  int d[100001];

  cin >> N;
  for(int i = 0; i < N; i++)
    cin >> d[i];

  sort(d, d + N);
  
  int m = d[N / 2 - 1], l = d[N / 2];
  if(l > m){
    int i = m + 1;
    while(i != l + 1){
      cnt++;
      i++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>

using namespace std;
typedef long long ll;

int main(){
  string a, b, c;
  string d, e, f, g;

  cin>>a>>b>>c;

  d = a[a.size()-1];
  e = b[0];
  f = b[b.size()-1];
  g = c[0];
  if(d==e && f==g){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }

}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;
 
 
 
int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);
 
    vector<long> a(n), b(n);
    vector<pair<long, long> > c(n);
    long i;
    for(i=0; i<n; i++) {
        scanf("%ld%ld", &a[i], &b[i]);
        c[i]=make_pair(a[i]+b[i], i);
    }
    sort(c.begin(), c.end());
 
    ll sum=0;
    for(i=n-1; i>=0; i--) {
        if((n-1+i)%2==0) sum += a[c[i].second];
        else sum -= b[c[i].second];
    }
 
    printf("%lld\n", sum);
 
    return 0;
}


Measured memory_bytes: 3328
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == d:
                e += 1
print(e)


Measured memory_bytes: 3316
#include <iostream>
#include <stdio.h>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>

using namespace std;

#define x first
#define y second
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define all(x) x.begin(),x.end()
#define SZ(x) int(x.size())
#define rep(i, a, b) for(int i = a; i < b; i++)
#define per(i, a, b) for(int i = b-1; i >= a; i--)
#define DBG(x) cerr << (#x) << "=" << x << "\n";
#define ll long long
#define inf 1000000007
#define mod 998244353 //1000000007
#define N 1000005

template<typename U, typename V> void Min(U &a, const V & b){if(a > b)a = b;}
template<typename U, typename V> void Max(U &a, const V & b){if(a < b)a = b;}
template<typename U, typename V> void add(U &a, const V & b){a = (a + b) % mod;} 
template<typename U> U gcd(U a, U b){
	if(a == 0)return b;
    if(b == 0)return a;
	if(a >= b)return gcd(a-b, b);
	else return gcd(a, b - a);
} 
int pow(int a, int b){
    int ans = 1;
    while(b){
        if(b & 1)ans = 1LL * ans * a % mod;
        a = 1LL * a * a % mod;
        b >>= 1;
    }
    return ans;
}

int q[N/10], p[N], cnt[N], f[N], d[N], a[N / 5];
vector<pii> v;
vi e[N];
void gen(int x, vi &e, int q = 1){
    if(x == SZ(v)){
        e.pb(q);
        return;
    }
    rep(i, 0, v[x].y+1){
        gen(x+1, e, q);
        q *= v[x].x;
    }
}
int main(){
    int T, m, n, i, j, k, K;
    int t = 0;
    rep(i, 2, N){
        if(!p[i])q[t++] = i, f[i] = i, d[i] = -1;
        rep(j, 0, t){
            if(1LL * i * q[j] >= N)break;
            p[i * q[j]] = 1;
            if(i % q[j] == 0){
                f[i * q[j]] = f[i];
                d[i] = 0;
                break;
            }
            f[i * q[j]] = q[j];
            d[i * q[j]] = - d[i];
        }
    }
    scanf("%d", &n);
    rep(i, 0, n){
        scanf("%d", &a[i]);
        K = a[i];
        while(K > 1){
            k = f[K];
            j = 0;
            while(f[K] == k)K /= k, j++;
            v.pb({k, j});
        }
        gen(0, e[i]);
        v.clear();
        for(auto &x : e[i])add(cnt[x], a[i]);
    }
    ll ans = 0;
    rep(i, 0, n){
        for(auto &x : e[i]){
            v.clear();
            K = a[i] / x;
            while(K > 1){
                k = f[K];
                j = 0;
                while(f[K] == k)K /= k, j++;
                v.pb({k, j});
            }
            m = SZ(v);
            ll sum = 0;
            rep(j, 0, (1<<m)){
                int sn = 1, q = 1;
                rep(k, 0, m)if(j >> k & 1)q *= v[k].x, sn *= -1;
                sum += cnt[q * x] * sn;
            }
            sum %= mod;
            ans += a[i]/x * sum % mod;
        }
    }
    ans -= cnt[1];
    ans %= mod;
    ll inv2 = (mod + 1)/2;
    ans = ans * inv2 % mod;
    if(ans < 0)ans += mod;
    printf("%lld\n", ans);
}


Measured memory_bytes: 93568
if __name__ == '__main__':
	N,K = map(int, input().split())
	des = [int(a) for a in input().split()]
	ind = [0] * N
	ind[0] = 1
	h = 1
	c = 2
	check = 0
	while(check == 0):
		d = des[h-1]
		if ind[d-1] == 0:
			ind[d-1] = c
			c += 1
		else:
			check = 1
		h = d
	L = ind[d-1]
	R = c
	term = R-L
	if K <= L:
		ans = ind.index(K+1) + 1
	else:
		ans = ind.index(L + (K+1-L)%term)+1
	print(ans)

Measured memory_bytes: 92500
#include <iostream>
#include <string>
#include <math.h>
#include<algorithm>
using namespace std;

int main(){
int N;
  cin >> N;
  int A[N+1];
    A[0]=-N;
  for(int i=1;i<N+1;i++){
   cin >>  A[i];
    A[i]=A[i]-i;
  }
  sort(A,A+N+1);
  long long ans;
      long long sum;
    sum=0;
    for(int i=1;i<N+1;i++){
      ans=ans+abs(A[i]-A[N/2+1]);
    }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 1024
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <vector>
namespace fastIO{
#define getchar() my_getchar()
#define putchar(x) my_putchar(x)
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;
	char buf[IN_BUF], *ps = buf, *pt = buf;
	inline char my_getchar() {
		return ps == pt && (pt = (ps = buf) + fread(buf, 1, IN_BUF, stdin), ps == pt) ? EOF : *ps++;
	}
	template<typename T> inline bool read(T &x){
		char op = 0, ch = getchar();
		for (x = 0; !isdigit(ch) && ch != EOF; ch = getchar()) if (ch == '-') op ^= 1;
		if (ch == EOF) return false;
		for (; isdigit(ch); ch = getchar()) x = x * 10 + (ch ^ '0');
		if (ch != '.') return op ? x = -x : 0, true; else ch = getchar();
		T t = 1;
		for (; isdigit(ch); ch = getchar()) t /= 10, x += (ch ^ '0') * t;
		return op ? x = -x : 0, true;
	}
	inline int reads(char *s){
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar()) ;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) s[n++] = ch;
		return s[n] = '\0', n;
	}
	char pbuf[OUT_BUF], *pp = pbuf;
	struct _flusher{ ~_flusher(){ fwrite(pbuf, 1, pp - pbuf, stdout); } } OutputFlusher;
	inline void my_putchar(char x){
		pp == pbuf + OUT_BUF ? fwrite(pbuf, 1, OUT_BUF, stdout), pp = pbuf : 0, *pp++ = x;
	}
	template<typename T> inline void print_(T x){
		if (x == 0) return putchar('0'), void(0);
		std::vector<int> num;
		for (x < 0 ? putchar('-'), x = -x : 0; x; x /= 10) num.push_back(x % 10);
		while (!num.empty()) putchar(num.back() ^ '0'), num.pop_back();
	}
	template<typename T> inline void print(T x, char ch = '\n'){
		print_(x), putchar(ch);
	}
	inline void prints_(const char *s, int n = -1){
		if (n == -1) n = strlen(s);
		for (register int i = 0; i < n; ++i) putchar(s[i]);
	}
	inline void prints(const char *s, int n = -1, char ch = '\n'){
		prints_(s, n), putchar(ch);
	}
	template<typename T> inline void printd_(T x, int n){
		if (x < 0) x = -x, putchar('-');
		long long a, b;
		for (register int i = 0; i < n; ++i) x *= 10;
		x = (long long)(x + 0.5);
		for (register int i = 0; i < n; ++i) x /= 10;
		a = x, x -= a;
		for (register int i = 0; i < n; ++i) x *= 10;
		b = x;
		print_(a);
		if (n) putchar('.'); else return;
		std::vector<int> num(n);
		for (register int i = 0; i < n; ++i) num[i] = b % 10, b /= 10;
		while (!num.empty()) putchar(num.back() ^ '0'), num.pop_back();
	}
	template<typename T> inline void printd(T x, int n, char ch = '\n'){
		printd_(x, n), putchar(ch);
	}
}
using namespace fastIO;
int a, b;
void solve(){
	read(a), read(b);
	for (register int i = 1; i <= 10000; ++i){
		int x = i * 2 / 25, y = i / 10;
		if (x == a && y == b) return print(i), void(0);
	}
	print(-1);
}
int main(){
#ifdef AT_HOME
	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
#endif
	int T = 1;
	// read(T);
	while (T--) solve();
}

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

namespace CSharpSample01
{

    

    class Program
    {




        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split('/');

            string mm = str[1];
            string dd = str[2];

            string ans;

            if(mm[0] != '0')
            {
                ans = "TBD";
            }
            else
            {
                if(int.Parse(mm[1].ToString()) > 4)
                {
                    ans = "TBD";
                }
                else
                {
                    ans = "Heisei";
                }
            }

            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,k;cin>>n>>k;
  ll num=1,cnt=0;
  while(num<=n) {num*=k;cnt++;}
  print(cnt);
  return 0;
}

Measured memory_bytes: 256
s=input()
set_s=list(set(s))
ans=999999999999999
for i in range(len(set_s)):
    si=set_s[i]
    t=list(s)
#    print(t)
    si_ans=0
    while(len(set(t))>1):
        tdash=[]
        for j in range(len(t)-1):
            if(t[j]==si or t[j+1]==si):
                tdash.append(si)
            else:
                tdash.append(t[j])
        t=tdash
#        print(t)
        si_ans+=1
    if(ans > si_ans):
        ans=si_ans
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll a, b, c;
    cin >> a >> b >> c;

    set<ll> s;
    s.insert(a);
    s.insert(b);
    s.insert(c);

    cout << s.size() << endl;

    return 0;
}

Measured memory_bytes: 3592
N, K = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
GCD = [0 for i in range(K+1)]
for i in range(K, 0, -1):
    # gcd(a1,a2,a3....an)=i の物の数
    S = pow(K//i, N, mod)
    for j in range(2, K//i + 1):
        S -= GCD[j*i]
    GCD[i] = S % mod
for i in range(1, K+1):
    ans += GCD[i]*i
    ans %= mod
print(ans)

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

int main() {
    
    int A,B,X;
    
    cin >> X;

    A = 0;
    B = 0;
    for (int i = -300; i <= 300 ; i++){
        for (int j = -300; j <= 300 ; j++){
            if(pow(i,5) - pow(j,5) == X){
                A = i;
                B = j;
                break;
            }
        }
    }
    
    cout << A << " " << B << endl;
}


Measured memory_bytes: 3976
#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <map>
// #include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};


bool isenki(char c) {
    if (c == 'A' || c == 'T' || c == 'C' || c == 'G') return true;
    return false;
}

bool isacgt(string s) {
    for (int i = 0; i < (int)s.size(); i++) {
        if (!isenki(s[i])) {
            return false;
        }
    }
    return true;
}

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

    int ans = 0;
    for (int i = 0; i < (int)s.size(); i++) {
        for (int j = 0; j <= (int)s.size(); j++) {
            string str = s.substr(i, j);
            // cout << str << endl;
            if (isacgt(str)) {
                // cout << str << endl;
                ans = max(ans, (int)str.size());
            }
        }
    }

    cout << ans << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){

  int n;
  int height[20];

  scanf("%d", &n);

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

  int max = height[0];
  int count = 0;

  for(int i = 0 ; i < n ; i++){
    if(max <= height[i]){
      count++;
      max = height[i];
    }
  }

  printf("%d", count);

  return 0;
}

Measured memory_bytes: 128
// by Balloons
#include <cstdio>
#include <cstring>
#include <vector>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1e9,maxn=2e5+5;
int n,m;
vector<int>g[maxn];
long double dp[maxn],ans=1e18;
void getdp(int ban){
	dp[n]=0;
	for(int i=n-1;i>=1;i--){
		int deg = g[i].size();
		long double mxd=0,sum=0;
		for(auto e : g[i]){
			sum += dp[e];
			mxd = max(mxd, dp[e]);
		}
		if(i == ban&&deg>1){
			-- deg;sum -= mxd;
		}
		dp[i] = sum / deg + 1;
	}
	ans = min(ans,dp[1]); 
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int x,y;scanf("%d%d",&x,&y);
		g[x].push_back(y);
	}
	for(int i=0;i<=n-1;i++)getdp(i);
	printf("%.8Lf\n",ans);
	
	return 0;
}


Measured memory_bytes: 7168
#include <iostream>
using namespace std;
int main()
{
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a*b==c*d)
  cout<<a*b;
  else if(a*b>c*d)
  cout<<a*b;
  else
  {
      cout<<c*d;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>

using namespace std;

#define M  300000

int turn_members(string S, int sum[]){
  int num=0;

  return num;
}
int main(){
  // sum[i] : 0~i-1までのEの累積人数
  int N, i, min, val, sum[M]={0}, me=0;
  string S;
  cin >> N;
  cin >> S;
  min = N;
  for (i = 0; i < N; i++){
    if (S.at(i) == 'E')
       sum[i+1] = sum[i] + 1;
    else
      sum[i+1] = sum[i];
  }
  for (i = 0; i < N; i++){
    if (S.at(i) == 'E')
      me = 1;
    val = (i - sum[i]) + (sum[N] - sum[i+1]);
    if (min > val)
      min = val;

  }

  cout << min << endl;
  return 0;
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define rep(i, n) for(long i = 0; i < n; i++)
#define erep(i, n) for(long i = 1; i <= n; i++)
const long MOD = 1000000007;
#define all(a) a.begin(), a.end()
#define eall(a) a.begin()+1, a.end()
#define show(ans)  cout << ans << endl;


long N;
int main(){
cin >> N;
vector<long> A(N+1);
erep(i, N) cin >> A[i];
long cnt = 0;
long sum = 0;
long Amin = 1e9+3;
erep(i, N){
    if(A[i] < 0){
        cnt++;
        A[i] = -A[i];
    }
    sum += A[i];
    Amin = min(Amin, A[i]);
}
if(cnt % 2 == 0) show(sum);
if(cnt % 2 == 1) show(sum - Amin * 2);

return 0;
}

Measured memory_bytes: 1024
parseInt(x) = parse(Int, x)

function main()
    n = readline() |> parseInt
    a = map(parseInt, readline() |> split)
    b = map(parseInt, readline() |> split)
    c = map(parseInt, readline() |> split)
    m = 0
    for i = 1:n
        m += b[a[i]]
        i < n && (a[i+1] == a[i] + 1) && (m += c[a[i]])
    end
    println(m)
end

main()


Measured memory_bytes: 165952
program main
  implicit none
  integer(8) :: n, i, a, b, mi, ma, md
  integer(8), allocatable :: h(:)
  read *, n, a, b
  allocate (h(n))
  do i = 1, n
    read *, h(i)
  end do

  mi = 0  ! NG
  ma = 10 ** 9  ! OK
  do while (ma - mi > 1)
    md = mi + (ma - mi) / 2
    if (isok(md)) then
      ma = md
    else
      mi = md
    end if
  end do
  print "(i0)", ma

  contains

  logical function isok(x)
    integer(8), intent(in) :: x
    integer(8) :: i, cnt
    cnt = 0
    do i = 1, n
      cnt = cnt + ceiling(max(h(i) - x * b, 0_8) / dble(a - b))
    end do
    isok = (cnt <= x)
  end function isok
end program main


Measured memory_bytes: 1024
# bit 全探索
# https://beta.atcoder.jp/contests/abc079/tasks/abc079_c

if __name__ == '__main__':
    v = input()
    d = len(v) - 1

    for bit in range(1 << d):
        expr_i = v[0]
        sum_i = int(v[0])
        for i in range(d):
            if bit & (1 << i) != 0:
                expr_i += '+' + v[i + 1]
                sum_i += int(v[i + 1])
            else:
                expr_i += '-' + v[i + 1]
                sum_i -= int(v[i + 1])

        if sum_i == 7:
            expr_i += '=7'
            print(expr_i)
            exit(0)


Measured memory_bytes: 3060
/*
    author:ujwalll
*/
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std; 
#define rep(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
const int INF = 1<<29;
const int MOD=1073741824;
#define pp pair<ll,ll>
#define ppi pair<int,int>
typedef long long int ll;
bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
}
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
////////////////////////////////////////////////////////////////////

int main(){
    int tc=1;
    // cin>>tc;
    while(tc--){
        ll n;
        cin>>n;
        ll a[n];
        rep(i,n)cin>>a[i];
        ll ans=0,mx=a[0];
        for1(i,n-1){
            if(a[i]<mx){
                ans+=mx-a[i];
                a[i]=mx;
                continue;
            }
            mx=max(mx,a[i]);
        }
        cout<<ans;   
    }
}

Measured memory_bytes: 5192
object Main extends App {
	val strAry = io.StdIn.readLine().split(' ')
	val num1 = strAry(0).toInt
	val num2 = strAry(1).toInt
	val num3 = strAry(2).toInt
	
	val result = if(num1 < num2 && num2 < num3) {
		"Yes"
	} else {
		"No"
	}
	
	println(result)
}


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

int main() {
  int H,W;
  int h,w;
  int y,x;
  cin>>H>>W;

  vector<string> c(H+2);
  c[0]=string(W+2,'$');
  for(int a=1;a<H+1;a++){
    cin>>c[a];
    c[a]='$'+c[a]+'$';
  }
  c[H+1]=string(W+2,'$');

  int ans=0;
  queue<int> q1;
  queue<int> q2;
  vector<vector<int>> dist(H+2,vector<int>(W+2));
  for(int i=0; i<H+2; i++){
    for(int g=0; g<W+2; g++){
      dist[i][g]=-1;
      if(c[i][g]=='#'){
        q1.push(i);
        q2.push(g);
        dist[i][g]=0;
      }
    }
  }

  vector<vector<int>> direction{{0,1},{1,0},{0,-1},{-1,0}};

  while(!q1.empty()){
    h=q1.front();
    w=q2.front();
    q1.pop();
    q2.pop();
    for(int i=0;i<4;i++){
      y=direction[i][0];
      x=direction[i][1];
      if (c[h+y][w+x]=='.' && dist[h+y][w+x]==-1){
        q1.push(h+y);
        q2.push(w+x);
        dist[h+y][w+x]=dist[h][w]+1;
        ans=max(ans,dist[h+y][w+x]);
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 14464
N = int(input())
L = [0]*10000
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            tmp = i**2+j**2+k**2+i*j+j*k+i*k
            if 1 <= tmp <= 10000:
                L[tmp-1] +=1
for i in range(N):
    print(L[i])

Measured memory_bytes: 69396
#include <cstdio>
using namespace std;
using ll = long;
const ll N = 200010;
ll a[N], n, k, pos;
int main()
{
	scanf("%lld%lld", &n, &k);
	for (ll i = 1; i <= n; i++)
		scanf("%lld", a + i);
	for (ll i = 1; i < n; i++)
		if (a[i] + a[i + 1] >= k)
		{
			pos = i;
			break;
		}
	if (pos == 0)
		return puts("Impossible"), 0;
	puts("Possible");
	for (ll i = 1; i < pos; i++)
		printf("%lld\n", i);
	for (ll i = n -1; i > pos ; i--)
		printf("%lld\n", i);
	printf("%lld", pos);
}

Measured memory_bytes: 1536
n = int(input())
c=0

#フェルマーの小定理
def is_prime(q):
    q = abs(q)
    if q == 2:
        return True
    if q < 2 or q&1 == 0:
        return False
    return pow(2, q-1, q) == 1

for i in range(n):
    m = int(input())
    if is_prime(m)==1:
        c+=1

print(c)


Measured memory_bytes: 5612
#include <cstdio>
#include <algorithm>

int n,p[200005];
double Ans;

int main()
{
    scanf("%d",&n),n<<=1;
    for(int i=0;i<n;++i)scanf("%d",&p[i]);
    std::sort(p,p+n);
    for(int i=0;i<n;++i)Ans+=(double)i*p[i];
    printf("%.9f\n",Ans/(n-1));
    return 0;
}

Measured memory_bytes: 896
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Iterator;

class Graph {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	private int[] bfs;
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
		bfs = new int[totalVertex];
	}
	public void BFS(int s) 
    { 
        // Mark all the vertices as not visited(By default 
        // set as false) 
        boolean visited[] = new boolean[totalVertex]; 
  
        // Create a queue for BFS 
        LinkedList<Integer> queue = new LinkedList<Integer>(); 
        LinkedList<Integer> queue2 = new LinkedList<Integer>(); 
  
        // Mark the current node as visited and enqueue it 
        visited[s]=true; 
        queue.add(s);
  
        while (queue.size() != 0) 
        { 
            // Dequeue a vertex from queue and print it 
            s = queue.poll();
            queue2.add(s);
  
            // Get all adjacent vertices of the dequeued vertex s 
            // If a adjacent has not been visited, then mark it 
            // visited and enqueue it 
            Iterator<Integer> i = adjList.get(s).listIterator(); 
            while (i.hasNext()) 
            { 
                int n = i.next(); 
                if (!visited[n]) 
                {
                    visited[n] = true; 
                    queue.add(n);
                    bfs[n] = bfs[s] + 1;
                }
                
            } 
        } 
        for(int i = 0; i < totalVertex; i++) {
        	if(i != 0 && bfs[i] == 0) bfs[i] = -1;
        }
        for(int i = 0; i < totalVertex; i++) {
        	System.out.print((i + 1) + " " + bfs[i]);
        	System.out.println();
        }
    }
}

public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		g.BFS(0);
	}
}


Measured memory_bytes: 28360
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll keta[62][2];
int main() {
	ll n;
	cin>>n;
	ll ch[300010];
	for(ll i=0;i<n;i++){
		cin>>ch[i];
	}
	for(ll i=0;i<n;i++){
		ll now=ch[i];
		ll j=0;
		while(j<62){
			keta[j][now%2]++;
			j++;
			now/=2;
		}
	}
	ll ans=0;
	ll k=1;
	for(ll i=0;i<62;i++){
		ll now=keta[i][0]*keta[i][1];
		now%=inf;
		ll cnt=k*now;
		cnt%=inf;
		ans+=cnt;
		ans%=inf;
		k*=2;
		k%=inf;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 5968
#include <iostream>

using namespace std;

int main()
{
    string s;
    cin >> s;
    if (s[5] == '0' && s[6] < '4'){
        cout << "Heisei";
        return 0;
    }else if (s[6] == '4'){
        if (s[8] == '2' || s[8] == '1' || s[8] == '0'){
            cout << "Heisei";
            return 0;
        }else if (s[9] == '0'){
            cout << "Heisei";
            return 0;
        }else{
            cout << "TBD";
            return 0;
        }
    }else{
        cout << "TBD";
        return 0;
    }
    return 0;
}


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

using namespace std;

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  for ( ; ; )
  {
    int           res = 0;
    string        s;
    const char  * p;

    getline ( cin, s );
    if ( s == "END OF INPUT" )  break ;

    for ( p = s.c_str ( ); *p != '\0'; ++p )
    {
      if ( isspace ( *p ) )
      {
        cout << res;
        res = 0;
      }
      else
      {
        ++res;
      }
    }
    cout << res << endl;
  }

  return ( 0 );
}

Measured memory_bytes: 0
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        if (A > B) System.out.println(2*A -1);
        else if (B > A) System.out.println(2*B -1);
        else System.out.println(A +B);
//        return;
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main() {
int N; 
cin >> N; 
int X[110], Y[110], H[110]; 
for(int i = 0; i < N; i++){
cin >> X[i] >> Y[i] >> H[i]; 
}

int minheight = H[0]; 
for(int i = 0; i < N; i++){
minheight = min(minheight, H[i]); 
}

int A[110][110][110] = {}, M[110][110] = {}, m[110][110] = {}; 

for(int x = 0; x <= 100; x++){
  for(int y = 0; y <= 100; y++){
    for(int i = 0; i < N; i++){
A[x][y][i] = H[i] + abs(x - X[i]) + abs(y - Y[i]); 
}
}
}

int ansx = 0, ansy = 0, ansh = 0; 

if(minheight > 0){
for(int x = 0; x <= 100; x++){
  for(int y = 0; y <= 100; y++){
M[x][y] = A[x][y][0], m[x][y] = A[x][y][0]; 
}
}

for(int x = 0; x <= 100; x++){
  for(int y = 0; y <= 100; y++){
    for(int i = 1; i < N; i++){
M[x][y] = max(M[x][y], A[x][y][i]); 
m[x][y] = min(m[x][y], A[x][y][i]); 
}
}
}
for(int x = 0; x <= 100; x++){
  for(int y = 0; y <= 100; y++){
    if(M[x][y] == m[x][y]){
ansx = x, ansy = y, ansh = M[x][y]; 
}
}
}
cout  << ansx << " " << ansy << " " << ansh << endl; 
}

else if(minheight == 0){
int ansx = 0, ansy = 0, ansh = 0; 
for(int x = 0; x <= 100; x++){
for(int y = 0; y <= 100; y++){
for(int h = 1; h <= 200; h++){
for(int i = 0; i < N; i++){
if(max(h - abs(x-X[i]) - abs(y-Y[i]), 0) != H[i]){
break; 
}
if(i == N-1 && max(h - abs(x-X[i]) - abs(y-Y[i]), 0) == H[i]){
ansx = x, ansy = y, ansh = h; 
}
}
}
}
}

cout  << ansx << " " << ansy << " " << ansh << endl; 
}
}

Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
int main()
{
    double n;
    cin>>n;
    double cnt=0;
    double x;
    for(int i=1;i<=n;i++)
    {
        if(i%2!=0)
        {
            cnt++;
        }

    }
     x=cnt/n;
    cout<<fixed<<setprecision(10)<<double(x)<<endl;

}


Measured memory_bytes: 3768
//C
#include <cassert>
//#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//ここまで標準include

using namespace std;

long aCb(long a, long b) {
	long out = 1;
	for (long i = 1; i <= b; i++) {
		out = out * (a + 1 - i) / i;
	}
	return out;
}

int main() {
	int a, b;
	cin >> a >> b;
	cout << max({ a + b,a - b,a * b }) << endl;
}
	


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(i,k,n) for(ll i = (k); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
typedef long long ll;

int main(){
    ll x;
    cin>>x;
    vector<ll> dp(0);
    int i=0;
    while(true){
        ll bb = pow(i,5);
        dp.push_back(bb);
        if(binary_search(all(dp),x-bb)){
            int a = lower_bound(dp.begin(),dp.end(),x-bb)-dp.begin();
            cout<<i<<" "<<-a<<endl;
            return 0;
        }
        else if(binary_search(all(dp),bb-x)){
            int b = lower_bound(dp.begin(),dp.end(),bb-x)-dp.begin();
            cout<<i<<" "<<b<<endl;
            return 0;
        }
        i++;
    }
    return 0;
}


Measured memory_bytes: 4056
#include <stdio.h>
int n,x,c[100001];
long long int cnt;
int main() {
	scanf("%d%d",&n,&x);
	for(int i=0;i<n;i++)
		scanf("%d",c+i);
	for(int i=1;i<n;i++) {
		int t=c[i-1]+c[i];
		int tx=t-x;
		if(t>x) {
			if(c[i]>=tx) {
				c[i]-=tx;
				cnt+=tx;
			}
			else {
				cnt+=tx;
				c[i-1]-=(tx-c[i]);
				c[i]=0;
			}
		} 
	}
	printf("%lld\n",cnt);
}

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

int main(){
	int a,b;
	cin >> a >> b;
	string c = to_string(a) + to_string(b);
	int d = stoi(c);
	a = (int) sqrt(d);
	if (a*a == d) cout << "Yes";
	else cout << "No";
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n;
vector<int>edge[200005];
int dp[100005][3],V;
int dfs(int v,int u){
	rep(i,edge[v].size()){
		if(edge[v][i] == u) continue;
		dfs(edge[v][i],v);
	}
	{
		ll t[2][2][2];
		rep(a,2)rep(b,2)rep(c,2)t[a][b][c] = INF;
		t[0][0][0] = 0; t[0][0][1] = 1;
		int cur = 0,nxt = 1;
		rep(i,edge[v].size()){
			if(edge[v][i] == u) continue;
			rep(a,2)rep(b,2)t[nxt][a][b] = INF;
			t[nxt][0][1] = min(t[nxt][0][1],min(t[cur][0][0],t[cur][0][1])+min(dp[edge[v][i]][0],dp[edge[v][i]][1]));
			t[nxt][1][0] = min(t[nxt][1][0],t[cur][0][0]+dp[edge[v][i]][2]);
			t[nxt][1][1] = min(t[nxt][1][1],min(t[cur][0][1],t[cur][0][1])+min(dp[edge[v][i]][2],dp[edge[v][i]][2]));
			t[nxt][1][1] = min(t[nxt][1][1],min(t[cur][1][0],t[cur][1][1])+min(dp[edge[v][i]][0],dp[edge[v][i]][1]));
			swap(cur,nxt);
		}
		dp[v][0] = t[cur][0][1];
		dp[v][1] = t[cur][1][1];
		dp[v][2] = min(t[cur][0][0],t[cur][1][0]);
		//cout << v << dp[v][0] << dp[v][1] << dp[v][2] << endl;
		return min(dp[v][0],min(dp[v][1],dp[v][2]));
	}
}
int main(){
	cin>>n;
	for(int i=1;i<n;i++){
		int a,b;cin>>a>>b;
		edge[a].pb(b);
		edge[b].pb(a);
	}
	for(int i=0;i<n;i++){
		if(edge[i].size() >= 3){
			cout << dfs(i,-1) << endl;
			return 0;
		}
	}
	cout << 1 << endl;
}

Measured memory_bytes: 16896
from itertools import combinations

# input
N = int(input())
A = set(map(int, input().split()))

if len(A) == 1:
    print(0)
else:
    nc2 = combinations(A, 2)

    max_sub = max(
        [
            max(a - b, b - a)
            for a, b in nc2
        ]
    )

    print(max_sub)


Measured memory_bytes: 3188