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

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a, b) for(int i=a;i<b;++i)
#define fj(a, b) for(int j=a;j<b;++j)
#define fk(a, b) for(int k=a;k<b;++k)
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
////////////////////////////////

int const N = 1e5 + 41;
int const MOD = 1e9 + 7;

int q;
string s, t;
int sa[N], sb[N], ta[N], tb[N];

void solve(){
	cin >> s;
	cin >> t;
	fi(0, sz(s)){
		if(s[i] == 'A') ++sa[i+1];
		else ++sb[i+1];
		sa[i+1] += sa[i];
		sb[i+1] += sb[i];
	}
	fi(0, sz(t)){
		if(t[i] == 'A') ++ta[i+1];
		else ++tb[i+1];
		ta[i+1] += ta[i];
		tb[i+1] += tb[i];
	}
	cin >> q;
	fi(0, q){
		int ls, rs, lt, rt;
		cin >> ls >> rs >> lt >> rt;
		int sf = ((sa[rs] - sa[ls-1]) * 2) + ((sb[rs] - sb[ls-1]));
		int tf = ((ta[rt] - ta[lt-1]) * 2) + ((tb[rt] - tb[lt-1]));
		int maxi = max(sf, tf);
		int mini = min(sf, tf);
		if((maxi - mini) % 3 == 0) cout << "YES";
		else cout << "NO";
		cout << endl;
	}
}

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

	solve();



	return 0;
}

Measured memory_bytes: 2432
import math
# 素因数分解
def factorize(n):
    if n == 1:
        return [1]
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def f(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 素数判定
def isPrime(n):
    if n == 1:
        return False
    else:
        for i in range(2, int(math.sqrt(n)) + 1):
           if n%i == 0:
               return False
        return True


n, p = map(int, input().split())

if n == 1 or isPrime(p):
    print(p)
    exit()

# f = factorize(p)
# cnt = [0] * (max(f) + 1)
# # print(f)

# for _f in f:
#     cnt[_f] += 1

# ans = 1
# # print(cnt)

# for i in range(len(cnt)):
#     if cnt[i] >= n:
#         loop = cnt[i]//n
#         for j in range(loop):
#             ans *= i

# print(ans)

f = f(p)
ans = 1

for i in range(len(f)):
    ans *= f[i][0] ** (f[i][1] // n)

print(ans)

Measured memory_bytes: 38512
#include <iostream>
#include <stdio.h>
#include <vector> 
#include <math.h> 
#include <map> 
using namespace std;
int main(void) {
    int N; cin >> N;
    int i = 1, j= 1, z = 1;
    map<int, int> m;
    while (i <= 10000) {
        m[i] = 0;
        i++;
    }
    i = 1;
    while(i <= 100) {
        j = 1;
        while(j <= 100) {
            z = 1;
            while(z <= 100) {
                int tmp =  i*i + j*j + z*z + i*j + j*z + z*i;
                if (m.count(tmp)) m[tmp]++;
                else  m[tmp] = 1;
                z++;
            }
            j++;
        } 
        i++;
    }
    for (auto itr = m.begin(); itr != m.end(); itr++) {
        if (itr-> first <= N) cout << itr->second << endl;
    }
}


Measured memory_bytes: 5464
#include <bits/stdc++.h>
#define ll long long 
#define ld long double
using namespace std;
const ll INF = 1e18;
const ll MOD = 998244353;



int32_t main() {
	ios::sync_with_stdio(!cin.tie(NULL));

	int n;
	cin >> n;

	string s;
	cin >> s;

	char w = 'W', r = 'R';
	priority_queue<int> reds;
	priority_queue<int, vector<int>, greater<int>> whites;

	for(int i = 0; i < n; i++) {
		if(s[i] == w)	whites.push(i);
		else	reds.push(i);
	}
	
	ll cnt = 0;
	int a, b;
	while(!reds.empty() and !whites.empty() and reds.top() > whites.top()) {
		cnt++;

		a = reds.top(), b = whites.top();
		reds.pop(), whites.pop();

		reds.push(b), whites.push(a);
	}

	cout << cnt;
}



Measured memory_bytes: 4816
#include <iostream>

int main(void){
	using namespace std;
	using type = long double;
	
	type a, b;
	cin >> a >> b;
	
	if(a > b)	cout << "GREATER";
	if(a < b)	cout << "LESS";
	if(a == b)	cout << "EQUAL";
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define for_tests(t, tt) int t; scanf("%d", &t); for(int tt = 1; tt <= t; tt++)
#ifndef ONLINE_JUDGE
#define debug(args...) fprintf(stderr,args)
#else
#define debug(args...)
#endif //ONLINE_JUDGE
template<typename T> inline T abs(T t) { return t < 0? -t : t; }
const ll modn = 1000000007;
inline ll mod(ll x) { return x % modn; }
#define IOS() ios::sync_with_stdio(0),cin.tie(0)

const int MAXN = 212345;

int n, m, k;
int s[MAXN];

int main (){
	scanf("%d", &n);
	for(int a=0;a<n;a++){
        printf("ACL");
	}
    puts("");
}



Measured memory_bytes: 3728
#include <iostream>
#include <cstring>

using namespace std;

int main(void){
    int i,j,k,l;
    int n;
    int weight[10]={1,2,4,8,16,32,64,128,256,512};
    int weight_f[10];
    
    while(cin>>n){
    
    memset(weight_f,0,sizeof(weight_f));
    
    for(i=9;i>=0;i--){
        if(n-weight[i]>=0){
            n=n-weight[i];
            weight_f[i]=1;
        }
    }
    i=0;
    while(true){
        if(weight_f[i]==1){
            cout<<weight[i]<<flush;
            break;
        }
        i++;
    }
    for(j=i+1;j<10;j++){
        if(weight_f[j]==1){
            cout<<" "<<weight[j]<<flush;
        }
    }
    cout<<endl;
    }
    return(0);
}

Measured memory_bytes: 1160
s = input()

def check_kaibun(st):
  if st == st[::-1]:
    pass
  else:
    print('No')
    exit()

check_kaibun(s)
check_kaibun(s[:int((len(s)-1)/2)])
check_kaibun(s[int((len(s)+3)/2-1):])
print('Yes')

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

int	main()
{
	int	N, W;
	cin >> N >> W;
	int	v[100];
	int	w[100];
	for (int i = 0; i < N; ++i)
		cin >> v[i] >> w[i];
	int	val[10001];
	for (int i = 0; i <= W; ++i)
		val[i] = -1;	
	int	v_i, val_j, val_k, k;
	int	max_val = 0;
	val[0] = 0;
	for (int i = 0; i < N; ++i) {
		v_i = v[i];
		for (int j = W; j >= 0; --j) {
			val_j = val[j];
			if (val_j == -1) continue;
			k = j + w[i];
			if (k > W) continue;
			val_k = val_j + v_i;
			if (val[k] < val_k) {
				val[k] = val_k;	
				if (max_val < val_k)
					max_val = val_k;
			}
		}
	}
	cout << max_val << endl;
}



Measured memory_bytes: 3136
def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

@r = 10**9+7
s = gets.chomp
nk = 1
dp = na2(s.size+1,13,0)
dp[s.size][0] = 1
s.reverse.each_char.with_index do |c, i|
  if(c != "?")
    d = (c.to_i * nk) % 13
    (0...13).each do |j|
      dp[i][j] = dp[i-1][j - d]
    end
  else
    t = nk
    tail = 0
    sum = 0
    head = 0
    10.times do |j|
      sum += dp[i-1][head]
      head = (head + t) % 13
    end
    13.times do |j|
      sum -= dp[i-1][tail]
      sum += dp[i-1][head]
      dp[i][head] = sum % @r
      tail += t
      tail %= 13
      head += t
      head %= 13
    end
  end
  nk *= 10
  nk %= 13
end
p dp[-2][5] %@r


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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main() {
 
 string a,b;
 cin>>a>>b;
 int x =stoi(a + b);

 for(int i=0;i<1000;i++){
     if(x==i*i){
         cout<<"Yes"<<endl;
        x=0;
        break;
     }
 }
 if(x!=0){
     cout<<"No"<<endl;
 }
}

Measured memory_bytes: 3592
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var n,m int
    fmt.Scan(&n,&m)
    ans := make([]int, n)
    for i:=0;i<m;i++{
        var a,b int
        fmt.Scan(&a,&b)
        ans[a-1]++
        ans[b-1]++
    }
    for i:=0;i<n;i++{
        fmt.Println(ans[i])
    }
}





// Pairsort
type Pair struct {
    first,second int64
}

type By func(p1, p2 *Pair) bool

func (by By) Sort(pairs []Pair) {
    ps := &pairSorter{
            pairs : pairs,
            by: by,
    }
    sort.Sort(ps)
}

type pairSorter struct {
    pairs []Pair
    by func(p1, p2 *Pair) bool
}

func (s *pairSorter) Len() int {
    return len(s.pairs)
}

func (s *pairSorter) Swap(i, j int) {
    s.pairs[i], s.pairs[j] = s.pairs[j], s.pairs[i]
}

func (s *pairSorter) Less(i, j int) bool {
    return s.by(&s.pairs[i], &s.pairs[j])
}

func first (p1, p2 *Pair) bool {
        return p1.first < p2.first
}

func second (p1, p2 *Pair) bool {
        return p1.second < p2.second
}
// end



func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func makeTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func sortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}

func reverseString(s string) string{
    t := []rune(s)
    for i,j := 0, len(s)-1 ; i < j ; i, j = i+1, j-1 {
        t[i], t[j] = t[j], t[i]
    }
    return string(t)
}

func inside(h,w,H,W int) bool{
    if h>=0 && h<H && w>=0 && w<W{
        return true
    }
    return false
}


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



int main(){
    long long int N,A,B;
    cin >> N>>A>>B;
    long long int k=N/(A+B);
    long long int ans=k*A;
    long long int r=N-k*(A+B);
    
    if(r>=A){
        ans+=A;
    }else{
        ans+=r;
    }
    cout << ans <<endl;
    return 0;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

using namespace std;

const int N=100005;

struct edge{
	int v;
	edge *next;
}pool[3*N],*h[N];

int n,top=-1;
int p[N],dep[N],flag[N];
int S,T;
int ans[N],Index,deg[N],dfn[N],_Index;
int ans2[N];
int oscar;

inline void addedge(int u,int v){
	edge *tmp=&pool[++top];
	tmp->v=v;tmp->next=h[u];h[u]=tmp;
}

void dfs(int u,int pre){
	p[u]=pre;
	dep[u]=dep[pre]+1;
	for(edge *tmp=h[u];tmp!=NULL;tmp=tmp->next){
		int v=tmp->v;
		if(v==pre) continue;
		dfs(v,u);
	}
}

void solve(int u,int pre){
	
//	printf("- %d %d\n",u,pre);
	
	dfn[u]=++_Index;
	if(flag[u]==false){
		if(deg[u]>1) oscar=true;
		return ;
	}
	if(u==T){
		ans[++Index]=dfn[u];
		return ;
	}
	int son;
	for(edge *tmp=h[u];tmp!=NULL;tmp=tmp->next){
		int v=tmp->v;
		if(v==pre) continue;
		if(flag[v]==false){
			solve(v,u);
			ans[++Index]=dfn[v];
		}
		else son=v;
	}
	ans[++Index]=dfn[u];
	solve(son,u);
}

void init(){
	int x1,x2;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		scanf("%d%d",&x1,&x2);
		addedge(x1,x2);
		addedge(x2,x1);
		deg[x1]++;deg[x2]++;
	}
	dfs(1,0);
	for(int i=1;i<=n;i++) if(dep[i]>dep[S]) S=i;
	dfs(S,0);
	for(int i=1;i<=n;i++) if(dep[i]>dep[T]) T=i;
	for(int i=T;i>0;i=p[i]) flag[i]=true;
	solve(S,0);
	if(oscar==true){
		printf("-1\n");
		return ;
	}
	for(int i=1;i<=n;i++) ans2[i]=ans[i];
	_Index=Index=0;
	swap(S,T);
	dfs(S,0);
	solve(S,0);
	/*
	for(int i=1;i<=n;i++) printf("%d ",ans[i]); printf("\n");
	for(int i=1;i<=n;i++) printf("%d ",ans2[i]); printf("\n");
	*/
	for(int i=1;i<=n;i++){
		if(ans[i]<ans2[i]){
			for(int j=1;j<=n;j++) printf("%d ",ans[j]);
			return ;
		}
		if(ans[i]>ans2[i]){
			for(int j=1;j<=n;j++) printf("%d ",ans2[j]);
			return ;
		}
	}
	for(int i=1;i<=n;i++) printf("%d ",ans2[i]);
}

int main(int argc, char** argv) {
	init();
	return 0;
}

Measured memory_bytes: 12160
#include "bits/stdc++.h"
using namespace std;

int main() {
	int n, i;
	string s;
	vector<string> items;
	items.clear();

	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> s;
		items.push_back(s);
	}
	sort(items.begin(), items.end());
	items.erase(unique(items.begin(), items.end()), items.end());
	cout << items.size() << endl;
	return 0;
}


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

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

  set<int> st;
  int d;
  rep(i, N) {
    cin >> d;
    st.insert(d);
  }

  cout << st.size() << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<math.h>
int main(){
  int box[300000]={},i,j,n,cnt;
  for(i=2;i<=123456*2;i++)
    box[i]=1;
  for(i=2;i<=sqrt(123456*2);i++){
    if(box[i]==1){
      for(j=i*i;j<=123456*2;j+=i)
        box[j]=0;
    }
  }
  while(1){
    cnt=0;
    scanf("%d",&n);
    if(n==0)
      break;
    for(i=n+1;i<=2*n;i++)
      cnt+=box[i];
    printf("%d\n",cnt);
  }
}



Measured memory_bytes: 2964
#include <stdio.h>
int main(){
  int a,b;
  scanf("%d%d",&a,&b);
  if (a>b){
    printf("%d",2*a-1);
  }else if(a==b){
    printf("%d",2*a);
  }else{
    printf("%d",2*b-1);
  }
  printf("\n");
  return 0;
}



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

typedef long long ll;
typedef long double ld;

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    ll n, m;
    cin >> n >> m;
    m /= 2;
    ll x = max(0LL, (m-n)/2);
    n += x;
    m -= x;
    cout << min(n, m);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <cstdio>
#include <deque>
#include <algorithm>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <stack>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n; cin >> n;
	if (n == 7 || n == 5 || n == 3)cout << "YES" << '\n';
	else cout << "NO" << '\n';


}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vii;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define in insert
#define sz(v) v.size()
#define mina(a,b) (a)=min((a),(b));
#define maxa(a,b) (a)=max((a),(b));
const ll INF = 1e18 + 5;

void solve(){
    int l,r; cin>>l>>r;
    ll mi=4*INF;
    if(r-l<=100000){
        for(int i=l;i<r;i++){
            for(int j=i+1;j<=r;j++){
                mi=min(mi,((ll)i*(ll)j)%2019);
            }
        }
        cout<<mi;
        return;
    }
    else{
        cout<<0;
    }
}
int main(){
    int T=1;        //! COMMENT IF THERE IS NO TEST CASES
    //cin>>T;             
    for(int i = 0; i < T; i++) solve(); 
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <cassert>
#include <cstring>

using namespace std;

int main() {
	int cnt[2] = {0};
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		cnt[x & 1]++;
	}
	if (cnt[1] == 0 || cnt[0] == 0) {
		puts("YES");
		return 0;
	} else {
		if (cnt[1] % 2 == 1) {
			puts("NO");
			return 0;
		} else {
			puts("YES");
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j,key;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);

  for(i=1;i<=n;i++){

    key=A[i];

    j=i-1;


  while(j>=0 && A[j]>key)
    {
    A[j+1]=A[j];

  j--;

  A[j+1]=key;

}
trace(A, n);
  }
  return 0;
}

Measured memory_bytes: 608
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
	char name[100];
	int t;
}P;

P Q[LEN];

int head,tail,n;

void enqueue(P x){
	Q[tail]=x;
	tail=(tail+1)%LEN;
}

P dequeue(){
	P x=Q[head];
	head=(head+1)%LEN;
	return x;
}

int min(int a,int b){
	return a<b? a:b;
}

int main(void){
	int elaps=0,c;
	int i,q;
	P u;
	scanf("%d %d",&n,&q);
	
	for(i=1;i<=n;i++){
		scanf("%s",Q[i].name);
		scanf("%d",&Q[i].t);
	}
	head = 1;
	tail = n+1;
	
	while(head!=tail){
		u=dequeue();
		c=min(q,u.t);
		u.t -= c;
		elaps += c;
		if(u.t>0)enqueue(u);
		else{
			printf("%s %d\n",u.name,elaps);
		}
	}
	return 0;
}


Measured memory_bytes: 11864
#include <cstdlib>
#include <array>
#include <iostream>


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

  std::array<int, 3> abc;
  std::cin >> abc[0] >> abc[1] >> abc[2];
  int cnt5 = 0, cnt7 = 0;
  for (const auto& e : abc) {
    switch (e) {
      case 5:
        cnt5++;
        break;
      case 7:
        cnt7++;
        break;
    }
  }
  std::cout << (cnt5 == 2 && cnt7 == 1 ? "YES" : "NO") << std::endl;

  return EXIT_SUCCESS;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fr(i,j,n)   for(int i=j;i<n;i++)
#define pb          push_back
#define rf(i,j,p)   for(int i=p;i>=j;i--)
#define vi          vector<int>
#define vll         vector<long long>
#define ll          long long
#define hmm         "\n"
#define sp          " "
#define srt(v)      sort(v.begin(), v.end());
#define down        cout<<hmm;
#define faaast      ios_base::sync_with_stdio(0);cin.tie(nullptr);
using namespace std;
int main()
{
 int n , a , b ; cin >> n >> a  >> b;
int del = abs(a-b);
if(del==0){cout<<"Borys"<<hmm;}
else
{
    del--;
    if(del%2!=0)cout<<"Alice"<<hmm;
    else cout<<"Borys"<<hmm;
}

}


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

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct ii {
    int a, b;
    bool operator < (ii o) const {
        return tie(a, b) < tie(o.a, o.b);
    }
};
struct iii {
    int a, b, c;
    bool operator < (iii o) const {
        return tie(a, b, c) < tie(o.a, o.b, o.c);
    }
};

const int MOD = 1000000007;
const int INF = 1000000000;
const int MAXN = 1000005;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    string s;
    cin >> s;
    int ans = 0;
    int cntR = 0;
    for (char c: s) {
        if (c == 'R') {
            cntR++;
            ans = max(ans, cntR);
        } else cntR = 0;
    }
    cout << ans << "\n";
    
}


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

using _i64 = int64_t;
using _u64 = uint64_t;
using _f64 = double;

#define _for(i, start, end) for(_i64 i = (_i64)start; i < (_i64)end; ++i)
#define _rep(i, number) _for(i, 0, number)
#define _foreach(e, data) for(auto& e : data)
#define _all(data) data.begin(), data.end()

template<typename type>
_i64 _size(const type& data) { return static_cast<_i64>(data.size()); }
template<typename type, size_t size>
_i64 _size(const type (&)[size]) { return static_cast<_i64>(size); }

enum _flag : bool { able = true, disable = false };

struct _time {
    _time(_flag flag) { check = flag; if(!check) { return; } gettime(start); }
    ~_time() {
        if(!check) { return; }; gettime(end);
        _i64 elapse = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cout << endl << "Time: " << elapse << " ms" << endl;
    }
    private:
    using _timer = chrono::time_point<chrono::system_clock>;
    _timer start, end; bool check;
    void gettime(_timer& time) { time = chrono::system_clock::now(); }
};

struct _ini { _ini() { ios::sync_with_stdio(false); cin.tie(nullptr); } } _ini;

int main() {
    {
        _time time(disable);
        _i64 a, b;
        while(cin >> a >> b) { cout << (_i64)log10(a + b) + 1 << endl; }
    }
    return 0;
}


Measured memory_bytes: 3364
import * as fs from "fs";
const input = fs.readFileSync("/dev/stdin", "utf8").split("\n")[0];

const len = input.length;
const patterns = ["01","10"].map(s=>s.repeat(len).substring(0,len));

const counts = patterns.map(pattern => {
  let count = 0;
  for(let i=0; i<len;i++){
      if(input[i]!==pattern[i]) count++;
  }
  return count;
});

console.log(counts.sort((a,b)=>a-b)[0]);


Measured memory_bytes: 7500
using System;

namespace abc139_1
{
    class Program
    {
        static void Main(string[] args)
        {
            // input
            string s = Console.ReadLine();
            string t = Console.ReadLine();

            // output
            int correct = 0;

            for(int i = 0; i < 3; i++)
            {
                if(s[i] == t[i])
                {
                    correct++;
                }
            }

            Console.WriteLine(correct.ToString());
            
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <utility>
#include <queue>
#include <memory>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)

using namespace std;
using ll = long long;
const int mod = 1e9+7;

vector<int> col(100010);
vector<int> graph[100010];
vector<bool> visit(100010,false);

int n,k;
ll ans = 1;

void dfs(int x,int p){
    visit[x] = true;
    
    int cnt = 0;

    if(p != -1){
        col[p]++;
        col[x]++;
        ans = (ans * (k-col[p])) % mod;
    }else{
        ans = k;
    }
    for(auto e: graph[x]){
        if(visit[e]){
            continue;
        }
        dfs(e,x);   
    }
}

int main(){
    cin >> n >> k;
    rep(i,n-1){
        int a,b;
        cin >> a >> b;
        a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    dfs(0,-1);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9600
#include <iostream>
using namespace std;
int main()
{
    int a,b;
    cin >>a>>b;
    
    if(a>=0 && b>=0)
    {  
      if(a+b>=a*b)
      cout << a+b;
      else
       cout <<a*b;
    }
    else if(a>=0 && b<0)
    cout << a-b;
    else if(a<=0 && b>=0)
    { 
      if(a+b >= a*b)
        cout << a+b;
      else
        cout << a*b;
        
    }
    else if(a<=0 && b<=0)
    { 
      if(a+b >= a*b)
      cout << a+b;
      else
        cout <<a*b;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    vec x(N); readvec(x);
    vec y(M); readvec(y);

    SORT(x);
    SORT(y);
    int xM = x[N - 1];
    int ym = y[0];

    string ans = "War";
    FOR(Z, X + 1, Y + 1) if(xM < Z && Z <= ym) ans = "No War";
    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int h,w,b[100][100],k[10][2]={{0,-1},{0,1},{1,0},{-1,0},{1,1},{-1,-1},{1,-1},{-1,1}};
char c,a[100][100];
int main()
{
  scanf("%d%d",&h,&w);getchar();
  for(int i=1;i<=h;i++)
    for(int j=1;j<=w;j++)
    {
      scanf("%c",&a[i][j]);
      if(j==w&&i<h)  getchar();
	}
  for(int i=1;i<=h;i++)
    for(int j=1;j<=w;j++)
    {
      if(a[i][j]=='#')  printf("%c",a[i][j]);
	  else 
	  {
	  	for(int m=0;m<=7;m++)
          if(a[i+k[m][0]][j+k[m][1]]=='#')  b[i][j]++;
        printf("%d",b[i][j]);
	  }
	  if(j==w)  printf("\n");
	}
  return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        String S = sc.next();
        int fn = 1;
        int bn = 1;
        int max = 0;
        int m = 0;
        char[] fs = new char[N];
        char[] bs = new char[N];
        int[] f = new int[N];
        int[] b = new int[N];

        for(int i=0; i<N-1; i++){
            fn = 1;
            bn = 1;
            m = 0;
            for(int j=1; j<=i; j++){
                int xf = 0;
                for(int k=0; k<j; k++){
                    if(j!=k){
                        if(S.charAt(k)!=S.charAt(j)){
                            xf += 1;
                        }
                    }
                }
                if(xf==j){
                    fn += 1;
                    fs[j] = S.charAt(j);
                    f[j] = j;
                }
            }

            for(int j=i+2; j<=N-1; j++){
                int xf = 0;
                for(int k=i+1; k<j; k++){
                    if(j!=k){
                        if(S.charAt(k)!=S.charAt(j)){
                            xf += 1;
                        }
                    }
                }
                if(xf==j-i-1){
                    bn += 1;
                    bs[j] = S.charAt(j);
                    b[j] = j;
                }
            }
            fs[0] = S.charAt(0);
            bs[i+1] = S.charAt(i+1);
            f[0] = 0;
            b[i+1] = i+1; 
            for(int j=0; j<=i; j++){
                for(int k=i+1; k<N; k++){
                    if(bs[k]==fs[j] && f[j]==j && b[k]==k){
                        m += 1;
                    }
                }
            }
            max = Math.max(max, m);
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 22804
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

const int N = 15; 
ll fact[N+1];

void set_fact() {
    fact[0] = 1;
    rep(i,N) fact[i+1] = ((ll)i+1) * fact[i];
}

const int D = 10;
vi cnt(D);
int n;
string in;
ll inm, ins;

ll calc_parm(){
    int sum = 0;
    rep(i, D) sum += cnt[i];

    ll ret = fact[sum];
    rep(i, D){
        ret /= fact[cnt[i]];
    }

    return ret;
}

ll calc(){
    vi cnt_org = cnt;

    ll ret = 0LL;
    rep(i, n){
        int num = in[i] - '0';

        rep(j, num){
            if(cnt[j] <= 0) continue;
            cnt[j]--;
            ret += calc_parm();
            cnt[j]++;
        }

        if(cnt[num] <= 0) break;
        cnt[num]--;
    }

    cnt = cnt_org;

    return ret;
}

ll dfs(int num, int depth, ll mul, ll sum){
    if(sum > ins) return 0LL;

    if(depth == n){
        if(sum <  ins) return calc_parm();
        if(sum == ins){
            if(mul <  inm) return calc_parm();
            if(mul == inm){
                return calc();
            }
        }
        return 0LL;
    }

    ll ret = 0LL;
    rep(nnum, num, 10){
        cnt[nnum]++;
        ret += dfs(nnum, depth + 1, mul * (nnum + 1), sum + nnum);
        cnt[nnum]--;
    }

    return ret;
}

int main(void){
    cin >> in;
    n = in.size();

    set_fact();

    ins = 0LL, inm = 1LL;
    for(auto & c : in){
        int e = c - '0';
        ins += e;
        inm *= (e + 1);
    }

    cout << dfs(0, 0, 1LL, 0LL) << endl;

    return 0;
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i=0;i<n;i++){
        cin >> h[i]; 
    }
    int max = 0;
    int ans = 0;
    for(int i=0;i<n;i++){
        if(max <= h[i]){
            ans ++;
            max = h[i];
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

const int MOD = 1e6 + 3;
ll fac[MOD], inv_fac[MOD];

ll bp(ll a, ll p) {
    ll r = 1;
    while (p > 0) {
        if (p & 1)
            r = r * a % MOD;
        a = a * a % MOD;
        p >>= 1;
    }
    return r;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    fac[0] = inv_fac[0] = 1;

    for (int i = 1; i < MOD; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv_fac[i] = bp(fac[i], MOD - 2);
    }

    int q;
    cin >> q;

    for (int i = 0; i < q; i++) {
        int x, d, n;
        cin >> x >> d >> n;

        if (d == 0) {
            cout << bp(x, n) << "\n";
        }
        else {
            x = x * bp(d, MOD - 2) % MOD;
            if (x == 0 || MOD <= x + n - 1) {
                cout << "0\n";
            }
            else {
                cout << fac[x + n - 1] * inv_fac[x - 1] % MOD * bp(d, n) % MOD << "\n";
            }
        }
    }

    return 0;
}

Measured memory_bytes: 16512
// Problem : C - Folia
// Contest : AtCoder - NOMURA Programming Competition 2020
// URL : https://atcoder.jp/contests/nomura2020/tasks/nomura2020_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;
int n, a[maxN];
pii range[maxN];

// sprawdz MODULO!
int main() {
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> n;
	REP(i, n + 1) cin >> a[i];
	if (n == 0) {
		if (a[0] == 1)
			cout << 1 << endl;
		else cout << -1 << endl;
		return 0;
	}
	if (a[0] > 0) {
		cout << -1 << endl;
		return 0;
	}
	range[0] = {1, 1};
	RI(i, n) {
		range[i] = range[i - 1];
		range[i].nd *= 2;
		range[i].nd -= a[i];
		if (range[i].nd > 1e18) {
			range[i].nd = (ll)1e18;
		}
		if (range[i].nd < 0 || (range[i].nd == 0 && i != n)) {
			cout << -1 << endl;
			return 0;
		}
	}
	ll ans = a[n], ile = a[n];
	FORD(i, n - 1, 0) {
		ll t = min(range[i].nd, ile);
		ans += t + a[i];
		ile = t + a[i];
	}
	cout << ans << endl;
	return 0;
}
 


Measured memory_bytes: 5612
M={0:0,1:0,2:0}

def f(N):
    if N in M:
        return M[N]

    X=1
    for i in range(3,N-2):
        X+=f(i)
        X%=Mod

    M[N]=X
    return X

S=int(input())
Mod=10**9+7
print(f(S))

Measured memory_bytes: 67984
#include <stdio.h>
#define MAX 500000

int root = -1;
int key[MAX];
int left[MAX];
int right[MAX];
int p[MAX];

void insert(int z){
  int a = -1;
  int b = root;
  while(b!=-1){
    a = b;
    if(key[z]<key[b]){
      b = left[b];
    }
    else b = right[b];
  }

  p[z] = a;
  if(a==-1) root = z;
  else if(key[z]<key[a]) left[a] = z;
  else right[a] = z;
}

void preorder(int t){
  if(t == -1) return;
  printf(" %d",key[t]);
  preorder(left[t]);
  preorder(right[t]);
}

void inorder(int t){
  if(t == -1) return;
  inorder(left[t]);
  printf(" %d",key[t]);
  inorder(right[t]);
}

void print(){
  inorder(root);
  printf("\n");
  preorder(root);
  printf("\n");
}

int find(int t){
  int i = 0,b = root;
  int y = -1;
  while(b!=-1){
    if(key[b] == t) return 1;
    y = b;
    if(t<key[b]) b = left[b];
    else b = right[b];
  }
  return 0;
}

int main(){
  int i,n,x;
  int z =0;
  char A[10];
  scanf("%d",&n);
  for(i=0;i<MAX;i++){
    key[i] = -1;
    left[i] = -1;
    right[i] = -1;
    p[i] = -1;
  }

  for(i=0;i<n;i++){
    scanf("%s",A);
    if(A[0]=='i'){
      scanf("%d",&x);
      key[z] = x;
      insert(z);
      z++;
    }
    else if(A[0]=='p') print();
    else if(A[0]== 'f'){
      scanf("%d",&x);
      if(find(x)==1) printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

Measured memory_bytes: 8428
import std.stdio;
import std.ascii;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

struct Edge {
    int to, cost;
}

void main() {
    int N;
    Edge[][] G;
    bool input() {
        scanf("%d\n", &N);
        if (N == 0) return false;
        auto ps = readln.chomp.split(" ").map!(to!int).array;
        auto ds = readln.chomp.split(" ").map!(to!int).array;
        G = new Edge[][N + 1];
        foreach (i; 0 .. N - 1) {
            G[i + 2] ~= Edge(ps[i], ds[i]);
            G[ ps[i] ] ~= Edge(i + 2, ds[i]);
        }
        return true;
    }
    void solve() {
        auto memo = new int[][][](2, N + 1, N + 1);
        foreach (i; 0 .. 2) foreach (j; 0 .. N + 1) memo[i][j][] = -1;
        int dfs(int v, int from, bool m) { // m: must return?
            if (G[v].length == 1 && from != 0) return 0;
            if (memo[m][v][from] >= 0) return memo[m][v][from];
            int Ret;
            foreach (e; G[v]) {
                if (e.to == from) continue;
                if (G[e.to].length == 1) {
                    Ret += e.cost;
                }
            }
            if (m) {
                int Add = int.max / 2;
                foreach (e1; G[v]) {
                    if (e1.to == from) continue;
                    if (G[e1.to].length == 1) continue;
                    int Add1 = dfs(e1.to, v, true) + e1.cost * 2;
                    foreach (e2; G[v]) {
                        if (e2.to == from) continue;
                        if (G[e2.to].length == 1) continue;
                        if (e2 == e1) continue;
                        Add1 += dfs(e2.to, v, false) + e2.cost * 3;
                    }
                    Add = min(Add, Add1);
                }
                if (Add == int.max / 2) Add = 0;
                Ret += Add;
            } else {
                foreach (e; G[v]) {
                    if (e.to == from) continue;
                    if (G[e.to].length == 1) continue;
                    Ret += dfs(e.to, v, false) + e.cost * 3;
                }
            }
            //writeln([v, from, m], "->", Ret);
            return memo[m][v][from] = Ret;
        }
        int Ans = int.max / 2;
        foreach (i; 1 .. N + 1) {
            Ans = min(Ans, dfs(i, 0, true));
        }
        writeln(Ans);
    }
    while (input) solve;
}

Measured memory_bytes: 18100
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main(){
    string str;
    cin>>str;
    if(str[0]=='S'){
        cout<<"Cloudy";
    } 
    else if(str[0]=='C'){
        cout<<"Rainy";
    } 
    else if(str[0]=='R'){
        cout<<"Sunny";
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int K,A,B;
    cin >> K ;
    cin >> A >> B;
    bool answer=false;
    
for (int i = A; i <= B; i++){
  if(i%K==0){
    answer=true;
}
}
 
if(answer){
    cout << "OK" << endl;
    return 0;
}
else{
    cout << "NG" << endl;
    return 0;
}
}
    


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

using namespace std;

int main(){
    int N,A;
    int i,j,k,l,m,n,x,y;
    int count,ans=0;
    vector<vector<pair<int,int>>> X;
    cin >> N;
    for(i=0; i<N; i++){
        cin >> A;
        vector<pair<int,int>> hoge;
        for(j=0;j<A;j++){
            cin >> x >> y;
            hoge.push_back(make_pair(x,y));
        }
        X.push_back(hoge);
    }
    for(i=0;i< (1<<N);i++){
        count = 0;
        for(j=0; j<N;j++){
            if(i&(1<<j)){
                count++;
                for(k=0;k<X[j].size();k++){
                    if((i&(1<<X[j][k].first-1))>>X[j][k].first-1 != X[j][k].second){
                        m = i & (1<<X[j][k].first-1);
                        count = -100;
                        break;
                    }
                }
            }
        }
        if(count > ans){
            ans = count;
        }
    }
    cout << ans << endl;

}

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

using namespace std;

typedef struct n
{
    int z;
    char c;
}c;

bool com(c a,c b){

    if(a.z>=b.z)return true;
    else return false;

}
int main()
{
    c ar[3];
    cin>>ar[0].z>>ar[1].z>>ar[2].z;
    ar[0].c='A';
    ar[1].c='B';
    ar[2].c='C';
    sort(ar,ar+3,com);
    cout<<ar[0].c<<endl;
    return 0;
}



Measured memory_bytes: 3160
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';

int main() {
    ll N, K, S;
    cin >> N >> K >> S;
    ll rem = S+1; if(rem > 1000000000)rem=1;
    rep(i,N)i<K?cout<<S<<" ":cout<<rem<<" ";
    cout<<endl;
}


Measured memory_bytes: 1280
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <random>
#include <functional>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define MAP map<int,int>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;
const ll INF = (ll)1e17;

void ANS(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Ans(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void ans(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

int main() {
	int N;
	cin >> N;
	VS S(N);
	ll M = 0, A= 0, R = 0, C= 0, H=0;
	REP(i, N) {
		cin >> S[i];
		if (S[i][0] == 'M') M++;
		if (S[i][0] == 'A') A++;
		if (S[i][0] == 'R') R++;
		if (S[i][0] == 'C') C++;
		if (S[i][0] == 'H') H++;
	}
	ll sum = M*A*R + M*A*C + M*A*H + M*R*C + M*R*H + M*C*H + A*R*C + A*R*H + A*C*H + R*C*H;
	cout << sum << endl;




	return 0;
}


Measured memory_bytes: 6144
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

n = int(input())
a = list(map(int,input().split()))
d = [0] *8
p = 0
for i in a:
    if i>=1 and i<400:
        d[0] += 1
    elif i >= 400 and i<800:
        d[1] +=1
    elif i >=800 and i<1200:
        d[2] += 1
    elif i>=1200 and i<1600:
        d[3] += 1
    elif i>=1600 and i<2000:
        d[4] += 1
    elif i>=2000 and i<2400:
        d[5] += 1
    elif i>=2400 and i<2800:
        d[6] += 1
    elif i>=2800 and i<3200:
        d[7] += 1
    else:
        p += 1
cnt = 0
for i in range(len(d)):
    if d[i]>0:
        cnt+=1
if cnt == 0:
    print(1,cnt + p)
else:
    print(cnt,cnt+p)

Measured memory_bytes: 3316
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }

constexpr int MAX_N = 10;
constexpr int INF = (1 << 29);

int n;
int a[MAX_N][MAX_N];

int ans;
int dist[MAX_N];

void dfs(int index) {
	for(int i = 0; i < n; ++i) {
		if(dist[i] != INF) continue;

		int max_dist = 0;
		for(int j = 0; j < n; ++j) {
			if(dist[j] != INF) {
				chmax(max_dist, dist[j] + a[i][j]);
			}
		}

		if(max_dist >= ans) continue;
		if(index == n - 1) {
			ans = max_dist;
			return;
		}

		dist[i] = max_dist;
		dfs(index + 1);
		dist[i] = INF;
	}
}

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

	fill(dist, dist + MAX_N, INF);
	while(cin >> n && n) {
		for(int i = 0; i < n; ++i) {
			for(int j = 0; j < n; ++j) {
				cin >> a[i][j];
			}
		}

		for(int i = 0; i < n; ++i) {
			for(int j = 0; j < n; ++j) {
				a[i][j] = a[j][i] = max(a[i][j], a[j][i]);
			}
		}

		ans = INF;
		dfs(0);
		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

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

int main() {
  int n, m, c; cin >> n >> m >> c; int ans = 0;
  vector<int> b(m); for (int& e : b) cin >> e;
  for (int i = 0; i < n; i++) {
    vector<int> a(m);
    int sum = 0;
    for (int j = 0; j < m; j++) {
      int a; cin >> a;
      sum += a * b.at(j);
    }
    if (sum > -c) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import copy
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

m = [a, b, c, d, e]

ans = 10 ** 10
def order(t, mr):
  global ans
  if len(mr) == 0:
    ans = min(ans, t)
    return
  
  if t % 10 != 0:
    t = t - (t % 10) + 10
  for i in range(len(mr)):
    nextt =  t + mr[i]
    nextmr = copy.deepcopy(mr)
    del nextmr[i]
    order(nextt, nextmr)
order(0, m)
print(ans)

Measured memory_bytes: 70336
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < N; i++)
using namespace std;

int main()
{
    int min, max;
    string S;
    cin >> S;
    rep(i, S.size())
    {
        if (S[i] == 'A')
        {
            min = i;
            break;
        }
    }
    rep(i, S.size())
    {
        if (S[i] == 'Z')
        {
            max = i;
        }
    }
    cout << max - min + 1 << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        a[i]-=i+1;
    }
    sort(a.begin(),a.end());
    long long ans=0;
    for(int i=0;i<n;i++){
        ans+=abs(a[i]-a[n/2-1]);
    }
    long long tmp=0;
    for(int i=0;i<n;i++){
        tmp+=abs(a[i]-a[n/2]);
    }
    ans=min(ans,tmp);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define tt this->
#define ll long long
using namespace std;
int main ()
{
ll x,y,z,s=0;
cin>>x>>y;
for (int i=0; i<x ; i++)
{
    cin>>z;
    if (z>=y)s++;
}
cout<<s;

    return 0;
}

/*
▀█████████▄     ▄████████    ▄████████    ▄████████
  ███    ███   ███    ███   ███    ███   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
 ▄███▄▄▄██▀    ███    ███  ▄███▄▄▄▄██▀   ███    ███
▀▀███▀▀▀██▄  ▀███████████ ▀▀███▀▀▀▀▀   ▀███████████
  ███    ██▄   ███    ███ ▀███████████   ███    ███
  ███    ███   ███    ███   ███    ███   ███    ███
▄█████████▀    ███    █▀    ███    ███   ███    █▀
                            ███    ███

*/


Measured memory_bytes: 3640
# 2回目のソートに気づけずTLE、納得のアルゴリズム
n = int(input())
s = []
for _ in range(n): #文字列の各要素をソートしリストに格納
    #s.append(list(input())) # !!!
    #s.append(sorted(list(input()))) # !!!
    #s.append(sorted(input())) # !!!
    #s.append([''.join(sorted(input()))])
    s += [''.join(sorted(input()))] # appendよりも'+='の方が高速！
s = sorted(s) #さらにソートして全検索を避ける
#print(s)

a = []
x = 1
for i in range(1,n): #隣り合う要素が重複する数をリストに格納
    if s[i] == s[i-1]:
        x += 1
    else:
        a.append(x)
        x = 1
else:
    a.append(x)
#print(a)

y = 0
for j in a: #各重複する数から各組み合わせ数を返し合算
    y += j*(j-1)/2

print(int(y))


Measured memory_bytes: 11408
#include <bits/stdc++.h>
using namespace std;
#define vi vector <int>
int main() {
	int n,m;
	cin >> n >> m;
	vi v(m);
	vi::iterator i;
	int sum=0;
	for(i=v.begin();i!=v.end();i++)
	{
		cin >> *i;
		sum+=*i;
	}
	if(n-sum>=0)
	{
		cout << n-sum;
	}
	else
	{
		cout << -1;
	}
	return 0;
}

Measured memory_bytes: 3600
import math
n, d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]

ans = 0
sum = 0
for i in range(n):
    for j in range(1, n-i):
        for a, b in zip(x[i], x[i+j]):
            sum += (a-b)**2
        if math.sqrt(sum) == int(math.sqrt(sum)):
            ans += 1
        sum = 0
print(ans)


Measured memory_bytes: 3064