akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#include <numeric>
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

ll mod = 1e9 + 7;
ll dp[1010101],sum[1010101];
ll n;

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

	cin >> n;
	dp[n] = n;
	sum[n] = n;

	for (int i = n - 1; i >= 1; i--) {
		ll tmp = (i <= n - 3) ? (i + 1) : n - 1;
		dp[i] = dp[i+1] + sum[i+3] + (n-1LL)*(n-1LL) + tmp;
		dp[i] %= mod;
		sum[i] = sum[i + 1] + dp[i];
		sum[i] %= mod;
	}
	puts(dp[1] % mod);

	return 0;
}

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

int main(){
	int N;
	cin >> N;
	int A[N], B[N];
	for(int i=0;i<N;i++){
		cin >> A[i];
		B[A[i] - 1] = i + 1;
	}
	for(int i=0;i<N;i++){
		cout << B[i];
		if(i != N-1)cout << " ";
	}
	cout << endl;
}

Measured memory_bytes: 4200
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

int main()
{
	int N;
	ll A[100010];
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	sort(A, A + N);
	int ans = N;
	ll size = A[0];
	int count = 1;
	for (int i = 1; i < N; i++) {
		if (size * 2 < A[i]) {
			ans -= count;
			count = 1;
		}
		else {
			count++;
		}
		//cout << size << " " << A[i] << " " << ans << endl;
		size += A[i];
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define umap unordered_map
#define flush fflush(stdout)
#define all(v) v.begin(),v.end()
#define st first
#define nd second
#define ln '\n'
#define MAX 1000000009
#define MOD 1000000007
#define N 3005
using namespace std;
typedef long long ll;
typedef pair<int ,int > pii;
int n;
double d, dp[N][N];
vector <double> v;
double DP(int now, int sum){
    if(dp[now][sum] != -1){
        return dp[now][sum];
    }
    if(sum  > v.size() / 2){
        return dp[now][sum] = 1;
    }
    if(now == v.size() - 1){
        if(sum == v.size() / 2){
            return dp[now][sum] = (double)v[now];
        }
        return dp[now][sum] = 0;
    }
    return dp[now][sum] = (double)((double)DP(now + 1, sum + 1) * v[now] + (double)((double)1 - v[now]) * DP(now + 1, sum));
}
int main(){
    #ifndef ONLINE_JUDGE
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    #endif
    for(int i = 0; i < N ;i++   ){
        for(int j = 0; j < N; j++){
            dp[i][j] = (double)-1;
        }
    }
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    cin >> n;
    while(n--){
        cin >> d;
        v.pb(d);
    }

    cout <<setprecision(12) <<  DP(0, 0) << ln;
}

Measured memory_bytes: 71040
import sys
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    m = a[-1]+1
    ava = [0]*m
    for rep in a:
        ava[rep] += 1
        if ava[rep]==1:
            for item in range(2*rep,m,rep):
                ava[item] += 2

    print(ava.count(1))
    return

if __name__=='__main__':
    n = I()
    a = list(IL())
    a.sort()
    solve()

Measured memory_bytes: 32116
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        mut d: [usize; n],
    }

    d.sort();

    println!("{}", d[n/2]-d[n/2-1]);

}

Measured memory_bytes: 4352
#include "bits/stdc++.h"
#define LF '\n'
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() { cin.tie(nullptr); ios_base::sync_with_stdio(false); }
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
template<class Itr> void dump(Itr begin, Itr end) { for (;begin != end; ++begin) clog << *begin << LF; }

signed main()
{
  int x, a,b;
  cin >> x >> a >> b;
  x -= a;
  x -= x/b * b;

  cout << x << endl;

  return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {
		long[][] memo;
		int N, C;
		int[][] d,c;
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			N = in.nextInt(); C = in.nextInt();
			d = new int[C][C];
			c = new int[N][N];

			for (int i = 0; i < C; i++) {
				for (int j = 0; j < C; j++) {
					d[i][j] = in.nextInt();
				}
			}

			for (int i = 0; i < N; i++) {
				for (int j = 0; j < N; j++) {
					c[i][j] = in.nextInt();
				}
			}

			memo = new long[3][C+1];
			for (int i = 0; i < 3; i++) {
				Arrays.fill(memo[i], -1);
			}

			long ans = Long.MAX_VALUE/2;
			for (int i = 1; i <= C; i++) {
				for (int j = 1; j <= C; j++) {
					for (int k = 1; k <= C; k++) {
						if (i == j || j == k || k == i) {
							continue;
						}
						ans = Math.min(ans, dfs(0, i) + dfs(1, j) + dfs(2, k));
					}
				}
			}

			out.println(ans);

		}

		long dfs(int mod, int to) {

			if (memo[mod][to] > 0) {
				return memo[mod][to];
			}

			int ret = 0;
			for (int i = 0; i < N; i++) {
				for (int j = 0; j < N; j++) {
					if ((i+1 + j+1) % 3 == mod) {
						ret += d[c[i][j]-1][to-1];
					}
				}
			}

			return memo[mod][to] = ret;
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 47340
c=[0 for i in range(10000)]

for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      n=x*x+y*y+z*z+z*y+y*x+x*z
      if n<=10000:
        c[n-1]+=1
print("\n".join(list(map(str,c))[:int(input())]))


Measured memory_bytes: 73944
#include <stdio.h>

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

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


    int alice=0, bob=0, count=0, flag=1;

    i = 100;
    while(i>0) {
        for(j=0; j<num[i]; j++) {
            // printf("%d\n", i);
            if(flag) {
                alice += i;
                flag = 0;
            } else {
                bob += i;
                flag = 1;
            }
        }
        i -= 1;
    }

    printf("%d\n", alice-bob);

    return 0;
}

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

int main()
{
	int D;
	cin >> D;
	switch (D)
	{
	case 25:
		cout << "Christmas";
			break;
	case 24:
		cout << "Christmas Eve";
		break;
	case 23:
		cout << "Christmas Eve Eve";
		break;
	case 22:
		cout << "Christmas Eve Eve Eve";
		break;
	default:
		break;
	}
}

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

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
  #define cerrendl 42
#endif
//}}}

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

  map<pii, int> d;
  rep(x, 1, n+1){
    string s = to_string(x);
    int m = sz(s);
    d[mp(s[0]-'0', s[m-1]-'0')]++;
  }
  dump(d);

  int ans = 0;
  each(el, d){
    int x = el.first.first;
    int y = el.first.second;
    int c = el.second;

    if (x==0 || y==0) continue;
  
    if (x==y){
      ans += c*c;
    }
    else{
      int c2 = d[mp(y, x)];
      ans += c*c2;
    }
    dump(x, y, ans);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <map>
#include <vector>
using namespace std;

const int N = 2e5 + 5;
int pa1[N], pa2[N];
int find(int* p, int v) { return v == p[v] ? v : p[v] = find(p, p[v]); }
void unite(int* p, int a, int b) { p[find(p, b)] = find(p, a); }

typedef long long LL;
int n, k, l;
// vector<int> e1[N], e2[N];

map<LL, int> mp;

int main() {
#ifdef D
    freopen("a.in", "r", stdin);
#endif
    for (int i = 0; i < N; i++) {
        pa1[i] = pa2[i] = i;
    }
    scanf("%d%d%d", &n, &k, &l);
    for (int i = 0; i < k; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        unite(pa1, a, b);
        // e1[a].push_back(b);
        // e1[b].push_back(a);
    }
    for (int i = 0; i < l; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        unite(pa2, a, b);
        // e2[a].push_back(b);
        // e2[b].push_back(a);
    }

    for (int i = 1; i <= n; i++) {
        mp[find(pa1, i) * (LL)(n + 1) + find(pa2, i)] += 1;
    }

    for (int i = 1; i <= n; i++) {
        printf("%d ", mp[find(pa1, i) * (LL)(n + 1) + find(pa2, i)]);
    }
    puts("");

    return 0;
}


Measured memory_bytes: 13696
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

vector<pair<int, int>> primeFact(int n) {
  vector<pair<int, int>> res;
  for (int i = 2; i * i <= n; i++) {
    int divcnt = 0;
    if (n % i == 0) {
      do {
        divcnt++;
        n /= i;
      } while (n % i == 0);
      res.emplace_back(i, divcnt);
    }
  }
  if (n != 1)
    res.emplace_back(n, 1);
  return res;
}

int calc(int a,int b){
  if(b == 0) return 1;
  if(b%2 == 0){
    int d = calc(a,b/2);
    return (d*d)%MOD;
  }
  return (a*calc(a,b-1))%MOD;
}

int comb(int n,int r){
  int tmp = 1,ttmp = 1;
  for(int i = n;i >= n-r+1;i--) tmp = (tmp*i)%MOD;
  for(int i = 1;i <= r;i++) ttmp = (ttmp*i)%MOD;
  return (tmp*calc(ttmp,MOD-2))%MOD;
}

signed main() {
  int N, M; 
  cin >> N >> M;

  auto p = primeFact(M);
  
  int ans = 1;
  for(auto v : p){
    (ans *= comb(N+v.second-1, v.second)) %= MOD;
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <cstdio>
#include <string.h>

using namespace std;

int main()
{
    int n,i,s=0;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        s^=a[i];
    }
    for(i=0;i<n;i++)
        cout<<(s^a[i])<<" ";

    return 0;
}

Measured memory_bytes: 4308
#include<iostream>
using namespace std;
int main ()
{ 
	int n;
	cin>>n;
	if(n==1||n==2||n==3||n==5||n==7||n==11||n==13||n==15||n==17||n==19||n==23||n==29||n==31)
		cout<<"1";
	else if(n==4||n==6||n==9||n==10||n==14||n==21||n==22||n==26||n==25)
		cout<<"2";
	else if(n==28||n==30)
		cout<<"4";
	else if(n==27||n==18||n==20||n==12||n==8)
		cout<<"5";
	else if(n==16)
		cout<<"14";
	else if(n==24)
		cout<<"15";
	else
		cout<<"51";
	return 0;
} 

Measured memory_bytes: 256
def div_two(x):
    tmp = 0
    cur = x
    while cur % 2 == 0:
        tmp += 1
        cur = cur // 2
    return tmp


n = int(input())
A = list(map(int, input().split()))

ans = 0

for i in range(n):
    ans += div_two(A[i])

print(ans)


Measured memory_bytes: 4148
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;


int main(){
    int n;
    cin >> n;
    map<int, int> m;

    bool ok = true;
    rep(i, n){
        int x;
        cin >> x;
        if(m.count(x)) ok = false;
        else m[x] = 1;
    }
    
    if(ok) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 9600
import java.util.*;
import java.lang.Double;

public class Main {

    public static void main(String[] args) {
      Scanner reader=new Scanner(System.in);
      int  x=reader.nextInt();
      for(int i=-120;i<120;i++)
      {
        for(int m=-120;m<120;m++)
        {
            long w =(long)Math.pow(i,5);
            long r =(long)Math.pow(m,5);
            //powを使おう部k城は
          if((w-r)==x)
          {

            System.out.println(i+" "+m);
            return;
          }
        }
      }
    }}

Measured memory_bytes: 38628
using System;
using System.Collections.Generic;
using System.Linq;
using static Scanner;

class Program
{
    static void Main() => new Program().Solve();

    public void Solve()
    {
        int h = ReadInt();
        int w = ReadInt();
        int k = ReadInt();
        string[] c = Read(h).ToArray();
        int ans = 0;
        for (int a = 0; a < (1 << h); a++)
        {
            for (int b = 0; b < (1 << w); b++)
            {
                int count = 0;
                for (int i = 0; i < h; i++)
                {
                    for (int j = 0; j < w; j++)
                    {
                        if ((a & (1 << i)) != 0) continue;
                        if ((b & (1 << j)) != 0) continue;
                        if (c[i][j] == '.') continue;
                        count++;
                    }
                }
                if (count == k) ans++;
            }
        }
        Console.WriteLine(ans);
    }
}

static class Scanner
{
    static Queue<string> que = new Queue<string>();
    public static string Read() { if (!que.Any()) foreach (var s in Console.ReadLine().Split()) que.Enqueue(s); return que.Dequeue(); }
    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());
    public static decimal ReadDecimal() => decimal.Parse(Read());
    public static IEnumerable<string> Read(long n) { for (long i = 0; i < n; i++) yield return Read(); }
    public static IEnumerable<int> ReadInt(long n) => Read(n).Select(int.Parse);
    public static IEnumerable<long> ReadLong(long n) => Read(n).Select(long.Parse);
    public static IEnumerable<double> ReadDouble(long n) => Read(n).Select(double.Parse);
    public static IEnumerable<decimal> ReadDecimal(long n) => Read(n).Select(decimal.Parse);
}


Measured memory_bytes: 28368
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
//typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef pair<ll, pair<int, int>> P;
typedef pair<ll,pair<ll,ll>> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
int INFM =100000000;
ll MOD  = 1000000007;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};


int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
        A.at(i) -= i + 1;
    }
    
    sort(A.begin(), A.end());
    int mid = N / 2;
    ll res1 = 0;
    for(int i = 0; i < N; i++){
        res1 += abs(A.at(i) - A.at(mid));
    }
    mid = N / 2 - 1;
    if(mid < 0){
        mid = 0;
    }
    ll res2 = 0;
    for(int i = 0; i < N; i++){
        res2 += abs(A.at(i) - A.at(mid));
    }
    cout << min(res1, res2) << endl;
    
}


Measured memory_bytes: 1792
n = int(input())
a_list =[int(x) for x in input().split()]
mod = 10**9 + 7

s_list = [0]*(n+1)
for i,a in enumerate(a_list):
    s_list[i+1] = s_list[i]+a


ans = 0
for i,a in enumerate(a_list):
    ans += a * (s_list[n]-s_list[i+1])
    
print(ans%mod)

Measured memory_bytes: 31568
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;
void Main()
{
    ll n;
    cin >> n;
    vector<ll> a(3 * n);
    rep(i, 3 * n) cin >> a[i];
    
    vector<ll> L(3 * n);
    priority_queue<ll, vector<ll>, greater<ll>> que;

    ll sum = 0;
    rep(i, a.size()) {
        que.push(a[i]);
        sum += a[i];
        if (que.size() > n) {
            ll v = que.top(); // minimum
            sum -= v;
            que.pop();
        }
        L[i] = sum;
    }
    
    vector<ll> R(3 * n);
    priority_queue<ll, vector<ll>, less<ll>> queR;

    sum = 0;
    for (int i = a.size() - 1; i >= 0; i--) {
        queR.push(a[i]);
        sum += a[i];
        if (queR.size() > n) {
            ll v = queR.top(); // maxmam
            sum -= v;
            queR.pop();
        }
        R[i] = sum;
    }

    ll res = -1e18;
    for (int i = n-1; i < 2 * n; i++) {
        ll score = L[i] - R[i+1];
        res = max(res, score);
    }

    put(res);
    
}
signed main(){ Main();return 0;}

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

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

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n, h, w;
    scanf("%d %d %d", &n, &h, &w);
    int ans = 0;
    int a, b;
    for (int i = 0; i < n; i++)
    {
        scanf("%d %d", &a, &b);
        if (a >= h && b >= w)
            ans++;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define popcnt(x) __builtin_popcount(x)
#define popcntll(x) __builtin_popcountll(x)
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class FIntervalRunning {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        vc<lint> T(2), A(2), B(2), L(2);
        REP(i, 2) in>>T[i];
        REP(i, 2) in>>A[i];
        REP(i, 2) in>>B[i];
        L[0] = T[0] * A[0] + T[1] * A[1];
        L[1] = T[0] * B[0] + T[1] * B[1];
        if(L[0]==L[1]){
            out<<"infinity\n";
            return;
        }
        if(L[0]<L[1]){
            swap(A[0], B[0]);
            swap(A[1], B[1]);
            swap(L[0], L[1]);
        }
        if(A[0]>=B[0]){
            out<<"0\n";
            return;
        }
        lint left = 0, right = L[1] / (L[0]-L[1]);
        while(1<right-left){
            lint mid = (left+right) >> 1;
            lint dif = mid * (L[0]-L[1]);
            if(dif<=T[0]*(B[0]-A[0])) left = mid;
            else right = mid;
        }
        lint ans = 2 * left + 1, dif = left * (L[0]-L[1]);
        if(dif==T[0]*(B[0]-A[0])) --ans;
        out<<ans<<'\n';
    }
};


int main() {
	FIntervalRunning solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>
using namespace std;
pair<int,int> a[200005];
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    if(s=="SUN"){
        cout<<7;
        return 0;
    }
    if(s=="MON"){
        cout<<6;
        return 0;
    }
    if(s=="TUE"){
        cout<<5;
        return  0;
    }
    if(s=="WED"){
        cout<<4;
        return 0;
    }
    if(s=="THU"){
        cout<<3;
        return 0;
    }
    if(s=="FRI"){
        cout<<2;
        return 0;
    }
    if(s=="SAT"){
        cout<<1;
        return 0;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <map>
#include <cmath>
#include <bitset>
#include <deque>
#include <queue>
#define INF (1LL<<31)
#define fst first
#define snd second
typedef long long ll;
typedef std::pair<int,int> ii;
using namespace std;

int main(){
  int n,m;
  bool f1[200000]={},fn[200000]={};
  bool flg=false;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    if(a==1)f1[b-1]=true;
    if(b==n)fn[a-1]=true;
  }
  for(int i=0;i<n;i++){
    if(f1[i]&&fn[i]){
      flg=true;
      break;
    }
  }
  cout<<(flg?"POSSIBLE":"IMPOSSIBLE")<<endl;
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define LL long long int
#define s(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define ss(a) scanf("%s",a)
#define w(t) while(t--)
#define f(i,n) for(i=0;i<n;i++)
#define fd(i,n) for(i=n-1;i>=0;i--)
#define p(a) printf("%d",a)
#define pl(a) printf("%lld",a)
#define ps(a) printf("%s",a)
#define pc(a) printf("%c",a)
#define ent printf("\n")
#define mod 1000000007
#define PI 3.14159265
#define gs getline(cin,s)
#define pb push_back
#define mp make_pair
#define INF 1e18

using namespace std;

unordered_map<int,int> pos;
int ar[600005];
int tree[69*300000+5];
int lft[69*300000+5];
int rht[69*300000+5];
int root[1000005];
int rt[500005];
int idx;

inline void build(int node,int start,int end)
{
    if(start==end)
        {
            tree[node]=0;
            return;
        }
        lft[node]=idx++;
        rht[node]=idx++;
        int mid=(start+end)/2;
        build(lft[node],start,mid);
        build(rht[node],mid+1,end);
        tree[node]=0;
}

inline int update(int node,int start,int end,int pos,int val)
{
    int x;
    x=idx++;
    if(start==end)
    {
        tree[x]=val;
        return x;
    }
    lft[x]=lft[node];
    rht[x]=rht[node];
    int mid=(start+end)/2;
    if(pos<=mid)
        lft[x]=update(lft[x],start,mid,pos,val);
    else
        rht[x]=update(rht[x],mid+1,end,pos,val);

    tree[x]=tree[lft[x]]+tree[rht[x]];

    return x;
}

inline int query(int node,int start,int end,int l,int r)
{
    if(start>r || end<l)
        return 0;
    else if(start>=l && end<=r)
        return tree[node];
    int mid=(start+end)/2;
    int q1=query(lft[node],start,mid,l,r);
    int q2=query(rht[node],mid+1,end,l,r);

    return (q1+q2);
}


int main()
{
    std:ios_base::sync_with_stdio(false);cin.tie(0);
    int n;
    s(n);
    int m;
    s(m);
    int i;

      idx=0;
       root[0]=0;
        build(0,1,n);

    int t=1;
    for(i=1;i<=n;i++)
    {
        s(ar[i]);
        int k=pos[ar[i]];
        if(k!=0)
        {
            root[t]=update(root[t-1],1,n,k,0);
            t++;
            root[t]=update(root[t-1],1,n,i,1);
            t++;
        }
        else
        {
            root[t]=update(root[t-1],1,n,i,1);
            t++;
        }

        rt[i]=t-1;
        pos[ar[i]]=i;
    }



    while(m--)
    {
        int a,b;
        s(a);
        s(b);

        p(query(root[rt[b]],1,n,a,b));
        ent;
    }

 return 0;

}


Measured memory_bytes: 254188
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(n) for(ll i=0; i<n; i++)
ll MOD = 1000000007;

vector<int> bin_ex(ll x)
{
  vector<int> v;
  for (size_t i = 0; i < 60; i++)
  {
    v.push_back(x&1);
    x = x>>1;
  }
  return v;
}

int main()
{
  ll n,tmp;
  cin >> n;
  vector<vector<int> > A(n);
  rep(n)
  {
    cin >> tmp;
    A[i] = bin_ex(tmp);
  }

  tmp = 0;
  ll cur = 1;
  ll one = 0;

  for (int j = 0; j < 60; j++)
  {
    one = 0;
    for (int i = 0; i < n; i++)
    {
      if(A[i][j]==1) one++;
    }
    one = (one * (n-one)) % MOD;
    one = (cur * one) % MOD;
    tmp = (tmp + one)%MOD;
    cur = (cur*2)%MOD;
  }

  cout << tmp << endl; 

  return 0;
}

Measured memory_bytes: 82304
#include <bits/stdc++.h>
using namespace std;
#define oo 1000000010
#define mod 1000000007
const int N = 300010;
int n , m , u , v , num[N];
bool can[N];
int main(){
	scanf("%d%d",&n,&m);
	can[1] = true;
	for(int i = 1;i <= n;i++)
		num[i] = 1;
	for(int i = 0 ;i < m;i++){
		scanf("%d%d",&u,&v);
		num[u]--;
		num[v]++;
		if(can[u]) can[v] = true;
		if(num[u] == 0)
			can[u] = 0;
	}
	int ans = 0;
	for(int i = 1;i<= n;i++)
		ans += can[i];
	cout << ans << endl;
    return 0;
} 

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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

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

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;


/*************************************************************************/
ll ans=0;
int main()
{
    ios_base::sync_with_stdio(0);

    int n;
    cin >> n;

    VVI tab(n, VI(n));
    FOR(i,0,n-1) FOR(j,0,n-1)
    {
        cin >> tab[i][j];
        ans+=tab[i][j];
    }

    FOR(i,0,n-1) FOR(j,0,n-1) FOR(k,0,n-1)
    {
        if (tab[i][k] > tab[i][j] + tab[j][k])
        {
            cout << -1;
            return 0;
        }
    }

    ll total = 0;
    FOR(i,0,n-1) FOR(k,0,n-1)
    {
        bool found = false;

        FOR(j,0,n-1) if (j != i && j != k && tab[i][k] == tab[i][j] + tab[j][k])
        {
            found = true;
            //break;
        }

        if (found)
        {
            total += tab[i][k];
        }
    }

    cout << ans/2-total / 2;

    return 0;
}

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

int main(void)
{
    int r, g, b;
    string s;
    cin >> r >> g >> b;

    if ((r*100 + g*10 + b) % 4 == 0)
    {
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    
using namespace std;
    
bool median(vector<int> *A, int length, int *ans) {
    sort((*A).begin(), (*A).end());
    if(length % 2 == 0) {
        *ans = ((*A)[length / 2] + (*A)[length / 2 - 1]) / 2.0;
        return false;
    }
    else {
        *ans = (*A)[length / 2];
        return true;
    }
}

int main() {
    int N, cnd, med;
    long long int ans1 = 0, ans2 = 0;

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

    if(!median(&A, N, &med)) {
        for(int i = 0; i < N; i++) {
            ans1 += abs(A[i] - med);
            ans2 += abs(A[i] - med - 1);
        }
        if(ans1 > ans2) {
            ans1 = ans2;
        }
    }
    else {
        for(int i = 0; i < N; i++) {
            ans1 += abs(A[i] - med);
        }
    }

    printf("%lld\n", ans1);

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1001001001;
constexpr long long INFL = (1LL<<60);
constexpr double eps = (1e-9);

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

  int n;
  cin >> n;
  vector<int> a(n), ans(n, 0);
  rep(i, n) cin >> a[i];

  for (int i = 1; i < n; i++) {
    ans[0] = (ans[0] ^ a[i]);
  }

  for (int i = 1; i < n; i++) {
    ans[i] = ans[0] ^ (a[0] ^ a[i]);
  }

  rep(i, n) printf("%d%c", ans[i], i == n-1 ? '\n' : ' ');

  return 0;
}


Measured memory_bytes: 4692
def abc058_c():
    from collections import Counter
    n = int(input())
    s = [list(input()) for _ in range(n)]
    s_count = [Counter(s[i]) for i in range(n)]
    ans_dict = {}
    for i in range(ord("a"), ord("z")+1):
        ans_dict[chr(i)] = 50
    for i in range(n):
        for let in ans_dict:
            ans_dict[let] = min(ans_dict[let], s_count[i][let])
    ans = []
    for let in ans_dict:
        ans += ([let] * ans_dict[let])
    print("".join(sorted(ans)))


abc058_c()

Measured memory_bytes: 3436
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=2e5+10;
struct node{
    ll s,t,x;
    ll l,r;
}block[maxn];
bool cmp(node a,node b){
    return a.l==b.l?a.r<b.r:a.l<b.l;
}
bool operator < (node a,node b){return a.x>b.x;}
priority_queue<node>Q;
ll ans[maxn];
ll query[maxn];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,q;
    cin>>n>>q;
    for(ll i=1;i<=n;++i){
        cin>>block[i].s>>block[i].t>>block[i].x;
        block[i].l=block[i].x-block[i].t+1;
        block[i].r=block[i].x-block[i].s;
    }
    sort(block+1,block+n+1,cmp);
//    for(ll i=1;i<=n;++i){
//        cout<<block[i].l<<" "<<block[i].r<<endl;
//    }
    for(ll i=1;i<=q;++i){
        cin>>query[i];
        query[i]*=-1;
    }
    sort(query+1,query+q+1);
    ll qpos;
    ll k,bpos=1;
    for(qpos=1;qpos<=q;++qpos){
//        cout<<query[qpos]<<endl;
        int f=0;
//        cout<<query[qpos].n<<" "<<block[bpos+1].l<<" "<<block[bpos+1].r<<endl;
        while(query[qpos]>=block[bpos].l&&bpos<=n){
                Q.push(block[bpos]);
                bpos++;
        }
        if(Q.empty()){
            ans[qpos]=-1;
            continue;
        }
        while(!Q.empty()){
            node now=Q.top();
            if(now.r<query[qpos]){
                Q.pop();
                continue;
            }
            f=1;
            ans[qpos]=now.x;
            break;
        }
        if(!f)ans[qpos]=-1;
//        if(query[qpos]>=block[bpos].l&&query[qpos]<=block[bpos].r){
//            ans[qpos]=block[bpos].x;
//            qpos++;
//        }
//        else if(query[qpos]>block[bpos].r){
//            bpos++;
//        }
//        else {
//            ans[qpos]=-1;
//            qpos++;
//        }
    }
    for(ll i=q;i>=1;--i)
        cout<<ans[i]<<endl;
}


Measured memory_bytes: 21996
#include <iostream>
#include <array>


constexpr size_t Max = 2 * 1e+5;


// void array_print(const std::array<size_t, Max + 1>& raw, size_t first, size_t last)
// {
//     std::cout << "######debug-print#####" << std::endl;
//     for(size_t i = first; i < last; i++)
//     {
//         std::cout << raw.at(i) << std::endl;
//     }
//     std::cout << "######################" << std::endl;
// }


int main()
{
    size_t N;
    std::cin >> N;
    std::array<size_t, Max + 1> box = {};
    std::array<size_t, Max + 1> store = {};

    size_t max_num = -1;
    for(size_t i = 0; i < N; i++)
    {
        size_t num;
        std::cin >> num;

        box.at(num) += 1;
        store.at(i) = num;
        if(max_num < num)
        {
            max_num = num;
        }
    }
    
    // array_print(box, 0, N + 1);
    // array_print(store, 0, N + 1);

    size_t combs = 0;
    for(size_t i = 0; i <= N; i++)
    {
        combs += box[i] * (box[i] - 1) / 2;
    }
    //std::cout << "<debug>: combs = " << combs << std::endl;

    for(size_t k = 0; k < N; ++k)
    {
        if(box[store[k]] == 0) continue;

        std::cout << combs - (box[store[k]] - 1) << std::endl;
    }

}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000000+7;
const long long INF=-mod;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
//ショートカット
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,k,n) for(int i=k;i<n;i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
//入力
#define vin(v,N) for(long long i=0;i<N;i++) cin>>v.at(i)
#define lin(n) long long n;cin>>n
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

#define max(a,b) max((ll)a,(ll)b)
#define min(a,b) min((ll)a,(ll)b)

//関数
//最大公約数
long long gcd(long long m, long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m, long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x, long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//nCr
long long Comb (long long n, long long r);
//nCr (mod)
long long modC(long long n, long long r) {
    vector<long long> f(n+1),inv(n+1),invf(n+1);
    f[0]=f[1]=1;
    invf[0]=invf[1]=1;
    inv[1]=1;
    for (long long i=2;i<n+1;i++) {
        f[i]=(i*f[i-1])%mod;
        inv[i]=mod-((mod/i)*inv[mod%i])%mod;
        invf[i]=(inv[i]*invf[i-1])%mod;
    }
    long long cmb=f[n]*(invf[r]*invf[n-r]%mod)%mod;
    if (n>=r) return cmb;
    else return 0;
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(10);
  
  lin(d);lin(b);lin(c);
  
  ll A=abs(d-b); ll B=abs(b-c); ll C=abs(c-d);
  
  vl a(3);a[0]=A;a[1]=B;a[2]=C;
  
  sort(all(a));
  
  if(a[0]==0 && a[1]!=0 && a[2]!=0) cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 256
/////////////////////////   _LeMur_
#define _CRT_SECURE_NO_WARNINGS
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <chrono>
#include <random>
#include <bitset>
#include <cstdio>
#include <vector>
#include <string>
#include <ctime>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <list>
#include <map>
#include <set>

using namespace std;

const int N = 200005;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;

int n;
string s;

int pref[N];

int main() {
	mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count());
	cin >> n >> s;
	for(int i=0;i<n;i++){
        pref[i] = (s[i] == '#');
        if(i) pref[i] += pref[i - 1];
	}
	int answ = n - pref[n - 1];
	for(int i=0;i<n;i++){
        answ = min(answ , pref[i] + n - i - 1 - pref[n - 1] + pref[i]);
	}
	cout << answ << endl;
	return 0;
}


Measured memory_bytes: 1412
N, M, K = map(int,input().split())

A = list(map(int,input().split()))
A.insert(0, 0)
B = list(map(int,input().split()))
a = []
b = []

def nibun(L,l,r,target):

  wrk = -(-(l+r)//2)
  
#  print(l,r,target,wrk)
  
  if r == l:
    if r == len(L):
      return 0
    else:
      return wrk + 1
  
  if l == (len(L)-1):
    if L[wrk-1] > target:
      return wrk
    else:
      return 0

  if L[wrk] == target:
    return wrk+1

  elif L[wrk] > target:
    return nibun(L,l,wrk-1,target)

  else:
    return nibun(L,wrk,r,target)

  
s = 0
for i,e in enumerate(B):
  s += e 
  b.append(s)

s = 0
ans = 0
for i in range(len(A)):
#  print(i,'kaime')
#  print(s,i,A[i])
  s += A[i]
  if s > K:
    break
  else:  
    wrk = nibun(b,-1,len(b),K-s)
    
    ans=max(ans,i+wrk)
#    print('koko',s,wrk,ans)

print(ans)

Measured memory_bytes: 41020
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  ll n, m;
  cin >> n >> m;
  ll g = __gcd(n, m);
  ll l = n/g*m;
  string s, t;
  cin >> s >> t;
  for(ll i = 0; ; i++){
    ll ns = i*(l/m), nt = i*(l/n);
    if(ns >= n || nt >= m) break;
    if(s.at(ns) != t.at(nt)){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << l << endl;
  return 0;
}

Measured memory_bytes: 512
s = input()
q = int(input())
f = []
b = []
h = 0

for i in range(q):
    a = list(input().split())
    if a[0] == "1":
        f, b = b, f
        h = 1 - h
    elif len(a) >= 3:
        if a[1] == "1":
            f.append(a[2])
        elif a[1] == "2":
            b.append(a[2])

if h == 0:
    print("".join(f[::-1]) + s + "".join(b))
else:
    print("".join(f[::-1]) + s[::-1] + "".join(b))

Measured memory_bytes: 6252
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(b - a == c - b) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 25556
#include<iostream>
#include<cstdio>
using namespace std;
int n,d,x,a,s; 
int main()
{
	cin>>n;
	cin>>d>>x;
	s+=x;
	for(int i=1;i<=n;i++)
	{
	cin>>a;
	s+=1;
	 for(int i=1;;i++)
	 {
	  if(a*i+1<=d)s++;
	  else break;	
	 }
	}
	cout<<s;
	return 0;
} 

Measured memory_bytes: 256
using System;

namespace AtCoder3
{
    class Program
    {
        static void Main(string[] args)
        {
            //125
            string[] x = Console.ReadLine().Split(' ');
            double A = int.Parse(x[0]);
            double B = int.Parse(x[1]);
            double T = int.Parse(x[2]);

            double val = Math.Floor(T / A);
            double c = val * B;
            Console.WriteLine(c);
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  vector<int>h(n);
  int mh=0;
  int cnt=0;
  rep(i,n){cin>>h[i];cnt+=chmax(mh,h[i]);}
  cout<<cnt<<endl;

  return 0;

}


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

int n, a[MAXN], aSorted[MAXN];
int aBits[MAXN], aBitsSp[MAXN], af[MAXN], aib[MAXN], ord[MAXN];

int queryAib(int pos) {
    int ans = 0;
    while (pos > 0) {
        ans += aib[pos];
        pos -= (pos & (-pos));
    }

    return ans;
}

int updateAib(int pos, int val) {
    while (pos < MAXN) {
        aib[pos] += val;
        pos += (pos & (-pos));
    }
}

long long countLowerEqual(int val) {
    ord[0] = 0;
    for (int i = 1; i <= n; ++i) {
        aBits[i] = ((a[i] <= val) ? 0 : 1);
        aBitsSp[i] = aBitsSp[i - 1] + aBits[i];
        af[i] = 2 * aBitsSp[i] - i;
        ord[i] = i;
    }

    sort(ord, ord + n + 1, [&](int x, int y) {
        return af[x] > af[y];
    });
    memset(aib, 0, sizeof(aib));
    
    long long ans = 0;
    for (int i = 0; i <= n; ) {
        int j;
        for (j = i; j <= n && af[ord[j]] == af[ord[i]]; ++j);

        for (int k = i; k < j; ++k)
            ans += queryAib(ord[k]);
        for (int k = i; k < j; ++k)
            updateAib(ord[k] + 1, 1);
        i = j;
    }

    return ans;
}

int main() {
    ios::sync_with_stdio(0);

    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        aSorted[i] = a[i];
    }
    sort(aSorted + 1, aSorted + n + 1);

    const long long target = 1LL * n * (n + 1) / 4 + 1;
    int left = 1, right = n, mid, sol;
    while (left <= right) {
        mid = (left + right) >> 1;
        if (countLowerEqual(aSorted[mid]) >= target) {
            sol = mid;
            right = mid - 1;
        }
        else
            left = mid + 1;
    }
    cout << aSorted[sol] << "\n";

    return 0;
}

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

int main(){
    int x[10000];
    
    for(int i = 0 ; i < 10000 ; i++){
        cin >> x[i];
        if(x == 0) break;
        cout << "Case " << i + 1 << ": " << x[i] << endl;
    }
    
    return 0;
}


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

using namespace std;



void solver() {
	int N; cin >> N;
	int money = 1000;
	while(money < N)
		money += 1000;
	cout << money - N << '\n';
}

int main() {

	ios_base :: sync_with_stdio(0); cin.tie(NULL);

	int t;
	//cin >> t;
	t = 1;

	while(t--)
		solver();

	return 0;
}


Measured memory_bytes: 3544