akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace cs
{
    public class Program
    {
        public static void Main(string[] args)
        {
            
            var N = int.Parse(Console.ReadLine());
            var input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            var list = new List<int>();

            list = input.Select(w => w).ToList();
            list.Sort();
            input = list.ToArray();
            var x = N / 2;

            Console.WriteLine(input[x] - input[x-1]);
            
            
            
/*
            Console.WriteLine();
            Console.WriteLine("続行するにはアレ");*/
            //Console.ReadKey();
           
        }

        public static long GCD(long n, long m){
            
            if(m % n == 0) return n;
            else return GCD(m%n, n);

        }

        public static long LCD(long n, long m){

            return m * n / GCD(n,m);
        }
    }
}


Measured memory_bytes: 18400
import java.io.*;
import java.util.StringTokenizer;


public class Main {
    static final int UNCALC = -1;
    static final int INF = (int) 1e9;
    static final int mod = (int) (1e9 + 7);

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = sc.nextIntArray(n);
        int[][] dp = new int[n][k + 1];
        dp[n - 1][0] = 1;
        for (int i = 1; i <= k; i++)
            dp[n - 1][i] += dp[n - 1][i - 1] + (i <= a[n - 1] ? 1 : 0);
        for (int child = n - 2; child >= 0; child--) {
            for (int rem = k; rem >= 0; rem--) {
                long ans = dp[child + 1][rem] - ((rem - a[child] > 0) ? dp[child + 1][rem - a[child] - 1] : 0);
                while (ans < 0) ans += mod;
                dp[child][rem] = (int) (ans % mod);
            }
            for (int i = 1; i <= k; i++)
                dp[child][i] = (dp[child][i] + dp[child][i - 1]) % mod;
        }
        long ans = dp[0][k] - (k > 0 ? dp[0][k - 1] : 0);
        while (ans < 0) ans += mod;
        out.println(ans % mod);
        out.flush();
        out.close();

    }


    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        public Scanner(String file) throws Exception {
            br = new BufferedReader(new FileReader(file));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

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

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

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

        public void waitForInput() throws InterruptedException {
            Thread.sleep(3000);
        }

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

        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

    }
}

Measured memory_bytes: 82516
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(void) {
    int n,t,a;
    cin >> n >> t >> a;
    int res=0;
    double diff=100000.0;
    rep(i,n){
        double h;
        cin >> h;
        if(abs(a-t+h*0.006)<diff){
            res=i+1;
            diff = abs(a-t+h*0.006);
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).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 (a > b) {a = b; return 1;} return 0; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }

// gcc拡張マクロ
#define gcd __gcd
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {

    ll n; cin >> n;
    
    vector<vector<ll>> g(n);
    REP(i, n-1) {
        ll a, b;
        cin >> a >> b;
        a--; b--; // 0-indexed
        g[a].push_back(b);
        g[b].push_back(a);
    }

    ll u, v;
    ll gd;
    {
        deque<ll> q = {0};
        vector<ll> d(n, 0);
        while (!q.empty()) {
            ll qi = q.front();
            ll di = d[qi];
            q.pop_front();
            for (ll qj : g[qi]) {
                if (!d[qj] && qj != 0) {
                    d[qj] = d[qi] + 1;
                    q.push_back(qj);
                }
            }
        }
        u = max_element(ALL_OF(d)) - d.begin();
    }
    {
        deque<ll> q = {u};
        vector<ll> d(n, 0);
        while (!q.empty()) {
            ll qi = q.front();
            ll di = d[qi];
            q.pop_front();
            for (ll qj : g[qi]) {
                if (!d[qj] && qj != u) {
                    d[qj] = d[qi] + 1;
                    q.push_back(qj);
                }
            }
        }
        v = max_element(ALL_OF(d)) - d.begin();
        gd = d[v];
    }
    DUMP(u);
    DUMP(v);

    DUMP(gd);
    
    ll grundy;
    if (gd == 0) {
        grundy = 1;
    } else {
        switch (gd % 3) {
            case 0: grundy = 1; break;
            case 1: grundy = 0; break;
            case 2: grundy = 2; break;
        }
    }

    cout << (grundy ? "First" : "Second") << endl;

}

Measured memory_bytes: 15984
#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>
#include <stack>
#include <cstdint>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b-1);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline 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);
  ll n;cin>>n;
  ll res=1;
  rep(i,n)res*=3;
  ll d=1;
  rep(i,n){
    ll a;cin>>a;
    if(a%2)d*=1;
    else d*=2;
  }
  cout<<res-d<<endl;
  return 0;

}


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

int main()
{
  ll N;
  cin>>N;
  ll s,t=0;
  while(N-->0){
    ll a;
    cin>>a;
    if(s<=a){s=a;}else{t+=s-a;}
  }
  cout << t;
}

Measured memory_bytes: 3596
import bisect
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
A = I()

if N%500 <= A:
	print("Yes")
else:
	print("No")

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

struct dise{
 int lab1, lab2, lab3, lab4, lab5, lab6;
};

int main(){
 dise d2;
 cin >> d2.lab1 >> d2.lab2 >> d2.lab3 >> d2.lab4 >> d2.lab5 >> d2.lab6;

 int q;
 cin >> q;
 int top, front;
 for( int j=0; j<q; j++ ){
   cin >> top >> front;
   if( top==d2.lab3 || top==d2.lab4 ){
     int tmp = d2.lab1;
     d2.lab1 = d2.lab4;
     d2.lab4 = d2.lab6;
     d2.lab6 = d2.lab3;
     d2.lab3 = tmp;
   }
   while( top!=d2.lab1 ){
     int tmp = d2.lab1;
     d2.lab1 = d2.lab2;
     d2.lab2 = d2.lab6;
     d2.lab6 = d2.lab5;
     d2.lab5 = tmp;
   }
   while( front!=d2.lab2 ){
     int tmp = d2.lab2;
     d2.lab2 = d2.lab3;
     d2.lab3 = d2.lab5;
     d2.lab5 = d2.lab4;
     d2.lab4 = tmp;
   }

 cout << d2.lab3 << endl;
 }

 return 0;
}


Measured memory_bytes: 3092
import java.util.Scanner;

  class Main{
    public static void main(String[] args){
      Scanner stdIn = new Scanner(System.in);
      int a = stdIn.nextInt();
      int b = stdIn.nextInt();
      int X = a+b;
      int Y = a-b;
      int Z = a*b;
      int[] S = {X,Y,Z};
      int M = S[0];
      for(int i=0; i<=2; i++){
        if(M <= S[i]){
          M = S[i];
        }
      }
      System.out.println(M);
    }
  }

Measured memory_bytes: 21716
#include <iostream>
using namespace std;
 
int main() {
    int N, count=0;
    const int MAX_N = 100;
    int a[MAX_N];
     
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> a[i];
    }
     
    int tmp;
    for(int i=0; i<N-1; i++){
        for(int j=N-1; j>=i+1; j--){
            if(a[j-1]>a[j]){
                tmp = a[j];
                a[j] = a[j-1];
                a[j-1] = tmp;
                count++;
            }
        }
    }
     
    if(N==1){
        cout << a[0] <<endl;
        cout << 0 << endl;
        return 0;
    }
     
    for(int i=0; i<N-1; i++){
        cout << a[i] << " ";
    }
    cout << a[N-1] << endl;
    cout << count << endl;
}
 

Measured memory_bytes: 3048
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <deque>
#include <map>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a + b >= 10) {
		cout << "error" << endl;
		return 0;
	}
	cout << a + b << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 1024
void insertionSort(int *A,int N);
int main(void){
    int A[MAX];
    int N;
    int i;
    scanf("%d",&N);
    for(i=0;i<N;i++)
        scanf("%d",&A[i]);
    for(i=0;i<N-1;i++)
        printf("%d ",A[i]);
    printf("%d",A[N-1]);
    printf("\n");
    insertionSort(A,N);
    return 0;
}
void insertionSort(int *A,int N){
    int i,j,k;
    int v;
    for(i=1;i<N;i++){
        v=A[i];
        j=i-1;
        while(j>=0 && A[j]>v){
            A[j+1]=A[j];
            j--;
        }
        A[j+1]=v;
    for(k=0;k<N-1;k++)
        printf("%d ",A[k]);
    printf("%d",A[N-1]);
    printf("\n");
    }
}

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

using namespace std;

const double PI = 3.141592653589;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define ll long long
#define ll long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define INF LLONG_MAX
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
//  


int32_t main()
{
    fastio;
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    int r;
    cin >> r;
    cout << fixed << setprecision(15) << PI*2*r << "\n";
    return 0;
}



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

int main() {
    int N;
    cin >> N;
    vector<string> s(N);
    rep(i, N) {
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
    }
    sort(s.begin(), s.end());


    ll cnt=0;
    ll tcnt = 0;
    for(int i=0; i<N-1; i++) {
        if(s[i] == s[i+1]) {
            tcnt++;
        }
        else {
           if(tcnt) cnt += (tcnt*(tcnt+1))/2;
            tcnt = 0;
        } 
    }
   if(tcnt) cnt += (tcnt*(tcnt+1))/2;

    cout << cnt << endl;


    return 0;
}


Measured memory_bytes: 7296
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul, xor
from copy import copy, deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits
from datetime import date

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A,B,Q=MAP()

S=[0]*(A+2)
for i in range(A):
    S[i+1]=INT()
T=[0]*(B+2)
for i in range(B):
    T[i+1]=INT()
S[-1]=T[-1]=INF

# Si番目の神社から左に一番近い寺
L1=[INF]*(A+2)
# Si番目の神社から右に一番近い寺
R1=[INF]*(A+2)
for i in range(1, A+1):
    idx=bisect_right(T, S[i])-1
    if T[idx]!=0:
        L1[i]=S[i]-T[idx]
    idx=bisect_left(T, S[i])
    if T[idx]!=INF:
        R1[i]=T[idx]-S[i]

# Ti番目の寺から左に一番近い神社
L2=[INF]*(B+2)
# Ti番目の寺から右に一番近い神社
R2=[INF]*(B+2)
for i in range(1, B+1):
    idx=bisect_right(S, T[i])-1
    if S[idx]!=0:
        L2[i]=T[i]-S[idx]
    idx=bisect_left(S, T[i])
    if S[idx]!=INF:
        R2[i]=S[idx]-T[i]

for i in range(Q):
    dist1=dist2=dist3=dist4=INF
    x=INT()
    # 地点xから左に一番近い神社
    idx=bisect_right(S, x)-1
    if S[idx]!=0:
        # idx番目の神社に行く
        dist1=x-S[idx]
        # idx番目の神社から一番近い寺に行く
        dist1+=min(L1[idx], R1[idx])
    idx=bisect_left(S, x)
    if S[idx]!=INF:
        dist2=S[idx]-x
        dist2+=min(L1[idx], R1[idx])
    idx=bisect_right(T, x)-1
    if T[idx]!=0:
        dist3=x-T[idx]
        dist3+=min(L2[idx], R2[idx])
    idx=bisect_left(T, x)
    if T[idx]!=INF:
        dist4=T[idx]-x
        dist4+=min(L2[idx], R2[idx])
    print(min(dist1, dist2, dist3, dist4))


Measured memory_bytes: 30124
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int N;
  cin >> N;
  
  vector<int> d(N);
  REP(i, N) cin >> d[i];
  
  ll sum = 0;
  REP(i, N-1){
    FOR(j, i+1, N) sum += d[i] * d[j];
  }
  
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

typedef struct {
	char name[16];
	int sum;
	int num;
} FEE;

int main(void)
{
	FEE fee[9];
	int i, am, pm;
	
	for (i = 0; i < 9; i++){
		scanf("%s %d %d", fee[i].name, &am, &pm);
		fee[i].num = am + pm;
		fee[i].sum = am * 200 + pm * 300;
		
	}
	
	for (i = 0; i < 9; i++){
		printf("%s %d %d\n", fee[i].name, fee[i].num, fee[i].sum);
	}
	
	return (0);
}

Measured memory_bytes: 596
def main():
    # n = int(input())
    # n, m = map(int, input().split())
    # a = list(map(int, input().split()))
    # s = input()
    # h = [int(input()) for _ in rane(n)]

    import math

    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    dishes = [a, b, c, d, e]
    count = 0
    mini = 10
    index = 0
    for i in range(5):
        if dishes[i] % 10 != 0 and mini > dishes[i] % 10:
            mini = dishes[i] % 10
            index = i
    for i in range(5):
        if i != index:
            count += math.ceil(dishes[i]/10) * 10
        else:
            count += dishes[i]

    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62332
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main(){

  int N;
  cin>>N;
  vector<int> data(3*N);

  for(int i=0;i<3*N;i++)
    cin>>data[i];

  sort(data.begin(),data.end());

  long long int ans = 0;
  for(int i=0;i<N;i++){
    ans+=data[3*N-2-2*i];
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 1408
/// author: Mr.Hakimov

#include <bits/stdc++.h>
#include <chrono>

#define fi first
#define se second
#define pb push_back
#define pf push_front
#define Pb pop_back
#define Pf pop_front
#define all(x) (x).begin(), (x).end()
#define fin(s) freopen(s, "r", stdin);
#define fout(s) freopen(s, "w", stdout);

using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

typedef long long ll;
typedef long double ld;

int TN = 1;

void solve() {
	vector<vector<int>> a(3, vector<int> (3));
	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < 3; ++j) {
			cin >> a[i][j];
		}
	}
	
	int n;
	cin >> n;
	
	map<int, bool> has;
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		has[x] = true;
	}
	
	vector<vector<int>> b(3, vector<int> (3));
	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < 3; ++j) {
			if (has[a[i][j]]) {
				b[i][j] = true;
			}
		}
	}
	
	for (int i = 0; i < 3; ++i) {
		bool f = true;
		for (int j = 0; j < 3; ++j) {
			f &= b[i][j];
		}
		if (f) {
			cout << "Yes";
			return;
		}
	}
	
	for (int j = 0; j < 3; ++j) {
		bool f = true;
		for (int i = 0; i < 3; ++i) {
			f &= b[i][j];
		}
		if (f) {
			cout << "Yes";
			return;
		}
	}
	
	bool f = true;
	for (int i = 0; i < 3; ++i) {
		f &= b[i][i];
	}
	
	if (f) {
		cout << "Yes";
		return;
	}
	
	f = true;
	for (int i = 0; i < 3; ++i) {
		f &= b[i][3 - i - 1];
	}
	if (f) {
		cout << "Yes";
		return;
	}
	
	cout << "No";
}

int main() {
    auto start = chrono::steady_clock::now();
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    /// =========================================
    /// fin("input.txt"); fout("output.txt");
    /// fin("file.in"); fout("file.out");
    /// cin >> TN;
    /// =========================================

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

    auto finish = chrono::steady_clock::now();
    auto elapsed_ms = chrono::duration_cast<chrono::milliseconds>(finish - start);
    cerr << endl << "Time: " << elapsed_ms.count() << " ms\n";

    return 0;
}


Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))

ave_low = int(sum(x)/len(x))
ave_upp = int(sum(x)/len(x))+1

cout_low = 0
cout_upp = 0

for i in range(len(x)):
    cout_low = cout_low + (ave_low-x[i])*(ave_low-x[i])
    cout_upp = cout_upp + (ave_upp-x[i])*(ave_upp-x[i])

if cout_low <= cout_upp:
    print(cout_low)
else:
    print(cout_upp)

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

int main(){
  string s;
  cin >> s;
  if(s=="SUN"){
    cout << "7" << endl;
  }
  if(s=="MON"){
    cout << "6" << endl;
  }
  if(s=="TUE"){
    cout << "5" << endl;
  }
  if(s=="WED"){
    cout << "4" << endl;
  }
  if(s=="THU"){
    cout << "3" << endl;
  }
  if(s=="FRI"){
    cout << "2" << endl;
  }
  if(s=="SAT"){
    cout << "1" << endl;
  }

  return 0;
}

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


//read_kaisetsu
int main() {
    int n;cin>>n;
    pair<pair<string,int>,int> p[101];
    rep(i,n){
        string s;
        int q;
        cin>>s>>q;
        p[i] = make_pair(make_pair(s,-q),i);
    }
    sort(p, p+n);
    rep(i,n)cout<<p[i].second + 1<<endl;
	return 0;
}

Measured memory_bytes: 3648
import java.io.PrintWriter;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());

		out.println((A + B) % 24);
		
		sc.close();
		out.flush();
	}
}

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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskB {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int n = in.nextInt();
			int m = in.nextInt();
			int[][] a = new int[n][m];
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					a[i][j] = in.nextInt() - 1;
				}
			}
			int[] b = new int[m];
			boolean[] dead = new boolean[m];
			int[] ptr = new int[n];
			for (int ans = 1; ans <= n; ans++) {
				Arrays.fill(b, 0);
				Arrays.fill(dead, false);
				Arrays.fill(ptr, 0);
				for (int i = 0; i < n; i++) {
					++b[a[i][ptr[i]]];
				}
				int numAlive = m;
				while (numAlive > 0) {
					int bad = -1;
					for (int i = 0; i < m; i++) {
						if (dead[i]) {
							continue;
						}
						if (b[i] > ans) {
							bad = i;
							break;
						}
					}
					if (bad < 0) {
						break;
					}

					dead[bad] = true;
					--numAlive;
					for (int i = 0; i < n; i++) {
						if (a[i][ptr[i]] != bad) {
							continue;
						}
						--b[bad];
						while (ptr[i] < m && dead[a[i][ptr[i]]]) {
							++ptr[i];
						}
						if (ptr[i] < m) {
							++b[a[i][ptr[i]]];
						}
					}
				}
				if (numAlive > 0) {
					out.println(ans);
					return;
				}
			}
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(in.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

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

	}
}



Measured memory_bytes: 31128
use std::io::{self, Read, Write};
use std::str::{self, FromStr};

pub struct IO<R: Read, W: Write>(R, io::BufWriter<W>);

impl<R: Read, W: Write> IO<R, W> {
    pub fn new(reader: R, writer: W) -> Self {
        Self(reader, io::BufWriter::new(writer))
    }

    pub fn read<T: FromStr>(&mut self) -> T {
        let token = self
        .0
        .by_ref()
        .bytes()
        .map(|b| b.unwrap())
        .skip_while(|&b| (b as char).is_whitespace())
        .take_while(|&b| !(b as char).is_whitespace())
        .collect::<Vec<u8>>();

        unsafe { str::from_utf8_unchecked(token.as_slice()) }
        .parse()
        .ok()
        .expect("Can't parse it.")
    }

    pub fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


fn main() {
    let (r, w) = (io::stdin(), io::stdout());
    let mut rw = IO::new(r.lock(), w.lock());

    let (a, b): (i32, i32) = (rw.read(), rw.read());
    let ans = if a & 1 == 0 || b & 1 == 0 {
        "Even"
    } else {
        "Odd"
    };
    println!("{}", ans);
}

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

int main() {
  string s;
  cin >> s;
  string k = "CODEFESTIVAL2016";
  int ans = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] != k[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
//IncrementDecrement.cpp (B)
#include <iostream>
#include <string>
using namespace std;

int main(){
  int N;
  string S;
  cin >> N >> S;
  int Ans,Mans;
  Ans = 0;
  Mans = 0;
  for(int i = 0; i < N; i++){
    if(S[i]=='I') ++Ans;
    else --Ans;
    Mans = max(Mans,Ans);
  }
  printf("%d\n",Mans );
  return 0;
}


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

int main() {
  ll n, k;
  cin >> n >> k;
  ll a = n%k;
  ll ans = min(a, k-a);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b;
    cin >> a >> b;
    int ans = 0;
    int n=1;
    while(n < b)
    {
        n += (a-1);
        ans++;
    }
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
#pragma region Macros

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

using ll = long long;
#define int ll
using vi = vector<int>;
using vvi = vector<vi>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

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;
}

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

#pragma endregion

void Main() {
    int X, Y;
    cin >> X >> Y;

    if (Y % 2 != 0) {
        cout << "No";
        return;
    }

    if (X * 4 < Y) {
        cout << "No";
        return;
    }
    if (X * 2 > Y) {
        cout << "No";
        return;
    }

    cout << "Yes";
}

#pragma region main
main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    cout << flush;
}
#pragma endregion


Measured memory_bytes: 3608
from sys import exit, stderr, stdin
input = stdin.readline
# setrecursionlimit(10**7)

def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    M, D = [int(n) for n in input().split()]
    ans = 0
    for i in range(2,10):
        for j in range(2,10):
            for m in range(1,M+1):
                if i*10 + j <= D and i*j == m:
                    ans += 1
    print(ans)



if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException{
		// TODO ?????????????????????????????????????????????
		BufferedReader x = new BufferedReader(new InputStreamReader(System.in));
		String str = x.readLine();
		int num = Integer.parseInt(str);
		 num = num*num*num;
		 
		 System.out.println(num);
		
		
	}

}

Measured memory_bytes: 24260
#include<bits/stdc++.h>
using namespace std;
long long dp[210][210],a[210][210];
long long t[9][9],v[9],g[9],vis[9],n,ans=1000100100,r;
void dfs(int m)
{
    if(m==r)
    {
        long long mn=0;
        for(int i=1;i<r;i++)
        {
            mn+=dp[g[i]][g[i-1]];
        }
        ans=min(ans,mn);
        return;
    }
    for(int i=0;i<r;i++)
    {
        if(vis[i])continue;
        vis[i]=1;
        g[m]=v[i];
        dfs(m+1);
        vis[i]=0;
    }
}
int main()
{
    cin.tie(0);ios_base::sync_with_stdio(false);
    int m,x,y,z;
    cin>>n>>m>>r;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
        dp[i][j]=1000100000;
    for(int i=0;i<r;i++)cin>>v[i];
    while(m--)
    {
        cin>>x>>y>>z;
        a[x][y]=a[y][x]=z;
        dp[x][y]=dp[y][x]=z;
    }
    for(int k=1;k<=n;k++)
    for(int i=1;i<=n;i++)
    for(int j=1;j<=n;j++)
    dp[i][j]=min(dp[i][k]+dp[k][j],dp[i][j]);
    dfs(0);
    cout<<ans<<endl;
return 0;
}



Measured memory_bytes: 896
import sys
A,B=map(int,input().split())
if B-A<100:
    s=0
    for i in range(A,B+1):
        s^=i
    print(s)
    sys.exit()
s=(A//4)*4+4
t=(B//4)*4
u=0
for i in range(A,s):
    u^=i
for i in range(t,B+1):
    u^=i
print(u)


Measured memory_bytes: 3060
s = int(input())
list = []
like = 753
while s > 0:
    list.append(s % 10)
    s //= 10
list.reverse()
list_1=[]
for i in range(len(list)-2):
    list_1.append(100*list[i]+10*list[i+1]+list[i+2])

list_2=[]
for i in range(len(list_1)):
    if like>list_1[i]:
        list_2.append(like-list_1[i])
    else:
        list_2.append(list_1[i]-like)
print(min(list_2))

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

typedef long long ll;

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<vector<int>> matrix(n, vector<int>(n, 0));
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        u--;
        for (int j = 0; j < k; j++) {
            int v;
            cin >> v;
            v--;
            matrix[u][v] = 1;
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << matrix[i][j];
            if (j != n - 1) {
                cout << " ";
            }
        }
        cout << endl;
    }
    return 0;
}




Measured memory_bytes: 3188
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int cnt = 0;
		for (int i=0;i<N;i++) {
			if ((i+1)%2==1) {
				cnt++;
			}
		}
		System.out.println((double)cnt/(double)N);
	}
}

Measured memory_bytes: 22100
#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<char> Vc;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<char>> VVc;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgset(st) cerr << #st << ":"<<endl; for (auto i = st.begin(); i != st.end(); ++i) { cerr << *i <<" ";}cerr<<endl;
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#else
#define dbg(...)
#define dbgmap(...)
#define dbgset(...)
#define dbgarr(...)
#define dbgdp(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int solve(){
    string s;
    cin>>s;
    bool ok = false;
    REP(i,1,s.length()){
        if(s[i-1]=='A' && s[i]=='C') ok = true;
    }
    Yes(ok);
    return  0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);
//    ll T;
//    cin>>T;
//    while(T--)
    solve();
}


Measured memory_bytes: 3652
import itertools

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


points = [i for i in range(1, N+1)]
ans = 0

for i, v in enumerate(list(itertools.permutations(points))):
    if not v[0] == 1:
        continue
    for j in range(N-1):
        if sorted([v[j], v[j+1]]) not in Paths:
            break
    else:  # このelseの使い方覚える
        ans += 1


print(ans)

Measured memory_bytes: 8052
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
 
  string s;
  cin>>s;

  int w;
  cin>>w;


  for(int i=0;i<s.size();i+=w){
    cout<<s.at(i);
  }
  cout<<endl;

	return 0;
}

Measured memory_bytes: 3588
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define speed                                                                  \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define oprecision                                                             \
  cout.precision(6);                                                           \
  cerr.precision(7);
#define bb bool
#define ii int
#define ll long long
#define ff float
#define dd double
#define cc char
#define ss string
#define forn(sz) for (int i = 1; i <= sz; i++)
#define forni(i, sz) for (int i = 1; i <= sz; i++)
#define fornid(i, m, sz) for (int i = m; i <= sz; i++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vii vector<ii>
#define vii64 vector<ll>
#define vb vector<bb>
using namespace std;
const int INF = 1000000005;
int n, w, ans, a[105], b[105], dp[500005];
int main() {
  speed;
  oprecision;
  // code
  cin >> n >> w;
  forn(n) cin >> a[i] >> b[i];
  dp[0] = 0;
  for (int i = 1; i <= 500005; i++)
    dp[i] = INF;
  forn(n) {
    for (int j = 100001; j >= 0; j--) {
      dp[j + b[i]] = min(dp[j + b[i]], dp[j] + a[i]);
    }
  }
  for (int i = 0; i <= 100001; i++) {
    if (dp[i] <= w)
      ans = i;
  }
  cout << ans;
  // endl
#ifndef ONLINE_JUDGE
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;

int main(){
    int A, B; cin >> A >> B;

    int C = A + B;
    if(C >= 24) {
        cout << C - 24 << endl;
    } else {
        cout << C << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

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

int main(void){
	int N,ans,i;
	scanf("%d",&N);
	int a[N],sum=0;
	for(i=0;i<N;i++){
		scanf("%d",&a[i]);
		sum += a[i];
	}
	qsort(a,N,sizeof(int),comp);
	int alice=0;
	for(i=N-1;i>=0;i-=2){
		alice += a[i];
	}
	
	
	ans = alice - (sum-alice);
	printf("%d",ans);
	return 0;}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n)	for(int i=0;i<n;i++)
#define srep(i,a,n)	for(int i=a;i<n;i++)
#define REP(i,n)	for(int i=0;i<=n;i++)
#define SREP(i,a,n)	for(int i=a;i<=n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define RREP(i,n)	for(int i=n;i>=0;i--)
using namespace std;
typedef long long ll;
int N, W, V_[100], W_[100];
int memo[100][10001];
int rec(int id, int w) {
	if (id == N) return 0;
	if (w < 0) return 0;
	if (memo[id][w] != -1) return memo[id][w];
	int coe = w < W_[id] ? 0 : 1;
	return memo[id][w] = max(rec(id + 1, w), (rec(id + 1, w - W_[id]) + V_[id]) * coe);
}
int main(void) {
	cin >> N >> W;
	rep(i, N) cin >> V_[i] >> W_[i];
	rep(i, N) REP(j, W) memo[i][j] = -1;
	cout << rec(0, W) << endl;
	return 0;
}

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

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

  double count = 0.0;
  for(int i = 1; i <= N; i++){
    if(i%2 == 1){
      count += 1.0;
    }
  }

  double ans = count/N;
  cout << ans << endl;
}


Measured memory_bytes: 256
import kotlin.math.max
import kotlin.math.min

fun main() {
    var (a,b,c,x,y)= readLine()!!.split(" ").map { it.toInt() }
    if (2*c<a+b){
        var tmp= min(x,y)
        if (((x-tmp)!=0 && 2*c<a)||(y-tmp)!=0 && 2*c<b){
            println(2* max(x,y)*c)
        }else{
            println((x-tmp)*a+(y-tmp)*b+2*tmp*c)
        }
    }else{
        println(a*x+b*y)
    }
}

Measured memory_bytes: 36488
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    int k;
    scanf("%d", &k);
    int ans;
    ans = max(a,max(b,c));
    int mul = 1;
    for(int i = 0; i < k; i++){
        mul *= 2;
    }
    
    ans = (a + b + c - ans) + ans * mul; 
    printf("%d\n", ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i,  n) for (int i  =  0; i < (int)(n); ++i)
#define FOR(i, s, n) for (int i  =  s; i < (int)(n); ++i)
#define REPR(i,  n) for (int i  =  n - 1; i >= 0; --i)
using namespace std;
#define int long long int
//------------ATCODER TEMPLATE-------------

signed main() {
  int N; cin >> N;
  int cnt = 0;
  FOR(i, 1, N) {
    int x = ceil((double)N/ i);
    cnt += x - 1;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3760
n=int(input())
hs=list(map(int,input().split()))
dp=[float("inf")]*n
dp[0]=0

for i in range(1,n):
  dp[i]=min(dp[i],dp[i-1]+abs(hs[i]-hs[i-1]))
  if i-2<0: continue
  dp[i]=min(dp[i],dp[i-2]+abs(hs[i]-hs[i-2]))

print(dp[n-1])

Measured memory_bytes: 20496
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    struct Point
    {
        public int[] array;
        public Point(int[] array)
        {
            this.array = array; 
        }
    }

    static void Main()
    {
        var nd = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
        var N = nd[0];
        var D = nd[1];
        var point = new Point[N];
        for(int i = 0; i < N; ++i)
        {
            var x= Console.ReadLine().Split(' ').Select(n => Int32.Parse(n)).ToArray();
            point[i] = new Point(x);
        }

        var count = 0;
        for (int i=0;i<N;++i)
        {
            for (int j=i+1;j<N;++j)
            {
                var distance = 0;
                for (int k=0;k<D;++k)
                {
                    distance += (point[i].array[k] - point[j].array[k]) * (point[i].array[k] - point[j].array[k]);
                }
                var temp = Math.Sqrt(distance);
                if (temp == (int)temp) count++;
                
            }
        }

        Console.WriteLine(count);
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define ps puts("")
#define fi first
#define nd second
#define mset(x) memset((x), 0, sizeof (x))
#define mk make_pair
#define sqr(x) ((x)*(x))
#define pii pair<int,int>
#define lch (o<<1)
#define rch (o<<1|1)
using namespace std;
typedef long long ll;
ll read() {ll x = 0;char f = 1, ch = getchar();while(ch < '0' || ch > '9') {if(ch == '-')f = -1;
ch = getchar();}while(ch >= '0' && ch <= '9') {x = x * 10 + ch - '0';ch = getchar();}return x * f;}
void write(ll x) {if(x < 0) x = -x, putchar('-');if(x > 9) write(x / 10);putchar(x % 10 + '0');}
inline void writeln(ll x) {write(x);puts("");}
const int N = 400000, M = 1550000;
int n, m;
ll cnt[N];
ll ans;
int main() {
	n = read(), m = read();
	for(int i = 1; i <= n; ++i)
		++cnt[i % m];
	for(int i = 0; i <= m; ++i)
		if(i  * 2 % m == 0)
			ans += cnt[i] * cnt[i] * cnt[i];
	writeln(ans);
	return 0;
}

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

const int maxn = 2000010;
int n, ans[maxn];
char s[maxn];

namespace TRIE {
int tot = 1, num[maxn], ch[maxn][3], tag[maxn];

void pushdown(int k) {
    swap(ch[k][1], ch[k][2]), tag[k] = 0;
    for (int i = 0; i < 3; i++) tag[ch[k][i]] ^= 1;
}

void ins(int x) {
    int cur = 1, y = x;
    for (int i = n; i; i--, x /= 3) {
        int c = x % 3;
        if (!ch[cur][c]) ch[cur][c] = ++tot;
        cur = ch[cur][c];
    }
    num[cur] = y + 1;
}

void inc() {
    int cur = 1;
    for (int i = 1; i <= n; i++) {
        if (tag[cur]) pushdown(cur);
        swap(ch[cur][0], ch[cur][2]), swap(ch[cur][1], ch[cur][2]);
        cur = ch[cur][0];
    }
}

void dfs(int k, int pos = 0, int w = 1) {
    if (tag[k]) pushdown(k);
    if (num[k]) { ans[num[k] - 1] = pos; return; }
    for (int i = 0; i < 3; i++) dfs(ch[k][i], pos + i * w, w * 3);
}
}  // namespace TRIE

int main() {
    scanf("%d %s", &n, s + 1);
    int tot = pow(3, n);
    for (int i = 0; i < tot; i++) {
        TRIE::ins(i);
    }
    for (int i = 1, l = strlen(s + 1); i <= l; i++) {
        if (s[i] == 'S') TRIE::tag[1] ^= 1;
        else TRIE::inc();
    }
    TRIE::dfs(1);
    for (int i = 0; i < tot; i++) {
        printf("%d ", ans[i]);
    }
    return 0;
}

Measured memory_bytes: 21996
#include <cstdio>
using namespace std;
int main(){
  int k,s,c,i;
  while(1){
    scanf("%d",&k);
    if (!k) break;
    for(i=0,s=0;i<k*(k-1)/2;i++)
      scanf("%d",&c),s+=c;
    printf("%d\n",s/(k-1));
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int n,m,num;
struct data
{
	int l,r; 
}a[100100];
bool cmp(data a,data b)
{
	return (a.l<b.l)||(a.l==b.l&&a.r>b.r);
}
int main()
{
	cin>>n>>m;
	for (int i=1;i<=m;i++)
	{
		cin>>a[i].l>>a[i].r;
	}
	sort(a+1,a+1+m,cmp);
	int s=0,l=a[1].l,r=a[1].r;
	a[m+1].l=0;a[m+1].r=n+1;
	for (int i=1;i<=m+1;i++)
	{
		if(a[i].l>=l&&a[i].l<r||a[i].r>l&&a[i].r<=r)
		{
			l=max(l,a[i].l);r=min(r,a[i].r);
		}
		else
		{
		  l=a[i].l;r=a[i].r;num++;
	    }
	}
	cout<<num<<endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long x[] = new long[N];
		long y[] = new long[N];
		for(int i = 0; i < N; i++) {
			x[i] = sc.nextLong();
			y[i] = sc.nextLong();
		}
		
		long ans = Long.MAX_VALUE;
		for(int left = 0; left < N; left++) {
			for(int right = 0; right < N; right++) {
				for(int up = 0; up < N; up++) {
					for(int down = 0; down < N; down++) {
						int cnt = 0;
						for(int i = 0; i < N; i++) {
							if(x[left] <= x[i] && x[i] <= x[right] && y[i] <= y[up] && y[down] <= y[i]) {
								cnt++;
							}
						}
						if(cnt >= K) {
							ans = Math.min(ans, Math.abs(x[left] - x[right]) * Math.abs(y[up] - y[down]));
						}
					}
				}
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 24532