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

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

using namespace std;

const int inf = 1000000000 + 7;
const int N = 1e6 + 5;

typedef long long ll;

ll n, c, k, t[N], cnt, tmm, ans = 1;

inline void solve()
{
    cin >> n >> c >> k;

    for(int i = 1; i <= n; i ++)
        cin >> t[i];
    sort(t + 1, t + n + 1);
    tmm = t[1];

    for(int i = 2; i <= n; i ++)
    {
        cnt ++;
        if(t[i] > tmm + k || cnt >= c)
        {
            ans ++;
            tmm = t[i];
            cnt = 0;
        }
    }

    cout << ans << endl;
}

int tests = 1;

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

    while(tests --)
        solve();
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll n;
    cin >> n;
    map<ll,ll> factor;
    ll nleft = n;
    for(ll i=2; 1<nleft && i*i<=nleft; i++){
        while(nleft%i == 0){
            factor[i]++;
            nleft /= i;
        }
    }
    if(2<=nleft) factor[nleft]++;
    ll count = 0;
    for(auto x: factor){
        ll left = x.second;
        for(ll i=1; i<=left; i++){
            left -= i;
            count++;
        }
    }

    cout << count;
    return 0;
}


Measured memory_bytes: 3624
N,M = map(int,input().split())
l_n = list(map(int,input().split()))
l_n.append(M)
l_n.sort()
l_a = []
l_s = []
for i in range(N):
    l_a.append(l_n[i+1]-l_n[i])
min_number = l_a[0]
n_list = []
for i in range(1,int(min_number**0.5)+1):
    if min_number % i == 0:
        if i == min_number // i:
            pass
        else:
            n_list.append(min_number // i)
        n_list.append(i)
n_list.sort(reverse=True)
for i in n_list:
    if [j for j in l_a if j % i != 0] == []:
        print(i)
        exit()

Measured memory_bytes: 14224
/* Author - thiolhub */

#include <bits/stdc++.h>

using namespace std;

#define ll              long long int
#define ld              long double
#define db              double
#define pi              3.1415926535897932384626
#define PI              acos(-1.0)
#define endl            "\n"
#define mod             1000000007
#define mk              make_pair
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            ll t; cin>>t; while(t--)
#define sc(a)	        scanf("%lld",&a);
#define pr(a)	        printf("%lld\n",a)
#define f(i,a,n)		for(ll i=a;i<n;i++)
#define m(a)		    memset(a,0,sizeof(a))
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)



int main(){ FastIO;

int a[3];cin>>a[0]>>a[1]>>a[2];
int t;
t=a[1];a[1]=a[0];a[0]=t;
t=a[2];a[2]=a[0];a[0]=t;
cout<<a[0]<<" "<<a[1]<<" "<<a[2];


return 0;
}

Measured memory_bytes: 256
S = input()
L = len(S)
goukei = 0

for i in range(2**(L-1)):
  f = ""
  for j in range(L-1):
    f += S[j]
    if i & 1:
      f += "+"
    i >>= 1
  goukei += eval(f+S[-1])

print(goukei)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()

int32_t main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=max(n,m);i++){
		cout<<min(n,m);
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF INT_MAX
#define eps LDBL_EPSILON
#define moder 1000000007
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
using namespace std;
int n,t,a[100010];
int b[100010],c[100010];
signed main(){
	cin>>n>>t;
	rep(i,n){
		cin>>a[i];
		b[i]=a[i];
		c[i]=a[i];
		if(i)b[i]=min(b[i],b[i-1]);
	}
	for(int i=n-2;i>=0;i--){
		c[i]=max(c[i],c[i+1]);
	}
	int ans=0;
	for(int i=1;i<n;i++){
		ans=max(ans,c[i]-b[i-1]);
	}
	int cnt=0;
	for(int i=1;i<n;i++){
		if(b[i-1]==a[i-1]&&c[i]-b[i-1]==ans)cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <iostream> 
#include <bits/stdc++.h>
#include <vector> 
#include <algorithm> 
#include <string>
#include <cmath>
#include <iomanip> 
#include<climits> 
#include <utility>   
#include <set>
#include <numeric> 
#include <iterator>
#include <map> 
using namespace std; 
#define ll long long int
//#define M 1000000007
//typedef pair<ll,ll> p; 
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    
   int n;
   cin>>n;
   string s=to_string(n);
   if(s[0]=='7' || s[1]=='7' || s[2]=='7')
   cout<<"Yes"<<endl;
   else
   cout<<"No"<<endl;
}


Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, s, n) for(int i = s; i < n; i++)
#define rRep(i, n) for(int i = n - 1; i >= 0; i--)
#define pii pair<int, int>
#define vii vector<pair<int, int>>
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define endl "\n"

vi vec;

int merge(int left, int mid, int right) {
    vi temp;
    int inv = 0;
    int i = left, j = mid;
    while(i < mid && j <= right) {
        if(vec[i] <= vec[j])
            temp.pb(vec[i++]);
        else {
            temp.pb(vec[j++]);
            inv += mid - i;
        }
    }
    while(i < mid)
        temp.pb(vec[i++]);
    while(j <= right)
        temp.pb(vec[j++]);
    REP(i, left, right + 1)
        vec[i] = temp[i - left];
    return inv;
}

int mergeSort(int l, int r) {
    if(l >= r)
        return 0;
    int inv = 0;
    int m = (l + r)/2;
    inv += mergeSort(l, m);
    inv += mergeSort(m + 1, r);
    inv += merge(l, m + 1, r);
    return inv;
}

void solve() {
    string s, t;
    cin >> s >> t;
    int count = 0;
    REP(i, 0, s.length())
        if(s[i] != t[i])
            count++;
    cout << count << endl;
}

int32_t main() {
    FAST
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //int t; cin >> t; while(t--)
    {
        solve();
    }   
}

Measured memory_bytes: 3804
#include <iostream>
#include <deque>
using namespace std;
int main(){
    string test , desired;
    cin >> test >> desired;
    deque <char> v;
    bool done = false;
    for (int i = 0 ; i < test.length() ; i++)
        v.push_back(test[i]);
    for (int i = 0 ; i < v.size() ; i++){
        test = "";
        v.push_front(v[v.size() - 1]);
        v.pop_back();
        for (int j = 0 ; j < v.size() ; j++) test += v[j];
        if (test == desired) done = true;
        if (done){
            cout << "Yes";
            exit(0);
        }
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 256
from itertools import accumulate
def main():
    n,k=map(int,input().split())
    P=list(map(int,input().split()))
    E=[0]*n
    for i,p in enumerate(P):
        E[i]=(1+p)/2
    Acc=[0]+list(accumulate(E))
    ans=0
    for i in range(n-k+1):
        ans=max(ans,Acc[i+k]-Acc[i])
    print(ans)
    
if __name__=='__main__':
    main()

Measured memory_bytes: 87944
#include<bits/stdc++.h>
using namespace std;
typedef long long lld;
typedef pair<lld,lld> pr;
lld const mod = 1e9+7;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  lld n;
  cin>>n;
  lld a[n];
  // lld List[n]={0};
  vector <lld> L[n+5];
  lld i;
  for(i=0;i<n;i++)
  {
    cin>>a[i];
    L[a[i]-1].push_back(i);
  }
  // for(i=0;i<n;i++)
  // {
  //   cout<<i<<" :";
  //   for(auto itr = L[i].begin();itr!=L[i].end();itr++)
  //   {
  //     cout<<*itr<<",";
  //   }
  //   cout<<'\n';
  // }

  lld size[n]={0};
  lld total = 0;
  for(i=0;i<n;i++)
  {
    size[i] = L[i].size();
    // cout<<size[i]<<'\n';
    total += size[i]*(size[i]-1)/2;
  }

  // cout<<'\n';

  lld cnt=0;
  for(i=0;i<n;i++)
  {
    cnt = size[a[i]-1];
    cout<< total - cnt*(cnt-1)/2 + (cnt-1)*(cnt-2)/2<<'\n';
    // cnt = L[a[i]].size();
    // cnt--;
    // cout<<cnt*(cnt-1)/2<<'\n';
  }
}


Measured memory_bytes: 13696
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to;
	ld cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y, h;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
ll fact(ll x, ll k) {//最大値、個数
	ll sum = 1;
	for (int i = 0; i < k; i++)
		sum *= (x--);
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}
#define int long long
const long long inf = 4523372036854775807;
const int iinf = 1500000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int n;
signed main() {
	cin >> n;
	int sum = 0;
	for (int i = 1; i <= n; i++) {
		sum += i;
		if (sum >= n) {
			for (int j = 1; j <= i; j++) {
				if (sum - n == j) continue;
				cout << j << endl;
			}
			break;
		}
	}
	getchar(); getchar();
}

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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 1024;

int n, m, a[N][N];

void solve(int x, int y, int k) {
	if (!k) {
		return;
	}
	int t = 1 << (k - 1);
	a[x + t][y + t] = 1;
	solve(x, y, k - 1);
	solve(x + t, y, k - 1);
	solve(x, y + t, k - 1);
	solve(x + t, y + t, k - 1);
}

int main() {
	read(n), read(m);
	solve(0, 0, std::max(n, m));
	for (int i = 1; i < (1 << n); ++i) {
		for (int j = 1; j < (1 << m); ++j) {
			putchar(a[i][j] ^ '0');
		}
		putchar('\n');
	}
}


Measured memory_bytes: 8584
#include<bits/stdc++.h>
using namespace std;
int res;
int solve(double a,double b)
{
    a=pow(a,2);
    b=pow(b,2);
    //cout<<a<<" "<<b<<"\n";
    double ans=sqrt(a+b);
   // cout<<ans<<"\n";
   if(ans<=res)
    return 1;
    return 0;
}
int main()
{
    int a,ret=0,ans=0;
    double t,c,x,y;
    cin>>a>>res;
    while(a--)
    {

        cin>>x>>y;
        int ret=solve(x,y);
        if(ret)
            ans++;

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

    return 0;
}


Measured memory_bytes: 3824
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define all(v) v.begin(),v.end()
#define fio() ios::sync_with_stdio(0);cin.tie(0);
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define fornn(i,a,n) for(ll i=a;i<=n;i++)
#define pb push_back
#define MAXN 100005LL
#define INF 1000000005LL
inline void solve(){
	ll n;
	cin>>n;
	ll h[n];
	for(ll i=0;i<n;i++)
		cin>>h[i];
	ll dp[n];
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);
	for(ll i=2;i<n;i++)
		dp[i]=min((dp[i-1]+abs(h[i]-h[i-1])),(dp[i-2]+abs(h[i]-h[i-2])));
	cout<<dp[n-1];
}
int main(){
	#ifndef ONLINE_JUDGE
	//freopen("output.txt","w",stdout);
	//freopen("input.txt","r",stdin);
	#endif
	fio();
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(void){
   int n,m;
   cin >> n >> m;
   int count[n];
   for(int i=0;i<n;i++){
       count[i] = 0;
   }
   for(int i=0;i<m;i++){
       int a,b;
       cin >> a >> b;
       count[a-1]++;
       count[b-1]++;
   }
   for(int i=0;i<n;i++){
       cout << count[i] << endl;
   }
}

Measured memory_bytes: 3632
import sys
input = sys.stdin.readline

n = int(input())
buttons = [int(input())-1 for n in range(n)]
light = 0
count = 0
while light != 1:
    if buttons[light] == -1:
        print(-1)
        break
    num = light
    light = buttons[num]
    buttons[num] = -1
    count += 1
else:
    print(count)

Measured memory_bytes: 7084
#include<stdio.h>

int main(){
	
	char buf[101];
//	char buf[3];
	int N;
	int x=0;
	int i=0;
	int max = 0;
		
	fgets(buf,100,stdin);
	sscanf(buf,"%d",&N);
//	if(N < 1){
//		N = 1;
//	}
//	else if( N > 100){
//		N = 100;
//	}

	fgets(buf,101,stdin);
//	fgets(buf,3,stdin);
	
//	printf("%s", buf);
	
	
	for(i=0; i<N; ++i){
		if(buf[i] == 'I' ){
			++x;
		}
		else if(buf[i] == 'D'){
			--x;
		}
		if(x > max){
			max = x;
		}
	}
	
	printf("%d\n", max);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

#define max(a,b) (a > b ? a : b)
#define min(a,b) (a < b ? a : b)

using namespace std;

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

long gbd(long x,long y){
    return x*y / gcd(max(x,y),min(x,y));
}

int main(void){
    long a,b,c,d;
    cin >> a >> b >> c >> d;
    long ca = (a-1) / c;
    long da = (a-1) / d;
    long cb = b / c;
    long db = b / d;
    long gbda = (a-1) / gbd(c,d);
    long gbdb = b / gbd(c,d);
    cout << (b-a+1) - (cb-ca) - (db-da) + (gbdb - gbda) << endl; 
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll H, W;
    ll current = 0;
    cin >> H >> W;
    rep(i, H) {
        ll temp = current;
        string row;
        cin >> row;
        if(row[current] == '.') {
            cout << "Impossible" << endl;
            return 0;
        }
        rep(j, W) {
            if(j >= current) {
                if(row[j] == '#') temp = j; 
            } else if(row[j] == '#') {
                cout << "Impossible" << endl;
                return 0;
            }
        }
        current = temp;
    }
    if(current == W - 1) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
    return 0;
}


Measured memory_bytes: 256
def make_divisors(n):
    #divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            B[i]+=1
            if i != n // i:
                B[n//i]+=1

    # divisors.sort()
    #return divisors

N=int(input())
A=list(map(int,input().split()))

B=[0]*300000
C=[]
count=0
for i in reversed(range(N)):
    if B[i+1]%2!=A[i]:
        make_divisors(i+1)
        count +=1
        C.append(i+1)
print(count)
#print(B)
if count!=0:
    for i in reversed(range(1,count)):
        print(str(C[i])+" ",end="")
    print(C[0], end="")

Measured memory_bytes: 66536
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0): # 四捨五入
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def round_up(a):
    return int(a + 0.9)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    n,k,s = map(int,input().split())
    ans = []
    count = 0
    for i in range(n):
        if count < k:
            ans.append(str(s))
            count += 1
        else:
            if s == int(1e9):
                ans.append(str(s - 1))
            else:
                ans.append(str(s + 1))
    print(' '.join(ans))
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 54252
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <cstdlib>
#include <unordered_map>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.0000000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007 
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	vector<int> inputs;
	inputs.push_back(a);
	inputs.push_back(b);
	inputs.push_back(c);
	sort(inputs.begin(), inputs.end());
	int ans = inputs[2] - inputs[1];
	inputs[0] += ans;
	inputs[1] += ans;
	cout << ans + (inputs[2] - inputs[0]+1) / 2 + (inputs[2] - inputs[0]) % 2 << endl;
	return 0;
}

Measured memory_bytes: 888
while 1:
	try:
		a = map(int,raw_input().split())
		b = map(int,raw_input().split())
		c,d = 0,0
		for i in enumerate(b):
			if i[1] in a:
				if a[i[0]] == i[1]:
					c += 1
				else:
					d += 1
		print c,d
	except:
		exit()

Measured memory_bytes: 4212
#include <stdio.h>
#include <math.h>
double stdev(int s[], int n)
{
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        sum = sum + s[i];
    }
        double m = (double)sum / n;
        double sum2 = 0;
        for (int i = 0; i < n; i++)
        {
            sum2 = sum2 + pow(s[i] - m, 2);
        }
        double v = sum2 / n;
        return sqrt(v);
}

int main()
{
    int n, s[1000];
    do
    {
        scanf("%d", &n);
        if (n > 0)
        {
            for (int i = 0; i < n; i++)
            {
                scanf("%d", &s[i]);
            }
            double sd = stdev(s, n);
            printf("%.6lf\n", sd);
        }

    } while (n > 0);

    return 0;
}


Measured memory_bytes: 2100
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
using namespace std;
int N,M;
int main(){
    cin>>N;
    char s[N][11];
    for(int i=0;i<N;i++)
        cin>>s[i];
    cin>>M;
    char t[M][11];
    for(int j=0;j<M;j++)
        cin>>t[j];
    
    int cunt[N];
    for(int i=0;i<N;i++){
        cunt[i]=1;
        for(int j=i+1;j<N;j++){
            if(strcmp(s[i],s[j])==0)
                cunt[i]++;
        }
        for(int j=0;j<M;j++){
            if(strcmp(s[i],t[j])==0)
                cunt[i]--;
        }
    }
    
    int max_num=-100;
    for(int i=0;i<N;i++){
        if(cunt[i]>max_num){
            max_num=cunt[i];
        }    
        
    }
    
    cout<<(max_num>=0?max_num:0)<<"\n";                    
    
    return 0;
    

}


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


int main(){
    long long N;
    cin>>N;
    long long a[N];
    for(int i=0;i<N;++i){
        cin>>a[i];
    }
    long long m=a[0];
    long long k=0;
    for(int i=0;i<N;++i){
        if(a[i]>m){
            m=a[i];
            k=i;
        }
    }
    a[k]=0;
    long long sum=accumulate(a,a+N,0);
    if(sum>m){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

}

Measured memory_bytes: 256
#include <iostream>
 using namespace std;
 int main(){
     int A,B,C;
     cin >> A >> B >> C ;
     if (A+B >=C) {
         cout << "Yes" <<endl;
     }
     else {
         cout << "No" <<endl;
     }
        
        
            
            
            
          return 0;
 }               

Measured memory_bytes: 256
#include <stdio.h>

main(){
    int n;
    char str[200];

    scanf("%d",&n);
    scanf("%s",str);

    int i,j;
    int x[30],y[30];
    int max=0,c;
    for(i=0;i<=n;i++){
        for(j=0;j<30;j++)
            x[j]=y[j]=0;
        for(j=0;j<n;j++){
            if(j<i)
                x[str[j]-'a']++;
            else
                y[str[j]-'a']++;
        }
        c=0;
        for(j=0;j<30;j++)
            if(x[j]&&y[j])
                c++;
        if(max<c)
            max=c;
    }
    printf("%d\n",max);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long


int main()
{
	int N, K, V[60];
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> V[i];
	}
	int sum = 0, ans = 0;
	for (int i = 0; i <= min(N, K); i++) {
		for (int j = 0; j <= min(N, K) - i; j++) {
			vector<int> Ne;
			sum = 0;
			for (int k = 0; k < i; k++) {
				sum += V[k];
				if (V[k] < 0) Ne.push_back(V[k]);
			}
			for (int k = 0; k < j; k++) {
				sum += V[N - 1 - k];
				if (V[N - 1 - k] < 0) Ne.push_back(V[N - 1 - k]);
			}
			sort(Ne.begin(), Ne.end());
			for (int k = 0; k < K - (i + j); k++) {
				if (k >= Ne.size()) break;
				sum -= Ne[k];
			}
			if (sum > ans) ans = sum;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makel(N) ll N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007
#define re return 0
#define distance(x1,y1,x2,y2) sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

void YN(bool b) {
	if (b)say("YES");
	else say("NO");
}

template<typename T>
void maxi(T &a, T b) {
	a = max(a, b);
}

template<typename T>
void mini(T &a, T b) {
	a = min(a, b);
}

void exact_say(double x) {
	cout << setprecision(numeric_limits<double>::max_digits10) << x << endl;
}

int main() {
	int ans = 0;
	makei(n);
	makev(p, n);
	sort(rev(p));
	ans += p.front() / 2;
	Rep(1, n)ans += p[i];
	say(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

typedef tuple<ll, ll, ll> T;

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


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  map<int,int> a;
  REP(i,3){
    int n;cin>>n;
    a[n]++;
  }
  (a[5]==2 && a[7]==1) ? cout<<"YES" : cout<<"NO";
  cout<<endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i <(int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i,k,n) for (int i = (int)(n)-1; i >= k; i--)
// #define mod 1000000007
long long dp[10][2][20][2] = {};
string n;
long long rec(int k = 0,bool tight = true,int bit = 0,bool zero=false){
  if(k==n.size()){
      if(bit==7) return 1;
      else return 0;
  }
  int x = n[k] - '0';
  int r = (tight ? x : 9);
  long long &res = dp[k][tight][bit][zero];
  if(res!=-1) return res;
  res = 0;
  rep(i,r+1){
     if(i==7||i==5||i==3) res += rec(k+1,tight && i == r, bit|(1<<((i-3)/2)),true);
     if(i==0&&zero==false) res += rec(k+1,tight && i == r, bit,zero);
  }
  return res;
}
int main(){
  memset(dp,-1,sizeof(dp));
  cin >> n;
  cout << rec() << endl;
  return 0;
}


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

int main()
{
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
        return 0;
    } else {
        cout << "No" << endl;
        return 0;
    }
}

Measured memory_bytes: 888
#include "bits/stdc++.h"
using namespace std;
const int maxn = 200200;
int A[maxn], B[maxn];
int main(){
	int n;
	cin >> n;
	for(int e = 0; e < n; e++) cin >> A[e] >> B[e];
	for(int e = 0; e < n; e++) if(A[e] != B[e])
		goto charm;
	cout << 0 << endl;
	return 0;
	charm:;
	long long tmp = 1ll<<60;
	for(int e = 0; e < n; e++) if(A[e] > B[e]) tmp = min(tmp, 1ll * B[e]);
	long long res = -tmp;
	for(int e = 0; e < n; e++) res += B[e];
	cout << res << endl;
    return 0;
}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <vector>
#include <queue>
#include <unordered_map> 
#include <iomanip>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF (INT_MAX/3)
#define PSB push_back
#define PN 1000000007
typedef long long LL;
//#define int long long


//booooooooooooost
//#include <boost/multiprecision/cpp_int.hpp>
//#include <boost/multiprecision/cpp_dec_float.hpp>
//namespace mp = boost::multiprecision;	//多倍長整数(mp::cpp_int), 多倍長小数(mp::cpp_dec_float_100)



LL inv_mod(LL a, LL m)
{
	LL b, x, u, q, tmp;

	b = m; x = 1; u = 0;
	while (b > 0) {
		q = a / b;
		tmp = u; u = x - q * u; x = tmp;
		tmp = b; b = a - q * b; a = tmp;
	}

	return (x < 0) ? m + x : x;
}




signed main() {

	string s;
	cin >> s;

	LL ans = 0;

	vector<int> flag;
	flag.resize(s.size() - 1);
	REP(i, pow(2, s.size() - 1)) {
		REP(j, s.size() - 1) {
			if ((i / (int)pow(2, j)) % 2 == 1) flag[j] = true;
			else flag[j] = false;
		}
		string tmp = string{ s[0] };
		REP(j, s.size() - 1) {
			if (flag[j]) tmp.PSB(s[j + 1]);
			else {
				ans += stoll (tmp);
				tmp = string{ s[j + 1] };
			}
		}
		ans += stoll(tmp);
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 384
while true
        n,x = gets.split(' ').map(&:to_i)
        break if n == 0 && x == 0
 
        count = 0
        (1..n).each {|i|
                e = i + 1
                (e..n).each {|j|
                        f = j + 1
                        (f..n).each {|k|
                                count += 1 if (i + j + k) == x
                        }
                }
        }
 
        puts count
 
end

Measured memory_bytes: 8724
n, m = map(int, input().split())
p = list(map(lambda x: int(x) - 1, input().split()))
xy = [list(map(lambda x: int(x) - 1, input().split())) for _ in range(m)]

parents = [i for i in range(n)]
ranks = [0 for _ in range(n)]


def root(x):
    return x if x == parents[x] else root(parents[x])


def is_same(x, y):
    return root(x) == root(y)


def unite(x, y):
    x, y = root(x), root(y)
    if x == y:
        return
    if ranks[x] < ranks[y]:
        parents[x] = y
    else:
        parents[y] = x
        if ranks[x] == ranks[y]:
            ranks[x] += 1


for x_, y_ in xy:
    unite(x_, y_)

cnt = sum((1 if is_same(i, p_) else 0) for i, p_ in enumerate(p))
print(cnt)


Measured memory_bytes: 36032
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
const int N=100005;
vector<int> v[N];
int n,color[N];
void insert(int a,int b){
	v[a].push_back(b); v[b].push_back(a);
}
struct tree{
	vector<int> v[N];
	int vis[N],rt;
	void dfs(int p){
		if(v[p].size()%2==0)vis[p]=p;
		for(unsigned i=0;i<v[p].size();i++){dfs(v[p][i]); if(vis[p]){insert(vis[v[p][i]],vis[p]); vis[p]=0;}else vis[p]=vis[v[p][i]];}
	}
	void init(){
		for(int i=1;i<=n;i++){	
			int t=read(); if(t==-1)rt=i; else v[t].push_back(i);
		}
		dfs(rt);
	}
}T[2];
void ddd(int p,bool dq){
	color[p]=dq;
	for(unsigned i=0;i<v[p].size();i++)if(color[v[p][i]]==-1)ddd(v[p][i],dq^1);
}
int main(){
	n=read();
	T[0].init();
	T[1].init();
	for(int i=1;i<=n;i++)if(((T[0].v[i]).size())%2!=((T[1].v[i]).size())%2){
		puts("IMPOSSIBLE"); return 0;
	}
	puts("POSSIBLE");
	memset(color,-1,sizeof(color));
	for(int i=1;i<=n;i++)if(color[i]==-1)ddd(i,0);
	for(int i=1;i<=n;i++)if(T[0].v[i].size()&1){
		putchar('0'); putchar(' ');
	}else{
		if(color[i])putchar('-'); putchar('1'); putchar(' ');
	}
}

Measured memory_bytes: 18816
Sp = str(input())
T = str(input())
n = len(T)
a = [] # Spの何文字目から始まる文字列ならTと一致できるか。
b = [] # 候補のリスト
for i in range(len(Sp)-n+1):
  X = Sp[i:i+n]
  cnt = 0
  for j in range(n):
    if X[j] != '?':
      if X[j] != T[j]:
        break
      else:
        cnt += 1
    else:
      cnt += 1
  if cnt == n:
    a.append(i)
if a == []:
  print('UNRESTORABLE')
  exit()
for i in a:
  S1 = Sp[:i]
  S2 = Sp[i+n:]
  S3 = S1.replace('?', 'a')
  S4 = S2.replace('?', 'a')
  b.append(S3 + T + S4)
b.sort()
print(b[0])

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
#define ll long long
#define mem(x,num) memset(x,num,sizeof x)
#define reg(x) for(int i=last[x];i;i=e[i].next)
using namespace std;
inline ll read(){
    ll f=1,x=0;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();}
    return x*f;
}
#define pb push_back
const int maxn=1e5+6;
struct point{int id,val;};
vector<point> v[4];
int n,r,c,s[maxn<<1],top=0;
inline bool check(int x,int y){
    if(x==0||x==r||y==0||y==c)return 1;else return 0;
}
void push(int id,int x,int y){
    if(x==0)v[0].pb({id,y});
    else if(y==c)v[1].pb({id,x});
    else if(x==r)v[2].pb({id,y});
    else if(y==0)v[3].pb({id,x});
}
inline bool cmp1(point a,point b){return a.val<b.val;}
inline bool cmp2(point a,point b){return a.val>b.val;}
int main()
{
    r=read(),c=read(),n=read();
    rep(i,1,n){
        int X1=read(),Y1=read(),X2=read(),Y2=read();
        if(check(X1,Y1)&&check(X2,Y2))push(i,X1,Y1),push(i,X2,Y2);
    }
    sort(v[0].begin(),v[0].end(),cmp1);
    sort(v[1].begin(),v[1].end(),cmp1);
    sort(v[2].begin(),v[2].end(),cmp2);
    sort(v[3].begin(),v[3].end(),cmp2);
    rep(j,0,3)
        for(int i=0;i<v[j].size();i++){
            if(top==0){s[++top]=v[j][i].id;continue;}
            if(s[top]==v[j][i].id)top--;else s[++top]=v[j][i].id;
        }
    if(top==0)puts("YES");else puts("NO");
    return 0;
}


Measured memory_bytes: 2584
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

set<ll> S;
ll A[5], N, sum = 0;
ll dfs(ll bit) {
    for(int i=0; i<N; i++) {
        {
            int cnt = 0;
            for(int b=0; b<(1<<N); b++) {
                if((bit >> b & 1) and (b >> i & 1)) cnt++;
                if(cnt > A[i]) return LONGINF;
            }
        }
        {
            for(int j=i+1; j<N; j++) {
                int cnt = 0;
                for(int b=0; b<(1<<N); b++) {
                    if((b >> i & 1) and (b >> j & 1) and (bit >> b & 1)) cnt++;
                    if(cnt > 1) return LONGINF;
                }
            }
        }
    }

    ll res = sum;
    for(int b=0; b<(1<<N); b++) {
        if(!(bit >> b & 1)) continue;
        res -= __builtin_popcountll(b) - 1;
    }
    // cerr << "# " << bitset<32>(bit).to_string() << " " << res << endl;

    int lb = -1;
    for(int b=0; b<(1<<N); b++) {
        if(bit >> b & 1) lb = b;
    }
    for(int b=lb+1; b<(1<<N); b++) {
        if(__builtin_popcountll(b) <= 1) continue;
        chmin(res, dfs(bit | (1LL << b)));
    }
    return res;
}

int main() {
    cin >> N;
    for(int i=0; i<N; i++) {
        cin >> A[i];
        sum += A[i];
    }
    ll ans = dfs(0);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3124
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

struct point2d {
    int x;
    int y;
};

#define BUF_SIZE 20

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

#include <math.h>
#define TOWNS_MAX 10
char used[TOWNS_MAX];
int p[TOWNS_MAX];

int main(void) {
    int num = get_int();
    struct point2d pos[TOWNS_MAX];
    int i, j;
    for(i = 0; i < num; i++) {
        get_int2(&pos[i].x, &pos[i].y);
    }
    double sum = 0;
    for(i = 0; i < num; i++) {
        for(j = 0; j < num; j++) {
            if(i==j) continue;
            int dx = pos[i].x - pos[j].x;
            int dy = pos[i].y - pos[j].y;
            sum += sqrt(dx*dx + dy*dy);
        }
    }
    printf("%f\n", sum / i);
}

Measured memory_bytes: 128
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

int main(void){
    string s;
    cin >> s;
    ll cnt = 0;
    map<char, ll> mp;
    for(int i = 0; i < s.size(); i++){
        mp[s[i]]++;
    }
    for(auto &i : mp){
        if(i.second < 2) continue;
        cnt += nCr(i.second, 2);
    }

    if(s.size() == 1){ 
        cout << 1 << endl;
        return 0;
    }

    ll ans = nCr(s.size(), 2) + 1;
    cout << ans - cnt << endl;

}

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

ll gcd(ll a, ll b){
    // cout << a << " " << b << endl;
    ll x = max(a,b);
    ll y = min(a,b);
    ll z = x % y;
    if(z == 0){
        return y;
    }
    return gcd(y, z);
}

int main(){
    ll k;
    cin >> k;
    ll total = 0;
    for(int a=1;a<=k;a++){
        for(int b=1;b<=k;b++){
            for(int c=1;c<=k;c++){
                total += gcd(gcd(a,b),c);
            }
        }
    }

    cout << total << endl;
    
} 

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9)+7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n) {
  vector< pair<ll, ll> > p;
  for (ll i = 2; i * i <= n; i++) {
    if ((n % i) != 0) continue;
    p.push_back(make_pair(i, 0));
    while ((n % i) == 0) {
      n /= i;
      p[i].second += 1;
    }
    p.push_back(make_pair(n, 0));
  }

  if (n != 1) p.push_back(make_pair(n, 1));
  return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a) {
	ll b = MOD, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0) { u += MOD; }
	return u;
}
// 順列
ll permutation(const ll n, const ll m) {
	ll result = 1;
	for (ll i = n; i > n - m; i--) { result = (result * i) % MOD; }
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x) {
	if (x == 0) return 1;
	ll res = repeat_square(n, x/2);
	res = res * res % MOD;
	if ((x % 2) == 1) res = res * n % MOD;
  return res;
}
// 組み合わせ
ll combination(const ll n, const ll a) {
	ll x = 1, y = 1;
  for(ll i = 0; i < a; i++){
    x = x * (n-i) % MOD;
    y = y * (i+1) % MOD;
  }
  return x * repeat_square(y, MOD-2) % MOD;
}

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

  if (K % 2 == 0 || K % 5 == 0) {
    cout << -1 << endl;
    return 0;
  }

  ll start = 0;
  int ans = 0;
  while(true) {
    start = (10 * start + 7) % K;
    ans++;
    if (start == 0) break;
  }
  cout << ans << endl;
  return 0;
}


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

int main(void){
	int a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  if(abs(a - c) <= d) {
    printf("Yes");
  } else if(abs(a - b) <= d && abs(b - c) <= d) {
    printf("Yes");
  } else {
    printf("No");
  }
	return 0;
}

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


int main(){
	string s;
	cin>>s;
	
	int l[s.size()];
	int last[s.size()];
	
	memset(l, 0, sizeof(l));
	
	int lastR=0;
	int lastL=s.size()-1;
	
	for (int i=1; i<s.size(); i++){
		if (s[i]=='R') lastR=i;
		else last[i]=lastR;
	}
	
	for (int i=s.size()-2; i>=0; i--){
		if (s[i]=='L') lastL=i;
		else last[i]=lastL;
	}
	
	for (int i=0; i<s.size(); i++){
		if (s[i]=='R'){
			int andou=last[i]-i;
			if (andou%2==0) l[last[i]]++;
			else l[last[i]-1]++;
		}
		
		if (s[i]=='L'){
			int andou=i-last[i];
			if (andou%2==0) l[last[i]]++;
			else l[last[i]+1]++;
		}
	}
	
	for (int i=0; i<s.size(); i++) cout<<l[i]<<" ";
}


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

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a;
	int sum = 0;
	while (n--) {
		int x;
		cin >> x;
		a.push_back(x);
		sum += x;
	}
	double avg = 1.0 * sum / a.size();
	int idx = 0;
	for (int i = 1; i < a.size(); i++) {
		if (fabs(a[i] - avg) < fabs(a[idx] - avg)) {
			idx = i;
		}
	}
	cout << idx << endl;
}

Measured memory_bytes: 256
//自动打表 
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
//k:位数-1
//由于dfs时先push_back后return
//可达limit+1
const int limit=9;
vector<ll> ans;
void dfs(ll now,int len)
{
	ans.push_back(now);
	if(len>=limit)
		return;
	len++;
	if(now%10)
		dfs(now*10+now%10-1,len);
	dfs(now*10+now%10,len);
	if(now%10<9)
		dfs(now*10+now%10+1,len);
}
int main()
{
	dfs(1,0),dfs(2,0),dfs(3,0);
	dfs(4,0),dfs(5,0),dfs(6,0);
	dfs(7,0),dfs(8,0),dfs(9,0);
	sort(ans.begin(),ans.end());
	ans.erase(unique(ans.begin(), ans.end()), ans.end());
	
	int k;
	scanf("%d",&k);
	printf("%lld",ans[k-1]);
	return 0;
}

Measured memory_bytes: 2420
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int64, n, n)
	ans := 1
	odd := 1
	for _, ai := range a {
		fmt.Scan(&ai)
		ans *= 3
		if ai%2 == 0 {
			odd *= 2
		}
	}
	fmt.Println(ans - odd)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
        #define ll  long long int
        #define pb push_back
        #define mp make_pair
        #define ff first
        #define ss second
        #define vi vector<int>
        #define br cout <<"\n";
        #define all(x)  (x).begin(),(x).end()
        #define tr(c,i) for(auto i : c)
        #define pii pair< int,int >
        #define fast_io() ios_base::sync_with_stdio(false);cin.tie(nullptr)
        #define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
        #define er(x) cout << x << " "
        #define err(x,y) cout << x << " "<<y
        const int M = 200005;
        using namespace std;
        clock_t time_p=clock();
        void dem()
        {
            time_p=clock()-time_p;
            cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
        }

        using namespace std ;
        const int N =  5 * 1000 + 10   ;
        const int dx[] = { 1, -1 , 0 , 0  };
        const int dy [] = { 0 ,0 , 1 , -1  };
        int lcp [N][N] ;
        int main (){
        int n ;
        cin >> n ;
        string s ;
        cin >>s ;
        int res  = 0 ;
        for ( int i = n-1 ; i >=0  ; --i ){

            for ( int j = n-1 ; j >= i; -- j ){
                lcp[i][j] = s[i] == s[j] ? 1 + lcp [i+1][j+1] :  0 ;
                res =  max ( min ( j - i , lcp[i][j] ) , res ) ;

            }

        }

        cout << res ;
        return 0 ;

        }


Measured memory_bytes: 96896