akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL_BOOKNU
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// ........................macro.......................... //
#define FOR(i, f, n) for(int (i) = (f); (i) < (int)(n); ++(i))
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (int)(n); --(i))
#define pb push_back
#define emb emplace_back
#define fi first
#define se second
#define ENDL '\n'
#define sz(A) (int)(A).size()
#define ALL(A) A.begin(), A.end()
#define UNIQUE(c) (c).resize(unique(ALL(c)) - (c).begin())
#define next next9876
#define prev prev1234
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef long long i64;
typedef unsigned long long ui64;
// inline i64 GCD(i64 a, i64 b) { if(b == 0) return a; return GCD(b, a % b); }
inline int getidx(const vi& ar, int x) { return lower_bound(ALL(ar), x) - ar.begin(); } // 좌표 압축에 사용: 정렬된 ar에서 x의 idx를 찾음
inline i64 GCD(i64 a, i64 b) { i64 n; if(a < b) swap(a, b); while(b != 0) { n = a % b; a = b; b = n; } return a; }
inline i64 LCM(i64 a, i64 b) { if(a == 0 || b == 0) return GCD(a, b); return a / GCD(a, b) * b; }
inline i64 CEIL(i64 n, i64 d) { return n / d + (i64)(n % d != 0); } // 음수일 때 이상하게 작동할 수 있음.
inline i64 ROUND(i64 n, i64 d) { return n / d + (i64)((n % d) * 2 >= d); }
const i64 MOD = 1e9+7;
inline i64 POW(i64 a, i64 n) {
	assert(0 <= n);
	i64 ret;
	for(ret = 1; n; a = a*a%MOD, n /= 2) { if(n%2) ret = ret*a%MOD; }
	return ret;
}
template <class T> ostream& operator<<(ostream& os, vector<T> v) {
	os << "[";
	int cnt = 0;
	for(auto vv : v) { os << vv; if(++cnt < v.size()) os << ","; }
	return os << "]";
}
template <class T> ostream& operator<<(ostream& os, set<T> v) {
	os << "[";
	int cnt = 0;
	for(auto vv : v) { os << vv; if(++cnt < v.size()) os << ","; }
	return os << "]";
}
template <class L, class R> ostream& operator<<(ostream& os, pair<L, R> p) { return os << "(" << p.fi << "," << p.se << ")"; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H, debug_out(T...); }
// ....................................................... //

int n;
void input() {
	cin >> n;
}

int solve() {
	if(n%2 == 0) {
		vii ans;
		FOR(i, 1, n+1) {
			FOR(j, i+1, n+1) {
				if(i+j == n+1) continue;
				ans.pb({ i, j });
			}
		}
		cout << ans.size() << ENDL;
		for(ii x : ans) {
			cout << x.first << ' ' << x.second << ENDL;
		}
	} else {
		vii ans;
		FOR(i, 1, n) ans.pb({ i, n });
		FOR(i, 1, n) {
			FOR(j, i+1, n) {
				if(i+j == n) continue;
				ans.pb({ i, j });
			}
		}
		cout << ans.size() << ENDL;
		for(ii x : ans) {
			cout << x.first << ' ' << x.second << ENDL;
		}
	}
	return 0;
}

// ................. main .................. //
void execute() {
	input(), solve();
}

int main(void) {
#ifdef LOCAL_BOOKNU
	freopen("input.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
#endif
	cin.tie(0), ios_base::sync_with_stdio(false);
	execute();
	return 0;
}
// ......................................... //

Measured memory_bytes: 384
N,K = map(int,input().split())
X = list(map(int,input().split()))
res = 9999999999999
for i in range(N-K+1):
    ans_1 = abs(X[i]) + abs(X[i] - X[i+K-1])
    ans_2 = abs(X[i+K-1]) + abs(X[i] - X[i+K-1])
    res = min(res,min(ans_1,ans_2))
print(res)

Measured memory_bytes: 14392
import sys

n = int(input())

if n == 2:
    print(1)
    sys.exit()

# temp1 = (n-1) // 2
# temp2 = 2 + n - 2
#ans = ((n-1) / 2) * (2 + (n - 2))
ans = (n-1) * (2 + (n - 2))
ans = ans // 2
#ans = temp1 * temp2

#print(ans)
print(int(ans))

Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main()
{
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	int x3, y3, x4, y4;
	x3 = x2 + (y1 - y2);
	y3 = y2 + (x2 - x1);
	x4 = x1 + (y1 - y2);
	y4 = y1 + (x2 - x1);

	cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << endl;

	return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

struct data{
  ll h,w,sqr;
  bool operator<(const data& d){
    if(sqr == d.sqr) return h < d.h;
    return sqr < d.sqr;
  }
  bool operator==(const data& d){
    return w == d.w && h == d.h && sqr == d.sqr;
  }
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<data> d;
  ll h,w,sqr2;
  REP(j,1,151){
    REP(i,j+1,151){
      sqr2 = i*i+j*j;
      d.push_back({j,i,sqr2});
    }
  }
  sort(all(d));
  while(cin >> h >> w && h && w){
    ll sqr = h*h+w*w;
    data ans = data{h,w,sqr};
    rep(i,d.size()){
      if(d[i] == ans){
        ans = d[i+1];
        break;
      }
    }
    cout << ans.h << " " << ans.w << endl;
  }
  return 0;
}

Measured memory_bytes: 3364
#include <bits/stdc++.h>
#define va first
#define vb second
#define lb lower_bound
#define pb push_back
#define all(v) v.begin(),v.end()
#define fio ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
using ll = long long;
using lf = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

lf d[3005][3005];
int n;
lf p[3005];

int main(){
    fio;
    cout << fixed;
    cout.precision(18);
    cin >> n;
    d[0][0] = 1.L;
    for(int i = 1; i <= n; i++){
        cin >> p[i];
        d[i][0] = 1.L;
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= i; j++){
            d[i][j] = p[i] * d[i-1][j-1] + (1.L - p[i]) * d[i-1][j];
        }
    }
    cout << d[n][(n+1)/2] << '\n';
}

Measured memory_bytes: 139392
n,k = map(int,input().split())
tmp_x = list(map(int, input().split()))
import bisect

x=[]
for tmp in tmp_x:
    if tmp==0:
        k-=1
    else:
        x.append(tmp)
if k==0:
    print(0)
    exit()

z_ind = bisect.bisect_left(x,0)

mn_res=10**9
for i in range(1,k+2):
    l_ind = z_ind-i+1
    r_ind = z_ind-i+k

    if l_ind < 0:
        continue
    if r_ind >= len(x):
        continue

    l = x[l_ind]
    r = x[r_ind]

    if l > 0:
        result = r
    elif r< 0:
        result = -l
    else:
        result = max(abs(l),abs(r)) + 2 * min(abs(l),abs(r))

    if mn_res > result:
        mn_res=result
print(mn_res)

Measured memory_bytes: 14128
#include <iostream>
#include <cmath>

constexpr int MAX_N = 100000;

int N;
int A[MAX_N];

int main(){

	std::cin >> N;

	int sum = 0;

	for(int i = 0; i < N; ++i){
		std::cin >> A[i];
		if(i == 0 || i == N - 1){
			sum += abs(A[i]);
		}

		if(i > 0){
			sum += abs(A[i - 1] - A[i]);
		}
	}

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

		std::cout << tsum << std::endl;
	}

	return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;

int H, W, maxn; char c[1 << 10][1 << 10];
int dist[1 << 10][1 << 10];
queue<pair<int, int>> Q;

int main() {
	cin >> H >> W;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cin >> c[i][j]; dist[i][j] = (1 << 30);
			if (c[i][j] == '#') { Q.push(make_pair(i, j)); dist[i][j] = 0; }
		}
	}
	while (!Q.empty()) {
		int cx = Q.front().first, cy = Q.front().second; Q.pop();
		int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
		for (int i = 0; i < 4; i++) {
			int ex = cx + dx[i], ey = cy + dy[i];
			if (ex <= 0 || ey <= 0 || ex > H || ey > W) continue;
			if (dist[ex][ey] > dist[cx][cy] + 1) {
				dist[ex][ey] = dist[cx][cy] + 1;
				Q.push(make_pair(ex, ey));
			}
		}
	}
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) maxn = max(maxn, dist[i][j]);
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 13584
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 6
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}
using namespace std;
typedef long long LL;
int dp[M][M][M][M];

int go(int a,int b,int c,int d)
{
	if(a>b) swap(a,b);
	if(c>d) swap(c,d);
	
	if( dp[a][b][c][d]!=-1 ) return dp[a][b][c][d];
	if(a==5 && b==5) return dp[a][b][c][d] = 0;

	dp[a][b][c][d] = 0;
	if(a!=5)
	{
		if(c!=5)
		{
			if( !go(min(c+a,5),d,a,b) ) dp[a][b][c][d] = 1;
		}
		if(d!=5)
		{
			if( !go(min(d+a,5),c,a,b) ) dp[a][b][c][d] = 1;
		}
	}
	if(b!=5)
	{
		if(c!=5)
		{
			if( !go(min(c+b,5),d,a,b) ) dp[a][b][c][d] = 1;
		}
		if(d!=5)
		{
			if( !go(min(d+b,5),c,a,b) ) dp[a][b][c][d] = 1;
		}
	}
	return dp[a][b][c][d];
}

int main()
{
	MSET(dp, -1);
	
	int a,b,c,d;
	RI(a,b,c,d);

	puts(go(a,b,c,d) ? "ISONO" : "NAKAJIMA");
	
	return 0;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int A, B; cin >> A >> B;
    int n = 1;
    int ans = 0;
    while(n < B)
    {
        ans++;
        n += A-1;
    }
    cout << ans << endl;
} 
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

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

#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
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; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
bool dp[100100];

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}

long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}


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

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




}


Measured memory_bytes: 3640
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int a, b, c, d, sum = 0;
    cin >> a >> b >> c >> d;
    sum = a + b + c + d;
    int ans = inf;
    chmin(ans, abs(sum - 2 * (a + b)));
    chmin(ans, abs(sum - 2 * (a + c)));
    chmin(ans, abs(sum - 2 * (a + d)));
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}


Measured memory_bytes: 3184
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
#include<map>
#include<set>
#include <climits>
using namespace std;
#define INF 11000000000
#define MOD 1000000007
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
typedef long long ll;
typedef pair<int,int> P;

int C[110000];

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


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

int main() {
  int H, W;
  cin >> H >> W;
  
  string pre, cur, next;
  cin >> cur;
  for( int i=0; i<H; i++ ){
    cin >> next;
    for( int j=0; j<W; j++ ){
      if( cur.at(j) == '#' ){
        cout << '#';
        continue;
      }
      
      int num = 0;
      if( j != 0 ){
        if( (i != 0) && (pre.at(j-1) == '#') ){
          num++;
        }
        if( cur.at(j-1) == '#' ){
          num++;
        }
        if( (i != (H-1)) && (next.at(j-1) == '#') ){
          num++;
        }
      }
      
      if( (i != 0) && (pre.at(j) == '#') ){
        num++;
      }
      if( cur.at(j) == '#' ){
        num++;
      }
      if( (i != (H-1)) && (next.at(j) == '#') ){
        num++;
      }
      
      if( j != (W - 1) ){
        if( (i != 0) && (pre.at(j+1) == '#') ){
          num++;
        }
        if( cur.at(j+1) == '#' ){
          num++;
        }
        if( (i != (H-1)) && (next.at(j+1) == '#') ){
          num++;
        }
      }
      
      cout << num;
    }
    cout << endl;
    
    pre = cur;
    cur = next;
  }
}


Measured memory_bytes: 3584
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

int main() {
  ll X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<ll> red(A);
  for_each(begin(red), end(red), [](auto& x) { cin >> x; });
  vector<ll> green(B);
  for_each(begin(green), end(green), [](auto& x) { cin >> x; });
  vector<ll> mushoku(C);
  for_each(begin(mushoku), end(mushoku), [](auto& x) { cin >> x; });

  sort(begin(red), end(red), greater<>());
  vector<ll> good_r(begin(red), begin(red) + X);
  map<ll, ll> map_r;
  for (const auto& x : good_r) {
    map_r[x]++;
  }

  sort(begin(green), end(green), greater<>());
  vector<ll> good_g(begin(green), begin(green) + Y);
  map<ll, ll> map_g;
  for (const auto& x : good_g) {
    map_g[x]++;
  }

  sort(begin(mushoku), end(mushoku), greater<>());

  // ソートを崩さずに挿入する
  for (const auto& x : mushoku) {
    const ll red_value = x - map_r.begin()->first;
    const ll green_value = x - map_g.begin()->first;
    if (max(red_value, green_value) <= 0) {
      continue;
    }
    // 適切な場所に入れる

    if (red_value > green_value) {
      map_r[x]++;
      if (map_r.begin()->second == 1) {
        map_r.erase(map_r.begin()->first);
      } else {
        map_r.begin()->second--;
      }
    } else {
      map_g[x]++;
      if (map_g.begin()->second == 1) {
        map_g.erase(map_g.begin()->first);
      } else {
        map_g.begin()->second--;
      }
    }
  }
  ll ans = 0;
  for (const auto& x : map_r) {
    ans += x.first * x.second;
  }
  for (const auto& x : map_g) {
    ans += x.first * x.second;
  }

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


Measured memory_bytes: 15232
# -*- coding: utf-8 -*-
N, W = tuple(map(int, input().split()))
items = []
for _ in range(N):
    items.append(list(map(int, input().split())))

cost = [0 for _ in range(W+1)]

for item in items:
    for w in range(item[1], W+1):
        cost[w] = max(cost[w], cost[w-item[1]]+item[0])

print(cost[-1])        

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

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

    if (n % 10 == 2 || n % 10 == 4 || n % 10 == 5 || n % 10 == 7 || n % 10 == 9) cout << "hon\n" ;
    else if (n % 10== 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8) cout << "pon\n" ;
    else cout << "bon\n" ;
}

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

const int mod = 1000000007;
typedef long long ll;

ll mod_pow(ll x, ll n) {
    if (n == 0) return 1;
    ll res = mod_pow(x * x % mod, n / 2);
    if (n % 2 == 1) res = res * x % mod;
    return res;
}

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

    cout << mod_pow(m, n) << endl;
    return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
      //#define ll long long
      using namespace std;
      #define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
      #define fileio freopen("http://in.in", "r", stdin),freopen("out.out", "w", stdout);
      #define ll long long
      #define pb push_back
      #define pll pair<ll,ll>
      #define ff first
      #define ss second
     
      #define N 2000001
      #define M 998244353
      #define INF 1000000000000000
      std::vector<ll> v;

int main()
{
  SPEED;
 ll t;
 t=1;

 while(t-->0)
 {
    ll n,k;
    cin>>n>>k;
    ll a[n];
    ll i;
    for(i=0;i<n;i++)
    {
      cin>>a[i];
    }
    sort(a,a+n);ll sum=0;
    for(i=0;i<k;i++)
    {
      sum+=a[i];
    }
    cout<<sum;
 }

}

Measured memory_bytes: 3660
n,m,l=map(int,input().split())
a = []
b = []
for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(m):
    b.append(list(map(int,input().split())))
for i in range(n):
    d=[]
    for k in range(l):
        c=0
        for j in range(m):
            c+=a[i][j]*b[j][k]
        d.append(c)
    d=[str(a) for a in d]
    d=' '.join(d)
    print(d)


Measured memory_bytes: 6312
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
    long double n;
    cin >> n;
    int ans = -1;

    if (floor(floor(n/1.08)*1.08) == n) ans = floor(n/1.08);
    if (floor(ceil(n/1.08)*1.08) == n) ans = ceil(n/1.08);


    if (ans < 0) {
        cout << ":(" << endl;
        return 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(true){
		c-=b;
		if(c<=0){
			break;
		}
		a-=d;
		if(a<=0){
			break;
		}
	}
	if(a<=0){
		cout<<"No"<<endl;
	}else {
		cout<<"Yes"<<endl;
	}
	
	return 0;
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

//cout << (c)?"Yay!":":(" << endl;

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    long long int x;
    cin >> x;
    int count = 0;
    long long int num = 100;
    for (;; count++)
    {
        num = (long long int)(num * 1.01);
       // cout << num << endl;
        if (num >= x)
        {
            cout << count+1 << endl;
            return 0;
        }
    }
}


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

using ll = long long;

int main() {
  int N;
  cin >> N;
  N *= 3;
  int a[N];
  for (int i = 0; i < N; i++) scanf("%d", a + i);

  sort(a, a + N);
  ll ans = 0;
  int count = 0;
  for (int i = N - 2; i >= 0; i -= 2) {
    ans += a[i];
    count++;
    if (count == N / 3) break;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
#include<iostream>

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

using namespace std;

string s;

void compute() {
  int n = s.size();
  rep(i,n) {
    if( i+1 < n && s[i] == s[i+1] ) {
      cout << i+1 << " " << i+2 << endl;     
      return;
    }
    if( i+2 < n && s[i] == s[i+2] ) {
      cout << i+1 << " " << i+3 << endl;     
      return;
    }
  }
  puts("-1 -1");
}

int main() {
  cin >> s;
  compute();
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <sstream>  // istringstream
#include <vector>

using namespace std;

int main()
{
	int N = 0;

	cin >> N;

	std::vector<long> vctA(N, 0);
	std::vector<long long> vctSum(N, 0);
	// std::vector<long long> vctSumRvs(N, 0);

	long long sum = 0;
	std::vector<long long>::iterator is = vctSum.begin();
	for (int i = 0; i < N; ++i){
		int curA = 0;
		cin >> curA;
		sum += curA;
		*is = sum;
		if (i < N - 1){
			++is;
		}
	}

	is = vctSum.begin();
	long long minDiff = 0;

	for (int i = 0; i < N -1; ++i){
		long long diff = std::abs(sum - 2 * *is);
		if (i == 0){
			minDiff = diff;
		}
		else if (diff < minDiff){
			minDiff = diff;
		}
		++is;
	}

	cout << minDiff;

	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
double Pi = 3.1415926535897932384626;
 
vector<ll> G1[500005];
vector<ll> G2[500005];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
 
ll mod = 1000000007;
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

 
//ll fact[800005],rfact[800005];
/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,ans,a,b,c,e,g,h,w,i,j,k,q;
vector <ll> table[5000];
ll x[500005],y[500005];
char s[500005][15];
ll push_num;

int main(){
    cin >> k >> n;
    for(i=-1000000;i<=1000000;i++){
        ll dif = abs(n - i);
        if(dif <= k - 1){
            pe(i);
        }
    }
    el;
    
    return 0;
}












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

using ll = long long;
using namespace std;

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

	string S; cin >> S;

	const ll mod = 1e9+7;

	ll dp[100005][4];

	memset(dp,0,sizeof(dp));
	dp[0][0] = 1;

	for (int i = 0;i < S.size();i++){
		
		if(S[i] == 'A' || S[i] == '?'){
			for (int j = 0;j < 4;j++){
				dp[i+1][j] += dp[i][j];
			}	
			dp[i+1][1] += dp[i][0];
		} 
		if(S[i] == 'B' || S[i] == '?'){
			for (int j = 0;j < 4;j++){
				dp[i+1][j] += dp[i][j];
			}
			dp[i+1][2] += dp[i][1];
		}
		if(S[i] == 'C' || S[i] == '?'){
			for (int j = 0;j < 4;j++){
				dp[i+1][j] += dp[i][j];
			}	
			dp[i+1][3] += dp[i][2];
		}
		for (int j = 0;j < 4;j++){
			dp[i+1][j] %= mod;
		}
	}

	cout << dp[S.size()][3] << endl;

	return 0;

}


Measured memory_bytes: 3664
n, m = map(int, input().split())
k = [list(map(int, input().split())) for _ in range(n)]

for i in range(n):
    k[i].pop(0)

cnt = 0

for i in range(1, m+1):
    flag = True
    for j in range(n):
        if i not in k[j]:
            flag = False
    if flag == True:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		int[] c = new int[n+1];
		int[][] a= new int[n+1][m+1];

		for (int i=1; i<=n; i++){
			c[i] = sc.nextInt();
			for (int j=1; j<=m; j++){
				a[i][j] = sc.nextInt();
			}
		}

		ArrayList<ArrayList<Integer>>buyList = new ArrayList<ArrayList<Integer>>();

		for (int i=1; i<=n; i++){

			if (i==1){
				for (int l=1; l<= n; l++){
					buyList.add(new ArrayList<>(Arrays.asList(l)));
				}
			} else {

				for (int j = 0; j<buyList.size(); j++){
					ArrayList<Integer> push = buyList.get(j);
					if (push.size() == i-1){
						int lastNum = push.get(i-2);
						for (int k = lastNum+1; k<=n; k++){
							ArrayList<Integer> newList = (ArrayList<Integer>) push.clone();
							newList.add(k);
							buyList.add(newList);
						}
					}
				}
			}

		}

		int ans = Integer.MAX_VALUE;
		for (int i=0; i < buyList.size(); i++){
			int[] rikaido = new int[m+1];
			int money = 0;
			ArrayList<Integer> buy = buyList.get(i);

			for (int j=0; j<buy.size(); j++){
				int sankosyo = buy.get(j);
				money += c[sankosyo];
				for (int k=1 ; k<=m; k++){
					rikaido[k] += a[sankosyo][k];
				}
			}

			boolean result = true;

			for (int l=1; l<=m; l++){
				if (rikaido[l] < x){
					result = false;
					break;
				}
			}
			if (result){
				ans = Math.min(ans, money);
			}
		}

		if (ans == Integer.MAX_VALUE){
			ans = -1;
		}

		System.out.println(ans);
	}


}

Measured memory_bytes: 38568
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
	vector<int> A(3);
	int ans = 0;

	cin >> A[0] >> A[1] >> A[2];

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

	int cnt = 0;
	cnt = (A[2] - A[0]) / 2;
	ans += cnt;
	A[0] += cnt * 2;

	cnt = (A[2] - A[1]) / 2;
	ans += cnt;
	A[1] += cnt * 2;

	if (A[2] - A[0] == 1 && A[2] - A[1] == 1)
	{
		ans++;
	}
	else if(A[2] - A[0] == 0 && A[2] - A[1] == 0)
	{}
	else
	{
		ans += 2;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
//marico el que lo lea
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <assert.h>
using namespace std;

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

void fastIO() {
	std::ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
}

#define FOR(i,f,t) for(int i=f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=f; i>(int)t; i--)
#define FORE(i,c) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define all(obj) obj.begin(), obj.end()
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define ms2(obj, val, sz) memset(obj, val, sizeof(obj[0])*sz)

#define fst first
#define snd second

template<typename T, typename U> inline void mnze(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void mxze(T &x, U y) { if(x < y) x = y; }

void _scan( int &x ) { scanf("%d",&x); }
void _scan( long long &x ) { scanf("%lld",&x); }
void _scan( double &x ) { scanf("%lf",&x); }
void _scan( char &x ) { scanf(" %c",&x); }
void _scan( char *x ) { scanf("%s",x); }
void scan() {}
template<typename T, typename... U>
void scan( T& head, U&... tail ) { _scan(head); scan(tail...);}

template<typename T> void _dbg(const char* sdbg, T h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename T, typename... U> void _dbg(const char* sdbg, T h, U... t) {
	while(*sdbg != ',')cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(_i, (x)) cerr <<*_i <<", "; cerr <<"\n"; }}
#define debuga(x, sz) {{cerr <<#x <<" = "; FOR(_i, 0, sz) cerr << x[_i] <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define debuga(x, sz)
#define cerr if(0)cout
#endif

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

const int MAXN = 103;
const ll MOD = 1e9+7;

int N, K;
ll k_pow[MAXN];

ll dp[MAXN][MAXN*1000];
ll f(int i, int cnt){
	if(i==0) return 0;
	ll &ret = dp[i][cnt];
	if(ret!=-1) return ret;
	ret = 0;
	FOR(v,0,min(i,K)+1)
		ret = (ret + ((v+cnt)%i)*k_pow[i-1]%MOD + f(i-1,cnt + (v+cnt)/i))%MOD;
	FOR(v, i+1, K+1)
		ret = (ret + (v+cnt)*k_pow[i-1]%MOD + f(i-1,cnt))%MOD;
    assert(ret>=0);
	return ret;
}

int main(){
	scan(N,K);
	k_pow[0] = 1;
	FOR(i,1,N+1) k_pow[i] = (k_pow[i-1]*(K+1))%MOD;
	ms(dp, -1);
	printf("%lld\n",f(N, 0));
}


Measured memory_bytes: 83200
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const int INF = INT32_MAX / 3;
const ll MOD = 1e9 + 7;

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


/******************************************************************************************/



//ユークリッド互除法
template<typename T>
T gcd(T x, T y) {

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

/*最小公倍数*/
template<typename T>
T lcm(T x, T y) {
	T tmp = gcd(x, y);
	return x * y / tmp;
}


int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);

	string y = "Yay!";
	string n = ":(";
	
	int N;
	cin >> N;
	for (int i = 0; i <= 50000; i++)
	{
		if ((int)(i * 1.08) == N) {
			cout << i << endl;
			return 0;
		}
	}

	cout << n << endl;

	return 0;
}


Measured memory_bytes: 256
M = list(map(int,input().split()))
N = M[0]
X = M[1]

number = 0

while not X == 0:
    for x in range(N,-1,-1):
        if 2**(x+2)-3 <= X-N+x:
            number = number + 2**(x+1) -1 
            X = X-N+x-2**(x+2)+3
            N = x
            if X >= 1:
                X = X-1 
                number = number + 1
                break
            else:
                break
        if x == 0:
            X = 0 
            break
else:
    print(number)

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

bool is_overflow(ll a, ll b) {

	ll prod = a * b;
	
	return !(a < LONG_LONG_MAX / b);
}

int main()
{
  ll n;
  cin >> n;
  vector<ll> as(n);
  rep(i, n) cin >> as[i];

  rep(i, n) {
    if (as[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  ll ans = 1;
  rep(i, n) {
    if (is_overflow(ans, as[i])) {
      ans = -1;
      break;
    }
    ans *= as[i];
    if (1000000000000000000 < ans) {
      ans = -1;
      break;
    }
  }
  
  cout << ans << endl;  
  return 0;
}


Measured memory_bytes: 4032
#include<stdio.h>

int main(){
	int n,m,i,j;
	char nn[1000000],nm[1000000],mm[1000000];
	while(1){
		scanf("%d",&n);
		if(!n)break;
		for(i=0;i<n;i++){
			scanf(" %c %c",&nn[i],&nm[i]);
		}
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf(" %c",&mm[i]);
			for(j=0;j<n;j++)if(mm[i]==nn[j]){
				mm[i]=nm[j];
				break;
			}
		}
		puts(mm);
	}
}

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

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}

void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 

#define pii pair<int,int >
#define vec vector<int >

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

#define FOR(i,l,r) for(int i=l,i##_r=r;i<=i##_r;i++)

const int maxn = 3e6+10;
const int inf = 1e9;
const lf eps = 1e-8;
const int mod = 998244353;

int fac[maxn],ifac[maxn];

int qpow(int a,int x) {
    int res=1;
    for(;x;x>>=1,a=1ll*a*a%mod) if(x&1) res=1ll*res*a%mod;
    return res;
}

void gen() {
    fac[0]=ifac[0]=1;
    for(int i=1;i<maxn;i++) fac[i]=1ll*fac[i-1]*i%mod;
    ifac[maxn-1]=qpow(fac[maxn-1],mod-2);
    for(int i=maxn-2;i;i--) ifac[i]=1ll*ifac[i+1]*(i+1)%mod;
}

int c(int a,int b) {return a<b?0:1ll*fac[a]*ifac[b]%mod*ifac[a-b]%mod;}

int add(int a,int b) {a+=b;if(a>=mod) a-=mod;return a;}
int del(int a,int b) {a-=b;a+=a>>31&mod;return a;}

int f(int n,int m,int k) {
    int ans=0;
    for(int i=m&1;i<=k;i+=2) ans=add(ans,1ll*c(n,i)*c(n-1+(m-i)/2,n-1)%mod);
    return ans;
}

int main() {
    gen();int n,m;read(n),read(m);
    write(del(f(n,m*3,m),1ll*n*del(f(n,m,m),f(n-1,m,m))%mod));
    return 0;
}


Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll a,b;
	cin>>a>>b;
	a=a*b;
	cout<<a;
	
}

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


int main() {
  int N;
  cin >> N;
  int a = N/100;
  int b = N - a*100;
  int c = b/10;
  int d = b - c*10;
  
  if (a == 7 || c ==7 || d ==7){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}



Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF ((1<<30)-1)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()




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

	int n;
	cin >> n;

	vector<int> ans(n + 1);
	for (int x = 1; x < n;x++) {
		for (int y = 1; x * y < n; y++) {
			for (int z = 1; x * x + y * y + z * z + x * y + y * z + z * x <= n; z++) {
				ans[x * x + y * y + z * z + x * y + y * z + z * x]++;
			}
		}
	}
	for (int x = 1; x <= n; x++) {
		cout << ans[x] << endl;
	}



	return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}

using mint=modint998244353;
const mint nol=mint(1)/9;
struct S{
    mint a,sz;
};

S op(S l,S r){
    return {l.a*r.sz+r.a,l.sz*r.sz};
}

S e(){
    return {0,1};
}

S mapping(int l,S r){
    if(l) return {(r.sz-1)*nol*l,r.sz};
    return r;
}

int composition(int l,int r){
    if(l) return l;
    return r;
}

int id(){
    return 0;
}

void solve(){
    int n,q;
    cin>>n>>q;
    lazy_segtree<S, op, e, int, mapping, composition, id> seg(vector(n,S{1,10}));
    {
        int l,r,d;
        for(int i{};i<(q);++i){
            cin>>l>>r>>d;
            --l;
            seg.apply(l,r,d);
            cout<<seg.all_prod().a.val()<<endl;
        }
    }
}

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


Measured memory_bytes: 9832
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>

using namespace std;

#define ll long long

void solve()
{
    ll N;
    cin >> N;
    vector<ll> d(N);
    for (ll i = 0; i < N; i++)
    {
        cin >> d.at(i);
    }

    sort(d.begin(), d.end());
    cout << (d.at(N / 2) - d.at(N / 2 - 1)) << endl;
}

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


Measured memory_bytes: 1024
import heapq
n = int(input())
a = list(map(int, input().split()))

a1 = a[:n]
ax = a[n:2*n]
a2 = list(map(lambda x: -x, a[2*n:]))
#print('a2', a2)

sum_a1 = sum(a1)
fdif1 = [sum_a1]
heapq.heapify(a1)
for i in range(n):
    p = heapq.heappushpop(a1,ax[i])
    fdif1.append(fdif1[-1]+ax[i]-p)
    
sum_a2 = sum(a2)
fdif2 = [sum_a2]
heapq.heapify(a2)
#print('a2', a2)
for i in range(n):
    p = heapq.heappushpop(a2,-ax[-1-i])
    fdif2.append(fdif2[-1]-ax[-1-i]-p)
fdif2.reverse()

fdif = [fdif1[i]+fdif2[i] for i in range(n+1)]
print(max(fdif))

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

int main(void) {
  int h, w;
  cin >> h >> w;
  vector<string> ss(h);
  for (int i = 0; i < h; i++) cin >> ss[i];

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (ss[i][j] == '#') continue;

      int cnt = 0; 
      if (i != 0) {
        if (j != 0) cnt += (ss[i - 1][j - 1] == '#' ? 1 : 0);
        cnt += (ss[i - 1][j] == '#' ? 1 : 0); 
        if (j != w - 1) cnt += (ss[i - 1][j + 1] == '#' ? 1 : 0); 
      }

      if (j != 0) cnt += (ss[i][j - 1] == '#' ? 1 : 0); 
      if (j != w - 1) cnt += (ss[i][j + 1] == '#' ? 1 : 0); 

      if (i != h - 1) {
        if (j != 0) cnt += (ss[i + 1][j - 1] == '#' ? 1 : 0); 
        cnt += (ss[i + 1][j] == '#' ? 1 : 0); 
        if (j != w - 1) cnt += (ss[i + 1][j + 1] == '#' ? 1 : 0);
      }
      ss[i][j] = to_string(cnt)[0];
    }
  }

  for (int i = 0; i < h; i++) {
    cout << ss[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vb = vector<bool>;
using vs = vector<string>;
using vp = vector<pii>;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(), (x).end()
#define each(a, x) for (auto&& a : (x))
#define _overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) rep2(_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, n) rep4(i, a, n, 1)
#define rep4(i, a, n, s) for (ll i = (a); i < (n); i += (s))
#define rep(...) _overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
template<typename T> inline void print(const T& x) {cout << x << "\n";}
template<typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template<typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
struct Init {Init() {cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10);}} init;

int main() {
    ll h,w,k; cin>>h>>w>>k;
    vs c(h);
    ll cnt = 0;
    rep(i,h) cin>>c[i];
    for (int bith = 0; bith < (1<<h); ++bith) {
        for (int bitw = 0; bitw < (1<<w); ++bitw) {
            vs cc{c};
            rep(i, h) if (bith & (1<<i)) {
                rep(j, w) cc[i][j] = 'r';
            }
            rep(j, w) if (bitw & (1<<j)) {
                rep(i, h) cc[i][j] = 'r';
            }
            ll n = 0;
            each(x,cc) n += count(all(x), '#');
            if (n == k) ++cnt;
        }
    }
    print(cnt);
}

Measured memory_bytes: 3664
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();
    int ans = 0;
    while(n > 0) {
      ans++;
      n -= (n % k);
      n /= k;
    }
    System.out.println(ans);
  }
}

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

int main() {
    int N,A,B;
    cin >> N >> A >> B;
    int num[3] = {0};
    for(int i=0; i<N; ++i) {
        int p; cin >> p;
        if(p <= A) num[0] += 1;
        else if(p <= B) num[1] += 1;
        else num[2] += 1;
    }
    sort(num,num+3);
    cout << num[0] << endl;
}

Measured memory_bytes: 256
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let a=read::<i32>();
    println!("{}",a%9);
}

Measured memory_bytes: 4352
#ifdef _WIN32
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

// 継承可能な型
template <class Type>
struct IN : Type
{
	IN()
	{
		std::cin >> *this;
	}
};

// 継承不可能な型
template <class Type>
struct IN_
{
	Type val;

	IN_()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN_<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN_<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN_<Type>& value)
{
	return is >> value.val;
}

template <class Type>
void OUT(const Type& value)
{
	std::cout << value << std::endl;
}

template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value << ' ';
	OUT(args...);
}

using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;

#define FOR(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for (ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for (ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for (auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for (auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

#ifdef _DEBUG
	system("pause");
#endif

	return 0;
}

using namespace std;

//////////////////////////////

void Main()
{
	inll x, a, b;

	return OUT((x - a) % b);
}


Measured memory_bytes: 764
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod =1e9+7;
const int N = 2e5+7;

int main()
{
    
    int n;
    scf(n);
    
    int a[n];
    
    rep(i,0,n)
    scf(a[i]);
    
    sort(a,a+n);
    
    prin(a[n-1]-a[0]);
    
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, x = MAP()

if x == 1 or x == 2*N-1:
    print("No")
else:
    print("Yes")
    ans = deque([1, x, 2*N-1])
    for i in range(2, 2*N-1):
        if i == x: continue
        if (i+(x!=2*N-2))%2:
            ans.append(i)
        else:
            ans.appendleft(i)

    print(*ans, sep="\n")


Measured memory_bytes: 21748
#include <iostream>
#include <string>

int main() {
	while (true) {
		std::string s;
		int query;
		std::cin >> s;
		if (s == "-") break;
		std::cin >> query;
		
		while (query--) {
			int h;
			std::cin >> h;
			s = s.substr(h) + s.substr(0, h);
		}
		
		std::cout << s << '\n';
	}
	
	return 0;
}


Measured memory_bytes: 3172
var
a,b:string;
t:char;
i,j,c,d,e,n,m:longint;
begin
readln(a);
readln(b);
for i:=1 to length(a)-1 do
 for j:=i+1 to length(a) do
  begin
   if a[i]>a[j] then begin t:=a[i];a[i]:=a[j];a[j]:=t;end;
end;
for i:=1 to length(b)-1 do
 for j:=i+1 to length(b) do
  begin
   if b[i]<b[j] then begin t:=b[i];b[i]:=b[j];b[j]:=t;end;
end;
if a<b then writeln('Yes')
       else writeln('No');
end.

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

typedef long long ll;

int N, A, B;

void load() {
  scanf("%d%d%d", &N, &A, &B);
}

ll solve() {
  if (A > B)
    return 0;
  if (A == B)
    return 1;
  if (N == 1)
    return 0;
  return (ll)(N - 2) * (B - A) + 1; 
}

int main() {
  load();
  printf("%lld\n", solve());
  return 0;
}


Measured memory_bytes: 128
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
p = [0] * N 
for i in A:
    p[i-1] += 1    

for i in range(N):
    P = K - Q + p[i]
    if P > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 8640