akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  ll n, m; cin >> n >> m;
  vector<P> v(n);
  rep(i, n) {
    ll a, b; cin >> a >> b;
    v[i] = make_pair(a, b);
  }
  sort(v);

  ll ans = 0;
  for (int i = 0; i < n && m > 0; i++) {
    ll pr = v[i].first;
    ll am = v[i].second;
    // debug3(m, pr, v.second);
    ans += min(m, am) * pr;
    m -= min(m, am);
  }
  outl(ans);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C;
  long long X;
  cin>>A>>B>>C>>X;
  int ans = 0;
  for(int i=0;i<=A;i++){
    for(int j=0;j<=B;j++){
      for(int k=0;k<=C;k++){
        if(i*500+j*100+k*50==X){
          ans++;
        }
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int N, red = 0;
  string s;
  cin >> N >> s;
  for (int i=0; i<N; i++) {
    if (s[i]=='R') red++;
  }
  if (2*red>N) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

using namespace std;

int cx, cy, n, ct;
const int N = 100004;

struct couple {
	int x, y, t;
};

bool operator < (couple a, couple b) {
	return a.t < b.t;
}

int localAbs(int v) {
	return v > 0 ? v : -v;
}

couple a[N];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d%d%d", &a[i].t, &a[i].x, &a[i].y);
	}
	//sort(a, a + n);
	cx = 0; cy = 0; ct = 0;
	for (int i = 0; i < n; i++) {
		int x, y, t;
		x = a[i].x;
		y = a[i].y;
		t = a[i].t;
		int h = localAbs(cx - x) + localAbs(cy - y);
		//printf("%d %d %d\n", h, t, ct);
		if (ct + h > t || (ct + h < t) && (t - (ct + h)) % 2 != 0) {
			printf("No\n"); return 0;
		}
		cx = x; cy = y; ct = t;
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)

int main() {
	string s, t; cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.rbegin(), t.rend());
	cout << (s < t ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;


public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        int ans = 700;
        
        for(int i=0; i<3; i++){
            if(s.charAt(i)=='o'){
                ans+=100;
            }
        }
        
		System.out.println(ans);
    }
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int n,k;
    cin >> n >> k;
    cout << n - k + 1 << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import collections


class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード

    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断

    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]


n, m, k = map(int, input().split())

friend_cnt = [0] * n
blocked_cnt = [0] * n

uf = UnionFind(n)

for i in range(m):
    a, b = map(int, input().split())
    friend_cnt[a-1] += 1
    friend_cnt[b-1] += 1
    uf.Unite(a-1, b-1)

for i in range(k):
    c, d = map(int, input().split())
    if uf.isSameGroup(c-1, d-1):
        blocked_cnt[c-1] = blocked_cnt[c-1] + 1
        blocked_cnt[d-1] = blocked_cnt[d-1] + 1

for i in range(n):
    renketsu_cnt_i = uf.Count(i)
    num_blocked = blocked_cnt[i]
    print(renketsu_cnt_i - friend_cnt[i] - num_blocked - 1, end="")
    if i != (n-1):
        print(' ', end="")
    else:
        print()


Measured memory_bytes: 108248
#include <iostream>

using namespace std;

int main(void)
{
    int N, M, X, Y, i, j, x[101], y[101], judge, ans=0;

    cin >> N >> M >> X >> Y;

    for(i=1; i<=N; i++){
        cin >> x[i];
    }

    for(i=1; i<=M; i++){
        cin >> y[i];
    }

    for(i=X+1; i<=Y; i++){
        judge = 1;

        for(j=1; j<=N; j++){
            if(x[j] >= i){
                judge = 0;
            }
        }

        for(j=1; j<=M; j++){
            if(y[j] < i){
                judge = 0;
            }
        }

        if(judge == 1){
            ans = 1;
            break;
        }
    }

    if(ans == 1){
        cout << "No War" << endl;
    }

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

    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int temp = n;
    int count = 0;
    while (temp > 0)
    {
        temp = temp / 10;
        count++;
    }
    int fx = 0, temp2 = n;
    for (int i = 0; i < count; i++)
    {
        fx += temp2 % 10;
        temp2 /=10;
    }
    puts(n % fx == 0 ? "Yes" : "No");
}

Measured memory_bytes: 256
MOD = 10**9 + 7
N, K = map(int, input().split())
*A, = map(int, input().split())
ans = 0
for i in range(N):
    a = A[i]
    for j in range(i):
        if A[j] > a:
            ans += K
    c = 0
    for j in range(N):
        if A[j] > a:
            c += 1
    ans += c * (K * (K - 1) // 2) % MOD
print(ans % MOD)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main(){
 int a, b, c, d = 0;
  cin >> a >> b >> c;
  for (int i = a; i <= b; ++i) {
    if ((c / i) * i == c) {
      ++d;
    }
  }
  cout << d << endl;
}



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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl

using namespace std;
using i64 = long long;

int main()
{
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> field(H);
    for (int i = 0; i < H; i++)
        cin >> field[i];

    int minimal = H + W - 2;
    for (int bit = 0; bit < (1 << (H - 1)); bit++)
    {
        bool grid_OK = true;
        vector<int> blocks(H, 0);
        vector<int> verlines;

        for (int w = 0; w < W; w++)
        {
            int blockcount = 0;
            for (int h = 0; h < H; h++)
            {
                blocks[blockcount] += field[h][w] - '0';
                if (bit & (1 << h))
                {
                    blockcount++;
                }
            }
            // 全てのblocksがK以下ならOK.
            bool OK = true;
            for (auto &&block : blocks)
            {
                OK &= (block <= K);
            }

            if (!OK)
            {
                // OKでない場合、w-1番目に線を引く。
                int newvline = w - 1;
                w--;

                // そもそも不可能だった場合
                if (newvline < 0)
                {
                    grid_OK = false;
                    break;
                }
                if ((!verlines.empty()) && newvline == verlines.back())
                {
                    grid_OK = false;
                    break;
                }

                verlines.push_back(newvline);

                // blocksをリセット
                for (auto &&block : blocks)
                {
                    block = 0;
                }
            }
        }

        int number_of_lines = __builtin_popcount(bit) + verlines.size();
        if (grid_OK)
            minimal = min(minimal, number_of_lines);
    }

    cout << minimal << endl;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# 


i = int(input())
if i > 7:
  print("NO")
elif i % 7 == 0:
  print("YES")
elif i > 5:
  print("NO")
elif i % 5 == 0:
  print("YES")
elif i % 3 == 0:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 2940
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
  string s;
  cin>>s;
  int N = s.size();
  char ans = -1;
  REP(iter, 100000){
    char c = (iter % 2 == 0) ? 'o' : 'x';
    bool ok = false;
    REP(i, s.size()) if(s[i] == c) ok = true;
    if(!ok){
      ans = (iter % 2 == 1) ? 'o' : 'x';
      break;
    }
    if(s[0] != c){
      s = c + s;
      for(int i = 1; i < s.size(); i++){
        if(s[i] == c) break;
        s[i] = c;
      }
    }else if(s[s.size()-1] != c){
      reverse(s.begin(), s.end());
      s = c + s;
      for(int i = 1; i < s.size(); i++){
        if(s[i] == c) break;
        s[i] = c;
      }
      reverse(s.begin(), s.end());
    }
  }
    cout<<ans<<endl;
  return 0;
}

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

long long N, A[87], CurrentMoney=1000;
int main() {

  cin>>N;
  for(int i=1; i<=N; i++) cin>>A[i];
  for(int i=1; i<=N-1; i++) {
    long long Stocks = 0;
    if(A[i]<A[i+1]) Stocks=CurrentMoney/A[i];
    CurrentMoney+=(A[i+1]-A[i])*Stocks;
}
  cout<<CurrentMoney<<endl;
}


Measured memory_bytes: 3624
#include <cstdio>
#include <vector>
using namespace std;
typedef vector<int> vi;
#define pb push_back
const int maxn = 200001;
int N,a[maxn],ans[maxn],sum[maxn]; vi b;
int main() {
    scanf("%d",&N); for (int i = 1;i <= N;i++) scanf("%d",&a[i]);
    for (int i = N;i;i--) {
        if (sum[i] != a[i]) ans[i] = 1;
        for (int j = 1;j*j <= i;j++) if (i%j == 0) {
            sum[j]+=ans[i]; sum[j]%=2;
            if (j*j < i) sum[i/j]+=ans[i],sum[i/j]%=2;
        }
    }
    for (int i = 1;i <= N;i++) if (ans[i]) b.pb(i);
    printf("%d\n",b.size());
    for (int x:b) printf("%d ",x); printf("\n");
}


Measured memory_bytes: 3704
// 巡回セールスマン問題
// 蟻本p173と同じ。
// 訪問済状態をビットで表すとbitDPで解ける

#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>
#include <climits>
#include <cassert>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair


ll INF = 1e9; // オーバーフローに注意

// S: これまでたどった頂点  v: 今いる頂点
int rec(int S, int v, int V, int E, vector<vector<ll>>& dp, vector<vector<ll>>& dist) {
    if (dp[S][v] >= 0) return dp[S][v];
    if (S == (1 << V) - 1 && v == 0) {
        return dp[S][v] = 0;
    }

    ll res = INF;
    REP(u, V) {  // 次に行く頂点をuとする
        if (!(S >> u & 1)) {
            auto d = dist[v][u];
            if (d != INF) {
                res = min(res, rec(S | 1 << u, u, V, E, dp, dist) + d);
            }
        }
    }
    return dp[S][v] = res;
}

ll travelling_salesman(int V, int E, vector<vector<ll>>& dist) {
    vector<vector<ll>> dp(1<<V, vector<ll>(V, -INF));
    return rec(0, 0, V, E, dp, dist);
}

int main(){
    int V, E;
    cin >> V >> E;
    vector<vector<ll>> dist(V, vector<ll>(V, INF));
    REP(e, E) {
        int s, t;
        ll d;
        cin >> s >> t >> d;
        dist[s][t] = d;
    }
    auto ret = travelling_salesman(V, E, dist);
    cout << (ret == INF ? -1 : ret) << endl;
}



Measured memory_bytes: 7532
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 4;

void solve() {
    ll n, x, y; cin >> n >> x >> y;
    // initialization of Floyd-Warshall
    vector<vector<long long> > dp(n, vector<long long>(n, INF64));
    for (int i = 0; i < n; ++i) dp[i][i] = 0;  // necessary

    for (int i = 0; i < n; ++i){
        for (int j = 0; j < n; ++j){
            dp[i][j] = abs(i-j);
        }
    }

    dp[x-1][y-1] = 1;
    dp[y-1][x-1] = 1;

    // Floyd-Warshall
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            dp[i][j] = min(dp[i][j], dp[i][x-1] + dp[x-1][j]);
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            dp[i][j] = min(dp[i][j], dp[i][y-1] + dp[y-1][j]);

    map<ll, ll> mp;
    for (int i = 0; i < n; ++i){
        for (int j = 0; j < n; ++j){
            ++mp[dp[i][j]];
        }
    }
    for (int i = 1; i < n; ++i) {
        cout << mp[i]/2 << endl;
    }
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 31744
#include <iostream>
#include <cstdio>

using namespace std;

int main(){
	int n, m, d;
	while(cin >> n >> m >> d){
		long long sum = (d == 0 ? n : 2 * max(0, n - d));
		double div = n;
		printf("%.10lf\n", sum*(m-1)/div/div);
	}
}

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



int main(){

    int a, b, c; cin >> a >> b >> c;

    if(a==b && b==c &&  c==a){cout << "No" << endl; return 0;}
    if(a!=b && b!=c && c!=a){cout << "No" << endl; return 0;}

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
S = input()
li = list(S)
ans = 'Yes'
for i, a in enumerate(li):
    if (i+1)%2 == 1:
        if a == 'L':
            ans = 'No'
            #break
    else:
        if a == 'R':
            ans = 'No'
            #break
print(ans)        

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int n,a[105],maxs=0,num[105];
int limi;
bool fail;

int main()
{
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        maxs = max(a[i],maxs);
        num[a[i]]++;
    }
    if (maxs&1)
    {
        limi = ((maxs+1)>>1);
        for (int i = 0; i < limi; ++i)
        {
            if(num[i]) fail = true;
        }
        if(num[limi]!=2) fail = true;
        for (int i = limi+1; i <= maxs; ++i)
        {
            if(num[i]<2) fail = true;
        }
    }
    else
    {
        limi = (maxs>>1);
        for (int i = 0; i < limi; ++i)
        {
            if(num[i]) fail = true;
        }
        if(num[limi]!=1) fail = true;
        for (int i = limi+1; i <= maxs; ++i)
        {
            if(num[i]<2) fail = true;
        }
    }
    puts(fail?"Impossible":"Possible");

    return 0;
}

Measured memory_bytes: 256
l,r,c,a[99],b[99],i,j,k,p;f(long n){n>1?a[i++]=n&1?f(n^1),--l:(f(n>>1),++r):(l=1);}long n;main(){scanf("%ld",&n),f(n+1);printf("%d\n",i*2);for(j=i;j;)b[a[--j]-l]=i-j;for(;k<i;)printf("%d ",b[k++]);for(;p<=r-l;)printf("%d ",++p);}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>

#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(void){
  string S;
  int x = 0;
  cin >> S;
  for(int i = 0; i < 4; i++){
    if(S[i] == '+'){
      x ++;
    }else{
      x --;
    }
  }
  cout << x << endl;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

int main(void)
{
	int N, K, Q;
	cin >> N >> K >> Q;
	vector<int> A(Q);
	vector<int> menber(N, K-Q);

	rep(i, Q) cin >> A[i];
	rep(i, Q) menber[A[i]-1]++;
	rep(i, N){
		if (menber[i] > 0){
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}
	}
	
	return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>

int main(){


int n;
scanf("%d",&n);
long long arr[200000] = {0};
scanf("%lli %lli",&arr[0],&arr[1]);
long long min = arr[0];
long long dif = arr[1] - arr[0];
long long max = dif;
for(int i=2;i<n;i++){
	scanf("%lli",&arr[i]);
}
for(int i=1;i<n;i++){

	if(min>arr[i-1])
	min = arr[i-1];

	dif = arr[i] - min;
	if(dif>max)
	max = dif;
}
printf("%lli\n",max);






	return 0;
}


Measured memory_bytes: 3420
S = input().strip()

if len(S) % 2 != 0:
    print("No")
else:
    hitach = "Yes"
    while len(S) > 0:
        s = S[0:2]
        S = S[2:]
        if s != "hi":
            hitach = "No"
            break
    print(hitach)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int n;
  cin >> n;
  ll a[n];
  rep(i,n)cin >> a[i];
  sort(a,a+n);
  reverse(a,a+n);
  vector<ll> v;
  int temp=0;
  while(temp<n && v.size()<2){
    int count=1;
    while(temp<n-1 && a[temp]==a[temp+1]){
      count++;
      temp++;
    }
    if(count>=2){
      v.push_back(a[temp]);
      if(count>=4)v.push_back(a[temp]);
    }
    temp++;
  }
  if(v.size()>=2)cout << v[0]*v[1] << endl;
  else cout << 0 << endl;
return 0;}

Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <vector>

using namespace std;

int main() {
	int n;
	scanf("%d", &n);
	double v;
	vector<double> x;
	vector<double> y;
	int i;

	i = 0;
	while(1) {
		if(i >= n) break;
		cin >> v;
		x.push_back(v);
		//printf("[%d] %lf ", i, v);
		i++;
	}

	i = 0;
	while(1) {
		if(i >= n) break;
		cin >> v;
		y.push_back(v);
		//printf("[%d] %lf ", i, v);
		i++;
	}

	// p = 1, 2, 3
	int p;
	double sum;
	double d;
	for(p = 1; p <= 3; p++) {
		sum = 0;
		for(i = 0; i < n; i++) {
			sum += pow(fabs(x[i] - y[i]), (double)p);
		}
		d = pow(sum, 1.0 / (double)p);
		printf("%lf\n", d);
	}

	// p = infinity
	double dd;
	d = fabs(x[0] - y[0]);
	for(i = 1; i < n; i++) {
		dd = fabs(x[i] - y[i]);
		if(d < dd) d = dd;
	}
	printf("%lf\n", d);
	return 0;
}

Measured memory_bytes: 3468
N = int(input())
XY = []
for i in range(N):
    x,y=map(int,input().split())
    XY.append([x,y])

def f(x,y):
  mx = 0
  for x1,y1 in XY:
    if ((x1-x)**2+(y1-y)**2)**0.5 > mx:
      mx = ((x1-x)**2+(y1-y)**2)**0.5
  return mx

def g(x):
  l = 0.0
  r = 1000.0
  for i in range(80):
    c1 = (l*2+r)/3
    c2 = (l+r*2)/3
    if f(x,c1) > f(x,c2):
      l = c1
    else:
      r = c2
  return f(x,l)

l = 0.0
r = 1000.0
for i in range(80):
  c1 = (l*2+r)/3
  c2 = (l+r*2)/3
  if g(c1) > g(c2):
    l = c1
  else:
    r = c2

print(g(l))


Measured memory_bytes: 43624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100001,INF=1<<30;

int main(){

    int N;
    ll V;cin>>N>>V;
    vector<ll> A(N),B(N),C(N),D(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    for(int i=0;i<N;i++){
        cin>>B[i];
    }
    for(int i=0;i<N;i++){
        cin>>C[i];
    }
    for(int i=0;i<N;i++){
        cin>>D[i];
    }
    
    vector<ll> L,R;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            L.push_back(A[i]+B[j]);
            R.push_back(C[i]+D[j]);
        }
    }
    
    sort(all(R));
    
    ll ans=0;
    
    for(int i=0;i<N*N;i++){
        auto it=lower_bound(all(R),V-L[i]),it2=upper_bound(all(R),V-L[i]);
        ans+=distance(it,it2);
        //cout<<ans<<endl;
    }
    
    cout<<ans<<endl;
}




Measured memory_bytes: 18800
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1000000007;
const ll INF=2e18;

ll N,M,K,C;
ll a,b,c,d;
string s;
int main(){
    cin>>a>>b;

    cout<<max(a+b,max(a-b,a*b)) <<endl;
    return 0;
}


Measured memory_bytes: 256
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef long long ll;
const int MYINF = 1e9+7;
typedef int bool;
const bool true = 1;
const bool false = 0;

typedef struct node_st {
	int key;
	struct node_st *left, *right;
} node_t;

node_t *root;

node_t *node_new(int x) {
	node_t *new = malloc(sizeof(node_t));
	if (new == NULL) exit(1);
	new->key = x;
	new->left = new->right = NULL;
	return new;
}

node_t *insert(node_t *nd, int x) {
	if (!nd) return node_new(x);
	if (x < nd->key) nd->left = insert(nd->left, x);
	else if (nd->key < x) nd->right = insert(nd->right, x);
	return nd;
}

node_t *find(node_t *nd, int x) {
	if (!nd) return NULL;
	if (x < nd->key) return find(nd->left, x);
	else if (nd->key < x) return find(nd->right, x);
	return nd;
}

enum {
	PREORDER,
	INORDER,
};

void print_tree(node_t *nd, int order) {
	if (!nd) return;
	if (order == PREORDER) printf(" %d", nd->key);
	print_tree(nd->left, order);
	if (order == INORDER) printf(" %d", nd->key);
	print_tree(nd->right, order);
}

int main(int argc, char **argv)
{
	int i, n, x;
	char cmd[128];

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%s", cmd);
		if (!strcmp("insert", cmd)) {
			scanf("%d", &x);
			root = insert(root, x);
		} else if (!strcmp("find", cmd)) {
			scanf("%d", &x);
			printf("%s\n", find(root, x) ? "yes" : "no");
		} else if (!strcmp("print", cmd)) {
			print_tree(root, INORDER);
			puts("");
			print_tree(root, PREORDER);
			puts("");
		}
	}

	return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll Euclid(ll A, ll B){
    if(A<B) swap(A, B);
    ll C = B;
    while(C != 0){
        C = A%B;
        A = B;
        B = C;
    }
    return A;
}

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

    ll T;
    cin >> T;

    REP(t, T){
    	ll A, B, C, D;
    	cin >> A >> B >> C >> D;

    	bool flag;
    	if(A < B){
    		flag = false;
    	}else{
    		if(D < B){
    			flag = false;
    		}else{
    			if(C >= B){
    				flag = true;
    			}else{
    				ll g = Euclid(B, D);
    				if(B-g+(A%g) > C){
    					flag = false;
    				}else{
    					flag = true;
    				}
    			}
    		}
    	}
    	cout << (flag ? "Yes" : "No") << endl;
    }

    return 0;
}

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

namespace CSharpSample01
{
    
    class Program
    {
        
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            
            int ans = 0;

            if(A > B)
            {
                ans = 2 * A - 1;
            }
            else if(A < B)
            {
                ans = 2 * B - 1;
            }
            else
            {
                ans = A + B;
            }
            
            Console.WriteLine(ans);
            
        }
    }
}


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

using namespace std;

int in = 0;

int num(string str) {
    int res = str[in] - '0';
    in++;
    return res;
}

int mul(string str) {
    int res = num(str);
    int len = str.length();
    while (in < len && str[in] == '*') {
        in++;
        int temp = num(str);
        res *= temp;
    }
    return res;
}

int eval(string str) {
    int res = mul(str);
	int len = str.length();
    while (in < len) {
    	in++;
        res += mul(str);
    }
    return res;
}
    
int ltor(string str) {
    int res = str[0] - '0';
	int len = str.length();
    for (int i = 1; i < len; i += 2) {
        if (str[i] == '+') {
            res += str[i + 1] - '0';
        }
		else {
            res *= str[i + 1] - '0';
        }
   }     
   return res;
}

int main() {
    string expr;
	cin >> expr;
    int result;
	cin >> result;
    int m = eval(expr);
    int l = ltor(expr);
    if(result == m && result == l){
		cout << "U\n";
    }
	else if (result == m) {
       cout << "M\n";
    }
	else if (result == l) {
       cout << "L\n";
    }
	else {
       cout << "I\n";
    }
	return 0;
}



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


def solve(S: int, K: int):
    K -= 1
    for c in str(S):
        if c == "1":
            K -= 1
        else:
            K = -1
        if K < 0:
            print(c)
            return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(S, K)


if __name__ == '__main__':
    main()


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

using namespace std;
using LL = long long;

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

    int n, k;
    cin >> n >> k;
    priority_queue< int> pq;
    for (int i = 0; i < n; i ++) {
        int x;
        cin >> x;
        pq.push(x);
    }

    while (k > 0) {
        int x = pq.top(); pq.pop();
        k --;
        pq.push(x / 2);
    }

    LL result = 0;
    while (!pq.empty()) {
        result += pq.top();
        pq.pop();
    }
    cout << result << endl;
}

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    string a, b, c;
    cin >> a >> b >> c;
    cout << "A" << b[0] << "C" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N, M, A[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> M;
	rep(i, 0, N) cin >> A[i];
	sort(A, A + N);
	vector<pair<int, int>> v;
	rep(i, 0, M) {
		int B, C;
		cin >> B >> C;
		v.push_back({ C, B });
	}
	sort(all(v), greater<pair<int, int>>());

	int id = 0;
	fore(p, v) {
		rep(i, 0, p.second) {
			if (id == N) break;
			if (A[id] < p.first) {
				A[id] = p.first;
				id++;
			}
			else break;
		}
	}

	ll ans = 0;
	rep(i, 0, N) ans += A[i];
	cout << ans << endl;
}


Measured memory_bytes: 1784
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;
 
#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int main() {
  int n;
  cin >> n;
  int ans = n; 
  rep(i ,n+1){
    int tmp=0;
    int t = i;
    while(t>0){
      tmp += t % 6;
      t /= 6;
    }
    t = n - i;
    while(t>0){
      tmp += t % 9;
      t /= 9;
    }
    ans = min(ans, tmp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  ll x,y;
  cin >> x >> y;
  int ans = 0;
  while(x<=y){
    ++ans;
    x<<=1;
  }
  cout << ans << endl;
}


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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	vector<int>arr(n);
	for(int i=0; i<n; i++) cin>>arr[i];
	sort(arr.begin(),arr.end());
	long long sum = 0;
	int p = n-1;
	int num = 1;
	for(int i=0; i<n-1; i++){
		sum+=arr[p];
		num--;
		if(num==0){
			p--;
			num=2;
		}
	}
	cout<<sum;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h> 
using namespace std;  
long INF=1000000000000000;
int main() {
    long N,K;
    cin>>N>>K;
    
    
    vector<long> A(N);
    for(int i=0;i<N;i++) cin>>A.at(i);
    
    long sum=0;
    for(int i=0;i<N;i++) sum+=A.at(i);
    
    vector<long> divi(0);
    
    long n=1;
    while(n*n<=sum){
        if(sum%n==0){
            divi.push_back(n);
            divi.push_back(sum/n);
        }
        n++;
    }
    
    
    long ans=0;
    vector<long> rem(N);
    
    for(int i=0;i<divi.size();i++){
        long d=divi.at(i);
        
       // cout<<d<<endl;
        
        for(int i=0;i<N;i++) rem.at(i)=(A.at(i)%d);
        
        sort(rem.begin(),rem.end());
        
        long cost=0;
        long L=0,R=N-1;
        while(L<R){
            long mess=rem.at(L);
            cost+=mess;
            while(mess>0){
                if((d-rem.at(R))>=mess) {
                    rem.at(R)+=mess;
                    mess=0;
                }
                else{
                    mess-=(d-rem.at(R));
                    rem.at(R)=d;
                }
                
                if(rem.at(R)==d) R--;
            }
            L++;
        }
        //cout<<d<<" "<<cost<<endl;
        if(cost<=K) ans=max(ans,d);
    }
    
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

int main() {
    int n, d;
    int ans;
    cin >> n >> d;
    if (n % (d * 2 + 1) == 0) {
        ans = n / (d * 2 + 1);
    }
    else ans = n / (d * 2 + 1) + 1;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define ll long long
#define mset(s, _) memset(s, _, sizeof s)
#define ALL(a) (a).begin(), (a).end()
using namespace std;

int main(void) {
  static const double pi = 3.141592653589793238;
  int A, B, H, M;
  cin >> A >> B >> H >> M;

  double thetaA = (60.0 * H + M) / 2.0;
  double thetaB = M * 6.0;

  // cout << thetaA << " " << thetaB << endl;
  // cout << thetaA - thetaB << endl;
  // cout << pi * (thetaA - thetaB) / 180.0 << endl;

  double ans =
      sqrt(A * A + B * B - 2 * A * B * cos(pi * (thetaA - thetaB) / 180.0));

  printf("%.15f", ans);
  return 0;
}


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

int		main()
{
	int N, M; cin >> N >> M;
	int hoge = 0;
	int ans = 0;
	for (int i = 0; i < M; i++) 
	{
		int a; cin >> a;
		hoge += a;
	}
	cout << (N < hoge ? -1 : N - hoge) << endl;
}



Measured memory_bytes: 3632
//538B
#include<bits/stdc++.h>

using namespace std;



int main(){

    cout << fixed;
    cout << setprecision(0);

    int a ,b , c;
    cin >> a >> b>>c;

    int n = a*100 + 10*b + c ;

    if(n%4==0)
        cout << "YES" ;
    else
        cout << "NO" ;

	return 0;
}



Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto nm = readln.split.to!(int[]);
    auto N = nm[0];
    auto M = nm[1];
    int[][] G;
    G.length = N;
    foreach (i; 0..M) {
        auto ab = readln.split.to!(int[]);
        auto A = ab[0]-1;
        auto B = ab[1]-1;
        G[A] ~= B;
        G[B] ~= A;
    }

    auto res = new int[](N);
    auto ss = [0];
    while (!ss.empty) {
        int[] nss;
        foreach (s; ss) {
            foreach (n; G[s]) if (res[n] == 0) {
                res[n] = s+1;
                nss ~= n;
            }
        }
        ss = nss;
    }
    writeln("Yes");
    foreach (r; res[1..$]) writeln(r);
}

Measured memory_bytes: 25252
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);
typedef pair<int,int> P;
const int INF = 1001001001;

vector<int> to[100005];

int main() {
  int n, m;
  cin >> n >> m;
  rep(i,m){
    int a, b;
    cin >> a >> b;
    --a, --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  queue<int> q;
  vector<int> dist(n, INF);
  vector<int> pre(n, -1);
  dist[0]=0;
  q.push(0);
  while(!q.empty()){
    int v = q.front();q.pop();
    for(int u :to[v]){
      if(dist[u]!=INF)continue;
      dist[u]=dist[v]+1;
      pre[u]=v;
      q.push(u);
    }
  }
  cout << "Yes" << endl;
  rep(i,n){
    if(i==0)continue;
    int ans = pre[i];
    ++ans;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 10564
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>


long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;


int main(){
int N,k;
cin>>N>>k;
int h;
int ans=0;
for(int i=0;i<N;i++){
    cin>>h;
    if(h>=k){
        ans++;
    }
}

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

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

#define MAX 100010
#define MOD 1000000007
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
#define dbg(x) cout << #x << " = " << x << endl
#define ran(a, b) ((((rand() << 15) ^ rand()) % ((b) - (a) + 1)) + (a))

using namespace std;

int n;
long long a, b, ar[MAX];

int main(){
    int i, j, k, l;

    while (scanf("%d %lld %lld", &n, &a, &b) != EOF){
        for (i = 0; i < n; i++) scanf("%lld", &ar[i]);

        int cur = ar[0];
        long long res = 0;
        for (i = 0; i < n; i++){
            long long x = abs(ar[i] - cur);
            res = res + min(x * a, b);
            cur = ar[i];
        }

        printf("%lld\n", res);
    }
    return 0;
}


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

int main(){
  const int64_t mod=1e9+7;
  int N,K;
  cin >> N >> K;
  vector<int64_t> sum(N+2);
  sum.at(0)=0;
  for(int i=1;i<=N+1;i++){
    sum.at(i)=i+sum.at(i-1);
  }
  int64_t ans=0;
  for(int i=K;i<=N+1;i++){
    ans+=(sum.at(N+1)-sum.at(N+1-i))-(sum.at(i)-sum.at(0))+1;
    ans%=mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4844
int_str = input()
triple_same_digit = ['000']

first_three_digits = int_str[0:3]
last_three_digits = int_str[-3:]

for i in range(111, 1000, 111):
    triple_same_digit.append(str(i))

if first_three_digits in triple_same_digit:
    print('Yes')
elif last_three_digits in triple_same_digit:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9032
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
    cin>>n;int a[3]={0};
    for(int i=0;i<n;i++){
        cin>>a[0]>>a[1]>>a[2];
        sort(a,a+3);
        cout<<((a[2]*a[2])==(a[1]*a[1]+a[0]*a[0])?"YES":"NO")<<endl;
    }
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef pair<ll,P>  PP;
typedef vector<ll> Vector;
typedef vector<Vector> DVector;
typedef priority_queue<PP, vector<PP>, greater<PP>> PPQueue;

#define fi          first
#define se          second
#define sfi         se.fi
#define sse         se.se
#define pb          push_back
#define INF         INT_MAX
#define MOD         1000000007
#define bcnt        __builtin_popcount
#define all(x)      (x).begin(),(x).end()
#define uni(x)      x.erase(unique(all(x)),x.end())
#define ub(x,y)     (upper_bound(all(x),y)-x.begin())
#define lb(x,y)     (lower_bound(all(x),y)-x.begin())
#define rep(i,n)    repl(i,0,n-1)
#define usort(x)    sort(all(x))
#define dsort(x)    sort(all(x),greater<ll>())
#define mkp(x,y)    make_pair(x,y)
#define mmax(x,y)   (x>y?x:y)
#define mmin(x,y)   (x<y?x:y)
#define maxch(x,y)  x=mmax(x,y)
#define minch(x,y)  x=mmin(x,y)
#define exist(x,y)  (find(all(x),y)!=x.end())
#define each(itr,v) for(auto itr:v)
#define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)

int main() {
  cin.sync_with_stdio(false);
  ll k;
  cin >> k;

  cout << 50 << endl;

  Vector a(50);
  ll times = k / 50;
  ll plus = k % 50;

  rep(i,50)a[i] = i + times;
  reverse(all(a));

  rep(i, plus) a[i]++;

  rep(i, 49) cout << a[i] << " ";
  cout << a[49] << endl;
}


Measured memory_bytes: 256
#pragma GCC target ("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

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

bool prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)return false;
    }
    return n != 1;
}
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int t = mod_pow(n, p / 2, m);
        return (t * t) % m;
    }
    return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int digit(int x) {
    int cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}
int read() {
    int tmp;
    cin >> tmp;
    return tmp;
}
int xor128() {
    static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    int t = (x xor (x << 11));
    x = y; y = z; z = w;
    return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
    map<int, int>ans;
    int now = 2;
    while (now * now <= x) {
        if (x % now == 0) {
            x /= now;
            ans[now]++;
        }
        else now++;
    }
    if (x != 1) ans[x]++;
    return ans;
}
int comb(int n, int k) {
    k = min(k, n - k);
    int x = 1, y = 1;
    rep(i, k) {
        y *= i + 1;
        y %= MOD;
    }
    for (int i = n - k + 1; i <= n; i++) {
        x *= i;
        x %= MOD;
    }
    return x * modinv(y, MOD) % MOD;
}

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

    int n, k;
    cin >> n >> k;
    if (n < k) {
        cout << min(n, k - n) << endl;
    }
    else if (n == k) {
        cout << 0 << endl;
    }
    else {
        cout << min(n % k, k - n % k) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long LL;
#define int long long
const int N = (int) 1e6 + 6, mod = (int) 0;
int a[N];
int32_t main() {
	int n;
	cin >> n;
	for (int j = 0; j < n; ++j) {
		cin >> a[j];	
	}
	int mn = 2, mx = 2;
	if (a[n - 1] != 2) {
		cout << -1 << endl;
		return 0;
	}
	for (int j = n - 2; j >= 0; --j) {
		int nmx = (mx + a[j + 1] - 1) / a[j] * a[j];
		int nmn = (mn - 1) / a[j] * a[j] + a[j];
		if (nmx < nmn) {
			cout << -1 << endl;
			return 0;
		}
		mx = nmx;
		mn = nmn;
	}
	cout << mn << ' ' << mx + a[0] - 1 << endl;
}

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

int main(){
  bool flag=true;
  ll n;
  cin >> n;
  ll a;
  r(i,n){
    cin >> a;
    if(a%2==1)flag=false;
  }
  if(flag)cout<<"second"<<endl;
  else cout<<"first"<<endl;
}

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

int n, A[100000];

int partition(int p, int r) {
	int x = A[r];
	int i = p - 1;
	for (int j = p; j < r; j++) {
		if (A[j] <= x) {
			i++;
			swap(A[i], A[j]);
		}
	}
	swap(A[i + 1], A[r]);
	return i + 1;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> A[i];
	int mid = partition(0, n - 1);
	for (int i = 0; i < mid; i++)
		cout << A[i] << " ";
	cout << "[" << A[mid] << "] ";
	for (int i = mid + 1; i < n - 1; i++)
		cout << A[i] << " ";
	cout << A[n - 1] << endl;
	return 0;
}



Measured memory_bytes: 3476
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

double DP[310][310][310] = {};

int main(){
	
	int N;
	cin >> N;
	
	int c[4] = {};
	
	for(int i = 1; i <= N; i++){
		int a;
		cin >> a;
		c[a] += 1;
	}
	
	DP[c[1]][c[2]][c[3]] = 1;
	
	double ans = 0;
	for(int k = c[3]; k >= 0; k--){
		for(int j = c[3] + c[2]; j >= 0; j--){
			for(int i = N; i >= 0; i--){
				if(i + j + k > N){
					continue;
				}
				if(i + j + k == 0){
					break;
				}
				double S2 = i + j + k;
				double R = N / S2;
				ans += DP[i][j][k] * R;
				
				if(i != 0){
					DP[i - 1][j][k] += DP[i][j][k] * i / S2;
				}
				if(j != 0){
					DP[i + 1][j - 1][k] += DP[i][j][k] * j / S2;
				}
				if(k != 0){
					DP[i][j + 1][k - 1] += DP[i][j][k] * k / S2;
				}
			}
		}
	}
	
	printf("%.14f\n", ans);
	
	return 0;
}


Measured memory_bytes: 217472
#include<bits/stdc++.h>
using namespace std;
int n;
long long a[500010],sum,c,mm=999999999999999;
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum+=abs(a[i]);
		if(a[i]<0)
			c++;
		mm=min(mm,abs(a[i]));
	}
	//cout<<sum<<endl<<c<<endl<<mm;
	if(c%2==0)
		cout<<sum;
	else
		cout<<sum-2*mm;
	return 0;
}


Measured memory_bytes: 1024
N=int(input())
A=[int(x) for x in input().split()]

mi=100000000
ma=-100000000
mi_n=0
ma_n=0
for i in range(N):
  if A[i]>ma:
    ma=A[i]
    ma_n=i+1
  if A[i]<mi:
    mi=A[i]
    mi_n=i+1

if mi>=0:
  print(N-1)
  for i in range(N-1):
    print(i+1,i+2)
elif ma<=0:
  print(N-1)
  for i in range(N-1):
    print(N-i,N-i-1)
else:
  print(N+N-1)
  if abs(ma)>abs(mi):
    for i in range(N):
      print(ma_n,i+1)
    for j in range(N-1):
      print(j+1,j+2)
  else:
    for i in range(N):
      print(mi_n,i+1)
    for j in range(N-1):
      print(N-j,N-j-1)


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

using namespace std;

int main(){
	int dp[2][2000];
	int N, Z, W;
	while(cin >> N >> Z >> W){
		vector<int> a(N);
		for(int& t : a) cin >> t;
		for(int i=N-1;i>0;i--){
			dp[0][i] = dp[1][i] = abs(a[i-1] - a[N-1]);
			for(int j=i;j<N;j++){
				dp[0][i] = max(dp[0][i], dp[1][j]);
				dp[1][i] = min(dp[1][i], dp[0][j]);
			}
		}
		dp[0][0] = abs(W - a[N-1]);
		for(int i=1;i<N;i++) dp[0][0] = max(dp[0][0], dp[1][i]);
		cout << dp[0][0] << endl;
	}
}

Measured memory_bytes: 256
a=-1,A=65,d;
char
*N="GKSOCNWLDFVTBRXHAJUPEMQI",
*E="PHLTIDOXQAGWECSUMBKVJFNR",
*R="BCDAFGHEJKLINOPMRSTQVWXU",
s[9];
main(c)
{
for(;c-48&&scanf("%s",s);a+=d/4+1)
(c=*s)<A?~a&&printf("%d\n",a),a=d=0:0,
d=(c==78?d=N[d]:
c==69?d=E[d]:
c==82?d=R[d]:
c==83?d=N[N[N[d]-A]-A]:
c==87?d=E[E[E[d]-A]-A]:d+A)-A,
d=c==76?d=R[R[R[d]-A]-A]-A:d;
}

Measured memory_bytes: 0