akhauriyash/Code-Regression huggingface dataset:
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

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

const int N = 1e5 + 10;

int main() {
	fast_cin();
	int h, w, n;
	cin >> h >> w >> n;
	int m = max(h, w);
	cout << (n + m - 1) / m << endl;
}

Measured memory_bytes: 256
S = str(input())

str_keyence = "keyence"

if S.find("keyence")==0 or S.rfind("keyence")==len(S)-7:
  print("YES")
else:
  for i in range(1,7):
      #print(str_keyence[0:i],str_keyence[i:])
      #print(S.find(str_keyence[0:i]))
      #print(S.find(str_keyence[i:]))
      if S.find(str_keyence[0:i])==0 and S.rfind(str_keyence[i:])==len(S)-len(str_keyence[i:]):
          print("YES")
          break
  else:
      print("NO")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y){
  ll r; while((r= x % y)!=0){x=y; y=r;}  return y;
}
// 最小公倍数を求める関数lcm
ll lcm(ll x, ll y){return (x*y/gcd(x,y));}

int main(){
  ll A,B,C,D;
  cin >> A >> B >> C >> D;
  ll c=(B/C*C-(A/C+1)*C)/C;
  ll d=(B/D*D-(A/D+1)*D)/D;
  ll E=lcm(C,D);
  if(A%C==0)c++;
  if(A%D==0)d++;
  ll e=(B/E*E-(A/E+1)*E)/E;
  if(A%E==0)e++;
  ll ans=B-A+1-c-d+e;
  cout << ans-1 << endl;
}

Measured memory_bytes: 256
//Robs Code
/***********HEADER***************/
#include <iostream>
#include <bitset>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <set>
#include <queue>
#include <map>
/***********MACROS***************/
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define mxsz 1e5+10
#define mod 1e9 + 7
#define pii pair<int,int>
using namespace std;
const int N = 1e5 + 1;
int n,m,i,j,l,k,x,y,a,b,cnt[3],sum[3];
/***********MAIN**************/
int dp[3001][3001];
string s,t;
int brute(int i,int j){
	if(i == n){
		return 0;
	}
	if(j == m){
		return 0;
	}
	if(dp[i][j] != -1){
		return dp[i][j];
	}
	int ans = 0;
	if(s[i] == t[j]){
		ans = max(ans,brute(i+1,j+1) + 1);
	}
	ans = max(ans,brute(i+1,j));
	ans = max(ans,brute(i,j+1));
	dp[i][j] = ans;
	return ans;
}
void print(int i,int j){
	if(i == (n)){
		return ;
	}
	if(j == (m)){
		return ;
	}
	if(s[i] == t[j]){
		cout<<s[i];
		print(i+1,j+1);
	}else if(dp[i][j] == dp[i+1][j]){
		print(i+1,j);
	}else if(dp[i][j] == dp[i][j+1]){
		print(i,j+1);
	}
}
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>s>>t;
	n = s.length();
	m = t.length();
	memset(dp,-1,sizeof dp);
	brute(0,0);
	print(0,0);
	return 0;
}
//.........

Measured memory_bytes: 71040
#light "off"
open System;;
open System.IO;;

let reader = new StreamReader(new BufferedStream(Console.OpenStandardInput ()))
let writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput ()))

let skipSpaces () = while reader.Peek () <= int ' ' do reader.Read () |> ignore done;;
let read f = skipSpaces (); [|while reader.Peek () > int ' ' do yield char (reader.Read ()) done |] |> System.String |> f;;
let readint () = skipSpaces (); let mutable ans = 0 in while reader.Peek () > int ' ' do ans <- ans * 10 + (reader.Read () - int '0'); done; ans;;
let write (s : string) = writer.Write s;;
let writeln (s : string) = writer.WriteLine s;;


let a, b, c = readint (), readint (), readint();;
c - min (a - b) c |> printfn "%d";;


reader.Close();;
writer.Close();;

Measured memory_bytes: 11992
fib_memo = {}
def fib(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    if not (n in fib_memo):
        fib_memo[n] = fib(n-1) + fib(n-2)
    return fib_memo[n]

N = int(input())
print(fib(N))

Measured memory_bytes: 3060
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		String[] S = new String[N];
		for (int i=0; i<N; i++) {
			S[i] = sc.next();
		}
		Arrays.sort(S);
		String res = "";
		for (int i=0; i<N; i++) {
			res += S[i];
		}
		System.out.print(res);
	}
}


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

int main(){
 
  vector<int> v(3);
  
  for(int i = 0; i < 3; i++){
    int x;
    cin >> x;
    v[i] = x;
  }
  int sum = 0;
  sort(v.begin(),v.end());
  for(int i = 1; i < 3; i++){
    int t = abs(v[i] - v[i - 1]);
    sum += t;
  }
  cout << sum;
}
    


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

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int total = 0;
  for (int i = 1; i <= N; ++i) {
    int sum = findSumOfDigits(i); // i の各桁の和
    if (sum >= A && sum <= B) { //  i の各桁の和が A 以上 B 以下かどうか
      total += i;
    }
  }
  cout << total << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int scores[7];
    int score_length = 0;
    
    int number = 0;
    cin>>number;
    while (number != 0) {
        int max = 0;
        int min = 1000;
        int score = 0;
        int total = 0;
        for (int i = 0; i < number; i++) {
            cin>>score;
            total += score;
            if (score > max) max = score;
            if (score < min) min = score;
        }
        total -= max + min;
        scores[score_length] = total / (number-2);
        score_length++;

        cin>>number;
    }

    for (int i = 0; i < score_length; i++) {
        cout<<scores[i]<<endl;
    }
}

Measured memory_bytes: 3092
#include <stdio.h>
#include <math.h>

int cul(int,int);

int  main(void){
	int N,D,num;
	scanf("%d %d",&N,&D);
	num = cul(N,D);
	printf("%d\n",num);
	return 0;
}


int cul(int N,int D){
	int num;
	num = ceil(double(N) / (2 * double(D) + 1));
	return num;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
string X;
int main()
{
	cin >> X;
	int num = 0;
	int num1 = 0;
	for (int i = 0; i < X.size(); i++)
	{
		if (X.at(i) == 'S')
			num1++;
		else
		{
			if (num1 > 0)
			{
				num1--;
				num += 2;
			}
		}
	}
	cout << X.size() - num << endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <list>
#include <bitset>
#include <array>

using namespace std;

#define fi first	
#define se second
#define long long long
typedef pair<int,int> ii;
typedef pair<ii,int> iii;

int N = 1;
vector<iii> vec;

int main()
{
	// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	// freopen("input.in", "r", stdin);

	int L; scanf("%d", &L);
	
	int x = 1;
	while(1)
	{
		vec.push_back({{N,N+1},x});
		vec.push_back({{N,N+1},0});
		N++;
		x *= 2;
		if(x*2-1 >= L)
			break;
	}
	int temp = N;
	int sum = x;
	N--;
	while(N)
	{
		if((L)&(1<<(N-1)))
		{
			vec.push_back({{N,temp},sum});
			sum += (1<<(N-1));
		}
		N--;
	}
	N = temp;
	printf("%d %lu\n", N, vec.size());
	for(auto i : vec) printf("%d %d %d\n", i.fi.fi, i.fi.se, i.se);
}












Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int i,a,b,c,s;
	s=0;
	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
	if(c%i==0){
		s+=1;
	}
	}
	printf("%d\n",s);
	
	return 0;
}


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

int Q;
long long sumL = 0, sumR = 0;
multiset <int> L, R;
long long addB;

void update(int x) {
    if(L.empty()) {
        sumL += x;
        L.insert(x);
        return;
    }
    int naxL = *(L.rbegin());

    if(x >= naxL) {
        R.insert(x);
        sumR += x;
    } else {
        L.insert(x);
        sumL += x;
    }

    if(L.size() + 1 < R.size()) {
        int val = *R.begin();
        L.insert(val);
        R.erase(R.find(val));
        sumL += val;
        sumR -= val;
    } else if(R.size() + 1 < L.size()) {
        int val = *L.rbegin();
        R.insert(val);
        L.erase(L.find(val));
        sumR += val;
        sumL -= val;
    }
}

void get() {
    int val;
    if(L.size() + 1 == R.size())
        val = *R.begin();
    else
        val = *L.rbegin();

    long long ans = addB + L.size() * 1LL * val - sumL + sumR - R.size() * 1LL * val;
    cout << val << " " << ans << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin >> Q;
    while(Q --> 0) {
        int type;
        cin >> type;
        if(type == 1) {
            int a, b;
            cin >> a >> b;
            addB += b;
            update(a);
        } else {
            get();
        }
    }
}


Measured memory_bytes: 9600
t=list(input())
if t[0]=='?':
    t[0]=t[0].replace('?','D')
for i in range(1,len(t)-1):
    if t[i]=='?' and t[i+1]=='D' and t[i-1]=='P':
        t[i]=t[i].replace('?','D')
    elif t[i]=='?' and t[i+1]=='P' and t[i-1]=='P':
        t[i]=t[i].replace('?','D')
    elif t[i]=='?' and t[i+1]=='D' and t[i-1]=='D':
        t[i]=t[i].replace('?','P')
    elif t[i]=='?' and t[i+1]=='P' and t[i-1]=='D':
        t[i]=t[i].replace('?','D')
    elif t[i]=='?' and t[i+1]=='?' and t[i-1]=='D':
        t[i]=t[i].replace('?','P')
    elif t[i]=='?' and t[i+1]=='?' and t[i-1]=='P':
        t[i]=t[i].replace('?','D')
if t[-1]=='?':
    t[-1]=t[-1].replace('?','D')
for i in t:
    print(i,end='')

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
using P = pair<int64_t,int64_t>;
  

int main() {
  int N;
  cin >> N;
  vector<P> vec(N);
  for(int i=0; i<N; i++){
    int64_t x;
    cin >> x;
    P p = make_pair(x,i);
    vec[i] = p;
  }
  
  int64_t dp[N][N+1]; //i番目までの数で右側にj個
  int64_t MINF = -1e9;
  for(int i=0; i<N; i++){
    for(int j=0; j<N+1; j++){
      dp[i][j] = MINF;
    }
  }
  
  sort(vec.rbegin(),vec.rend());
  
  for(int i=0; i<N; i++){
    P p = vec[i];
    if(i == 0){
      dp[0][0] = p.first*abs(p.second - i);
      dp[0][1] = p.first*abs(p.second - (N-1));
    }
    else{
      for(int j=0; j<i+1; j++){
        dp[i][j] = max(dp[i][j], dp[i-1][j] + p.first* abs(p.second - (i-j)) ); //左に詰める
        dp[i][j+1] = max(dp[i][j+1], dp[i-1][j] + p.first* abs(p.second - (N-1-j))); //右に詰める
      }
    }
  }
  
  /*for(int i=0; i<N; i++){
    for(int j=0; j<N+1; j++){
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }*/
  int64_t ans = MINF;
  for(int j=0; j<N+1; j++){
    ans = max(ans,dp[N-1][j]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 34900
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
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; }
const int64_t INF = 1LL << 60;

int main() {
 int N;
 cin>>N;
 vector<string>s(N);
 map<string,int>k;
 for(int i=0;i<N;i++){
   cin>>s[i];
   k[s[i]]++;
 }
 int Max=0;
 for(auto a:k){
   Max=max(Max,a.second);
 }
 for(auto a:k){
   if(a.second==Max){cout<<a.first<<endl;}
 }

  return 0;}

Measured memory_bytes: 26752
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

  ll n;
  cin >> n;
  ll cnt = 0;
  ll mx = 0;
  vector<ll>vec;
  bool mrk = 0;
  for(int i=0; i<n; i++)
  {
     ll x;
      cin >> x;

    if(x%2==0)
    {
        ll v = x;
        mrk = 1;
    cnt = 0;
       while(x%2==0)
       {
           x/=2;cnt++;
       }
       //cout << v << " " << cnt << endl;
       mx+=cnt;

    }
  }

  if(mrk)cout << mx << endl;
  else cout << 0 << endl;


      }


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

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl;

const int INF=0x3f3f3f3f;

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

typedef pair<int,int> pii;

/*
#ifdef MYDEBUG
#include"debug.h"
#include"print.h"
#endif
*/
// }}}

int N,M;

vector<vector<int> > A;

bool f(int k){
	if(k==0)return false;
//	cout<<"test: "<<k<<endl;
	vector<queue<int> > q(N);
	REP(i,N)REP(j,M)q[i].push(A[i][j]);
	unordered_set<int> invalid;
	while(1){
		unordered_map<int,int> ct;
		REP(i,N){
			while(1){
				if(q[i].empty())return false;
				if(invalid.find(q[i].front())!=invalid.end())q[i].pop();
				else{
					ct[q[i].front()]++;
					break;
				}
			}
		}
		bool found = false;
		for(const auto &p:ct){
			if(p.second>k){
				invalid.insert(p.first);
				found = true;
//				cout<<"invalid: "<<p.first<<endl;
			}
		}
		if(!found)return true;
	}
	assert(false);
}

//{{{ int binarySearch(int l,int r,bool (*eval)(int)) false -> true
int binarySearch(int l,int r,bool (*eval)(int)){
	assert(!eval(l));assert(eval(r));
	while(r-l>1){
		int m=(l+r)/2;
		if(eval(m))r=m;
		else l=m;
	}
	return r;
}
//}}}

int main(){
	cin>>N>>M;
	A.assign(N,vector<int>(M));
	REP(i,N)REP(j,M)cin>>A[i][j];
	/*
	for(int i=0;i<=N;i++){
		cerr<<i<<" "<<f(i)<<endl;
	}
	*/
	for(int k=1;k<=N;k++){
		if(f(k)){
			cout<<k<<endl;
			return 0;
		}
	}
//	cout<<binarySearch(0,N,f)<<endl;
	return 0;
}



Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define forn(b) for(int i = 0; i < b; i++)
#define rforn(b) for(int i = b - 1 ;i >= 0; i--)
#define It(m) for(auto it = m.begin(); it != m.end(); it++)
#define N 500500
#define PI 3.14159265358979323846264338327950L
#define speed ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
const ll mod = (ll)1e9 + 7;
	
int main(){
	speed;
	int n, m, k; cin >> n >> m >> k;
	vi v1(n), v2(m);
	forn(n) cin >> v1[i];
	forn(m) cin >> v2[i];
	int cnt = 0;
	int mx = 0;
	int i1 = -1;
	int j2 = -1;
	for(int i = 0; i < n; i++) {
		if(v1[i] <= k) {
			cnt++;
			k -= v1[i];
		}
		else {
			break;
		}
	}
	mx = cnt;
	i1 = cnt - 1;
	for(int i = 0; i < m; i++) {
		if(v2[i] <= k) {
			cnt++;
			k -= v2[i];
		}
		else {
			if(i1 != -1) {
				k += v1[i1];
				cnt--;
				i1--;
				i--;
			}
			else {
				break;
			}
		}
		mx = max(cnt, mx);
	}
	cout << mx;
	return 0;
}

Measured memory_bytes: 4796
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	listX := make([]float64, n)
	listU := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&listX[i], &listU[i])
	}

	result := 0.0
	for i := 0; i < n; i++ {
		if listU[i] == "JPY" {
			result += listX[i]
		} else if listU[i] == "BTC" {
			result += listX[i] * 380000.0
		}
	}
	fmt.Println(result)
}


Measured memory_bytes: 512
#include<stdio.h>

int prime[200000]={},num[250000]={};
int main(void){
	int i,j,a,k=0,N,count;
	prime[k++]=2;
	prime[k++]=3;

	for(i=5;i<250000;i+=2){
		int flag=0;
		for(j=0;i>=prime[j]*prime[j];j++){
			if(i%prime[j]==0){
				flag=1;
				break;
			}
		}
		if(flag==0){prime[k++]=i;}
	}

	
	
	for(i=0;i<k;i++){
		a=prime[i];
		num[a]=1;
	}

	
		while(1){
		scanf("%d",&N);
		if(N==0){break;}
		count=0;
		for(i=N+1;i<=2*N;i++){
			count+=num[i];
		}

		printf("%d\n",count);

	}
	return 0;
}

Measured memory_bytes: 1660
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

const int M=100010;
bool stu[410][410];
int n,m,a[M],b[M];
bool cant[410];

int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
        scanf("%d%d",a+i,b+i);
    for(int i=1;i<=n;i++)
    {
        stu[i][i]=1;
        for(int j=m;j>=1;j--)
        {
            bool x=stu[i][a[j]],y=stu[i][b[j]];
            if(x&&y)
			{
				cant[i]=1;
				break;	
			}
            else if(x) stu[i][b[j]]=1;
            else if(y) stu[i][a[j]]=1;
        }
    }
    int ans=0;
    for(int i=1;i<n;i++)
    {
        if(cant[i]) continue;
        for(int j=i+1;j<=n;j++)
        {
            if(cant[j]) continue;
            bool flag=1;
            for(int k=1;k<=n;k++) if(stu[i][k]&&stu[j][k]) flag=0;
            ans+=flag;
        }
    }
    printf("%d\n",ans);
    return 0;
}

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

using namespace std;

int main(){
  int N;
  int K;
  int ans=0;
  cin >> N;
  cin >> K;
  vector<int> h(N);
  for(int& a : h){
    cin >> a;
    if(a>=K)ans++;
  }
  cout << ans << endl;
  return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}
#define ANS(a) cout<<a<<endl
inline int ceil10(int n) { n+=(10-n%10)%10; return n; }

bool is_repdigit(int n) {
    int d = n % 10;
    n /= 10;
    while (n!=0) {
        if (n%10!=d)
            return false;
        n/=10;
    }
    return true;
} 

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int N; cin>>N;
    while (!is_repdigit(N)) N++;
    cout << N << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1000000000000000000

using namespace std;

int main(void){
  ll a, v;
  cin >> a >> v;
  
  ll b, w;
  cin >> b >> w;
  
  ll t;
  cin >> t;
  
  if (t*(v-w) >= abs(b-a))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
    

  return 0;
}


Measured memory_bytes: 3680
#include<cmath>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<set>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const double pi=4*atan(1.0);
const int N = 1e5+5;
const ll mod = 998244353;

int main()
{
    int x,y;
    scanf("%d %d",&x,&y);
    if(y>=x)printf("unsafe\n");
    else printf("safe\n");
    return 0;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ff first
#define ss second
#define pb push_back
#define int long long
#define ios std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define fill(x, v) memset(x, v, sizeof(x))
const ll mod = 1000000007;
const double pi = 3.14159265359; // PI
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
/*
std::cout << std::setprecision(9) << f << '\n';//3.141590000;
map<char,int>::reverse_iterator rit;
for(rit = mp.rbegin(); rit!=mp.rend(); rit++)
    auto start = high_resolution_clock::now();
    // Call the function, here
    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<milliseconds>(stop - start);
    cout << "Time taken by function: "<< duration.count() << " milliseconds" << endl;
*/
int power(int x, unsigned int y, int p)
{
    int res = 1;

    x = x % p;

    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
// string parser
vector<int> parse(string s)
{
    stringstream ss(s);
    int x;
    vector<int> v;
    while (ss >> x)
    {
        v.pb(x);
    }
    return v;
}
//-----------------------------
const int N = 1e7 + 9;
int mood = 998244353;
int n;

int32_t main()
{
    ios;
    int a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    if (v * t >= abs(a - b) + w * t)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 3664
function main(input) {
  const args = input.split(' ');
  const a = parseInt(args[0]);
  const b = parseInt(args[1]);

  if ((a * b) % 2 === 0) {
    console.log("Even");
  } else {
    console.log("Odd");
  }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(){
    int n;
    cin>>n;
    vector<ll>a(n);
    vector<ll>wa(n);
    rep(i,n)cin>>a[i];
    
    wa[0]=a[0];
    for(int i=1;i<n;i++){
        wa[i]=a[i]+wa[i-1];
    }
    ll ans=1000000000000000;
    for(int i=0;i<n-1;i++){
        ans=min(abs((wa[n-1]-wa[i])-wa[i]),ans);
    }
    cout<<ans<<endl;
   
}

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

long long res(int n) {
    if (n==1) return 1;
    long long res_a=2;
    long long res_b=1;
    long long tmp=0;
    for (int i=1; i<n; i++) {
        tmp = res_b;
        res_b += res_a;
        res_a = tmp;
    }
    return res_b;
}

int main() {
    int N;
    cin >> N;
    cout << res(N) << "\n";
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define REV(x) reverse(ALL(x))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using Pll_ll = pair<ll, ll>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

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


int main(){
    int N, A, B; cin >> N >> A >> B;
    VI cnt(3, 0);
    REP(i, N){
        int P; cin >> P;
        if(P <= A) ++cnt[0];
        else if(B < P) ++cnt[2];
        else ++cnt[1];
    }
    cout << *min_element(ALL(cnt)) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int n = Integer.parseInt(scanner.next());
    int[] t = new int[n];
    for(int i=0; i<n; i++){
      t[i] = Integer.parseInt(scanner.next());
    }
    int m = Integer.parseInt(scanner.next());
    int[] p = new int[m];
    int[] x = new int[m];
    for(int i=0; i<m; i++){
      p[i] = Integer.parseInt(scanner.next());
      x[i] = Integer.parseInt(scanner.next());
    }
    scanner.close();

    int sum = 0;
    for(int i=0; i<n; i++){
      sum += t[i];
    }

    for(int i=0; i<m; i++){
      System.out.println(sum-t[p[i]-1]+x[i]);
    }
  }
}


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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

const int nsz = int(1e6);
int n, sum, pre[nsz + 5], mn[nsz + 5];
pair<int, int> dat[nsz + 5];
string s[nsz + 5];

bool inline cmp(pair<int, int> a, pair<int, int> b) {
	if (a.first > 0 && b.first > 0)  return a.second > b.second;
	if (a.first < 0 && b.first < 0)  return a.second - a.first < b.second - b.first;
	return a.first > b.first;
}

int main() {
	ios::sync_with_stdio(0);
	cin >> n;
	cont (i, n) {
		cin >> s[i];
		int cur = 0;
		loop (j, s[i].size()) {
			char c = s[i][j];
			cur += c == '(' ? +1 : -1;
			mn[i] = min(mn[i], cur);
		}
		pre[i] = cur;
		sum += cur;
		dat[i] = make_pair(pre[i], mn[i]);
	}
	if (sum != 0) {
		cout << "No" << ln;
		return 0;
	}
	sort(dat + 1, dat + n + 1, cmp);
	int cur = 0;
	cont (i, n) {
		int a = dat[i].first, b = dat[i].second;
		if (cur + b < 0) {
			cout << "No" << ln;
			return 0;
		}
		cur += a;
	}
	cout << "Yes" << ln;
}

Measured memory_bytes: 50528
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;
int a[1000010];

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

    int n,m,k;
    cin>>n>>m>>k;
    bool f=false;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            int tmp=i*m+j*n-2*i*j;
            if(tmp==k)f=true;
        }
    }
    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    int main(){

        string S,T;
        cin >> S >> T;
        int A, B;
        cin >> A >> B;
        string U;
        cin >> U;
        if(U==S){
        cout << A -1<< " " << B<<endl;
        }
        else if(U==T){
            cout << A << " " << B - 1 << endl;
        }
    }

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

int main(){
  string S;
  cin >> S;
  string C = "";
  rep(i, S.size()){
    if(S[i] == '0' || S[i]== '1')  C.push_back(S[i]);
    else if(C.size()!=0) C.pop_back();
  }
  cout << C << endl;
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long int n,min_,start;
    cin>>n;
    start=0;
    vector<char> s(n+5);
    for(int i=0;i<n;i++){
        cin>>s.at(i);
        if(i!=0){
            if(s.at(i)=='E')
            start++;
        }
    }
    min_=start;
    for(int i=0;i<n-1;i++){
        if(s.at(i+1)=='E')start--;
        if(s.at(i)=='W')start++;
        if(start<min_)min_=start;
    }
    cout<<min_<<endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

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

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool up_min(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool up_max(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }

    ll operator"" _64(unsigned long long x){ return ll(x); }
    ull operator"" _64u(unsigned long long x){ return ull(x); }

    template<class T>
    vector<T> make_mdvector(int n, T t){
        return vector<T>(n, t);
    }
    template<class ...Ts>
    auto make_mdvector(int n, Ts ... ts){
        return vector<decltype(make_mdvector(ts...))>(n, make_mdvector(ts...));
    }

    inline ll bit(int x){
        return 1ll << x;
    }

    template<class T>
    istream& operator>>(istream& is, vector<T>& v){
        for (auto &&x : v) { is >> x; } return is;
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<T>& v){
        for (auto &&x : v) { os << x << ' '; } cout << endl; return os ;
    }
}
using namespace utils;

class solver{
    istream& is;
    ostream& os;

public:
    solver(istream& I, ostream& O) :is(I), os(O) {}
    ll N;
    void run();
};

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef XELMH
    string test_cases = "test_B.txt";
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int loop = 0;
    while(fs) {
        loop++;
        cout << '#' << loop << "#------\n";
        solver(fs, cout).run();
    }
    if(loop <= 1) {
        cout << "===" << endl;
        while(cin) solver(cin, cout).run();
    }
#else
    solver(cin, cout).run();
#endif
    return 0;
}


void solver::run(){
    string S;
    is >> N;
    is >> S;
    if(!is) return;
    bool ok = true;
    if(S.size() % 2 == 0){
        int k = S.size() /2 ;
        for (int i = 0; i < k; ++i) {
            if(S[i] == S[i+k]) continue;
            else {ok = false; break;}
        } // end i
    }
    else ok = false;
    os << (ok ? "Yes" : "No") << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,p=0,r=0,ans=0,c=0;
	scanf("%d",&x);
	p=800*x;
	for(int i=x;i>=15;i-=15){
	   c=c+1;
	   }
		r=c*200;
		ans=p-r;
		printf("%d",ans);
	
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b,c;
    cin>>a>>b>>c;
    if(a==1&&b==0&&c==0)cout<<"Close"<<endl;
    else if(a==0&&b==1&&c==0)cout<<"Close"<<endl;
    else if(a==1&&b==1&&c==0)cout<<"Open"<<endl;
    else if(a==0&&b==0&&c==1)cout<<"Open"<<endl;
    else if(a==0&&b==0&&c==0)cout<<"Close"<<endl;
}



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

int main()
{
    int n,m,x;
    cin >> n >> m >> x;
    int ca = 0,cb = 0;
    for(int i = 0; i < m; i++){
        int a;
        cin >> a;
        if(a < x){
            ca++;
        }else{
            cb++;
        }
    }
    cout << min(ca,cb) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <stack>
#include <vector>
#include <set>
#include <queue>
#pragma comment (linker,"/STACK:102400000,102400000")
#define pi acos(-1.0)
#define eps 1e-6
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
#define FRE(i,a,b)  for(i = a; i <= b; i++)
#define FREE(i,a,b) for(i = a; i >= b; i--)
#define FRL(i,a,b)  for(i = a; i < b; i++)
#define FRLL(i,a,b) for(i = a; i > b; i--)
#define mem(t, v)   memset ((t) , v, sizeof(t))
#define sf(n)       scanf("%d", &n)
#define sff(a,b)    scanf("%d %d", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define pf          printf
#define DBG         pf("Hi\n")
typedef long long ll;
using namespace std;

#define INF 0x3f3f3f3f
#define mod 1000000009
const int maxn = 1005;
const int MAXN = 2005;
const int MAXM = 200010;
const int N = 1005;

struct Node
{
    int x,y,step;
    int g[2][4];
};

int dir[4][2]={0,1,1,0,-1,0,0,-1};
int fac[]={1,1,2,6,24,120,720,5040,40320,362880};
int a[10];
int vis[50000];

bool isok(int x,int y)
{
    if (x>=0&&x<2&&y>=0&&y<4) return true;
    return false;
}

int cantor(int w[][4])
{
    int s[8],cc=0;
    for (int i=0;i<2;i++)
        for (int j=0;j<4;j++)
            s[cc++]=w[i][j];
    int sum=0;
    for (int i=0;i<8;i++)
    {
        int t=0;
        for (int j=i+1;j<8;j++)
        {
            if (s[i]>s[j])
                t++;
        }
        sum+=(t*fac[8-i-1]);
    }
    return sum;
}

void bfs()
{
    Node st,now;
    queue<Node>Q;
    for (int i=0;i<8;i++)
        st.g[i/4][i%4]=i;
    st.step=0;
    st.x=st.y=0;
    vis[cantor(st.g)]=0;
    Q.push(st);
    while (!Q.empty())
    {
        st=Q.front();
        Q.pop();
        for (int i=0;i<4;i++)
        {
            now.x=st.x+dir[i][0];
            now.y=st.y+dir[i][1];
            now.step=st.step+1;
            if (isok(now.x,now.y))
            {
                for (int j=0;j<2;j++)
                    for (int t=0;t<4;t++)
                        now.g[j][t]=st.g[j][t];
                swap(now.g[now.x][now.y],now.g[st.x][st.y]);
                int cc=cantor(now.g);
                if (vis[cc]!=-1) continue;
                vis[cc]=now.step;
                Q.push(now);
            }
        }
    }
    return ;
}

int main()
{
//#ifndef ONLINE_JUDGE
//    freopen("C:/Users/lyf/Desktop/IN.txt","r",stdin);
//#endif
    int i,j;
    memset(vis,-1,sizeof(vis));
    bfs();
    while (~scanf("%d",&a[0]))
    {
        for (i=1;i<8;i++)
            scanf("%d",&a[i]);
        Node st;
        for (int i=0;i<8;i++)
            st.g[i/4][i%4]=a[i];
        int p=cantor(st.g);
        printf("%d\n",vis[p]);
    }
    return 0;
}

Measured memory_bytes: 1512
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
using ll = long long int;
int main() {
  ll N, K;
  cin >> N >> K;
  ll R, S, P;
  cin >> R >> S >> P;
  string T;
  cin >> T;

  vector<pair<char, ll>> TE(3);
  TE[0] = {'r', R};
  TE[1] = {'s', S};
  TE[2] = {'p', P};

  sort(TE.begin(), TE.end(), [](pair<char, ll> lhs, pair<char, ll> rhs) {
    return lhs.second < rhs.second;
  });

  vector<char> Janken(N, 0);

  for (auto &&e : TE) {
    char now = e.first;

    for (ll i = 0; i < N; i++) {
      if (T[i] == 'r' && now == 'p' && i < K) Janken[i] = 'p';
      if (T[i] == 'p' && now == 's' && i < K) Janken[i] = 's';
      if (T[i] == 's' && now == 'r' && i < K) Janken[i] = 'r';
      if (T[i] == 'r' && now == 'p' && i >= K && Janken[i - K] != 'p')
        Janken[i] = 'p';
      if (T[i] == 'p' && now == 's' && i >= K && Janken[i - K] != 's')
        Janken[i] = 's';
      if (T[i] == 's' && now == 'r' && i >= K && Janken[i - K] != 'r')
        Janken[i] = 'r';
    }
  }

  ll ans = 0;
  for (auto &&e : Janken) {
      if (e == 'r') ans += R;
      if (e == 'p') ans += P;
      if (e == 's') ans += S;
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long LL;
static const LL MOD = 1000000007;

struct modll {
	long long x;
	modll() { }
	modll(long long _x) : x(_x) { }
	operator int() const { return (int)x; }
	modll operator+(const modll &r) { return (x + r.x) % MOD; }
	modll operator+=(const modll &r) { return x = (x + r.x) % MOD; }
	modll operator-(const modll &r) { return (x + MOD - r.x) % MOD; }
	modll operator-=(const modll &r) { return x = (x + MOD - r.x) % MOD; }
	modll operator*(const modll &r) { return (x * r.x) % MOD; }
	modll operator*(int r) { return (x * r) % MOD; }
	modll operator*=(const modll &r) { return x = (x * r.x) % MOD; }
	static modll modinv(int a) { return modpow(a, MOD - 2); }
	static modll modpow(int a, int b) {
		modll x = a, r = 1;
		for (; b; b >>= 1, x *= x) if (b & 1) r *= x;
		return r;
	}
};

int main(int argc, char *argv[]) {
	int n, m;
	cin >> n >> m;
	vector<int> a(n), b(m);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for (int i = 0; i < m; ++i) {
		cin >> b[i];
	}
	modll ans = 0;
	if (unique(a.begin(), a.end()) - a.begin() == n && unique(b.begin(), b.end()) - b.begin() == m) {
		ans = 1;
		a.push_back(-1);
		b.push_back(-1);
		sort(a.rbegin(), a.rend());
		sort(b.rbegin(), b.rend());
		int ai = 0, bi = 0;
		for (int i = n * m; i >= 1; --i) {
			if (i == a[ai]) {
				++ai;
				if (i == b[bi]) {
					++bi;
				} else {
					ans *= bi;
				}
			} else if (i == b[bi]) {
				++bi;
				ans *= ai;
			} else {
				ans *= (ai * bi - (n * m - i));
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long



using namespace std;

void file(){
	#ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
	#endif
}
int tc;
const int N=1e6+5,M=2e6+5,MOD=1e9+7,OO=1e9;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//file();
	
	int n;
	scanf("%d",&n);

	printf("%d\n",(n+1)/2 );	
}		



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+123;
int a[maxn];
int ans = 0;
int cnt[maxn];
bool was[maxn];
int main()
{
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	sort(a + 1, a + n + 1);
	cout << a[n] - a[1];
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 3
#define N2 9

struct Puzzle {
    int f[N2];
    int space;
    string path;
    
    bool operator < ( const Puzzle &p ) const {
        for (int i = 0; i < N2; i++) {
            if (f[i] == p.f[i]) continue;
            return f[i] > p.f[i];
        }
        return false;
    }
};

static const int dx[4] = {
    -1, 0, 1, 0
};
static const int dy[4] = {
    0, -1, 0, 1
};
static const char dir[4] = {
    'u', 'l', 'd', 'r'
};

bool isTarget(Puzzle p) {
    for (int i = 0; i < N2; i++) {
        if (p.f[i] != (i + 1)) return false;
    }
    return true;
}

string bfs(Puzzle s) {
    queue<Puzzle> Q;
    map<Puzzle, bool> V;
    Puzzle u, v;
    s.path = "";
    Q.push(s);
    V[s] = true;
    
    while( !Q.empty()) {
        u = Q.front();
        Q.pop();
        if ( isTarget(u)) return u.path;
        int sx = u.space / N;
        int sy = u.space % N;
        for (int r = 0; r < 4; r++) {
            int tx = sx + dx[r];
            int ty = sy + dy[r];
            if (tx < 0 || ty < 0 || tx >= N || ty >= N) continue;
            v = u;
            swap(v.f[u.space], v.f[tx * N + ty]);
            v.space = tx * N + ty;
            if ( !V[v]) {
                V[v] = true;
                v.path += dir[r];
                Q.push(v);
            }
        }
    }
    
    return "unsolvable";
}

int main() {
    Puzzle in;
    
    for (int i = 0; i < N2; i++) {
        cin >> in.f[i];
        if (in.f[i] == 0) {
            in.f[i] = N2;
            in.space = i;
        }
    }
    string ans = bfs(in);
    cout << ans.size() << endl;
    
    return 0;
}



Measured memory_bytes: 30600
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
 
bool is_prime(ll n){
	if(n==1)return false;
	for(ll i=2;i*i<=n;i++){
		if(n%i==0)return false;
	}
	return true;
}
vector<ll>divisor(ll n){
	vector<ll>res;
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			res.push_back(i);
			if(i!=n/i)res.push_back(n/i);
		}
	}
	return res;
}
map<ll,int>prime_factor(ll n){
	map<ll,int>res;
	for(ll i=2;i*i<=n;i++){
		while(n%i==0){
			res[i]++;
			n/=i;
		}
	}
	if(n!=1)res[n]++;
	return res;
}
vector<ll>prime_enum(int n){
	vector<bool>is_prime(n+1,true);
	is_prime[0]=is_prime[1]=false;
	vector<ll>res;
	for(int i=2;i<=n;i++){
		if(!is_prime[i])continue;
		res.push_back(i);
		for(int j=2*i;j<=n;j+=i){
			is_prime[j]=false;
		}
	}
	return res;
}
set<ll>se;
 
void solve(ll N,ll n){
	auto v=divisor(N);
	for(ll k:v){
		if(k==1)continue;
		ll d=n;
		while(d>=k){
			if(d%k==0)d/=k;
			else break;
		}
		d%=k;
		if(d==1){
			se.insert(k);
		}
	}
}
 
int main(){
	ll n;cin>>n;
	solve(n,n);
	solve(n-1,n);
	cout<<se.size()<<endl;
	
}

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

int main()
{
	int a=0, b=0, c=0, d=0, e=0, k=0;
	cin >> a >> b >> c >> d >> e >> k;
	vector<int> pos { a,b,c,d,e };
	
	sort(pos.begin(), pos.end());
	reverse(pos.begin(), pos.end());

	int ans = 0;

	for (int j = 0; j < 4; j++) {
		for (int i = j + 1; i < 5; i++) {
			if (pos.at(j) - pos.at(i) > k) ans++;
		}
	}
	if (ans != 0) cout << ":(" << endl;
	else cout << "Yay!" << endl;
}

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

using namespace std;

/**
 *  Name: Chris M. Perez
 *  University: Interamerican University Metro Campus
 *
**/

#define endl '\n'
#define MOD 10E9
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define gcd(x , y) __gcd(x , y)
#define all(x) (x).begin() , (x).end()
#define forn(i , a , b) for(int i=(a);i<(b);i++)
#define forrange(j , a , b) for(int j=(a);j<=(b);j++)
#define nestedforn(i , a , b , j , c , d) for(int i=(a);i<=(b);i++) for(int j=(c);j<=(d);j++)
#define sort_all(x) sort(all(x))
#define zeros_at_beginning(x) __builtin_clz(x)
#define zeros_at_end(x) __builtin_ctz(x)
#define ones(x) __builtin_popcount(x)
#define parity_even_or_odd_ones __builtin_parity(x)


typedef vector<int> vi;
typedef pair<int , int> pii;
typedef tuple<int , int , int> tiii;
typedef vector<pii> vpii;
typedef vector<tiii> vtiii;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef long long int lli;

             
inline int input(){
  int n;
  scanf("%d" , &n);
  return n;
}

                                                           
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;  

#ifdef LOCAL_DEFINE
  freopen("input.txt" , "rt" , stdin);
#endif

  int n; cin >> n;
  int k; cin >> k;
  cout << (n - k + 1) << endl;
    
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif  
  return 0;
}

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

int main(){
  int N;
  cin>>N;
  vector<int> A(N),B(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    B.at(i)=A.at(i)-i-1;
  }
  sort(B.begin(),B.end());
  long long int sum=0;
  for(int i=0;i<N;i++){
    sum=sum+abs(B.at(i)-B.at(N/2));
  }
  cout<<sum<<endl;
  
  
}

Measured memory_bytes: 1792
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=1e5+10;
ll   a[N];
ll  t1[N];
int cmp(int x,int y)
{
	return x>y;
}
int main()
{
	ll n,i,mx=0,my=0;
	cin>>n;
	for( i=0;i<n;i++)
		cin>>a[i];		
	sort(a,a+n,cmp);
	for(i=1;i<n;i++)
		if(a[i]==a[i-1])
			break;
	mx=a[i];
	for(i=i+2;i<n;i++)
		if(a[i]==a[i-1])
			break;
	my=a[i];
	cout<<mx*my;
	cout<<endl;
	return 0;	
}

Measured memory_bytes: 1024
#include <fstream>
#include <iostream>
#include <vector>
using namespace std;

int main(){
    int n, c0, c1, c2, c3;
    string s;
    cin >> n;
    c0 = c1 = c2 = c3 = 0;
    for(int i = 0;i<n;i++){
        cin >> s;
        if(s=="AC") c0++;
        if(s=="WA") c1++;
        if(s=="TLE") c2++;
        if(s=="RE") c3++;
    }
    cout << "AC x " << c0 << endl;
    cout << "WA x " << c1 << endl;
    cout << "TLE x " << c2 << endl;
    cout << "RE x " << c3 << endl;
}

Measured memory_bytes: 3624
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(10000000)

INF = 10 ** 9
L = input()

for loop in range(L):
    n, m = map(int, raw_input().split())
    S, T = map(int, raw_input().split())
    E = [[] for i in range(n + 1)]
    for i in range(m):
        u, v, tp = raw_input().split()
        u = int(u)
        v = int(v)
        E[u].append((v, tp))
        E[v].append((u, tp))
    C1 = [INF] * (n + 1)
    que = deque()
    que.append((S, 0))
    while len(que) > 0:
        p = que.popleft()
        if C1[p[0]] <= p[1]:
            continue
        C1[p[0]] = p[1]
        for e in E[p[0]]:
            if e[1] == 'N':
                que.append((e[0], p[1] + 1))
    
    C2 = [INF] * (n + 1)
    que = deque()
    que.append((T, 0))
    while len(que) > 0:
        p = que.popleft()
        if C2[p[0]] <= p[1]:
            continue
        C2[p[0]] = p[1]
        for e in E[p[0]]:
            if e[1] == 'L':
                que.append((e[0], p[1]))
    if C2[0] == 0:
        print 0
        continue
    que = deque()
    for i in range(n + 1):
        if C2[i] == 0:
            que.append((i, 0))
    C2 = [INF] * (n + 1)
    while len(que) > 0:
        p = que.popleft()
        if C2[p[0]] <= p[1]:
            continue
        C2[p[0]] = p[1]
        for e in E[p[0]]:
            if e[1] == 'N':
                que.append((e[0], p[1] + 1))
    
    C3 = [INF] * (n + 1)
    que = deque()
    que.append((0, 0))
    while len(que) > 0:
        p = que.popleft()
        if C3[p[0]] <= p[1]:
            continue
        C3[p[0]] = p[1]
        for e in E[p[0]]:
            if e[1] == 'L':
                que.append((e[0], p[1]))
    que = deque()
    for i in range(n + 1):
        if C3[i] == 0:
            que.append((i, 0))
    C3 = [INF] * (n + 1)
    while len(que) > 0:
        p = que.popleft()
        if C3[p[0]] <= p[1]:
            continue
        C3[p[0]] = p[1]
        for e in E[p[0]]:
            if e[1] == 'N':
                que.append((e[0], p[1] + 1))
    ans = 10 ** 9
    for i in range(1, n + 1):
        ans = min(ans, C1[i] + C2[i] + C3[i])
    print ans


Measured memory_bytes: 46600