akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

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

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const ll mod = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool fl = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
string abc = "abcdefghijklmnopqrstuvwxyz";
struct edge { ll to, cost; };
struct edge1 { ll from, to, cost; };
double pai = 3.141592653589793;

int main() {
	ll x, sum = 0;
	cin >> x;
	for (int i = 1;i < 100000;i++) {
		sum += i;
		if (x <= sum) {
			cout << i << endl;
			exit(0);
		}
	}
}

Measured memory_bytes: 256
import math

def factorize(n):
    p = n
    while True:
        if p % 2 == 0:
            p //= 2
            yield 2
        else:
            break

    r = 3
    while r < int(math.sqrt(p)+1):
        if p % r == 0:
            p //= r
            yield r
        else:
            r += 2

    if p != 1:
        yield p

n = int(input())
l = factorize(n)

print(str(n)+":",*list(l))

Measured memory_bytes: 7780
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int arr[3];
  int f=0;
  int s=0;
  for(int i=0;i<3;i++) {
    cin>>arr[i];
    if(arr[i]==5) 
      f++;
    else if(arr[i]==7) 
      s++;
    }
    if(f==2 && s==1) 
      cout<<"YES";
    else cout<<"NO";
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int taro[110],hanako[110];

int main() {
	int n,m;
	while(n=in(),m=in()){
		int i;
		int sumt=0,sumh=0;
		for(i=0;i<n;i++){
			cin>>taro[i];
			sumt+=taro[i];
		}
		for(i=0;i<m;i++){
			cin>>hanako[i];
			sumh+=hanako[i];
		}
		int j;
		int rest=1000,resh=1000;
		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				if(sumt-taro[i]+hanako[j]==sumh-hanako[j]+taro[i]){
					if(rest>taro[i]){
						rest=taro[i];
						resh=hanako[j];
					}
				}
			}
		}
		if(rest!=1000)cout<<rest<<" "<<resh<<endl;
		else cout<<-1<<endl;
	}
	return 0;
}

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

int main()
{
    string s;
    cin>>s;
    if(s=="Sunny"){
        cout<<"Cloudy"<<endl;
    }
    else if(s=="Cloudy"){
        cout<<"Rainy"<<endl;
    }
    else{
        cout<<"Sunny"<<endl;
    }

    return 0;
}


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

using namespace std;

#define mz 1000000007
#define pq priority_queue

struct Edge
{
    long long dis;
    int to;
}temp;
long long dis[100005];
vector <Edge> vec[100005];
bool flag=0;

void dfs(int x,long long y)
{
    dis[x]=y;
    for(int i=0;i<vec[x].size();i++)
    {
        if(dis[vec[x][i].to]==-mz)
            dfs(vec[x][i].to,dis[x]+vec[x][i].dis);
        else
        {
            if(dis[x]+vec[x][i].dis!=dis[vec[x][i].to])
                flag=1;
        }
    }
}

int main()
{
    int n,m,l,r;
    long long d;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        dis[i]=-mz;
    while(m--)
    {
        scanf("%d%d%lld",&l,&r,&d);
        temp.to=r;
        temp.dis=d;
        vec[l].push_back(temp);
        temp.to=l;
        temp.dis=-d;
        vec[r].push_back(temp);
    }
    for(int i=1;i<=n;i++)
    {
        if(dis[i]==-mz)
            dfs(i,0);
    }
    if(flag)
        printf("No\n");
    else
        printf("Yes\n");
	return 0;
}


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

#define fo(i, n) for(ll i = 0; i < n; i++)
#define endl "\n"
#define of(i, n) for(ll i = n - 1; i >= 0; i--)
#define ll long long
#define vec vector<ll>
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define rep(i,j,n) for (int i = j; i <= n; ++i)
ll mod= 1e9+7;


int dx[4]={0,-1,0,1};
int dy[4]={1,0,-1,0};
int vis[600][600];
int cnt=0,k;
ll n,m;
//int a[600][600];
vector<string> v;
vector<pair<int,int> > str;
int cnt2=0;
bool check(int x,int y){
    if(x<n && x>=0 && y<m && y>=0)return 1;
    return 0;
}

void dfs(int x,int y)
{
    vis[x][y]=1;
    cnt++;
    //cout<<cnt<<" "<<x<<" "<<y<<endl;
    if(v[x][y]=='.' && cnt>cnt2-k)
    {
        //cout<<cnt<<" "<<x<<" "<<y<<endl;
        str.push_back(make_pair(x,y));
    }
    rep(i,0,3)
    {
        int xx = x+dx[i];
        int yy = y+dy[i];
        if(check(xx,yy) && vis[xx][yy]==0)
        {
            if(v[xx][yy]=='.') dfs(xx,yy);
        }
    }



}

int main()
{
	int n;
	cin>>n;
	n=n%10;
	if(n==3) cout<<"bon"<<endl;
	else if(n==0 || n==1 || n==6 || n==8) cout<<"pon"<<endl;
	else cout<<"hon"<<endl;


}


Measured memory_bytes: 3588
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef unsigned long long ll;
#define MAX_N 100

char field[MAX_N][MAX_N];

int main()
{
	int h,w;
	cin>>h>>w;
	rep(i,h){
		rep(j,w) cin>>field[i][j];
	}
	rep(i,h){
		rep(j,w) cout<<field[i][j];
		cout<<endl;
		rep(j,w) cout<<field[i][j];
		cout<<endl;
	}

	return 0;
}



Measured memory_bytes: 256
n,m = map(int,input().split())
H = list(map(int,input().split()))
G = [[] for _ in range(n)]
for i in range(m):
  a,b = map(int,input().split())
  G[a-1].append(H[b-1])
  G[b-1].append(H[a-1])

ans = 0  
for i in range(n):
  if len(G[i])==0:
    ans += 1
  else:
    if H[i] > max(G[i]):
      ans += 1

print(ans)  

Measured memory_bytes: 23076
import sys

def readinput():
    n=int(input())
    nMat=[]
    for _ in range(n):
        m=list(map(int,input().split()))
        nMat.append(m)
    
    return n,nMat

WHITE=0
GRAY=1
BLACK=2
INFTY=sys.maxsize
def prim(n,nMat):

    color=[WHITE]*n
    d=[INFTY]*n
    p=[-1]*n

    d[0]=0
    p[0]=-1

    while True:
        mincost=INFTY
        for i in range(n):
            if color[i]!=BLACK and d[i] < mincost:
                mincost=d[i]
                u=i

        if mincost==INFTY:
            break

        # Tに属する頂点とV-Tに属する頂点をつなぐ辺の中で最小のコストのもの(u,p[u])が選ばれた
        color[u]=BLACK

        # V-Tに属する各頂点vとTに属する頂点をつなぐ辺の中で最小のコストのものが(v,p[v])でそのコストがd[v]
        # uがTに入ったことで辺(u,v)のコストとd[v]を比べてd[v]が大きかったらp[v]=u, d[v]=辺(u,v)のコストで更新
        for v in range(n):
            if color[v]!=BLACK and nMat[u][v]!=-1:
                if nMat[u][v]<d[v]:
                    d[v]=nMat[u][v]
                    p[v]=u
                    color[v]=GRAY
    return p,d


def main(n,nMat):
    p,d=prim(n,nMat)
    
    ans=0
    for i in range(n):
        if p[i] != -1:
            ans+=d[i]
    
    return ans

if __name__=='__main__':
    n,nMat=readinput()
    ans=main(n,nMat)
    print(ans)



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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int R, G, B, N; cin >> R >> G >> B >> N;
  int result = 0;
  for (int i=0; R*i<=N; i++) {
    for (int j=0; R*i+G*j<=N; j++) {
      if ((N-R*i-G*j)%B==0) result++;
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

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

    for(ll i=0; i<8; i++){
        if(n < pow(2, i)){
            cout << (ll)pow(2, i-1) << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

double dp[301][301][301] = {};
int one = 0, two = 0, three = 0;
int n = 0;

double memo(int x, int y, int z)
{
  if (x > n || y > n || z > n || x < 0 || y < 0 || z < 0)
    return 0;
  if (x == 0 && y == 0 && z == 0)
    return 0;
  if (dp[x][y][z] != 0)
    return dp[x][y][z];

  double tmp = 1.0;
  if (y != n && x != 0)
    tmp += ((double)x / n) * memo(x - 1, y + 1, z);
  if (z != n && y != 0)
    tmp += ((double)y / n) * memo(x, y - 1, z + 1);
  if (z != 0)
    tmp += ((double)z / n) * memo(x, y, z - 1);
  tmp *= (double)n / (x + y + z);
  dp[x][y][z] = tmp;
  return tmp;
}

int main()
{
  cin >> n;
  double a[300] = {};
  REP(i, n)
  {
    cin >> a[i];
    if (a[i] == 1)
    {
      one += 1;
    }
    else if (a[i] == 2)
    {
      two += 1;
    }
    else if (a[i] == 3)
    {
      three += 1;
    }
  }

  cout << fixed << setprecision(10) << memo(three, two, one) << endl;
}


Measured memory_bytes: 213248
import java.util.*;
public class Main {
	
	void doIt() {
		Scanner stdIn = new Scanner(System.in);
		while(true) {
			int N = stdIn.nextInt();
			int P = stdIn.nextInt();
			if(N == -1 && P == -1) break;
			
			ArrayList<Integer> list = new ArrayList<Integer>();
			int num = N;
			
			//せっきーの方法
			while(list.size() < 100) {
				boolean flag = true; //素数であると仮定
				if(N == 1) flag = false;
				for(int c = 2; c * c <= N; c++) {
					if(N % c == 0) {
						flag = false;
						break;
					}
				}
				if(flag) list.add(N);
				N++;
			}
			
			
			
			for(int r = 0; r < list.size(); r++) {
				if(list.get(r) > num) { 
					num = r; //添字にする 
					break;
				}
			}
			
			ArrayList<Integer> output = new ArrayList<Integer>();
			for(int r = num; r < list.size(); r++) {
				for(int c = r; c < list.size(); c++) {
					output.add(list.get(r) + list.get(c));
				}
			}
			Collections.sort(output);
			System.out.println(output.get(P - 1));
		}
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
}

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

int main(void) {
    int day;
    string c;
    cin>>day;

    if(day==25){
        c = "Christmas";
    }else if(day==24){
        c = "Christmas Eve";
    }else if(day==23){
        c = "Christmas Eve Eve";
    }else{
        c = "Christmas Eve Eve Eve";
    }

    cout<<c<<endl;

    return 0;
}

Measured memory_bytes: 256
module Main where

import Data.List
import Control.Monad
import Debug.Trace
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as = let
    (fo, la) = span f as
    las = case la of
        [] -> []
        xs -> split f $ tail xs
    in
        case fo of
            [] -> las
            xs -> xs : las

solve :: String -> Int
solve slimes = let
    acc = (0, '0')
    f (cnt, prevColor) currentColor = if prevColor == currentColor then (cnt, prevColor) else
            (cnt + 1, currentColor) 
    in
        fst $ foldl' f acc slimes
    

main = do
    _ <- getLine
    slimes <- getLine
    print $ solve slimes


Measured memory_bytes: 4988
import java.util.Scanner;
import java.util.stream.Stream;

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

        int[] houses = Stream.of(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();

        int min;
        int max;
        if (houses[0] < houses[1]) {
            min = houses[0];
            max = houses[1];
        } else {
            min = houses[1];
            max = houses[0];
        }

        for (int i = min; i <= max; i++) {
            if (i == houses[2]) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");
    }
}


Measured memory_bytes: 28884
/**
 *    author        : Sudipta Banik Trisha 
 *    created       : August 07, 2020 1:51 PM
 *    Problem Name  : B - Frog 2
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/dp/tasks/dp_b
 *    @genarated by : ai-virtual-assistant
**/

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

int main(){
    ios_base::sync_with_stdio(false);

    int n,k;
    cin >> n >> k;

    vector<int>v(n);

    for(int i=0; i<n; i++){
        cin >> v[i];
    }

    int dp[n+1] = {0};

    for(int i=1; i<n; i++){
        dp[i] = dp[i-1] + abs(v[i] - v[i-1]);
        for(int j=i-1; j>= max(0,i-k); j--){
            dp[i] = min(dp[i], abs(v[i]-v[j])+dp[j]);
        }
    }

    cout << dp[n-1] << endl;

    return 0 ;


}


Measured memory_bytes: 4052
{-# LANGUAGE OverloadedStrings #-}
import Data.Char
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

main :: IO()
main = do
  getLine
  ns <- map (`div` 400) <$> getIntList
  let (ps, qs) = partition (< 8) ns
  let n = length . group . sort $ ps
  let m = length qs
  putStrLn . unwords . map show $ [max n 1, n + m]

readInt :: BS.ByteString -> Maybe (Int, BS.ByteString)
readInt = BS.readInt . BS.dropWhile isSpace

getIntList :: IO [Int]
getIntList = map (fst .fromJust . BS.readInt) . BS.words <$> BS.getLine


Measured memory_bytes: 508
import Data.Char
import Data.Monoid
import qualified Data.ByteString.Char8 as BS

main = do
  [n,k] <- map (read . BS.unpack) . BS.words <$> BS.getLine
  s <- BS.getLine
  BS.putStrLn $ BS.take (k - 1) s <> BS.singleton (toLower $ BS.index s (k - 1)) <> BS.drop k s


Measured memory_bytes: 380
#include <stdio.h>

int main(void){
	int n, i, x;
	scanf("%d", &n);

	for(i=3; i<=n; i++){
		x = i;
		if(i%3==0)
			printf(" %d", i);
		else 
			while(x>0){
				if(x%10==3){
					printf(" %d", i);
					break;
				}
			x /= 10;
		}

	}
	printf("\n");

	return 0;
}

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

int main(void) {
  ll N;
  cin >> N;
  vector<ll> A(N), B(N);
  REP(i, 0, N) cin >> A[i] >> B[i];

  bool ok = true;
  REP(i, 0, N) ok = ok && A[i] == B[i];
  if(ok) {
    cout << 0 << endl;
    return 0;
  }

  bool t = true;
  REP(i, 0, N) ok = ok && A[i] >= B[i];
  if(t) {
    ll ans = accumulate(A.begin(), A.end(), 0LL);
    cout << endl;
  }

  ll ans = 0;
  vector<ll> cand;
  REP(i, 0, N) {
    if(A[i] <= B[i]) {
      ans += B[i];
    } else {
      cand.push_back(B[i]);
    }
  }
  sort(cand.begin(), cand.end());
  REP(i, 1, cand.size()) ans += cand[i];
  cout << ans << endl;
}


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

#define endl '\n'
#define ll long long


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int x;
	cin >> x;
	if(x==1) cout << 0 << endl;
	else cout << 1 << endl;
	
	return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
 
  
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int d,n;
	
	cin>>d>>n;
  long int ans = pow(100,d);
	if(n==100){
		ans *= 101;
	}
	else{
      ans *= n;
	}
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
  
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    int N, K; cin >> N >> K;
    string s; cin >> s;
    s = '1' + s + '1';

    vector<pair<int, int>> sec; // a vector which has <left end, right end> of continuous 0 range
    sec.push_back({0,0}); // sentinel
    bool zero = false;
    int left, right;
    for(int i=1; i<=N+1; i++){
        if(zero==false && s[i]=='0'){
            zero = true;
            left = i;
        } else if(zero==true && s[i] == '1'){
            zero = false;
            right = i-1;
            sec.push_back({left, right});
        }
    }
    sec.push_back({N+1, N+1}); // sentinel


    if(sec.size()-2 <= K){ // I can change all 0 to 1
        cout << N << endl;
    } else {
        int ans = 0;
        for(int i=1; i<=sec.size()-1-K; i++){
            ans = max(ans, sec[i+K].first-sec[i-1].second-1);
        }
        cout << ans << endl;
    }

}

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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ll n,x;
  cin >> n >> x;
  if( 1 < x && x < 2*n-1)  cout << "Yes" << endl;
  else {
    cout << "No" << endl; return 0;
  }

  if(n == 2){
    cout << 1 << endl;
    cout << 2 << endl;
    cout << 3 << endl;
    return 0;
  }
  VI num;
  deque<int> qu;

  if(x == 2){
    qu.push_back(x+1);
    qu.push_back(x);
    qu.push_back(x-1);
    qu.push_back(x+2);
    FOR(i,1,2*n){
      if(i == x-1 || i == x+1 ||
         i == x   || i == x+2 ){
           // already pushed
           continue;
         }
      if(i%2) qu.push_front(i);
      else    qu.push_back(i);
    }
  }else{
    qu.push_back(x-1);
    qu.push_back(x);
    qu.push_back(x+1);
    qu.push_back(x-2);
    FOR(i,1,2*n){
      if(i == x-1 || i == x+1 ||
         i == x   || i == x-2 ){
           // already pushed
           continue;
         }
      if(i%2) qu.push_front(i);
      else    qu.push_back(i);
    }
  }

  while(qu.empty() == false){
    cout << qu.front() << endl;
    qu.pop_front();
  }
  return 0;
}


Measured memory_bytes: 2304
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	c := make([]int, 1, n+1)
	for i := 0; i < n; i++ {
		x := intScanner()
		if x != c[len(c)-1] {
			c = append(c, x)
		}
	}
	n = len(c)
	dp := make([]int, n)
	cs := make([]int, 2*100000+1)
	dp[0] = 1
	cs[0] = 1
	for i := 1; i < n; i++ {
		cs[c[i]] += dp[i-1]
		cs[c[i]] %= mod
		dp[i] = cs[c[i]]
	}
	fmt.Println(dp[n-1])
}


Measured memory_bytes: 8060
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    int a=scan.nextInt();
    int b=scan.nextInt();
    for(int x=b-a+1; x<b+a; x++){
      System.out.print(x+" ");
    }
  }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ld PI = acos(-1.0);
const ll LINF = (ll)1e18 + 5;
const int INF = (int)1e9 + 5;

template<class T>
T sqr(T x) { return x * x; }

template<class T>
T abs(T x) { return x < 0 ? -x : x; }

template<class T>
ll round(T x) { return x < 0 ? x - 0.5 : x + 0.5; }

template<class T>
bool chmin(T & x, const T & y) {
	if (y < x) {
		x = y;
		return true;
	}
	return false;
}

template<class T>
bool chmax(T & x, const T & y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}


template<class P, class Q>
ostream & operator <<(ostream & os, const pair<P, Q> & p) {
	return os << "(" << p.first << ", " << p.second << ")";
}

template<class T>
ostream & operator <<(ostream & os, const vector<T> & v) {
	bool was = false;
	os << "{";
	for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); it++) {
		if (was) {
			os << ", ";
		}
		else {
			was = true;
		}
		os << *it;
	}
	os << "}";
	return os;
}

template<class T>
ostream & operator <<(ostream & os, const set<T> & v) {
	bool was = false;
	os << "{";
	for (typename set<T>::const_iterator it = v.begin(); it != v.end(); it++) {
		if (was) {
			os << ", ";
		}
		else {
			was = true;
		}
		os << *it;
	}
	os << "}";
	return os;
}

template<class T>
ostream & operator <<(ostream & os, const multiset<T> & v) {
	bool was = false;
	os << "{";
	for (typename multiset<T>::const_iterator it = v.begin(); it != v.end(); it++) {
		if (was) {
			os << ", ";
		}
		else {
			was = true;
		}
		os << *it;
	}
	os << "}";
	return os;
}

template<class P, class Q>
ostream & operator <<(ostream & os, const map<P, Q> & v) {
	bool was = false;
	os << "{";
	for (typename map<P, Q>::const_iterator it = v.begin(); it != v.end(); it++) {
		if (was) {
			os << ", ";
		}
		else {
			was = true;
		}
		os << *it;
	}
	os << "}";
	return os;
}

#define all(x) (x).begin(), (x).end()

template<class T>
T nextInt() {
	ll x = 0;
	bool p = false;
	char c;
	do {
		c = getchar();
	} while (c <= 32);
	if (c == '-') {
		p = true;
		c = getchar();
	}
	while (c >= '0' && c <= '9') {
		x = x * 10 + c - '0';
		c = getchar();
	}
	return (p ? -x : x);
}

int main() {
	srand(time(0));

#ifdef LOCAL
	//gen();
	freopen("input.txt", "r", stdin);
#else
	
#endif

	string s;
	cin >> s;
	int k;
	cin >> k;

	int n = (int)s.length();

	for (int i = 0; i < n; i++) {
		if (i + 1 == n) {
			int c = s[i] - 'a';
			c = (c + k) % 26;
			s[i] = c + 'a';
		}
		else {
			int c = s[i] - 'a';
			int need = 0;
			while (c != 0) c = (c + 1) % 26, need++;
			if (need <= k) {
				s[i] = 'a';
				k -= need;
			}
		}
	}

	cout << s << endl;

}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
#define debug(x) cout<<#x<<" "<<x<<endl
const int MAXN=2e5+10;
int n,data[MAXN],nx[MAXN];
typedef long long ll;
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	rep(i,1,n)cin>>data[i];
	rep(i,1,n)nx[i]=i;
	dep(i,n-1,1){
		if((!data[i]) && (!data[i+1])){
			nx[i]=nx[i+1];
		}
	}
	ll ans=0;
	rep(i,1,n){
		int t=i;
		ll sum1=0;
		sum1=data[i];
		t=nx[i];
	//	debug(t);debug(i);
		while(t+1<=n&&(!(sum1&data[t+1]))){
			t++;
			sum1^=data[t];
			t=nx[t];
			
		}
	//	debug(t);debug(i);
		ans+=t-i+1;
	//	ans+=(ll)(t-i+1)*(ll)(t-i+2)/2LL;
	//	i=t;
	//	debug(ans);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 1792
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7

ans = 0

sum_j = [0] * n
sum_tmp = 0

for i in reversed(range(n)):
    sum_tmp += a[i]
    sum_j[i] = sum_tmp

for i in range(n-1):
    ans += a[i] * sum_j[i+1] % mod

print(ans % mod)


Measured memory_bytes: 31748
#include<iostream>
#include<algorithm>
#include<cstdio>

using namespace std;

int n,a[101010]={0},s=0;
int f=0,g=0,c,b;

signed main(){
    cin>>n;
    for(int i=0;i<n;++i){
        cin>>a[i];
        if(a[i]<=0){
            f=1;
            c=i;
        }
        else if(a[i]>=0){
            g=1;
            b=i;
        }
    }
    int m=a[0],k=0,x=a[1],l=1;
    if(f==0&&g==1){
        for(int i=0;i<n;++i){
            if(m>a[i]){
                m=a[i];
                k=i;
            }
            if(x<a[i]){
                x=a[i];
                l=i;
            }
            s+=a[i];
        }
        s-=2*m;
        cout<<s<<endl;
        s=m;
        for(int i=0;i<n;++i){
            if(i!=k&&i!=l){
                printf("%d %d\n",s,a[i]);
                s-=a[i];
            }
        }
        printf("%d %d\n",x,s);
    }
    else if(f==1&&g==0){
        for(int i=0;i<n;++i){
            if(m>a[i]){
                m=a[i];
                k=i;
            }
            if(x<a[i]){
                x=a[i];
                l=i;
            }
            s+=a[i];
        }
        s=-1*s;
        s+=2*x;
        cout<<s<<endl;
        s=x;
        for(int i=0;i<n;++i){
            if(i!=l){
                printf("%d %d\n",s,a[i]);
                s-=a[i];
            }
        }
        //printf("%d %d\n",x,s);
    }
    else{
        for(int i=0;i<n;++i){
            s+=max(a[i],-a[i]);
        }
        cout<<s<<endl;
        for(int i=0;i<n;++i){
            if(i!=c&&i!=b){
                if(a[i]<0){
                    printf("%d %d\n",a[b],a[i]);
                    a[b]-=a[i];
                }
                else{
                    printf("%d %d\n",a[c],a[i]);
                    a[c]-=a[i];
                }
            }
        }
        printf("%d %d\n",a[b],a[c]);
    }
    

    return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
 
#define int long long
 
#define pii pair<int, int>
 
#define x1 x1228
#define y1 y1228
 
#define left left228
#define right right228
 
#define pb push_back
#define eb emplace_back
 
#define mp make_pair                                                                
                                                                                                                                        
#define ff first                                                                  
#define ss second   
 
#define matr vector<vector<int> > 
 
#define all(x) x.begin(), x.end()
 
 
using namespace std;
typedef long long ll; 
typedef long double ld; 
                                                                                                   
const int maxn = 3e5 + 7, mod = 998244353, MAXN = 1e6 + 7;
const double eps = 1e-9;
const ll inf = 1e18; 
mt19937 rnd(time(0));
int n;
int a[maxn];

void solve() { 
    cin >> n; 
    for (int i = 0; i < n; ++i) cin >> a[i];
    int sm = 0; 
    for (int i = 0; i < n; ++i) sm += a[i];
    int ans = inf; 
    int L = 0;
    for (int i = 0; i <= n; ++i) {
        ans = min(ans, abs(L - (sm - L)));
        L += a[i];                 
    }
    cout << ans; 
}                                   
   
signed main() {
#ifdef LOCAL
    freopen("TASK.in", "r", stdin);
    freopen("TASK.out", "w", stdout);
#else 
    
#endif // LOCAL
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20); 
    cout << fixed; 
    int t = 1; 
    for (int i = 0; i < t; ++i) {              
        solve();
    }
    return 0;
}  

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int H,W,K;
int T[3030][3030];
ll dp[3030][3030][4];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W>>K;
	FOR(i,K) {
		cin>>y>>x>>r;
		T[y-1][x-1]=r;
	}
	
	FOR(y,H) FOR(x,W) {
		for(i=2;i>=0;i--) dp[y][x][i+1]=max(dp[y][x][i+1],dp[y][x][i]+T[y][x]);
		
		FOR(i,4) {
			dp[y+1][x][0]=max(dp[y+1][x][0],dp[y][x][i]);
			dp[y][x+1][i]=max(dp[y][x+1][i],dp[y][x][i]);
		}
	}
	
	
	cout<<dp[H][W-1][0]<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 323200
#include<stdio.h>
#include<stdlib.h>
int main(){
  int N,A[100],f=0,temp,i,j,minj;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<=N-1;i++){
    minj=i;
    for(j=i;j<=N-1;j++){
      if(A[j] < A[minj]){
	minj=j;
	  }
    }
    if(A[minj]<A[i]){
    temp=A[i];
    A[i]=A[minj];
    A[minj]=temp;
    f++;
    }
  }
  for(i=0;i<N;i++){
    if(i!=N-1)printf("%d ",A[i]);
    else printf("%d",A[i]);
   }
  printf("\n%d\n",f);
  return 0;
}


Measured memory_bytes: 2044
#include<bits/stdc++.h>
/**CLICK ss---> ctrl+j**/
#define PI 2.0*acos(0.0)
#define ll              long long int
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        ((a)*(b))/gcd(a,b)
#define MOD             1000000007
#define mx              123456789
using namespace std;
void solve()
{
    ll n;
    cin>>n;
    string ans="";
    while(n>0)
    {
        n-=1;
        ans+= char('a'+n%26);
        n/=26;
    }
    for(int i=ans.length()-1; i>=0; i--)
    {
        cout<<ans[i];
    }
    cout<<endl;
}
int main()
{
    int t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3592
s=input()
l=len(s)
max=0
Max=0
i=0
while i < l:
    if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
        i+=1
        max+=1
    else:
        i+=1
        if max>Max:
            Max=max
        max=0
if max>Max:
    Max=max
print(Max)
  

Measured memory_bytes: 3060
N = int(input())
A = []
for i in range(N):
    a = int(input())
    A.append(a)
B = [A[0]]
for i in range(1, N):

    if A[i] > B[-1]:#2分探索でどこかに入れる
        sm = -1
        la = len(B)-1
        
        while sm+1<la:
            mi = (sm+la)//2
            if B[mi]<A[i]:
                la=mi
            else:
                sm=mi
        B[la]=A[i]
        
    else:#Bに追加
        B.append(A[i])

print(len(B))

Measured memory_bytes: 85636
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<class F>auto recursive(F f){return[f](auto...a){return f(f,a...);};}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int p;fixprec(int p):p(p){}}; ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.p);}

/*!* [minmax_assign] *!*/
/*+* 最大値、最小値の代入 *+*/
template<class T>bool max_assign(T&x,const T y){if(x < y) { x = y; return true;} else return false;}
template<class T>bool min_assign(T&x,const T y){if(x > y) { x = y; return true;} else return false;}

int main() {
    int N;
    cin >> N;
    i64 x, y, z = 0;
    cin >> x >> y;
    for(int i = 2; i < N; i++) {
        i64 tmp;
        cin >> tmp;
        z ^= tmp;
    }
    i64 s = x + y;
    i64 ans = -1;
    recursive([&](auto f, int j, i64 r) -> void {
        if ( ((2 * (r & (s - r))) & (1ll << j)) != ((s - z) & (1ll << j)) ) return;
        if(r > x) return;
        if(j > 50) {
            max_assign(ans, r);
            return;
        }
        for(i64 b = 0; b < 2; b++) {
            f(f, j + 1, r | (b << j));
        }
    })(0, 0);
    if(ans <= 0 || ans > x) {
        cout << -1 << endl;
    } else {
        cout << x - ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main(){
    cout<<fixed<<setprecision(12);
    while(1){
        int n;
        double s[1000];
        double sum=0;
        cin>>n;
        if(n==0)break;
        for(int i=0;i<n;i++){
            cin>>s[i];
        }
        for(int i=0;i<n;i++){
            sum+=s[i];
        }
        double avg=sum/n;
        double ans=0;
        for(int i=0;i<n;i++){
            ans+=pow(s[i]-avg,2);
        }
        ans=sqrt(ans/n);
        cout<<ans<<endl;
    }
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    string a, b, c;
    cin >> a >> b >> c;
    int ans = 0;
    for(int i=0; i<n; i++){
        if(a[i] == b[i] && a[i] != c[i]) ans++;
        else if(a[i] == c[i] && a[i] != b[i]) ans++;
        else if(b[i] == c[i] && b[i] != a[i]) ans++;
        else if(a[i] != b[i] && a[i] != c[i] && b[i] != c[i]) ans += 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N;
    int ans = 10000;
    int A;
    cin >> N;
    
    for (int i = 0; i < N; i++){
        int cnt = 0;
        cin >> A;
        
    while (A%2 == 0){
        cnt = cnt + 1;
        A/=2;
    }
    ans = min(ans, cnt);
}
   cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=100010;
int par[maxn],_rank[maxn];
void init(int n){
	for(int i=1;i<=n;i++)
		par[i]=i,_rank[i]=0;
}
int find(int x){
	if(par[x]==x) return x;
	return par[x]=find(par[x]);
}
inline void unite(int x,int y){
	x=find(x),y=find(y);
	if(x==y) return;
	if(_rank[x]<_rank[y]){
		par[x]=y;
	}else{
		par[y]=x;
		if(_rank[x]==_rank[y]) _rank[x]++;
	}
}
inline bool same(int x,int y){
	return find(x)==find(y);
}
int p[maxn];
int main(){
	int n,m,x,y;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d",p+i);
	init(n);
	for(int i=0;i<m;i++){
		scanf("%d%d",&x,&y);
		unite(x,y);
	}
	int ans=0;
	for(int i=1;i<=n;i++)
		if(same(p[i],i))
			ans++;
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;

int main(){

    ll N; cin >> N;

    map<ll, ll > mp;

    for(ll i = 0; i < N; i++){
        ll t = 0; cin >> t;
        mp[t]++;
    }

    ll ans = 0;
    auto begin = mp.begin(), end = mp.end();
    for (auto iter = begin; iter != end; iter++) {
        if(iter->second < iter->first){
            ans += iter->second;
        }else{
            ans += iter->second - iter->first;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 6272
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <stack>

using namespace std;

#define INFint (1<<30)
#define BOUND 27182818284
#define MAT 2

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

ll MOD = 1000000007;
const ll INF = (1ll<<60);
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i=int(a);i<int(b);++i)

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

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

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(int arr[], int n) {
    int result = arr[0];
    for (int i = 1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
int main() {
    double N; cin >> N;
    vector<ll> Sum(N+1,0LL);
    set<ll>st;
    multiset<ll>ms;
    ll ans=0LL;

    st.insert(0);
    ms.insert(0);
    for(int i=1; i<=N; i++){
        int a; cin >> a;
        Sum[i]=Sum[i-1]+a;
        st.insert(Sum[i]);
        ms.insert(Sum[i]);
    }

    for(ll a: st){
        ll i=0;
        i=ms.count(a);
        ans+=i*(i-1)/2;
    }

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

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

int main() {
  int64_t n,a,b;
  
  cin >> n;
  cin >> a;
  cin >> b;
  
  int64_t ans=0;
  
  ans=(n/(a+b))*a; 
  // cout << ans << endl;
  
  if((n%(a+b))>=a){
    ans+=a;
  }else{
    ans+=n%(a+b);
  }
  
  cout << ans << endl;
  
}


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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >>s;
    REP(i, s.size()) {
        cout << "x";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;

int x[100];

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> a;
    rep(i, h) {
        bool ok = true;
        string s;
        cin >> s;
        rep(i, w) {
            if(s[i] != '.') ok = false;
        }
        if(!ok) a.push_back(s);
    }
    int n = a.size();
    rep(j, w) {
        bool ok = true;
        rep(i, n) {
            if(a[i][j] != '.') ok = false;
        }
        if(ok) x[j]++;
    }
    rep(i, n) {
        rep(j, w) {
            if(x[j] != 1) cout << a[i][j];
            else continue;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
#include<numeric>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define rep(i, k) for (i = 0; i < k; i++) 
typedef long long ll;
typedef pair<ll, ll> l_l;
int i, j;

ll b, k, n = 0, z = 0,s, x, y, a[200005] = {};
	vector<ll> v,vec;
int main() {
	cin >> n >> k >> s;
	
	rep(i, n) {
		if (i < k)cout << s << " ";
		else {
			if(s==1000000000)cout << 1 << " ";
			else cout << s+1 << " ";
		}
	}
	return 0;

}


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

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

  int n;
  cin >> n;
  int x[n];
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  sort(x, x+n);
  cout << x[n/2] - x[n/2 - 1] << '\n';
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
using namespace std;

int main(){
  int a, b;
  cin >> a >> b;

  int ans = (b / 100) - (a / 100) + 1;

  if(a > ((a/100)*100) + (((a/100)/10)%10)*10 + (((a/100)/10)/10)){
    ans = ans - 1;
  }

  if(b < ((b/100)*100) + (((b/100)/10)%10)*10 + (((b/100)/10)/10)){
    ans = ans - 1;
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long T,a,b,c,d,g;

long long gcd(long long a,long long b){return b==0?a:gcd(b,a%b);}

int main()
{
	scanf("%lld",&T);
	while (T--)
	{
		scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
		if (a<b) {puts("No"); continue;}
		if (d<b) {puts("No"); continue;}
		if (c>=b-1) {puts("Yes"); continue;}
		long long g=gcd(b,d);
		if (b-c-2>g) {puts("No"); continue;}
		
		a%=b;
		long long x=(b-1-a)/g;
		long long s=a+g*x+g-b;
		long long jijin=a+x*g;
		
		if (jijin>c) {puts("No"); continue;}
		if (s==0) {puts("Yes"); continue;}
		
		long long y=(b-1-jijin)/s;
		jijin=jijin+y*s;
		if (a>c) puts("No");
		else puts("Yes");
	}
}

Measured memory_bytes: 256
n=gets.chomp.to_i
sp_list=[]
for i in 1..n do
  s_p=gets.chomp.split(" ")
  sp_list.push([i,s_p[0],s_p[1].to_i])
end

0.upto(n-2) do |i|
  (n-1).downto(i+1) do |j|
    if sp_list[j-1][1]>sp_list[j][1]
      sp_list[j-1],sp_list[j]=sp_list[j],sp_list[j-1]
    end
    if sp_list[j-1][1]==sp_list[j][1] && sp_list[j-1][2]<sp_list[j][2]
      sp_list[j-1],sp_list[j]=sp_list[j],sp_list[j-1]
    end
  end
end

for i in 0..n-1 do
  puts sp_list[i][0]
end

Measured memory_bytes: 1916
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vl vector<ll>
#define pl pair<ll,ll>
#define TC int t;cin>>t;while(t--)
#define in(n) ll n;cin>>n;
#define inarr(n) ll n;cin>>n;vector<ll>arr;
int main(void){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    in(n);
    string ans="";
    string al = "abcdefghijklmnopqrstuvwxyz";
    vector<ll>check;
    for(int i=1;i<99;i++){
        if(n<=pow(26,i)){
            n--;
            for(int j=0;j<i;j++){
                ans+=al[n%26];
                n/=26;
            }
            break;
        }
        else
            n-=pow(26,i);
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4064
#![allow(unused_imports, unused_variables, dead_code)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

trait InputValue {
    fn parse(s: &str) -> Self;
}

fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn main() {
    let n: usize =read();
    let a: Vec<i32> = readnc();

    let mut best = i32::max_value();
    for to in -100..101 {
        let mut total = 0;
        for &ai in &a {
            total += (to-ai)*(to-ai);
        }
        best = min(best, total);
    }

    println!("{}", best);
}

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

using namespace std;

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

	if( N >= M )
	{
		cout << "0" << endl;
		return 0;
	}

	vector<int> X(M);
	for( int i = 0; i < M; ++i )
	{
		cin >> X[i];
	}

	sort( X.begin(), X.end() );
	vector<int>dif_X( M - 1 );
	for( int i = 0; i < M-1; ++i )
	{
		dif_X[i] = X[i + 1] - X[i];
	}

	sort( dif_X.begin(), dif_X.end() );

	int sum = 0;
	for( int i = 0;i < (dif_X.size()-N+1); ++i )
	{
		sum += dif_X[i];
	}

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a,ll b){
    ll v0=a,v1=b,v2=a%b;
    while(v2!=0){
        v0=v1;
        v1=v2;
        v2=v0%v1;
    }
    return v1;
}

ll lcm(ll a,ll b){
    return (a*b/gcd(a,b));
}

int main(){
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    ll ans=0;
    int y=x/500;
    ans+=1000*y;
    x-=500*y;
    int z=x/5;
    ans+=5*z;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
  

  int main(){
   lint n,m;
   cin>>n>>m;
   lint sum=0;
   rep(i,m){
       lint a;
       cin>>a;
       sum+=a;
   }
   if(sum>n)cout<<-1;
   else cout<<n-sum;  }
  
     


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int N;
    cin >> N;
    vector<int> A(N+1);  // 1-indexed
    rep(i, N) cin >> A[i+1];
    vector<int> ans;
    for (int i = N; i >= 1; i--) {
        int temp = 0;
        for (int j = i; j <= N; j += i) {
            temp ^= A[j];
        }
        if (A[i] ^ temp) A[i] ^= 1;
        if (A[i]) ans.push_back(i);
    }
    cout << sz(ans) << '\n';
    rep(i, sz(ans)) printf("%d\n", ans[i]);
    return 0;
}

Measured memory_bytes: 4708
n, k = map(int, input().split())
d = list(map(int, input().split()))
while True:
    p = 0
    for s in d:
        if str(s) in str(n):
            pass
        else:
            p += 1
    if p==k:
        print(n)
        break
    else:
        n += 1

Measured memory_bytes: 2940