akhauriyash/Code-Regression huggingface dataset:
//Abhinav ---IIIT_A
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define f(i,x,n) for(int i=x;i<(int)n;++i)
#define vpii vector<pair<int,int>>
#define vi vector<int>
#define mpii map<pair<int,int>,int>
#define mpivpii map<int,vector<pair<int,int>>>
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define mpi map<int,int>
#define vvi vector<vector<int>>
#define vvvi vector<vvi>
ld pie=3.141592653589;
int mod=1e9+7;

bool Compare(int a, int b)
{
   return a < b;
}
std::priority_queue<int, std::vector<int>, std::function<bool(int, int)>> pq(Compare);

vi pr;
void seive(){
	int p[100005]={0};
	f(i,2,100005){
		if(p[i]==0){
			pr.pb(i);
			for(int j=i*2;j<100005;j+=i) p[j]=1;
		}
	}
}


void solve(){
	int a,b,c,d,k; cin>>a>>b>>c>>d>>k;
	int h=(c-a)*60 + (d-b);
	cout<<h-k;
}


int32_t main(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
  int t=1; //cin>>t;
  while(t--) solve();
  return 0;
}
// check for overflows dummy !!!

Measured memory_bytes: 3648
object Main extends App {
  
  val sc = new java.util.Scanner(System.in) 
  val N = sc.nextInt()
  val a = Array.fill(N)(sc.nextLong())
  println(calc(a, 0))
  
  def calc(a: Array[Long], acc: Int): Int = {
    if (a.forall(x => x % 2 == 0)) {
      calc(a.map(x => x / 2), acc+1)
    } else {
      acc
    }
  }
}

Measured memory_bytes: 55524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

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

    ll a = 1, b = 1, c = 1;

    zep(i, 0, n){
        a *= 10; a %= MOD;
        b *= 9; b %= MOD;
        c *= 8; c %= MOD;
    }

    print((a + (MOD - 2 * b % MOD) + c) % MOD)
    
    return 0;
}

Measured memory_bytes: 3644
#!/usr/bin/env python3
import sys
import math


def solve(N: int, K: int):
    candidate = 0
    if K % 2 == 0:
        candidate = math.floor(N / (K//2))
        evenCandidate = math.floor(candidate / 2)
        oddCandidate = candidate - evenCandidate
        print(evenCandidate ** 3 + oddCandidate**3)
    else:
        candidate = math.floor(N/K)
        print(candidate**3)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import numpy as np

N, D = map(int, input().split())
X = [list(map(int, input().split())) for i in range(N)]

count = 0

for i in range(N-1):
    for j in range(i+1, N):
        dist = np.linalg.norm(np.array(X[i]) - np.array(X[j]))
        if dist % 1 == 0:
            count += 1

print(count)


Measured memory_bytes: 12496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N;
    cin >> N;
    vector<int> P(N);
    vector<int> Q(N);
    vector<int> R(N);
    rep(i,N) cin >> P[i];
    rep(i,N) cin >> Q[i];
    rep(i,N) R[i] = i+1;
    bool Pflg = false;
    bool Qflg = false;
    int Pcnt = 0;
    int Qcnt = 0;
    do{
        if(!Pflg)Pcnt++;
        if(!Qflg)Qcnt++;
        rep(i,N){
            if(P[i]!=R[i]){
                break;
            }
            if(i==N-1&&P[i]==R[i]){
                Pflg = true;
            }
        }
        rep(i,N){
            if(Q[i]!=R[i]){
                break;
            }
            if(i==N-1&&Q[i]==R[i]){
                Qflg = true;
            }
        }
    }while(next_permutation(R.begin(),R.end()));
    int ans = abs(Pcnt - Qcnt);
    cout << ans << endl;
    return 0;
}

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

int main()
{
	int N;
	cin >> N;
	vector<int> P( N );
	for( int i = 0; i < N; i++ ) {
		cin >> P[i];
	}

	int mi = P[0];
	int ans = 1;
	for( int i = 1; i < N; i++ ) {
		if( P[i] <= mi ) {
			mi = P[i];
			ans++;
		}
	}

	cout << ans << endl;
}


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

#define fi first
#define se second
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define FOR(i, a, b) for (int i = a; i <= (b); i++)
#define ROF(i, a, b) for (int i = a; i >= (b); i--)

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<ll>; using vvll = vector<vll>;

const ll MOD = 998244353;
ll fac[200005];

ll bm(ll b, ll p) {
    ll rt = 1;
    for (ll i = 1, j = b; i <= p; i <<= 1, j = j * j % MOD)
        if (i & p) rt = rt * j % MOD;
    return rt;
}

ll ncr(ll n, ll r) {
    return fac[n] * bm(fac[r] * fac[n - r] % MOD, MOD - 2) % MOD;
}

int main() {
    ll n, m, k; cin >> n >> m >> k;
    fac[0] = 1;
    FOR(i, 1, n)
        fac[i] = fac[i - 1] * i % MOD;
    ll ans = 0;
    FOR(i, 0, k) {
        ans = (ans + (ncr(n - 1, i) * m) % MOD * bm(m - 1, n - i - 1)) % MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 5140
#include <iostream>

using namespace std;

bool search(int s[], int n, int t) {
    int i = 0;
    s[n] = t;
    while (s[i] != t) ++i;

    if (i == n) return false;

    return true;
}

int
main(int argc, const char *argv[])
{
    int n, q;
    int S[10000];
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> S[i];
    
    cin >> q;
    int count = 0;
    for (int i = 0; i < q; ++i) {
        int t;
        cin >> t;
        if (search(S, n, t)) ++count;
    }
    cout << count << endl;

    return 0;
}

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

const int N = 5e5+15;
const int mod = 1e9+7;
const int M = (1<<22);
int A[N];

int numberOfZero[M];
int dx[M],totalDx[M];

int add(int x,int y){
   return (x+y)%mod;
}
int mul(int x,int y) {
   return (ll)x*y%mod;
}
void solve() {
   int n;
   scanf("%d",&n);
   for(int i=0;i<n;++i) {
      scanf("%d",&A[i]);
   }
   totalDx[0] = 1;
   int g = 0,ret=0, totalZero=0,lastDp = 0;
   for(int i=0;i<n;++i) {
      g^= A[i];
      if(i==n-1 && g==0) {
         ret = add(ret,1);
         break;
      }
      if(g==0) {
         ret = add(ret, totalDx[0]);
         totalDx[0] = add(totalDx[0],totalDx[0]);
         ++totalZero;
      } else {
         int diff = totalZero - numberOfZero[g];
         numberOfZero[g] = totalZero;
         int addVal = mul(diff, dx[g]);
         totalDx[g] = add(totalDx[g],addVal);
         lastDp = add(totalDx[g],1);
         ret = add(ret, lastDp);
         dx[g] = add(dx[g],lastDp);
      }
   }
   if(g==0) {
      printf("%d\n", ret);
   } else {
      printf("%d\n", lastDp);
   }
}
int main()
{
    //freopen("input.txt","r",stdin);
    solve();
}


Measured memory_bytes: 20608
#include<iostream>
using namespace std;
typedef pair<int, int> pii;
pii dxdy[]={{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
char fld[21][21];
bool used[20][20];
int W, H;

int rec(int i, int j){

   if(fld[i][j]=='#') return 0;
   if(used[i][j]) return 0;
   used[i][j]=true;
   int ret=0;
   for(pii dd: dxdy){
      int ni=i+dd.first;
      int nj=j+dd.second;
      if(!(0<=ni&&ni<H&&0<=nj&&nj<W)) continue;
      ret+=rec(ni, nj);
   }

   return ret+1;
}

int main(){

   while(1){
      cin>> W>> H;
      if(!(H||W)) break;
      int sx, sy;
      for(int i=0; i<H; i++){
         for(int j=0; j<W; j++){
            cin>> fld[i][j];
            if(fld[i][j]=='@'){
               sy=i;
               sx=j;
               fld[i][j]='.';
            }
         }
      }

      for(int i=0; i<20; i++)for(int j=0; j<20; j++) used[i][j]=false;
      cout<< rec(sy, sx)<< endl;
   }

   return 0;
}

Measured memory_bytes: 3072
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}


fn f(n: usize) -> (usize, usize) {
    let mut n = n;
    let b = n % 10;
    let mut a = b;
    while n > 0 {
        a = n;
        n /= 10;
    }
    (a, b)
}

fn main() {
    let n = read::<usize>();

    let mut c: Vec<Vec<usize>> = vec![vec![0; 10]; 10];
    for i in 0..10 {
        for j in 0..10 {
            for x in 1..n+1 {
                let (a, b) = f(x);
                if a == i && b == j {
                    c[i][j] += 1;
                }
            }
        }
    }
    let mut ans = 0;
    for i in 0..10 {
        for j in 0..10 {
            ans += c[i][j] * c[j][i];
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#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;

#define ll long long

using pi = pair<int, int>;

typedef tree< pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update>Order_Set;

Order_Set X;

const int mxn = 1e6+100;
const int Mod = 1e9+7;

int arr[mxn], qs[mxn];
int bitOn[55];
map<int,int>Mp, cnt, op;
vector<int>Pi, Ans;
vector<int>G[mxn];
set<int>seet[mxn];

const int N = 25;

int n, m;
char a[N][N];
int vis[N][N], dist[N][N];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};

int bfs(int i, int j)
{
    memset(vis, 0, sizeof vis);
    queue<pi>q;
    vis[i][j] = 1;
    dist[i][j] = 0;
    q.push({i, j});
    int cost = 0;
    while(!q.empty()){
            int x = q.front().first;
            int y = q.front().second;
            q.pop();
            for(int c=0 ; c<4 ; c++){
                int nx = x + dx[c];
                int ny = y + dy[c];
                if(nx < 0 or nx >= n or ny < 0 or ny >= m or a[nx][ny] == '#' ) continue;
                if(!vis[nx][ny]){
                    vis[nx][ny] = 1;
                    dist[nx][ny] = dist[x][y] + 1;
                    cost = max(dist[nx][ny], cost);
                    q.push({nx, ny});
                }
            }
    }
    return cost;
}


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

	cin >> n >> m;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> a[i][j];
		}
	}
	int ans = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			if(a[i][j] == '.'){
				ans = max(ans, bfs(i, j));
			}
		}
    }

	cout << ans <<endl ;

	return 0;
}


Measured memory_bytes: 72064
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

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

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  int64 ret = 1;
  for (int i = 1; i <= n; ++i) {
    ret = ret * i % MOD;
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<stdio.h>
int main(void)
{
    int n = 0;
    char c=getchar_unlocked();
    while(c<='9'&&c>='0') {n=(n<<1)+(n<<3)+c-'0'; c=getchar_unlocked();}
    int a = 0, b = 0, e = 0, d = 0;
    do
    {
        switch(getchar_unlocked())
        {
          case 'A': ++a;break;
          case 'W': ++b;break;
          case 'R': ++d;break;
          default: ++e;getchar_unlocked();
        }
        getchar_unlocked();
        getchar_unlocked();
    } while(--n);
    printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d", a, b, e, d);
    return 0;
}


Measured memory_bytes: 1536
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var n int
	fmt.Scan(&n)
	xs := make([]int, n)
	for i := range xs {
		fmt.Scan(&xs[i])
	}

	sum := 0
	for _, x := range xs {
		sum += x
	}
	sum /= 2

	sum2 := 0
	for i := 1; i < n; i += 2 {
		sum2 += xs[i]
	}

	ans := make([]int, n)
	for i := 0; i < 2*n; i += 2 {
		ans[i%n] = (sum - sum2) * 2
		sum2 -= xs[(i+1)%n]
		sum2 += xs[i%n]
	}

	w := bufio.NewWriter(os.Stdout)
	fmt.Fprint(w, ans[0])
	for _, a := range ans[1:] {
		fmt.Fprint(w, " ")
		fmt.Fprint(w, a)
	}
	fmt.Fprintln(w, "")
	_ = w.Flush()
}


Measured memory_bytes: 7552
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

const int MOD = 1e9 + 7;

int main(){

    int N;
    cin >> N;
    string S;
    cin >> S;

    if(S[0] == 'W'){
        cout << 0 << endl;
        return 0;
    }

    int cntOut = 1;
    int cntIn = 0;
    long long ans = 1;
    for(int i = 1; i < 2 * N; i++){
        
        char temp2 = S[i];
        bool in;
        if(i % 2 == 1){
            if(temp2 == 'W'){
                cntOut++;
                in = false;
            }
            else{
                cntIn++;
                in = true;
            }
        }
        else
        {
            if(temp2 == 'B'){
                cntOut++;
                in = false;
            }
            else{
                cntIn++;
                in = true;
            }
        }
        
        if(cntIn > cntOut){
            cout << 0 << endl;
            return 0;
        }

        if(in){
            ans = (ans * (cntOut - cntIn + 1)) % MOD;
        }
    }

    if(cntIn == cntOut){

        long long C = 1;
        for(int i = 2; i <= N; i++){
            C = (C * i) % MOD;
        }

        ans = (ans * C) % MOD;

        cout << ans << endl;
    }
    else{
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 200005
#define pb push_back
#define mp make_pair
#define vit vector<int>::iterator
typedef pair<lint,lint> pii;
vector<pii> E;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    lint n,ans=0,px,py,a,b;
    cin>>n;
    for(lint i=1;i<=n;i++){
        cin>>a>>b;
        E.pb(mp(a,b));
    }
    sort(E.begin(),E.end());
    px=E[0].first;py=E[0].second;
    for(auto e:E){
        ans=max(ans,abs(e.first-px)+abs(e.second-py));
        if(e.second<py && (py-e.second)>(e.first-px)){
            px=e.first;
            py=e.second;
        }
    }

    px=E[0].first;py=E[0].second;
    for(auto e:E){
        ans=max(ans,abs(e.first-px)+abs(e.second-py));
        if(e.second>py && (e.second-py)>(e.first-px)){
            px=e.first;
            py=e.second;
        }
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 7416
import sys
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
import bisect
MAX_INT = int(10e25)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = I()
a = prime_factorize(N)

d = {}
for i in a:
  if i in d:
    d[i] += 1
  else:
    d[i] = 1

ruiseki = [0]
tmp = 0
for i in range(1,200):
  ruiseki.append(ruiseki[-1]+i)

ans = 0
for i in d.values():
  tmp = bisect.bisect_right(ruiseki, i) -1
  ans += tmp
print(ans)

Measured memory_bytes: 77368
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)

#define REP(i,m,M) for(int i=m; i<M; i++)
#define REPR(i,M,m) for(int i=M; i>m; i—-)
#define REPLL(i,m,M) for(ll i=m; i<M; i++)
#define REPLLR(i,M,m) for(ll i=M; i>m; i—-)
#define ALL(v) v.begin(),v.end()

ll A, B;

string bit(ll n){
    string ret = "";
    while(n>0){
        if((n&1)==1) ret = '1'+ret;
        else ret = '0'+ret;
        n >>= 1;
    }
    return ret;
}

int bitLength(ll n){
    int ret = 0;
    while(n>0){
        ret++;
        n >>= 1;
    }
    return ret;
}

ll solve(ll a, ll b){
    if(a==b) return 1LL;
    
    int al = bitLength(a),  bl = bitLength(b);
    
    if(a==0LL) return 1LL<<bl;
    
    if(al==bl){
        ll tmp = (1LL<<(al-1));
        return solve(a-tmp, b-tmp);
    }
    
    ll bp = b-(1LL<<(bl-1));
    int bpl = bitLength(bp);
    ll ret = solve(a, (1LL<<(bl-1))-1);
    if(bpl>=al){
        ret += 1LL<<(bl-1);
    }else{
        ret *= 2LL;
        ret += 1LL<<bpl;
    }
    
    return ret;
}

int main(int argc, const char * argv[]) {
    cin >> A >> B;

    cout << solve(A, B) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    Vector<Long> v = new Vector<>();
    int q = sc.nextInt();
    int cnt = -1;
    for(int i = 0 ; i < q ; i++){
      int query = sc.nextInt();
      switch(query){
        case 0: long x = sc.nextLong(); v.add(x); cnt++; break;
        case 1: int p = sc.nextInt(); System.out.println(v.get(p)); break;
        case 2: v.remove(cnt--); break;
      }
    }
  }
}


Measured memory_bytes: 143508
class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        if n < r:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

def main():
    X, Y = map(int, input().split())
    if (X + Y) % 3 != 0:
        print(0)
        exit()
    if (2 * X - Y) < 0 or (2 * Y - X) < 0:
        print(0)
        exit()
    
    M = (2 * X - Y) // 3
    N = (2 * Y - X) // 3
    comb = Combination(10 ** 6)

    ans = comb(M + N, M)
    print(ans)



if __name__ == "__main__":
    main()

Measured memory_bytes: 125000
#!/usr/bin/env python3
import sys
import itertools


def solve(N: int, d: "List[int]"):
    combi = itertools.combinations(d, 2)
    sum = 0
    for item in combi:
        sum += item[0] * item[1]
    print(sum)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    d = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, d)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
N = int(input())
waterlist = list(map(int, input().split()))
mountain = [0 for _ in range(N)]
S = 0
for i in range(N):
    S += waterlist[i]
# print(S)
x1 = S
for i in range(1, N, 2):
    x1 -= waterlist[i] * 2
mountain[0] = x1
# print(x1)
for i in range(1, N):
    mountain[i] = 2*waterlist[i-1]-mountain[i-1]

# print(mountain)
# A = np.array(matrix)
# inv_A = np.linalg.inv(A)
# # print(inv_A)

# ansmatrix = inv_A.dot(W)*2
# # print(ansmatrix)
message = ""
for i in range(N):
    message += str(int(mountain[i]))
    if i == (N - 1):
        break
    message += " "
print(message)


Measured memory_bytes: 14100
import java.util.*;
import java.util.ArrayList;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();

    ArrayList<Integer> c = new ArrayList<Integer>();
    c.add(1);
    c.add(2);
    c.add(3);

    c.remove(c.indexOf(a));
    c.remove(c.indexOf(b));
    System.out.println(c.get(0));
  }
}

Measured memory_bytes: 22868
//============================================================================
// Author       : Sun YaoFeng
//============================================================================

//#pragma 	comment(linker, "/STACK:100240000,100240000")
//#include	<cstdio>
//#include	<cstdlib>
//#include	<cstring>
//#include	<algorithm>

#include	<bits/stdc++.h>

using	namespace	std;

#define DB		double
#define	lf		else if
#define I64		long long
#define unt		unsigned int
#define	Rd()	(rand()<<15|rand())
#define For(i,a,b)	for(int i=(int)(a);i<=(int)(b);i++)
#define Rep(i,a,b)	for(int i=(int)(a);i>=(int)(b);i--)

#define	fi	first
#define se	second
#define MK	make_pair
#define pb	push_back
#define Vec	vector<int>
#define PA	pair<int, int>

//#define	min(a,b)	((a)<(b)?(a):(b))
//#define	max(a,b)	((a)<(b)?(b):(a))

#define	CH	(ch=getchar())
int		IN()	{
		int x= 0, f= 0, ch;
		for	(; CH < '0' || ch > '9';)	f= (ch == '-');
		for	(; ch >= '0' && ch <= '9'; CH)	x= x*10 + ch -'0';
		return	f? -x : x;
}

#define n	200005
#define P	1000000007
#define INF	(1 << 30)

int		N, X, Y, L[n], R[n];

Vec		A[n];

int		Pow(int a,int b){
		int ret=1;
		for (;b;b>>=1,a=1ll*a*a%P)
			if  (b&1)	ret=1ll*ret*a%P;
		return	ret;
}

int		main(int argc, char* argv[]){
		N= IN();
		X= IN();
		Y= IN();
		
		L[0]= 1;
		For(i, 1, N)	L[i]= 1ll*L[i-1]*i%P;
		For(i, 0, N)	R[i]= Pow(L[i], P-2);
		
		For(i, 1, N)	{
			int c= IN(), w= IN();
			A[c].pb(w);
		}
		
		For(i, 1, N)	sort(A[i].begin(), A[i].end());
		
		int	m1= INF, m2= INF, c1= 0, c2= 0;
		For(i, 1, N)	if	(A[i].size()){
			if	(A[i][0] < m1)	m2= m1, c2= c1, m1= A[i][0], c1= i;
			lf	(A[i][0] < m2)	m2= A[i][0], c2= i;
		}
		
		int	tot= 0, Ans= 1;
		For(i, 1, N)	if	(A[i].size())	{
			int t= 1;
			For(j, 2, A[i].size())	{
				if	(A[i][0] +  A[i][j-1] <= X)	t++;
				lf	(c1 != i && m1 + A[i][0] <= Y && m1 + A[i][j-1] <= Y)	t++;
				lf	(c2 != i && m2 + A[i][0] <= Y && m2 + A[i][j-1] <= Y)	t++;
					else	break;
			}
			
			if	(c1 != i && m1 + A[i][0] <= Y)	tot+= t, Ans= 1ll*Ans*R[t]%P;
			lf	(c2 != i && m2 + A[i][0] <= Y)	tot+= t, Ans= 1ll*Ans*R[t]%P;
		}
		
		Ans= 1ll*Ans*L[tot]%P;
		printf("%d\n", Ans);
		
		return	0;
}

Measured memory_bytes: 10880
import itertools as it
import math
def Dist (x1,y1,x2,y2):
    dis = (x2 - x1)**2 + (y2 - y1)**2
    return math.sqrt(dis)
N = int(input())
Pos = []
res = 0
for i in range(N):
    pos = list(map(int,input().split()))
    Pos.append(pos)
array = list(it.permutations(i for i in range(N)))
for i in range(math.factorial(N)):
    for j in range(N-1):
        res += Dist(Pos[array[i][j]][0],Pos[array[i][j]][1],Pos[array[i][j+1]][0],Pos[array[i][j+1]][1])
print(res / math.factorial(N))

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

int main() {
  int x;
  cin >> x;
  for(int i=-1000; i<=1000; i++){
    for(int j=-1000; j<=1000; j++){
      if(pow(i,5) - pow(j,5) == x){
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 4064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int indices = sc.nextInt();
		int[][] relations = new int[indices][indices];
		
		for(int i = 0; i < indices; i++) {
			int index = sc.nextInt();
			int degree = sc.nextInt();
			
			for(int j = 0; j < degree; j++) {
				int currentValue = sc.nextInt();
				relations[index-1][currentValue-1] = 1;
			}
		}
		
		for(int i = 0; i < indices; i++) {
			for(int j = 0; j < indices; j++) {
				if(j == indices-1) {
					System.out.print(relations[i][j] + "\n");
				}else if(i == indices-1 && j == indices-1){
					System.out.print(relations[i][j]);
				}else {
					System.out.print(relations[i][j] + " ");
				}
			}
		}
	}
}



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

#define REP(i, start, count) for (int i = (start); i < (int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;

int X;

int main(void)
{
    cin >> X;
    ll ans = 0;
    ans += (X / 500) * 1000;
    ans += (X % 500) / 5 * 5;

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
const ll inf=1e9+7;
ll gcd(ll a, ll b) { return (b ? gcd(b, a % b) : a); }
ll lcm(ll a, ll b) { return a / (gcd(a, b)) * b; }

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

    int len=s.size();
    len--;


    for(int i=len/2;i>0;i--){
      bool tmp=true;
      for(int j=0;j<i;j++){
        if(s[j]!=s[j+i]) tmp=false;
      }

      if(tmp){
        cout<<i*2<<endl;
        break;
      }
    }


}

Measured memory_bytes: 256
H,W = map(int,input().split())
S = [input() for i in range(H)]
S = ["."*W] + S + ["."*W]
S_new = []
result = []

for i in S:
    s_new = "." + i + "."
    S_new.append(s_new)

for i in range(1,H+1):
    for j in range(1,W+1):
        if S_new[i][j] == ".":
            count = 0
            for k in range(i-1,i+2):
                for r in range(j-1,j+2):
                    if S_new[k][r] == "#":
                        count += 1
            result.append(count)
        else:
            result.append("#")

flag = 0
for i in result:
    print(i,end="")
    flag += 1
    if flag == W:
        print("")
        flag = 0


Measured memory_bytes: 3444
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <vector>
#include <string>
using namespace std;

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")

#define DEBUG(x) cout << ">> " << #x << ": " << x << endl;
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
typedef long long ll;
typedef long double ld;

int main() { _
  int n, m; cin >> n >> m;
  vector<vector<int> > sw(n);
  vector<int> p(m);
  for (int i = 0; i < m; i++) {
    int k; cin >> k;
    for (int j = 0; j < k; j++) {
      int tmp; cin >> tmp;
      sw[tmp-1].push_back(i);
    }
  }
  for (int i = 0; i < m; i++) {
    cin >> p[i];
  }
  vector<int> num(m, 0);
  int ans = 0;
  for (int i = 0; i < (1 << n); i++) {
    int count = 0, temp = i;
    for (int j = 0; j < m; j++) num[j] = 0;
    while (temp != 0) {
      if (temp & 1) for (int b : sw[count]) num[b]++;
      temp >>= 1;
      count++;
    }
    for (int j = 0; j < m; j++) {
      if (num[j] % 2 != p[j]) {
        ans--; break;
      }
    }
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    string S;
    cin >> S;

    int diff = 0;
    size_t size = S.length();
    for(int i = 0; i < size/2; i++){
        if(S[i] != S[size - i - 1]){
            diff ++;
        }
    }
    cout << diff << endl;
    return 0;
} 

Measured memory_bytes: 256
def main():
    N = int(input())
    ans = 0

    if N == 2:
        print(2)
        return
    
    while True:
        flg = True
        for i in range(2, ((N + 1) // 2) + 1):
            if N % i == 0:
                flg = False
                break
        
        if flg:
            break
        else:
            N += 1
    
    print(N)

if __name__ == '__main__':
    main()

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

int main(){
  
  string s;
  cin>>s;
  
  if(s=="KIHBR"){
    cout<<"YES"<<endl;
  }
  else if(s=="AKIHBR" || s=="KIHABR" || s=="KIHBAR" || s=="KIHBRA"){
    cout<<"YES"<<endl;
  }
  else if(s=="AKIHABR" || s=="AKIHBAR" || s=="AKIHBRA" || s=="KIHABAR" || s=="KIHABRA" || s=="KIHBARA"){
    cout<<"YES"<<endl;
  }
  else if(s=="AKIHABR" || s=="AKIHABRA" || s=="AKIHBARA" || s=="KIBAHARA"){
    cout<<"YES"<<endl;
  }
  else if(s=="AKIHABARA"){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
  
}


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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound


signed main() {
    int a, p;
    cin >> a >> p;
    cout << (3 * a + p) / 2 << endl;
    return 0;
}


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



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class CLower {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n;
        in >> n;
        vi H(n);
        in >> H;
        vi dp(n);
        FOR(i, 1, n) {
            dp[i] = H[i] <= H[i - 1] ? dp[i - 1] + 1 : 0;
        }
        int res = *max_element(all(dp));
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    CLower solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 4008
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int h1, m1, h2, m2, k;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int x = 60 * h1 + m1;
    int y = 60 * h2 + m2;
    cout << y - x - k << endl;
}


Measured memory_bytes: 3652
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

struct Vector{double x, y;};

bool isPara(Vector v1, Vector v2){
  int outer=v1.x*v2.y-v1.y*v2.x;
  //cout << "outer:" << outer << endl;
  if(outer==0) return true;
  else return false;
}

bool isOrth(Vector v1, Vector v2){
  int inner=v1.x*v2.x+v1.y*v2.y;
  //cout << "inner:" << inner << endl;
  if(inner==0) return true;
  else return false;
}

int main(){
  int q; cin >> q;
  for(int i=0;i<q;i++){
    int x0, y0, x1, y1; cin >> x0 >> y0 >> x1 >> y1;
    Vector v1;
    v1.x=x1-x0; v1.y=y1-y0;
    int x2, y2, x3, y3; cin >> x2 >> y2 >> x3 >> y3;
    Vector v2;
    v2.x=x3-x2; v2.y=y3-y2;
    if(isOrth(v1, v2)){
      cout << 1 << endl;
    }else if(isPara(v1, v2)){
      cout << 2 << endl;
    }else{
      cout << 0 << endl;
    }
  }
}

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

typedef long long int ll;
ll h2(ll n) 
{ 
    ll res = 0; 
    for (ll i=n; i>=1; i--) 
    { 
        if ((i & (i-1)) == 0) 
        { 
            res = i; 
            break; 
        } 
    } 
    return res; 
} 
ll h1(ll n) 
{ 
   ll p = (ll)log2(n); 
   return (ll)pow(2, p);  
} 
int main(){
   ll a;
   cin>>a;
  
   if(a==1){
       cout<<"1";}
//   }else{
//     //   cout<<h2(a);
       
//     //   cout<<sum;
       
//     //   while(a!=1 || a<=0 ){
//     //       a=a/2;
//     //       sum+=pow(2,kl);
//     //       kl++;
//     //       cout<<sum;
//     //       cout<<a;a
           
//       }
else{
       ll kj=h1(a);
       //cout<<kj;
       ll summ=0;
       while(kj>0){
           summ=summ+kj;
           kj=kj/2;
           
       }
       cout<<summ;
   }
    
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926525
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  string n;cin>>n;
  if((int)n.size()==1){
    P(n);
    return 0;
  }
  ll ans=0;
  ans+=n[0]-48;
  bool flag=false;
  for(int i=1;i<(int)n.size();i++){
    if(n[i]!='9')flag=true;
    ans+=9;
  }
  if(flag){
    P(ans-1);
  }else{
    P(ans);
  }
  return 0;
}


Measured memory_bytes: 256
hoge = input().split()
N = int(hoge[0])
M = int(hoge[1])

if N == 1 and M == 1:
  print(0)
else:
  n = 0
  if N != 0:
    for i in range(N-1):
      n += 1+i
  else:
    n = 0
  if M != 0:
    m = (M * (M-1)) / 2
  else:
    m = 0
  print(int(n + m))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

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

    int n;
    cin >> n;
    int a[n + 5], ans = 0;
    rep(i, n){
      cin >> a[i];
      if(a[i] % 2 == 1){
	ans ++;
      }
    }
    cout << (ans % 2 == 0 ? "YES\n" : "NO\n");
    return 0;
} 


Measured memory_bytes: 640
H,W,D = map(int, input().split())
arr = [0]*(H*W)
for i in range(H):
    for j , v in enumerate(map(int, input().split())):
        arr[v-1] = (i,j)
X = [[] for _ in range(D)]
Y = [[] for _ in range(D)]
for i , (x,y) in enumerate(arr):
    if i // D == 0:
        X[i%D].append(0)
        Y[i%D].append(0)
    else:
        px, py = arr[i - D]
        X[i%D].append(X[i%D][-1] + abs(x - px))
        Y[i%D].append(Y[i%D][-1] + abs(y - py))
Q = int(input())
for _ in range(Q):
    L, R = map(lambda x : int(x) - 1 , input().split())
    
    assert L % D  == R % D
    print(X[R%D][R//D] - X[L%D][L//D] + Y[R%D][R//D] - Y[L%D][L//D])
    
    


Measured memory_bytes: 31304
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <unordered_map>
#include <map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int h, w;
int color[501][501];

void printr() {
    REP(i,h) {
        REP(j,w) {
            if (color[i][j] >= 1) {
                cout << "#";
            } else {
                cout << ".";
            }
        }
        cout << endl;
    }
}

void printb() {
    REP(i,h) {
        REP(j,w) {
            if (color[i][j] % 2 == 0) {
                cout << "#";
            } else {
                cout << ".";
            }
        }
        cout << endl;
    }
}

int main() {
    cin >> h >> w;
    
    REP(i,h) {
        color[i][0] = 1;
        if (i % 2 == 0) {
            REP(j,w-1) {
                color[i][j] = 1;
            }
        }
    }
    
    char c;
    
    REP(i,h) {
        REP(j,w) {
            cin >> c;
            if (c == '#') color[i][j] = 2;
        }
    }
    
    printr();
    cout << endl;
    printb();
}


Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main(){
  ll n;
  cin >>n;
  ll x[n],y[n],h[n],l=1e10;
  for(ll i=0;i<n;i++) {
    cin >>x[i]>>y[i]>>h[i];
    l=min(h[i],l);
  }
  ll fl=0,fl1=0,hh,j,k;
  for(hh=l;;hh++){
    fl=0;
    for(ll i=0;i<n;i++) if(hh-h[i]<0) fl=1;
    if(fl==1) continue;
    for(j=0;j<=100;j++){
        for(k=0;k<=100;k++){
          fl1=0;
          for(ll p=0;p<n;p++){
            if(h[p]==0){
              if(abs(x[p]-j)+abs(y[p]-k)<hh) {
                fl1=1;
                break;
              }
            }
            else{
              if(hh-abs(x[p]-j)-abs(y[p]-k)!=h[p]){
                fl1=1;break;
              }
            }
          }
          if(fl1==0) break;
        }
        if(fl1==0) break;
    }
    if(fl1==0) break;
    }
    cout << j<<" "<<k<<" "<<hh<<endl;
    return 0;
}


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

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


Measured memory_bytes: 3708
package main

import "fmt"

var h, w, k int
var cs [][]rune

func main() {
	fmt.Scan(&h, &w, &k)
	cs = make([][]rune, h)
	for i := 0; i < h; i++ {
		var s string
		fmt.Scan(&s)
		cs[i] = []rune(s)
	}
	sum := 0
	for i := 0; i < 1<<h; i++ {
		for j := 0; j < 1<<w; j++ {
			c := count(i, j)
			if c == k {
				sum++
			}
		}
	}
	fmt.Println(sum)
}

func count(hi, wi int) int {
	c := 0
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if (hi>>i)&1 == 1 {
				continue
			}
			if (wi>>j)&1 == 1 {
				continue
			}
			if cs[i][j] == '#' {
				c++
			}
		}
	}
	return c
}


Measured memory_bytes: 1768
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            // 整数の入力
            int n = int.Parse(Console.ReadLine());

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            var sortArray = inputLongArray.OrderBy(x => x).ToArray();

            long medianL = sortArray[n / 2 - 1];
            long medianR = sortArray[n / 2];

            for(int i = 0; i < n; ++i) {
                if(inputLongArray[i] < medianR) {
                    Console.WriteLine(medianR);
                } else {
                    Console.WriteLine(medianL);
                }
            }

            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 48708
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
template <class T>
using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;
template <class T>
using ordered_multiset = __gnu_pbds::tree<T, __gnu_pbds::null_type, less_equal<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

#define PI atan2(0, -1)
#define EPS 1e-9
#define INF 5e18
#define MOD 1000000007

#define all(x) begin(x), end(x)
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

int N, preR [200010], preW [200010], ret;
string s;

int main(){
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10);
    cin >> N >> s; s = "#"+s;
    for(int i = 1; i <= N; i++){
        preR[i] = preR[i-1]+(s[i] == 'R');
        preW[i] = preW[i-1]+(s[i] == 'W');
    }
    ret = min(preR[N], preW[N]);
    for(int red = 1; red < N; red++){
        int sum = preW[red]+(preR[N]-preR[red]);
        int wrong = min(preW[red], preR[N]-preR[red]);
        ret = min(ret, sum-wrong);
    }
    cout << ret << '\n';
    return 0;
}

/******************************
Kateba ii dake no hanashi darou
Success is only a victory away
- No Game No Life Opening
******************************/


Measured memory_bytes: 5336
#include "bits/stdc++.h"
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair <ll, ll > pll;

//bool comp(
//
//	st pll &a, const pll &b) {
//	return a.first < b.first;
//}
//std::vector<int> enum_div(int n)//nの約数を列挙
//{
//	std::vector<int> ret;
//	for (int i = 1; i*i <= n; ++i)
//	{
//		if (n%i == 0)
//		{
//			ret.push_back(i);
//			if (i != 1 && i*i != n)
//			{
//				ret.push_back(n / i);
//			}
//		}
//	}
//	return ret;
//}


template<int N>
int factorial() {
	return factorial<N - 1>() * N;
}

template<>  /// 特殊化：factorial<N=”1”>だったら，値を返す
int factorial<1>() {
	return 1;
}
int main()
{
	priority_queue<int> q;
	string s = {};
	ll h = 0, w = 0, k = 0, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, ans = 0;
	ll x[300005] = {};
	ll y[620] = {};
	ll y2[302][302] = {};
	cin >> a;
	cin >> b;
	if (a*500>=b)
	{
		cout << "Yes" << endl;

	}
	else
	{
		cout << "No" << endl;

	}
	
	//cout << ans << endl;
	//cout << fixed << setprecision(10) <<tmp << endl;
	//cout<<factorial<10><<endl;
	return 0;
}
//2つの組の数をソートしたりするやつ
//vector<pair<ll, ll> > hoges(a);
//for (int i = 1; i <= a; i++)
//{
//	cin >> h;
//	hoges[i - 1] = make_pair(h, i);
//}
//sort(hoges.begin(), hoges.end(), comp);
//for (int i = 0; i < a; i++)
//{
//	cout << hoges[i].second << endl;
//}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <cctype>
#include <cstdlib>
using namespace std;

int main(){
	string s;
	getline(cin, s);
	transform(s.begin(), s.end(), s.begin(), ::toupper);
	cout << s << endl;
	return 0;
}

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

int main() {
    int H, N;
    cin >> H >>N;
    vector<int>vec(N);
    for (int &x : vec){
        cin >> x;
    }
    int Dam = 0;
    for (int x : vec){
        Dam += x;
    }
    if (Dam >= H){
        cout << "Yes" << endl;
    }
    if (Dam < H){
        cout << "No" << endl;
    }
    

}


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

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

  int left = 0;
  int right = N - 1;
  cout << left << endl;
  string s0;
  cin >> s0;
  if (s0 == "Vacant") return 0;
  cout << right << endl;
  string s1;
  cin >> s1;
  if (s1 == "Vacant") return 0;

  string s = s0;
  int query = 20 - 1;
  while (query--) {
    int mid = left + (right - left) / 2;
    cout << mid << endl;
    cin >> s;

    if (s == "Vacant") {
      break;
    } else {
      if ((s == s0 && (mid - left) % 2 == 1) ||
          (s != s0 && (mid - left) % 2 == 0)) {
        right = mid;
        s1 = s;
      } else {
        left = mid;
        s0 = s;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 852
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
#define rep(i, n)for(int i=0; i<n; i++)

int main(){
  long long N, D;
  cin >> N >> D;
  long long X[N], Y[N];
  rep(i, N)
    cin >> X[i] >> Y[i];
  //

  int ans = 0;
  rep(i, N){
    long long tmp;
    tmp = X[i]*X[i] + Y[i]*Y[i];
    if(tmp <= D*D)
      ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6716
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		// 計算
		int result = 0;
		result = a+b+c-max(a, max(b, c));
		
		// 出力
		System.out.println(result);
	}

}

Measured memory_bytes: 21588