akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define rep(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
int main()
{
  int a,b,x,y,z,k;
  cin >> a >> b;
  x=a-b;
  y=a+b;
  z=a*b;
  k=max({x,y,z});
  printf("%d",k);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <cinttypes>
#include <string.h>
#include <bits/stdc++.h>

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define pi pair<int,int>
#define fi first
#define se second

#define FOR(var, to)          for (register s64 var = 0; var < (s64)to; var++)
#define FROMTO(var, from, to) for (register s64 var = from; var <= (s64)to; var++)

#define INIT(var) FOR(i,countof(var)) var[i] = 0
#define INPUT(var) FOR(i,countof(var)) var[i] = ri()

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)

#define MOD 1000000007
#define INF (1 << 30)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

using namespace std;

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

static inline s64 rs64() {
  s64 a;
  scanf("%" SCNd64, &a);
  return a;
}

static inline void wi(int a) {
  printf("%d", a);
}

static inline void wu64(u64 a) {
  printf("%" PRIu64, a);
}

static inline void ws64(s64 a) {
  printf("%" PRId64, a);
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

int main() {
    int n = ri();
    int m = ri();
    int x = ri();
    int a[m];
    INPUT(a);
    
    int r1 = 0;
    int r2 = 0;
    FOR(i,m) {
        if (a[i] < x) r1++;
        else r2++;
    }
    cout << min(r1,r2) << endl;
 return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <vector>
#include <map>
#include <ctime>
#include <cmath>
#include <string.h>
#define inf 0x7fffffff
using namespace std;
struct P
{
    int x,y;
    long long z;
    bool operator<(const P &a)const{
        if(y!=a.y)
        return y>a.y;
        return z>a.z;
    }
};
vector<int> v[200056];
int a,b,c,n,m,i,k,o[310][3130],d,e,dy[5]={0,0,-1,1,0},dx[5]={-1,1,0,0,2};
int l[510][1000];
long long x,y,z1[5000000],z2[5000000];
P u[100100];
int j[6000100];
queue<int> q;
stack<int> s;
priority_queue<P> q1,q2;
//long long x=0,y=0,z[99];

//deque<int> d;
//'1'==49;
map<int, P > p[2222];
//string r;
char r[1000];


void f(int t,int w)
{

    if(t*100+w>i) return;
    if(e*(t*100)<100*w) return;

    if(o[t][w]) return;
    //printf("@@%d %d\n",t,w);
    o[t][w]=1;
    if(w*(m*100+n)>(t*100+w)*n) n=w,m=t;
    f(t+a,w);
    f(t+b,w);
    f(t,w+c);
    f(t,w+d);
}

int main()
{
    scanf("%d",&a);
    for(int t=1;t<=a;t++)
        for(int w=1;w<=a;l[t][w]=o[t][w],w++)
        scanf("%d",&o[t][w]);
    for(int h=1;h<=a;h++)
    for(int t=1;t<=a;t++)
        for(int w=1;w<=a;w++)
        if(l[h][t]&&l[h][w])
    {
        l[t][w]=min(l[t][w],l[t][h]+l[w][h]);
        l[w][t]=l[t][w];
    }
    for(int t=1;t<=a;t++)
        for(int w=1;w<=a;w++)
        if(l[t][w]!=o[t][w])
    {
        puts("-1");
        return 0;
    }

    for(int h=1;h<=a;h++)
    for(int t=1;t<=a;t++)
        for(int w=1;w<=a;w++)
        if(t!=h&&w!=h&&o[t][h]+o[w][h]==o[t][w]&&l[t][w])
    {
        l[t][w]=0;
        l[w][t]=0;
    }
/*for(int t=1;t<=a;t++)
        for(int w=1;w<=a;w++,puts(""))
        printf("%d ",l[t][w]);
*/    for(int t=1;t<=a;t++)
        for(int w=1;w<t;w++)
        x+=l[t][w];
    printf("%lld",x);
}


Measured memory_bytes: 11776
#include<bits/stdc++.h>
#define pi 3.141592653897932384626
//freopen("std.in","r",stdin);freopen("std.out","w",stdout);
using namespace std;
long a[100005],b[100005];
int main()
{
    long n,sum=0,x=0,y=999999999;
    cin>>n;
    for(long i=0;i<n;i++){
        scanf("%ld%ld",&a[i],&b[i]);
        sum+=a[i];
        if(a[i]!=b[i])x=1;
        if(a[i]>b[i])y=min(y,b[i]);
    }
    if(x)cout<<sum-y<<endl;
    else cout<<0<<endl;
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>
#include <iterator>
#include <cassert>

using namespace std;

#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl

#define Tof(x) (x) ? Yes : No
#define TOF(x) (x) ? YES : NO
#define tof(x) (x) ? yes : no

using ll = long long;

constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;

ll LONG_LONG_MAX = 1e18;



/*for文でx,yを上下左右確認するやつだよ。正直使いづらいよ。

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


for (int i = 0; i < 4; i++) {
	int ny = y + dy[i];
	int nx = x + dx[i];
}

*/

/*繰り返し二乗法だよ。modもとってくれるよ。n^kをmodで割った余りでやってくれるよ。

ll POW_MOD(ll n, ll k, ll mod) {
	ll r = 1;

	for (; k > 0; k >>= 1) {
		if (k & 1) {
			r = (r * n) % mod;
		}
		n = (n * n) % mod;
	}
	return r;
}

*/

/*2重for文書くのめんどくなった時用だよ。

for (int i = 0; i < h; ++i) {
	for (int j = 0; j < w; ++j) {

	}
}

*/



int main() {
	int n; cin >> n;
	int p[51];
	for (int i = 1; i <= n; i++) {
		cin >> p[i];
	}
	int tmp = 0;
	for (int i = 1; i <= n; i++) {
		if (p[i] != i) { tmp++; }
	}

	if (tmp <= 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}



	return 0;
}

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

struct node{int p,r,l;};

node tree[10000];
int D[10000],n[10000];

int height(int i){
  int h1,h2;
  h1=h2=0;
  if(tree[i].r!=NIL) h1=height(tree[i].r)+1;
  if(tree[i].l!=NIL) h2=height(tree[i].l)+1;
  return n[i]=max(h1,h2);
}

void depth(int u,int p){
  if(u==NIL) return;
  D[u]=p;
  depth(tree[u].r,p+1);
  depth(tree[u].l,p+1);
}

int getsibling(int u){
  if(tree[u].p==NIL) return NIL;
  if(tree[tree[u].p].l!=u && tree[tree[u].p].l!=NIL) return tree[tree[u].p].l;
  if(tree[tree[u].p].r!=u && tree[tree[u].p].r!=NIL) return tree[tree[u].p].r;
  return NIL;
}

void print(int u){
  int c;
  cout<<"node"<<" "<<u<<": ";
  cout<<"parent = "<<tree[u].p<<", ";
  cout<<"sibling = "<<getsibling(u)<<", ";
  int deg=0;
  if(tree[u].r!=NIL) deg++;
  if(tree[u].l!=NIL) deg++;
  cout<<"degree = "<<deg<<", ";
  cout<<"depth = "<<D[u]<<", ";
  cout<<"height = "<<n[u]<<", ";
  if(tree[u].p==NIL) cout<<"root";
  else if(tree[u].l==NIL && tree[u].r==NIL) cout<<"leaf";
  else cout<<"internal node";
  cout<<endl;
}
    


int main(){
  int n;
  int num,r,l,A;
  cin>>n;
  for(int i=0;i<n;i++){
    tree[i].p=NIL;
  }
  for(int i=0;i<n;i++){
    cin>>num>>r>>l;
    if(l!=NIL) tree[l].p=num;
    if(r!=NIL) tree[r].p=num;
    tree[num].l=l;
    tree[num].r=r;
  }
  for(int i=0;i<n;i++) if(tree[i].p==NIL){
      A=i;
      break;
    }
  depth(A,0);
  height(A);
  for(int i=0;i<n;i++) print(i);
  return 0;
}
  



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

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	vl p = { 2 };
	FOR(i,2, 100000) {
		int flag = 1;
		REP(j, p.size()) {
			if (i%p[j] == 0)flag = 0;
		}
		if (flag)p.push_back(i);
	}
	while (1) {
		ll ansm, ansn, cmax = -INF;
		ll m, a, b;
		cin >> m >> a >> b;
		if (!m)break;
		REP(i, p.size()) {
			
			FOR(j, i, p.size()) {
				if (p[i] * p[j] > m||a*p[j]>b*p[i])break;
				if (cmax < p[i] * p[j]) {
					ansn = p[i]; ansm = p[j]; cmax = p[i] * p[j];
				}
			}
		}
		cout << ansn << " " << ansm << endl;
	}
	return 0;
}

Measured memory_bytes: 3252
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/04/04.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC161
//
//

#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

 const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const ll MOD = 1000000007;
//#define __DBG__



void solve(void){
  
  ll N, K;
    
  cin >> N >> K;
  
  if(N%K==0){cout << "0" << endl; return;}
  N=N%K;
  
  ll dif=abs(N-K);
  
  N=dif;
  
  while(abs(N-K)<dif){
    N=abs(N-K);
    if(N==0)break;
  }

 cout << N << endl;
  
  
  
  return;
}

#define TESTCASES 1

int main(int argc, const char * argv[]) {


    cin.tie(0);
    ios::sync_with_stdio(false);

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}



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

void nout(vi a, int n){
  rep(i, n){
    cout << a[i];
    if(i<n-1){
      cout << " ";
    }
  }
  cout << endl;
}

void insetionsort(vi a, int n){
  for(int i=1; i<n; i++){
    int v=a[i], j=i-1;
    while(j>=0&&a[j]>v){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=v;
    nout(a, n);
  }
}

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

  nout(a, n);
  insetionsort(a, n);

  return 0;
}


Measured memory_bytes: 3180
#include "bits/stdc++.h"
using namespace std;
typedef pair<int,int> P;
int oror(int x,int y)
{
	if(x==2 || y==2)
		return 2;
	else
		return x|y;
}

int andand(int x,int y)
{
	if(x==1 && y==1)
		return 1;
	else
		return x*y/2;
}

int notnot(int x)
{
	switch(x)
	{
		case 0:
		return 2;
		case 1:
		return 1;
		case 2:
		return 0;
	}
	return x;
}

//1重の()で囲われた式を計算する
P hyouka(string s,int ind,int a,int b,int c)
{
	int ret=0;
	while(ind<s.size())
	{
		//cerr<<ind<<endl;
		if(s[ind]=='(')
		{
			//()演算の場合
			ind++;
			P p=hyouka(s,ind,a,b,c);//これで左辺が取れる
			int hi=p.first;
			bool op=true;
			if(s[p.second]=='+')
				op=true;
			else if(s[p.second]=='*')
				op=false;
			ind=p.second+1;
			p=hyouka(s,ind,a,b,c);//右辺を取る
			int mi=p.first;
			ind=p.second;
			if(op)
				ret=oror(hi,mi);
			else
				ret=andand(hi,mi);
		}else if(s[ind]=='-'){
			//-の場合
			P p=hyouka(s,ind+1,a,b,c);
			ret=notnot(p.first);
			ind=p.second;
		}else if(s[ind]=='P'){
			//変数の場合
			ret=a;
			ind++;
		}else if(s[ind]=='Q'){
			ret=b;
			ind++;
		}else if(s[ind]=='R'){
			ret=c;
			ind++;
		}else if(s[ind]>='0' && s[ind]<='2'){
			//定数の場合
			ret+=s[ind]-'0';
			ind++;
		}else if(s[ind]==')'){
			ind++;
			break;
		}else{
			//記号の場合
			break;
		}
	}
	return P(ret,ind);
}

int main()
{
	string s;
	while(1)
	{
		cin>>s;
		int ans=0;
		if(s==".")
			break;
		//cerr<<hyouka(s,0,1,1,1).first<<endl;
		for(int p=0;p<3;p++)
		{
			for(int q=0;q<3;q++)
			{
				for(int r=0;r<3;r++)
				{
					if(hyouka(s,0,p,q,r).first==2)
						ans++;
				}
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3124
import java.math.BigInteger;
import java.util.stream.Stream;

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        int x = scanner.nextInt();
        System.out.println(Stream.generate(() -> null)
                .limit(n)
                .map(i -> BigInteger.valueOf(Math.abs(x - scanner.nextInt())))
                .reduce(BigInteger::gcd)
                .get()
                .intValue());
    }
}

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

int read()
{
	int ans=0;
	char ch=getchar();
	for(;(ch<'0' || ch>'9') && ch!='-';ch=getchar());
	bool flag=0;
	if(ch=='-')flag=1,ch=getchar();
	for(;ch>='0' && ch<='9';ch=getchar())ans=ans*10+ch-'0';
	if(flag)ans=-ans;
	return ans;
}

long long rell()
{
	long long ans=0;
	char ch=getchar();
	for(;(ch<'0' || ch>'9') && ch!='-';ch=getchar());
	bool flag=0;
	if(ch=='-')flag=1,ch=getchar();
	for(;ch>='0' && ch<='9';ch=getchar())ans=ans*10ll+(long long)(ch-'0');
	if(flag)ans=-ans;
	return ans;
}

void writ(int n)
{
	char ch[25];
	int m=0;
	if(n<0)putchar('-'),n=-n;
	if(n==0)
	{
		putchar('0');
		return;
	}
	for(;n;n/=10)ch[m++]=n%10ll+'0';
	for(;m;)putchar(ch[--m]);
}

void wrll(long long n)
{
	char ch[25];
	int m=0;
	if(n<0)putchar('-'),n=-n;
	if(n==0)
	{
		putchar('0');
		return;
	}
	for(;n;n/=10ll)ch[m++]=n%10ll+'0';
	for(;m;)putchar(ch[--m]);
}
const int N=1<<17;
int a[N],s[N];

int main()
{
	int n;
	scanf("%d",&n);
	memset(s,0,sizeof(s));
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		s[a[i]]++,s[a[i]+1]++,s[a[i]+2]++;
	}
	int ans=0;
	for(int i=0;i<N;i++)
	{
		ans=max(ans,s[i]);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define pb           push_back
#define pf           push_front
#define in           insert
#define ff           first
#define ss           second
#define mp           make_pair
#define int          long long
#define uint         unsigned long long
#define rep(i,x,m)   for(int i=x;i<m;i++)
#define repr(i,x,m)  for(int i=x;i>=m;i--)
#define MOD          1000000007
#define endl         "\n"
#define all(v)       v.begin(),v.end()
#define rall(v)      v.rbegin(),v.rend()
#define vi           vector<int>
#define vs           vector<string>
#define pi           pair<int,int>
#define di           deque<int>
#define sz(x)       (int)x.size()
#define pq           priority_queue<int>
#define pqs          priority_queue<int,vi,greater<int> >
#define fix(y)       fixed<<setprecision(y)
#define print(v)     for(int i=0;i<v.size();i++) cout<<v[i]<<" ";cout<<endl
#define noob         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

int fac[2000005]={0};
void factorial(){ fac[0]=1; fac[1]=1; for(int i=2;i<200005;i++) fac[i]=((i%MOD)*(fac[i-1]%MOD))%MOD;}
int power(int n,int m)
{int p=1;if(m==0)return 1;p=(power(n,m/2)%MOD);p=(p%MOD*p%MOD)%MOD;
return(m&1?((p%MOD*n%MOD)%MOD):(p%MOD));}
int ncr(int n,int r){return ((fac[n]*power(fac[r],MOD-2))%MOD*power(fac[n-r],MOD-2))%MOD;}

void ram5564()
{
    int n;
    cin>>n;
    cout<<n+(n*n)+(n*n*n);
}

signed main()
{
        // noob
        // #ifndef ONLINE_JUDGE
        //  freopen("input.txt","r",stdin);
        //  freopen("output.txt","w",stdout);
        //  #endif   
        
        int t=1;
        //cin>>t;
        while(t--)
        ram5564();
        return 0;
}

Measured memory_bytes: 3588
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    l2=sorted(l)
    x=l2[n//2-1]
    y=l2[n//2]
    if x==y:
        for i in range(n):
            print(x)
    else:
        setx=set(l2[:n//2])
        sety=set(l2[n//2:])
        for i in l:
            if i in setx:
                print(y)
            else:
                print(x)
resolve()

Measured memory_bytes: 96064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
  public static void main(String[] args) {
	FastReader sc = new FastReader();
	String s = sc.next();
	StringBuilder sb = new 	StringBuilder();
	
	for (int i = 0; i < s.length(); i++) {
		if (i % 2 == 0) {
			sb.append(s.charAt(i));
		}
	}
	
	System.out.println(sb.toString());
  }
  
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

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

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

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

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


Measured memory_bytes: 24532
const bool TEST=1;
#include<iostream>
#include<cctype>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<cctype>
#include<cstring>
#include<utility>
#include<cmath>
#include<sstream>
#include<stack>
const int inf=0x7fffffff;
#define IF if(TEST)
#define FI if(!TEST)
#define gts(s) fgets((s),sizeof(s),stdin)
#define ALL(s) (s).begin(),(s).end()
#define MK(a,b) make_pair((a),(b))
typedef long long int LL;
typedef unsigned int U;
typedef unsigned long long ULL;
using namespace std;
typedef pair<int,int> Point;
template <typename T>
void pA(T *begin,int n){ for(int i=0;i<n;i++){ cout<<*(begin++); } printf("\n"); }
void sol(){
	int x;
	cin>>x;
	if(x<1200)cout<<"ABC";
	else cout<<"ARC";
	cout<<endl;
}
int main()
{
	sol();
	return 0;
}
//A.cc
//generated automatically at Sat Jan 28 20:06:00 2017
//by xsthunder


Measured memory_bytes: 256
using System;

class Example
{
    static void Main()
    {
        string[] n = Console.ReadLine().Split(' ');
        int a = int.Parse(n[0]);
        int b = int.Parse(n[1]);
        if (a < b) Console.WriteLine("a < b");
        if (a > b) Console.WriteLine("a > b");
        if (a == b) Console.WriteLine("a == b");
    }
}

Measured memory_bytes: 8904
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    string s;
    cin >> s;
    vector<char> op = {'+','-'};
    vector<int> a(4);
    rep(i, 4) a[i] = s[i] - '0';

    for(int i = 0; i < (1 << 3); i++){
        int ans = a[0];
        rep(j, 3){
            if(i & (1 << j)){
                ans -= a[j + 1];
            }else{
                ans += a[j + 1];
            }
        }
        if(ans == 7){
            cout << a[0];
            rep(j, 3){
                cout << op[(i >> j) & 1] << a[j + 1];
            }
            cout << "=7" << endl;
            break;
        }
    }
    
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
??´?????????
"""
inp = input().strip().split(" ")
row = int(inp[0])
col = int(inp[1])

cells = [[0 for r in range(col+1)] for c in range(row+1)]
for r in range(row):
    inp = input().strip().split(" ")
    for c in range(col):
        cells[r][c] = int(inp[c])
        cells[row][c] += cells[r][c]
        cells[r][col] += cells[r][c]
    cells[row][col] += cells[r][col]

for r in range(row+1):
    print(" ".join(map(str,cells[r])))

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

long long gcd(long x, long y)
{    if (y == 0)
        return x;
    return gcd(y, x % y);}
long long lcm(long x, long y){ return x * y / gcd(x, y);}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}


int main()
{
    int N,M,f[100010]={},b[100010]={},x,y,ans=0;
    cin>>N>>M;
    f[1]=1;

    for(int i=1;i<=N;i++){
        b[i]=1;
    }

    for(int i=1;i<=M;i++){
        cin>>x>>y;

        if(f[x]==1)f[y]=1;
        b[x]--;
        if(b[x]==0)f[x]=0;
        b[y]++;
    }

    for(int i=1;i<=N;i++){
        if(f[i]==1&&b[i]>0)ans++;
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1024
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll dp[51][51][2510] = {};

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

    // input
    ll N, A;
    cin >> N >> A;

    vector<ll> X(N+1);
    X[0] = 0;
    FOR(i, 1, N+1){
        cin >> X.at(i);
    }

    FOR(i, 0, 51){
        dp[i][0][0] = 1;
    }

    FOR(j, 1, N+1){
        FOR(k, 1, N+1){
            if(j<k){
                continue;
            }

            FOR(s, 0, N*50+1){
                if(s-X[j] < 0){
                    // X[j]を足してもsには届かない場合
                    dp[j][k][s] = dp[j-1][k][s]; // stay
                }
                else{
                    ll stay = dp[j-1][k][s];
                    ll plus = dp[j-1][k-1][s-X[j]];
                    dp[j][k][s] = stay + plus;
                }
            }
        }
    }

    ll sum = 0;
    FOR(k, 1, N+1){
        sum += dp[N][k][k*A];
    }

    p(sum);
    
    return 0;
}

Measured memory_bytes: 49280
#include<iostream>
#include<bits/stdc++.h>
#include<climits>
#include<math.h>

#define forn(x,n,s) for(int i = x; i < n; i += s )
#define forr(x,n,s) for(int i = x; i>=n; i -= s)
#define PI 3.14159265358979323846264338327950L

using namespace std;

void go(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  #ifndef ONLINE_JUDGE
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
  #endif
} 
long long int mod = 1e9+7;

int main(){
    go(); 

    // code here
    long long int x;cin>>x;
    long long int p = 100;
    int step = 0;
    while(p<x){
        p += (p/100);
        step++;
    }
    cout<<step;
    
}





Measured memory_bytes: 3652
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n, k;
  cin >> n >> k;
  ll g;
  ll mv = 0;
  rep(i, n) {
    ll x;
    cin >> x;
    if(i == 0){
      g = x;
    } else {
      g = __gcd(x, g);
    }
    chmax(mv, x);
  }
  string ans = k <= mv && k % g == 0 ? "POSSIBLE" : "IMPOSSIBLE";

  cout << ans << endl;

  return 0;
}


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

int main()
{
	int n; cin >> n;
	
	bool can = false;
	
	for (int i = 0; i <= n / 4 ; i++) {
		for (int j = 0; j <= n / 7; j++) {
			if (4 * i + 7 * j == n) {
				can = true;
				break;
			}
		}
	}
	
	string ans="No";

	if (can) ans = "Yes";

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

Measured memory_bytes: 256
#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 <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 <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  cout << n / 3 << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 20;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

int N;

int main()
{
	ll ans = 0, mn = 1e9, ch = 1;
	scanf("%d", &N);
	for(int i = 1; i <= N; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		ans += a;
		if(a != b) ch = 0;
		if(a > b) mn = min(mn, (ll)b);
	}
	if(ch) printf("0\n");
	else printf("%lld\n", ans - mn);
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		long countA = 0;
		long count = 0;
		int idx = 0;
		while (idx < arr.length - 2) {
			if (arr[idx] == 'A') {
				countA++;
			} else {
				countA = 0;
				idx++;
				continue;
			}
			if (arr[idx] == 'A' && arr[idx + 1] == 'B' && arr[idx + 2] == 'C') {
				count += countA;
				countA--;
				arr[idx + 2] = 'A';
				idx += 2;
			} else {
				idx++;
			}
		}
		System.out.println(count);
	}
}


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

int main() {
  int h , w;
  cin >> h >> w;
  
  string s;
  vector<string> vec0(w + 2 , "#");
  vector<string> vec(w + 2 , "#");
  //1行目
  for(int i =0; i < w +2; i++){
    cout << vec0.at(i);
  }
  cout << endl;
  
  //2行目-最終直前
  for(int i = 0; i < h; i++) {
    cin >> s;
    for(int j = 0; j < w; j++){
      vec.at(j + 1) = s.at(j);
    } //配列完成
  //出力  
  	for(int i =0; i < w + 2 ; i++){
    	cout << vec.at(i);
  	}
  	cout << endl;
  }  
  //最終行
    for(int i =0; i < w +2; i++){
    cout << vec0.at(i);
  }
  cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
using namespace std;
int main(){
  int n;
  cin >> n;
  int arr[n];
  for(int i = 0; i < n; i++){
    cin >> arr[i];
  }
  sort(arr, arr+n);
  int ans = 0;
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      for(int k = j + 1; k < n; k++){
        if(arr[i] + arr[j] > arr[k]){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n,m = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(m)]

box = [1]*(n+1)
red = [0]*(n+1)
red[1] = 1
for x,y in xy:
    box[x] -= 1
    box[y] += 1
    if red[x]==1: red[y] = 1
    if box[x]==0: red[x] = 0
print(sum(red))

Measured memory_bytes: 28516
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define MAX 1000
const int INF = 1000000;
typedef pair<int,int> P;
int n,m;
char mp[MAX+1][MAX+1];

int bfs(int sy,int sx,int gy,int gx){
    int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1};
    int d[MAX][MAX];
    queue<P> q;
    
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < m ; j++)
            d[i][j] = INF;
    
    q.push(P(sy,sx));
    d[sy][sx] = 0;
    
    while(q.size()){
        P p = q.front(); q.pop();
        if(p.first == gy && p.second == gx) break;
        
        for(int i = 0 ; i < 4 ; i++){
            int nx = p.first+dx[i];
            int ny = p.second+dy[i];
            
            if(0<=nx&&nx<n&&0<=ny&&ny<m&&d[nx][ny]==INF&&mp[nx][ny]!='X'){
                q.push(P(nx,ny));
                d[nx][ny] = d[p.first][p.second]+1;
            }
        }
    }

    return d[gy][gx];
}

int main(){
    int num;
    
    fill(mp[0],mp[MAX],'#');
    cin >> n >> m >> num;
    vector<P> v(num+1);
    
    for(int i = 0 ; i < n ; i++){
        for(int j = 0 ; j < m ; j++){
            cin >> mp[i][j];
            if(mp[i][j]=='S'){
                v[0].first = i;
                v[0].second = j;
            }
            if('1' <= mp[i][j] && mp[i][j] <= '9'){
                v[mp[i][j]-'0'].first = i;
                v[mp[i][j]-'0'].second = j;
            }
        }
    }
    
    int sum = 0;
    for(int i = 1 ; i < num+1 ; i++){
        sum += bfs(v[i-1].first,v[i-1].second,v[i].first,v[i].second);
    }
    cout << sum << endl;
    
    return 0;
}

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

int main() {
  int h,w;
  cin >> h >> w;
  vector<string> vec(h);
  for (int i = 0; i < h; i++) {
    cin >> vec.at(i);
  }
  for (int i = 0; i < h + 2; i++) {
    if (i == 0 || i == h + 1) {
      for (int j = 0; j < w + 2; j++) {
        cout << "#";
      }
      cout << endl;
    }
    else {
      cout << '#' << vec.at(i-1) << '#' << endl;
    }
  }
}

Measured memory_bytes: 3604
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    if( a < b ){
        cout<<"a < b"<<endl;
    }else if( a > b ){
        cout<<"a > b"<<endl;
    }else if( a = b ){
        cout<<"a == b"<<endl;
    }
}



Measured memory_bytes: 3084
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy

p1="U"*y+"R"*x
p2="D"*y+"L"*x
p3="L"+"U"*(y+1)+"R"*(x+1)+"D"
p4="R"+"D"*(y+1)+"L"*(x+1)+"U"

print(p1+p2+p3+p4)

Measured memory_bytes: 9144
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

// return n is prime or not : O(sqrt(n))
bool is_prime(ll n) {
    ll smallest_divisor = n;
    if (n % 2 == 0) smallest_divisor = 2;
    for (ll i = 3; i * i <= n; i += 2) {
        if (n % i == 0) smallest_divisor = i;
    }
    return n > 1 && smallest_divisor == n;
}

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

    ll x;
    cin >> x;
    while (1) {
        if (is_prime(x)) {
            cout << x << endl;
            return 0;
        }
        x++;
    }
    return 0;
}

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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	vector<long long> a(n);
	for(int i=0;i<n;i++) cin >> a[i];
	sort(a.begin(),a.end());
	a.erase(unique(a.begin(),a.end()),a.end());
	if(a.size()==n) cout << "YES\n";
	else cout << "NO\n";
	
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define gc getchar()
#define mp make_pair
#define fir first
#define sec second
#define N 200010
#define debug(x) cerr<<#x<<"="<<x
#define sp <<" "
#define ln <<endl
using namespace std;
typedef pair<int,int> pii;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');return x;
}
struct segment{
	int l,r,mn,pt;
	segment *ch[2];
}*rt;pii a[N];
inline int push_up(segment* &rt) { return rt->mn=min(rt->ch[0]->mn,rt->ch[1]->mn); }
inline int update_tags(segment* &rt,int v) { return rt->mn+=v,rt->pt+=v; }
inline int push_down(segment* &rt)
{	return update_tags(rt->ch[0],rt->pt),update_tags(rt->ch[1],rt->pt),rt->pt=0;	}
int build(segment* &rt,int l,int r,int x)
{
	rt=new segment,rt->l=l,rt->r=r,rt->pt=0;
	if(l==r) return rt->mn=x-l;int mid=(l+r)>>1;
	build(rt->ch[0],l,mid,x),build(rt->ch[1],mid+1,r,x);
	return push_up(rt);
}
int update(segment* &rt,int s,int t,int v)
{
	if(s>t) return 0;
	int l=rt->l,r=rt->r,mid=(l+r)>>1;
	if(s<=l&&r<=t) return update_tags(rt,v);
	if(rt->pt) push_down(rt);
	if(s<=mid) update(rt->ch[0],s,t,v);
	if(mid<t) update(rt->ch[1],s,t,v);
	return push_up(rt);
}
int main()
{
	int n=inn(),m=inn(),Ans=min(n,m);
	for(int i=1,l,r;i<=n;i++)
		l=inn(),r=inn(),a[i]=mp(l,r);
	sort(a+1,a+n+1),build(rt,1,m+1,m+1);
	for(int l=0,c=0;l<=m;l++)
	{
		while(c<n&&a[c+1].fir<=l)
			c++,update(rt,a[c].sec+1,m+1,1);
		Ans=min(Ans,n-c+l+rt->mn);
	}
	return !printf("%d\n",n-Ans);
}

Measured memory_bytes: 20608
#include <cstdio>

int main(){
  double x[4],y[4],s[3];
  while(1){
    for(int i=0; i<4; i++)
      if(scanf("%lf %lf",&x[i],&y[i]) == EOF)
	goto outer;

    for(int i=0; i<3; i++){
      int j=(i+1)%3;
      s[i] = (x[i]-x[j])*(y[j]-y[3])-(y[i]-y[j])*(x[j]-x[3]);
    }

    if((s[0]>0&&s[1]>0&&s[2]>0)||(s[0]<0&&s[1]<0&&s[2]<0))
      printf("YES\n");
    else
      printf("NO\n");
  }
 outer: ;
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double eps = 1e-8;

int main(){
	int gesture[5];
	while(~scanf("%d",&gesture)){
		if(gesture[0]==0) break;
		for(int i=0;i<4;i++){
			scanf("%d",gesture+i+1);
		}

		for(int i=0;i<5;i++){
			int bit,player;
			bit = player = (1 << (gesture[i]-1));

			for(int j=0;j<5;j++){
				if(i==j) continue;
				bit |= (1 << (gesture[j]-1));
			}

			if(bit == ((1<<3)-1)){
				printf("3\n");
			}

			else if(bit == 1 
				|| bit == (1<<1)
				|| bit == (1<<2)){
					printf("3\n");
			}

			else{
				bit &= ~player;
				if(player == 1 && bit == (1<<1)){
					printf("1\n");
				}
				else if(player == 1 && bit == (1<<2)){
					printf("2\n");
				}

				else if(player == (1<<1) && bit == 1){
					printf("2\n");
				}
				else if(player == (1<<1) && bit == (1<<2)){
					printf("1\n");
				}

				else if(player == (1<<2) && bit == 1){
					printf("1\n");
				}
				else if(player == (1<<2) && bit == (1<<1)){
					printf("2\n");
				}
			}
		}
		
	}

}

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

int main()
{
  int n;
  cin >> n;
  double cur;
  double invSum = 0;
  for (int i = 0; i < n; ++i)
  {
    cin >> cur;
    invSum += 1.0 / cur;
  }
  cout << setprecision(10) << (1.0 / invSum) << endl;
 
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, int b, int _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) a[i] -= i + 1;
  sort(all(a));
  // cout << a << endl;

  vector<ll> acc(n + 1);
  rep(i, n) acc[i + 1] = acc[i] + a[i];

  ll ans = INF;
  rep(i, n) {
    ll tmp = 0;
    tmp += a[i] * i;
    tmp -= acc[i];

    tmp -= a[i] * (n - i);
    tmp += acc[n] - acc[i];
    chmin(ans, tmp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
 using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 int main(){
   int r,d,x;
   cin>>r>>d>>x;
   rep(i,10){
   x=r*x-d;
     cout<<x<<endl;
   }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <cassert>

using namespace std;

const int kN= 1e9;

int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    std::vector<int64_t> v(n);
    for (auto& el : v) {
        cin >> el;
    }
    std::set<int64_t> st;
    std::set<int64_t> real;
    for (int i = 0; i < n; i++) {
        st.insert((v[i] - v[(i - 1 + n) % n] + n *1ll *kN) % n);
        real.insert(-(v[i] - v[(i - 1 + n) % n]));
    }
    if (st.size() != 1) {
        cout << "NO" << endl;
        return 0;
    }
    auto all = -(*real.begin());
    std::vector<int64_t> k(n);
    for (int i = 0; i < n; i++) {
        auto l = v[i];
        auto r = v[(i + 1) % n];
        k[i] = (all - (r - l)) / n;
        assert(k[i]>=0);
    }
    int64_t cur = 0;
    int64_t ccur = n - 1;
    for (int i = 1; i < n; i++) {
        cur += k[i] * ccur;
        ccur--;
    }
    for (int i = 0; i < n; i++) {
        int64_t i_ans = cur + k[i] * n;
        if (i_ans > v[i]) {
            cout << "NO" << endl;
            return 0;
        }
        v[i] -= i_ans;
        cur -= k[(i + 1) % n] * (n - 1);
        cur += all - k[(i + 1) % n];
    }

    for (int i = 0; i < n - 1; i++) {
        assert(v[i + 1] == v[i]);
    }
    if (v[0] % ((n) * 1ll * (n + 1) / 2) == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}



Measured memory_bytes: 8704
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
typedef long long int ll; 
typedef long double ld; 

ll power(ll a,ll b)
{
    ll r = 1;
    while(b>0)
    {
        if(b%2 == 1)
        {
            r = r*a;
        }
        a = a*a;
        b = b/2;
    }
    return r;
}

int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    ll x;
    cin>>x;
    //cout<<power(120,5)<<endl;
    for(ll i=-120;i<=120;i++)
    {
        for(ll j=-120;j<=120;j++)
        {
            if((x==(power(i,5)-power(j,5))))
            {
                cout<<i<<" "<<j<<endl;
                return 0;
            }
        }
    }

}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
const int maxn=300005;
const int mod=998244353;
typedef long long ll;
int n,m;
int a[maxn];
char s[maxn];
ll cnt[2];
char col[2];
int main()
{
	scanf("%d%s",&n,s);
	int LEN=n*3;
	ll ans=1;
	for(int i=0;i<LEN;i++)
	{
		if(cnt[0]&&col[0]==s[i])
		{
			cnt[0]++;
			a[i]=-1;
		}
		else if(cnt[1]&&col[1]&&col[1]==s[i])
		{
			cnt[1]++;
			if(cnt[1]>cnt[0])
			{
				swap(cnt[1],cnt[0]);
				swap(col[1],col[0]);
				a[i]=-1;
			}
			else a[i]=0;
		}
		else if(!cnt[0])
		{
			cnt[0]=1;
			col[0]=s[i];
			a[i]=-1;
		}
		else if(!cnt[1])
		{
			cnt[1]=1;
			col[1]=s[i];
			a[i]=0;
		}
		else
		{
			cnt[0]--;
			cnt[1]--;
			a[i]=1;
		}
	}
	int rem=0;
	for(int i=0;i<LEN;i++)
	{
		if(a[i]==-1)rem++;
		if(a[i]==0)ans=ans*rem%mod,rem--;
	}
	for(int i=LEN-1;i>=0;i--)
	{
		if(a[i]==1)rem++;
		if(a[i]==0)ans=ans*rem%mod,rem--;
	}
	//printf("%lld\n",ans);
	for(int i=1;i<=n;i++)ans=ans*i%mod;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1664
def calc_digits(num):
	ans = 1

	while True:
		if num // 10 == 0:
			break

		num //= 10
		ans += 1

	return ans


def main():
	N = int(input())

	n = int(N ** 0.5)
	ans = 10 ** 10

	for A in range(1, n + 1):
		if N % A == 0:
			B = int(N / A)
		else:
			continue

		A_digits = calc_digits(A)
		B_digits = calc_digits(B)

		max_digits = max(A_digits, B_digits)

		if max_digits < ans:
			ans = max_digits

	print(ans)



  
if __name__ == "__main__":
  	main()

Measured memory_bytes: 9472
from collections import defaultdict
dict=defaultdict(lambda:0)
n=int(input())

for x in range(1,100):
    for y in range(1, 100):
        for z in range(1,100):
            p=(x+y+z)**2-(x*y+y*z+z*x)
            dict[p]+=1

for i in range(1,n+1):
    print(dict[i])

Measured memory_bytes: 11836
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
AB = np.array(read().split(), np.int64)

A = AB[::2]
B = AB[1::2]

A.sort()
B.sort()

if N % 2 == 0:
    n = N // 2
    med1 = A[n - 1] + A[n]
    med2 = B[n - 1] + B[n]
    x = med2 - med1 + 1
else:
    n = N // 2
    med1 = A[n]
    med2 = B[n]
    x = med2 - med1 + 1

print(x)

Measured memory_bytes: 53200
use {
    proconio::{input, marker::Usize1},
    std::{
        collections::{BTreeSet, BTreeMap},
        ops::Bound::Included,
    },
};

const M: usize = usize::max_value();

fn main() {
    input! {
        h: usize,
        w: usize,
        ab: [(Usize1, Usize1); h],
    }

    let mut es = BTreeSet::new();
    let mut dc = BTreeMap::new();
    for j in 0..w {
        es.insert((j, j));
    }
    dc.insert(0, w);

    for i in 0..h {
        let (a, b) = ab[i];
        let mut rm = vec![];
        let mut add = None;
        for &(e, s) in es.range((Included(&(a, 0)), Included(&(b, w)))).rev() {
            rm.push((e, s));
            if add.is_none() {
                let e = if b == w - 1 { M } else { b + 1 };
                add = Some((e, s));
            }
        }

        for (e, s) in rm {
            es.remove(&(e, s));

            let d = e - s;
            let v = dc.get_mut(&d).unwrap();
            if *v <= 1 {
                dc.remove(&d);
            } else {
                *v -= 1;
            }
        }

        if let Some((e, s)) = add {
            es.insert((e, s));
            *dc.entry(e - s).or_insert(0) += 1;
        }

        let d = if let Some(f) = dc.iter().next() { *f.0 } else { M };
        if d >= w {
            println!("-1");
        } else {
            println!("{}", d + i + 1);
        }
    }
}


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

vector<ll> a, b;

ll ceil(ll n, ll m) {
    return n % m == 0 ? n / m : n / m + 1;
}

vector<vector<ll>> dp;

ll solve(ll h, ll i, ll n) {
    if (h <= 0) return 0;
    if (i == n - 1) return ceil(h, a[i]) * b[i];
    if (dp[i][h] != -1) {
        return dp[i][h];
    }
    dp[i][h] = min(solve(h, i+1, n), solve(h - a[i], i, n) + b[i]);
    return dp[i][h];
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll h, n;
    cin >> h >> n;
    dp = vector<vector<ll>>(n, vector<ll>(h + 1, -1));
    a = vector<ll>(n);
    b = vector<ll>(n);
    for (ll i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    cout << solve(h, 0, n);
    return 0;
}


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

int main(){
  int N;
  long long int X;
  cin >>N>>X;
  vector<long long int> l(51); // l.at(i) means the number of layers in level i burger
  l.at(0) = (long long int) 1;
  for(int i=1;i<51;i++){
    l.at(i) = l.at(i-1)*2+3;
  }
  vector<long long int> p(51);
  p.at(0) = (long long int) 1;
  for(int i=1;i<51;i++){
    p.at(i) = p.at(i-1)*2+1;
  }
  vector<long long int> a(50,0);
  long long int ans=0;
  for(int i=N-1;i > (-1);i--){
    X--;
    if(X == 0) break;
    if(X > l.at(i)-(long long int)1){
      a.at(i)++;
      X -= l.at(i);
      if(X == 0) break;
      X--;
      ans++;
      if(X == 0) break;
    }
  }
  if(X > 0) ans++;
  for(int i=0;i<N;i++){
    if(a.at(i) == 1){
      ans += p.at(i);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256