akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner scan = new Scanner(System.in);
			String nyumoji = scan.next();

			String outpt = "";
			for(int i = 0; i < nyumoji.length(); i++){
				outpt +=nyumoji.charAt((nyumoji.length()-1) - i);
			}
			System.out.println(outpt);
			scan.close();
	}
}

Measured memory_bytes: 25856
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int m[14],w[10],w2[10],a[9];

void f0(int *ws,int *k)
{
	int j;
	for(j=1;ws[j]==0;j++);
	if(ws[j]>2)
	{
		ws[j]-=3;
		(*k)++;
	}
}

void f1(int *ws,int *k)
{
	int j;
	for(j=1;j<8;)
	{
		if(ws[j]>0&&ws[j+1]>0&&ws[j+2]>0)
		{
			ws[j]--;ws[j+1]--;ws[j+2]--;(*k)++;
		}
		else
			j++;
	}
}

void f2(int *ws,int *k)
{
	int j;
	for(j=1;j<=9;j++)
		if(ws[j]>=3)
		{
			ws[j]-=3;
			(*k)++;
		}
}
int s(int *ws)
{
	int j,k=0;
	f0(ws,&k);
	f1(ws,&k);
	f2(ws,&k);
	return k;
}

int s2(int *ws)
{
	int k=0;
	f0(ws,&k);
	f2(ws,&k);
	f1(ws,&k);
	return k;
}

int main()
{
	int i,j,k,l,x;
	while(scanf("%1d",&m[0])==1)
	{
		for(i=1;i<13;i++)
			scanf("%1d",&m[i]);
		x=0;
		for(i=1;i<=9;i++)
		{
			for(l=1;l<=9;l++)
			{
				k=0;
				memset(w,0,sizeof(w));
				for(j=0;j<13;j++)
					w[m[j]]++;
				if(w[i]+1>4)
					continue;
				w[i]++;
				if(w[l]<2)
					continue;
				w[l]-=2;
				memcpy(w2,w,sizeof(w));
				if(s(w)==4||s2(w2)==4)
				{
					a[x++]=i;
					break;
				}
			}
		}
		if(x==0)
			printf("0\n");
		else
			for(i=0;i<x;i++)
				printf("%d%s",a[i],i==x-1?"\n":" ");
	}
	return 0;
}

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

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

  cin >> N;
  n = N;

  for (i = 0;i < 8;i++){
    if (n < 10) {
      f += n;
      break;
    } else {
      f += n % 10;
      n /= 10;
    }
  }

  if (N % f) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }  

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i += 2) {
        int cnt = 0;
        for (int j = 1; j <= i; j++) {
            if (i % j == 0) cnt++;
        }
        if (cnt == 8) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int a, b, c, d,e,f;
	int x = 0, y = 0;
	int z, z_;
	int ans_a = 0, ans_b = 0, ans_c = 0, ans_d = 0;
	double m,n,max = 0;
	scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);

	m = 1.0 * e / 100;
	for (int i = 0; i <= 30; i++)
	{
		int ii = a * 100 * i;
		if (f < ii) break;
		for (int j = 0; j <= 30; j++)
		{
			int jj = b * 100 * j;
			if (f < jj + ii) break;
			for (int k = 0; k < 5000; k++)
			{
				int kk = c * k;
				if (f < ii + jj + kk) break;
				for (int l = 0; l < 5000; l++)
				{
					int ll = d * l;
					if (f < ii + jj + kk + ll) break;
					x = a*i * 100 + b*j * 100;
					y = c*k + d*l;
					if (f >= x + y && x != 0)
					{
						n = 1.0 * y / x;
						if (m >= n)
						{
							if(max <= n)
							{
								max = n;
								//z = ii + jj;
								//z_ = kk + ll;
								ans_a = i;
								ans_b = j;
								ans_c = k;
								ans_d = l;
							}
						}
					}
				}
			}
		}
	}
	//printf("%d %d", z + z_, z_);
	printf("%d %d", ((a*ans_a * 100) + (b*ans_b * 100) + (c*ans_c) + (d*ans_d)), ((c*ans_c) + (d*ans_d)));
	return 0;
}

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	ll x,y;
	cin >> x >> y;
	if(x * y == 0){
		ll ans = abs(x - y);
		if(x > y)ans++;
		ANS(ans);
	}else if(x * y < 0){
		ANS(abs(abs(x) - abs(y)) + 1);
	}else{
		ll ans = abs(x - y);
		if(x > y)ans+=2;
		ANS(ans);
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define p 1000000007
int main()
{
	int n;
	cin>>n;
	long long int a[n];
	long long int sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum=(sum%p+a[i]%p)%p;
	}
	long long int pre[n];
	pre[0]=(sum-a[0]+p)%p;
	for(int i=1;i<n;i++)
	{
		pre[i]=(pre[i-1]-a[i]+p)%p;
	}
	long long int ans=0;
	for(int i=0;i<n;i++)
	{
		ans=(ans%p+((a[i]%p)*(pre[i]%p))%p)%p;
	}
	cout<<ans<<"\n";
	

}

Measured memory_bytes: 6760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define cu continue
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf 1000000000
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define f first
#define s second
#define vll vector <ll>
#define dbg(n) cout<<n<<' ';

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

    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(ll i=0;i<n;i++)
        cin>>a[i];
    ll dp[k+1];
    memset(dp,0,sizeof dp);
    for(ll j=1;j<=k;j++)
    {
        for(ll i=0;i<n;i++)
        {
            if(j-a[i]<0)
                cu;
            dp[j]=(dp[j-a[i]]^1)|(dp[j]);
        }
    }
    if(dp[k]&1)
        cout<<"First\n";
    else
        cout<<"Second\n";
}       


Measured memory_bytes: 1024
N = int(input())

D = [int(x) for x in input().split(" ")]
dic = {}

for d in D:
    if d in dic:
        dic[d] += 1
    else:
        dic[d] = 1

M = int(input())
T = [int(x) for x in input().split(" ")]

NO = False

for t in T:
    if t not in dic:
        NO = True
    else:
        dic[t] -= 1
        if dic[t] < 0:
            NO = True
    if NO:
        break

print('YES' if not NO else 'NO')



Measured memory_bytes: 47700
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define reep(i,n) for(ll i = n; i >-1; i--)
#define deb(variable) cout<<#variable<<"="<<variable<<endl
#define MMOD(i) ((i%MOD)+MOD)%MOD;
#define vec(i,j) vector<vector<ll>>(i,vector<ll>(j,0))
const ll INF=99999999999999999;
const ll MOD=128;
const ll MAX_N=500010;
double a,c,d,e,x,y,z,k,m,n,l,q,ans=0,sum=0,sum2=0;
vl v;
vector<double> v1;
vp p;
string s;
double solve(void){
    for(double i=1;i<k+1;i++){
        a=i;
        ll b=0;
        while(a<n){
            a*=2;
            b++;
        }
        ans+=v1[b];
    }
    return ans/k;
}
int main(){
    v1.push_back(1);
    rep(i,60){
        v1.push_back(v1.back()/(double)2);
    }
 
    cin>>k>>n;
    a=solve();
    printf("%.10f",a);
}

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

vector<pair<char, int>> RLE(const string &S) {
    vector<pair<char, int>> res;
    int N = (int)S.size();
    for(int i = 0; i < N; ++i) {
        int j = i;
        while(j < N && S[i] == S[j]) j++;
        res.emplace_back(S[i], j - i);
        i = j - 1;
    }
    return res;
}

int main() {
    int N, K;
    cin >> N >> K;
    map<char, int> score;
    string H = "spr";
    rep(i, 3) {
        int s; cin >> s;
        score[H[i]] = s;
    }
    string T; cin >> T;
    vector<string> S(K);
    rep(i, N) S[i % K] += T[i];
    auto solve = [&](const string &s) -> int {
        auto R = RLE(s);
        int res = 0;
        for(auto &t : R) {
            int n = (t.second + 1) / 2;
            res += n * score[t.first];
        }
        return res;
    };
    int ans = 0;
    for(auto &s : S) ans += solve(s);
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+10;ll sum[N],X[N];
ll a[N];
int main(){
    int n;scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
    sum[1]=X[1]=a[1];
    for(int i=2;i<=n;i++) sum[i]=sum[i-1]+a[i],X[i]=X[i-1]^a[i];
    ll ans=0;int l=1;
    for(int r=1;r<=n;r++){
        for(;sum[r]-sum[l-1]!=(X[r]^X[l-1]);l++);
        ans+=(r-l+1);
    }
    printf("%lld\n",ans);
    return 0;
}

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

int main()
{
int n1=0,n2=0,n3=0;
for(int i=0;i<10;i++){
int a;cin>>a;
if(n1<a){
n3=n2;n2=n1;n1=a;
}
else if(n2<a){
n3=n2;n2=a;
}
else if(n3<a){
n3=a;
}
}

cout<<n1<<endl<<n2<<endl<<n3<<endl;
}

Measured memory_bytes: 0
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

n=int(input())
arr=list(map(int,input().split()))
g=arr[0]
cnt=[0]*(10**6+1)
for val in arr:
  g=gcd(g,val)
  cnt[val]+=1
for i in range(2,10**6+1):
  tmp=0
  for j in range(i,10**6+1,i):
    tmp+=cnt[j]
  if tmp>=2:
    break
if i==10**6:
  print('pairwise coprime')
elif g==1:
  print('setwise coprime')
else:
  print('not coprime')

Measured memory_bytes: 195028
#include<stdio.h>
void cha(int n,int a1[],int c1[]){
for(int i=0;i<n;i++){
        c1[i]=a1[i];
    for(int j=0;j<i;j++){
            if(a1[i]>a1[j]){
                c1[i]--;
            }   
        }
    }
}

int main(void){
    int N;
    int a[10];
    int b[10];
    int ch[10];
    int nm=1;
    int L1=1;
    int L2=1;

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

for(int i=1;i<=N;i++){
    nm=nm*i;
}

cha(N,a,ch);

for(int i=0;i<N-1;i++){
    nm=nm/(N-i);
    L1=L1+nm*(ch[i]-1);
}

nm=1;

for(int i=1;i<=N;i++){
    nm=nm*i;
}
cha(N,b,ch);

for(int i=0;i<N-1;i++){
    nm=nm/(N-i);
     L2=L2+nm*(ch[i]-1);


}

if(L1>L2){
    printf("%d\n",L1-L2);
  }else{
    printf("%d\n",L2-L1);
}

return 0;
}

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

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

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

  ll x = min(b - 1, n);
  ANS(a * x / b - a * (x / b));
  return 0;
}


Measured memory_bytes: 3464
#include "bits/stdc++.h"

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define EPS (1e-7)
#define INF ((ll)1e9+7)
#define PI (acos(-1))
#define c(a) cout<<a<<"\n";
using namespace std;

int main() {
	speed;
	int h, w;
	char a[101][101];
	cin >> h >> w;
	rep(i, h) {
		rep(j, w) {
			cin >> a[i][j];
		}
	}
	vector<bool>hf(h, false);
	vector<bool>wf(w, false);
	rep(i, h) {
		rep(j, w) {
			if (a[i][j] == '#') {
				hf.at(i) = true;
				wf.at(j) = true;
			}
		}
	}
	rep(i, h) {
		if (!hf.at(i))continue;
		rep(j, w) {
			if (!wf.at(j))continue;
			cout << a[i][j];
		}
		ed;
	}
	ed;
	return 0; 
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	char a[100], b[100], str[100];
	int i, j, cnt = 0, n;
	scanf("%s", str);
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%s", a);
		strcat(a, a);
			if (strstr(a, str) != 0) {
				cnt++;

			}
	}
	printf("%d\n", cnt);
}

Measured memory_bytes: 2688
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define MAX(a, b) ((a)>(b)?(a):(b))
#define MIN(a, b) ((a)<(b)?(a):(b))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;

typedef long long ll;

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

  string rs = "";
  REP(i, s.size()){
    rs += s[s.size()-1 - i];
  }

  if(s == rs){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int N;
int64_t cont=0;


ll dfs(bool odd,int64_t sum,int i,vector<int64_t> &a){

  ll ans;
  if(i==N){
    ans = cont;
    cont =0;
    return ans;
  }

  if(odd){
    if(a[i]+sum<=0){
      cont += abs(1-sum-a[i]);
      sum = 1;
    }else{
      sum+=a[i];
    }
    //cout << i << endl;
    ans = dfs(false,sum,i+1,a);
  }else{
    if(a[i]+sum>=0){
      cont += abs(-1-sum-a[i]);
      sum = -1;
    }else{
      sum+=a[i];
    }
    //cout << i << endl;
    ans=dfs(true,sum,i+1,a);
  }

  return ans;
}

int main(){
  ll ans;
  cin >> N;
  vector<int64_t> a(N);
  for(int i=0;i<N;i++){
    cin >> a.at(i);
  }
  ans = min(dfs(true,0,0,a),dfs(false,0,0,a));
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
using namespace std;
int n;
int all = 0;
int a[200], b[200];
vector<int> v;
void depart(int left, int right) {
	if (left >= right)
	{
		return;
	}
	int k=0;
	for (int i = 0; i < n; i++) {
		if (a[all] == b[i]) {
			k = i;
			/*depart(i+1, right);
			cout << " ";
			cout <<b[i];*/
		}
	}
	int t = a[all++];
	depart(left, k);
	depart(k+1, right);
	v.push_back(t);
}
int main(void) {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	depart(0, n);
	for (int i = 0; i != v.size(); i++) {
		if (i) cout << " ";
		cout << v[i];
	}
	cout << endl;
}


Measured memory_bytes: 3160
#include<bits/stdc++.h>
#define endl '\n'

using namespace std;

string a;

int main() {
    cin >> a;
    int case1=0, case2=0;/// 101 010
    for (int i = 0; i < a.size(); ++i) {
        if (i%2==0) {
            case1+=a[i]-'0';
            case2+=!(a[i]-'0');
        }
        if (i%2==1) {
            case2+=a[i]-'0';
            case1+=!(a[i]-'0');
        }
    }
    cout << min(case1, case2) << endl;
    return 0;
}


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

int main()
{
  int k,n,m;
  cin>>k>>n;
  m=0;
  vector<int> a(n);
  for(int i=0;i<n;i++)
  {
    cin>>a.at(i);
  }
  for(int i=0;i<n-1;i++)
  {
    m=max(m,(a.at(i+1)-a.at(i)));
  }
  m=max(m,(k-a.at(n-1)+a.at(0)));
  cout<<k-m<<endl;
}

Measured memory_bytes: 3996
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

int main(const int args, const char* argv[])
{
    double x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << fixed << setprecision(6) << sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)) << endl;

    return 0;
}


Measured memory_bytes: 3268
/*▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄█████████████  █▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐*/
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
#pragma GCC optimize("fast-math")
#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define DEBUG
#define fi first
#define se second
#define pqueue priority_queue
#define pb(x) push_back(x)
//#define endl '\n'
#define all(x) x.begin(), x.end()
#define int long long
#define mk(a, b) make_pair(a, b)
     
using namespace std;
      
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<ll> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
// typedef tuple<ll, ll, ll> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector< vector<ll> > vvi;
typedef vector<char> vc;
      
const ll INF = 1e9 + 228;
const ll INFLL = 1e18;
const ll MOD = 1e9 + 7;
//static const int maxn = 2e5 + 228;;
const ld eps = 1e-7;
const ld eps2 = 1e-9;
const ll MOD2 = 998244353;
const ll dosz = 5e5;
const ll SZ = (1<<18);
const ld PI = atan2l(0, -1);
     
void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef DEBUG
//      freopen("haybales.in", "r", stdin);
//      freopen("haybales.out", "w", stdout);
    #endif
}

void solve(){
	int n;
	int c;
	cin >> n >> c;
	if(n<c)
		swap(n, c);
	string ans = "";
	for(int i=0; i<n; i++)
		ans += (c+'0');
	cout << ans << endl;
	
	
}

signed main(){
        fast_io();
	srand(time(NULL));
//	cout << fixed << setprecision(12);
	int q = 1;
//	cin >> q;
	while(q--)
		solve();
     
}





Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
int main() {
	int a, b;
	cin >> a >> b;
	VE vec{ a + b,a - b,a * b };
	cout << *max_element(vec.begin(),vec.end()) << endl;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>
#include<functional>
#include<limits>
#include <unordered_map>
#include <numeric>
#include <array>
#include <queue>
#include <chrono>
#include <random>
#include <fstream>


using namespace std;
using  ull = unsigned long long int;

#define rep(i,n,m) for(long long int i=n;i<(long long int)(m);i++)
#define INF (1<<29)
#define MD 1000000007

int main() {
	long N, M, all;
	cin >> N >> M;
	all = N*M;
	if (N == 1 && M == 1)cout << "1" << endl;
	else if (N == 1 || M == 1) {
		long up = max(N, M);
		cout << all - 2 << endl;
	}else if(3<=N && 3<=M){
		cout << all - (N-2)*2 -(M-2)*2 -4<< endl;
	}
	else cout << "0" << endl;
	



	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int ch1,ch2;
  cin>>ch1>>ch2;
  int a=ch1+ch2;
  if(a==3)
     cout<<"3"<<endl;
  else if(a==4)
     cout<<"2"<<endl;
  else 
     cout<<"1"<<endl;
}


Measured memory_bytes: 256
w = gets.to_i
n = gets.to_i
aArray = Array.new(n)
bArray = Array.new(n)
ans = Array.new(w)
n.times { |count|
	aArray[count], bArray[count] = gets.split(',').map(&:to_i)
}

now = 0
w.times { |vbar|
	now = vbar+1
	n.times { |hbar|
		if now == aArray[hbar]
			now = bArray[hbar]
		elsif now == bArray[hbar]
			now = aArray[hbar]
		end
	}
	ans[now-1] = vbar+1
}

ans.count { |i|
	puts i
}

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

const int maxS = 1e5 + 7;
vector<int> graph[maxS];
vector<int> rgraph[maxS];

vector<int> inDegree(maxS, 0), outDegree(maxS, 0), len(maxS, 0); 
bool visit[maxS];
vector<int> S(maxS, 0), E(maxS, 0);

void DFS(int node, int & timeCounter) {
  
  if(visit[node] == true) {
      return ;
  }
  
  visit[node] = true;
  S[node] = timeCounter;
  timeCounter ++;
  for(int child: graph[node]) {
      DFS(child, timeCounter);
  }
  E[node] = timeCounter; 
  timeCounter ++;
}

int main() {    
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int N, M, x, y;
  cin >> N >> M;
  
  for(int i = 0;i < M;i ++) {
    cin >> x >> y;
    graph[x].push_back(y);
    rgraph[y].push_back(x);
    inDegree[y] ++;
    outDegree[x] ++;
  }
  
  int timeCounter = 1;
  for(int i = 1;i <= N;i ++) {
    if(visit[i] == false) { 
          DFS(i, timeCounter);
    }    
  }
  pair<int, int> parr[N+1];
  for(int i = 1;i <= N;i ++) {
      parr[i] = {E[i], i};
  }
  sort(parr + 1, parr + N + 1);
  int node, maxLen = 0;
  for(int i = N;i >= 1;i --) {
      node = parr[i].second;
    maxLen = max(maxLen, len[node]);
    for(int child: graph[node]) {
      len[child] = max(len[child], len[node] + 1);    
      maxLen = max(maxLen, len[child]);
    }
  }
  
  cout << maxLen ;
  
}


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

int main()
{
	int N, K;
	cin >> N >> K;
	while (K--) {
		int x, y;
		cin >> x >> y;
		cout << min(min(x - 1, N - x), min(y - 1, N - y)) % 3 + 1 << endl;
	}
	return 0;
}



Measured memory_bytes: 3096
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

int N,K,L,u,v,cnt[202018];
long long bb[4][202018];

int zbb(int i,int c)
{
	return bb[c][i]==i?i:bb[c][i]=zbb(bb[c][i],c);
}

int main()
{
	scanf("%d %d %d",&N,&K,&L);
	for(int i=1;i<=N;i++)
		bb[0][i]=i,bb[1][i]=i,bb[2][i]=i,bb[3][i]=i;
		
	for(int i=1;i<=K;i++)
	{
		scanf("%d %d",&u,&v);
		int p=zbb(u,0),q=zbb(v,0);
		if(p!=q) bb[0][q]=p;
	}
	
	for(int i=1;i<=L;i++)
	{
		scanf("%d %d",&u,&v);
		int p=zbb(u,1),q=zbb(v,1);
		if(p!=q) bb[1][q]=p;
	}
	
	for(int i=1;i<=N;i++)
		bb[2][i]=bb[3][i]=zbb(bb[0][i],0)+1LL*zbb(bb[1][i],1)*(N+1);
	
	sort(bb[3]+1,bb[3]+1+N);
	for(int i=1;i<=N;i++)
	{
		int pos=lower_bound(bb[3]+1,bb[3]+1+N,bb[2][i])-bb[3];
		cnt[pos]++;
	}
	for(int i=1;i<=N;i++)
	{
		int pos=lower_bound(bb[3]+1,bb[3]+1+N,bb[2][i])-bb[3];
		cout<<cnt[pos]<<' ';
	}
}

Measured memory_bytes: 7680
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
      double r=sc.nextDouble();
     double pi=Math.PI;
     double area=r*r*pi;
     double length=2*r*pi;
      System.out.printf("%f %f",area,length);
    }
    
}


Measured memory_bytes: 28112
/// WA

#include<bits/stdc++.h>
     
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()

using namespace std;

using ll = long long;
using pii = pair<int, int>;                                   

const int MOD = 1e9 + 7;
const int INF32 = 1e9 + 1e2;

void stndrtin() {
#ifdef ADIL    
    freopen(".in", "r", stdin);
#endif
}
              
const int N = 1e4+10;

ll dp[2][N], nw[2][N];

void add(ll& a, ll b) {
    a += b;
    if (a >= MOD)
        a -= MOD;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr), stndrtin();        
    string k;
    cin >> k;
    int d;
    cin >> d;
    dp[0][0] = 1;
    for (int i = 0; i < sz(k); ++i) {
        for (int w = 0; w < d; ++w) {
            for (bool t : {0, 1}) {
                for (int x = 0; x < 10; ++x) {
                    if (x > k[i]-'0' && !t) 
                        break;  
                    add(nw[t || (x < k[i]-'0')][(w+x)%d], dp[t][w]);
                }              
            }
        }
        for (bool t : {0, 1}) 
            for (int w = 0; w < d; ++w) {
                dp[t][w] = nw[t][w];
                nw[t][w] = 0;
            }
    }
    cout << (dp[0][0] + dp[1][0] - 1 + MOD) % MOD;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

/*????????§???*/

int p[502],p2[502];
int r[502],r2[502];

void init(int n){
    for (int i = 0; i < n; ++i) {
        p[i]=i;
        r[i]=0;
    }
}


int find(int x){
	if(x != p[x]){
		p[x] = find(p[x]);
    }
   	return p[x];
}
     
void union_set(int x,int y){
	x = find(x);
	y = find(y);
	if(x==y) return;
	if(r[x] < r[y]){
		p[x] = y;	
	}else{
		p[y] = x;
		if(r[x] == r[y])r[x]++;
	}
	return ;
}

int main(){
	int n,m;
	while(cin >> n >> m &&n!=0){
		ll ans = 0;
		vector<int>t(n);
		rep(i,n){
			cin >> t[i];
		}
		vector<pair<int,int> > v(n);
		rep(i,n){
			v[i] = MP(t[i],i);
		}
		sort(v.begin(),v.end(),greater<pair<int,int> >());
		vector<set<int> >vst;
		set<int>st;
		for(int i=0;i<n;i++){
			if(i==n-1){
				st.insert(v[i].second);
				vst.PB(st);
			}else{
				st.insert(v[i].second);
				if(v[i].first!=v[i+1].first){
					vst.PB(st);
					st.clear();
				}
			}
		}

		vector<pair<ll,pair<int,int > > >node;
		init(502);
		rep(i,m){
			int a,b;
			ll c;
			cin >> a >> b >> c;
			a--;
			b--;
			node.PB(MP(c,MP(a,b)));
		}
		sort(node.begin(),node.end());
		set<int>nst;
		int cnt=0;
		int nod=0;
		for(int i=0;i<vst.size();i++){
			for(auto x:vst[i]){
				nst.insert(x);
				cnt++;
			}
			for(auto x:node){
				if(nst.count(x.second.first)!=0&&nst.count(x.second.second)!=0){
					if(find(x.second.first)!=find(x.second.second)){
						ans += x.first;
						union_set(x.second.first,x.second.second);
						nod++;
						//cout << x.second.first << " " << x.second.second << endl;
					}
				}
			}
			if(nod!=cnt-1){
				init(502);
				ans = 0;
				nod = 0;
			}
		}
		if(nod!=n-1){
			ans = 0;
		}
		cout << ans << endl;

	}

	return 0;
}

Measured memory_bytes: 3664
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<functional>
#include<cmath>
#include<algorithm>
typedef  long long ll;

int main() {
	std::map<int, int> kiyomaru = {};
	int n = 0, some = 0;
	int count = 0;
	std::vector<int> a;
	ll ans = 1;
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> some;
		a.push_back(some);
		kiyomaru[a[i]]++;
	}
	std::sort(a.begin(),a.end(),std::greater<int>());
	for (int i = 0; i < a.size(); i++) {
		if (kiyomaru[a[i]] >= 2) {
			 ans *= a[i];
			 count++;
			 if (count == 2) {
				 std::cout << ans << std::endl;
				 return 0;
			 }
			kiyomaru[a[i]] -= 2;	
		}
	}
	std::cout << 0 << std::endl;
	return 0;
}


Measured memory_bytes: 5368
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,m,x,sum,ans=-1;
  int c[50],a[50][50];
  bool f;
  cin>>n>>m>>x;
  for(int i=0;i<n;i++){
    cin>>c[i];
    for(int j=0;j<m;j++){
      cin>>a[i][j];
    }
  }
  for(int bit=0;bit<(1<<n);bit++){
    int date[50]={};
    sum=0;
    f=true;
    for(int i=0;i<n;i++){
      if(bit&(1<<i)){
        for(int j=0;j<m;j++){
          date[j]+=a[i][j];
        }
        sum+=c[i];
      }
    }
    for(int j=0;j<m;j++){
      if(date[j]<x) f=false;
    }
    if(f){
      if(ans==-1) ans=sum;
      else ans=min(ans,sum);
    }
  }
  cout<<ans<<"\n";
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
lint power(lint x, lint n, lint mod) {
  lint ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= mod;
    (x *= x) %= mod;
    n >>= 1;
  }
  return ret;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lint N, K;
    cin >> N >> K;
    vector<lint> ans(K+1);
    IFOR(i, 1, K+1) {
        lint num = K/i;
        num = power(num, N, MOD);
        for(int j=i*2; j<=K; j+=i) {
            num = (num - ans[j] + MOD) % MOD;
        }
        ans[i] = num;
    }
    lint sum = 0;
    FOR(i, 1, K+1) {
        sum = (sum + ans[i]*i) % MOD;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vecll;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> string to_string(T p[2]) { return "["+to_string(p[0])+","+to_string(p[1])+"]"; }
template<typename T> void println(T e){ cout << to_string(e) << endl; }
template<typename T> void println(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void println(const vector<vector<T>>& vv){ for(const auto& v : vv){ println(v); } }
template<typename Iter> void println(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
template<typename T> T mod_pow(T x, T n, const T &p) { T ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= p; (x *= x) %= p; n >>= 1; } return ret; }
template<typename T> T mod_inv(T x, const T &p) { return mod_pow(x, p-2, p); }

const ll DVSR = 1e9+7;

int main(int argc, char const *argv[])
{
  ll N, A, B; cin >> N >> A >> B;
  ll patA = 1, patB = 1, res = mod_pow(2LL, N, DVSR)-1;
  RNG(i, 1, A+1) patA = (patA*i)%DVSR;
  patA = mod_inv(patA, DVSR);
  REP(i, A) patA = (patA*(N-i))%DVSR;
  res -= patA;
  res %= DVSR;

  RNG(i, 1, B+1) patB = (patB*i)%DVSR;
  patB = mod_inv(patB, DVSR);
  REP(i, B) patB = (patB*(N-i))%DVSR;
  res -= patB;
  res %= DVSR;

  cout << (res + DVSR)%DVSR << endl;
  return 0;
}


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

string s, t;

int main() {
	cin >> s;
	cin >> t;
	int DP[3002][3002];
	for (int i = 0; i < 3002; i++) {
		for (int j = 0; j < 3002; j++) {
			DP[i][j] = 0;
		}
	}

	for (int i = 0; i < s.size(); i++) {
		for (int j = 0; j < t.size(); j++) {
			if (s[i] == t[j]) {
				DP[i + 1][j + 1] = DP[i][j] + 1;
			}
			else {
				DP[i + 1][j + 1] = max(DP[i][j + 1], DP[i + 1][j]);
			}
		}
	}

	string Ans = "";
	int n = s.size(), m = t.size();
	while (DP[n][m] > 0) {
		if (s[n-1] == t[m-1]) {
			Ans = s[n-1] + Ans;
			n--;
			m--;
		}
		else if (DP[n][m] == DP[n - 1][m]) {
			n--;
		}
		else {
			m--;
		}
	}
	cout << Ans << endl;

}

Measured memory_bytes: 35456
/*######################################################
#########~~~~~####~~~~###~~##~~##~~##~~##~~##~~#########
#########~~##~~##~~##~~##~~~#~~##~~~#~~##~~##~~#########
#~~~~~~##~~~~~###~~~~~~##~~#~~~##~~#~~~##~~##~~##~~~~~~#
#########~~######~~##~~##~~##~~##~~##~~##~~##~~#########
#########~~######~~##~~##~~##~~##~~##~~###~~~~##########
######################################################*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

#pragma GCC optimize("O3")
#define rtn return
#define endl '\n'
#define F first
#define S second
#define mt make_tuple
#define pb push_back
#define int long long
#define value_at find_by_order
#define index_of order_of_key
#define fill(a, v) memset(a,v,sizeof(a))
#define copy(a, b) memcpy(b,a,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i, n) for(int i=0;i<(int)n;++i)
#define per(i, n) for(int i=(int)n-1;i>=0;--i)
#define rep1(i, n) for(int i=1;i<=(int)n;++i)
#define per1(i, n) for(int i=(int)n;i>=1;--i)
#define loop(i, begin, end) for(int i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " = " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " = " << arg1 << " |";
  __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

typedef string str;
typedef long double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pll;
typedef vector<int> vll;
typedef vector<pll> vpll;
typedef vector<db> vdb;

template<class T, class V> void remin(T &a, V b) { a > b ? a = b : a = a; }
template<class T, class V> void remax(T &a, V b) { a < b ? a = b : a = a; }
template<class T> using Tree = 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 INF = 1e18;
const db EPS = 1e-15;
const int MOD = 1e9 + 7;
const int N = 1e5 + 7;

int n, u, v;
vll add[N];
int disu[N];
int disv[N];

void dfsu(int s) {
  for (auto i : add[s]) {
    if (disu[i] == -1) {
      disu[i] = disu[s] + 1;
      dfsu(i);
    }
  }
}

void dfsv(int s) {
  for (auto i : add[s]) {
    if (disv[i] == -1) {
      disv[i] = disv[s] + 1;
      dfsv(i);
    }
  }
}

int32_t main() {
  FAST_IO;
  cin >> n >> u >> v;
  fill(disu, -1);
  fill(disv, -1);
  rep(i, n - 1) {
    int x, y;
    cin >> x >> y;
    add[x].pb(y);
    add[y].pb(x);
  }
  disu[u] = disv[v] = 0;
  dfsu(u);
  dfsv(v);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (disv[i] > disu[i]) {
      remax(ans, disv[i]);
    }
  }
  cout << ans - 1 << '\n';
  rtn 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cmath>

using namespace std;
typedef pair<int, int> P;
typedef pair<P, int> PI;

void solve()
{
	int N, K;
	cin >> N >> K;
	--K;
	vector<long long int> x(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> x[i];
	}
	long long int ans = 1e9;
	for (int i = 0; i < N - K; ++i)
	{
		long long int dist = 0;
		if (x[i + K] >= 0  && x[i] >= 0)
		{
			dist = x[i];
		}
		else if (x[i + K] < 0 && x[i] < 0)
		{
			dist = -x[i + K];
		}
		else
		{
			dist = min(abs(x[i]), abs(x[i + K]));
		}
		ans = min(ans, dist + x[i + K] - x[i]);
	}
	cout << ans << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int k, t;
int MAX = 0;

int main() {
	cin >> k >> t;
	rep(i, t) {
		int num;
		cin >> num;
		MAX = max(num, MAX);
	}
	cout << max(0, MAX - 1 - (k - MAX)) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 100000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
/*---------------------------------------------------*/

int n;
int a[11];

int dfs(int cnt, int sum,vi v){
  int ans=0;
  if(cnt==n){
    //for(auto i: v)cout<<i<<" ";
    //cout<<": "<<sum<<endl;
    //cout<<endl;
    if(sum%2==0)return 1;
    else return 0;
  }
  v.pb(a[cnt]);
  ans+=dfs(cnt+1,sum*a[cnt],v);
  v.pop_back();
  v.pb(a[cnt]+1);
  ans+=dfs(cnt+1,sum*(a[cnt]+1),v);
  v.pop_back();
  v.pb(a[cnt]-1);
  ans+=dfs(cnt+1,sum*(a[cnt]-1),v);
  v.pop_back();
  return ans;
}

int main(){
  int ans=0;
  vi v;
  cin>>n;
  rep(i,n)cin>>a[i];

  v.pb(a[0]);
  ans+=dfs(1,a[0],v);
  v.pop_back();
  v.pb(a[0]-1);
  ans+=dfs(1,a[0]-1,v);
  v.pop_back();
  v.pb(a[0]+1);
  ans+=dfs(1,a[0]+1,v);

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


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Queue;
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();
			
			long[] array = new long[N];
			long[] values = new long[N];
			for(int i = 0; i < N; i++){
				array[i] = sc.nextLong();
				values[i] = array[i] - (i + 1);
			}
			
			Arrays.sort(values);
			//System.out.println(Arrays.toString(values));
			
			long sum = 0;
			for(int i = 0; i < N; i++) {
				sum += Math.abs(array[i] - (values[N / 2] + (i + 1)));
			}
			
			System.out.println(sum);
			
		}
	}

	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: 54140
class CombinedResistance
  def initialize(rs)
    @r1 = rs[0].to_f
    @r2 = rs[1].to_f
  end

  def solve
    @r1 * @r2 / (@r1 + @r2)
  end
end

def run
  rs = gets.scan(/\d+/).map(&:to_i)
  puts CombinedResistance.new(rs).solve
end

run


Measured memory_bytes: 14228
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  REP(i, N) { cin >> A[i]; }
  int ans = 0;
  REP(i, N) {
    int down = i, up = i, tmp = A[i];
    for (int j = i + 1; j <= N; j++) {
      if (j == N ) {
        up = j-1;
        break;
      }
      if (A[j] < tmp) {
        up = j - 1;
        break;
      }
      tmp = A[j];
    }
    tmp = A[i];
    for (int j = i + 1; j <= N; j++) {
      if (j == N) {
        up = j;
        break;
      }
      if (A[j] > tmp) {
        down = j - 1;
        break;
      }
      tmp = A[j];
    }
    ans++;
    i = max(down, up);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3760
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<queue>
#include<bitset>

#define rep(i,n) for(i=0;i<n;i++)

using namespace std;

typedef long long int lli;
typedef long long ll;
typedef vector<int> vi;

int n, ax, bx, cx;
vi l;
int INF = pow(10, 9);

int dfs(int cur, int a, int b, int c) {
	int ret0, ret1, ret2, ret3;
	if (cur == n) {
		if (min(min(a, b), c) > 0) {
			return  abs(a - ax) + abs(b - bx) + abs(c - cx) - 30;
		}
		else {
			return INF;
		}
	}
	ret0 = dfs(cur + 1, a, b, c);
	ret1 = dfs(cur + 1, a + l[cur], b, c) + 10;
	ret2 = dfs(cur + 1, a, b + l[cur], c) + 10;
	ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10;

	return min(min(ret0, ret1), min(ret2, ret3));

}

int main() {
	int i, j;

	cin >> n;
	l.resize(n);

	cin >> ax >> bx >> cx;
	rep(i, n) {
		cin >> l[i];
	}

	cout << dfs(0, 0, 0, 0);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	string s[3];
	int p[3], id, i, j, k, winner, x;

	cin >> s[0] >> s[1] >> s[2];
	p[0] = p[1] = p[2] = 0;
	id = 0;

	while (p[id] < s[id].length()) {
		x = s[id][p[id]] - 'a';
		p[id]++;
		id = x;
	}

	char ch = 'A' + id;
	cout << ch << "\n";

	return 0;
}



Measured memory_bytes: 504
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
  		long[] a=new long[n];
  		long ans=1;
		for(int c=0;c<n;c++){
    		a[c]=sc.nextLong();
          	if(a[c]==0){
            	ans=0;
            }
    	}
  	if(ans!=0){
		for(int c=0;c<n;c++){
          if(a[c]<=(long)Math.pow(10,18)/ans){
            ans*=a[c];
          }else{
          	ans=-1;
            break;
          }
    	}
    }
    	System.out.println(ans);
    }
}


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

#define ll long long
queue<ll>q;

int main()
{
    int k;
    cin >> k;
    for (int i = 1; i <= 9; i++)
        q.push(i);

    int j = 1;

    while (j < k)
    {
        ll p = q.front();
        q.pop();
        j++;

        ll u = p % 10;

        if (u != 0)
            q.push(p * 10 + u - 1);

        q.push(p * 10 + u);

        if (u != 9)
            q.push(p * 10 + u + 1);
    }
    cout << q.front() << endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  string S; cin >> S;
  cout << S[0] << S[1] << S[2] << endl;
}


Measured memory_bytes: 3592
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll K;
	string S;
	while(cin>>S>>K) {
		string ans = "1";
		REP(i, min(K, (ll)S.size())) {
			if(S[i]!='1') {
				ans=string(1, S[i]);
				break;
			}
		}
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  vc c(n);
  rep(i,n) cin>>c[i];
  vc a(n);
  a=c;
  sort(all(a));
  ll ans=0;
  rep(i,n){
    if(a[i]!=c[i]) ans++;
  }
  COUT((ans+1)/2);
}

Measured memory_bytes: 3780
from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,a,b = inm()
if (a-b)%2==0:
    print(abs(a-b)//2)
else:
    p = max([a-1,b-1])
    q = max([n-a,n-b])
    r = (a+b-1)//2
    s = (2*n-a-b+1)//2
    print(min([p,q,r,s]))


Measured memory_bytes: 38384