akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

void dfs(int sx,int sy,char stage[12][6],bool toErase[12][6],char color,int* count){
  if(toErase[sy][sx]) return;
  toErase[sy][sx] = true;
  (*count)++;
  for(int i=0;i<4;i++){
    int dx = sx + tx[i];
    int dy = sy + ty[i];
 
    if(dx < 0 || dx >= 6 
       || dy < 0 || dy >= 12) continue;
    if(stage[dy][dx] != color) continue;
         
    dfs(dx,dy,stage,toErase,color,count);
  }
}
 
bool markBlock(bool toErase[12][6],char stage[12][6]){
 
  bool res = false;
  for(int y=0;y<12;y++){
    for(int x=0;x<6;x++){
      if(stage[y][x] == '.'
	 || stage[y][x] == 'O') continue;
 
      if(!toErase[y][x]){
	char color = stage[y][x];
	int count = 0;
	bool tmp[12][6];
	memcpy(tmp,toErase,sizeof(bool)*12*6);
 
	dfs(x,y,stage,toErase,color,&count);
	if(count < 4){
	  memcpy(toErase,tmp,sizeof(bool)*12*6);
	}
	else{
	  res = true;
	}
      }
    }
  }
 
  return res;
}
 
void eraseBlock(bool toErase[12][6],char stage[12][6]){
  for(int x=0;x<6;x++){
    for(int y=0;y<12;y++){
      if(stage[y][x] == '.'){
	toErase[y][x] = true;
	continue;
      }
      if(stage[y][x] == 'O'){
	for(int i=0;i<4;i++){
	  int dx = x + tx[i];
	  int dy = y + ty[i];
	  if(dx < 0 || dx >= 6 
	     || dy < 0 || dy >= 12) continue;
	  if(toErase[dy][dx] == true
                        && stage[dy][dx] != '.'
	     && stage[dy][dx] != 'O'){
	    toErase[y][x] = true;
	  }
	}
      }
    }
  }
 
  char nextStage[12][6];
  for(int x=0;x<6;x++){
    queue<char> que; 
    for(int y=12-1;y>=0;y--){
      if(!toErase[y][x]){
	que.push(stage[y][x]);
      }
    }
 
    int idx = 12-1;
    while(!que.empty()){
      nextStage[idx][x] = que.front();
      que.pop();
      idx--;
    }
    while(idx >= 0){
      nextStage[idx][x] = '.';
      idx--;
    }
  }
 
  memcpy(stage,nextStage,sizeof(char)*12*6);
}
 
void printStage(char stage[12][6]){
  for(int y=0;y<12;y++){
    for(int x=0;x<6;x++){
      printf("%c",stage[y][x]);
    }
    printf("\n");
  }
  printf("\n");
}
 
int main(){
  int n;
 
  while(~scanf("%d",&n)){
    for(int i=0;i<n;i++){
      char stage[12][6];
      bool toErase[12][6];
      memset(toErase,0,sizeof(toErase));
 
      for(int y=0;y<12;y++){
	string str;
	cin >> str;
	for(int x=0;x<6;x++){
	  stage[y][x] = str[x];
	}
      }
 
      //printStage(stage);
      int res = 0;
      while(markBlock(toErase,stage)){
	eraseBlock(toErase,stage);
	memset(toErase,0,sizeof(toErase));
	res++;
	//printStage(stage);
      }
      printf("%d\n",res);
    }
  }
}

Measured memory_bytes: 1232
#include <iostream>
#include <string>
#include <algorithm>

int used[26];

int main() {
	std::string str;
	std::cin >> str;

	int ans = 10000000;
	for (char target = 'a'; target <= 'z'; ++target) {
		auto s = str;
		int res = 0;
		for (; std::count(s.begin(), s.end(), target) != s.size(); ++res) {
			for (int i = 0; i < s.size() - 1; ++i) {
				if (s[i + 1] == target)
					s[i] = target;
			}

			s.pop_back();
		}

		ans = std::min(ans, res);
	}
	
	std::cout << ans << std::endl;
}

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

int main(){
  int64_t N,K;
  cin >> N >> K;
  vector< pair<int,int> > vp(N);
  for(int i=0;i<N;i++){
    cin >> vp.at(i).first >> vp.at(i).second;
  }
  sort(vp.begin(), vp.end());
  int64_t sum=0;
  for(int i=0;i<N;i++){
    sum+=vp.at(i).second;
    if(sum>=K){
      cout << vp.at(i).first << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 1024
// https://atcoder.jp/contests/abc075/tasks/abc075_b
import java.lang.Math.*
import java.util.*

fun makeGrid(H:Int, W:Int): Array<Array<String?>> {
    return Array(H) { arrayOfNulls<String?>(W)}
}

fun main(args: Array<String>) {
    val scn = Scanner(System.`in`)
    val H = scn.nextInt()
    val W = scn.nextInt()

    var grid = makeGrid(H+2,W+2)

    for(i in 1..H){
        grid[i] = scn.next().split("").toTypedArray()
    }

    for(i in 1..H){
        for(j in 1..W){
            if(grid[i][j]=="."){
                var cnt=0
                if(grid[i-1][j-1]=="#") cnt++
                if(grid[i-1][j]=="#") cnt++
                if(grid[i-1][j+1]=="#") cnt++
                if(grid[i][j-1]=="#") cnt++
                if(grid[i][j+1]=="#") cnt++
                if(grid[i+1][j-1]=="#") cnt++
                if(grid[i+1][j]=="#") cnt++
                if(grid[i+1][j+1]=="#") cnt++

                grid[i][j] = cnt.toString()
            }
        }
    }


    for(i in 1..H){
        for(j in 1..W){
            print(grid[i][j])
        }
        println("")
    }
}

Measured memory_bytes: 36208
n=int(input())
string_list=[input() for i in range(n)]
ans=0
for i in range(n-1):
    if string_list[i][-1:] != string_list[i+1][:1] :
        ans +=1
zako =set(string_list)

if len(string_list) == len(zako) and ans==0 :
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include<fstream>
#include<string>
#include<iostream>
#include<sstream>
#include<iterator>
#include<cmath>
#include<stdio.h>

using namespace std;

int main(){
string txt;
 cin >> txt;
 int N = txt.length();
  int n = N/2;
  int i;
  char c;
  char d;
  int t = 0;
  for(i=0;i<n;i++){
   c = txt[i];
   d = txt[N-1-i];
   if(c!=d)t++;}
  cout << t << endl; 
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define N 100000
#define M 50000

int binary_search(int);

int n, s[N], q, t[M];

int main(){
  int c=0,i, j;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&t[i]);
    if( binary_search(t[i])==1)c++;
  }
  printf("%d\n",c);
  return 0;
}
int binary_search(int key){
  int left, right, mid;

  left = 0;
  right = n;
  while( left < right){
    mid = (left + right) / 2;
    if(s[mid] == key) return 1;
    else if(key < s[mid])right = mid;
    else left = mid + 1;
  }
  return 0;
}
	      

Measured memory_bytes: 1184
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}


int main() {
	int a, b, c, d; cin >> a >> b;
	cout << (a + b + 1) / 2;
	
	


	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll N,K;
  cin>>N>>K;
  vector<ll> p(N);
  for(int i=0;i<N;i++)cin>>p.at(i);
  double kitm=0;
  vector<double> ki(N);
  for(int i=0;i<N;i++)ki.at(i)=1.0*(p.at(i)+1)/2.0;
  vector<double>rui(N);
  for(int i=0;i<N;i++){
    if(i==0)rui.at(i)=ki.at(i);
    else rui.at(i)=ki.at(i)+rui.at(i-1);
  }
  for(int i=0;i+K-1<N;i++){
    if(i==0)kitm=max(kitm,rui.at(i+K-1));
    else kitm=max(kitm,rui.at(i+K-1)-rui.at(i-1));
  }
  cout << fixed << setprecision(15) << kitm << endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n;
  cin>>n;
  vector<ll> a(n);
  vector<ll> b(n);
  vector<ll> c(n);
  rep(i,n)
    cin>>a[i]>>b[i]>>c[i];
  vector<ll> dpa(n);
  vector<ll> dpb(n);
  vector<ll> dpc(n);
  dpa[0]=a[0];
  dpb[0]=b[0];
  dpc[0]=c[0];
  repeat(i,1,n) {
    dpa[i]=max(dpb[i-1],dpc[i-1])+a[i];
    dpb[i]=max(dpa[i-1],dpc[i-1])+b[i];
    dpc[i]=max(dpa[i-1],dpb[i-1])+c[i];
  }
  cout << max(max(dpa[n-1],dpb[n-1]),dpc[n-1]) << endl;
  return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;



int main()
{
    int x, y, z;
    cin >> x >> y >> z;
    int ans;
    ans = x/(y+z);
    if((y+z)*ans+z > x) cout << ans-1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<functional>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	int i,j,a[9],flg[9],b,n,f;
	int che[8][3]={{0,1,2},{3,4,5},{6,7,8},
					{0,3,6},{1,4,7},{2,5,8},
					{0,4,8},{2,4,6}};
	for(i=0;i<9;i++)	scanf("%d",&a[i]);
	for(i=0;i<9;i++)	flg[i]=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)	{
		scanf("%d",&b);
		for(j=0;j<9;j++)	{
			if(b==a[j])	flg[j]=1;
		}
	}
	f=0;
	for(i=0;i<8;i++)	{
		if(flg[che[i][0]]==1 && flg[che[i][1]]==1 
		&& flg[che[i][2]]==1)	{
			f=1;	break;
		}
	}
	if(f==1)	printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 1608
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979

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; }

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0;true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void AnsYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void AnsYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}







//ここまでライブラリ
//ここから本文





int main() {
	int n;
	cin >> n;
	string s = to_string(n);
	int sum = 0;
	for (int i = 0; i < s.size(); i++) {
		sum += (s.at(i) - '0');
	}
	AnsYes((n % sum == 0));
}


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

int main(){
  int d,n;
  cin >> d >> n;
  if(d == 0){
    if(n == 100){
      cout << 101 << endl;
    }else{
      cout << n << endl;
    }
  }else if(d == 1){
    if(n == 100){
      cout << 101 * 100 << endl;
    }else{
      cout << n * 100 << endl;
    }
  }else{
    if(n == 100){
      cout << 101 * 10000 << endl;
    }else{
      cout << n * 10000 << endl;
    }
  }
}

Measured memory_bytes: 3524
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int a,b;
cin>>a>>b;
vector<pair<int,int>> vec(a);
for(int i=0;i<a;i++){
	int X,Y;
	cin >> X >> Y;
	vec.at(i) = make_pair(X,Y);
}
  sort(vec.begin(),vec.end());
 	int count = 0;
 	int answer = 0;
 	for(int i = 0;i < a;i++) {
 		if(b - count <= vec[i].second) {
 			answer = vec[i].first;
 			break;
 		}
 		count += vec[i].second;
 	}
  cout << answer << endl;
}


		


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

using namespace std;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,k;
    cin >> n >> k;
    vector<int> a(n+1);
    for(int i=1;i<=n;i++) cin >> a[i];
    for(int i=k+1;i<=n;i++)
    {
        if(a[i]>a[i-k]) cout << "Yes\n";
        else cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 3984
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	sLst := strings.Split(s,"")
	if sLst[0]==sLst[1] || sLst[1]==sLst[2] || sLst[2]==sLst[3] {
		fmt.Println("Bad")
	} else {
		fmt.Println("Good")
	}
}

Measured memory_bytes: 640
def ans_dp(H,W,M):
    dp = [[0 for i in range(W)] for j in range(H)]
    flag = [[0 for i in range(W)] for j in range(H)]
    if M[0][0] == "#":
        dp[0][0] = 1
        flag[0][0] = 1
    else:
        dp[0][0] == 0
    for i in range(1,W):
        if M[0][i] == "#":
            flag[0][i] = 1
            if flag[0][i-1] == 1:
                dp[0][i] = dp[0][i-1]
            else:
                dp[0][i] = dp[0][i-1] + 1 
        else:##M[0][i] = "."
            dp[0][i] = dp[0][i-1]
    for j in range(1,H):
        if M[j][0] == "#":
            flag[j][0] = 1
            if flag[j-1][0] == 1:
                dp[j][0] = dp[j-1][0]
            else:
                dp[j][0] = dp[j-1][0] + 1 
        else:##M[0][i] = "."
            dp[j][0] = dp[j-1][0]
    
    for i in range(1,H):
        for j in range(1,W):
            if M[i][j] == "#":
                flag[i][j] = 1
                dp[i][j] = min(dp[i-1][j]+int(not flag[i-1][j]),dp[i][j-1]+int(not flag[i][j-1]))
            else:#M[i][j] == "."
                dp[i][j] = min(dp[i-1][j],dp[i][j-1])
    return dp[-1][-1]

def main():
    H,W = map(int,input().split())
    M = []
    for i in range(H):
        M.append(list(input()))
    print(ans_dp(H,W,M))
 
if __name__ == "__main__":
    main()

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

using namespace std;

int n, a[100], ans = 1e+9;

int main(){
	cin >> n;
	for(int i = 0; i < n; ++i) cin >> a[i];
	for(int i = -100; i <= 100; ++i){
		int sum = 0;
		for(int j = 0; j < n; ++j) sum += (a[j] - i) * (a[j] - i);
		ans = min(ans, sum);
		}
	cout << ans;
	return 0;
	}


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

const int maxn=250010;

int n,a[maxn],a0[maxn];

int main()
{
#ifdef h10
	freopen("D.in","r",stdin);
	freopen("D.out","w",stdout);
#endif
	int i,j,x,p;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
		scanf("%d",&x),a0[x]=a[x]=i;

	for (i=p=1;i<=n*n;i++)
		if (a0[i])
		{
			int val=a0[i];
			for (j=1;j<val;j++)
			{
				while (a[p]) p++;
				a[p]=val;
			}
			if (p>i) {puts("No"); return 0;}
		}

	for (i=p=n*n;i>=1;i--)
		if (a0[i])
		{
			int val=a0[i];
			for (j=val;j<n;j++)
			{
				while (a[p]) p--;
				a[p]=val;
			}
			if (p<i) {puts("No"); return 0;}
		}

	puts("Yes");
	for (i=1;i<=n*n;i++)
		printf("%d ",a[i]);
}


Measured memory_bytes: 2816
import Data.List
import Data.Function
main :: IO ()
main = do
  n <- read <$> getLine :: IO Int
  [t,a] <- map read . words <$> getLine :: IO [Int]
  hs <- map read . words <$> getLine :: IO [Int]
  let degs = map (\h -> abs $ 1000 * t - 6*h - 1000 * a) hs
      ans = minimumBy (compare `on` snd) $ zip [1..] degs
  print $ fst ans

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    ll N = S.size();
    ll ans = INF;
    ll cnt = 0;
    rep(i,0,N){
        if(i % 2 == 0){
            if(S[i] == '1'){
                cnt++;
            }
        }else{
            if(S[i] == '0'){
                cnt++;
            }
        }
    }
    ans = cnt;
    cnt = 0;
    rep(i,0,N){
        if(i % 2 == 0){
            if(S[i] == '0'){
                cnt++;
            }
        }else{
            if(S[i] == '1'){
                cnt++;
            }
        }
    }
    ans = min(ans, cnt);
    print(ans);

    
    
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/







int N, K;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> K;

    int ma = (N + 1) / 2;
    if (K <= ma) printf("YES\n");
    else printf("NO\n");
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int ara[5],i;
    for (i=0;i<3;i++)
        cin>>ara[i];
    sort(ara,ara+3);
    for (i=0;i<3;i++)
    {
        cout<<ara[i];
        if (i<2)
            cout<<" ";
    }
    cout<<endl;

}


Measured memory_bytes: 3136
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        //aの入力
        int a = Integer.parseInt(sc.next());
        //bの入力
        int b = Integer.parseInt(sc.next());
        int x = a * b;
        if(x % 2 == 0){
            System.out.println("Even");
        }else{
            System.out.println("Odd");;
        }
        sc.close();
    }
}

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

typedef long long ll;
#define REP(i,n) for(int(i)=0;(i)<(n);++(i))

int main () {
  int h, w, n;
  cin >> h >> w;
  cin >> n;
  
  int a[n];
  REP(i,n) cin >> a[i];
  queue<int> q;
  REP(i,n) {
    REP(j,a[i]) {
      q.push(i+1);
    }
  }
  
  int c[h+1][w+1];  
  for (int j = 1; j <= h; j++) {
    if (j % 2 == 1) {
      for (int k = 1; k <= w; k++) {
        c[j][k] = q.front();
        q.pop();
      }
    } else {
      for (int k = w; k >= 1; k--) {
        c[j][k] = q.front();
        q.pop();
      }
    }
  }
  
  for (int j = 1; j <= h; j++) {
    for (int k = 1; k <= w; k++) {
      cout << c[j][k];
      if(k == w) cout << endl;
      else cout << " ";
    }
  }
}

Measured memory_bytes: 384
n = gets.to_i
s = gets.chomp
if n % 2 == 0
  l = n / 2
  ans = s.split(/\A(.{1,#{l}})/, 2)[1..-1]
end
if n % 2 == 1
  puts "No"
else
  if ans[0] == ans[1]
    puts "Yes"
  else
    puts "No"
  end
end



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

#define int           long long 
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (int)(1e9)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){ cerr << name << " = " << arg1 << endl;}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args)
{ const char *name = strchr(names, ',');cerr.write(names, name-names) << " = " << arg1 << endl;_F(name+2, args...);}

template< typename T1, typename T2 > istream& operator>>(istream& in, pair<T1, T2> &q){ in >> q.F >> q.S; return in;}
template< typename T1, typename T2 > ostream& operator<<(ostream& out, pair<T1, T2> &q){ out << q.F << " " << q.S; return out;}
template< typename T1, typename T2 > pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F+p2.F, p1.S+p2.S};}
template< typename T1, typename T2 > pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F-p2.F, p1.S-p2.S};}
template< typename T1, typename T2 > bool operator<(pair<T1, T2> p1, pair<T1, T2> p2){ return p1 < p2 ;}

template<typename T> void Unique(vector<T> &v){
    sort(all(v)), v.resize(distance(v.begin(), unique(all(v))));
}

void solve(int &test) {
    int n; cin >> n;
    vi ans;
    while(n){
        n--;
        ans.pb(n%26);
        n /= 26;
    }
    reverse(all(ans));
    for(auto u : ans){
        cout << (char)(u+'a');
    }
    cout << endl;

}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   

    int t = 1;

    start = clock(); 

    cout << fixed << setprecision(20);
    
    
   
    // cin >> t;
     
    for(int i = 1; i <= t; ++i){
        solve(i);
    }
    //cerr << time(start);
    return 0;
}

Measured memory_bytes: 3672
#include<stdio.h>
int main(void)
{
	int h,w,i,j;
	while(1)  {
		scanf("%d %d",&h,&w);
		if(h==0 && w==0) break;
		for(i=0;i<h;i++)  {
			for(j=0;j<w;j++)  {
				if(i==0 || i==h-1 || j==0 || j==w-1){
					printf("#");
				}
				else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	
	return 0;
}



Measured memory_bytes: 2028
import std.stdio;
import std.array;
import std.algorithm;
import std.string;
import std.conv;

void main(){
    int[10] height;
    foreach(int i ; 0 .. 10){
        height[i] = to!int(readln().chomp());
    }
    height.sort;
    writef("%d\n%d\n%d\n", height[9], height[8], height[7]);
}

Measured memory_bytes: 1052
//#include<bits\stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<algorithm>	
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long
#define db double
#define ld long double
#define put(x) printf("%d\n",x)
#define min(x,y) ((x)>(y)?(y):(x))
#define max(x,y) ((x)>(y)?(x):(y))
#define EPS 1e-8
#define mod 1000000007
#define INF 10000000000000000ll
using namespace std;
char buf[1<<15],*fs,*ft;
inline char getc()
{
	return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline int read()
{
	int x=0,f=1;char ch=getc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
	return x*f;
}
const int MAXN=100010;
char a[2];
int main()
{
	//freopen("1.in","r",stdin);
	scanf("%s",a+1);
	printf("%c",(char)(a[1]+1));
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define rt0 return 0;
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(){
    int n, m, x;
    cin >> n >> m >> x;
    vvi a(n, vi(m));
    vi c(n);
    rep(i, n){
        cin >> c[i];
        rep(j, m) cin >> a[i][j];
    }
    int ans = 12345678;
    int all = 1<<n;
    

    rep(mask, all){
        vi level(m);
        int cost = 0;
        
        rep(i, n){
            if((mask>>i)&1){
                cost += c[i];
                rep(j, m){
                    level[j] += a[i][j];
                }
            }
        }
        
        bool ok = true;
        rep(j, m){
            if(level[j] < x) ok = false;
        }
        if(ok) ans = min(ans, cost);
    }

    if(ans == 12345678) mes(-1);
    else mes(ans);
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,a[N],dp[N];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	dp[0]=0;
	dp[1]=abs(a[0]-a[1]);
	for(int i=2;i<n;i++)
	{
		dp[i]=min(dp[i-1]+abs(a[i-1]-a[i]),dp[i-2]+abs(a[i-2]-a[i]));
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  int a=0,b=0;
  for(int i=0;i<s.size();i++)
  {
    if(s[i]=='A')
      a++;
    else
      b++;
  }
  if(a==3 || b==3)
    cout<<"No"<<endl;
  else
    cout<<"Yes"<<endl;}

Measured memory_bytes: 3600
//g++ -std=c++14 test.cpp -o test.out
//問題URL
//https://atcoder.jp/contests/abc165/tasks/abc165_e

//参考；
//https://www.youtube.com/watch?v=C5_NnCp1CRI&feature=youtu.be

//円形に1~Nを配置し、ペアを線で結んで作っていく考え方

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N,M;

vector<pair<LL,LL>> ans;

void solve(){
	if(N%2==1){
		for(int i=1;i<=M;i++){
			ans.push_back(pair<LL,LL>(i+1,N-i+1));
		}
	}else{
		for(int i=1;i<=M;i++){
			if(N-i*2>N/2) ans.push_back(pair<LL,LL>(i+1,N-i+1));
			else ans.push_back(pair<LL,LL>(i+1,N-i));
		}
	}
}

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

    solve();

	for(int i=0;i<ans.size();i++)cout << ans[i].first << " " << ans[i].second << endl;
    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define MOD ((int)(1e9) + 7)
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define filename "lynext"
#define freop freopen(filename ".cik","w",stdout);freopen(filename ".gir","r",stdin)
const long long int N = ((long long int)4e3) + 5;
const long long int M = ((long long int)1e3) + 5;
const long long int llinf = (long long int)1e18;
const int inf = INT_MAX;
typedef long long int lli;

lli n;
lli arr[N];
lli tot;
lli dp[N][N];

lli f (lli alinanLeft, lli alinanRight, bool taro, lli a)
{
	if (dp[alinanLeft][alinanRight] != -1)
		return dp[alinanLeft][alinanRight];
	if (a == n)
		return 0;
	if (taro)
	{
		return dp[alinanLeft][alinanRight] = max(f(alinanLeft, alinanRight + 1, false, a + 1) + arr[n - alinanRight - 1],f(alinanLeft + 1,alinanRight,false, a + 1) + arr[alinanLeft]);
	}
	else
	{
		return dp[alinanLeft][alinanRight] = min(f(alinanLeft, alinanRight + 1, true,a + 1),f(alinanLeft + 1,alinanRight,true,a + 1));
	}
	return -1;
}

int main ()
{
	fast;
	//freop;
	cin >> n;
	memset(dp, -1, sizeof dp);
	for (int i = 0; i < n; i++)
		cin >> arr[i],tot += arr[i];
	lli ans = f(0,0,true,0);
	//cout << "Taro : " << ans << "\n";
	//cout << "Jiro : " << tot - ans << "\n";
	cout << ans - (tot - ans) << "\n";
}


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

typedef long long ll;
typedef double ld;
typedef pair <ll, ll> pll;

#define pb push_back
#define mp make_pair
#define all(_c) _c.begin(), _c.end()

const int MOD = 1e9 + 7;

string k;
int dp[10001][100][2], d, n;

int f(int i, int rem, int sm) {
    if (i == n) {
        return rem == 0;
    }

    int& ret = dp[i][rem][sm];
    if (ret != -1)
        return ret;

    ret = 0;

    if (sm) {
        for (int j = 0; j <= 9; j++)
            ret = (ll(ret) + f(i + 1, (rem + j) % d, 1)) % MOD;
    } else {
        int dig = (k[i] - '0');
        for (int j = 0; j < dig; j++)
            ret = (ll(ret) + f(i + 1, (rem + j) % d, 1)) % MOD;
        ret = (ll(ret) + f(i + 1, (rem + dig) % d, 0)) % MOD;
    }

    return ret;
}

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

    cin >> k >> d;
    n = k.length();

    memset(dp, -1, sizeof dp);
    cout << (f(0, 0, 0) - ll(1) + MOD) % MOD << '\n';
    return 0;
}


Measured memory_bytes: 8832
#include <cstdio>

int main(){
    int n;
    scanf("%d",&n);
    for(int x = 1;x <= n;x++){
    int a = x / 10;
    int b = x / 100;
    int c = x / 1000;
        if(x % 3 == 0){printf(" %d",x);}
        else if(a ==3 || b == 3 || c == 3){printf(" %d",x);}
        else if(x % 10 == 3 || a % 10 == 3 || b % 10 == 3 || c % 10 == 3){printf(" %d",x);}
    }
            printf("\n");
return 0;
}


Measured memory_bytes: 2740
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<=n;++i)
int main(){
  int a,b,c;cin>>a>>b>>c;
  if(a+b+c>21){
    cout<<"bust"<<endl;
  }
  else{
    cout<<"win"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define mod 1000000000
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define pi 3.14159
ll power(ll a,int n){
  if(n==0)
    return 1;
  if((n%2)==0)
    return power(a*a,n/2);
  else
    return a*power(a*a,n/2);    
}
vector<bool> mark;
void seive(ll N){
    mark.resize(N+1);
  for(ll i=2;i*i<=N;i++){
    if(!mark[i]){
       for(ll j=i*i;j<=N;j+=i){
         mark[j]=1;
       }
      }
  }
}
//vector<int> a1(150002),a2(150002);
int main(){
FASTIO
string s;
cin>>s;
string t;
cin>>t;
bool is=true;
for(int i=0;i<s.size();i++){
   if(s[i]!=t[i]){
    is=false;
    break;
   }
}
if(is){
  cout<<"Yes";
}
else
cout<<"No";
return 0;
}


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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line = reader.readLine();
        double r = Double.parseDouble(line);
        double area = Math.PI*r*r;
        double l = 2*Math.PI*r;

        System.out.printf("%f %f\n",area, l);
    }
}


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

/* define const */
const int M5 = 100000;
/* finish defineing const */

int T[110] = {};
int P[110] = {};
int X[110] = {};

int main()
{
  int n,m;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> T[i];
  //  for (int i = 0; i < n; i++) cout << "~" << T[i] << endl;
  cin >> m;
  for (int i = 0; i < m; i++) cin >> P[i] >> X[i];
  // finish inputting
  
  for (int i = 0; i < m; i++) {
    long sum = 0;
    for (int j = 0; j < n; j++) {
      if (j == (P[i]-1)) {
	//	cout << "=" << X[i] << endl;
	sum += X[i];
      }
      else {
	//	cout << "=="<< i << ":" << T[j] << endl;
	sum += T[j];
      }
    }
    cout << sum << endl;
  }
  
}


Measured memory_bytes: 256
#-*-coding:utf-8-*-

import sys

def main():
    n = int(input())
    answer_list=[]
    answer_list=[input() for _ in range(n)]
    AC=0
    WA=0
    TLE=0
    RE=0
    for answer in answer_list:
        if "AC" == answer:
            AC+=1
        elif "WA" == answer:
            WA+=1
        elif "TLE"==answer:
            TLE+=1
        elif "RE"==answer:
            RE+=1
    print("AC x {}".format(AC))
    print("WA x {}".format(WA))
    print("TLE x {}".format(TLE))
    print("RE x {}".format(RE))

if __name__ == "__main__":
    main()

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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int num[9];
  rep(i, 9) cin >> num[i];
  vint vec;
  rep(i, 9) vec.push_back(i+1);
  int ans = 0;
  do {
    bool flag = true;
    rep(i, 9) if(num[i] != -1 && num[i] != vec[i]) flag = false;
    if(!flag) continue;
    int a = vec[0];
    int bc = vec[1]*10 + vec[2];
    int def = vec[3]*100 + vec[4]*10 + vec[5];
    int ghi = vec[6]*100 + vec[7]*10 + vec[8];
    if(a+bc+def == ghi) ans++;
  }while(next_permutation(all(vec)));
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3212
n = int(input())
x = list(map(int, input().split()))
s_x = sorted(x)
med1=s_x[n//2 - 1]
med2=s_x[n//2]

for i in range(n):
    if x[i] > med1:
        print(med1)
    else:
        print(med2)

Measured memory_bytes: 93780
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];



void solve(){
	ll i, j, k, p, q, r, x, y, u, v, n, m;
    cin>>n;
    ll s=(mpow(10,n)-(2*mpow(9,n))%mod+mpow(8,n)+mod)%mod;
    cout<<s<<endl;
    // ll s=(n*(n-1))%mod;
    // ll ans=(mpow(10,n-2)*s)%mod;
    // cout<<(ans+mod)%mod<<endl;
    // ll c=0,d;
    // for(i=0;i<1000;i++){
    //     p=i;
    //     unordered_map<int,int> mp;
    //     d=3;
    //     while(d){
    //         mp[p%10]++;
    //         p=p/10;
    //         d--;
    //     }
    //     if(mp[0]>0 and mp[9]>0){
    //         deb(i);
    //         c++;
    //     }
    // }
    // cout<<c<<endl;
}

int main() {
	ios_base::sync_with_stdio(0);
	int i,t=1;
	//cin>>t;
	for(i=1;i<=t;i++){
		solve();
	}
	return 0;
}

int mpow(int base, int exp) {
	base %= mod;
	int result = 1;
	while (exp > 0) {
		if (exp & 1) result = ((ll)result * base) % mod;
		base = ((ll)base * base) % mod;
		exp >>= 1;
	}
	return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}




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

vector<int> binary(int i, int n, int N){
    int x = 1;
    rep(j,N){
        x *= n;
    }
    vector<int> vec(N);
    rep(j,N){
        x /= n;
        vec[j] = i / x;
        i -= x * vec[j];
    }
    return vec;
}

int main(){
    ll N,M,X;
    cin >> N >> M >> X;
    vector<ll> price(N);
    vector<vector<ll> > skill(N, vector<ll>(M));
    rep(i,N){
        cin >> price[i];
        rep(j,M){
            cin >> skill[i][j];
        }
    }
    ll num = 1;
    rep(i,N){
        num *= 2;
    }
    ll ans = 10000000;
    rep(i,num){
        vector<int> book = binary(i, 2, N);
        vector<ll> skill_2(M, 0);
        ll ans_sub = 0;
        rep(j, N){
            if (book[j] == 1){
                ans_sub += price[j];
                rep(k,M){
                    skill_2[k] += skill[j][k];
                }
            }
        }
        bool achieve = true;
        rep(j, M){
            if (skill_2[j] < X) achieve = false;
        }
        if (achieve){
            ans = min(ans, ans_sub);
        }
    }
    if (ans == 10000000) cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 3644
using System;
 
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
      string[] str=Console.ReadLine().Split(' ');
      int a1=int.Parse(str[0]);
      int a2=int.Parse(str[1]);
      int a3=int.Parse(str[2]);
      if(a1+a2+a3>=22){
        Console.WriteLine("bust");
      }else{
      
    
        Console.WriteLine("win");
      }
    }
  }
}

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

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    int n,m,s,c;
    char ss[10];
    scanf("%d%d",&n,&m);
    REP(i,10)ss[i]=-1;
    REP(i,m){
        scanf("%d%d",&s,&c);
        if(!(ss[n-s]==-1 || ss[n-s]==c) || s>n){
            printf("-1\n");return 0;
        }
        ss[n-s]=c;
    }
    if(ss[n-1]==0 && n>1){printf("-1\n");return 0;}
    for(int i=n-1;i>=0;i--){
        if(i==n-1 && n==1 && ss[i]==-1)printf("0");
        else if(i==n-1&&ss[i]==-1)printf("1");
        else if(ss[i]==-1)printf("0");
        else printf("%d",ss[i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
#define rep(i,l,r) for((i)=(l);(i)<(r);(i)++)
#define erep(i,l,r) for((i)=(l);(i)<=(r);(i)++)
#define drep(i,l,r) for((i)=(l);(i)>=(r);(i)--)
#define MOD 1000000007
#define ll long long
using namespace std;
int main(){
    int ans=0,i;
    char s[4],t[4];
    cin>>s;
    cin>>t;
    rep(i,0,3){
        if(s[i]==t[i])ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
# coding: utf-8
import itertools

N, K = map(int, input().split())
lst = sorted([int(input()) for _ in range(N)], reverse=True)

ans = 10000000000
for i in range(N-K+1):
    l = lst[i]-lst[i+K-1]
    if l < ans:
        ans = l
print(ans)

Measured memory_bytes: 8300
N = int(input())

A = []

tmp = 6

while tmp<=N:
    A.append(tmp)
    tmp = tmp*6
    

tmp = 9

while tmp<=N:
    A.append(tmp)
    tmp = tmp*9
    
A.sort()
    
dp = [[0 for i in range(N+1)] for j in range(len(A)+1)]

for i in range(N+1):
    dp[0][i] = i
    
for i in range(len(A)):
    for j in range(N+1):
        if A[i]<=j:
            dp[i+1][j] = min(dp[i+1][j-A[i]]+1, dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]
            
print(dp[len(A)][N])

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

using namespace std;

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

const int nmax=10000000;

bool isprime[nmax+1];
vector<int> ans;

void init(){
	rep(i,nmax+1) isprime[i]=true;
	isprime[0]=isprime[1]=true;
	for(int i=2;i*i<=nmax;++i)
		if(isprime[i])
			for(int j=i*i;j<=nmax;j+=i)
				isprime[j]=false;

	for(int i=13;i<=nmax;i+=2){
		if(!isprime[i])
			continue;
		if(!isprime[i-2])
			continue;
		if(!isprime[i-6])
			continue;
		if(!isprime[i-8])
			continue;
		ans.push_back(i);
	}
}

int main(void){
	init();
	int in;
	while(cin >> in,in){
		int out=upper_bound(ans.begin(),ans.end(),in)-ans.begin();
		cout << ans[out-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 10988
#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)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

const int mod=998244353;
ll n,m,k;
const int MAX_N=200001;
ll fact[MAX_N+1];
ll inv[MAX_N+1],finv[MAX_N+1];
int inv_init(ll n,ll p){
    inv[1]=1;
    FOR(i,2,n+1) inv[i]=p-(p/i)*inv[p%i]%p;
    fact[0]=finv[0]=1;
    FOR(i,1,n+1){
        fact[i]=fact[i-1]*i%p;
        finv[i]=finv[i-1]*inv[i]%p;
    }
    return 0;
}
ll comb_mod(ll n,ll k,ll p){
    if(k<0||n<k) return 0;
    return finv[k]*finv[n-k]%p*fact[n]%p;
}
ll modpow(ll x,ll n,ll mod){
    ll res=1;
    while(n>0){if(n&1) res=res*x%mod;x=x*x%mod;n>>=1;}
    return res;
}
int main(){
    cin>>n>>m>>k;
    inv_init(n+1,mod);
    ll ans=0;
    rep(i,k+1){
        ll tmp=m*modpow(m-1,n-1-i,mod)%mod*comb_mod(n-1,i,mod)%mod;
        ans+=tmp;
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 8228
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/24 16:46:00 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

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

// TOP
void	Main()
{
	int	n;
	cin >> n;
	unordered_map<int, int>	um;
	rep(i, n)
	{
		int x;
		cin >> x;
		um[x]++;
	}
	ll sum;
	sum = 0;
	for (auto itr = um.begin(); itr != um.end(); itr++)
	{
		if (itr->first < itr->second)
			sum += itr->second - itr->first;
		else if (itr->first != itr->second)
			sum += itr->second;
	}
	cout << sum << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 4260