akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){

	int X, Y, Z; cin >> X >> Y >> Z;
	int ans = (X-Z)/(Y+Z);
	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
N=int(input())
a=[0 for i in range(N)]
st=input().split()
for i in range(N):
    a[i]=int(st[i])
aa=sorted(a)
count=0
nowp=aa[0]
aa.append(10**9+1)
nowcount=1
for i in range(1,N+1):
    if aa[i-1]==aa[i]:
        nowcount+=1
    else:
        nowp=aa[i]
        if nowcount<aa[i-1]:
            count+=nowcount
        else:
            count+=nowcount-aa[i-1]
        nowcount=1
print(count)



Measured memory_bytes: 15688
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

char a,b,c,d,e,f,g;

int main()
{
	a=getchar();
	b=getchar();
	c=getchar();
	d=getchar();
	e=getchar();
	f=getchar();
	g=getchar();
	if(a == g && b==f && c==e)
		printf("YES");
	else
		printf("NO");
    return 0;
}


Measured memory_bytes: 128
fn main() {
    let n = read::<u64>();

    let mut a = 2u64;
    let mut b = 1u64;
    let mut tmp;
    for _ in 1..n + 1 {
        tmp = b;
        b = a + b;
        a = tmp;
    }
    println!("{}", a);
}

#[allow(dead_code)]
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()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
n, w = map(int, input().split())

import numpy as np 

dp = np.full(1000*n+1, w+1, dtype=int)

dp[0] = 0

for i in range(n):
    weight, value = map(int, input().split())
    dp[value:] = np.minimum(dp[value:], dp[:-value] + weight)

print(np.max(np.where(dp <= w)))

Measured memory_bytes: 14908
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
const ll MOD = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (b / a >= c)
		cout << c;
	else
		cout << b / a;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define MOD 1000000007
int main()
{
    int i,n,a[100000],x,flag=0,sum;
    memset(a,0,sizeof(a));
    scanf("%d",&n);
    for(i=1;n>=i;i++)
    {
        scanf("%d",&x);
        a[x]++;
    }
    if(n%2==0)
    {
        for(i=1;n>i;i++)
        {
            if(i%2==1&&a[i]!=2)
            {
                flag=1;
                break;
            }
            else if(i%2==0&&a[i]!=0)
            {
                flag=1;
                break;
            }
        }
    }
    else
    {
        for(i=0;n>i;i++)
        {
            if(i==0&&a[i]!=1)
            {
                flag=1;
                break;
            }
            else if(i!=0&&i%2==0&&a[i]!=2)
            {
                flag=1;
                break;
            }
            else if(i%2==1&&a[i]!=0)
            {
                flag=1;
                break;
            }
        }
    }
    if(flag==1)
    {
        printf("0\n");
    }
    else
    {
        sum=1;
        for(i=1;n/2>=i;i++)
        {
            sum=(sum*2)%MOD;
        }
        printf("%d\n",sum);
    }
    return 0;
}

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

int main() {
  // ここにプログラムを追記
  int n = 0; 
  int sum_of_cell = 0;
  int remain_cell = 0;
  int select_cell = 0;
  
  cin >> n;
  cin >> select_cell;
  sum_of_cell = n*n;
  remain_cell = sum_of_cell - select_cell;
  
  cout << remain_cell << endl;
}

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

using namespace std;

vector<pair<int, int> > G[101010];
int ans[101010];
void dfs(int a, int ta, int c) {
	ans[a] = c;
	for (auto x : G[a]) {
		if (x.first != ta) 
			dfs(x.first, a, x.second ^ c);
	}
}


int main() {
	int V;
	cin >> V;
	for (int i = 0; i < V - 1; i++) {
		int s, t, c;
		cin >> s >> t >> c;
		G[s].emplace_back(t, c % 2);// c even -> 0
		G[t].emplace_back(s, c % 2); 
	}
	dfs(1, -1, 0);
	for (int i = 1; i <= V; i++)
		cout << ans[i] <<endl;
	return 0;
}



Measured memory_bytes: 8448
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>pii;
typedef pair<long long, long long>pll;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7; constexpr int MAX = 100050;
const double pi = acos(-1); constexpr double EPS = 1e-12;
constexpr ll INF = 1e16;
void yes(bool c) { if (c)print("Yes"); else print("No"); };


void solve() {
	int A, B, C; cin >> A >> B >> C;
	int K; cin >> K;
	int ans = 0;
	if (A >= K) {
		ans += K;
		K = 0;
	}
	else {
		ans += A;
		K -= A;
	}
	if (B >= K)K = 0;
	else K -= B;
	if (K)ans -= K;
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <numeric>


template <typename DataType>
auto convert(const std::string& data_str) -> DataType {
	std::stringstream ss;
	DataType ret {};

	ss << data_str;
	ss >> ret;

	return ret;
}




auto input() {
	int H, N;
	std::cin >> H >> N;
	return std::make_pair(H,N);
}


auto split(const std::string& str) {
	std::vector<std::string> ret {};

	std::size_t currentp {}, nextp {};
	while(true) {
		nextp = str.find_first_of(' ', currentp);

		ret.push_back(str.substr(currentp, nextp-currentp));
		
		if(nextp == std::string::npos)
			break;
		
		currentp = nextp + 1;
	}

	return ret;
}


auto extract(const std::string& str) {
	std::vector<int> skill_set {};

	for(auto&& s : split(str))
		skill_set.push_back(convert<int>(s));

	return skill_set;
}


auto judge(int H, const std::vector<int>& skill_set) {
	return std::accumulate(skill_set.begin(), skill_set.end(), 0) >= H;
}


void process() {
	auto data = input();

	std::string s;
	std::getline(std::cin, s);
	std::getline(std::cin, s);

	auto skill_set = extract(s);

	std::cout << (judge(data.first, skill_set) ? "Yes" : "No") << std::endl;
}

int main() {
	process();
}


Measured memory_bytes: 7168
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int ans = 0;
		for (int i=0; i<3; i++) {
			if (S.charAt(i) == T.charAt(i)) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
#include <stdio.h>
 
int main(void) {
	char str[100001];
	fgets(str,100001,stdin);
	unsigned long zero,one,ans,index;
	zero = 0;
	one = 0;
	for (index=0;index<100001;index++) {
		if (str[index]=='0') zero++;
		else if (str[index]=='1') one++;
		else break;
	}
	ans = ((zero<one)?zero:one)*2;
	printf("%ld\n",ans);
 
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

    char[] s = scanner.next().toCharArray();
    char[] t = scanner.next().toCharArray();
    int count = 0;
    for (int i = 0; i < 3; i++) {
      if (s[i] == t[i]) count++;
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 21716
import scala.math.{min,max}

object Main {
    def main(args: Array[String]) {
        var input = io.Source.stdin.getLines().mkString("\n");
        // val xs = input.split('\n').map(_.toInt).toArray;
        var ss = input.split('\n').toList;
        val s = ss(0);
        val res = if (s(0) == 'A') {
            'T'
        }
        else if (s(0) == 'T') {
            'A'
        }
        else if (s(0) == 'G') {
            'C'
        }
        else {
            'G'
        };
        println(res);
    }
    def to_array_int(s: String): Array[Int] = {
        return s.split(' ').map(_.toInt).toArray;
    }
}


Measured memory_bytes: 25372
/******************************************************************************
 
рассвет. 
 
*******************************************************************************/
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int> 
#define vplli vector <pair <lli,lli> >
#define vpulli vector <pair <ulli,ulli> >
#define vvi vector <vector <int> >
#define vvlli vector <vector <lli> >
#define vvpii vector <vector <pair <int,int>> >
#define fr(i,n) for (int i = 0; i < (n); ++i)
#define frbig(i,n) for (lli i = 0; i < (n); ++i)
#define fra(i,a,n) for (lli i = a; i < (n); ++i)
#define run(c,s) for(auto c:s) 
#define read(n) int n; cin >> n;
#define readchar(n) char n; cin >> n;
#define readstr(n) string n; cin >> n;
#define readarr(a,n) fr(i,n) cin >> a[i];
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
 
const lli MOD=1e9+7;
const lli MAXN=1e6+1;
const ld PI=acos(-1);
 
int main(){
    rapgame
    read2ll(n,k);
    lli ans=0;
    fra(i,k,n+2){
        ans+=n*i-(i-1)*i+1;
        ans%=MOD;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <iterator>
#pragma warning(disable:4996)

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long n, x;
    scanf("%ld %ld", &n, &x);
    
    long a[105]={0};
    long i;
    long sum=0;
    for(i=0; i<n; i++) {
        scanf("%ld", &(a[i]));
        sum+=a[i];
    }
    sort(a+0, a+n);

    printf("%ld\n", (x-sum)/a[0]+n);

    return 0;
}


Measured memory_bytes: 128
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int n,x,p=0,ans=1; cin>>n>>x;
    vector<int> l(n,0);
    rep(i,n) cin>>l[i];
    int i=0;
    while(p<=x){
        p+=l[i];
        if(p<=x) ans++;
        i++;
        if(i==n) break;
    }
    cout<<ans<<endl;
}

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

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;

set<int> mergeSet(set<int> s1, set<int> s2) {
	for (int ele : s2) {
		s1.insert(ele);
	}
	return s1;
}


void solve() {
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif

	int n;
	cin >> n;
	int i = 1, s = 0;
	while (s < n) {
		s += i;
		i++;
	}
	for (int j = 1; j < i; j++) {
		if (s - n != j) cout << j << endl;
	}
}




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


	solve();
#ifdef _WIN32
	system("PAUSE");
#endif
	return 0;
}

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

using ll = long long;

int main()
{
  ll a, b;
  std::cin >> a >> b;

  ll num = 1LL;
  ll max_value = std::min(0LL, b);
  for (ll i = a; i <= max_value; i++) {
    if (i < 0) num *= -1;
    if (i == 0) num = 0LL;
  }

  std::string ans = "Zero";
  if (num > 0) ans = "Positive";
  if (num < 0) ans = "Negative";
  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  int n; cin >> n;
  vector<int> a(n+1),b(n+1);
  REP(i,n) cin >> a[i+1];

  vector<int> ans;
  for (int i=n; i>0; i--) {
    int sum = 0;
    for(int j=i*2; j<=n; j+=i) sum+=b[j];
    if (sum%2 != a[i]) { b[i]++; ans.push_back(i); }
  }
  COUT(ans.size());
  reverse(ALL(ans));
  REP(i,ans.size()) {
    cout << ans[ans.size()-i-1] << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 5288
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
ll kai[200001];
ll gyaku[200001];

//aのp乗を求める
ll jou(ll a,ll p)
{
	ll ret=1;
	ll b2[40];
	b2[0]=a;
	for(int i=1;i<40;i++)
	{
		b2[i]=b2[i-1]*b2[i-1];
		b2[i]%=MOD;
		if(b2[i]<0)
			b2[i]+=MOD;
	}

	for(ll bit=0;bit<40;bit++)
	{
		ll tmp=(p&(1LL<<bit));
		if(tmp>0)
		{
			ret*=b2[bit];
			ret%=MOD;
			if(ret<0)
				ret+=MOD;
		}
	}
	return ret;
}

int main()
{
	int n,m,k;
	ll ans=0;
	int cnt=0;
	cin>>n>>m>>k;
	//階乗
	kai[0]=1;
	for(ll i=1;i<200001;i++)
	{
		kai[i]=kai[i-1]*i;
		kai[i]%=MOD;
		if(kai[i]<0)
			kai[i]+=MOD;
	}
	//逆元
	for(int i=0;i<200001;i++)
		gyaku[i]=jou(kai[i],MOD-2);
	
	for(int i=1;i<n*m;i++)
	{
		ll tmp=abs(i%m-0%m)+abs(i/m-0/m);//コストを求める
		//cerr<<tmp<<" ";
		tmp*=kai[n*m-2];
		tmp%=MOD;
		tmp*=gyaku[k-2];
		tmp%=MOD;
		tmp*=gyaku[n*m-k];
		tmp%=MOD;
		//cerr<<tmp<<endl;
		//個数はこの四角形が入る個数分
		tmp*=(ll)(m-i%m);
		tmp%=MOD;
		tmp*=(ll)(n-i/m);
		tmp%=MOD;
		if(i%m>0 && i/m>0)
			tmp*=2;
		tmp%=MOD;
		if(tmp<0)
			tmp+=MOD;
		ans+=tmp;
		ans%=MOD;
	}
	if(ans<0)
		ans+=MOD;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair <int, int>
#define iiii pair <int, pii >
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i, x) for(int (i) = 0; (i) < (x); (i)++)
inline int getint() {
  int x = 0, p = 1; char c = getchar();	
  while (c <= 32) c = getchar();
  if (c == 45) p = -p, c = getchar();
  while (c > 32) x = x * 10 + c - 48, c = getchar();
  return x * p;
}
using namespace std;
//ruogu_alter
const int B = 6005;
int n, mod, f[B][B << 1];
//
void reduce(int &x) { x += x >> 31 & mod; }
int mul(int x, int y) { return 1ll * x * y % mod; }
int main() {
  n = getint(); mod = getint();
  f[3 * n][B] = 1;
  for (int i = 3 * n; i > 0; i--) {
    rep(j, B << 1) if (f[i][j]) {
      reduce(f[i - 1][j + 1] += f[i][j] - mod);
      if (i >= 2 && j >= 1) reduce(f[i - 2][j - 1] += mul(f[i][j], i - 1) - mod);
      if (i >= 3) {
        reduce(f[i - 3][j] += mul(f[i][j], (i - 1) * (i - 2)) - mod);
      }
    }
  }
  int res = 0;
  for (int i = B; i < (B << 1); i++) {
    reduce(res += f[0][i] - mod);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 280576
using System;

namespace py
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] a = new string[2];
            a = Console.ReadLine().Split(' ');
            int n = int.Parse(a[0]);
            int m = int.Parse(a[1]);
            if (m == n)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13140
#include<stdio.h>
#include<math.h>

typedef struct {
	double x;
	double y;
}Point_t;

void koch(int n, Point_t a, Point_t b){
	if(n==0)return;
	Point_t s,t,u;
	double th=M_PI*60.0/180.0;
	
	s.x=(2.0*a.x+1.0*b.x)/3.0;
	s.y=(2.0*a.y+1.0*b.y)/3.0;
	t.x=(1.0*a.x+2.0*b.x)/3.0;
	t.y=(1.0*a.y+2.0*b.y)/3.0;
	u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
	u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;
	
	koch(n-1,a,s);
	printf("%.8f %.8f\n",s.x,s.y);
	koch(n-1,s,u);
	printf("%.8f %.8f\n",u.x,u.y);
	koch(n-1,u,t);
	printf("%.8f %.8f\n",t.x,t.y);
	koch(n-1,t,b);
}

int main(void){
	Point_t a,b;
	int n;
	
	scanf("%d",&n);
	a.x=0;
	a.y=0;
	b.x=100;
	b.y=0;
	
	printf("%.8f %.8f\n",a.x,a.y);
	koch(n,a,b);
	printf("%.8f %.8f\n",b.x,b.y);
	
	return 0;
}


Measured memory_bytes: 2048
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n, k = [int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    if n == k:
        print(1)
    else:
        ans = ((n + (k - 3)) // (k-1))
        print(ans)
        

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""


Measured memory_bytes: 20840
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

int imos[501][501];

int main(){
  int N,M,Q,L,R;
  cin >> N >> M >> Q;
  vector<pair<int,int>> que;
  FOR(i,0,M){
    cin >> L >> R;
    imos[L][R]++;
  }
  FOR(i,0,Q){
    cin >> L >> R;
    que.push_back(make_pair(L,R));
  }
  FOR(i,0,501)FOR(j,1,501){
    imos[i][j] += imos[i][j-1];
  }
  FOR(i,0,501)FOR(j,1,501){
    imos[i][j] += imos[i-1][j];
  }
  for(auto q:que){
    cout << imos[N][q.second] - imos[q.first-1][q.second] << endl;
  }
}


Measured memory_bytes: 2804
#include <stdio.h>
#include <string.h>

int main(void){
  char s[1005];
  int l=0;
  scanf("%s", s);
  l = strlen(s);
  
  if(s[l-1]=='s'){
    //s = s+'es';
    printf("%s%s", s,"es");
  }
  else{
    //s = s+'s';
    printf("%s%s", s,"s");
  }
  return 0;
}
  

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head 
int main() {
	int d,s,t;
	scanf("%d%d%d",&d,&t,&s);
	if(t*s>=d)printf("Yes");
	else printf("No"); 
} 

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

using namespace std;

typedef long long ll;
typedef vector<int> vi; 
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define contains(i, c) ((c).find(i) != (c).end())

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i <= n; i++)
#define repa(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, n) for(int i = (n)-1; i >= 0; i--)

#define TRACE(x...) x
#define watch(x) TRACE(cerr << #x" = " << x << endl)
#define watch_all(x) TRACE(cerr << #x" = "; for(auto __i : x) cerr << __i << " "; cerr << endl)

//=========================

void run_test() {
	string s;
    cin >> s;
    int n = sz(s);
    rep(i, n) if(s[i] == '?') s[i] = 'D';
    cout << s << endl;
}

//=========================

ifstream infile;
clock_t start__;
void open_func();
void close_func();

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	open_func();
	//int t = 1, _t; cin >> _t; while(t <= _t) { cout << "Case #" << t++ << ": "; run_test(); }
	//int t; cin >> t; while(t--) run_test();
	run_test();
	close_func();
	return 0;	
}

void open_func() {
	//infile = ifstream("input.in"); if(infile.good()) cin.rdbuf(infile.rdbuf());
	start__ = clock();
	cerr << "---" << endl;
}

void close_func() {
	clock_t elapsed = clock()-start__;
	cerr << "---" << endl << "(time " << fixed << setprecision(2) << elapsed * (1.0/CLOCKS_PER_SEC) << "s)" << endl;	
	//if(infile.good()) infile.close();
}


Measured memory_bytes: 3872
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
#define INF 2000000000
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
/*覚えてないことメモ
数値型から文字列に変換　to_string(number);これは簡単
文字列から数値型に変換　stoi(number)
文字列からllに変換　stoll(number)*/

//ここから書き始める
int main(){
	int n ; cin >> n;
	vector<string> S(n);
	rep(i,n){
		string s; 
		cin>>s;
		SORT(s);
		S[i]=s;
	}
	SORT(S);
//	rep(i,n){
//		che(S[i],"si");
//	}
	ll ans = 0;
	ll count = 1;
	rep(i,n-1){
		if(S[i+1]==S[i]){
			count++;	
		}
		else{
			ans+= count*(count-1)/2 ;
			count = 1;
		}
	}
	ans+=count*(count-1)/2;
	cout<<ans<<endl;
}


Measured memory_bytes: 5760
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
    int h,w;cin>>h>>w;
    string g[60];rep(i,h)cin>>g[i];
    int cnt=0;
    rep(i,h)rep(j,w)if(g[i][j]=='.')++cnt;
    vector<vector<int>> f(h,vector<int>(w,-1));
    f[0][0]=1;
    queue<pair<int,int>> q;
    q.push({0,0});
    int d[4]={1,0,-1,0};
    while(!q.empty()){
        int x=q.front().first;
        int y=q.front().second;
        q.pop();
        rep(i,4){
            int nx=x+d[i];
            int ny=y+d[i^1];
            if(0<=nx&&nx<h&&0<=ny&&ny<w&&g[nx][ny]=='.'&&f[nx][ny]==-1){
                q.push({nx,ny});
                f[nx][ny]=f[x][y]+1;
            }
        }
    }
    if(f[h-1][w-1]==-1)cout<<-1<<endl;
    else cout<<cnt-f[h-1][w-1]<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = (int)1e9+7;


int h,w;
vector< vector<char> > a(20,vector<char>(20));

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

void check(int sx, int sy){
	
	vector<vector<int> > dist(20,vector<int>(20,-1));
	queue<pair<int,int> > q;
	q.push({sx,sy});
	dist[sx][sy] = 0;
	
	auto valid =[&](int i,int j){
		return i>=0 && i< h && j>=0 && j<w && (dist[i][j]==-1) && (a[i][j]!='#');
	};
	
	while(!q.empty()){
		pair<int,int> ss = q.front();
		int px = ss.first;
		int py = ss.second;
		q.pop();
		for(int i=0;i<4;i++){
			int gx = px + dx[i];
			int gy = py + dy[i];
			if(valid(gx,gy)){
				dist[gx][gy] = 1 + dist[px][py];
				ans = max(ans,dist[gx][gy]);
				q.push({gx,gy});
			}
		}
	}
}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	
	cin>>h>>w;
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++)
			cin>>a[i][j];
	}
	
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(a[i][j]=='.')
				check(i,j);
		}
	}
	cout<<ans;
	
	return 0;
}
	
	
	
	
	
	
	
	
	
	
	

























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

int main() {
  long X, K, D;
  cin >> X >> K >> D;

  X = abs(X);
  long tmp = min(X/D, K);
  X -= tmp*D;
  K -= tmp;
  if(K % 2 == 1){
    X = D - X;
  }

  cout << X << endl;
}


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

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

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int a[100002];
int b[100002];
int n;
 
int main() {
	cin >> n;
	for(int i = 1; i <= n; i++)
		b[i] = 0;
	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
 
	int cnt = 0;
	for(int i = 1; i <= n; i++) {
		if(b[i] == 1) continue;
		if(a[a[i]] == i) {
			cnt++;
			b[a[i]] = 1;
		}
	}
 
	printf("%d", cnt);
 
	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define RG register
#define LL long long
using namespace std;
const int N=1e5+10;
struct node{
	int col,id; LL tim;
}pt[N];
int n,m,cnt[N],ans[N][15];
template<typename I> inline void read(I &ot){
	I ch=getchar(), x=0, f=1;
	while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();	}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();	}
	ot=x*f;}
template<typename I, typename... U> inline void read(I &x,U&... y){read(x); read(y...);}
inline bool cmp(node a,node b){
	return a.col==b.col ? a.tim<b.tim : a.col<b.col;
}
template<typename I>inline I goon(I x)
{
	I tt=0;
	while(x)
	{
		x/=10;
		tt++;
	}
	return tt;
}
int main()
{
	//freopen("ID.in","r",stdin);
	//freopen(".out","w",stdout);
	read(n,m);
	for(int i=1;i<=m;i++)
	{
		read(pt[i].col,pt[i].tim);
		pt[i].id=i;
	}
	sort(pt+1,pt+1+m,cmp);
	for(int i=1;i<=m;i++)
	{
		int oo=0;
		cnt[pt[i].col]++;
		int tt1=goon(pt[i].col), tt2=goon(cnt[pt[i].col]);
		for(int j=1;j<=6-tt1;j++) ans[pt[i].id][++oo]=0;
		LL re=pt[i].col;
		oo=7;
		while(re)
		{
			ans[pt[i].id][--oo]=re%10;
			re/=10;
		}
		oo=6;
		for(int j=1;j<=6-tt2;j++) ans[pt[i].id][++oo]=0;
		re=cnt[pt[i].col];
		oo=13;
		while(re)
		{
			ans[pt[i].id][--oo]=re%10;
			re/=10;
		}
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=1;j<=12;j++) printf("%d",ans[i][j]);
		printf("\n");
	}
	//fclose(stdin); fclose(stdout);
	return 0;
}

Measured memory_bytes: 9344
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
using namespace std;
#define MOD 1000000007

int N;
vector<vector<int>> G;
long long dp[100001][2];

void dfs(int x, int y){
    int cnt = 0;
    long long white = 1;
    long long black = 1;
    for(int z : G[y]){
        if(z == x) continue;
        dfs(y, z);
        white *= (dp[z][0]+dp[z][1])%MOD;
        black *= dp[z][0];
        white %= MOD;
        black %= MOD;
    }
    dp[y][0] = white;
    dp[y][1] = black;
}

int main(){
    cin >> N;
    G.resize(N);
    for(int i=0; i<N-1; i++){
        int x, y;
        cin >> x >> y;
        x--; y--;
        G[x].push_back(y);
        G[y].push_back(x);
    }
    dfs(-1, 0);
    long long ans = (dp[0][0]+dp[0][1])%MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;
typedef vector<int> vec;

string rot(string s){
  string ans = "";
  int n = s.size();
  ans.push_back(s[n-1]);
  rep(i,n-1) ans.push_back(s[i]);
  return ans;
}

int main(){
  
  string s,t;
  cin >> s >> t;
  
  int n = s.size();
  
  rep(i,n){
    if(s == t){
      cout << "Yes" << endl;
      return 0;
    }
    s = rot(s);
  }
  cout << "No" << endl;
}

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

int n;
long long total;
std::vector<int> d;
std::vector<int> cur;
int k = 2;

void combination_cnt(int start, int cnt){
    if(cnt == k){
        total += d[cur[0]] * d[cur[1]];
        return;
    }
    for(int i = start; i < n; i++){
        cur.push_back(i);
        combination_cnt(i+1, cnt+1);
        cur.pop_back();
    }
}

int main(void){
    std::cin >> n;
    d.resize(n);
    for(int i = 0; i < n; i++){
        std::cin >> d[i];
    }
    combination_cnt(0, 0);
    std::cout << total << std::endl;

    return 0;
}

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

int main(void){
    int N,K,i;
    cin>>N>>K;
    vector<int> D(K);
    for (int i=0;i<K;i++){
        cin>>D.at(i);
    }
    for (i=N;i<100000;i++){
        int tmp =i;
        set<int> s;
        while(tmp!=0){
            s.insert(tmp%10);
            tmp=tmp/10;
        }
        bool flag = true;
        for(int j=0;j<K;j++){
            if(s.count(D.at(j))){
                flag = false;
            }
        }
        if (flag){
            cout<<i<<endl;
            break;
        }
    }
}

Measured memory_bytes: 256
N=input()
a=0
for i in range(8):
    t=list(format(i,"b"))
    a=[-1]*3
    for j in range(len(t)):
        if(int(t[len(t)-j-1])==1):
            a[j]=1
    
    if((int(N[0])+int(N[1])*a[0]+int(N[2])*a[1]+int(N[3])*a[2])==7):
        print(N[0],end="")
        if(a[0]==1):
            print("+",end="")
        else:
            print("-",end="")
        print(N[1],end="")
        if(a[1]==1):
            print("+",end="")
        else:
            print("-",end="")
        print(N[2],end="")
        if(a[2]==1):
            print("+",end="")
        else:
            print("-",end="")
        print(N[3],end="")    
        print("=7")
        exit()


Measured memory_bytes: 38256
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#define INF 1000000007
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
signed main(){
    int n;
    cin>>n;
    int a[114514],b[114514];
    for(int i=0;i<=n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]>b[i]){
            ans+=b[i];
            a[i]-=b[i];
            b[i]=0;
        }else{
            ans+=a[i];
            b[i]-=a[i];
            if(a[i+1]>b[i]){
                ans+=b[i];
                a[i+1]-=b[i];
                b[i]=0;
            }else{
                ans+=a[i+1];
                a[i+1]=0;
                b[i]-=a[i];
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
      	int b = sc.nextInt();
      	int c = sc.nextInt();
      
      if(a+b==c||a+c==b||b+c==a){
        System.out.print("Yes");
      }else{
        System.out.print("No");
      }
      
    }
}

Measured memory_bytes: 21588
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

void ABC089D()
{
	int H, W, D;
	cin >> H >> W >> D;
	int N = H * W;
	map<int, pair<int, int> > loc;
	for (int i = 0; i < H; ++i)
	{
		for (int j = 0; j < W; ++j)
		{
			int x;
			cin >> x;
			loc[x] = { i,j };
		}
	}

	vector<vector<ull> > dist(D);
	for (int i = 0; i < D; ++i)
	{
		auto& x = dist[i]; x.reserve(N / D + 1);
		ull d = 0;
		x.push_back(0);
		for (int j = i; j < N - D; j += D)
		{
			int p = j;
			int q = j + D;
			auto p1 = loc.find(p + 1)->second;
			auto q1 = loc.find(q + 1)->second;
			int theDist = abs(p1.first - q1.first) + abs(p1.second - q1.second);
			d += theDist;
			x.push_back(d);
		}
	}
	int Q;
	cin >> Q;
	for (int i = 0; i < Q; ++i)
	{
		int L, R;
		cin >> L >> R;
		int base = (L - 1) % D;
		int begin = (L - 1) / D;
		int n = (R - L) / D;
		int end = begin + n;
		ull theD = dist[base][end] - dist[base][begin];
		cout << theD << endl;
	}

}

int main()
{
	ABC089D();
	return 0;
}

Measured memory_bytes: 11008
n = int(input())
t = [0]+list(map(int,input().split()))
v = [0]+list(map(int,input().split()))

left = [0]*(n+1)
right = [0]*(n+1)

for i in range(1,n):
    s = left[i-1]
    left[i] = min(s+t[i],v[i],v[i+1])
for i in range(n-1,0,-1):
    s = right[i+1]
    right[i] = min(s+t[i+1],v[i],v[i+1])

ad = [min(x,y) for x,y in zip(left,right)]

def cal(le,ri,t,v):
    x = v-le+v-ri
    if x >= t:
        v = (le+ri+t)/2
        x = t
    d = (le+v)*(v-le)/2
    d += v*(t-x)
    d += (ri+v)*(v-ri)/2
    return d

ans = 0
for i in range(1,n+1):
    ans += cal(ad[i-1],ad[i],t[i],v[i])
print(ans)

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

int main(void)
{
	string instr;
	int N;

	cin >> N;

	while(N--, N >= 0){
		int out = 0;
		int pos[4] = {};

		while(out < 3){
			cin >> instr;

			if(instr == "HIT"){
				if(pos[2]){
					pos[3] += pos[2];
					pos[2] = 0;
				}
				swap(pos[2],pos[1]);
				swap(pos[1],pos[0]);
				pos[0] = 1;
			}
			else if(instr == "HOMERUN"){
				pos[3] += pos[0] + pos[1] + pos[2] + 1;
				pos[0] = pos[1] = pos[2] = 0;
			}
			else if(instr == "OUT")
				out++;
	//		cout << pos[0] << ' ' << pos[1] << ' ' << pos[2] << ' ' << pos[3] << endl;
		}
		cout << pos[3] << endl;
	}
			

	return 0;
}

Measured memory_bytes: 1208
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>

#define for0(i, N)    for (int i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (int i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (int i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (int i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (int i = (x); i <  (N); ++i)
#define forl(i, N, x, a) for (int i = (x), a = 0; a < (N);  \
                              i = (i + 1) % (N), ++a)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;
typedef set<ll> sll;
typedef unordered_set<ll> usll;


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

    int a, b;

    cin >> a >> b;

    if (a >= 10 || b >= 10) {
        cout << -1;
        return 0;
    }

    cout << a * b;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

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

  	int i = 0;
    int change = 0;
  	while(i < 10){
        if(i * 1000 < n && n <=(i + 1) * 1000){
            change = (i + 1) * 1000 - n;
        }
        i++;
    }

  	printf("%d\n", change);
}

Measured memory_bytes: 1704
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import bisect
import heapq

import logging
logging.basicConfig(level=logging.DEBUG)

import sys
input = sys.stdin.readline().rstrip

setrecursionlimit(1000000)

MOD = 10**9+7
INF = float('inf')

def main():
    A,B=[int(x) for x in input().split()]
    ans = A - B*2
    print(ans if ans > 0 else 0)

main()

Measured memory_bytes: 69356
n,k = map(int,input().split())
a = [int(x) for x in input().split()]
d = {}
ans_list = []
ans = 0

for aa in a:
    if aa not in d:
        d[aa] = 0
    d[aa] += 1

for v in d.values():
    ans_list.append(v)

ans_list.sort()

for i in range(len(ans_list) - k):
    ans += ans_list[i]

print(ans)


Measured memory_bytes: 32264
import java.util.*;

public class Main{
	public static void main(String args[]){
    	Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	int[] a = new int[3*N];
      
      	for(int i = 0; i<3*N; i++){
        	a[i] = sc.nextInt();  
        }
    
      	Arrays.sort(a);
      
      	long sum = 0;
      
      	for(int i=N;i<3*N;i+=2){
        	sum +=a[i];  
        }  
      	System.out.println(sum);
    }
}

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

#define fastread std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define print(a) for(auto x:a) cout<<x<<' ';cout<<endl;
#define printM(b) for(auto y:b) {print(y);}
#define printP(p) cout<<p.first<<' '<<p.second<<endl;

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef unsigned long long ull;

vector<ll> g[100010], r[100010];
vector<ll> cnt;
vector<bool> vis;
map<ll, bool> root;
ll mx;

void Rdfs(ll cur)
{
    vis[cur] = true;

    ll c=0;
    for(auto adj: r[cur])
    {
        c++;
        if(!vis[adj])
            Rdfs(adj);
    }
    
    if(c == 0)
        root[cur] = true;
    else
        root[cur] = false;
    //cout<<cur<<' '<<root[cur]<<endl;
}

ll dfs(ll cur, ll d)
{
    //cout<<cur+1<<endl;
    if(cnt[cur] > 0)
    {
        return cnt[cur]+1;
    }
    mx = max(mx, d);

    ll x=-1;
    for(auto adj: g[cur])
        x = max(x, dfs(adj, d+1));
    
    cnt[cur] = max(cnt[cur], x);
    return cnt[cur] + 1;
}

int main()
{
	fastread;
	
	ll n, m, i, j, x, y;

    cin>>n>>m;

    for(i=0 ; i<n ; ++i)
        g[i].clear();
    cnt = vector<ll>(n, 0);
    vis = vector<bool>(n, 0);
    root.clear();

    for(i=0 ; i<m ; ++i)
    {
        cin>>x>>y;

        x--, y--;
        g[x].pb(y);
        r[y].pb(x);
    }

    for(i=0 ; i<n ; ++i)
        if(!vis[i])
            Rdfs(i);
    
    //for(i=0 ; i<n ; ++i)
    //    cout<<root[i]<<' ';
    //cout<<endl;
    
    mx = 0;
    for(i=0 ; i<n ; ++i)
        if(root[i])
            dfs(i, 0);
    
    for(i=0 ; i<n ; ++i)
        mx = max(mx, cnt[i]);
    cout<<mx;
    
    return 0;
}

Measured memory_bytes: 25728
#include<bits/stdc++.h>
using namespace std;
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const long long int infLL = 9000000000000000000;
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(a) (a).begin(),(a).end()
#define mx_int_prime 999999937
const int inf = 2000000000;
const double PI = acos(-1);
const double eps = 1e-9;
typedef long double ld;
#define MOD 1000000007
const unsigned int M = 1000000007;
typedef long long ll;
const int mx=2e5+125;
int ar[mx],br[mx],pos[mx];
#define PB push_back
#define endl '\n'
#define S second
#define F first
void solve()
{
    int x;
    cin>>x;
    bool ck=false;
    for(int i=1; i<=9; i++){
        for(int j=1; j<=9; j++){
                if((i*j)==x){
                    ck=true;
                    break;
                }

        }
    }
    if(ck==true)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}
int main()
{
    faster();
    int tc;
    tc=1;
    while(tc--)
        solve();
    return 0;
}



Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#define all(c) (c).begin(),(c).end()
#define f first
#define s second

using namespace std;

typedef long long ll;

struct point{ll x,y,z;};

typedef pair<point,point> P;

int main(void){
  ll n,k,x1,x2,y1,y2,z1,z2;
  vector<ll>x,y,z;

  cin >> n >> k;
  vector<P> p(n);

  for(int i=0;i<n;i++){
    cin >> p[i].f.x >> p[i].f.y >> p[i].f.z;
    cin >> p[i].s.x >> p[i].s.y >> p[i].s.z;

    x.push_back(p[i].f.x);
    x.push_back(p[i].s.x);
    y.push_back(p[i].f.y);
    y.push_back(p[i].s.y);
    z.push_back(p[i].f.z);
    z.push_back(p[i].s.z);
  }
  
  sort(all(x));
  sort(all(y));
  sort(all(z));

  map<ll,int>X,Y,Z;
  
  for(int i=0;i<x.size();i++)X[x[i]]=i;
  for(int i=0;i<y.size();i++)Y[y[i]]=i;
  for(int i=0;i<z.size();i++)Z[z[i]]=i;
  
  int grid[101][101][101];
  for(int i=0;i<101;i++)
    for(int j=0;j<101;j++)
      for(int l=0;l<101;l++)grid[i][j][l]=0;

  for(int i=0;i<n;i++)
    for(int xi=X[p[i].f.x];xi<X[p[i].s.x];xi++)
      for(int yi=Y[p[i].f.y];yi<Y[p[i].s.y];yi++)
	for(int zi=Z[p[i].f.z];zi<Z[p[i].s.z];zi++)
	  grid[xi][yi][zi]++;

  ll ans=0;
  for(int i=0;i<x.size()-1;i++)
    for(int j=0;j<y.size()-1;j++)
      for(int l=0;l<z.size()-1;l++)
	if(grid[i][j][l]>=k)
	  ans+=(x[i+1]-x[i])*(y[j+1]-y[j])*(z[l+1]-z[l]);
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 5264
/*
竟然转化转化成置换了^-^ 妙啊 ~
想起了哥哥之前说的“不同系统中的等效操作”，大致这个意思hhh
*/
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
#define per(i, x, y) for (int i = x; i >= y; i--)
using namespace std;

const int N = 1e5 + 10;
typedef long long ll;
ll n, m, K, pos[N], a[N], b[N], vis[N], p[N], ans[N];

int main() {
    cin >> n;
    rep(i, 1, n) scanf("%lld", &pos[i]), b[i] = i;
    per(i, n, 1) pos[i] -= pos[i - 1];
    cin >> m >> K;
    rep(i, 1, m) scanf("%lld", &a[i]), swap(b[a[i]], b[a[i] + 1]);
    rep(i, 1, n) if (!vis[i]) {
        int cnt = 0;
        int j = i;
        for (; !vis[j]; j = b[j]) {
            vis[j] = 1;
            p[++cnt] = j;
        }
        rep(j, 1, cnt) ans[p[j]] = pos[p[(j + K % cnt - 1) % cnt + 1]];
    }
    rep(i, 1, n) ans[i] += ans[i - 1], printf("%lld.0\n", ans[i]);
    return 0;
}


Measured memory_bytes: 6144
#include<bits/stdc++.h>
# define ll long long
# define mo 1000000009
using namespace std;
int main()
{
	string s;
	cin>>s;
	int a=0,b=0;
	for(int i=0;i<3;i++)
	{
		if(s[i]=='A')
		a++;
		else
		b++;
	}
	if(a==3||b==3)
	cout<<"No";
	else
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
<?php
$N = intval(trim(fgets(STDIN)));
$A = array_map("intval", explode(" ", trim(fgets(STDIN))));
$B = array_map("intval", explode(" ", trim(fgets(STDIN))));
foreach($A as $a)$map[$a] = true;
foreach($B as $b)$map[$b] = true;
$keys = array_keys($map);
sort($keys);
$keys = array_flip($keys);
foreach($A as $i => $a)$A[$i] = $keys[$A[$i]]+1;
foreach($B as $i => $b)$B[$i] = $keys[$B[$i]]+1;
$MAX = max($keys)+1;

$dp = array_fill(0, 1<<$N, array_fill(0,51,PHP_INT_MAX));
$dp[0][0] = 0;
for($bit = 0, $NN = 1<<$N; $bit < $NN; ++$bit){
    $con = countBits($bit);
    $ords = [];
    $iter = $con;
    for($i = 0; $i < $N; ++$i)
        if(!($bit & (1<<$i)))
            $ords[$i] = $iter++;
    for($s = 0; $s <= $MAX; ++$s){
        if($dp[$bit][$s] == PHP_INT_MAX)continue;
        foreach($ords as $p0 => $p1){
            $ns = ($p0-$con) & 1 ? $B[$p0] : $A[$p0];
            if($ns >= $s){
                $nb = $bit | (1<<$p0);
                $dp[$nb][$ns] = min($dp[$nb][$ns], $dp[$bit][$s] + abs($p1 - $con));
            }
        }
    }
}
$min = min($dp[(1<<$N)-1]);
if($min == PHP_INT_MAX){
    echo -1;
}else{
    echo $min;
}

function countBits($x){
    $con = 0;
    while ($x) {
        $x &= $x-1;
        ++$con;
    }
    return $con;
}


Measured memory_bytes: 682488
#include <iostream>
#include <queue>

int main(){
  using namespace std;
  int N,M,i,x,lmax,a,b,sum;
  priority_queue<int> xque,lque;
  cin >> N >> M;
  if(N>=M){cout << 0 <<endl;return 0;}
  for(i=0;i<M;i++){
    cin >> x;
    xque.push(x);
  }
  
  //lqueに区間の距離を入れていく。
  a=xque.top();lmax=a;xque.pop();
  while(!xque.empty()){
    b=xque.top();
    xque.pop();
    lque.push(a-b);
    a=b;
  }
  lmax-=a;
  
  sum=0;
  for(i=0;i<N-1;i++){
    sum+=lque.top();
    lque.pop();
  }
  
  cout << lmax-sum << endl;
}

Measured memory_bytes: 1400
a=int(input())
List1 = list(map(int, input().split()))
Row = int(input())
List2 = []
for i in range (Row):
  List2.append(list(map(int, input().split())))
res = [0]*Row
for i in range(Row):
  for j in range(a):
    if j+1 == List2[i][0]:
      res[i] += List2[i][1]
    else:
      res[i] += List1[j]
for element in res:
  print(element)

Measured memory_bytes: 9040
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second

int main()
{
    int n, i;

    cin >> n;

    vector<pair<int, int>>v(n);

    for(i = 0; i < n; i++)
    {
        cin >> v[i].ff;
        v[i].ss = i+1;
    }

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

    for(i = 0; i < n; i++)
        cout << v[i].ss << " ";
}


Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
 int main()
 { 
       long long int i,c=1;
         string s;
          cin>>s;
           if(s[0]=='R'&&s[1]=='R'&&s[2]=='R')
             cout<<3<<endl;
           else if(s[0]=='R'&&s[1]=='R'&&s[2]=='S'||s[0]=='S'&&s[1]=='R'&&s[2]=='R')
              cout<<2<<endl;
           else if(s[0]=='S'&&s[1]=='S'&&s[2]=='S')
              cout<<0<<endl;
              else
                cout<<1<<endl;
 }


Measured memory_bytes: 3624
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

typedef int64_t  ll;
typedef uint64_t ull;

#define rep(i,n)   for (int i = 0; i < (n); i++)
#define rrep(i,n)  for (int i = (n)-1; i >= 0; i--)
#define rep1(i,n)  for (int i = 1; i <= (n); i++)
#define rrep1(i,n) for (int i = (n); i > 0; i--)

int main(void) {
    string s;
    cin >> s;
    rep(i,s.length()) {
        if (i%2==0) {
            if (s[i] == 'L') {
                puts("No");
                return 0;
            }
        } else {
            if (s[i] == 'R') {
                puts("No");
                return 0;
            }
        }
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 256