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

#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ll IINF = INT_MAX;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int ans = 0;
    for (int i = 1; i <= 5; i++) {
        int x;
        cin >> x;
        if (x == 0) ans = i;
    }
    cout << ans << '\n';
    return 0;
}

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

int a[60];
int A, n;

long long dp[50][2500][50];

void init() {
	for (int i = 0; i < 50; ++i) {
		for (int j = 0; j < 2500; ++j) {
			for (int k = 0; k < 50; ++k) {
				dp[i][j][k] = -1;
			}
		}
	}
}

long long rek(int i, int sum, int cnt) {
	if (i < 0) return 0;
	if (dp[i][sum][cnt] != -1) return dp[i][sum][cnt];
	return dp[i][sum][cnt] = (sum+a[i] == A*(cnt+1)) + rek(i-1, sum+a[i], cnt+1) + rek(i-1, sum, cnt);
}

void solve() {scanf("%d %d", &n, &A);
	for (int i = 0; i < n; ++i) scanf("%d", a+i);
	printf("%lld", rek(n-1, 0, 0));
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int>data(N);
  for(int i=0;i<N;i++){
    cin >> data.at(i);
  }
  int ima=1;
  for(int i=1;i<N+2;i++){
    if(data.at(ima-1)==2){
      cout << i << endl;
      return 0;
    }
    ima=data.at(ima-1);
  }
  cout << -1 << endl;
}

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

int main(){
    int N;
    while(cin >> N, N != -1){
        string now = "0000000";
        for(int i = 0; i < N; i++){
            int k;
            cin >> k;
            string S;
            if(k == 0) S = "0111111";
            if(k == 1) S = "0000110";
            if(k == 2) S = "1011011";
            if(k == 3) S = "1001111";
            if(k == 4) S = "1100110";
            if(k == 5) S = "1101101";
            if(k == 6) S = "1111101";
            if(k == 7) S = "0100111";
            if(k == 8) S = "1111111";
            if(k == 9) S = "1101111";

            string ans = "0000000";
            for(int i = 0;i < ans.size(); i++){
                if(now[i] != S[i]) ans[i] = '1';
            }
            now = S;
            cout << ans << endl;
        }
    }
    
}


Measured memory_bytes: 3208
n, k = map(int, input().split())
lst = [int(i) for i in input().split()]

count = 0
min_price = 0
while count < k:
  #print(count)
  total = min_price
  for i in range(len(lst)):
    total += lst[i]
    #print(total)
    if i == 0:
      min_price = total
      min_index = i
    elif total < min_price:
      min_price = total
      min_index = i
    total -= lst[i]
  lst.pop(min_index)
  count += 1
print(min_price)

Measured memory_bytes: 9260
import java.util.*;
 
public class Main{
 
    void solve(){
        Scanner sc = new Scanner(System.in);
 
        while(true){
            int n = sc.nextInt();
            if(n==0) break;

            ArrayList<int[]> hr = new ArrayList<int[]>();

            for(int i=0; i<n; i++) 
                hr.add(new int[]{sc.nextInt(), sc.nextInt()});

            int m = sc.nextInt();
            for(int i=0; i<m; i++) 
                hr.add(new int[]{sc.nextInt(), sc.nextInt()});

            Collections.sort(hr, new Comparator<int[]>(){
                    public int compare(int[] a, int[] b){
                        if(a[0]<b[0]) return -1;
                        if(a[0]>b[0]) return 1;
                        if(a[1]<b[1]) return -1;
                        if(a[1]>b[1]) return 1;
                        return 0;
                    }
                });
 
            int[] dp = new int[n+m];
            Arrays.fill(dp,1);
            for(int i=0; i<n+m; i++){
                for(int j=0; j<i; j++){
                    if(hr.get(i)[0]<=hr.get(j)[0]) continue;
                    if(hr.get(i)[1]<=hr.get(j)[1]) continue;
                    dp[i] = Math.max(dp[i],dp[j]+1);
                }
            }
 
            int ans = 0;
            for(int i=0; i<n+m; i++) ans = Math.max(ans, dp[i]);
 
            System.out.println(ans);
        }
    }
 
    public static void main(String[] args){
        new Main().solve();
    }
}

Measured memory_bytes: 24872
A = input()
B = input()
C = input()
player = ['A','B','C']
word = ['a','b','c']
S = [list(A), list(B), list(C)]
turn = 0
while(1):
  if len(S[turn]) == 0:
    print(player[turn])
    break
  else:
    tmp = S[turn].pop(0)
    turn = word.index(tmp)


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
// ifstream fin("filename.in");
// ofstream fout("filename.out");

int main(){
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	while(k>0 && b<=a)
	{
		b = b*2;
		k--;
	}
	while(k>0 && c<=b)
	{
		c = c*2;
		k--;
	}
	if(c>b && b>a)
		cout<<"Yes";
	else 
		cout<<"No";
}


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

char s[105];

int main(){
    scanf("%s",s+1);
    int n=strlen(s+1);
    bool f=1;
    for(int i=1;i<=n/2;i++){
        if(s[i]!=s[n-i+1]) f=0;
    }
    int len=n/2;
    for(int i=1;i<=len/2;i++){
        if(s[i]!=s[len-i+1]) f=0;
        if(s[len+1+i]!=s[len+1+len-i+1]) f=0;
    }
    if(f) puts("Yes");
    else puts("No");
}


Measured memory_bytes: 256
#include <cstdio>

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

    int ans = 0;
    for (int i = 0; i < n; i++) {
        int a;
        scanf("%d", &a);
        while (a % 2 == 0) {
            a /= 2;
            ans++;
        }
    }
    
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
using System;
using System.Linq;

namespace atcorder
{
    class Program
    {
        static void Main()
        {
            var k = int.Parse(Console.ReadLine());
            var ab = Console.ReadLine().Split(' ');

            var a = int.Parse(ab[0]);
            var b = int.Parse(ab[1]);

            int sho = a / k;
            if(a % k != 0)
            {
                sho += 1;
            }

            if(k * sho >= a && k * sho <= b)
            {
                Console.WriteLine("OK");
            }
            else
            {
                Console.WriteLine("NG");
            }


        }
    }
}


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

int main() {
	int k; cin >> k;
	queue<ll> que;
	if (k <= 9) {
		cout << k << endl;
		return 0;
	}
	for (int i = 1; i <= 9; ++i) que.push(i);
	int cnt = 9;
	while (que.size()) {
		ll tmp = que.front(); que.pop();
		if (tmp % 10 > 0) {
			que.push(tmp * 10 + tmp % 10 - 1);
			cnt++;
			if (cnt == k) {
				cout << tmp * 10 + tmp % 10 - 1 << endl;
				return 0;
			}
		}
		que.push(tmp * 10 + tmp % 10);
		cnt++;
		if (cnt == k) {
			cout << tmp * 10 + tmp % 10 << endl;
			return 0;
		}
		if (tmp % 10 < 9) {
			que.push(tmp * 10 + tmp % 10 + 1);
			cnt++;
			if (cnt == k) {
				cout << tmp * 10 + tmp % 10 + 1 << endl;
				return 0;
			}
		}
	}
	return 0;
}

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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

int main()
{
    canhazfast();

    int n, m, a, b;

    cin >> n >> m >> a >> b;
    for (int i = 0; i < n; ++i) {
        int r = i < b;
        for (int j = 0; j < m; ++j) {
            int c = j < a;
            char x = (r^c)+'0';
            cout << x;
        }
        cout << '\n';
    }

    return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>

int main(void) {
int input[2];
int area, length;

scanf("%d %d", &input[0], &input[1]);

area = input[0] * input[1];
length = input[0] * 2 + input[1] * 2;

printf("%d %d\n", area, length);

return 0;
}


Measured memory_bytes: 2052
import numpy as np
N, K = map(int, input().split())
h = list(map(int, input().split()))
h = np.array(h, dtype='int32')
x = [0] * N
x = np.array(x, dtype='int32')
x[0] = 0
x[1] = x[0] + abs(h[1] - h[0])
for i in range(2, N):
    if (i < K):
        x[i] = min(x[0:i] + abs(h[i] - h[0:i]))
    else:
        x[i] = min(x[i - K:i] + abs(h[i] - h[i - K:i]))
print(x[N - 1])


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

int main()
{
    int n = 0, q = 0;
    cin >> n >> q;

    queue<pair<string, int>> schedule;

    vector<pair<string, int>> task(n, make_pair(" ", 0));
    for (int i = 0; i < n; i++)
    {
        cin >> task[i].first >> task[i].second;
        schedule.push(make_pair(task[i].first, task[i].second));
    }

    int now = 0;
    vector<pair<int, string>> finished;

    while (schedule.empty() == false)
    {
        string taskname_top = schedule.front().first;
        int remainder_top = schedule.front().second;

        schedule.pop();
        if (remainder_top > q)
        {
            schedule.push(make_pair(taskname_top, remainder_top - q));
            now = now + q;
        }
        else
        {
            now = now + remainder_top;
            finished.push_back(make_pair(now, taskname_top));
            // finished[taskname_top] = now;
        }

        // cout << "now: " << now << endl;
    }

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

    for (int i = 0; i < n; i++)
    {
        cout << finished[i].second << " " << finished[i].first << endl;
    }
}


Measured memory_bytes: 7780
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    n, r = map(int,input().split())
    if 10 <= n:
        print(r)
    else:
        print(r + (100 * (10 - n)))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 2940
import java.io.PrintWriter

fun main() {
    val pw = PrintWriter(System.out)

    val (n, k) = readInputLine().split(" ").map { it.toLong() }

    val mod = 1000000007L

    var ans = 0L

    for (i in LongRange(k, n + 1L)) {
        val l = (i - 1L) * i / 2L
        val r = n * (n + 1L) / 2L - (n - i) * (n - i + 1L) / 2L

        ans = (ans + r - l + 1L) % mod
    }

    pw.println(ans)

    pw.flush()
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 36608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

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

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

void primeFactor(ll val, map<ll,ll> &primeList){
  if(val<1){
    return;
  }
  for(int i=2;i*i<val;i++){
    while(val%i==0){
      primeList[i]++;
      val/=i;
    }
  }
  if(val!=1){
    primeList[val]=1;
  }
  return;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  ll n;cin>>n;
  vector<ll> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  ll sum=0;
  ll p=a[n-2];
  ll ans=0;
  for(int i=0;i<n-1;i++){
    sum+=a[n-1-i];
    sum%=mod;
    p=a[n-2-i];
    ll val=sum*p%mod;
    ans+=val;
    ans%=mod;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4836
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class AAddtion
    {
        public static void Main(string[] args)
        {
            new AAddtion().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var n = cin.ReadInt;
            int[] aList = new int[n];
            int[] dest = new int[n];
            
            for(int i = 0; i<n; i++) aList[i] = cin.ReadInt;

            Array.Copy(aList, dest, n);
            Array.Sort(dest);

            for (int i = 0; i < n; i++)
            {
                if (aList[i] == dest[n - 1])
                {
                    Console.WriteLine(dest[n - 2]);
                }
                else
                {
                    Console.WriteLine(dest[n - 1]);
                }
            }
        }
    }
}

public class ConsoleInput
{
    private readonly System.IO.TextReader _stream;
    private char _separator = ' ';
    private Queue<string> inputStream;
    public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
    {
        this._separator = separator;
        this._stream = stream;
        inputStream = new Queue<string>();
    }
    public string Read
    {
        get
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(_separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
    }
    public string ReadLine { get { return _stream.ReadLine(); } }
    public int ReadInt { get { return int.Parse(Read); } }
    public long ReadLong { get { return long.Parse(Read); } }
    public double ReadDouble { get { return double.Parse(Read); } }
    public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
    public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
    public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
}

Measured memory_bytes: 18104
n = int(input())
ranges = []
for _ in range(n):
    xi, li = map(int, input().split())
    ranges.append((xi - li, xi + li))
ranges = sorted(ranges, key=lambda x: x[1])


ans = 0
cur = -int(1e18)
for i in range(n):
    if cur <= ranges[i][0]:
        ans += 1
        cur = ranges[i][1]

print(ans)

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int n, k;
  cin >> n >> k;
  if (n <= k) {
    cout << 0 << endl;
    return;
  }
  vi h(n);
  rep(i, n) cin >> h[i];
  sort(h.rbegin(), h.rend());
  rep(i, k) h[i] = 0;
  ll ans = 0;
  rep(i, n) ans += h[i];
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 1024
#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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N;
    cin >> N;
    vector<int> V(N), C(N);
    rep(i, 0, N) cin >> V[i];
    rep(i, 0, N) cin >> C[i];
    int ans = 0;
    rep(i, 0, N)
    {
        if (V[i] > C[i]) ans += V[i] - C[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;

public class S
{
    private const bool FINE = true;
    private const bool BROKEN = false;
    public static void Main()
    {



        var input = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        var stairCount = input[0];
        var brokenStairCount = input[1];

        var stairs = new bool[stairCount + 1];
        var patterns = new long[stairCount+1];

        for(long i = 0; i < stairCount; i++){
            stairs[i] = FINE;
            patterns[i] = 0;
        }

        for(long i = 0; i < brokenStairCount; i++){
            stairs[long.Parse(Console.ReadLine()) -1] = BROKEN;
        }

        patterns[0] = stairs[0] ? 1 : 0;
        patterns[1] = stairs[1] ? stairs[0] ? 2 : 1 : 0;
        
        stairs[stairCount] = BROKEN;

        for(long i = 2; i < stairCount; i++){
            if(stairs[i] == FINE){
                patterns[i] = patterns[i-1] + patterns[i-2];
            }else{
                patterns[i] = 0;
            }
            patterns[i] %= 1000000007;
        }

        Console.WriteLine(patterns[stairCount-1] % 1000000007);
    }
}

Measured memory_bytes: 13792
N=int(input())
S=input()
ans=S.count("R")*S.count("G")*S.count("B")
for i in range(0,N-2):
    for j in range(i+1,N-1):
        if 2*j-i<N:
            if S[i]!=S[j] and S[j]!=S[2*j-i] and S[i]!=S[2*j-i]:
                ans-=1
print(ans)

Measured memory_bytes: 9076
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		l = scanner.nextInt();
		turara = new int[n + 2];
		for (int i = 1; i <= n; i++)
			turara[i] = scanner.nextInt();
		dp = new int[n + 1];
		Arrays.fill(dp, -1);

		int ret = 0;
		for (int i = 1; i <= n; i++) {
			if (dp[i] != -1)
				ret = Math.max(ret, dp[i]);
			else
				ret = Math.max(ret, slove(i));
		}
		System.out.println(ret);
	}

	private int slove(int idx) {
		Deque<Integer> deque = new ArrayDeque<Integer>();
		deque.push(idx);
		int ret = 0;
		while (!deque.isEmpty()) {
			int x = deque.peek();
			if (turara[x] < turara[x + 1]) {
				if (dp[x + 1] != -1)
					ret = Math.max(ret, dp[x + 1]);
				else {
					deque.push(x + 1);
					continue;
				}
			}
			if (turara[x] < turara[x - 1]) {
				if (dp[x - 1] != -1)
					ret = Math.max(ret, dp[x - 1]);
				else {
					deque.push(x - 1);
					continue;
				}
			}
			ret = dp[x] = ret + (l - turara[x]);
			deque.poll();
		}
		return ret;
	}

	int[] dp, turara;
	int n, l;

}

Measured memory_bytes: 64880
#include <stdio.h>

int main(void) {

  long n;
  scanf("%ld", &n);
  long a[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }
  long sum = 0;
  for (long i = 0; i < n; i++) {
    sum += a[i];
  }
  if (sum%2 == 0) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }

  return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i < (int)n;i++)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int N;
    cin >> N;
    vector<pair<int,int>> xy(N);
    rep(i,N) cin >> xy[i].first >> xy[i].second;
    double sum = 0;
    for(int i = 0;i < N;i++)
    {
        for(int j = i + 1;j < N;j++)
        {
            int xdis = abs(xy[i].first - xy[j].first);
            int ydis = abs(xy[i].second - xy[j].second);
            sum += sqrt(xdis * xdis + ydis * ydis);
        }
    }
    printf("%.10f\n",(2 * sum / N));
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  int N; cin >> N;
  vector<vector<double>> t(N);
  for(int i=0;i<N;i++){
    double x,y; cin >> x >> y;
    t[i].push_back(x);
    t[i].push_back(y);
  }
  double sum = 0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      sum += sqrt(pow((t[j][0]-t[i][0]),2)+pow((t[j][1]-t[i][1]),2));
    }
  }
  printf("%.20f\n",sum * 2.0/N);
  return 0;
}
  
      

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LSON            id << 1 , l , mid
#define RSON            id << 1 | 1 , mid + 1 , r
#define ROOT            1 , 1 , n
#define CLR(x , y)      memset(x , y , sizeof(x))
#define LOWBIT(x)       x & (-x)
#define FORN(i , a , n)  for(int i = (a) ; i <= (n) ; ++i)
#define FORP(i , n , a)  for(int i = (n) ; i >= (a) ; --i)
#define CASE(x)		printf("Case %d: ", x)
#define SFD(x)      scanf("%lf" , &x)
#define SFC(x)      scanf(" %c" , &x)
#define SFS(x)      scanf(" %s" , x)
#define SFI(x)      scanf("%d" , &x)
#define PFD(x)         printf("%lf\n" , x)
#define PFI(x)         printf("%d\n" , x)
#define PFC(x)         printf("%c\n" , x)
#define PFS(x)         printf("%s\n" , x)
#define LOCAL
static const double PI = acos(-1.0);
static const double EPS = 1e-8;
static const int INF = 0X3fffffff;
typedef long long LL;
typedef double DB;
template<class T> inline
T read(T &x)
{
    x = 0;
    int f = 1 ; char ch = getchar();
    while (ch < '0' || ch > '9') {if (ch == '-') f = -1; ch = getchar();}
    while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
    x *= f;
}
int main()
{
#ifdef LOCAL
    //freopen("D:\\系统优化\\Desktop\\littlepea\\in.data" , "r" , stdin);
#endif
    string a , b;
    cin >> a >> b;
    if(a == b)
        puts("EQUAL");
    else
    {
        if(a.size() != b.size())
        {
            if(a.size() > b.size())
            {
                puts("GREATER");
            }
            else
                puts("LESS");
        }
        else
        {
            int si = a.size();
            for(int i = 0 ; i < si ; ++i)
            {
                if(a[i] > b[i])
                {
                    puts("GREATER");
                    return 0;
                }
                else if(a[i] < b[i])
                {
                    puts("LESS");
                    return 0;
                }

            }
        }
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

const int MAX_N = 500;

vector<int> trains[MAX_N + 1];

int main(void) {
    int N, M, Q;
    cin >> N >> M >> Q;

    for (int i = 0; i < M; i++) {
        int L, R;
        cin >> L >> R;
        trains[L].push_back(R);
    }

    for (int i = 0; i <= N; i++) {
        sort(trains[i].begin(), trains[i].end());
    }

    for (int i = 0; i < Q; i++) {
        int p, q;
        cin >> p >> q;
        // printf("[%d, %d]\n", p, q);

        int ans = 0;
        for (int j = p; j <= q; j++) {
            auto it = upper_bound(trains[j].begin(), trains[j].end(), q);
            int dist = distance(trains[j].begin(), it);
            // printf("start: %d, += %d\n", j, dist);
            ans += dist;
        }
        cout << ans << endl;
    }

    return 0;
}


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

using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "
#define cout(n) cout<<fixed<<setprecision(n)
int main(){
  ll N;
  ll M=0,A=0,R=0,C=0,H=0;
  cin>>N;
  string s;
  FOR(i,0,N){
    cin>>s;
    if(s[0]=='M') M++;
    if(s[0]=='A') A++;
    if(s[0]=='R') R++;
    if(s[0]=='C') C++;
    if(s[0]=='H') H++;
  }
  cout<<M*A*(R+C+H)+ A*R*(C+H) + A*C*H+ R*C*H + M*R*(C+H) + M*C*H<<endl;
}


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

int main() {
  string S;
  int Q;
  cin >> S >> Q;
  
  vector<tuple<int,int,char>> V(Q);
  
  for (int i = 0; i < Q; i++) {
    cin >> get<0>(V.at(i));
    
    if (get<0>(V.at(i)) == 1) {
      get<1>(V.at(i)) = 0;
      get<2>(V.at(i)) = 'a';
    }
    
    else
      cin >> get<1>(V.at(i)) >> get<2>(V.at(i));
  }
  int count = 0;
  string first,last;
  for (int j = 0; j < Q; j++) {
    if (get<0>(V.at(j)) == 1) 
      count++;
    
    else {
      if ((get<1>(V.at(j)) == 1 && count%2 == 0) || (get<1>(V.at(j)) == 2 && count%2 == 1))
        first = get<2>(V.at(j)) + first;
      else
        last = last + get<2>(V.at(j));
    }
  }
  S = first + S + last;
  if (count%2 == 0)
    cout << S << endl;
  else {
    reverse(S.begin(),S.end());
    cout << S << endl;
  }
    
      
}


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

bool check(char a, char b){
    if(a == 'i' || a == 'w') return a == b;
    if(a == '(') return b == ')';
    if(a == ')') return b == '(';
    if(a == '[') return b == ']';
    if(a == ']') return b == '[';
    if(a == '{') return b == '}';
    if(a == '}') return b == '{';
    return false;
}

int dfs(int p, string& s, string& t){
    if(p == s.size()){
        int len = t.size(), i;
        for(i = 0; i < (len+1)/2; i++){
            if(!check(t[i], t[len-1-i])) break;
        }
        if(i < (len+1)/2) return 0;
        int cnt = 0;
        for(int i = 0; i < len-2; i++){
            if(t[i] == 'i' && t[i+1] == 'w' && t[i+2] == 'i') cnt++;
        }
        if(cnt != 1) return 0;
        return len;
    }
    int ret = 0;
    t.push_back(s[p]);
    ret = max(ret, dfs(p+1, s, t));
    t.resize(t.size()-1);
    ret = max(ret, dfs(p+1, s, t));
    return ret;
}

int main(){
    string s;
    while(cin >> s){
        int len = s.size();
        string t = "";
        cout << dfs(0, s, t) << endl;
    }
    return 0;
}

Measured memory_bytes: 1200
var
  n, i: longint;
  s: ansistring;
function c2n(c: char): longint; inline;
begin
  exit(ord(c) - ord('A'));
end;
function n2c(n: longint): char; inline;
begin
  exit(chr(n + ord('A')));
end;
begin
  readln(n);
  readln(s);
  for i := 1 to length(s) do s[i] := n2c((c2n(s[i]) + n) mod 26);
  writeln(s);
end.


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll = long long;
using R = long double;
const R EPS = 1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);}
inline R sq(R x) {return sqrt(max(x, 0.0L));}

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

// Problem Specific Parameter:
ll C[1010][1010];

const ll inf = 1LL << 60;

ll Add(ll a, ll b) {
	return min(a + b, inf);
}

int main(void) {

	const int limit = 1000;
	rep(i, limit + 1) {
		rep(j, i + 1) {
			if (j == 0 or j == i)
				C[i][j] = 1LL;
			else
				C[i][j] = Add(C[i - 1][j - 1], C[i - 1][j]);
		}
	}

	ll n;
	cin >> n;

	ll total = 0LL;
	int cmax = 0;

	while (cmax < 650 and C[7 + cmax][7] <= n) cmax++;

	n -= total;
	vector<int> coef(cmax, 0);

	rrep(i, cmax) {
		while (n >= C[7 + i][7]) {
			n -= C[7 + i][7];
			coef[i]++;
		}
	}

	rrep(i, cmax) {
		rep(loop, coef[i]) cout << "F";
		cout << "ESTIVAL";
	}

	cout << endl;

	return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, l;
  cin >> n >> l;
  
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a.at(i);
  
  bool ans = false;
  int keep;
  for(int i = 1; i < n; i++){
    if(a.at(i - 1) + a.at(i) >= l){
      ans = true;
      keep = i;
      break;
    }
  }
  
  if(ans){
    cout << "Possible\n";
    for(int i = 1; i < keep; i++) cout << i << '\n';
    for(int i = n - 1; i >= keep; i--) cout << i << '\n';
  }
  else cout << "Impossible\n";
}

Measured memory_bytes: 1280
#include <bits/stdc++.h> 
using namespace std; 
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main(void) {
    io;
    int a,b; cin >> a >> b;
    string astr, bstr;
    char achar, bchar;
    achar = '0' + a;
    bchar = '0' + b;
    rep(i, a) bstr.push_back(bchar);
    rep(i, b) astr.push_back(achar);
    cout << ((astr < bstr) ? astr : bstr);
    return 0;
}



Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, up, down;
  cin >> N;
  up = N/10;
  down = N-(N/1000)*1000;
  if(up%111 == 0 || down%111 == 0)cout << "Yes" << endl;
  else if(up == 0 || down == 0)cout << "Yes" << endl;
  else{cout << "No" << endl;}
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s, t; cin>>s>>t;
	ll ans=0;
	rep(i, 3){
		if (s[i]==t[i]) ans++;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
import sys
from collections import Counter
from collections import deque
import math
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))


n,m=mp()
step=[-1]*(n+1)
ans=[-1]*(n+1)
edge=[[i] for i in range(n+1)]
for i in range(m):
    a,b=mp()
    edge[a].append(b)
    edge[b].append(a)


que=deque()
que.append(edge[1])
step[1]=0
while len(que):
    q=que.popleft()
    for i in range(1,len(q)):
        if step[q[i]]==-1:
            step[q[i]]=0
            ans[q[i]]=q[0]
            que.append(edge[q[i]])
print("Yes")
for i in range(2,n+1):
    print(ans[i])

Measured memory_bytes: 40032
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <map>

typedef long long int ll;

using namespace std;

int main() {

    ll n, k;

    cin >> n >> k;

    cout << min(n % k, k - n % k) << endl;
    return 0;
}

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


int main(int argc, char** argv) {
    
    int n;
    int q;
    int S[10000];
    int T[500];
    
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%d", &S[i]);
    }
    scanf("%d", &q);
    for(int i=0; i<q; i++){
        scanf("%d", &T[i]);
    }
    int count = 0;
    for(int a=0; a<q; a++){
        for(int b=0; b<n-1; b++){
            if(S[b] == T[a]){
                count++;
                break;
            }  
        } 
    }
    printf("%d\n", count);
    
    return 0;
}


Measured memory_bytes: 2128
N = int(input())
ToF = []
for i in range(N):
    A = list(map(int,input().split()))
    A.sort()
    if A[0]**2 + A[1]**2 == A[2]**2:
        ToF.append("YES")
    else:
        ToF.append("NO")
for i in ToF:
    print(i)

Measured memory_bytes: 7692
while True:
    n = int(input())
    if n == 0:
        break
    cum = [0]
    s = 0
    for i in range(n):
        s += int(input())
        cum.append(s)
    M = cum[1]
    for i in range(n):
        for j in range(i + 1, n + 1):
            if cum[j] - cum[i] > M:
                M = cum[j] - cum[i]
    print(M)

Measured memory_bytes: 7612
#include<iostream>
using namespace std;
int main(){
        int n, nswap=0;
        int a[101];
        cin>>n;
        for(int i=0;i<n;i++) cin>>a[i];
        for(int i=0;i<n;i++){
                for(int j=n-1;j>0;j--){
                        if(a[j]<a[j-1]) {
                                swap(a[j],a[j-1]);
                                nswap++;
                        }
                }
        }
        for(int i=0;i<n;i++) {
                cout<<a[i];
                if(i==n-1) cout<<endl;
                else cout<<" ";
        }
        cout<<nswap<<endl;
        return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

const int MAXN = 100005;
int x[MAXN], earliest[MAXN];

int n;

vector<PII> intervals;

void printPair(const PII& x) {
    cout << "(" << x.FF << " " << x.SS << ") ";
}

int main() {
    GI(n);

    earliest[1] = 1; int icnt = 0;

    FOR1(i, n) {
        GI(x[i]);
 
        intervals.PB(MP(x[i], x[i])); icnt++;

        while (icnt >= 2 && intervals[icnt-1].FF == intervals[icnt-2].SS + 1) {
            intervals[icnt-2].FF -= 1;
            intervals[icnt-2].SS = intervals[icnt-1].SS;
            intervals.pop_back(); icnt--;
        }

        earliest[i+1] = earliest[i];

        while (icnt > 0 && intervals[0].FF <= 0) {
            assert(icnt == 1);

            if (intervals[0].FF == intervals[0].SS) {
                intervals.pop_back(); icnt--;
                earliest[i+1]++;
            }
            else {
                intervals[0].FF += 2;
                earliest[i+1]++;
            }
        }

//        for (auto& i : intervals) printPair(i); cout << endl;
    }

//    PR0(earliest, n+1);
    
    LL res = 1, pool = 0; int idx = 1;

    FOR1(i, n) {
        while (idx < n+1 && earliest[idx] <= i) {
            idx++;
            pool++;
        }

        res = (res * pool) % MOD;
        pool--;
    }

    printf("%lld\n", res);

    return 0;
}


Measured memory_bytes: 1912
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N,K; cin>>N>>K;
  vi dp(N+1);
  rep(i,0,N){
    int X; cin>>X;
    dp[i+1]=(dp[i]+X-1)%K;
  }
  map<int,int> M;
  int ans=0;
  REP(i,0,N){
    if(i>=K) M[dp[i-K]]--;
    ans+=M[dp[i]];
    M[dp[i]]++;
  }
  cout<<ans<<endl;
  }


Measured memory_bytes: 14336
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

using namespace std;

int vs[4][4];
int as[4];
int bs[4];

bool solve(void) {
  for(as[0] = -100; as[0] <= 200; ++as[0]) {
    // cerr << ">>>>>" << as[0] << endl;
    bs[0] = vs[0][0] - as[0];
    bs[1] = vs[0][1] - as[0];
    bs[2] = vs[0][2] - as[0];
    as[1] = vs[1][0] - bs[0];
    as[2] = vs[2][0] - bs[0];
    // cerr << as[0] << " " << as[1] << " " << as[2] << " " << bs[0] << " " << bs[1] << " " << bs[2] << endl;
    bool ok = true;
    REP(i, 3) REP(j, 3) {
      if(as[i] + bs[j] != vs[i][j]) {
        ok = false;
      }
    }
    // if(as[0] == 0) {
    //   cerr << "foo" << endl;
    //   if(as[1] == 1 && as[2] == 0 && bs[0] == 1 && bs[1] == 0 && bs[2] == 1) {
    //     cerr << ">" << ok << endl;
    //   }
    // }
    if(ok) {
      // cerr << "ok" << endl;
      return true;
    }
  }
  return false;
}

int main(void) {
  REP(i, 3) REP(j, 3) {
    scanf("%d", &vs[i][j]);
    // cerr << " " << vs[i][j];
  }
  bool res = solve();
  // cerr << ">>" << res << endl;
  puts(res ? "Yes" : "No");

  return 0;
}


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

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

using namespace std;

typedef unsigned long long ull;

#define TH(x) (((x)/180.0)*pi)

int main(){
  long double a,b,c,d;
  const long double r  = 6378.1;
  const long double pi = M_PI;
  while(cin>>a>>b>>c>>d, (a!=-1 || b!=-1 || c!=-1 || d!=-1)){
    long double x1,y1,z1,x2,y2,z2,ip,ang;
    a = TH(a); b = TH(b); c = TH(c); d = TH(d);

    x1 = cos(b) * cos(a);
    y1 = sin(b) * cos(a);
    z1 = sin(a);

    x2 = cos(d) * cos(c);
    y2 = sin(d) * cos(c);
    z2 = sin(c);

    ip  = x1*x2 + y1*y2 + z1*z2;
    ang = acos(ip);

    cout << (int)(floor(r*ang+0.5)) << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n, a, b;
  cin >> n >> a >> b;
  cout << min(n * a, b) << endl;
}


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

namespace AtCoderKeyence
{
	class Program
	{
		static void Main(string[] args)
		{
			var numbers = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

			var sentinel = 1000000000;
			if(numbers[2] == 1000000000)
			{
				sentinel = 999999999;
			}

			var rest = numbers[1];
			for(var i = 0;i < numbers[0]; i++)
			{
				if( i != 0)
				{
					Console.Write(" ");
				}

				if(rest > 0)
				{
					rest--;
					Console.Write(numbers[2]);
				}
				else
				{
					Console.Write(sentinel);
				}
			}
		}
	}
}


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

using namespace std;

long long dp[55][2];

int a[55];

int main() {
  int n, p;
  scanf("%d %d", &n, &p);
  dp[0][0] = 1;
  dp[0][1] = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", a+i);
    a[i] &= 1;
    dp[i+1][0] = dp[i][0];
    dp[i+1][1] = dp[i][1];
    dp[i+1][a[i]] += dp[i][0];
    dp[i+1][a[i]^1] += dp[i][1];
  }
  cout << dp[n][p] << endl;
  return 0;
}

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

int main() {
	
	int n, k, h[100010];

	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> h[i];
	sort(h, h + n);
	int ans = 1 << 30;
	for (int i = 0; i + k - 1 < n; i++) {
		ans = min(ans, h[i + k - 1] - h[i]);
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 640
class UnionFind3
  def initialize(size)
    @table = [-1]*size
  end

  def find(x)
    if @table[x] < 0
      return x
    else
      return @table[x] = find(@table[x])
    end
  end

  def union(x, y)
    s1 = find(x)
    s2 = find(y)
    @table[s2] = s1
  end
end

#UF=Hash.new{-1}
#def u a,b;UF[f a]=f b;end
#def f c;0>UF[c]?c:UF[c]=f(UF[c])end

cities=(1..n=gets.to_i).map{|i|gets.split.map(&:to_i)+[i]}

road = cities.sort_by{|x,y,i|x}.each_cons(2).map{|(x1,y1,i),(x2,y2,j)|[x2-x1,i,j]}+
       cities.sort_by{|x,y,i|y}.each_cons(2).map{|(x1,y1,i),(x2,y2,j)|[y2-y1,i,j]}

uf=UnionFind3.new(100001)
p road.sort.inject(0){|s,(cost,i,j)|
  if uf.find(i)!=uf.find(j)
    uf.union(i,j)
    s+cost
  else
    s
  end
}


Measured memory_bytes: 29632
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<cstdlib>
using namespace std;

typedef struct Node {
    int key;
    Node *parent, *left, *right;
} Node;

Node *root, *NIL;

void insert(int k) {
    Node *x, *y, *z;
    x = root;
    y = NIL;

    z = (Node *)malloc(sizeof(Node));
    z -> key = k;
    z -> left = NIL;
    z -> right = NIL;

    while (x != NIL) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }

    z -> parent = y;
    if (y == NIL) root = z;
    else {
        if ( z->key < y->key ) y->left = z;
        else y->right = z;
    }
}

void inorder(Node *u) {
    if ( u == NIL ) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u) {
    if ( u == NIL ) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main() {
    int n, i, x;
    string com;

    scanf("%d", &n);

    for ( i = 0; i < n; i++ ) {
        cin >> com;
        if ( com == "insert" ) {
            scanf("%d", &x);
            insert(x);
        } else if ( com == "print" ) {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}


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

class job{
 public:
 int duration,deadline;
    const bool operator <(const job &j){
    	return(deadline<j.deadline);
  }
};

int main()
{
  int n;
  cin>>n;
  job j[n];
  for(int i=0;i<n;i++)
  {
    cin>>j[i].duration>>j[i].deadline;
  }
  sort(j,j+n);
  int current=0,flag = true;
  for(int i=0;i<n;i++)
  {
    current+=j[i].duration;
    if(current>j[i].deadline)
      flag=false;
  }
  if(flag)
    cout<<"Yes";
  else
    cout<<"No";
  
  
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define maxn 500005
using namespace std;
inline int read()
{
	char x = getchar();
	int lin = 0, f = 1;
	while(x < '0' || x > '9')
	{
		if(x == '-') f = -1;
		x = getchar();
	}
    while(x >= '0' && x <= '9')
	{
		lin = lin * 10 + x - '0';
		x = getchar();
	}
	return lin * f;
}
#define PII pair<int,int>
#define fir first
#define sec second
#define ma(a,b) make_pair(a,b)
char s[maxn];
int main(){
	scanf("%s",s + 1);
	int a = 0,len = strlen(s + 1);
	for(int i = 1; i <= len; i++)
		a += s[i] - '0';
	int ans = s[1] - '1';
	cout << max(a,ans + (len - 1) * 9);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  vvi c(3, vi(3));
  vi a(3), b(3);
  int maxNum = 0;
  rep(i, 3){
    int minVal = 100;
    rep(j, 3){
      cin >> c[i][j];
      maxNum = maxNum < c[i][j] ? c[i][j] : maxNum;
      minVal = minVal > c[i][j] ? c[i][j] : minVal;
    }
    a[i] = minVal;
  }
  rep(x, 3){
    b[0] = a[0] - c[0][x];
    for(int y = 1; y < 3; y++){
      if(b[0] != a[y] - c[y][x]){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256