akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<map>
#include<iterator>

using namespace std;

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

    vector<int> v1(n/2), v2(n/2);
    for(int i=0;i<n/2;i++)cin >> v1.at(i) >> v2.at(i);

    vector< pair<int, int> > p1(100000), p2(100000);
    for(int i=0;i<100000;i++){
        p1.at(i) = make_pair(0, i+1);
        p2.at(i) = make_pair(0, i+1);
    }
    for(int i=0;i<n/2;i++){
        p1.at(v1.at(i)-1).first++;
        p2.at(v2.at(i)-1).first++;
    }

    sort(p1.begin(), p1.end(), greater< pair<int, int> >());
    sort(p2.begin(), p2.end(), greater< pair<int, int> >());

    if(p1.at(0).second != p2.at(0).second){
        cout << n - p1.at(0).first - p2.at(0).first << endl;
    }
    else if(p1.at(0).first > p2.at(0).first){
        cout << n - p1.at(0).first - p2.at(1).first << endl;
    }
    else if(p1.at(0).first == p2.at(0).first){
        if(p1.at(1).first >= p2.at(1).first)cout << n - p1.at(1).first - p2.at(0).first << endl;
        else cout << n - p1.at(0).first - p2.at(1).first << endl;;
    }
    else{
        cout << n - p1.at(1).first - p2.at(0).first << endl;
    }
    
    return 0;
}

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

int main(){
    int r, c;
    cin >> r >> c;
    
    vector<vector< int > > v1(r + 1, vector<int>(c + 1));
    for(int i = 0; i < r; i++){
        int sum = 0;
         for(int j = 0; j < c; j++){
             cin >> v1[i][j];
             sum += v1[i][j];             
        }
        v1[i][c] = sum;                              
    }

    for(int i = 0; i < c + 1; i++){
        for(int j = 0; j < r; j++){
            v1[r][i] += v1[j][i];
        }
    }  
    for(int i = 0; i < r + 1; i++){
         for(int j = 0; j < c + 1; j++){
             if(j != c){
             cout << v1[i][j] << " ";
             }
             else{
                 cout << v1[i][j] << endl;
             }
         }
    }    
}


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

using namespace std;
int a[100005]; 
int main(){
	int n;
	cin>>n;
	int k=0;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	for(int i=0;i<n;i++)if(a[i]!=a[i-1])k++;
	if(k%2==0)cout<<k-1<<endl;
	else cout<<k<<endl; 
	return 0;
}

Measured memory_bytes: 640
/******************************************
* NICK : nikhilsinghh59 *
******************************************/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"

#define PB push_back
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
const int M = 1e9+7;

int main()
{   
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    string s;
    cin >> s;
    //cout << n;

    if(s[0]=='7' || s[1]=='7' || s[2]=='7') {
        cout <<"Yes";
    }
    else {
        cout << "No";
    }

    
    return 0;
}

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

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

    int *a = new int[4];
    a[3] = n / 1000;
    a[2] = (n - a[3] * 1000) / 100;
    a[1] = (n - a[3] * 1000 - a[2] * 100) / 10;
    a[0] = (n - a[3] * 1000 - a[2] * 100 - a[1] * 10);

    for (int mask = 0; mask < (1 << 3); mask++) {
        int sum = a[3];
        for (int i = 2; i >= 0; i--) {
            if (1 & mask >> i) {
                sum += a[i];
            } else {
                sum += -a[i];
            }
        }
        if (sum == 7) {
            string result = "";
            for (int i = 0; i < 3; i++) {
                result += to_string(a[i]) + (((mask >> i) & 1) ? "+" : "-");
            }
            result += to_string(a[3]);
            reverse(result.begin(), result.end());
            cout << result << "=7" << endl;
            return 0;
        }
    }

    
    return 0;
}

Measured memory_bytes: 3688
N = int(input())
from collections import defaultdict

G = defaultdict(list)
EdaNum = defaultdict(int)

for i in range(N-1):
    a,b = map(int,input().split())
    G[a].append(b)
    G[b].append(a)
    EdaNum[(a,b)] = i
    
ans = [-1]*(N-1)

que = [[1,-1,-1]]
K = 0
visited = [False]*(N+1)

for i in range(1,N+1):
    K = max(K,len(G[i]))

while que != []:
    #print(que)
    now,parent,parentcolor = que.pop()
    visited[now]=True
    nowcolor = 1
    for i in G[now]:
        #print(i,parent)
        if i != parent:
            if nowcolor == parentcolor:
                nowcolor += 1
            ans[EdaNum[(min(now,i),max(now,i))]] = nowcolor
            nowcolor += 1
            if len(G[i])!=1:
                que.append([i,now, nowcolor-1])
    #print(que)

print(K)
for i in ans:
    print(i)

Measured memory_bytes: 93016
#include <stdio.h>

void swap_s(int *a, int *b){
  int temp = *a;
  *a = *b;
  *b = temp;
}

void sort_s(int *s, int n){
  int i, j;
  
  for(i = 0; i < n - 1; i++){
    for(j = n - 1; j > i; j--){
      if(s[j - 1] > s[j])
        swap_s(&s[j - 1], &s[j]);
    }
  }
}

int main(){
  int n;
  int i;
  int a[128];
  int k = 1;
  
  scanf("%d", &n);
  
  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }
  
  sort_s(a, n);
  
  for(i = n - 1; i > 0; i--){
    if(a[i - 1] < a[i])
      k++;
  }
  
  printf("%d\n", k);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6,inf=1e9;
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  int n,cnt=0;cin>>n;string s;cin>>s;
  for(int i=2;i<n;i++)
    if(s[i-2]=='A'&&s[i-1]=='B'&&s[i]=='C')cnt++;
  cout<<cnt<<endl;
  
  return 0;
}

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


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<string> v(n);
    FOR(i,0,n){
      string s;
      cin>>s;
      sortAl(s);
      v[i] = s;
    }
    sortAl(v);

    vector<ll> com(n+1,0);
    FOR(i,2,n+1){
      com[i] += com[i-1] + i-1;
    }

    ll tmp = 0;
    ll ans = 0;
    string s = "";
    FOR(i,0,n){
      if(s != v[i]){
        s = v[i];
        ans += com[tmp];
        tmp = 1;
      }
      else tmp++;
    }
    ans += com[tmp];
    cout<<ans<<endl;
}


Measured memory_bytes: 6528
s = input()
acgt = "ACGT"

count = 0
max_count = 0
for i in s:
    if i in acgt:
        count += 1
    else:
        if count > max_count:
            max_count = count
        count = 0
else:
    if count > max_count:
        max_count = count
        
print(max_count)

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

int main() {
    
    ll n, k; cin >> n >> k;
    const ll p = 200001;
    vector<ll> num(p, 0);
    for (int i = 0; i < n; i++) {
        ll a; cin >> a;
        num[a]++;
    }
    sort(num.rbegin(), num.rend());
    ll ans = 0;
    for (int i = k; i < p; i++) {
        ans += num[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4852
N = int(input())
S = [input() for _ in range(N)]
dic = {}
for s in S:
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1

max = max(dic.values())
for key, value in sorted(dic.items()):
    if value == max:
        print(key)


Measured memory_bytes: 45708
def gcd(a, b):
    if b > a:
        a, b = b, a
    c = a % b
    if (c == 0):
        return b
    return gcd(b, c)


N, X = list(map(int, input().split()))
xlist = list(map(int, input().split()))
xlist.append(X)
xlist.sort()

m = xlist[1] - xlist[0]
for i in range(1, len(xlist) - 1):
    d = xlist[i + 1] - xlist[i]
    m = gcd(d, m)
print(m)


Measured memory_bytes: 14224
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int area = a * b;
        int length = 2 * a + 2 * b;
        System.out.println(area + " " + length);
        sc.close();
    }
}


Measured memory_bytes: 26240
#include <bits/stdc++.h>
#define NMAX 2000006
#define pll pair<ll,ll>
#define MOD 1073741824

using namespace std;
typedef long long ll;
int a[105][105],ok;
int main()
{
    int n;
    cin>>n;
    if(n==2)
    {
        cout<<-1<<'\n';
        return 0;
    }
    if(n%2==0)
    {
        n--;
        ok=1;
    }
    for(int i=1;i<=n;++i)
    {
        for(int j=0;j<n-1;++j)
        {
            int ans=(i+j)%n+1;
            a[i][j+1]=ans;
        }
    }
    if(ok)
    {
        for(int i=1;i<=n;++i)
        {
            a[i][n]=n+1;
            a[n+1][i]=i;
        }
        a[n][1]=n+1;
        a[n][n]=1;
        n++;
    }
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<n;++j)
        {
            cout<<a[i][j]<<' ';
        }
        cout<<'\n';
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int height,width;
	while(1){
		int i,j;
		scanf("%d %d",&height,&width);
		if(!height&&!width) break;

		for(i=0;i<height;i++){
			for(j=0;j<width;j++){
				if(i==0||i==height-1||j==0||j==width-1) printf("#");
				else printf(".");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
int n, k;
vvi v, s;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> k;
  int kk = k*2;
  v.resize(kk);
  each(itr, v) (*itr).resize(k*2);
  s.resize(kk);
  each(itr, s) (*itr).resize(k*2);
  int p = 0;
  FOR(i, 0, n){
    int x, y;
    char c;
    cin >> x >> y >> c;
    x %= kk;
    y %= kk;
    if(c == 'W') y = (y+k)%kk;
    v[x][y]++;
    if((x/k+y/k)%2 == 0) p++;
  }
  FOR(j, 0, kk){
    ll l = 0;
    FOR(i, 0, k) l += v[i][j];
    FOR(i, 0, kk){
      s[i][j] = l;
      l += v[(i+k)%kk][j] - v[i][j];
    }
  }
  int ans = 0;
  FOR(i, 0, k){
    FOR(j, 0, k){
      maxs(ans, max(n-p, p));
      p += s[i][(j+k)%kk] + s[(i+k)%kk][j] - s[i][j] - s[(i+k)%kk][(j+k)%kk];
    }
    p = n-p;
    FOR(j, 0, k) p += v[i][(j+k)%kk] + v[(i+k)%kk][j] - v[i][j] - v[(i+k)%kk][(j+k)%kk];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 31616
import java.io.*;
public class Main{
public static void main(String[] args)throws IOException{
BufferedReader mBufferedReader=new BufferedReader(new InputStreamReader(System.in));
String str=mBufferedReader.readLine();
int h,m,s;
int x=Integer.parseInt(str);
h=x/3600;
x%=3600;
m=x/60;
x%=60;
s=x;
System.out.println(h+":"+m+":"+s);
}
}


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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var << endl;
#else
#define debug(var)
#endif

const int N = 1e5+123;
const int mod = 1e9+7;

int fact[N];

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	fact[0] = 1;
	for (int i = 1; i < N; ++i) {
		fact[i] = ((long long)fact[i-1]*i)%mod;
	}
}

void solve() {
	int n, m; scanf("%d%d", &n, &m);
	if (n < m) swap(n, m);
	if (n-m >= 2) {
		printf("0");
		return;
	}
	if (n-m == 1) {
		printf("%lld", (long long)fact[n]*fact[m]%mod);
	} else {
		printf("%lld", (long long)fact[n]*fact[m]*2%mod);
	}
}

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


Measured memory_bytes: 640
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <list>
#include <cstdlib>
using namespace std;
#define forr(i,m,n) for (int i=(m); i<=(n); i++)
#define forall(it,p) for (auto it = p.begin(); it != p.end(); ++it)
#define DBG 1

#define R 1000000007
#define MAXN 1001
char a[MAXN][MAXN];
long b[MAXN][MAXN];

int main() {
  int h,w;
  string s;
  cin >> h >> w;
  forr(i,0,h-1) {
    cin >> s;
    forr(j,0,w-1)
      a[i][j] = (s[j] == '#' ? 1 : 0);
  }

  forr(i,0,h-1) {
    if (a[i][0]) break;
    b[i][0] = 1;
  }
  forr(j,0,w-1) {
    if (a[0][j]) break;
    b[0][j] = 1;
  }
  forr(i,1,h-1)
    forr(j,0,w-1) {
      if (a[i][j]) continue;
      b[i][j] = (b[i-1][j] + b[i][j-1]) % R;
    }
  cout << b[h-1][w-1];
}


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

int main(){
  ll l,r;
  cin >> l >> r;
  if(r-l>673){
    cout << 0 << endl;
  }else{
    ll minmod=2018,i,j;
    for(i=l;i<r;i++){
      for(j=i+1;j<=r;j++){
        minmod=min(minmod,(i*j)%2019);
      }
    }
    cout << minmod << endl;
  }
}

Measured memory_bytes: 3636
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;

int ref(int a, int b) {
	if (a > b)swap(a, b);

	int ans = b / a;
	if (b%a == 0) {
		return (ans * 2 - 1)*a;
	}
	else {
		return ans * 2 * a + ref(b%a, a);
	}
}

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

	int N, X;
	cin >> N >> X;

	cout << N + ref(X, N - X) << endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <iomanip>
using namespace std;
const int N = 2000010;
double dices[N];
int n, k;

double ex(double num){
    return (num + 1)/2;
}
int main(){
    cin >> n >> k;
    for(int i = 0; i < n; i ++){
        double num;
        cin >> num;
        dices[i] = ex(num);
    }
    double sum = 0;
    for(int i = 0; i < k; i ++){
        sum += dices[i];
    }
    double res = sum;
    for(int i = k; i < n; i ++){
        sum += dices[i];
        sum -= dices[i-k];
        res = max(res, sum);
    }
    cout << std::fixed;
	cout << std::setprecision(10) << res << endl;
    return 0;
}


Measured memory_bytes: 1792
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int K = sc.nextInt();
		int R = sc.nextInt();
		int S = sc.nextInt();
		int P = sc.nextInt();
		String T = sc.next();
		int[] cc = new int[N+1];
		char[] ch = new char[N+1];
		for( int i=1; i<=N; i++ ){
			ch[i] = T.charAt(i-1);
		}
		int ans = 0;
		for( int i=1; i<=K; i++ ){
			if( ch[i]=='r' ){
				cc[i] = P;
			}
			if( ch[i]=='s' ){
				cc[i] = R;
			}
			if( ch[i]=='p' ){
				cc[i] = S;
			}
		}
		for( int i=K+1; i<=N; i++ ){
			if( ch[i]=='r' ){
				cc[i] = P;
				if( ch[i-K]=='r' ){
					cc[i] = 0;
					ch[i] = 'a';
				}
			}
			if( ch[i]=='s' ){
				cc[i] = R;
				if( ch[i-K]=='s' ){
					cc[i] = 0;
					ch[i] = 'a';
				}
			}
			if( ch[i]=='p' ){
				cc[i] = S;
				if( ch[i-K]=='p' ){
					cc[i] = 0;
					ch[i] = 'a';
				}
			}			
		}
		for( int i=1; i<=N; i++ ){
			ans += cc[i];
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 28368
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
const int maxn=2010;
int n,m,ans;
char s[maxn][maxn];
int shang[maxn][maxn];
int xia[maxn][maxn];
int zuo[maxn][maxn];
int you[maxn][maxn];
int main() {
	//freopen("1.txt","r",stdin);
	read(n); read(m);
	for (int i=1;i<=n;i++)
		scanf("%s",s[i]+1);
	for (int i=1;i<=n;i++) {
		for (int j=1;j<=m;j++)
			if (s[i][j]=='#') zuo[i][j]=0;
			else zuo[i][j]=zuo[i][j-1]+1;
		for (int j=m;j>=1;j--)
			if (s[i][j]=='#') you[i][j]=0;
			else you[i][j]=you[i][j+1]+1;
	}
	for (int j=1;j<=m;j++) {
		for (int i=1;i<=n;i++)
			if (s[i][j]=='#') shang[i][j]=0;
			else shang[i][j]=shang[i-1][j]+1;
		for (int i=n;i>=1;i--)
			if (s[i][j]=='#') xia[i][j]=0;
			else xia[i][j]=xia[i+1][j]+1;
	}
	for (int i=1;i<=n;i++)
	for (int j=1;j<=m;j++)
		if (s[i][j]=='.')
			ans=max(ans,zuo[i][j]+shang[i][j]+xia[i][j]+you[i][j]-3);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 67328
#include <iostream>
long long batas=99999999999999999;
using namespace std;
int main(){
  long long a,b;
  bool lanjut=true;
  	cin >> a >> b;
  
  if((b-a)>=2019){
    cout << 0 <<  endl;
    lanjut=false;
  }
  else{
     for(long long i=a;i<=b;i++){
      	 for(long long j=i+1;j<=b;j++){
            long long test=(i*j)%2019;
          	if(test==0){
				cout << 0 << endl;
              	lanjut=false;
              	break;
            }
           	else if(test<batas){
                	batas=test;
            }
         }
         if(!lanjut){
         	break;
		 }
     }
  }
  if(lanjut){
   cout << batas << endl; 
  }
}

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

using namespace std;

int N, h[100000], dp[100000];

int main(){
	// 入力
	cin >> N;
	for(int i = 0; i < N; ++i) cin >> h[i];
	
	// 基底の初期化
	dp[0] = 0; dp[1] = abs(h[0]-h[1]);
	
	// 順に解く
	for(int i = 2; i < N; ++i) dp[i] = min(dp[i-2]+abs(h[i-2]-h[i]), dp[i-1]+abs(h[i-1]-h[i]));
	
	// 解を出力
	cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main(void) {
  int n;
  char s[300000];
  cin >> n >> s;

  int wcount[300000] = { 0 };
  for (int i = 1; i < n; i++) {
    if (i == 0) {
      continue;
    } else if (i == 1 and s[i - 1] == 'W') {
      wcount[i] = 1;
    } else if (i > 1 and s[i - 1] == 'W') {
      wcount[i] = 1 + wcount[i - 1];
    } else {
      wcount[i] = wcount[i - 1];
    }
  }

  int ecount[300000] = { 0 };
  for (int i = n - 1; i >= 0; i--) {
    if (i == n - 1) {
      continue;
    } else if (i == n - 2 and s[i + 1] == 'E') {
      ecount[i] = 1;
    } else if (i < n - 2 and s[i + 1] == 'E') {
      ecount[i] = 1 + ecount[i + 1];
    } else {
      ecount[i] = ecount[i + 1];
    }
  }

  int res[300000] = { 0 };
  for (int i = 0; i < n; i++) {
    res[i] = wcount[i] + ecount[i];
  }
  sort(res, res + n);
  cout << res[0] << endl;
  return EXIT_SUCCESS;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b;
    cin >> a >> b ;
    if(a>=10){
        b=b;
        cout << b << endl;
    }
    else if(a<10){
        b=1000-100*a+b;
        cout << b << endl;
    }
}

Measured memory_bytes: 256
import java.io.PrintWriter
import java.math.BigDecimal
import java.util.*

val pw = PrintWriter(System.out)
val sc = Scanner(System.`in`)

fun main(args: Array<String>) {
    val (a, b) = nextListOfInt()
    if(a%2 == 0 || b%2 == 0){
        println("No")
    }else{
        println("Yes")
    }
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextListOfString() = next().split(" ")
fun nextListOfInt() = nextListOfString().map { it.toInt() }
fun nextListOfLong() = nextListOfString().map { it.toLong() }
fun nextListOfDouble() = nextListOfString().map { it.toDouble() }



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

int solve(int a, int b, int c) {
    int rem[60];
    fill(rem, rem + 60, -1);
    int t = 0;
    while (rem[t%60] < 0) {
        if (t % 60 <= c && c <= t % 60 + a) {
            return t + (c - t % 60);
        } else {
            rem[t%60] = t;
            t += a + b;
        }
    }
    return -1;
}

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << solve(a, b, c) << endl;
    return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>
int main(void)
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if (a==1&&b==0&&c==0)
	{
		printf("Close\n");
	}
	else if (a==0&&b==1&&c==0)
	{
		printf("Close\n");
	}
	else if (a==a&&b==1&&c==0)
	{
		printf("Open\n");
	}
	else if (a==0&&b==0&&c==1)
	{
		printf("Open\n");
	}
	else if (a==0&&b==0&&c==0)
	{
		printf("Close\n");
	}
	return 0;
}

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

struct Card{char suit; int value;};
void bubble(struct Card a[],int n);
void selection(struct Card a[],int n);
void out(struct  Card a[],int n);
int checker(struct Card a[],struct Card b[],int n);

int main(){
    int i,n;
    Card c1[100+1],c2[100+1];
    cin>>n;
    for(i=0;i<n;i++){
        cin>>c1[i].suit>>c1[i].value;
        //cout<<c1[i].suit<<":"<<c1[i].value<<endl;
    }
    
    for(i=0;i<n;i++)c2[i]=c1[i];//c1???c2????????????
    bubble(c1,n);out(c1,n);
    cout<<"Stable"<<endl;
    selection(c2,n);out(c2,n);
    if(checker(c1,c2,n)==1)cout<<"Stable"<<endl;
    else cout<<"Not stable"<<endl;
    
    
}

int checker(struct Card a[],struct Card b[],int n){
    int i,flag=0;
    for(i=0;i<n;i++){
        if(a[i].value==b[i].value&&a[i].suit!=b[i].suit)return 0;
        else if(a[i].value==b[i].value&&a[i].suit==b[i].suit)flag=1;
        
    }
    if (flag)return 1;
    return 0;
}

void bubble(struct Card a[],int n){
    int i,flag=1,j=0;
    while(flag){
        flag=0;
        for(i=n-1;i>j;i--){
            if(a[i].value<a[i-1].value)swap(a[i],a[i-1]),flag=1;
        }
        j++;
    }
}

void selection(struct Card a[],int n){
    int i,j,min,flag;
    for(i=0;i<n;i++){
        min=i;flag=0;
        for(j=i;j<n;j++){
            if(a[j].value<a[min].value){
                min=j;
                flag=1;
            }
        }
        if(flag)swap(a[i],a[min]);
    }
}

void out(struct Card a[],int n){
    int i;
    for(i=0;i<n;i++)i==n-1?cout<<a[i].suit<<a[i].value<<endl:cout<<a[i].suit<<a[i].value<<" ";
}

Measured memory_bytes: 3100
#include <iostream>
using namespace std;
int main(){
	int P,Q,R;
	cin >> P >> Q >> R;
	int min=P+Q;
	if(P+Q > Q+R){
		min=Q+R;
		if(min >R+P) min=R+P;
	}
	if(P+Q > R+P){
		min=R+P;
		if(min >Q+R) min=Q+R;
	}
	cout << min <<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();
		int[][] f = new int[n][10];
		int[][] p = new int[n][11];
		for(int i  = 0 ; i < n ; i++) {
			for(int j = 0 ; j < 10 ; j++) {
				f[i][j] = sc.nextInt();
			}
		}
		for(int i  = 0 ; i < n ; i++) {
			for(int j = 0 ; j < 11 ; j++) {
				p[i][j] = sc.nextInt();
			}
		}
		int ans = -1001001001;
		// 0000000000~1111111111パターン生成
		for(int mask = 1 ; mask < (1<<10) ; mask++) {
			int score = 0;
			for(int i = 0 ; i < n ; i++) {
				int cnt = 0;
				for(int j = 0 ; j < 10 ; j++) {
					if(((mask>>j)&1) == 1 && f[i][j] == 1) {
						cnt++;
					}
				}
				score += p[i][cnt];
			}
			ans = Math.max(ans, score);
		}
		System.out.println(ans);
	}
}

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

int main(){
  string s, t;
  cin >> s >> t;
  int rpta = 0;
  for(int i = 0; i<s.size(); i++){
    if(s[i] == t[i])
      continue;
    rpta++;
  }
  cout << rpta<< endl;

}


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

int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++)
    cin >> A[i];
  sort(A, A + N);
  int answer = abs(A[0] - A[N - 1]);
  cout << answer << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;



int main(){
    string s, t;
    cin >> s >> t;
    t.pop_back();
    if(s == t){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;

   

}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
        string st;
        cin>>st;
        if(st[st.size()-1]=='2'|| st[st.size()-1]=='4' || st[st.size()-1]=='5' || st[st.size()-1]=='7' || st[st.size()-1]=='9')cout<<"hon"<<endl;
        if(st[st.size()-1]=='0'|| st[st.size()-1]=='1' || st[st.size()-1]=='6' || st[st.size()-1]=='8')cout<<"pon"<<endl;
        if(st[st.size()-1]=='3')cout<<"bon"<<endl;
}


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

int main() {
  int n;cin>>n;
  if(n>=30)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
	int N = 0, ans = 0;
	std::cin >> N;
	
	std::vector<int>P(N), Q(N), array(N);
	for (int i = 0; i < N; i++){
		array[i] = i + 1;
	}
	
	for (int i = 0; i < N; i++){
		std::cin >> P[i];
	}
	for (int i = 0; i < N; i++){
		std::cin >> Q[i];
	}

	int i = 0, a = 0, b  = 0;
	do{
		if (array == P) a = i;
		if (array == Q) b = i;
      	i++;
	} while (std::next_permutation(array.begin(), array.end()));
	
	ans = (a >= b) ? a - b : b - a;

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        long a=Long.parseLong(st.nextToken());
        long b=Long.parseLong(st.nextToken());
        long x=Long.parseLong(st.nextToken());
        if(a%x==0){
            System.out.println((b/x-a/x)+1);
        }else{
            System.out.println(b/x-a/x);
        }
        
    }
}

Measured memory_bytes: 8276
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int dp[1002];
int W,w[1001],v[1001],n,cnt = 1,wm;
int main(){
  while(1){
    memset(dp, 0, sizeof(dp));
    cin >> W;
    if(W == 0) break;
    cin >> n;
    for(int i = 0; i < n; i++){
      scanf("%d,%d",&v[i],&w[i]);
    }
    for(int i = 0; i < n; i++){
      //dp[w[i]] = v[i];
      for(int j = W; j >= 0; j--){
	if(j + w[i] <= W) dp[j + w[i]] = max(dp[j + w[i]],dp[j] + v[i]);
      }
    }
    wm = 0;
    for(int i = 0; i <= W; i++){
      if(dp[i] > dp[wm]) wm = i;
    }
    cout << "Case " << cnt <<  ":" << endl;
    cout << dp[wm] << endl;
    cout << wm << endl;
    cnt++;
  }
}

Measured memory_bytes: 1256
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

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

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (int)(n); (i)++)
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; (i)--)
#define For(i, a, b)    for(int i = (a); (i) < (int)(b) ; (i)++)
#define CtoI(c)         int((c)) - int('0')

//functions=============
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };



/*--------additional--------*/

bool judge(vector<vector<int>> &_G,vector<ll> &_h, int p){

    for(auto x : _G[p]){
        if(_h[p] <= _h[x]) return false;
    }

    return true;
}

/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n, m; cin >> n >> m;
    vector<ll> h(n);
    rep(i, n) cin >> h[i];
    vector<vector<int>> G(n);
    rep(i, m){
        int a, b; cin >> a >> b; a--, b--;
        G[a].pb(b);
        G[b].pb(a);
    }

    ll ans = 0;
    rep(i, n){
        if(judge(G, h, i)) ans++;
    }

    cout << ans << endl;

return 0;
}

Measured memory_bytes: 9224
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] a = new int[n];
		int sum = 0;
		for(int i=0;i<n;i++){
			a[i] = scanner.nextInt();
			sum += a[i];
		}
		double ave = Math.round((double)sum/n);
		int cost = 0;
		for(int i=0;i<n;i++){
			cost += Math.pow(a[i]-ave, 2);
		}
		System.out.println(cost);
	}

}


Measured memory_bytes: 22996
#include<stdio.h>
int main(){
	char moji;
	int i,n,j,k;
	int S[100]={0},H[100]={0},C[100]={0},D[100]={0};
	scanf("%d",&n);
	for(i=1;i<=n;i++){
	    scanf("%c %d",&moji,&j);
		if(moji=='\n'){
		scanf("%c %d",&moji,&j);
		}
		if(moji=='S'){
			S[j]=1;
		}
		if(moji=='H'){
			H[j]=1;
		}
		if(moji=='C'){
			C[j]=1;
		}
		if(moji=='D'){
			D[j]=1;
		}
	}
	for(i=0;i<4;i++){
		for(k=1;k<=13;k++){
			if(i==0&&S[k]==0){
				printf("S %d\n",k);
			}
			if(i==1&&H[k]==0){
				printf("H %d\n",k);
			}
			if(i==2&&C[k]==0){
				printf("C %d\n",k);
			}
			if(i==3&&D[k]==0){
				printf("D %d\n",k);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 596
while True:
    
    n, x = map(int, input().split())

    if n == 0 and x == 0:
        break
    
    ans = 0
    for a in range(1, n+1):
        for b in range(1, n+1):
            if b <= a:
                continue
            c = x - a - b
            if c > b and c <= n:
                ans += 1
    
    print(ans)


Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,flag=0;
  	char s;
  	cin>>n;
  	for(int i=0;i<n;i++){
	cin>>s;
      if(s=='Y'){
		flag=1;
        break;
      }
    }
  
  	if(flag==0){
		cout<<"Three"<<endl;
    }else{
      	cout<<"Four"<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll L,R;
  cin>>L>>R;
  vector<int>v(2019);
  for(ll i=L;i<=min(L+2019+2018,R);i++){
    v[i%2019]++;
  }
  int ans=INF;
  for(int i=0;i<2019;i++){
    for(int j=0;j<2019;j++){
      if(i==j){
        if(v[i]>=2){
          ans=min(ans,i*j%2019);
        }
      }else{
        if(v[j]>0&&v[i]>0){
          ans=min(ans,i*j%2019);
        }
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[1].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var k = parseInt(input[0], 10);
	var a = parseInt(tmp[0], 10);
	var b = parseInt(tmp[1], 10);

  var ans = 'NG';
  if(b-a >= k) ans = 'OK';
  else{
    var v1 = a/k;
    var v2 = b/k;

    var v1int = parseInt(v1, 10);
    var v2int = parseInt(v2, 10);
    if(v1int != v2int) ans = 'OK';
    if(v1%1 == 0 || v2%1 == 0) ans = 'OK';
  }

	//出力
	console.log('%s', ans);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));





Measured memory_bytes: 29624
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,M=MI()
    S=list(input())
    S2=S[::-1]
    
    now=0
    ans=[]
    while now!=N:
        nxt=now+M
        if nxt>N:
            nxt=N
        while S2[nxt]=="1":
            nxt-=1
        if now==nxt:
            ans=[-1]
            break
        ans.append(nxt-now)
        now=nxt
        
    print(' '.join(map(str, ans[::-1])))
    
main()


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

int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    int ans;
    if(a==b && a==c) ans = 1;
    else if(a!=b && b!=c && c!=a) ans = 3;
    else ans = 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
K = gets.to_i
A,B=gets.chomp.split(" ").map(&:to_i);
c= 0
cc = 1
while true
  c = cc* K
  if c<A
    cc+=1
  elsif c>=A && c<=B
    puts("OK");
    break
  else c>B
    puts("NG")
    break
  end
end

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

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<ll> vll;
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;
typedef unsigned long long ull;

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

string const NO = "No";
string const YES = "Yes";

void print(string s) {
	printf("%s\n", s.c_str());
}

ll a, b, c, d;

ll gcd(ll a, ll b) {	
	return (a ? gcd(b % a, a) : b);
}

void solve() {
	if (b > a) { 
		print(NO);
		return;
	}
	if (b > d) {
		print(NO);
		return;
	}
	ll g = gcd(b, d);
	ll q = (c - b + 1 - a) / g;
	a += q * g;
	if (a < 0) {
		print(NO);
		return;		
	}
	print(YES);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

  int t;
  scanf("%d", &t);
  while (t--) {
  	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
		solve();		
	}

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 256
#import"cstdio"
long n,m;
void d(long a,int f){if(a<=n)m+=f==7,a*=10,d(a+3,f|1),d(a+5,f|2),d(a+7,f|4);}
main(){scanf("%ld",&n);d(0,0); printf("%ld\n",m);}

Measured memory_bytes: 128
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
c=0
cc=1
a.sort()
for i in range(n-1):
  if a[i]!=a[i+1]:
    if cc%2==0:
      c=c
    else:
      c=c+1
    cc=1
  else:
    cc=cc+1
if cc%2!=0:
  c=c+1
print(c)

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

int main() {
	long long n, a[100005], tmp=0, c_num=1, c_tyou=0, ans;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	sort(a, a+n);
	tmp = a[0];
	for(int i=1;i<n;i++){
		if(tmp < a[i]){
			c_num++;
			tmp = a[i];
		}else if(tmp == a[i]){
			c_tyou++;
		}
	}
	if(c_tyou % 2 == 0){
		ans = c_num;
	}else{
		ans = c_num - 1;
	}
	cout << ans << endl;
	

	return 0;
}

Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder(sc.next());
		ArrayList<Integer> RAry = new ArrayList<>();
		ArrayList<Integer> LAry = new ArrayList<>();
		int n = sb.length();
		while(sb.length() != 0){
			int r = sb.indexOf("L");
			RAry.add(r);
			sb.delete(0, r);
			int l = sb.indexOf("R");
			if(l == -1){
				l = sb.length();
			}
			LAry.add(l);
			sb.delete(0, l);
		}
		int[] ans = new int[n];
		int index = 0;
		for(int i = 0; i < RAry.size(); i++){
			int r = RAry.get(i);
			int l = LAry.get(i);
			int sum = r + l;
			if(sum % 2 == 0){
				ans[index + r - 1] += sum /2;
				ans[index + r] += sum /2;
			}
			else{
				if(r % 2 == 0){
					ans[index + r - 1] += sum / 2;
					ans[index + r] += sum / 2 + 1;
					
				}
				else{
					ans[index + r - 1] += sum / 2 + 1;
					ans[index + r] += sum / 2;
				}
			}
			index += sum;
		}
		for(int num : ans){
			System.out.println(num);
		}
	}
}


Measured memory_bytes: 45604
r,c=map(int,input().split())

a=[]
for i in range(r):
    a.append(list(map(int,input().split())))
for i in range(r):
    print(*a[i],sum(a[i]))
y=0
for i in range(c):
    x=0
    for j in range(r):
        x+=a[j][i]
    y+=x
    print(x,end=' ')
print(y)


Measured memory_bytes: 6220
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	ll N, K, S;
	cin >> N >> K >> S;

	for (auto i = 0; i < N; ++i)
	{
		if (i < K)
		{
			cout << S;
		}
		else if (S == (ll)1e9)
		{
			cout << 1;
		}
		else
		{
			cout << (ll)1e9;
		}
		if (i < N - 1)
		{
			cout << " ";
		}
	}

	cout << endl;

	return 0;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    int a, b;
    cin >> a >> b;
    if (a == b) {
        cout << "Draw\n";
        return 0;
    }
    if (a == 1) {
        cout << "Alice\n";
        return 0;
    }
    if (b == 1) {
        cout << "Bob\n";
        return 0;
    }
    if (a > b) {
        cout << "Alice\n";
        return 0;
    }
    cout << "Bob\n";
    return 0;
}


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

using namespace std;

constexpr int MAXV=55,MAXE=105,MAXCOIN=2501;
int n,m,s;
int head[MAXV];
int C[MAXV],D[MAXV];
unsigned long long ans[MAXV][MAXCOIN];
bool use[MAXV][MAXCOIN];

struct Edge{int to,next,a,b;}edge[MAXE*2];
struct Node{
	int id;
	unsigned long long coin,time;
	friend bool operator >(Node lhs,Node rhs){
		return lhs.time>rhs.time;
	}
};

void add_edge(int u,int v,int a,int b){
	static int ecnt;
	auto add=[](int from,int to,int a,int b)->void{
		edge[++ecnt]=Edge{to,head[from],a,b};
		head[from]=ecnt;
	};
	add(u,v,a,b),add(v,u,a,b);
}

void A_star(){
	for(int i=1;i<=n;++i)
		fill_n(ans[i],MAXCOIN,numeric_limits<unsigned long long>::max());
	priority_queue<Node,vector<Node>,greater<Node>> pq;
	ans[1][s]=0;
	pq.push({1,s,0});
	while(!pq.empty()){
		auto [u,coin,time]=pq.top();
		pq.pop();
		if(use[u][coin]) continue;
		use[u][coin]=true;
		for(int i=head[u];i;i=edge[i].next){
			int v=edge[i].to;
			if(coin>=edge[i].a){
				unsigned long long j=coin-edge[i].a;
				if(unsigned long long k=time+edge[i].b;k<ans[v][j]){
					ans[v][j]=k;
					pq.push({v,j,k});
				}
			}
		}
		if(unsigned long long j=coin+C[u];j<MAXCOIN){
			if(unsigned long long k=time+D[u];k<ans[u][j]){
				ans[u][j]=k;
				pq.push({u,j,k});
			}
		}
	}
}

int main(){
	scanf("%d%d%d",&n,&m,&s);
	s=min(s,MAXCOIN-1);
	for(int i=1;i<=m;++i){
		int u,v,a,b;
		scanf("%d%d%d%d",&u,&v,&a,&b);
		add_edge(u,v,a,b);
	}
	for(int i=1;i<=n;++i)
		scanf("%d%d",&C[i],&D[i]);
	A_star();
	for(int i=2;i<=n;++i){
		unsigned long long mn=numeric_limits<unsigned long long>::max();
		for(auto tm:ans[i])
			mn=min(mn,tm);
		printf("%llu\n",mn);
	}
}

Measured memory_bytes: 7496
#include <stdio.h>

#include <vector>
#include <iterator>
#include <algorithm>
#include <iostream>
#include <map>
#include <string>



#ifdef _WIN32   //socket
#include <winsock2.h>
#include <ws2tcpip.h>
#endif  //win32

int main() {

    int N;
    std::cin >> N;

    std::map<std::string, int> S;

    int max_val = 0;
    for (int i = 0; i < N; i++) {
        std::string neko;
        std::cin >> neko;
        S[neko]++;
    }

    for (auto e : S) {
        if (e.second > max_val) {
            max_val = e.second;
        }
    }

    for (auto e : S) {
        if (e.second == max_val) {
            std::cout << e.first << std::endl;
        }
    }
}

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

const int inf = 1e9+7;
int a[1007];
int n;
long long ans;

int main(){
	
	cin >> n;
	for(int i = 2;i<=n;i++){
		int x = i;
		for(int j = 2;j<=sqrt(n);j++){
			while(x%j==0){
				a[j]++;
				x/=j;
			}
		}
		if(x>1) a[x]++;
	}
	ans = 1;
	for(int i = 2;i<=n;i++){
		if(a[i]){
			ans*=(a[i]+1)%inf;
			ans%=inf;
		}
	}
	cout << ans;
} 

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

#define PB          push_back
#define PF          push_front
#define MP          make_pair
#define FI          first
#define SE          second
#define SIZE( A )   int( ( A ).size( ) )
#define ALL( A )    ( A ).begin( ), ( A ).end( )
#define ALLR( A )   ( A ).rbegin( ), ( A ).rend( )

using namespace std;

typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         lf;
typedef pair< int, int >    pii;
typedef pair< ll, ll >      pll;
typedef vector< bool >      vb;
typedef vector< lf >        vd;
typedef vector< ll >        vll;
typedef vector< int >       vi;
typedef vector< pii >       vpii;

const int MAXN = int( 2e5 );
const int MOD  = int( 360 );
const int oo   = INT_MAX;

int n;
int arr[ MAXN ];

int main( ) {

  #ifdef LOCAL
    freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
  #else
    //freopen( "attack.in", "r", stdin );
    //freopen( "attack.out", "w", stdout );
    ios_base::sync_with_stdio( 0 );
    cin.tie( 0 );
  #endif

  while( cin >> n ) {
    for( int i = 0; i < n; ++i ) {
      cin >> arr[ i ];
    }
    int ans = 0;
    for( int i = 0; i < n; ++i ) {
      ++ans;
      if( i+1 == n ) {
        break;
      }
      int j = i+1;
      int tp = ( arr[ i ] < arr[ j ] ? -1 : ( arr[ i ] > arr[ j ] ? 1 : 0 ) );
      while( j+1 < n ) {
        int tp2 = ( arr[ j ] < arr[ j+1 ] ? -1 : ( arr[ j ] > arr[ j+1 ] ? 1 : 0 ) );
        if( tp2 == 0 || tp == 0 || tp == tp2 ) {
          ++j;
          tp = ( tp2 != 0 ? tp2 : tp );
        } else {
          break;
        }
      }
      i = j;
    }
    cout << ans << '\n';
  }

  return 0;
}


Measured memory_bytes: 640
n, m = map(int, input().split())
yu, ic, hi = -1, -1, -1
for x in range(n+1):
	for y in range(n-x+1):
		z = n - x - y
		if 10000*x + 5000*y + 1000*z == m:
			yu, ic, hi = x, y, z
			break
print(yu, ic, hi)

Measured memory_bytes: 3060
#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 INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  string s;
  cin >> s;
  ll k;
  cin >> k;
  vector<string> v;
  REP(i, s.size()) {
    FOR(j, 1, k + 1) {
      string t = s.substr(i, j);
      v.push_back(t);
    }
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  cout << v[k - 1] << endl;
  return 0;
}



Measured memory_bytes: 1660
n, k = map(int, input().split())
p = list(map(int, input().split()))
m = 0
ans = 0
for i in range(k):
    m += p[i]
    m1 = m
    start = 0
for i in range(n - k):
    m1 += (p[i + k] - p[i])
    if m < m1:
        m = m1
        start = i + 1
for i in range(start, start + k):
    ans += (p[i] + 1) / 2
print(ans)


Measured memory_bytes: 24804
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<list>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,x) unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;


struct edge
{
	long long to; long long len;
	bool operator<(const edge& rhs) const {
		return len > rhs.len;
	}
};

ll const MAX = 1e5 + 5;
ll h[MAX];
ll dp[MAX];

int main() {
	cin.tie(0);
	ll n, k;
	cin >> n >> k;
	REP(i, 1, n) {
		cin >> h[i];
	}
	dp[1] = 0;
	REP(i, 2, n) {
		if (i - k < 1) {
			ll val = 1e18;
			REP(j, 1, i - 1) {
				val = min(val, dp[j] + abs(h[i] - h[j]));
			}
			dp[i] = val;
		}
		else {
			ll val = 1e18;
			REP(j, i - k, i - 1) {
				val = min(val, dp[j] + abs(h[i] - h[j]));
			}
			dp[i] = val;
		}
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 1792
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Main{


	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int g = Integer.parseInt(scanner.nextLine());
		boolean x = false;

		for(int i = 0; i < 25; i++) {

				for(int j = 0; j < 15; j++) {

					if((i * 4 + j * 7) == g ) {

						x = true;
					}

				}
			}


		if(x)System.out.println("Yes");
		else System.out.println("No");






	}
}


Measured memory_bytes: 35576
/**
 *    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;
    string a,b;
    cin>>a>>b;
    int ans=0;
    rep(i,0,a.size()-1) if(a[i]!=b[i]) ans++;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3888