akhauriyash/Code-Regression huggingface dataset:
l, r = list(map(int, input().split()))
MOD = 2019
#print(l // MOD)
#print(r // MOD)
#print(l % MOD)
#print(r % MOD)
result = 1 << 31
for i in range(l, r + 1):
  for j in range(i + 1, r + 1):
    i %= MOD
    j %= MOD
    if i == 0 or j == 0:
      print(0)
      exit(0)
    result = min(result, (i * j) % MOD)
print(result)


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

using namespace std;

typedef long long ll;
ll a, b;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

	cin >> a >> b;

	ll tmp = gcd(a, b);
	ll ans = (a * b) / tmp;

	cout << ans << "\n";

	return 0;

}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

	int i, j, ans;
	ans = 0;
	for(i = 1; i <= 9; i++){
			for(j = 1; j <= 9; j++){
				ans = i * j;	
				printf("%dx%d=%d\n", i, j, ans);
				}
	}


    return 0;
}

Measured memory_bytes: 524
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S, T = readline().split()
    A, B = map(int, readline().split())
    U = readline().strip()

    if S == U:
        print(A - 1, B)
    else:
        print(A, B - 1)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 61280
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long i,j,t,a,b,n,c,d,y,temp,m,r,sum,count,k,l,ans;
    t=1;
    // cin>>t;
    while(t--)
    {
        char ch[2][3];
        for(i=0;i<2;i++)
        for(j=0;j<3;j++)
        cin>>ch[i][j];
        {
            if(ch[0][0]==ch[1][2] && ch[0][2]==ch[1][0] && ch[0][1]==ch[1][1])
                cout<<"YES";
            else cout<<"NO";
        }
        
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    if(a+b>=c){
        cout<<"No";
    }
    else{
        if(4*a*b<(c-a-b)*(c-a-b)) cout<<"Yes";
        else cout<<"No";
    }
}

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

int main(){
  int R;
  cin >> R;
  if(R<1200){
    cout << "ABC" << endl;
  }else if(R<2800){
    cout << "ARC" << endl;
  }else{
    cout << "AGC" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <boost/range/adaptors.hpp>
#include <iomanip>

int main() {
    int X;
    std::cin >> X;

    int coin_500 = X / 500;
    int Y = X - coin_500 * 500;
    int coin_5 = Y / 5;
    std::cout << coin_500 * 1000 + coin_5 * 5 << std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;

public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        String[] input = br.readLine().split(" " , n);
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        insertionSort(array);

    }

    static void insertionSort(int[] A){
        int N = A.length;

        //output
        StringBuilder sb = new StringBuilder();
        for(int k : A){
            sb.append(k + " ");
        }
        System.out.println(sb.toString().substring(0 , sb.length() - 1));

        for(int i = 1; i < N; i++){
            int v = A[i];
            int j = i-1;
            while(j>=0 && A[j] > v){
                A[j+1] = A[j];
                j--;

            }
            A[j+1] = v;

            //output
            StringBuilder sbs = new StringBuilder();
            for(int k : A){
                sbs.append(k + " ");
            }
            System.out.println(sbs.toString().substring(0 , sbs.length() - 1));

        }
    }

}



Measured memory_bytes: 28316
#include <bits/stdc++.h>
using namespace std;
#define ll	    long long
#define vi      vector <ll>
#define vii     vector <pair<int,int>>
#define ii      pair<int,int>
#define loop(n)	for(int i=0;i<n;i++)
#define pb      push_back
const ll mod=1e9+7;
void fast();
ll power(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)
            res*=a;
        a*=a;
        b>>=1;
    }
    return res;
}
int main()
{
    fast();
    int n;
    cin>>n;
    ll a[n];
    ll cnt[n][60]={};
    loop(n){
        cin>>a[i];
        for(int j=0;j<60;j++){
            if((a[i]&(power(2,j))))
                cnt[i][j]++;
            if(i)
                cnt[i][j]+=cnt[i-1][j];
        }
    }
    ll res=0;
    for(int i=0;i<n-1;i++){
        for(int j=0;j<60;j++){
            int bit;
            if(i)
                bit=cnt[i][j]-cnt[i-1][j];
            else
                bit=cnt[i][j];
            if(bit){
                res+=power(2,j)%mod*(n-i-1-(cnt[n-1][j]-cnt[i][j]));
            }
            else
                res+=power(2,j)%mod*(cnt[n-1][j]-cnt[i][j]);
            res%=mod;
        }
    }
    cout<<res%mod;

}
void fast(){
std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
/*

*/


Measured memory_bytes: 143232
import java.io.*;
 
class Main {
    public static void main(String args[]) {
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String t[], s;
            double a[] = new double[6];
            while((s = reader.readLine())  != null) {
                t = s.split(" ");
                for(int i = 0;i < a.length;i++) {
                    a[i] = Double.parseDouble(t[i]);
                }
                double z = a[0]*a[4]-a[1]*a[3];
                double x = (a[4]*a[2]-a[1]*a[5])/z;
                double y = (-a[3]*a[2]+a[0]*a[5])/z;
 
                if(x == -0.0)
                    x = 0.0;
                if(y == -0.0)
                    y = 0.0;
                System.out.printf("%4.3f %4.3f\n", x, y);
 
            }
 
        }
        catch(IOException e) {
            System.out.println(e);
        }
    }
}

Measured memory_bytes: 24472
while True:
    n,m=map(int,input().split())
    if n==0 and m==0:
        break
    
    X=max(n,m)
    Y=min(n,m)
    
    a=0
    while True:
        a+=1
        tmp=X%Y
        X,Y=Y,tmp
        if tmp==0:
            break
        
    print(X,a)


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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define PI (acos(-1.0))
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    ll n,k;
    cin >> n >> k;

    vector<int> light(n + 2);

    rep(i, n){
        cin >> light[i + 1];
    }

    //imos法をつかう
    vector<int> count(n + 2);

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

        for(int i = 1; i <= n; i++){
            
            if(i - light[i] < 1){
                count[0]++;
            }else{
                count[i - light[i]]++;
            }

            if(i + light[i] + 1 > n){
                count[n + 1]--;
            }else{
                count[i + light[i] + 1]--;
            }
        }

        ll sum = 0;

        for(int i = 1; i <= n + 1; i++){
            count[i] = count[i] + count[i - 1];
            light[i] = count[i];

            if(i != n + 1) sum += count[i];
        }

        if(sum == n * n) break;

        rep(i, n + 2){
            count[i] = 0;
        }
    }

    for(int i = 1; i <= n; i++){
        cout << light[i] << " ";
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 4824
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

int main() {
    int h,w;
    cin>>h>>w;
    vector<string>s(h);
    for(int i=0;i<h;i++){
        cin>>s.at(i);
    }
    int cnt=0;//cntは'.'の個数
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(s.at(i).at(j)=='.'){
                cnt++;
            }
        }
    }
    //幅優先探索
    vector<int>dx={1,0,0,-1};
    vector<int>dy={0,1,-1,0};
    vector<vector<int> >dist(h,vector<int>(w));
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            dist.at(i).at(j)=-1;
        }
    }
    dist.at(0).at(0)=1;
    queue<pair<int,int> >que;
    que.push(make_pair(0,0));

    while(!que.empty()){
        // cout<<"AAA"<<endl;
        pair<int,int>v = make_pair(que.front().first,que.front().second);
        que.pop();

        int y=v.first;
        int x=v.second;
        for(int i=0;i<4;i++){
            if(x+dx.at(i)>=0 and x+dx.at(i)<w and y+dy.at(i)>=0 and y+dy.at(i)<h){
                if(s.at(y+dy.at(i)).at(x+dx.at(i))=='.' and dist.at(y+dy.at(i)).at(x+dx.at(i))==-1){
                    dist.at(y+dy.at(i)).at(x+dx.at(i))=dist.at(y).at(x)+1;
                    que.push(make_pair(y+dy.at(i), x+dx.at(i)));
                }
            }
        }
    }
    if(dist.at(h-1).at(w-1)==-1){
        cout<<-1<<endl;
        return 0;
    }
    cout<<cnt-dist.at(h-1).at(w-1)<<endl;





    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define MAX_C 1000000001
 
int check(char c) {
  if ((c-'A')*(c-'C')*(c-'G')*(c-'T') == 0) return 1;
  return 0;
}
 
int main() {
  string s;
  cin >> s;
  vector<int> atcg(s.size());
  
  for (int i = 0; i < s.size(); i++) {
    atcg[i] = check(s[i]);
  }
 
  int ret = 0;
  int tmp = 0;
  for (int i = 0; i < s.size(); i++) {
    if (atcg[i] == 1) {
      tmp++;
      ret = max(ret, tmp);
    }
    else tmp = 0;
  }
  cout << ret << endl;
}

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

const int INF=1<<29;
int N,p[5010];
int dp[5010][4];
//dp[i][j]:i番目までのパンケーキを全てひっくり返したとき、
//         i+1番目のパンケーキの残り裏返し回数

int main(){
    cin>>N;
    for(int i=0; i<N; i++)cin>>p[i];
    
    for(int i=0; i<5010; i++){
        for(int j=0; j<4; j++){
            dp[i][j]=INF;
        }
    }
    for(int i=0; i<p[0]+1; i++)dp[0][i]=p[0]-i;
    
    for(int i=0; i<N-1; i++){
        for(int j=0; j<4; j++){
            for(int k=0; k<p[i+1]+1; k++){
                int d=p[i+1]-k;
                if(d<j)continue;
                dp[i+1][k]=min(dp[i+1][k],dp[i][j]+d*2);
            }
        }
    }
    int ans=INF;
    for(int i=0; i<4; i++)ans=min(ans,dp[N-1][i]+i);
    cout<<ans<<endl;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    for (char c = 'a'; c <= 'z'; c++) {
        bool y = 0;
        for (int i = 0; i < s.length(); i++) if (s[i] == c) y = 1;
        if (!y) {
            cout << c;
            return 0;
        }
    }
    cout << "None";
}


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

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	cin >> n >> m;
	f = 0;
	REP(i, n, m+1){
		s = to_string(i);
		if(s[0] == s[4] && s[1] == s[3]) ++f;
	}
	cout << f;
}


Measured memory_bytes: 256
n = int(input())
cnt = 0
if n < 10:
  for i in range(1,n+1):
    cnt += 1
elif 10 <= n < 100:
  cnt += 9
elif 100 <= n < 1000:
  cnt += 9
  for i in range(100,n+1):
    cnt += 1
elif 1000 <= n < 10000:
  cnt += 909
elif 10000 <= n < 100000:
  cnt += 909
  for i in range(10000, n+1):
    cnt +=1
elif n == 100000:
  cnt = 90909
print(cnt)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
ll n,ans,r,g,b;
char s[4010];
int main(){
	cin>>n;
	scanf("%s",s+1);
	rep(i,1,n){
		if(s[i]=='R')	r++;
		if(s[i]=='G')	g++;
		if(s[i]=='B')	b++;
	}
	ans=r*g*b;
	rep(len,1,n){
		rep(j,1,n-2*len){
			if(s[j]!=s[j+len]&&s[j]!=s[j+2*len]&&s[j+len]!=s[j+2*len])
				ans--;	
		}
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 3700
import heapq
from sys import stdin
input = stdin.readline


class MaxHeapObj(object):
  def __init__(self, val):
    self.val = val

  def __lt__(self, other):
    return self.val > other.val

  def __eq__(self, other):
    return self.val == other.val

  def __str__(self):
    return str(self.val)


class MinHeap(object):
  def __init__(self, L=None):
    if L is None:
      self.h = []
    else:
      heapq.heapify(L)
      self.h = L

  def heappush(self, x):
    heapq.heappush(self.h, x)

  def heappop(self):
    return heapq.heappop(self.h)

  def __getitem__(self, i):
    return self.h[i]

  def __len__(self):
    return len(self.h)


class MaxHeap(MinHeap):
  def __init__(self, L=None):
    super(MaxHeap, self).__init__(list(map(lambda x: MaxHeapObj(x), L)))

  def heappush(self, x):
    heapq.heappush(self.h, MaxHeapObj(x))

  def heappop(self):
    return heapq.heappop(self.h).val

  def __getitem__(self, i):
    return self.h[i].val


def main():
  N, M = list(map(int, input().split()))
  L = []
  for i in range(N):
    a, b = map(int, input().split())
    L.append((a, b))
  L = sorted(L)

  H = []
  PQ = MaxHeap(H)
  max_ = 0

  start = 0
  for m in range(M-1, -1, -1):
    res = M - m
    while start < N and L[start][0] == res:
      PQ.heappush(L[start][1])
      start += 1

    if len(PQ):
      now = PQ.heappop()
      max_ += now

  print(max_)


if(__name__ == '__main__'):
  main()


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

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

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

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

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

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

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

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

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

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

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

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

const int N = 200005;

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

int main() {
	read(n);
	for (int i = 0; i < n; ++i) {
		read(a[i]);
	}
	for (int i = 0; i < n; ++i) {
		read(b[i]);
	}
	std::priority_queue<std::pair<long long, int>> Q;
	for (int i = 0; i < n; ++i) {
		if (b[i] < a[i]) {
			print(-1);
			return 0;
		}
		if (b[i] > a[i]) {
			Q.push({b[i], i});
		}
	}
	long long ans = 0;
	while (!Q.empty()) {
		int u = Q.top().second;
		Q.pop();
		int pr = (u + n - 1) % n, nx = (u + 1) % n;
		int val = b[pr] + b[nx];
		int t = (b[u] - a[u]) / val;
		b[u] -= t * val, ans += t;
		if (t == 0) {
			print(-1);
			return 0;
		}
		if (b[u] > a[u]) {
			Q.push({b[u], u});
		}
	}
	print(ans);
}


Measured memory_bytes: 12044
#include <bits/stdc++.h>
#define INF 1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define arr array
#define _min(a) *min_element(a.begin(), a.end());
#define _max(a) *max_element(a.begin(), a.end());
#define _sort(x) sort(x.begin(), x.end())
#define _rsort(x) sort(x.rbegin(), x.rend())
#define _reverse(x) reverse(x.begin(), x.end())
#define _debug(x) cout << #x << " = " << x << endl;
#define debug(x, y) cout << #x " = " << x << " " << #y << " = " << y << endl;
#define _lower_bound(a, x) lower_bound(a.begin(), a.end(), x) - a.begin()
#define _upper_bound(a, x) upper_bound(a.begin(), a.end(), x) - a.begin()
typedef long long ll;
using namespace std;

void solve() {	
	string s; cin >> s;
	_sort(s);
	if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) puts("Yes\n");
	else puts("No");
}   

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

    // int t; cin >> t;
    // while(t--) 
        solve();
}

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> B(N);
    ll ans=0;
    rep(i,N) cin >> A.at(i);
    int maxtmp=0;
    rep(i,N){
        maxtmp = max(maxtmp, A.at(i));
        ans += maxtmp - A.at(i); 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4784
import java.util.Scanner;

public class Main {
  static int n, p = 0;
  static int[] a;
    
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    n = scanner.nextInt();
    a = new int[n + 1];
    for (int i = 1; i <= n; i++) {
        a[i] = scanner.nextInt();
    }
    scanner.close();

    for (int i = 1; i <= n; i++) {
        if (i == a[a[i]]) {
            p++;
            a[a[i]] = 0;
        }
    }

    System.out.println(p);
  }
}

Measured memory_bytes: 32500
n=int(input());s=input();l=s[:n];r=s[n:][::-1];d={};e={}
for i in range(1<<n):
 s=t=u=v=''
 for j in range(n):
  if i>>j&1:s+=l[j];t+=r[j]
  else:u+=l[j];v+=r[j]
 d[s,u]=d.get((s,u),0)+1
 e[t,v]=e.get((t,v),0)+1
print(sum(d[i]*e.get(i,0)for i in d.keys()))

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
template<typename T>
void pr(T a){
  cout<<a<<endl;
}
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  cout<<(n+1)/2<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define endl "\n"


 
int main ()
{
	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #define int ll
	
	int t;
	cin >> t;

	int result = log2(t);
	int ans;
	for (int i = 2; true; i*=2){
	    if (i > t){
	        ans = i-1;
	        break;
	    }
	}    

	cout << ans << endl;
 
	return 0;
	
}


Measured memory_bytes: 3700
#abcをa b c
s = [0,0,0]
n = int(input())
s[0] = n // 100
s[1] = n // 10 - 10 * s[0]
s[2] = n % 10
m = 0
for a in range(3):
    if s[a] == 1:
        m += 1
print(m)

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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define MAX 510000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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

template <typename t> t mod_pow(t n, t r, t m)
{
	t ret = 1;
	t tmp = n;
	
	while(r != 0) {
		if(r % 2) {
			ret *= tmp;
		}
		tmp *= tmp;
		tmp %= m;
		ret %= m;
		r /= 2;
	}
	return ret;
}

template <typename t> t mod_inv (t a, t m)
{
	return mod_pow(a, m - 2, m);
}

template <typename t> t mod_div (t a, t b, t m)
{
	return a * mod_inv(b, m) % m;
}

template <typename t> t mod_sub (t a, t b, t m)
{
	return (a < b) ? m + a - b : (a - b) % m;
}

long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    sort(all(A));

    COMinit();

    ll ans = 0;

    rep(i,N)
    {
        ans += A[i] * COM(i, K-1);
        ans -= A[i] * COM(N-i-1, K-1);
        ans %= MOD;
    }

    cout << ans << endl;
}


Measured memory_bytes: 13056
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>v;
int n,k;
bool poss(int len) {
	ll ctr = 0;
	for (int i = 0; i < n; i++) {
		if (v[i] < len)
			break;
		ctr += v[i]/len;
		if (v[i]%len == 0)
			ctr--;
	}
	return ctr <= k;
}
int main() {
	int len;
	cin >> n >> k;
	int ans = -1;
	for (int i = 1; i <= n; i++){
		cin >> len;
		v.push_back(len);
		ans = max(ans,len);
	}
	sort(v.rbegin(), v.rend());
	int l,r,mid;
	l = 1, r = ans;
	while (l <= r) {
		mid = l + (r-l)/2;
		if (poss(mid)) {
			ans = min(ans,mid);
			r = mid - 1;
		}
		else
			l = mid + 1;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 4252
import java.util.Scanner;
import java.io.IOException;
        public class Main {
                private final static int WHITE=0;
                private final static int GRAY=1;
                private final static int BLACK=2;
                private static int[][] M;
                private static int n;
                public static void main(String[] args) throws IOException {
                        final Scanner sc = new Scanner(System.in);
                        int i,j;
                        n=sc.nextInt();
                        M = new int[n][n];

        //??????????????????
                        for(i=0;i<n;i++)
                                for(j=0;j<n;j++) M[i][j]=Integer.MAX_VALUE;
                        int u,k,v,c;

                        for(i=0;i<n;i++){
                                u=sc.nextInt();
                                k=sc.nextInt();
                                for(j=0;j<k;j++){
                                        v=sc.nextInt();
                                        c=sc.nextInt();
                                        M[u][v]=c;
                                }
                        }

                        dicstra();

                }

                public static void dicstra(){
                        int[] color = new int[n];
                        int[] depth = new int[n];
                        int i,j;
                        for(i=0;i<n;i++){
                                depth[i]=Integer.MAX_VALUE;
                                color[i]=WHITE;
                        }

                        depth[0]=0;
                        color[0]=GRAY;
                        int mincost;
                        int u;
                        while(true){
                                mincost=Integer.MAX_VALUE;
                                u=-1;
                                for(i=0;i<n;i++){
                                        if(color[i]!=BLACK && depth[i]<mincost){
                                                mincost = depth[i];
                                                u=i;
                                        }
                                }
                                if(mincost==Integer.MAX_VALUE) break;
                                color[u]=BLACK;

                                for(j=0;j<n;j++){
                                        if(color[j]!=BLACK && M[u][j]!=Integer.MAX_VALUE){
                                                if(depth[j]>depth[u]+M[u][j]){
                                                        depth[j]=depth[u]+M[u][j];
                                                        color[j]=GRAY;
                                                }
                                        }
                                }

                        }
                        for(i=0;i<n;i++){
                                System.out.println(i+" " + (depth[i]==Integer.MAX_VALUE ? -1 : depth[i]));
                        }
                }
        }

Measured memory_bytes: 644192
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#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 MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
    int n;
    string s;
    cin >> n >> s;
    int cnt=0;
    rep(i,n-2){
        if(s.at(i)=='A'&&s.at(i+1)=='B'&&s.at(i+2)=='C') cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

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

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

bool IsPrime(int n){
  if(n==1) return false;
  for(int j=2;j*j<=n;j++){
    if(n%j==0){
      return false;
    }
  }
  return true;
}


int primeNumber(int *a, int n){
  int i,cnt=0;
  for(i=0;i<n;i++){
    if(IsPrime(a[i]))
      cnt++;
  }
  return cnt;
}

int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++)
    cin >> a[i];
  cout << primeNumber(a,n) << endl;
}



Measured memory_bytes: 3136
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		sc.close();
		char[] c = n.toCharArray();
		if ((c[0]==c[1]&&c[1]==c[2]) ||(c[1]==c[2]&&c[2]==c[3])) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 22608
#include<stdio.h>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>


using namespace std;

void solve(){
	int N;
	cin >>  N;

	for(int i=N; i>=1; i--){
		int temp = log2(i);
		double comp = log2(i) - temp;
		if(comp == 0.0 ){
			printf("%d\n", i);
			break;
		}
	}
}

int main(void) {
	solve();
	return 0;
}


Measured memory_bytes: 512
#https://atcoder.jp/contests/abc109/tasks/abc109_b
#B - Shiritori

n = gets.to_i
w = n.times.map {|i| gets.strip}

if w.uniq.size != w.size
  puts "No"
  exit
end

(w.size-1).times{|i|
  # p "#{w[i][w[i].size-1]} #{w[i+1][0]}"
  if w[i][w[i].size-1] != w[i+1][0]
    puts "No"
    exit
  end
}

puts "Yes"

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main () {
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> C(N);
    vector<vector<int>> A(N, vector<int>(M));
    for (int i = 0; i < N; i++) {
        cin >> C[i];
        for (int j = 0; j < M; j++) {
            cin >> A[i][j];
        }
    }
    int ans = INT_MAX;
    for (int k = 1; k < (1 << N); k++) {
        vector<int> B(M, 0);
        int res = 0;
        for (int i = 0; i < N; i++) {
            if ((k & (1 << i))) {
                res += C[i];
                for (int j = 0; j < M; j++) {
                    B[j] += A[i][j];
                }
            }
        }
        bool f = 1;
        for (int j = 0; j < M; j++) {
            if (B[j] < X) f = 0;
        }
        if (f) {
            ans = min(ans, res);
        }
    }
    if (ans == INT_MAX) {
        puts("-1");
    }
    else {
        cout << ans << endl;
    }
}

Measured memory_bytes: 3544
require "set"
n=gets.to_i
flag = true
ws=Array.new(n){gets.chomp}
set = Set.new
#重複判定
ws.each do |w|
  if set.include?(w)
    flag = false
  end
  set << w
end

#先頭末尾判定
cur = 0
while cur < ws.length-1
  if ws[cur][-1]!=ws[cur+1][0]
    flag = false
  end
  cur+=1
end

puts flag ? "Yes" : "No"


Measured memory_bytes: 1916
def solve(xyhs):
    for cx in range(100 + 1):
        for cy in range(100 + 1):
            cand = None
            for x, y, h in filter(lambda xyh: xyh[2] != 0, xyhs):
                t = h + abs(x - cx) + abs(y - cy)
                if cand is None:
                    cand = t
                elif cand != t:
                    break
            else:
                for x, y, h in filter(lambda xyh: xyh[2] == 0, xyhs):
                    if abs(x - cx) + abs(y - cy) < cand:
                        break
                else:
                    return cx, cy, cand

    return -1, -1, -1


n = int(input())
xyhs = tuple(tuple(map(int, input().split())) for _ in range(n))

print(*solve(xyhs))


Measured memory_bytes: 3064
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>
#include <time.h>
#include <random>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 3e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pd(x) cerr<<"//"<<(x)<<endl;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll mod = 1000000007;
ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

ll n,m,num,sum,ans,a,b,c,d,e,g,h,w,i,j,k,q,l,r;
ll x[500005],y[500005],z[500005];
char s[200005],t[200005];
ll dp[1005][1005];
ll sx,sy;
bool flag,dame;

int main(){
	cin >> h >> w >> n;
	cin >> sx >> sy;
	cin >> s >> t;
	ll up,down,left,right;
	up = 1;
	down = h;
	left = 1;
	right = w;
	for(i=n-1;i>=0;i--){
		if(s[i] == 'U'){
			up++;
		}else if(s[i] == 'D'){
			down--;
		}else if(s[i] == 'L'){
			left++;
		}else{
			right--;
		}
		if(left > right || up > down){
			//p(i);
			p("NO");
			return 0;
		}
		if(i == 0)break;
		if(t[i-1] == 'L'){
			right = min(w,right + 1);
		}else if(t[i-1] == 'R'){
			left = max(1ll,left - 1);
		}else if(t[i-1] == 'D'){
			up = max(1ll,up-1);
		}else{
			down = min(h,down + 1);
		}
	}
	//pe(up);
	//pe(down);
	//pe(left);
	//pe(right);
	if(up <= sx && sx <= down && left <= sy && sy <= right){
		p("YES");
	}else{
		p("NO");
	}
	//p("YES");





	return 0;
}

Measured memory_bytes: 29312
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;



int main(){
	int a,b,c,d;
	scanf("%d %d %d %d", &a,&b,&c,&d);

	if(abs(c-a)<=d){
		printf("Yes\n");
	}else if(abs(b-a)<=d && abs(c-b)<=d){
		printf("Yes\n");
	}else{
		printf("No\n");
	}


	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力

N, M = map(int, input().split())
lst = list(map(int, input().split()))

votes = sum(lst)
threshold = votes * (1/(4*M))

lst = sorted(lst,reverse=True)

index = M-1
if(lst[index] >= threshold):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
from sys import stdin
def input():
    return stdin.readline().strip()

import heapq

def main():
    h, w, k = map(int, input().split())
    x1, y1, x2, y2 = map(int, input().split())

    # surround the square with '@'
    c = [['@'] * (w+2)]
    for _ in range(h):
        i = list('@' + input() + '@')
        c.append(i)
    c.append(['@'] * (w+2))

    # Dijkstra
    # seen[x][y] = the minimum cost of (x, y)
    # if seen[x][y] == -1, (x, y) is unresearched
    seen = [[-1] * (w+2) for _ in range(h+2)]

    # todo[i] == (cost, x, y, direction)
    todo = [(0, x1, y1, 0)]
    heapq.heapify(todo)

    # direction
    dx = [-1, 0, 1, 0]
    dy = [0, 1, 0, -1]

    while len(todo) > 0:
        cost, xi, yi, direction = heapq.heappop(todo)

        # special case
        if seen[xi][yi] != -1:
            if (seen[xi][yi]+k-1)//k * k >= cost:
                xj, yj = xi + dx[direction], yi + dy[direction]
                if c[xj][yj] == '.':
                    heapq.heappush(todo, (cost+1, xj, yj, direction))
            continue
        seen[xi][yi] = cost

        # goal
        if xi == x2 and yi == y2:
            print((cost+k-1)//k)
            exit()
        
        # add
        for j in range(4):
            xj, yj = xi + dx[j], yi + dy[j]
            if c[xj][yj] == '.':
                if j == direction:
                    if seen[xj][yj] == -1 or (seen[xj][yj]+k-1)//k * k > cost:
                        heapq.heappush(todo, (cost+1, xj, yj, j))
                elif seen[xj][yj] == -1:
                    heapq.heappush(todo, ((cost+k-1)//k * k + 1, xj, yj, j))

    print(-1)

main()

Measured memory_bytes: 75504
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stack>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <cassert>
using namespace std;
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define PER(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)((x).size()))
#define ALL(t) t.begin(),t.end()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;
#define DBG(vari) cout<<"["<<__LINE__<<"] "<<#vari<<" = "<<(vari)<<endl;
template<class T> ostream &operator<<(ostream &os, vector<T> V){ os<<"[";for(auto vv:V)os<<vv<<",";return os<<"]"; } 
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) { return os<<"("<<P.fi<<","<<P.se<<")"; }
#define flash ios_base::sync_with_stdio(0);
#define read freopen("1.in","r",stdin);
#define write freopen("1.out","w",stdout);
inline bool EQ(ld a,ld b) {return fabs(a-b)<=(1e-7);}
const ll mod=(1e9+7);
const ld pi=(acos(-1));
//CUT BEGINS

int main() {
	flash;
	int a,b,c,d,e,f,water_ans=-1,sugar_ans=-1;
	ld ans=-1;
	cin>>a>>b>>c>>d>>e>>f;
	int water[3004]={0},sugar[3004]={0};
	REP(i,0,30) REP(j,0,30) if ((a*i*100)+(b*j*100)<=3000) water[(a*i*100)+(b*j*100)]=1;
	REP(i,0,3000) REP(j,0,3000) if((c*i)+(d*j)<=3000) sugar[(c*i)+(d*j)]=1;
//	REP(i,1,100) if(sugar[i]) cout<<i<<" ";
	REP(i,1,3000) REP(j,0,3000) {
		if(water[i] && sugar[j] && i+j<=f) {
			if(ld(j)/(ld)(i+j)>ans && (ld)(j*100)/(ld)i<=(ld)e) ans=ld(j)/(ld)(i+j),water_ans=i,sugar_ans=j;
		}
	}
	cout<<water_ans+sugar_ans<<" "<<sugar_ans;
	return 0;
}

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

int main(){
  int n; cin >> n;
  int ans = 0;
  int a[n]={0};
  for(int i = 0; i < n; i++){
    int temp;
    cin >> a[i];
    ans = __gcd(ans, a[i]);
   // cout << ans << endl;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1020
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int h = int.Parse(Console.ReadLine());

            Console.WriteLine((a + b) * h / 2);
        }
    }
}


Measured memory_bytes: 2648
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n, k, s = MAP()
 
if s == 10 ** 9:
  a = 1
else:
  a = 10 ** 9

ans = [s] * k + [a] * (n - k)
 
print(*ans)





Measured memory_bytes: 8780
rmap = {
  "AC": 0,
  "WA": 0,
  "TLE": 0,
  "RE": 0,
}

output_order = ["AC", "WA", "TLE", "RE"]

N = int(input())
for _ in range(N):
  rmap[input()] += 1

for k in output_order:
  print("{} x {}".format(k, rmap[k]))

Measured memory_bytes: 9020
A=list(input()[::-1])
B=list(input()[::-1])
C=list(input()[::-1])


next="a"
while True:
  #print(next)
  if next=="a":
    if len(A)==0:
      print("A");exit()
    next=A.pop()    
  elif next=="b":
    if len(B)==0:
      print("B");exit()
    next=B.pop()    
  else:
    if len(C)==0:
      print("C");exit()
    next=C.pop()
    
    

Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define lint long long
#define st first
#define nd second
#define INF 0x3f3f3f3f

using namespace std;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int x; cin>>x;
	int y = !x;
	cout<<y<<"\n";

	return 0;	
}


Measured memory_bytes: 3592
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn=100010;
int n,n0,n1,m0,m1,sum;
int f[maxn],p0[maxn],p1[maxn];
inline int rd()
{
	int ret=0,f=1;	char gc=getchar();
	while(gc<'0'||gc>'9')	{if(gc=='-')	f=-f;	gc=getchar();}
	while(gc>='0'&&gc<='9')	ret=ret*10+gc-'0',gc=getchar();
	return ret*f;
}
int main()
{
	n=rd();
	int i;
	for(i=1;i<=n;i++)
	{
		f[i]=rd(),sum+=abs(f[i]);
		if(f[i]>=0)
		{
			p0[++n0]=i;
			if(!m0||f[i]<f[m0])	m0=i;
		}
		else
		{
			p1[++n1]=i;
			if(!m1||f[i]>f[m1])	m1=i;
		}
	}
	if(!n0)
	{
		printf("%d\n",sum+2*f[m1]);
		for(i=1;i<=n;i++)	if(i!=m1)	printf("%d %d\n",f[m1],f[i]),f[m1]-=f[i];
		return 0;
	}
	if(!n1)
	{
		printf("%d\n",sum-2*f[m0]);
		if(m0!=1)	swap(f[m0],f[1]);
		for(i=3;i<=n;i++)	printf("%d %d\n",f[1],f[i]),f[1]-=f[i];
		printf("%d %d\n",f[2],f[1]);
		return 0;
	}
	printf("%d\n",sum);
	for(i=2;i<=n0;i++)	printf("%d %d\n",f[p1[1]],f[p0[i]]),f[p1[1]]-=f[p0[i]];
	for(i=1;i<=n1;i++)	printf("%d %d\n",f[p0[1]],f[p1[i]]),f[p0[1]]-=f[p1[i]];
	return 0;
}


Measured memory_bytes: 2688
//Lucky 7

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

int main (){
    string S;
    cin >> S;
    if(S[0]=='7'||S[1]=='7'||S[2]=='7')cout<< "Yes"<< endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3624
use std::usize;
use std::cmp;

fn main() {
    // 1つの数字
    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };
    let n: usize = s.parse().unwrap();

    // 1行ベクトル
    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };
    let h: Vec<usize> = s.split_whitespace().map(|x| x.parse().unwrap()).collect();

    let mut dp: Vec<usize> = vec![usize::MAX; n];

    dp[0] = 0;
    dp[1] = abs_diff(h[1], h[0]);

    for i in 2..n {
        dp[i] = cmp::min(dp[i - 1] + abs_diff(h[i], h[i - 1]), dp[i - 2] + abs_diff(h[i], h[i - 2]))
    }

    // println!("{:?}", dp);
    println!("{}", dp[n - 1]);
}

fn abs_diff(a: usize, b: usize) -> usize {
    if a > b {
        a - b
    } else {
        b - a
    }
}


Measured memory_bytes: 8444
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val q = sc.nextInt()
    val s = sc.next()

    val count = IntArray(s.length)

    (1 until count.size).forEach {
        val ac = s[it - 1] == 'A' && s[it] == 'C'
        count[it] = count[it - 1] + (if (ac) 1 else 0)
    }


    repeat(q) {
        val cl = count[sc.nextInt() - 1]
        val rl = count[sc.nextInt() - 1]
        println(rl - cl)
    }
}

Measured memory_bytes: 74788
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

X,Y=get_i
x=X
ans=0
while x<=Y
    ans+=1
    x*=2
end
puts ans

Measured memory_bytes: 1788
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>	
#define inf INT_MAX
#define INF 9223372036854775807
#define rep(i,n) for(i=0;i<n;i++)

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}

int main(void){
	int x=in(),y=in(),a[]={0,1,2,1,3,1,3,1,1,3,1,3,1};
	puts(a[x]==a[y]?"Yes":"No");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=998244353;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

template<typename T>
struct SegmentTree{
private:
    int n;
    vector<T> node;
    using F=function<T(T,T)>;
    F op;
    T id;
    T get(int a,int b,int k,int l,int r){
        if(b<=l||r<=a)return id;
        if(a<=l&&r<=b){
            return node[k];
        }
        else{
            return op(get(a,b,2*k+1,l,(l+r)/2),get(a,b,2*k+2,(l+r)/2,r));
        }
    }
public:
    SegmentTree(int sz,F op,T id):op(op),id(id){
        n=1;
        while(n<sz)n*=2;
        node.resize(2*n-1,id);
    }
    SegmentTree(const vector<T> & v, F op,T id):SegmentTree(v.size(),op,id){
        for(int i=0;i<v.size();++i){
            node[i+n-1]=v[i];
        }
        for(int i=n-2;i>=0;--i){
            node[i]=op(node[2*i+1],node[2*i+2]);
        }
    }
    void update(int a,T x){
        a+=n-1;
        node[a]=x;
        while(a>0){
            a=(a-1)/2;
            node[a]=op(node[2*a+1],node[2*a+2]);
        }
    }
    T get(int a){
        return node[a+n-1];
    }
    T get(int a,int b){
        return get(a,b,0,0,n);
    }
};

int main(){
    int n;
    cin>>n;
    pair<int,int> p[n];
    rep(i,n){
        int x,d;
        cin>>x>>d;
        p[i]={x,x+d};
    }
    sort(p,p+n);
    auto op=[](int a,int b)->int{
        return max(a,b);
    };
    SegmentTree<int> seg(n,op,-inf);
    for(int i=n-1;i>=0;--i){
        int r=p[i].second;
        int mx=lower_bound(p,p+n,make_pair(r,-inf))-p;
        if(mx!=i+1){
            mx=max(mx,seg.get(i+1,mx));
        }
        seg.update(i,mx);
    }
    ll dp[n+1];
    dp[n]=1;
    for(int i=n-1;i>=0;--i){
        dp[i]=(dp[i+1]+dp[seg.get(i)])%mod;
    }
    cout<<dp[0]<<endl;
}

Measured memory_bytes: 5376