akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	int oddnum = 0;
	for(int i = 0; i < n; i++){
		int a;
		cin >> a;
		if(a % 2 == 1) oddnum++;
	}
	if(oddnum % 2 == 0) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
n, m = map(int,input().split())
a = []
for i in range(n):
    a.append(list(map(int,input().split())))
b = []
for i in range(m):
    b.append(int(input()))
for i in range(n):
    print(sum(a[i][j]*b[j] for j in range(m)))


Measured memory_bytes: 6012
n,x,y = map(int,input().split())

x = x-1
y = y-1

count_dict = {i : 0 for i in range(0, n)}

for i in range(n):
    for k in range(n):
        key = min(abs(i-k), abs(i-x)+abs(k-y) + 1, abs(i-y) +abs(k-x) + 1)
        count_dict[key] += 1

for i in range(1, n):
    print(count_dict[i] //2)

Measured memory_bytes: 53724
program changing_a_character
  implicit none
  integer :: n, k, i
  character(50) :: s
  read(*,*) n, k
  read(*,*) s
  s = trim(adjustl(s))
  s(k:k) = achar(ichar(s(k:k))+32)
  write(*,'(a)') trim(s)
  stop
end program changing_a_character

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

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

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

    int sum = 0;
    for (int i = 1; i <= N+1; i++) {
        sum += abs(A[i] - A[i-1]);
    }

    int ans = 0;
    for (int i = 1; i <= N; i++) {
        ans = sum - abs(A[i] - A[i-1]) - abs(A[i+1] - A[i])
              + abs(A[i+1] - A[i-1]);
        printf("%d\n", ans);

    }

    return 0;
}


Measured memory_bytes: 1664
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main() {
	char c;
	cin >> c;

	string ans;
	if (c >= 'a' && c <= 'z') ans = "a";
	else ans = "A";

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int N; cin >> N;
	rep(i, 0, N) {
		int K, P; cin >> K >> P;
		cout << (K%P ? K%P : P) << endl;
	}
	return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <vector>


int main() {
    int N, M;
    std::cin >> N >> M;

    std::vector<int> heights(N);
    for (int i = 0; i < N; i++) {
        std::cin >> heights[i];
    }

    std::vector<int> is_heighest(N, 1);
    for (int i = 0; i < M; i++) {
        int a, b;
        std::cin >> a >> b;
        a--;
        b--;
        if (heights[a] > heights[b]) {
            is_heighest[b] = 0;
        }
        if (heights[b] > heights[a]) {
            is_heighest[a] = 0;
        }
        if (heights[a] == heights[b]) {
            is_heighest[a] = 0;
            is_heighest[b] = 0;
        }
    }

    int sum = 0;
    for (auto && val : is_heighest) {
        sum += val;
    }

    std::cout << sum << std::endl;
}


Measured memory_bytes: 4048
#include <iostream> 
#include <vector> 
#include <algorithm> 
#include <bits/stdc++.h> 
#include <stdlib.h> 
#include <stdio.h> 
#include <functional> 
#include<math.h> 
#include<cstring>
using namespace std;
typedef long long ll;

int main(void){
    // Your code here
    string S;
    cin >> S;
    vector<int> ans(S.size());
    for(int i = 0; i < S.size(); i++)ans.at(i) = 0;
    int cnt = 0;
    for(int i = 0; i < S.size(); i++){
        if(S.at(i) == 'A' || S.at(i) == 'T' || S.at(i) == 'G' || S.at(i) == 'C'){
            ans.at(cnt)++;
        }
        else{
            cnt++;
        }
    }
    sort(ans.begin(),ans.end());
    reverse(ans.begin(),ans.end());
    cout << ans.at(0);
    
    
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100000
int main(){
  int n, i, H, A[N];
  scanf("%d", &H);
  for( i = 1; i <= H; i++ )
    scanf("%d", &A[i]);
  for( i = 1; i <= H; i++ ){
    printf("node %d: key = %d, ", i, A[i]);
    if( i/2 >= 1 )
      printf("parent key = %d, ", A[i/2]);
    if( i*2 <= H )
      printf("left key = %d, ", A[i*2]);
    if( i*2+1 <= H )
      printf("right key = %d, ", A[i*2+1]);
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2052
program abc042b
      implicit none
      character(100),allocatable,dimension(:)::s
      integer::n,l
      integer::i
      
         read *, n,l
         allocate(s(n))
         do i=1,n
            read *, s(i)
         end do
         
         call sort_bubble(n,s)
         
         do i=1,n
            write(*,'(A)',advance='no') s(i)(1:l)
         end do
         stop
         
   contains         
      subroutine sort_bubble(n,arr)
       ! 最も直感的
       ! O(N^2)
       ! if want to sort the array of strings, change 't(int)' to 'w(character)'
         implicit none
         integer,intent(in)::n
         character(100),intent(inout)::arr(1:n)
         integer::i,j
         character(100)::t

            do i=1,n-1
               do j=i+1,n
                  if(arr(i) > arr(j))then
                     t=arr(i)
                     arr(i)=arr(j)
                     arr(j)=t
                  end if
               end do
            end do

            return
      end subroutine sort_bubble
      
   end program abc042b

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

using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ll long long
#define li long int

#define pb push_back
#define m <i> map<int>
#define v <i> vector<int>

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

int main()
{
  IOS;
  int n, k;
  cin >> n >> k;
  int ans=0;
  while (n>0)
    {
      n/=k;
      ans++;
    }
  cout << ans << endl;
  return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long> VLL;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/

int main(){
    int n;cin>>n;
    string s;cin>>s;
    int max=-1;
    for(int i=0;i<=n-2;i++){
        int cnt=0;
        for(char c='a';c<='z';c++){
            bool left=false;
            bool right=false;
            bool flag=false;
            for(int j=0;j<=i;j++){
                //cout<<s[j];
                if(s[j]==c)left=true;
            }
            //cout<<endl;
            for(int j=i+1;j<n;j++){
                //cout<<s[j];
                if(s[j]==c)right=true;
            }
            if(right&&left)flag=true;
            if(flag==true)cnt++;
        }
        //printf("cnt=%d\n",cnt);
        if(max<cnt)max=cnt;
    }
    cout<<max<<endl;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>

#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <ctime>

// namespace
using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

// constant
static const ll MOD = 1000000007LL;
static const double PI = 3.14159265358979323846;

// conversion
inline ll toint(string s) { ll v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

// print
#define RET(x) return cout << x << endl, 0;

// for loop
#define REP(i, a, b) for ((i) = (ll)(a);(i) < (ll)(b);(i)++)
#define REPD(i, a, b) for (ll i = (ll)(a);(i) < (ll)(b);(i)++)
#define REPI(v, vs) for (auto& v : vs)

//debug
#ifdef LOCAL_ENV
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define DUMP(x)
#define DEBUG(x)
#endif

#define MAX_VALUE 9223372036854775807

int solve() {
	ll H, W, M;
	cin >> H >> W >> M;

	vector<pair<ll, ll>> row_bombs(H);
	vector<pair<ll, ll>> col_bombs(W);
	REPD(i, 0, H) row_bombs[i] = {0, i};
	REPD(i, 0, W) col_bombs[i] = {0, i};

	set<pair<ll, ll>> bombs;
	ll h, w;
	REPD(i, 0, M) {
		cin >> h >> w;
		--h, --w;
		row_bombs[h] = {row_bombs[h].first + 1, h};
		col_bombs[w] = {col_bombs[w].first + 1, w};
		bombs.insert({h, w});
	}

	sort(row_bombs.begin(), row_bombs.end(), greater<pair<ll, ll>>());
	sort(col_bombs.begin(), col_bombs.end(), greater<pair<ll, ll>>());

	ll max_row_bomb = row_bombs[0].first;
	ll max_col_bomb = col_bombs[0].first;

	set<ll> row_sets;
	REPD(i, 0, H) {
		if (row_bombs[i].first == max_row_bomb) row_sets.insert(row_bombs[i].second);
		else break;
	}
	set<ll> col_sets;
	REPD(i, 0, W) {
		if (col_bombs[i].first == max_col_bomb) col_sets.insert(col_bombs[i].second);
		else break;
	}

	if (row_sets.size() * col_sets.size() > M) RET(max_row_bomb + max_col_bomb);

	bool no_bomb_mass_is_found = false;
	for (auto iter1 = row_sets.begin(); iter1 != row_sets.end(); ++iter1) {
		for (auto iter2 = col_sets.begin(); iter2 != col_sets.end(); ++iter2) {
			if (bombs.count({*iter1, *iter2}) == 0) {
				no_bomb_mass_is_found = true;
				break;
			}
		}
	}

	if (no_bomb_mass_is_found) {
		RET(max_row_bomb + max_col_bomb);
	}
	else {
		RET(max_row_bomb + max_col_bomb - 1LL);
	}

	return 0;
}

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

	solve();
	// ll t;
	// cin >> t;
	// REPD(i, 0, t) solve();

	return 0;
}


Measured memory_bytes: 59356
A, B = map(int, input().split())

def MaxCoinCount(A,B):
  ans = 0
  if A > B:
    ans = A + (A - 1)
  elif A < B:
    ans = B + (B - 1)
  else:
    ans = A + B
  return ans


print(MaxCoinCount(A,B))

Measured memory_bytes: 3060
/* Filename: ABC046B.java
 * Author: Mushiyo
 */

import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);

		while (input.hasNext()) {
			int N = input.nextInt();
			int K = input.nextInt();
			
			int ways = K;
			for(int i = 2; i <= N; ++i){
				ways *= (K - 1);
			}
			
			System.out.println(ways);
		}
	}

}


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

int main(){
  int h,w;
  cin >> h >> w;
  cout << "#" ;
  for (int i = 0; i < w; i++){
    cout << "#";
  }
  

  cout << "#" << endl;
  string p;
  for (int i = 0; i < h; i++){
    cin >> p;
    cout << "#" << p << "#" << endl;
  }
  cout << "#" ;
  for (int i = 0; i < w; i++){
    
    cout << "#";
  }  
  cout << "#"  << endl;
  
}


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


int main() {
	int H, W;
	cin >> H >> W;
	vector<string>s(100);
	for (int i = 0; i < H; i++) {
		cin >> s.at(i);
	}
	for (int i = 0; i < W + 2; i++) {
		cout << '#';
	}
	cout << endl;
	for (int i = 0; i < H; i++) {
		cout << '#' << s.at(i) << '#' << endl;
	}
	for (int i = 0; i < W + 2; i++) {
		cout << '#';
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
char s[4];
int main() {
	int i, j, k;
	scanf("%s", s);
	if(s[0] == s[1] && s[1] == s[2]) printf("Yes\n");
	else if(s[1] == s[2] && s[2] == s[3]) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    intmax_t N, M;
    intmax_t p[(int)1e5];
    char S[(int)1e5][3];
    struct {
        bool ac;
        intmax_t penalty;
    } ans[(int)1e5] = {};
    intmax_t ac = 0, penalty = 0;

    scanf("%jd%jd", &N, &M);
    for (size_t i = 0; i < M; i++) {
        scanf("%jd%s", &p[i], &S[i][0]);
    }

    for (size_t i = 0; i < M; i++) {
        if (ans[p[i] - 1].ac)
            continue;

        if (strcmp(&S[i][0], "WA") == 0) {
            ans[p[i] - 1].penalty++;
        } else if (strcmp(&S[i][0], "AC") == 0) {
            ans[p[i] - 1].ac = true;
        }
    }

    for (size_t i = 0; i < N; i++) {
        if (ans[i].ac) {
            ac++;
            penalty += ans[i].penalty;
        }
    }

    printf("%jd %jd\n", ac, penalty);

    return 0;
}


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

typedef long long ll;

int main() {
  int n; ll a, b;
  cin >> n >> a >> b;
  vector <ll> c(n);
  for(int i = 0; i < n; i++) {
    cin >> c[i];
  }
  ll cost = 0;
  for(int i = 0; i < n - 1; i++) {
    ll distance = c[i + 1] - c[i];
    cost += min(a * distance, b);
  }
  cout << cost << '\n';
}




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

signed main() {
  int N;
  cin >> N;
  
  vector<int> A(N);
  vector<int> B(N);
  for( int i = 0; i < N; i++ ){
    cin >> A.at(i);
    B.at(i) = A.at(i) - (i+1);
  }
  sort(B.begin(), B.end());
  
  int ans = 0;
  int tasu = N/2;
  for( int i = 0; i < N; i++ ) ans += abs(B.at(i)-B.at(N/2));
  cout << ans << endl;
                                          
}

Measured memory_bytes: 3328
/*In the name of ALLAH, Most Gracious, Most Merciful*/
///     </> : omar_aziz

#include<bits/stdc++.h>

#define ll                      long long int
#define ull                     unsigned long long int
#define PI                      2*acos(0.0)
#define sqr(x)                  (x)*(x)
#define EPS                     10E-10
#define MOD                     1000000007
#define longlimit               92233720368547758
#define infinity                (1<<28)
#define setbits                 __builtin_popcount
#define zerobits                __builtin_ctzll
#define pb(a)                   emplace_back(a)
#define mp                      make_pair
#define ff                      first
#define ss                      second
#define gcd(a, b)               __gcd(a,b)
#define lcm(a, b)               ((a)*(b))/gcd(a,b)
#define pii                     pair<ll,ll>
#define vi                      vector<ll>
#define vii                     vector<pii>
#define watch(x)                cout << (#x) << " is " << (x) << endl
#define FOR(x,n)                for (ll i=x,j=x,k=x;i<n,j<n,k<n;i++,j++,k++)
#define FORR(n,x)               for (ll i=n-1,j=n-1,k=n-1;i>=x,j>=x,k>=x;i--,j--,k--)
#define TEST_CASES()            ll t;cin>>t;while (t--)
#define PRECISION(a,x)          fixed<<setprecision(x)<<a<<endl;
#define all(a)                  (a.begin()),(a.end())
#define UNIQUE(X)               (X).erase(unique(all(X)),(X).end())
#define DELETE(X)               (X).erase (remove (all(X)),(X).end())
#define SORT_UNIQUE(c)          (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define FAST_IO()               ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define FILE_IO()               freopen("output.txt", "w", stdout);freopen("input.txt", "r", stdin)
using namespace std;
ll tc=1;
//ll cnt=0,sum=0,ans=0,res=0,maxi=INT_MIN,mini=INT_MAX,row,col;


void solve()
{
    ll n;
    cin>>n;
    if (n<30)
        cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

int32_t main()
{
    FAST_IO();

    //TEST_CASES()
        solve();
}


Measured memory_bytes: 3648
void main() {
  import std.stdio, std.string, std.conv, std.algorithm;

  int n, g;
  rd(n, g);
  struct P {
    int p, c;
  }

  auto ps = new P[](n);
  foreach (i; 0 .. n)
    rd(ps[i].p, ps[i].c);
  int mn = 1000000000;
  foreach (bit; 0 .. (1 << n)) {
    int s = 0, cnt = 0;
    foreach (i; 0 .. n) {
      if (bit & (1 << i)) {
        s += ps[i].p * (i + 1) * 100 + ps[i].c;
        cnt += ps[i].p;
      }
    }
    if (s >= g) {
      mn = min(mn, cnt);
      continue;
    }
    foreach_reverse (i; 0 .. n) {
      if ((bit & (1 << i)) == 0) {
        if (s + ps[i].p * (i + 1) * 100 >= g) {
          mn = min(mn, cnt + ((g - s) + (i + 1) * 100 - 1) / ((i + 1) * 100));
        }
        break;
      }
    }
  }
  writeln(mn);
}

void rd(T...)(ref T x) {
  import std.stdio : readln;
  import std.string : split;
  import std.conv : to;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}


Measured memory_bytes: 256
const main = arg => {
  const n = parseInt(arg.split(' ')[0], 10)
  const r = parseInt(arg.split(' ')[1], 10)
  if (n >= 10) {
    console.log(r)
  } else {
    console.log(r + 100 * (10 - n))
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf-8'))


Measured memory_bytes: 7372
inf = 1 << 28
def calc(xyzr1,xyzr2):
    x1,y1,z1,r1 = xyzr1
    x2,y2,z2,r2 = xyzr2
    d = ((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)**0.5
    return max(0, d-r1-r2)
    
while 1:
    n = int(raw_input())
    if n == 0: break
    xyzr = [map(float,raw_input().split()) for i in xrange(n)]
    
    cost = [[0]*n for i in xrange(n)]
    for i in xrange(n):
        for j in xrange(n):
            cost[i][j] = cost[j][i] = calc(xyzr[i],xyzr[j])
    
    mincost = [inf]*n
    used = [False]*n
    mincost[0] = 0
    ans = 0
    while 1:
        v = -1
        for u in xrange(n):
            if not used[u] and (v == -1 or mincost[u] < mincost[v]): v = u
        if v == -1: break
        used[v] = True
        ans += mincost[v]
        for u in xrange(n):
            mincost[u] = min(mincost[u], cost[v][u])
    
    print "%.3f"%ans
    
    

Measured memory_bytes: 4528
/*
...........__________    							 |										    ___  __
.............|       |     						     |											 |   /
.............|       |     						     |									  		 |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
.........  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e5+10;

void raushan_kumar(){
	string s;cin>>s;
	map<int,int> m;
	fo0(i,s.length()){
		m[s[i]-'A']++;
	}
	if(m.size()==2)
	cout<<"Yes";
else
	cout<<"No";
}

int32_t main()
{
	
	fast;int t=1;
	//cin>>t;
	while(t--){
		raushan_kumar();
	}

}

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

int main() {
  int n;
  unordered_map<long,int>mp;
  cin >> n;
  for(int i = 0;i < n;i++){
    long a;
    cin >> a;
    auto itr = mp.find(a);
    if(itr == mp.end()){
      mp[a] = 1;
    }
    else{
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}


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

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int MAX = 1000001; 
const int MAX_N = 1e5 + 5;
const int MAX_L = 20; // ~ Log N
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;

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

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)
int factor[MAX] = { 0 };
void generatePrimeFactors() 
{ 
    factor[1] = 1; 
  

    for (int i = 2; i < MAX; i++) 
        factor[i] = i; 
  
    
    for (int i = 4; i < MAX; i += 2) 
        factor[i] = 2; 
  
    
    for (int i = 3; i * i < MAX; i++) { 
        
        if (factor[i] == i) { 
            
            for (int j = i * i; j < MAX; j += i) { 
                
                if (factor[j] == j) 
                    factor[j] = i; 
            } 
        } 
    } 
} 


void solve() {
	int N;
	cin>>N;
	int n=N-1;
	int b[N+1]={0};
	b[1]=1;
	while(n>1){
		
		int ans = 1; 
  
    
    int dup = factor[n]; 
  
    
    int c = 1; 
  
    
    int j = n / factor[n]; 
  
    while (j != 1) { 
        
        if (factor[j] == dup) 
            c += 1; 
  
        
        else { 
            dup = factor[j]; 
            ans = ans * (c + 1); 
            c = 1; 
        } 
  
        
        j = j / factor[j]; 
    } 
  
   
    ans = ans * (c + 1);
		
        
        b[n]=ans; 
	    n--;   
		
	}
	int aa=0;
	for(int i=0;i<=N-1;i++){
//		cout<<b[i]<<" ";
		aa+=b[i];
	}
	cout<<aa<<endl;
	
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    generatePrimeFactors(); 
    solve();
}

Measured memory_bytes: 11440
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

def printd(str)
  print str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

nn = inputs[0][0]
ll = inputs[0][1]

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

# body
if $debugFlag
  p nn
  p ll
end

arr = []
nn.times do |i|
  arr << ll + i
end

tmp_tgt = nil
arr.each do |a_i|
  if tmp_tgt == nil
    tmp_tgt = a_i
  else
    tmp_tgt = a_i if tmp_tgt.abs >= a_i.abs
  end
end

pd arr
pd arr.inject(:+)

ans = arr.inject(:+) - tmp_tgt

puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <sstream>

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

using namespace std;
typedef long long ll;

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

	rep(i,n)
	{
		string s;
		cin >> s;

		string ret = "";

		rep(j,8)
		{
			int temp;
			if('0' <= s[j] && s[j] <= '9') temp = s[j] - '0';
			else temp = (s[j] - 'a') + 10;

			bitset<4> bit(temp);
			ret += bit.to_string();
		}
		
		reverse(ret.begin(),ret.end());

		double ans = 0;
		double t = 1.0;
		int k = 1;

		for(int j=6;j>=0;j--)
		{
			t *= 0.5;
			ans += t*(ret[j] - '0');

			if(ret[j] - '0' == '1') k = 7-j;
		}

		ll t2 = 1,ans2 = 0;

		REP(j,7,31)
		{
			ans2 += t2*(ret[j] - '0');
			t2 *= 2;
		}

		if(ret[31] == '1')
		{
			cout << "-";
		}
		cout << ans2;

		if(ans == 0)
		{
			cout << ".0" << endl;
		}
		else
		{
			stringstream ss;
			ss.precision(8);
			ss << ans;
			string ret2 = ss.str();

			REP(j,1,ret2.size())
			{
				cout << ret2[j];
			}
			cout << endl;
		}
	}
	return 0;
}

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

using namespace std;

const int N = 2e5 + 5;
const int M = 1e6 + 9;
const long long INF = 1e9 + 7;
const int SM = 1e3 + 4;
const double EPS = 3e-16;
const int K = 25;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    
    string s; cin >> s;
    
    int n = int(s.size());    
    long long ans = 1;
    map<char, int> m;
    for(int i = 0; i < n; i++){
        ans += i - m[s[i]];
        m[s[i]]++;
    }
    
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 720
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n,a,b;
int main()
{
    cin>>n>>a>>b;
    if((b-a-1)%2==0)
        cout<<"Borys"<<endl;
    else
        cout<<"Alice"<<endl;
    return 0;
}


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

using namespace std;

#define ll long long
#define fix cout << fixed; cout << setprecision(0)

int main() {
	ll n, a, b;
	cin >> n >> a >> b;
	ll total = n / (a + b) * a;
	total += min(n % (a + b), a);
   fix;
	cout << total <<endl;

	return 0;
}

Measured memory_bytes: 256
s = list(input())
t = list(input())
ls = len(s)
lt = len(t)

cnt = 0
for i in range(ls-lt+1):
  tmp = 0
  for j in range(lt):
    if s[i+j]==t[j]:
      tmp += 1
  cnt = max(cnt,tmp)
print(lt-cnt)

Measured memory_bytes: 9108
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
 
#include<bits/stdc++.h>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>*/
 
#define sz(s) (int)(s.size())
#define all(s) s.begin(), s.end()
#define rep(a, b, c) for(int a = b; a <= c; ++a)
#define per(a, b, c) for(int a = b; a >= c; --a)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
 
using namespace std;
//using namespace __gnu_pbds;
 
typedef unsigned long long ull;
typedef long long ll;
/*typedef tree<pair<int, int>, 
null_type, less<pair<int, int>>, 
rb_tree_tag, tree_order_statistics_node_update>
ordered_set;*/
//find_by_order() order_of_key()
 
const double eps = 1e-7;
const int mod = 1e9+7, MXN = 5e5+17;
const int dx[] = {0,0,1,-1}, dy[] = {1,-1,0,0};
 
template<typename T>inline bool updmin(T &a, const T &b) {return a > b ? a = b,1 : 0;}
template<typename T>inline bool updmax(T &a, const T &b) {return a < b ? a = b,1 : 0;}
 
int h, w, a, b;
int f[MXN];

inline int Add(int a, int b) {
	a += b;
	if(a > mod) a -= mod;
	if(a < mod) a += mod;
	return a;
}
 
inline int Mul(int a, int b) {
	return (a*1ll*b)%mod;
}
 
inline int Pow(int a, int b) {
	int res = 1;
	while(b) {
		if(b&1) res = Mul(res,a);
		b >>= 1;
		a = Mul(a,a);
	}
	return res;
}
 
inline int Div(int a, int b) {
	return Mul(a,Pow(b,mod-2));
}
 
inline int Cnk(int n, int k) {
	return Div(f[n],Mul(f[k],f[n-k]));
}
 
int32_t main() { _
#ifdef DanQQQQQ
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	cin >> h >> w >> a >> b;
	f[0] = 1;
	rep(i,1,200050) f[i] = Mul(f[i-1],i);
	ull cur = Cnk(h+w-2,h-1), res = 0;
	rep(i,0,b-1) res = (res+Mul(Cnk(h-a+i-1,i),Cnk(w+a-i-2,a-1)))%mod;
	cout << (cur-res+mod)%mod << endl;
	return 0;
}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
import math
import numpy as np

s = input()
num = s.split(" ")
A = int(num[0])
B = int(num[1])

tax_8 = []
tax_10 = []

for i in range(10001):
  tax_8.append([math.floor(i*0.08)])
  tax_10.append([math.floor(i*0.1)])

tax_8_np = np.array(tax_8)
tax_10_np = np.array(tax_10)

tax_8_candidate = list(np.where(tax_8_np==A)[0])
tax_10_candidate = list(np.where(tax_10_np==B)[0])

candidate = list(set(tax_8_candidate)&set(tax_10_candidate))

if len(candidate)==0:
  print(-1)
else:
  print(int(np.array(candidate).min()))


Measured memory_bytes: 14892
#define ALL(obj) (obj).begin(), (obj).end()

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>

using namespace std;
typedef long long ll;
const ll INF = 1e18;

string S,T,U;
ll A, B;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> S >> T >> A >> B >> U;
    
    if (S.compare(U) == 0) {
        cout << A-1 << " " << B << endl;
    } else {
        cout << A << " " << B-1 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include "bits//stdc++.h"
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

#define rep(i,n) for (int i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> s[10];
	int p[10];
	rep(i, M) {
		int k;
		cin >> k;
		s[i].resize(k);
		rep(j, k) {
			cin >> s[i][j];
			s[i][j]--;
		}
	}
	rep(i, M) cin >> p[i];
	int ans = 0;
	for (int bit = 0; bit < (1 << N); bit++) {
		bool ok = 1;
		rep(i, M) {
			int cnt = 0;
			rep(j, s[i].size()) {
				if (bit&(1 << s[i][j])) cnt++;
			}
			if (cnt % 2 != p[i]) {
				ok = 0;
				break;
			}
		}
		if (ok) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
H, W, h, w = map(int, input().split())
if H % h == 0 and W % w == 0:
	print("No")
elif h == 1:
	print("Yes")
	coef = 999999999 // (w-1)
	plus, minus = coef, -coef * (w-1) - 1
	for _ in range(H):
		print(*[minus if j%w == 0 else plus for j in range(1, W+1)])
elif w == 1:
	print("Yes")
	coef = 999999999 // (h-1)
	plus, minus = coef, -coef * (h-1) - 1
	for i in range(1, H+1):
		print(*[minus if i%h == 0 else plus for _ in range(W)])
else:
	print("Yes")
	coef = min(999999999 // ((h-1) * (w-1)), 1000000000 // (h+w-1))
	plus, minus = coef * (h+w-1), -coef * (h-1) * (w-1) - 1
	for i in range(1, H+1):
		if i%h != 0:
			print(*[minus if j%w == 0 else plus for j in range(1, W+1)])
		else:
			print(*[minus for _ in range(W)])

Measured memory_bytes: 5916
// 

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

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

using namespace std;

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


Measured memory_bytes: 256
import sys
s=input()
a=int(s[0])
b=int(s[1])
c=int(s[2])
d=int(s[3])

for i in range(2):
    op1="+"*(1-i)+"-"*i
    for j in range(2):
        op2="+"*(1-j)+"-"*j
        for k in range(2):
            op3="+"*(1-k)+"-"*k
            sum=a+b*(-1)**i+c*(-1)**j+d*(-1)**k
            if sum==7:
                print(a,op1,b,op2,c,op3,d,"=7",sep="")
                sys.exit(0)
                

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

#define int long long
#define otp(n) cout << n;
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define ctv(v) rep(i,(v).size()) otp(v[i]) cte
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define repv(i,v) for(int i=0;i<(v).size();i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int n,k,l,ans;
vector<int> v;

main() {
    cin >> n >> k;
    rep(i,n) {
        cin >> l;
        v.pb(l)
    }
    sort(rall(v));
    rep(i,k) ans += v[i];
    ct(ans)
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int a[200010];
int main(){
	int n;
	int num=0,maxn=0,maxx=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		if(a[i]>maxn){
			maxn=a[i];
			num=0;
		}
		if(a[i]==maxn) num++;
	}
	for(int i=1;i<=n;i++) if(a[i]!=maxn&&maxx<a[i]) maxx=a[i];
	for(int i=1;i<=n;i++){
		if(a[i]==maxn){
			if(num>1) printf("%d",maxn);
			else printf("%d",maxx);
		}
		else printf("%d",maxn);
		printf("\n");
	}
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int64_t> L(N + 1);
  L.at(0) = 2;
  L.at(1) = 1;
  
  for (int i = 2; i < N + 1; i++) L.at(i) = L.at(i - 2) + L.at(i - 1);
  
  cout << L.at(N) << endl;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;


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

	cin >> N;
	while (N) {
		vector<int>y(N);
		vector<int>x(N);
		int ymin = 0;
		int ymax = 0;
		int xmin = 0;
		int xmax = 0;
		for (int i = 1; i < N; i++) {
			cin >> L >> R;
			if (R == 0) {
				y[i] = y[L];
				x[i] = x[L] - 1;
			}
			if (R == 1) {
				y[i] = y[L]-1;
				x[i] = x[L];
			}
			if (R == 2) {
				y[i] = y[L];
				x[i] = x[L] + 1;
			}
			if (R == 3) {
				y[i] = y[L]+1;
				x[i] = x[L];
			}
			ymax = max(ymax, y[i]);
			ymin = min(ymin, y[i]);
			xmax = max(xmax, x[i]);
			xmin = min(xmin, x[i]);
		}
		cout << xmax - xmin + 1 << " " << ymax - ymin + 1 << endl;
		cin >> N;
	}
	return 0;
}

Measured memory_bytes: 3180
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int mood) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%mood;
		x = x * x%mood;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, m, a[100000];
priority_queue<int> que;
int ans;

signed main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		que.push(a[i]);
	}
	for (int i = 0; i < m; i++) {
		int p = que.top(); que.pop();
		que.push(p / 2);
	}
	for (int i = 0; i < n; i++) {
		int p = que.top(); que.pop();
		ans += p;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1912
#include<stdio.h>

int main(void){

int a,b,c;

int count=0;

int i;

scanf("%d %d %d",&a,&b,&c);

for(i=a;i<=b;i++){ 

if(c%i==0){

count++;

}

}

printf("%d\n",count);

return 0 ; 

}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = INF+7;
const ll LINF = 1e18;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define VI vector<int>
#define VII vector<vector<int>>
#define all(v) (v.begin(),v.end())
#define MP make_pair
#define pb(n) push_back(n)


int main(){
    int A,B,C,D,E,F;
    cin>>A>>B>>C>>D>>E>>F;
    cout<<(A+5*B+10*C+50*D+100*E+500*F>=1000?1:0)<<endl;
}


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

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

    int n, k;
    cin >> n >> k;

    vector<int> v(n);

    for(int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(),v.end());

    int sum = 0;
    for(int i = 0; i < k; i++)
    {
        sum += v[i];
    }

    cout << sum << endl;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <unistd.h>
#define ll long long
#define ull unsigned long long
#define inf 1000000007
#define inf16 0x3f3f3f3f
#define INF 1000000000000000007LL
#define VI vector<int>
#define VPII vector<pair<int, int> >
#define VLL vector<ll>
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define flush fflush(stdout)
using namespace std;

#define N 307

int n, m;

int a[N][N];
int ile[N];
int curr[N];

struct comp
{
	bool operator()(int a, int b)
	{
		return mp(ile[a], a)>mp(ile[b], b);
	}
};

set<int, comp> S;

bool sprawdz(int k)
{
	S.clear();

	for(int i = 1; i <= m; ++i)
	{
		ile[i] = 0;
	}

	for(int i = 1; i <= n; ++i)
	{
		curr[i] = 1;
		++ile[a[i][curr[i]]];
	}

	for(int i = 1; i <= m; ++i)
	{
		S.insert(i);
	}

	while(ile[*S.begin()]>k)
	{
		S.erase(S.begin());

		for(int i = 1; i <= n; ++i)
		{
			if(S.find(a[i][curr[i]])==S.end())
			{
				while(curr[i]<m && S.find(a[i][curr[i]])==S.end())
					++curr[i];

				if(S.find(a[i][curr[i]])==S.end())
					return 0;
				else
				{
					S.erase(a[i][curr[i]]);
					++ile[a[i][curr[i]]];
					S.insert(a[i][curr[i]]);
				}
			}
		}
	}

	return 1;
}

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);

	cin >> n >> m;

	for(int i = 1; i <= n; ++i)
	{
		for(int j = 1; j <= m; ++j)
		{
			cin >> a[i][j];
		}
	}

	int l = 0, r = n;

	while(l<r)
	{
		int m = (l+r)/2;

		if(m==r)
			--m;

		if(sprawdz(m))
			r = m;
		else
			l = m+1;
	}

	cout << l;
}


Measured memory_bytes: 640
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//#include <ext/pb_ds/detail/standard_policies.hpp>
#include<set>
#include<map>
#include <unordered_map>
#include <unordered_set>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <strings.h>
#include <fstream>


#define f first
#define s second
#define pb push_back
#define lp(i,a,n) for(int (i)=(a);(i)<=(int)(n);(i)++)
#define lpd(i,n,a) for(int (i)=(n);(i)>=(a);--(i))
#define mp make_pair
#define clr(a, b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define mod 1000000007
#define eps 1e-8
#define infi 1000000007
#define infll 2000000000000000000ll
#define MX 1000000
#define X real()
#define Y imag()
#define polar(r,t) ((r)* exp(point(0,(t))))
#define length(a) hypot( (a).X , (a).Y )
#define angle(a) atan2( (a).Y , (a).X )
#define vec(a,b) ( (b) - (a) )
#define dot(a,b) (conj(a)*(b)).X
#define cross(a,b) (conj(a)*(b)).Y
#define lengthsqr(a) dot(a,a)
#define reflect(V,M) (conj((V)/(M)) * (M))
//#define rotate(a, theta) (a) * (polar(1.0, (theta) ))
#define normalize(a)   ((a)/length(a))
#define ccw(a,b,c) cross(vec(a,b) , vec(a,c)) > eps
#define cosRule(a,b,c) (acos(((a)*(a)+(b)*(b)-(c)*(c))/(2*(a)*(b))))
#define cosDot(a,b) (acos(dot(a,b)/length(a)/length(b)))
#define EQ(a,b) (fabs((a) - (b)) <= eps) /* equal to */
#define NE(a,b) (fabs((a) - (b)) > eps)  /* not equal to */
#define LT(a,b) ((a) < (b) - eps)        /* less than */
#define GT(a,b) ((a) > (b) + eps)        /* greater than */
#define LE(a,b) ((a) <= (b) + eps)       /* less than or equal to */
#define GE(a,b) ((a) >= (b) - eps)       /* greater than or equal to */
#define mod1 100050001
#define mod2 100030001
#define base1 37
#define base2 31
#define PI acos(-1)
#define sz(a) (int) (a).size()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef set<int> si;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef complex<long double> point;
typedef pair<point, point> line;
typedef pair<double , point> Circle;
typedef long double ld;


const int N = 200005;

int n,a[N];

ll check(int b) {
    ll ret =0;
    lp(i, 1, n) {
        ret += abs(1ll*a[i]-b);
    }
    return ret;
}

int main() {
    scanf("%d",&n);
    lp(i, 1, n) scanf("%d",&a[i]), a[i] -= i;
    
    sort(a+1, a+n+1);
    
    int b = n&1 ? a[n/2+1] : (a[n/2]+a[(n+1)/2])/2;
    
    ll ans = infll;
    lp(i, b-2, b+2) ans = min(ans, check(i));
    printf("%lld\n",ans);
    
    return 0;
}

/*
 */

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
//ios::sync_with_stdio(0);cin.tie(0);


Measured memory_bytes: 1024
def solve(restCard, target)
  c = 0
  restCard.each{|bHand|
    deck = restCard.clone
    deck.delete(bHand)
    deck.to_a.each{|n| c+= 1 if n <= target}
  }
  return c.to_f / 42.0
end

while input = $stdin.gets
  h = input.split(" ")
  restCard = Array.new
  (1..10).each{|n|
    restCard << n if h.index(n.to_s) == nil
  }
  if solve(restCard, 20 - h[0].to_i - h[1].to_i) >= 0.5
    puts "YES"
  else
    puts "NO"
  end
end

Measured memory_bytes: 6112
import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
MOD = 10**9+7

N,M,P = map(int,(input().split()))
line = []
for i in range(M):
    a,b,c = map(int,(input().split()))
    line.append([a-1,b-1,-c+P])

min_distance = [float("inf")]*N # min_distance[i] は始点から街iまでの最短距離
min_distance[0] = 0 # 始点から始点への最短距離は0とする

def Bellman_Ford():
    flag = 0
    for _ in range(N):
        update = False
        for s,g,d in line: # [s,g,d] = [道路の始点,道路の終点,道路の長さ] について、すべての道路を見る
            if min_distance[s] != float("inf") and min_distance[s] + d < min_distance[g]: # 最短経路が確立されている街から伸びる道路を通ることで、距離を短くできるならば、
                min_distance[g] = min_distance[s] + d # 最短距離を上書きする
                update = True
        if not update:
            flag = 1
            break
    return min_distance,flag

def Bellman_Ford2():
    for _ in range(N):
        for s,g,d in line: # [s,g,d] = [道路の始点,道路の終点,道路の長さ] について、すべての道路を見る
            if min_distance[s] != float("inf") and min_distance[s] + d < min_distance[g]: # 最短経路が確立されている街から伸びる道路を通ることで、距離を短くできるならば、
                min_distance[g] = -float("inf")
                if g == N-1:
                    break
        else:
            continue
        break
    return min_distance

min_distance,flag = Bellman_Ford()

if flag == 1:
    ans = min_distance[N-1]
    print(max(-ans,0))
else:
    min_distance = Bellman_Ford2()
    ans = min_distance[N-1]
    if ans == -float("inf"):
        print(-1)
    else:
        print(max(-ans,0))

#print(min_distance)


Measured memory_bytes: 75652
#x,y,z = list(map(int,input().split()))
n, m = list(map(int,input().split()))
a = list(map(int,input().split()))

ans = 0
b = sum(a)
c = b / (4*m)
for i in a:
    if i >= c:
        ans += 1
if ans >= m:
    print('Yes')
else:
    print('No')


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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

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

  if (n == 1) {
    cout << "Hello World"
         << "\n ";
  } else {
    cin >> a >> b;
    cout << a + b << "\n";
  }
}

Measured memory_bytes: 256
import math
from collections import Counter
n, m = map(int, input().split())

prime_count = Counter()
for i in range(2, math.ceil(math.sqrt(m))+1):
    while m % i == 0:
        m /= i
        prime_count[i] += 1
if m > 1:
    prime_count[int(m)] += 1

def ncr(n, r, p):
    num = den = 1
    for i in range(r):
        num = (num * (n - i)) % p
        den = (den * (i + 1)) % p
    return (num * pow(den, p - 2, p)) % p
p=10**9+7 

ans = 1
for k, v in prime_count.items():
    ans *= ncr(v+n-1, v, p)
    ans %= p

print(ans)


Measured memory_bytes: 38512
from heapq import*
def D(s,e):
 g=10**6;d=[10**18]*n;f=[1]*n;d[s]=f[s]=0;q=[]
 for a,b in e[s]:heappush(q,a*g+b)
 while q:
  m=heappop(q)
  if f[m%g]:
   v=m%g;x=d[v]=m//g;f[v]=0
   for y,w in e[v]:
    if f[w]:heappush(q,(x+y)*g+w)
 return d
(n,m,s,t),*z=[map(int,t.split())for t in open(0)];e,f=eval('[[]for _ in"_"*n],'*2);A,m=[],0
for u,v,a,b in z:u-=1;v-=1;e[u]+=(a,v),;e[v]+=(a,u),;f[u]+=(b,v),;f[v]+=(b,u),
for y,s in zip(D(s-1,e)[::-1],D(t-1,f)[::-1]):m=max(m,10**15-y-s);A+=m,
print(*A[::-1])

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

char  G[100][100];
int H, W;
bool good[100][100];
int main() {
cin >> H >> W;
for (int i = 0; i < H; i++) cin >> G[i];
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (i && G[i][j] == '#' && G[i-1][j] == '#') good[i][j] = good[i-1][j] = true;
if (j && G[i][j] == '#' && G[i][j-1] == '#') good[i][j] = good[i][j-1] = true;
}
}
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (G[i][j] == '#' && !good[i][j]) {
cout << "No\n"; return 0;
}
}
}
cout << "Yes\n"; return 0;
}

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

int N,K;
const int n=200010;
int cnt[n];

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

    for (int i = 0; i < N; i++)
    {
        int a;
        cin>>a;
        cnt[a-1]++;
    }

    sort(cnt,cnt+N);
    
    int ans=0;
    for (int i = 0; i < N-K; i++) 
    {
        ans+=cnt[i];
    }
    
    cout << ans << endl;
        
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

ll gcd(ll x, ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}

bool bfs(vector<vector<int>> g, vector<int> &dist, int sv){
	queue<int> q;
	q.push(sv);
	dist[sv]=0;
	while(!q.empty()){
		int now = q.front(); q.pop();
		for(auto v : g[now]){
			if(dist[v]!=-1) continue;
			dist[v] = dist[now]+1;
			q.push(v);
		}
	}
}

int main(void) {
	int a,b; cin >> a >> b;
	int ans = max(a+b,a-b);
	ans = max(ans,a*b);
	out(ans);
}




Measured memory_bytes: 256