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

#define REP(i, n) for(long long i = 0; i < n; i++)
#define REPR(i, n) for(long long i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(long long i = m; i <= n; i++)
#define FORR(i, m, n) for(long long i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;


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

    ll n;cin>>n;
    map<string,ll> mp;
    REP(i,n){
        string s; cin>>s;
        mp[s]++;
    }
    ll ans=0;
    for(auto p: mp){
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main()
{
    int n,m;
    char a[102][102];
    int visit[102];
    int visit2[102];
    while(cin>>n>>m)
    {
        memset(visit,0,sizeof(visit));
        memset(visit2,0,sizeof(visit2));
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                cin>>a[i][j];

            }
        }
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {

                if(a[i][j]=='#')
                {
                    visit[i]=1;
                    visit2[j]=1;
                }
            }
        }
        for(int i=0;i<n;i++)
        {
            if(visit[i]==1)
            {
                continue;
            }
            for(int j=0;j<m;j++)
            {
                a[i][j]='o';
            }
        }
        for(int i=0;i<m;i++)
        {
            if(visit2[i]==1)
            {
                continue;
            }
            for(int j=0;j<n;j++)
            {
                a[j][i]='o';
            }
        }
        int x;
        for(int i=0;i<n;i++)
        {
            x=0;
            for(int j=0;j<m;j++)
            {
                if(a[i][j]!='o')
                {
                    cout<<a[i][j];
                    x++;
                }

            }
            if(x!=0)
                cout<<endl;
        }
    }
    return 0;
}


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

using namespace std;

int main() {
  string in;
  cin >> in;

  for (int i = 0; i < in.size(); i++) {
    if (in[i] == '1') {
      in[i] = '9';
    } else if (in[i] == '9') {
      in[i] = '1';
    }
  }

  cout << in << endl;

  return 0;
}


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

#define REP(i, n) for(int64_t i = 0; i < n; i++)
#define REPR(i, n) for(int64_t i = n; i >= 0; i--)
#define FOR(i, m, n) for(int64_t i = m; i < n; i++)
#define FORR(i, m, n) for(int64_t i = m; i >= n; i--)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}
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 ll INF= 1ll << 60;
const ll MOD = 1000000007;
double EPS = 1e-10;
template<class T>
inline T GCD(T a, T b){if(a < b){T tmp=b;b=a;a=tmp;}return a % b != 0 ? GCD(b,a%b) : b;}
template<class T>
inline T LCM(T a, T b){return (a*b)/GCD(a,b);}
//----------------------------------------------------------

ll N, X;

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

    cout << 3*(N-GCD(N,X)) << endl;
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
XX = map(int, input().split())

if N >= M:
    ans = 0
else:
    X = []
    for i in XX:
        X.append(i)
    X.sort()
    X1 = []
    for i in range(M - 1):
        X1.append(abs(X[i + 1] - X[i]))
    X1.sort()
    ans = 0
    for i in range(M - N):
        ans += X1[i]

print(ans)

Measured memory_bytes: 13192
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
    {
        static void Main(string[] args)
        {
            //入力
            int xMaxInput = int.Parse(Console.ReadLine());
            string[] xInputStrings = new string[xMaxInput];
            for (int i = 0; i < xMaxInput; ++i)
            {
                xInputStrings[i] = Console.ReadLine();
            }
            //出力
            Console.WriteLine(string.Join("", new Output().Calu(xInputStrings).Reverse())) ;
        }

        public class Output{
            public Output(){ }
            public string Calu(string[] t){
                int a = int.MaxValue;
                char c = 'a';
                int k = (int)c;  
                StringBuilder g = new StringBuilder();
                for (int i = 1; i < 27; i++) {
                    foreach (var s in t) {
                        int Count = s.Length - s.Replace(c.ToString(), "").Length;
                        if (Count < a) {
                            a = Count;
                        }        
                    }
                    g.Insert(0,c.ToString(),a);
                    c = Convert.ToChar(c);
                    k += 1;
                    c = (char)k;
                    a = int.MaxValue; 
                }       
                return g.ToString();
            }
        }

    }

Measured memory_bytes: 11348
S = input()
#print(S, S[::-1], S[:int((len(S)-1)/2)], S[int((len(S)+2)/2):], len(S))
if S == S[::-1] and S[:int((len(S)-1)/2)] == S[int((len(S)+2)/2):]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include<functional>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main() {
	int N;
	int sum = 0;
	int n;
	cin >> N;
	n = N;
	int count = 0;
	for (int i = 1; i <= N; i++) {
		n = i;
		count = 0;
		while (n != 0) {
			n = n / 10;
			count = count + 1;
		}
		if (count % 2 == 1) {
			sum = sum + 1;
			
		}
	}
	cout << sum;
}

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

#include <iomanip>

using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

/*********** Constants ***********/
const auto INF = static_cast<ll>(1e15);
const auto MOD = static_cast<ll>(1e9 + 7);

/*********** Variables ***********/
ll N, K;
vector<ll> A;
vector<ll> DP;

/*********** Functions ***********/
void initialize() {
    cin >> N >> K;
    A.resize(N);
    for (auto& item : A) cin >> item;
    DP.resize(K + 1, 0);
}

void solve() {
    for (ll i = A[0]; i <= K; i++) {
        ll flag = false;
        for (const auto& item : A) {
            if (i - item < 0) {
                continue;
            }
            if (!DP[i - item]) {
                flag = true;
            }
        }
        if (flag) {
            DP[i] = 1;
        }
    }
}

void output() {
    if (DP[K]) {
        cout << "First";
    }
    else {
        cout << "Second";
    }
    cout << endl;
}

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


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

int main(){
  int N,K;
  string S;
  cin >> N >> K >> S;
  
  vector<int> V(1,1);
  if(S[0]=='0'){
    V[0] = 0;
    V.push_back(-1);
  }
  for(int i=1;i<N;i++){
    int j = V.size()-1;
    if(S[i]=='1'){
      if(V[j]>0) V[j]++;
      else V.push_back(1);
    }
    else{
      if(V[j]<0) V[j]--;
      else V.push_back(-1);
    }
  }
  if(V[V.size()-1]<0) V.push_back(0);
  for(int i=0;i<V.size();i++) V[i] = abs(V[i]);
  
  int M = V.size()/2;
  if(K>=M){
    cout << N << endl;
    return 0;
  }
  vector<int> W(M+1);
  W[0] = V[0];
  for(int i=1;i<=K;i++) W[i] = W[i-1] + V[i*2-1] + V[i*2];
  for(int i=K+1;i<=M;i++) W[i] = W[i-1] + V[i*2-1] + V[i*2] - V[(i-K-1)*2] - V[(i-K-1)*2+1];
  
  int ans = 0;
  for(int i=0;i<W.size();i++) ans = max(ans,W[i]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1020
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define INF 999999999
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
using namespace std;

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

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

string s[100] = {};

int main()
{
	int h,w;
	cin >> h >> w;
	
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#') continue;
			int num = 0;
			for (int d = 0; d < 8; d++) {
				const int ni = i + dy[d];
				const int nj = j + dx[d];
				if (ni < 0 or h <= ni) continue;
				if (nj < 0 or w <= nj) continue;
				if (s[ni][nj] == '#') num++;
			}
			s[i][j] = char(num + '0');
		}
	}
	for (int i = 0; i < h; i++) {
		cout << s[i] << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    char[] ca = sc.next().toCharArray();
    int count = 0;
    char ahead = '\0';
    for (int i = 0; i < n; i++) {
      if (ahead != ca[i]) {
        count++;
        ahead = ca[i];
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 27880
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-10;
const vi emp;

int N=0;
vector<string> a(3);
vi now(3);

int main(){
	for(auto i=a.begin();i!=a.end();i++) cin>>*i;
	int A=a[0].size()+1,B=a[1].size()+1,C=a[2].size()+1;
	while(now[0]!=A&&now[1]!=B&&now[2]!=C){
		char c=a[N][now[N]++];
		N=c-'a';
	}
	if(now[0]==A) cout<<'A'<<endl;
	else if(now[1]==B) cout<<'B'<<endl;
	else cout<<'C'<<endl;
}

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

const ll logx=30;
const ll N=4e5+5;
const ll M=3e5+5;
const ll mod=1e9+7;
const ll INF=1e18+5;
const double PI = 3.14159265358979323846;

#define ints(n) scanf("%d",&n)
#define intp(n) printf("%d\n",n)
#define longs(n) scanf("%intd",&n)
#define longp(n) printf("%intd\n",n)

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }

#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define ms(dp,val) memset(dp,val,sizeof(dp))
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1ll;x=(x*x)%m;}return ans%m;}

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

ll dp[N][27];

int main()
{
  ll n;
  cin>>n;
  cout<<((n*(n+1))/2)<<endl;
}


Measured memory_bytes: 256
//3つの整数を小さい順に整理するプログラム
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
 
int main(void)
{
    int a, b, c;//整数
    int x;//初期化しない
 
    scanf("%d%d%d", &a, &b, &c);
 
    if (a > b) {
        x = a;//交換
        a = b;
        b = x;
    }
    if (b > c) {
        x = b;//交換
        b = c;
        c = x;
    }
     if (a > b) {
        x = a;//交換
        a = b;
        b = x;
    }
    printf("%d %d %d\n", a, b, c);
 
    return 0;
}



Measured memory_bytes: 2076
//#include"bits/stdc++.h"
#include<iostream>
#include<ostream>
#include<vector>
#include<string>
#include<algorithm>

#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)


using namespace std;
using ll = long long;

void solve();

int main() {

   solve();
   return 0;

}

void solve() {

	string s, t;
	
	while (cin >> s >> t) {
		ll ans=0;
		vector<vector<ll>> dp;
		dp.resize(s.size()+1);
		REP(i, dp.size()) {
			dp[i].resize(t.size()+1);
			REP(j, dp[i].size()) {
				dp[i][j] = 0;
			}
		}
		REP(i, s.size()) {
			REP(j, t.size()) {
				if (s[i] == t[j]) {
					dp[i + 1][j + 1] = dp[i][j] + 1;
					//cout << "match" << endl;
				}
					ans = max(ans, dp[i+1][j+1]);
				
			}
		}
		//ans = max(ans, dp[s.size()][t.size()]);
		cout << ans << endl;

	}

}

Measured memory_bytes: 127964
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

vector< LL > Div( LL n ) {
    vector< LL > ret;
    for( LL i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    LL n;
    cin >> n;
    vector< LL > div = Div(n);
    int l = 0, r = div.size() - 1;
    int res = INF;
    while(l <= r) {
        LL tl = div[l], tr = div[r];
        int dl = 0, dr = 0;

        while( tl > 0 ) {
            tl /= 10;
            ++dl;

        }
        while( tr > 0 ) {
            tr /= 10;
            ++dr;

        }
        res = min(res, max(dl, dr));
        ++l; --r;

    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef int Int;
typedef pair<Int, Int> pii;
typedef pair<Int, double> pid;
typedef pair<double, double> pdd;
typedef pair<Int, pii> pip;
typedef pair<pii, Int> ppi;
typedef pair<double, Int> pdp;
typedef vector<Int> veci;
typedef vector<double> vecd;
typedef vector<int> veci;
typedef vector<ll> vecll;
typedef vector<double> vecd;
typedef vector<pii> vecpii;
typedef vector<ppi> vecppi;
typedef vector<veci> mati;
typedef vector<vecll> matll;
typedef vector<vecd> matd;
#define PB(x) push_back(x)
#define EB(x) emplace_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ(x) (x).size()
#define CLR(x) memset(x,0,sizeof x)
#define pdebug() printf("%d\n",__LINE__)
#define REP(i, a, b) for(int i = (a);i <= (b);i++)
#define FORO(i, n) REP(i,0,(int)n-1)
#define FORI(i, n) REP(i,1,(int)n)
#define FORIT(i, t) for(auto i = t.begin();i != t.end();i++)
#define eps 1e-6
#define sqr(x) ((x)*(x))
#define dist(_a, _b) sqrt(sqr(_a.A-_b.A)+sqr(_a.B-_b.B))
#define norm(_a) sqrt(sqr(_a.A)+sqr(_a.B))
#define DEBUG 1
#if DEBUG
#define DUMP(a) do { std::cout << #a " = " << (a) << ", "; } while(false)
#define DUMPLN(a) do { std::cout << #a " = " << (a) << std::endl; } while(false)
#else
#define DUMP(a)
#define DUMPLN(a)
#endif
template<typename T, typename U>
inline void getMin(T &a, U b) { if (a > b) a = b; }
template<typename T, typename U>
inline void getMax(T &a, U b) { if (a < b) a = b; }
template<typename T>
vector<T> getVector(const int n) { return vector<T>(n); }
template<typename T>
vector<T> getVector(const int n, const T a) { return vector<T>(n, a); }
template<typename T>
vector<T> getEmptyVector() { return vector<T>(); }
template<typename T>
void appendAll(vector<T> &a, vector<T> b) { a.insert(a.end(), b.begin(), b.end()); }
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
// #define X first
// #define Y second
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
const ll MOD = 1000000007;
const int MAXN = 1 << 17;
const int inf = 1 << 27;
const ll llinf = 1LL << 50;
const int NIL = -inf;
int popcount(int x) { return __builtin_popcount(x); }

ll solve() {
    int N, K;
    cin >> N >> K;
    vecll P(N), C(N);
    FORO(i, N) cin >> P[i];
    FORO(i, N) cin >> C[i];
    ll ret = C[0];
    for(int i = 0;i < N;i++) {
        vecll mxf(N + 1);
        int cur = i;
        int ncycle = 0;
        ll tot = 0;
        while(true){
            ncycle++;
            cur = P[cur] - 1;
            tot += C[cur];
            mxf[ncycle] = tot;
            if(ncycle > 1) getMax(mxf[ncycle], mxf[ncycle - 1]);
            if(cur == i) break;
        }
        getMax(ret, mxf[min(K, ncycle)]);
        if(K >= ncycle && tot > 0) {
            getMax(ret, tot * ll(K / ncycle) + max(0LL, mxf[K % ncycle]));
            getMax(ret, tot * ll(K / ncycle - 1) + mxf[ncycle]);
        }
    }
    return ret;
}

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

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 3796
#include <iostream>
#include <string>
#include<algorithm>
#include <cstdlib>
#include <cmath>

using namespace std;
int _f(int b);
int f(int c);
int _f(int b) {
	int count = 0;
	while (b > 0) {
		b = b / 10;
		count++;
	}
	return count;
}
int f(int c) {
	int n = _f(c);
	int ans = 0;
	for (int i = n-1; i >0; i--) {
		int x = c / pow(10, i);
		ans += x;
		c -= (x * pow(10, i));
	}
	ans += c;
	return ans;
}
int main()
{
	int a,x=1;
	string yn[2] = { "Yes","No" };
	cin >> a;
	if (a%f(a) == 0) x = 0;
	cout << yn[x] << endl;
    return 0;
}



Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using E = System.Linq.Enumerable;
class Program
{
    static char[] abc = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
    static char[] moji = "atcoder@".ToCharArray();
    static long mod = 1000000007;
    static void Main(string[] args)
    {
        //var S = Console.ReadLine();
        //var A = long.Parse(Console.ReadLine());
        var NKS = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        //var S = Console.ReadLine().Split(' ').ToArray();
        //var dic = new SortedDictionary<string, int>();
        var N = NKS[0];
        var K = NKS[1];
        var S = NKS[2];
        var ume = (S == 1000000000) ? 1 : 1000000000;
        var ans = new long[N];

        for (int i = 0; i < N; i++)
        {
            if(i < K)
            {
                ans[i] = S;
            }
            else
            {
                ans[i] = ume;
            }
        }


        Console.WriteLine(String.Join(" ",ans));
        
    }
        

    
}


Measured memory_bytes: 37596
#include <stdio.h>

void main() {

    int A, B, C, D;
    char buf[1000];

    fgets(buf, sizeof(buf), stdin);
    sscanf(buf, "%d %d %d %d\n", &A, &B, &C, &D);

    while (0 < A && 0 < C) {
        C -= B;
        if (C <= 0) {
            break;
        } 
        A -= D;
    }
    if (A > 0) {
        printf("Yes");
    }
    else {
        printf("No");
    }
    return;
}

Measured memory_bytes: 1772
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int x=0;char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x;
}
int main(char c){
	int n,x,y,t=1e7;
	map<int,map<int,int>>X,Y,S,D;
	for(cin>>n;n--;X[x][y]=Y[y][x]=S[x+y][x-y]=D[x-y][x+y]=c%5)cin>>x>>y>>c;
	auto f=[&](auto M,int a,int b){
		for(auto[z,m]:M){
			y=-3e7;
				for(auto[x,c]:m)
					y=c-a?y:x,t=c-b?t:min(t,x-y);
		}
	};
	f(X,0,3);f(Y,2,1);f(S,2,0);f(S,3,1);f(D,0,1);f(D,2,3);
	t<1e7?cout<<t*5:cout<<"SAFE";
}

Measured memory_bytes: 124280
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pi=pair<ll,ll>;
using vi=vector<ll>;
using vstr=vector<string>;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
void yes(bool c) { if (c)print("Yes"); else print("No"); };

void solve() {
    
    int N;cin >> N;
    vector<vector<pi>> to(N);
    rep(i,N-1){
        ll a,b,c;
        cin >> a >> b >> c;
        a--;b--;

        to[a].pb(mp(b,c));
        to[b].pb(mp(a,c));
    }
    int Q,K; cin >> Q >> K;
    K--;
    vi dist(N,-1);
    dist[K] = 0;
    stack<int> s;
    s.push(K);
    while(!s.empty()){
        int v0 = s.top();
        s.pop();
        for(auto v:to[v0]){
            if(dist[v.fi]==-1){
                dist[v.fi] = v.sc + dist[v0];
                s.push(v.fi);
            }
        }
    }
    rep(i,Q){
        int x,y; cin >> x >> y;
        x--;y--;
        ll ans = dist[x]+dist[y];
    print(ans);
    }
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}


Measured memory_bytes: 9984
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
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; }

int main() {
    ll N; cin >> N;
    vector<ll> A(N + 1), B(N);
    rep(i, N + 1) cin >> A.at(i);
    rep(i, N) cin >> B.at(i);

    ll ans = 0;
    rep(i, N) {
        ans += min(A[i], B[i]);
        B[i] -= min(A[i], B[i]);
        A[i] -= min(A[i], B[i]);
        ans += min(A[i + 1], B[i]);
        A[i + 1] -= min(A[i + 1], B[i]);
    }
    cout << ans << endl;
}

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

int main()
{
	long int N;
	long int a[200200];
	

	scanf("%ld",&N);
	long int i;
	for(i=0;i<N;i++)scanf("%ld",&a[i]);
	
	long int wa_l=0,wa_r=0,index_l=0,index_r=N-1;
	
	while(index_l!=index_r){
		
		if(wa_l<=wa_r){
			wa_l+=a[index_l];
			index_l++;
		}
		else {
			wa_r+=a[index_r];
			index_r--;
			
		}
		//printf("%ld,%ld,(%ld,%ld)\n",wa_l,wa_r,index_l,index_r);
		
	}
	long int sa;
	sa = labs(labs(wa_l-wa_r)-a[index_l]);
	//printf("%ld,%ld,(%ld,%ld),%ld\n",wa_l,wa_r,index_l,index_r,sa);
	printf("%ld\n",sa);
	return 0;
}

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

int main() {
  int N,M;cin>>N>>M;
  vector<int> H(N+1);
  vector<bool> G(N+1,true);
  for(int i=1;i<=N;i++)cin>>H[i];
  for(int i=0;i<M;i++){
    int a,b;cin>>a>>b;
    if(H[a]<=H[b])G[a]=false;
    if(H[b]<=H[a])G[b]=false;
  }
  int cnt=0;
  for(int i=1;i<=N;i++){
    if(G[i])cnt++;
  }
  cout<<cnt<<endl;
}


Measured memory_bytes: 3784
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
// dfmt on

void main()
{
    long N = lread();
    auto A = aryread();

    // A_1 - A_N == d
    long d = A.sum();
    A[] *= 2;
    foreach (i; 0 .. N - 1)
        d -= A[i] * (i & 1);
    auto ans = new long[](N);
    ans[0] = d;
    // writeln(ans[0]);
    foreach (i; 1 .. N)
        ans[i] = A[i - 1] - ans[i - 1];

    write(ans[0]);
    foreach (a; ans[1 .. $])
        write(" ", a);
    writeln();
}


Measured memory_bytes: 7368
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
inline int ri()
{
	register int x=0;register bool f=0;register char ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')f=1;ch=getchar();}
	while(ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=getchar();};
	return f?-x:x;
}
void wi(int x)
{
	if(x<0)	x=-x,putchar('-');
	if(x>9)	wi(x/10);
	putchar('0'+x%10);
}
const int p=1e9+7;
int f[45][131071+5];
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int n=ri(),x=ri(),y=ri(),z=ri(),i,k,j,ban=1<<(x-1),ss=(1<<(x+y+z))-1,nxt;
	ll ans=1;
	ban=(ban<<(y))|(1<<(y-1));
	ban=(ban<<(z))|(1<<(z-1));
	f[0][0]=1;
	for(i=0;i<n;i++)
	{
		for(j=0;j<=ss;j++)
		{
			for(k=1;k<=10;k++)
			{
				nxt=ss&((1<<(k-1))|(j<<k));
				if((nxt&ban)!=ban)	f[i+1][nxt]=(f[i+1][nxt]+f[i][j])%p;
			}
		}
	}
	for(i=1;i<=n;i++)	ans=ans*10%p;
	for(j=0;j<=ss;j++)
	{
		if((j&ban)!=ban)	ans=(ans-f[n][j])%p;
	}
	wi((ans%p+p)%p);
	return 0;
}


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

using namespace std;

int main()
{

    int a,b,c,d,k=0;


    cin>>a>>b>>c>>d;


    while(1)
    {
        a=(a-d);
       c=(c-b);
       if(c<=0)
       {
       k=1;
       break;}
       if(a<=0)
       {
           k=0;break;
       }

    }
    if(k)
        cout<<"Yes\n";

    else
        cout<<"No\n";


    return 0;
}


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

int n;
set<int> s;

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        int a;
        scanf("%d", &a);
        if (s.find(a) != s.end()) {
            printf("NO\n");
            return 0;
        }
        s.emplace(a);
    }
    printf("YES\n");
    return 0;
}


Measured memory_bytes: 9728
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {

            int n = int.Parse(Console.ReadLine());
            int h = int.Parse(Console.ReadLine());
            int w = int.Parse(Console.ReadLine());
            if (h > n || w > n)
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine((n - h + 1) * (n - w + 1));
            }
        }
    }
}


Measured memory_bytes: 11092
//============================================================================
// Name        : AOL.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>
using namespace std;



int main(){

	char n1,n2,n3,n4;

	cin>>n1>>n2>>n3>>n4;

	if(n1==n2&&n2==n3){

			cout<<"Yes"<<endl;

	}else if(n2==n3&&n3==n4){

			cout<<"Yes"<<endl;
			}else{
		cout<<"No"<<endl;
	}

}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <cstdio>

using namespace std;

int main(void) {

    while (true) {
        int a, op, b, result;
//        cin >> a >> op >> b;
        scanf("%d %c %d", &a, &op, &b);
        switch (op) {
            case '+':
                result = a + b;
                break;
            case '-':
                result = a - b;
                break;
            case '*':
                result = a * b;
                break;
            case '/':
                result = a / b;
                break;
            default:
                goto END;
                break;
        }
        printf("%d\n", result);
    }

END:
    return 0;
}

Measured memory_bytes: 1188
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main() {
    int p, q, r;
    cin >> p >> q >>r;
    int a = p + q;
    int b = q + r;
    int c = p + r;
    int ans = 0;
    ans = min({ a,b,c });
    cout << ans << endl;
    return 0;
}

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

int main(){
  ll N,i,ans;
  ll A[222222];
  cin >> N;
  for(i=0;i<=N-1;i++)
    cin >> A[i];
  sort(A,A+N,greater<int>());
  ans = A[0];
  for(i=0;i<=N-3;i++)
    ans += A[i/2+1];
  cout << ans << endl;
}

Measured memory_bytes: 5148
#include <stdio.h>
int main()
{
    char a[20],re[20];
    int i,count,c;
    for(i=0,count=0;i<20;i++)
    {
        scanf("%c",&a[i]);
        if(a[i]=='\n')
            break;
        count++;
    }
    for(i=0;i<count;i++)
    {
        c=i+1;
        re[i]=a[count-c];
        printf("%c",re[i]);
    }
    printf("\n");
    return 0;
}

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

int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int parent(int i) { return i / 2; }
void maxHeapify(int a[], int i, int n)
{
    int l = left(i);
    int r = right(i);
    int largest = 0;

    if (l <= n && a[l] > a[i])
        largest = l;
    else
        largest = i;
    if (r <= n && a[r] > a[largest])
        largest = r;

    if (largest != i)
    {
        swap(a[i], a[largest]);
        maxHeapify(a, largest, n);
    }
}
void heapIncreaseKey(int a[], int i, int key)
{
    if (key < a[i])
        return;
    a[i] = key;
    while (i > 1 && a[parent(i)] < a[i])
    {
        swap(a[i], a[parent(i)]);
        i = parent(i);
    }
}
void insert(int a[], int *n, int x)
{
    *n += 1;
    a[*n] = -1;
    heapIncreaseKey(a, *n, x);
}
int extract(int a[], int *n)
{
    int r = a[1];
    a[1] = a[*n];
    *n -= 1;
    maxHeapify(a, 1, *n);
    return r;
}
#define MAX 2000000
int main()
{
    int a[MAX + 1];
    int n = 0;
    string s;
    cin >> s;
    while (s != "end")
    {
        if (s == "insert")
        {
            int x;
            cin >> x;
            insert(a, &n, x);
        }
        else if (s == "extract")
        {
            cout << extract(a, &n) << endl;
        }
        cin >> s;
    }
}


Measured memory_bytes: 6928
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    int x;
    cin>>x;
    if(x>=1800) cout<<1;
    else if(x>=1600) cout<<2;
    else if(x>=1400) cout<<3;
    else if(x>=1200) cout<<4;
    else if(x>=1000) cout<<5;
    else if(x>=800) cout<<6;
    else if(x>=600) cout<<7;
    else cout<<8;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;

int main()
{
    int N,p=0,q=0;
    cin >> N;
    vint x(N), y(N);
   // vvint xdif(N, vint(N)), ydif(N, vint(N));
    int xdif = 0, ydif = 0;
    map<pair<int, int>, int> m;
    rep(i, N)
    {
        cin >> x[i] >> y[i];
    }
    rep(i,N)
    {
        rep(j,N)
        {
            if(i==j)
                continue;
            xdif = x[i] - x[j];
            ydif = y[i] - y[j];
            m[{xdif, ydif}]++;
        }
    }
    if(N==1)
    {
        m[{0, 0}] = 0;
    }
    int Max = 0;
    for (auto itr = m.begin(); itr != m.end();itr++)
    {
        Max = max(Max, itr->second);
    }
    cout << (N - Max);
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int X;
  cin>>X;
  cout<<(X>=30?"Yes":"No")<<endl;
  return 0;
}


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

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1e9+7;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////
/*(._.)*/
int main(){
	int N; cin >> N;
	static ll A[100002];
	static ll B[100002];
	ll ans = 0;

	FORq(i,1,N+1){
		cin >> A[i];
	}

	FORq(i,1,N){
		cin >> B[i];
	}

	FORq(i,1,N){
		if (A[i] >= B[i]){
			ans += B[i];
			A[i] = A[i] - B[i];
			B[i] = 0;

		}else{
			ans += A[i];
			B[i] = B[i] - A[i];
			A[i] = 0;
			ans += min(A[i+1],B[i]);
			A[i+1] = max(0LL,A[i+1] - B[i]);

		}
	}




	cout << ans << "\n";
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 20005;
int p[MAXN],n,a[MAXN],b[MAXN];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%d",p+i);
	for(int i=1;i<=n;++i)a[i]=n*i;
	for(int i=i;i<=n;++i)b[i]=n*(n-i+1);
	int now=0;
	for(int i=1;i<=n;++i)
		a[p[i]]+=(now++);
	for(int i=1;i<=n;++i)printf("%d ",a[i]);
	puts("");
	for(int i=1;i<=n;++i)printf("%d ",b[i]);
	return 0;
}


Measured memory_bytes: 896
n,m=gets.split.map(&:to_i)
box=Array.new(n,false)
ball_number=Array.new(n,1)
box[0]=true

m.times.each do
v=gets.split.map(&:to_i)
if box[v[0]-1] && ball_number[v[0]-1]==1
    box[v[0]-1]=false
    box[v[1]-1]=true
    ball_number[v[0]-1]-=1
    ball_number[v[1]-1]+=1
elsif box[v[0]-1] && ball_number[v[0]-1]!=1
box[v[0]-1]=true
  box[v[1]-1]=true
  ball_number[v[0]-1]-=1
  ball_number[v[1]-1]+=1
elsif box[v[0]-1]==false
    ball_number[v[0]-1]-=1
     ball_number[v[1]-1]+=1
end
end
p box.count(true)

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

int main() {
  ll n; cin >> n;
  ll cnt=n-1;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ll x=n/i;
      ll y=i;
      cnt=min(cnt,x+y-2);
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{

  int k;
  int a;
  int b;
  int x;
  int c= 0;

  scanf("%d%d%d", &k, &a, &b);

  for (x = a; x <= b; x++){
    if (x % k == 0) c+= 1;
  }

  if (c>=1) printf("OK");
  else printf("NG");

  return 0;

}


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

int main(void)
{
    int a,b,c;
    cin >> a >> b;
    c = a * pow(10,to_string(b).length()) + b;
    for(int i = 0;i < c;i++)
    {
        if(pow(i,2) == c){cout << "Yes" << endl; break;}
        else if(pow(i,2) > c){cout << "No" << endl; break;}
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i, j;
	int a[1003][1003];
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n - 1; j++)
		{
			scanf("%d", &a[i][j]);
			a[i][j]--;
		}
	}
	int ans = 0;
	int p[1003];
	for (i = 0; i < n; i++)
		p[i] = 0;
	int c;
	int count = 0;
	int r[1003];
	while (count < n * (n - 1) / 2)
	{
		c = 0;
		for (i = 0; i < n; i++)
			r[i] = 0;
		for (i = 0; i < n; i++)
		{
			if (r[i] == 0)
			{
				if (p[i] < n - 1)
				{
					if (r[a[i][p[i]]] == 0)
					{
						if (a[a[i][p[i]]][p[a[i][p[i]]]] == i)
						{
							c = 1;
							r[i] = 1;
							r[a[i][p[i]]] = 1;
							p[a[i][p[i]]]++;
							p[i]++;
							count++;
						}
					}
				}
			}
		}
		if (c == 0)
		{
			ans = -1;
			break;
		}
		ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 4096
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn = 1e5 + 5;

int a[maxn], b[maxn], c[maxn], dp[maxn][5];

int main()
{
	int n; scanf("%d",&n);
	for(int i = 1; i <= n; i++)
		scanf("%d %d %d",&a[i],&b[i],&c[i]);
	dp[1][1] = a[1], dp[1][2] = b[1], dp[1][3] = c[1];
	for(int i = 2; i <= n; i++)
	{
		dp[i][1] += max(dp[i-1][2],dp[i-1][3]) + a[i];
		dp[i][2] += max(dp[i-1][1],dp[i-1][3]) + b[i];
		dp[i][3] += max(dp[i-1][1],dp[i-1][2]) + c[i];
	}
	printf("%d\n",max(max(dp[n][1],dp[n][2]),dp[n][3]));
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
//#define int long long
using namespace std;
//const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x) cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define SANKOU(n, a, b) cout << ((n) ? (#a) : (#b)) << endl
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define P pair<int, int>
#define V vector<int>
#define M map<int, int>

int H, W, N, sx, sy;
int S[200010], T[200010];
int dx[5] = {-1, 0, 1, 0, -1}, dy[5] = {0, -1, 0, 1, 0};

void solve()
{
    bool flag = true;
    FOR(k, 0, 4)
    {
        int x = sx, X = sx, y = sy, Y = sy;
        FOR(i, 0, N)
        {
            int s = S[i], t = T[i];
            if (s == k) {
                x += dx[s];
                X += dx[s];
                y += dy[s];
                Y += dy[s];
            }
            x = max(1, x);
            X = min(W, X);
            y = max(1, y);
            Y = min(H, Y);
            //dump(x);
            if (x > W || X < 1 || y > H || Y < 1) {
                flag = false;
                break;
            }
            x += min(0, dx[t]);
            X += max(0, dx[t]);
            y += min(0, dy[t]);
            Y += max(0, dy[t]);
            x = max(1, x);
            X = min(W, X);
            y = max(1, y);
            Y = min(H, Y);
            //dump(x);
        }
        //cout << endl;
    }
    YES(flag);
    /*
    FOR(i,0,4){
        int x=sx,y=sy;
        FOR(j,0,N){
            int s = S[j],t = T[j];
            if(s == i || s == (i+1)%4){
                x += dx[s];
                y += dy[t];
            }
        }
    }*/
}

signed main()
{
    cin >> H >> W >> N >> sx >> sy;
    swap(sx, sy);
    //swap(H, W);
    FOR(i, 0, N)
    {
        char c;
        cin >> c;
        if (c == 'L')
            S[i] = 0;
        else if (c == 'U')
            S[i] = 1;
        else if (c == 'R')
            S[i] = 2;
        else if (c == 'D')
            S[i] = 3;
    }
    FOR(i, 0, N)
    {
        char c;
        cin >> c;
        if (c == 'L')
            T[i] = 0;
        else if (c == 'U')
            T[i] = 1;
        else if (c == 'R')
            T[i] = 2;
        else if (c == 'D')
            T[i] = 3;
    }
    solve();
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int k, n;
  ll a[252521];
  cin>>k>>n;
  REP(i, n){
    cin>>a[i];
  }
  ll ans=a[n-1]-a[0];
  FOR(i, 1, n){
    CHMIN(ans, k-(a[i]-a[i-1]));
  }
  cout<<ans<<'\n';
  return 0;
}


Measured memory_bytes: 1792
import bisect
import random

D = int(input())
C = list(map(int, input().split()))#下がりやすさ
S = [list(map(int, input().split())) for _ in range(D)]#増加分
#T = [int(input()) for _ in range(D)]#コンテストの開催
T = [0] * D
Last = [[-1] for _ in range(26)]

ans = 0

for i in range(D):
    tt = max(S[i])
    t = S[i].index(tt)
    #t = T[i]
    ans += S[i][t-1]
    Last[t-1].append(i) 
    for k in range(26):
        ans -= C[k] * (i - max(Last[k]))
    #print(ans)
    T[i] = t

M = 10**6

for i in range(M):
    d = random.randrange(D)
    q = random.randrange(26)
    
    old = T[d]
    T[d] = q 
    
    tmp = ans
    tmp += S[d][q] - S[d][old]
    
    if max(Last[q]) < d:
        tmp += C[q] * (D - d - 1)
    else:
        q_ind = bisect.bisect_left(Last[q], d)
        tmp += C[q] * (Last[q][q_ind-1] - d)

    if max(Last[old]) < d:
        tmp -= C[old] * (D - d - 1)
    else:
        old_ind = bisect.bisect_left(Last[old], d)
        tmp -= C[old] * (Last[old][old_ind-1] - d) 
    
    if tmp <= ans:
        T[d] = old
        continue
    if d in Last[old]:
        Last[old].remove(d)
    bisect.insort_left(Last[q], d)
    #print(i)

for t in T:
    print(t+1)

    
#Last = [[-1] for _ in range(26)]
#ans = 0
#for i in range(D):
#    t = T[i]
#    ans += S[i][t-1]
#    Last[t-1].append(i) 
#    for k in range(26):
#        ans -= C[k] * (i - max(Last[k]))
#    print(ans)

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

using namespace std;

#define rep(i, a, n) for(int i=a; i<(n); ++i)
typedef long long ll;

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

    ll SumOfWorkDays = 0;
    vector<int> a(m);
    rep(i, 0, m) 
    {
        cin >> a[i];
        SumOfWorkDays += a[i];
    }

    if (n >= SumOfWorkDays)
    {
        printf("%d", n - SumOfWorkDays);
    }
    else
    {
        printf("%d", -1);
    }
}

Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    float n,t,a,mx=999999; int l=0,i=1; cin>>n>>t>>a;
    while(n--){
            float x; cin>>x;
        float p=t-x*0.006;
        if(abs(p-a)<mx)mx=abs(p-a),l=i;
        i++;
    } cout<<l;
}



Measured memory_bytes: 3776
d=lambda n,x:-(-n//x)
N,A,B,C,D,E=[int(input())for _ in[0]*6]
m=A
r=d(N,A)
if m<B:r+=1
else:r=d(N,B)+1;m=B
if m<C:r+=1
else:r=d(N,C)+2;m=C
if m<D:r+=1
else:r=d(N,D)+3;m=D
if m<E:r+=1
else:r=d(N,E)+4
print(r)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long

using namespace std;
ll n,S,dp[3030][3030],a[3030];
const ll Mod = 998244353;

void Add_Self(ll &x , ll y){
    x = (x + y)%Mod;
}

ll Rec(int i , int Have){

    if(i == n)   return (Have == S ? 1 : 0);
    if(Have == S)   return n - (i - 1);

    if(dp[i][Have] != -1)  return dp[i][Have];

    ll Res = 0;
    Add_Self(Res , Rec(i + 1 , min((ll)3001 , Have + a[i])));
    Add_Self(Res , Rec(i + 1 , Have));

    return dp[i][Have] = Res;
}

int main()
{

    memset(dp , -1 , sizeof(dp));
    cin >> n >> S;
    for(int i = 0;i<n;i++)  cin >> a[i];
    ll Ans = 0;
    for(int i = 0;i<n;i++)  Add_Self(Ans , Rec(i , 0));
    cout << Ans;
    return 0;
}


Measured memory_bytes: 72192
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
#define P_MAX 300000

int main(){
  long n;
  cin >> n;
  vector<long> p(n);
  for (long i = 0; i < n; i++) cin >> p.at(i);
  long cnt = 0, min_v = P_MAX;
  for (long i = 0; i < n; i++) {
    if (min_v > p.at(i)) cnt++;
    min_v = min(min_v, p.at(i));
  }
  cout << cnt;
  return 0;
}

Measured memory_bytes: 1792