akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N,M; cin >> N >> M;
    vector<ll> a(N); for(auto& in:a) cin >> in;

    sort(a.begin(),a.end());
    ll _lcm = 1;
    for(auto x:a){
        _lcm = lcm(_lcm,x/2);
        if(_lcm > M) return res;
    }
    for(auto x:a){
        if(_lcm/(x/2)%2==0) return res;
    }
    res = (M-_lcm)/(2*_lcm) + 1;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  long long N;
  scanf("%lld", &N);
  long long W;
  scanf("%lld", &W);
  std::vector<long long> w(N);
  std::vector<long long> v(N);
  for (int i = 0; i < N; i++)
  {
    scanf("%lld", &w[i]);
    scanf("%lld", &v[i]);
  }

  vector<ll> dp(101001, 1e15);
  dp[0] = 0;
  for (int i = 0; i < N; ++i)
  {
    for (int j = 101000; j >= v[i]; --j)
    {
      dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
    }
  }
  ll ans = 0;
  for (ll i = 0; i < 101001; ++i)
    if (dp[i] <= W)
      ans = max(i, ans);
  cout << ans << endl;

  return 0;
}


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

int main() {
    int n;
    int max = 100;
    string s[max];
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> s[i];
        if (s[i] == "Y") {
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}

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

int main() {
	int n;
	cin>>n;
	int* a = new int[n];
	int* b = new int[n];
	int* c = new int[n];
	for(int i=0;i<n;i++){
	    cin>>a[i]>>b[i]>>c[i];
	}
	int* da = new int[n];
	int* db = new int[n];
	int* dc = new int[n];
	da[0] = a[0];
	db[0] = b[0];
	dc[0] = c[0];
	for(int i=1;i<n;i++){
	    da[i] = max(db[i-1],dc[i-1]) + a[i];
	    db[i] = max(da[i-1],dc[i-1]) + b[i];
	    dc[i] = max(db[i-1],da[i-1]) + c[i];
	}
	cout<<max(da[n-1],max(db[n-1],dc[n-1]))<<'\n';

}


Measured memory_bytes: 2560
# coding:utf-8
import sys


def main():
    # N = int(input())
    N, K = map(int, input().split())
    ans = 0

    if K == 1:
        ans = 0
    elif K > 1:
        ans = N - K
    print(ans)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 38384
// AOJ 2806: Weight Range
// 2017.10.10 bal4u@uu

#include <stdio.h>
#include <string.h>

int a[2005];

int gcd(int a, int b)
{
	int r;
	while (b != 0) r = a % b, a = b, b = r;
	return a;
}

int main()
{
	int n, m, i, j, k, group, step, min, max, ans;

	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++) scanf("%d", a+i);
	memcpy(a+n, a, sizeof(int)*n);

	step = gcd(n, m);
	group = n /step;   // = lcm(n,m)/m = (m*n/gcd(n,m))/m = n/gcd(n,m)

	ans = 0;
	for (k = 0, i = 0; i < group; i++, k += step) {
		min = max = a[k];
		for (j = 1; j < m; j++) {
			if      (a[k+j] < min) min = a[k+j];
			else if (a[k+j] > max) max = a[k+j];
		}
		ans += max-min;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1892
#include<stdio.h>

void checkswaps(int p[], int leftswap[], int rightswap[], int equal[], int swapped[], int N, int *equalcount) 
{
 int i;

 for(i=1;i<N+1;i++)
 {
  if(p[i]==i)
  {
    (*equalcount)++;
    equal[i]=1;
   }else{
    equal[i]=0;
   }
   if(i>1)
   {
    if((p[i]!=(i-1))&(p[i-1]!=i))
    {
      leftswap[i]=1;
    }else{
      leftswap[i]=0;
    }
   }

  if(i<N)
  {
   if((p[i]!=(i+1))&(p[i+1]!=i))
   {
     rightswap[i]=1;
   }else{
     rightswap[i]=0;
   }
  }
 }


 // End points
 leftswap[1]=0;
 rightswap[N]=0;
 swapped[0]=1;
 for (i=1;i<=N;i++) swapped[i]=0;
 swapped[N+1]=1;

}

void swapdata(int equal[], int leftswap[], int rightswap[], int swapped[], int p[], int N, int *swapcount)
{
 int i;
 int temp;
 
 for(i=1;i<N+1;i++)
 {
  if((equal[i]==1)&(equal[i+1]==1)&(swapped[i]==0)&(swapped[i+1]==0))
  {
    temp=p[i+1];
    p[i+1]=p[i];
    p[i]=temp;
    swapped[i]=1;
    swapped[i+1]=1;
    (*swapcount)++;
  }
 }

 for(i=1;i<N+1;i++)
 {
   if((equal[i]==1)&(leftswap[i]==1)&(swapped[i-1]==0)&(swapped[i]==0))
   {
     temp=p[i-1];
     p[i-1]=p[i];
     p[i]=temp;
     swapped[i]=1;
     swapped[i-1]=1;
     (*swapcount)++;
   }
   if((equal[i]==1)&(rightswap[i]==1)&(swapped[i]==0)&(swapped[i+1]==0))
   {
    temp=p[i+1];
    p[i+1]=p[i];
    p[i]=temp;
    swapped[i]=1;
    swapped[i+1]=1;
    (*swapcount)++;
   }
 }

}

int main()
{
 int N;
 int p[100005];
 int equal[100005];
 int leftswap[100005];
 int rightswap[100005];
 int equalcount=0;
 int i;
 int swapcount=0;
 int swapped[100005];
 int j;

 scanf("%d",&N);
 for (i=1;i<N+1;i++) scanf("%d",&p[i]);
 for(j=0;j<3; j++)
 {
   checkswaps(p, leftswap, rightswap, equal, swapped, N, &equalcount);
   if (equalcount==0) break;
   swapdata(equal, leftswap, rightswap, swapped, p, N, &swapcount);
   equalcount=0;
 }

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

 return 0;
}


Measured memory_bytes: 2176
#include<iostream>
using namespace std;
int main(){
  int m,f,r;
  cin >> m >> f >> r;
  while(m!=-1||f!=-1||r!=-1){
    if(m==-1||f==-1) cout << "F" << endl;
    else if(m+f>=80) cout << "A" << endl;
    else if(m+f>=65) cout << "B" << endl;
    else if(m+f>=50) cout << "C" << endl;
    else if(m+f>=30)
      if(r>=50) cout << "C" << endl;
      else cout << "D" << endl;
    else cout << "F" << endl;
 
    cin >> m >> f >> r;
  }
  return 0;
}

Measured memory_bytes: 3132
#include<bits/stdc++.h>
#define M 10005
using namespace std;
typedef pair<int,int> P;
typedef pair<double,P> P1;

#define rank Asdfiasofsad
class UF{
public:
  int V;
  vector<int> par,rank;
  UF(){}
  UF(int V):V(V),par(V),rank(V,0){for(int i=0;i<V;i++)par[i]=i;}
  
  int find(int x){
    assert(x < V);
    if(par[x]==x)return x;
    return par[x]=find(par[x]);
  }
  
  void unite(int x,int y){
    x=find(x), y=find(y);
    if(x==y)return;
    if(rank[x]<rank[y])par[x]=y;
    else{
      par[y]=x;
      if(rank[x]==rank[y])rank[x]++;
    }
  }
  
  bool same(int x,int y){return find(x)==find(y);}
};

int n, m, a[M], b[M], c[M], d[M], ans;

bool check(double X){
  
  UF uf=UF(n);
  
  priority_queue<P1> q;
  
  double S=0;
  
  for(int i=0;i<m;i++){
    q.push(P1(d[i]-X*c[i],P(a[i],b[i])));
    S+=d[i]-X*c[i];
  }
  
  double sum=0;
  
  while(!q.empty()){
    
    P1 t=q.top(); q.pop();
    
    int A=t.second.first, B=t.second.second;
    
    if(uf.same(A,B)) continue;
    
    sum+=t.first;
    
    uf.unite(A,B);
  }
  
  return S-sum<=(1e-8);
}

void solve(){
  
  double l=0, r=100000005;
  int cnt=100;
  
  while(cnt--){
    
    double Mid=(l+r)/2.0;
    
    if(!check(Mid)) l=Mid;
    else r=Mid;
    
  }
  
  printf("%.8f\n", l);
}

int main(){
  
  cin>>n>>m;
  
  for(int i=0;i<m;i++) cin>>a[i]>>b[i]>>c[i]>>d[i];
  
  solve();
  
  return 0;
}



Measured memory_bytes: 3548
import sys
sys.setrecursionlimit(99999999)


[n,m]=list(map(int,input().split()))
friends=[]
for i in range(m):
    friends.append(list(map(int,input().split())))

tomodachi=[[]for i in range(n)]

for i in range(m):
    tomodachi[friends[i][0]-1].append(friends[i][1]-1)
    tomodachi[friends[i][1]-1].append(friends[i][0]-1)

for i in range(n):
    tomodachi[i]=list(set(tomodachi[i]))

namelist=[1 for i in range(n)]
teams=[]

def haba(x,kari,tomodachi,namelist):
    for i in range(len(tomodachi[x])):
        if namelist[tomodachi[x][i]]==1:#生き残っているなら
            kari.append(tomodachi[x][i])
            namelist[tomodachi[x][i]]=0#殺す
            haba(tomodachi[x][i],kari,tomodachi,namelist)
    return(kari)
            


for i in range(n):
    if namelist[i]==1:
        teams.append(list(set(haba(i,[i],tomodachi,namelist))))

saidai=0

for i in range(len(teams)):
    if saidai<len(teams[i]):
        saidai=len(teams[i])

ans=saidai

print(ans)


Measured memory_bytes: 262892
import java.util.Scanner;

public class Main { 
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	String line = sc.nextLine();
    	
    	boolean resultFlag = true;
    	
    	//case even
    	for(int i = 0;i<line.length();i++) {
    		if(i%2 == 1) {
    			char tmp = line.charAt(i);
    			if( tmp != 'L' && tmp != 'U' && tmp != 'D') {
    				resultFlag = false;
    			}
    		}
    	}
    	
    	
    	//case odd
    	for(int i = 0;i<line.length();i++) {
    		if(i%2 == 0) {
    			char tmp = line.charAt(i);
    			if( tmp != 'R' && tmp != 'U' && tmp != 'D') {
    				resultFlag = false;
    			}
    		}
    	}

    	if(resultFlag) {
    		System.out.println("Yes");
    	}else {
    		System.out.println("No");
    	}
    	
    	
    	
    }
}

Measured memory_bytes: 21844
ary = gets.split(" ").map(&:to_i).sort.reverse

sum = ary[0] - ary[1]

if (ary[0] - (ary[2] + sum)).odd?
  sum += (ary[0] - (ary[2] + sum) + 1) / 2 + 1
else
  sum += (ary[0] - (ary[2] + sum)) / 2
end

puts sum


Measured memory_bytes: 1788
#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)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/



typedef long long ll;
int N, K;
ll X[101], Y[101];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> K;
    rep(i, 0, N) cin >> X[i] >> Y[i];

    set<int> xx, yy;
    rep(i, 0, N) xx.insert(X[i]);
    rep(i, 0, N) yy.insert(Y[i]);

    ll ans = -1;
    fore(sx, xx) fore(sy, yy) fore(tx, xx) fore(ty, yy) if (sx <= tx and sy <= ty) {
        ll sm = 1LL * (tx - sx) * (ty - sy);

        int c = 0;
        rep(i, 0, N) if (sx <= X[i] and X[i] <= tx and sy <= Y[i] and Y[i] <= ty) c++;
        if (K <= c) {
            if (ans < 0) ans = sm;
            ans = min(ans, sm);
            
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    static final int LIMIT = 100_000;

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

        int Q = sc.nextInt();
        int[] l = new int[Q];
        int[] r = new int[Q];
        for (int i = 0; i < Q; ++i) {
            l[i] = sc.nextInt();
            r[i] = sc.nextInt();
        }

        System.out.println(solve(l, r));

        sc.close();
    }

    static String solve(int[] l, int[] r) {
        boolean[] primes = buildPrimes();

        boolean[] similars = new boolean[LIMIT + 1];
        for (int i = 0; i < similars.length; ++i) {
            similars[i] = i % 2 != 0 && primes[i] && primes[(i + 1) / 2];
        }

        int[] prefixSums = new int[LIMIT + 1];
        int prefixSum = 0;
        for (int i = 0; i < prefixSums.length; ++i) {
            prefixSum += similars[i] ? 1 : 0;
            prefixSums[i] = prefixSum;
        }

        return IntStream.range(0, l.length).mapToObj(i -> String.valueOf(prefixSums[r[i]] - prefixSums[l[i] - 1]))
                .collect(Collectors.joining("\n"));
    }

    static boolean[] buildPrimes() {
        boolean[] primes = new boolean[LIMIT + 1];
        Arrays.fill(primes, true);
        primes[0] = false;
        primes[1] = false;

        for (int i = 2; i < primes.length; ++i) {
            if (primes[i]) {
                for (long j = (long) i * i; j < primes.length; j += i) {
                    primes[(int) j] = false;
                }
            }
        }

        return primes;
    }
}

Measured memory_bytes: 91884
#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>
#include <climits>
#include <cstring>
#include <cassert>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

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

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

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using uInt = long long unsigned int;
using Double = long double;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int X;
        cin >> X;
        Int tapu = X / 500;
        Int neri = tapu * 1000;
        X %= 500;
        Int tapi = X / 5;
        neri += tapi * 5;
        cout << neri << endl;

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
#include <string>
//#include <list>
//#include <deque>
//#include <unordered_map>
//typedef long long LL;
//typedef long double LD;
using namespace std;

//#define MOD 1000000007
#define MAX 100100
//#define NIL -1

int main() {
    string s;
    int n;
    int m;
    bool ans=true;
    cin >> s;
    n = s.size();
    m = (n-1)/2;
    for(int i=0; i<n/2; i++){
        if(s[i]!=s[n-1-i]){
            ans=false;
        }
    }
    for(int i=0; i<m/2; i++){
        if(s[i]!=s[m-1-i]){
            ans=false;
        }
    }
    for(int i=0; i<m/2; i++){
        if(s[m+1+i]!=s[n-1-i]){
            ans=false;
        }
    }

    if(ans==true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

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

int check(string s){
    for (int i = 0; i < s.length(); i++){
        if (s[i] == '7') return 1;
    }
    return 0;
}


int main()
{
    string s;
    cin >> s;
    if (check(s)) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using mapis = unordered_map<Int,string>;
using mapii = unordered_map<Int,Int>;
using pii = pair<Int,Int>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}
Int printX(Int r, Int D, Int X, int count){
    if(count == 10){
        return 0;
    }
    Int nextX = r*X - D;
    cout<< nextX <<endl;
    printX(r,D,nextX,count+1);

}

int myPow(int x, int p) {
    if (p == 0) return 1;
    if (p == 1) return x;
    return x * myPow(x, p-1);
}

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

    int ans = 0;
    REP(i,1,N+1){
        if(i >0 && i<10){
            ans++;
        }
        if(i>99&&i<1000){
            ans++;
        }
        if(i>9999&&i<100000){
            ans++;
        }
    }


    cout << ans << endl;



    return 0;
}


Measured memory_bytes: 256
// Let's bring the sky down :)
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 3e5 + 5;
ll a[N];
ll dp[N];
int main()
{
    ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    dp[1] = 0;
    dp[2] = abs(a[2] - a[1]);
    for(int i = 3; i <= n; i++){
        dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
    }
    cout << dp[n];
return 0;
}


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

using namespace std;

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


const ll mod = 1000000007;
ll num[26], tot = 1;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string S;
	int N;
	cin >> N >> S;
	for (int i = 0; i < S.size(); ++i){
		num[S[i]-'a']++;
	}
	for (int i = 0; i < 26; ++i){
		tot *= (num[i]+1);
		tot %= mod;
	}
	cout << tot-1 << '\n';
	cout << flush;
	//for (int i = 0; i < 1e9; ++i){for (int j = 0; j < 1e9; ++j){}}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
    #define hell                         1000000007 
    #define M                            1000000007
    #define Maxi                      10000000000000000
        #define lcm(a,b)                     (a*b)/__gcd(a,b)
        #define ll                           long long

        #define vll                          vector<ll>
        #define vi                           vector<long long>
        #define pll                          vector< pair<ll,ll> >
        #define pb                           push_back
        //#define mp                           make_pair
        #define all(v)                       v.begin(),v.end()
        #define lbnd                         lower_bound
        #define ubnd                         upper_bound
        #define bs                           binary_search
        #define F                            first
        #define S                            second
        #define rep(i,a,b)                   for(i=a;i<b;i++)
        #define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
        #define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
        #define ret(x)                       return cout<<x,0;
        #define dbg(x)                       cout << #x << " is " << x << endl;
        //#define endl                           '\n'
     
     
        // Debug //
     
        #define trace(x)                 cerr << #x << ": " << x << endl;
        #define trace1(x)                cerr << #x << ": " << x << endl;
        #define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
        #define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
        #define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
        #define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
        #define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;


    using namespace std;
    
    //ll parent
    ll arr[100005];
    map<ll,vector<ll>>m1;
    int main()
    {

         ios_base::sync_with_stdio(false);
         cin.tie(NULL);cout.tie(NULL);
      
      priority_queue<double,vector<double>,greater<double>>pq;

      ll i,j;
      ll n;
      cin>>n;
      
      
      for(i=0;i<n;i++)
      {
        double x;
        cin>>x;
        pq.push(x);
      }
      while(pq.size()>1)
      {
        double x,y;
        x=pq.top();
        pq.pop();
        y=pq.top();
        pq.pop();

        pq.push((x+y)/2.0);
      }
      cout<<pq.top()<<endl;
      return 0;
  }
        

        
    


  



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

int main(void){
  long double a,b,h,m;cin>>a>>b>>h>>m;
  long double dig=M_PI/180*360*((h+m/60)/12-(m/60));
  printf("%20.20Lf\n",sqrtl(a*a+b*b-2*a*b*cosl(dig)));
  return 0;
}


Measured memory_bytes: 4140
#include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define ll  long long
#define mod 1000000007
#define ve vector
#define pi pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define all(v) v.begin(),v.end()
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int inf=1e9+5;


ll power(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b/=2;
	}
	return res;
}





void solve()
{
ll a[5];
    for(ll i=0;i<5;i++)
        cin>>a[i];
    
    for(ll i=0;i<5;i++)
    {
     if(a[i]==0)
     {
      cout<<i+1<<endl;
         return ;
     }
    }
    
}

signed main()
{
//#ifndef ONLINE_JUDGE
    //  freopen("input.txt","r",stdin);
    //  freopen("output.txt","w",stdout);
//#endif
    FAST;

     int t=1;
   //  cin>>t;
     while(t--)
    	solve();
    return 0;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n;
  cin >> n;
  vi p(n), a(n);
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
    --p[i];
    a[p[i]] = i;
  }
  int res = n - 1;
  for (int i = 0; i < n; ++i) {
    int j = i + 1;
    for (; j < n && a[j-1] < a[j]; ++j) {}
    res = min(res, n - (j - i));
//    cerr << i << ' ' << j << endl;
    i = j - 1;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>

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

    int cnt0 = 0, cnt1 = 0;
    
    for (auto && c : S) {
        if (c == '0') {
            if (cnt1 > 0) cnt1--;
            else cnt0++;
        } else if (c == '1') {
            if (cnt0 > 0) cnt0--;
            else cnt1++;
        }
    }
    std::cout << S.length() - cnt0 - cnt1 << std::endl;
}


Measured memory_bytes: 512
import sys
def input():
    return sys.stdin.readline()[:-1]
def main():
    a, b = map(int,input().split())
    if a > 0 and b > 0:
        print("Positive")
    elif a*b <= 0:
        print("Zero")
    else:
        if (b-a)%2 == 1:
            print("Positive")
        else:
            print("Negative")
if __name__ == '__main__':
    main()


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

int main(){
	
	int n;
	
	cin >> n;
	
	bool ans = false;
	
	for (int i = 1; i < 10; i++){
		for (int j = 1; j < 10; j++){
			if (i*j==n){
				ans = true;
			}
		}
	}
	
	if (ans){
		cout << "Yes";
	} else {
		cout << "No";
	}
	
}


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

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int count=Integer.valueOf(scan.nextLine());
		int[] input = Stream.of(scan.nextLine().split(" ")).mapToInt(Integer::valueOf).toArray();
		int result=-1;
		boolean isCont=true;
		while(isCont) {
			result++;
			for(int i=0;i<count;i++) {
				if(input[i]%2==1) {
					isCont=false;
					break;
				}
				input[i]=input[i]/2;
			}
		}
		System.out.println(result);
		scan.close();
	}
}

Measured memory_bytes: 27988
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
using namespace std;
const int inf = 1e18 + 7;
const int N = 1e6 + 7;
const int md = 1e9 + 7;
void sol() {
  int n, m;
  cin >> n >> m;
  int ans = n*(n-1)/2;
  ans += m*(m-1)/2;
  cout << ans << "\n";
}

int32_t main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  //cin >> T; while(T--) 
  sol();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <functional>
//#include <bits/stdc++.h>

using namespace std;
typedef long long unsigned int ll;	//10^18
typedef unsigned long ul;

typedef map<ll, ll> m;
typedef multimap<ll, ll> mm;
typedef set<ll> s;
typedef multiset<ll> ms;
typedef priority_queue<ll> pq;
typedef queue<ll> q;
typedef deque<ll> dq;
typedef list<ll> lst;
typedef pair<ll, ll> p;

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

//#define and &&
//#define or ||
//#define not !
//#define neq !=
//#define eq ==

#define REP(i, n) for(int i=0;i<n;i++)	// from 0 to n
#define REPR(i, n) for(int i = n;i >= 0;i--)	// from n to 0
#define FOR(i, m, n) for(int i = m;i < n;i++)	// from m to n
#define DBG(a) cout << #a << " : " << a << "\n";
#define MSG(a) cout << a << "\n";
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())

#define pb push_back	//配列などの最後に要素を追加
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second

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

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

//swap(a, b);
//sort(arr, arr + n);	//昇順
//sort(arr, arr+n, greater<int>());	//降順
//max(a, b);
//min(a, b);

//upper_bound(a, a+n, k)	//配列aの中で、kより大きい値が初めて現れる位置へのポインタ
//upper_bound(ALL(v), k)	//STLvの中で、kより大きい値が初めて現れる位置へのポインタ
//lower_bound(a, a+n, k)
//lower_bound(ALL(v), k)	//STLvの中で、kの以上値が初めて現れる位置へのポインタ
//lower_bound(ALL(v),k) - upper_bound(ALL(v),k)	//二分探索を用いて、ある列aに含まれる数kの個数を求める


// index が条件を満たすかどうか
bool isOK(vector<ll>& v, int index, int key) {
	if (v[index] >= key) return true;
	else return false;
}

// 汎用的な二分探索	
int bs(vector<ll>& v, int key) {
	int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int ok = (int)v.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	/* ok と ng のどちらが大きいかわからないことを考慮 */
	while (abs(ok - ng) > 1) {
		int mid = (ok + ng) / 2;

		if (isOK(v, mid, key)) ok = mid;
		else ng = mid;
	}
	return ok;
}

// 最大公約数
ll gcd(ll a, ll b) {
	if (a < b)	swap(a, b);
	ll r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;

}

// 素因数分解
vector<ll> prime_factorization(ll n) {
	vector<ll> cnt_pf(sqrt(n), 0);
	REP(i, SZ(cnt_pf)) {
		while (n % (i+2) == 0) {
			cnt_pf[i]++;
			n /= (i + 2);
		}
		if (n == 1)	break;
	}
	if (n != 1) {
		cnt_pf.pb(1);
	}
	return cnt_pf;
}

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

	//string s;
	//cin >> s;
	
	ll n, m;
	int ans = 1;
	cin >> n >> m;

	n = gcd(n, m);

	vector<ll> a(sqrt(n)+1);
	a = prime_factorization(n);
	REP(i, SZ(a)) {
		if (a[i] != 0) {
			ans++;
		}
	}


	printf("%d", ans);

	return 0;
}


Measured memory_bytes: 22912
# -*- coding: utf-8 -*-
"""



"""
import sys


def solve(X, A):
    if X < A:
        return 0
    return 10


def main(args):
    X, A = map(int, input().split())
    ans = solve(X, A)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 2940
#include <stdio.h>

#define MAX 100001

struct process_t {
	char name[11];
	int time;
};

void enqueue(struct process_t *);
struct process_t dequeue(void);

int head=0, tail=0;
struct process_t Q[MAX];

int main(void)
{
	int n, q, i, t=0;
	struct process_t x;
	
	scanf("%d %d", &n, &q);
	for (i=0; i<n; i++) {
		scanf("%s %d", &x.name, &x.time);
		enqueue(&x);
	}
	while (head != tail) {
		x = dequeue();
		if( x.time <= q ) {
			t += x.time;
			printf("%s %d\n", x.name, t);
		} else {
			t += q;
			x.time -= q;
			enqueue(&x);
		}
	}
	
	return 0;
}

void enqueue(struct process_t *x)
{
	Q[tail] = *x;
	tail = (tail + 1) % MAX;
}

struct process_t dequeue(void)
{
	int temp=head;
	head = (head + 1) % MAX;
	return Q[temp];
}

Measured memory_bytes: 2160
N,Y = map(int,input().split())
c = 0
for i in range(0,N+1):
    for j in range(0,N+1):
        c = ((Y-(10000*i+5000*j))/1000)
        if c.is_integer and c >= 0 and i+j+c == N:
            d = int(c)
            print(i,j,d)
            exit()
print(-1,-1,-1)

Measured memory_bytes: 9204
N = int(input())
N = N%10

if N == 2 or N == 4 or N == 5 or\
N == 7 or N == 9:
  print('hon')
elif N == 0 or N == 1 or N == 6 or\
N == 8:
  print('pon')
else:
  print('bon')

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


int main() {
  int N, L;
  cin >> N >> L;
  string str[110];
  for(int i = 0; i < N; ++i) {
    cin >> str[i];
  }
  sort(str, str + N);
  for(int i = 0; i < N; ++i) {
    cout << str[i];
  }
  cout << endl;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

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

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

int main() {
	llong N, m = 0, mm = 0;
	vector<llong> A;

	cin >> N;
	A.resize(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		if (A[i] >= m)
			mm = m, m = A[i];
		else if (A[i] > mm)
			mm = A[i];
	}

	for (auto a : A) {
		cout << (a == m ? mm : m) << endl;
	}

	return 0;
}

Measured memory_bytes: 3200
x=int(input())
k=0
j=0
if x==1:
  print("1")
  exit()
elif x==2:
  print("2")
  exit()
else:
  for i in range(x):
    if j<x:
      j+=i
      k+=1
    else:
      print(k-1)
      exit()

Measured memory_bytes: 3060
from collections import deque 
INF = 10000

H,W = map(int,input().split())
S = [list(input()) for i in range(0,H,1)]
S_count=[[INF for j in range(0,W,1)]for i in range(0,H,1)]
task_list = deque([])

def bfs(x,y,count):
    if x<0 or H-1 < x or y < 0 or W-1<y:
        return False
    if S[x][y]=="#":
        return False
    if S_count[x][y] > count:
        S_count[x][y]=count
        task_list.append([x+1,y,count+1])
        task_list.append([x-1,y,count+1])
        task_list.append([x,y-1,count+1])
        task_list.append([x,y+1,count+1])
        return True

maxi = 0

for i in range(0,H,1):
    for j in range(0,W,1):
        S_count=[[INF for j in range(0,W,1)]for i in range(0,H,1)]
        task_list.append([i,j,0])
        while(len(task_list)):
            X,Y,T = task_list.popleft()
            if bfs(X,Y,T):
                maxi = max(T,maxi)

print(maxi)

Measured memory_bytes: 56412
n = int(input())
a1 = list(map(int, input().split()))
from collections import Counter
a = Counter(a1).most_common()
l = []
for i in range(len(a)):
    if 2 <= a[i][1]:
        for h in range(a[i][1]//2):
            l.append(a[i][0])
l.sort()
if 2 <= len(l):
    print(l[-1]*l[-2])
else:
    print(0)

Measured memory_bytes: 26128
use std::cmp;

macro_rules! input {
    // ?
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };

    // stdinの生成 値の読み込み開始
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    // ?
    ($next:expr) => {};
    // ?
    ($next:expr, ) => {};

    // 変数名:型の読み込みの繰り返し
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    // 値を読み込むベース 型,の繰り返し
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    // 配列の読み込み
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    // 文字列Vec<char>の読み込み
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    // usize1?の読み込み
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    // 指定した型で読み込み
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}


fn main() {
    input! {
        a:isize,
        b:isize,
    };

    println!("{}", solve(a, b));
}

fn solve(a: isize, b: isize) -> isize {
    let plus: isize = a + b;
    let minus: isize = a - b;
    let kakeru: isize = a * b;

    return cmp::max(plus, cmp::max(minus, kakeru));
}
macro_rules! tests {
    ($($test_name:ident:$name:ident($( $args:expr ),*) => $expected:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $test_name() {
                    assert_eq!($expected,super::$name($($args),*));
                }
            )*
        }
    }
}


tests! {
    //テスト名:[引数]=>expected
    test1:solve(2,4) => 8,
    test2:solve(2,-4) => 6,
    test3:solve(0,0) => 0,
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<string.h>
#include<math.h>

#define char_num 26

int main()
{
	long long int dog_num = 0;
	int n = 0;//n行必要
	char n_list[15];
	long long int d;

	scanf("%lld", &dog_num);

	while (dog_num > (char_num*(pow(char_num, n) - 1) / 25))
	{
		n++;
	}

	d = dog_num - (char_num*(pow(char_num, (n-1)) - 1) / 25) - 1;

	for (int i = (n - 1); i >= 0; i--)
	{
		n_list[i] = (d%char_num) + 97;
		d = d / char_num;
	}

	for (int i = 0; i<n; i++)
	{
		printf("%c", n_list[i]);
	}

	return 0;
}

Measured memory_bytes: 2476
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
#define INF 100000000
#define MAX 200001
#define MOD 1000000009
ll fac[MAX],finv[MAX],inv[MAX];
typedef vector<vector<int> > Graph;
const int m=2019;

vector<ll> func(ll n){
    vector<ll> res;
    for(ll i=1;i*i<=n;i++){
        if(n%i!=0) continue;
        res.push_back(i);
        if(i*i!=n) res.push_back(n/i);
    }
    return res;
}

int main(){
    ll n;cin>>n;
    int ans=0;
    for(ll x : func(n)){
        if(x==1) continue;
        ll tmp=n;
        while(tmp%x==0) tmp/=x;
        tmp%=x;
        if(tmp==1) ans++;
    }
    ans+=func(n-1).size()-1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
A, B, C = map(int, input().split())
for i in range(100):
    if A%2 == 0 and B%2 == 0 and C%2 == 0:
        A, B, C = B+C>>1, C+A>>1, A+B>>1
    else:
        print(i)
        break
else:
    print(-1)

Measured memory_bytes: 3060
#include <stdio.h>


int Syutoku(int N, int *A);
int Maxget(int N, int *A1, int *A2);

int main(void){
	int N,max;
	int A1[100] = {0};
	int A2[100] = {0};
	scanf("%d",&N);

	Syutoku(N,&A1[0]);
	Syutoku(N,&A2[0]);

	max = Maxget(N,&A1[0],&A2[0]);

	printf("%d",max);

	return 0;
}


int Syutoku(int N, int *A){
	for(int i = 0; i < N; i++){
		scanf("%d",&A[i]);
	}
	return 0;
}



int Maxget(int N, int *A1, int *A2){
	int max = 0;
	int buf;
	for(int c = 0; c < N; c++){
		buf = 0;
		for(int i = 0; i < N; i++){
			if(i <= c)	buf += A1[i];
			if(i >= c)	buf += A2[i];
		}
		if(buf > max)	max = buf;
	}


	return max;
}

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

using namespace std;

int main(int argc, char *argv[]) {
    int N, M;
    cin >> N >> M;

    vector<int> arr;
    int cur;
    for (int i = 0; i < M; i++) {
        cin >> cur;
        arr.push_back(cur);
    }
    sort(arr.begin(), arr.end());

    vector<int> subarr;
    for (int j = 0; j < M; j++) {
        if (j == 0) continue;
        int one = arr[j - 1];
        int other = arr[j];

        int sub = abs(other - one);
        subarr.push_back(sub);
    }
    sort(subarr.begin(), subarr.end());

    if (subarr.size() == 0 || M <= N) {
        cout << 0 << endl;
    } else {
        int del = N - 1;
        auto ite = subarr.end();
        ite--;
        for (int i = 0; i < del; i++) {
            subarr.erase(ite);
            ite--;
        }
        
        int64_t ans = 0;
        for (auto sub: subarr) {
            ans += sub;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 1400
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
wrong = 0
for i, a in enumerate(A, 1):
    if i == a:
        continue
    else:
        wrong += 1
if wrong == 2 or wrong == 0:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define PI 3.1415926535897932
#define _GLIBCXX_DEBUG
#define MOD 1000000007;
using namespace std;
long long GCD(long long A,long long B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
long long LCM(long long A,long long B){
  long long g=GCD(A,B);
  return A/g*B;
}
long long num_size(long long X){
  int ans=0;
  while(true){
    if(X==0){
      break;
    }
    else{
      X/=10;
      ans++;
    }
  }
  return ans;
}
int main() {
  
  int N;
  cin>>N;
  
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  
  int ans=0;
  
  
  for(int i=0;i<N-1;i++){
    if(A[i]==i+1){
      ans++;
      swap(A[i],A[i+1]);
    }
  }
  if(A[N-1]==N){
    ans++;
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 3768
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split()))
import math;floor,ceil=math.floor,math.ceil
from collections import deque
Yes=lambda b:print('Yes')if b else print('No');YES=lambda b:print('YES')if b else print('NO')
is_even=lambda x:True if x%2==0 else False

def main():
  n=aint()
  print(int(ceil(0.5*n)))
    
if __name__ == '__main__':
  main()

Measured memory_bytes: 3316
#include <stdio.h>
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main() {
    long long N;
    scanf("%lld", &N);
    long long A[N];
    long long saidai = -1;
    long long saisyo = 10000000000;
    for(long long i = 0;i < N;i++) {
        scanf("%lld", &A[i]);
        saidai = max(saidai, A[i]);
        saisyo = min(saisyo, A[i]);
    }
    printf("%lld\n", saidai - saisyo);
    return 0;
}


Measured memory_bytes: 256
//
// Created by yamunaku on 2019/12/01.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CYESA cout<<"Yay!"<<endl
#define CNOA cout<<":("<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    // CFS;
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    rep(i, 1000){
        string x;
        if(i < 10) x.push_back('0');
        if(i < 100) x.push_back('0');
        x += to_string(i);
        int now = 0;
        rep(j, n){
            if(s[j]==x[now]){
                now++;
                if(now==3){
                    ans++;
                    break;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}

int main() {
  int n;
  cin >> n;
  int ans;
  rep(i,n) {
    int x;
    cin >> x;
    if(i==0) ans = x;
    ans = gcd(ans,x);
  }

  cout << ans << endl;
}

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

int main() {
    int n,k,a,sol=0;
    cin >> n >> k;
    vector<int> V;
    for (int i=0;i<n;i++) {
        cin >> a;
        V.push_back(a);
    }
    sort(V.begin(),V.end());

    for (int i=0;i<k;i++)
        sol+=V[i];

    cout << sol << endl;
}


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

int main () {
    int H1, M1, H2, M2, K;
    std::cin >> H1 >> M1 >> H2 >> M2 >> K;

    int H0 = H1 + K / 60;
    int M0 = M1 + K % 60;
    H0 += M0 / 60;
    M0 = M0 % 60;

    int hour = H2 - H0;
    int min;
    if (M0 <= M2) {
        min = M2 - M0;
    } else {
        min = M2 + 60 - M0;
        hour--;
    }
    std::cout << hour * 60 + min << std::endl;
}


Measured memory_bytes: 3636
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  ll d, c[26], s[365][26], t[365], ans = 0, m, x, y, v, old[2];
  ll ra[100000];
  for (int i = 0; i < 100000; i++) {
    ra[i] = (floor(20 / (log(i % 100000 + 20) / log(20)))) - 4;
  }
  set<ll> se[26];
  srand(time(NULL));
  cin >> d;
  for (int i = 0; i < 26; i++) {
    cin >> c[i];
    se[i].insert(0);
    se[i].insert(d + 1);
  }
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s[i][j];
    }
  }
  for (int i = d - 1; i >= 0; i--) {
    x = -10000000000000;
    y = -1;
    for (int j = 0; j < 26; j++) {
      set<ll>::iterator it = se[j].lower_bound(i + 1);
      it--;
      if (x < s[i][j] + (*se[j].lower_bound(i + 1) - (i + 1)) * c[j] *
                            (i + 1 - *it)) {
        y = j;
        x = s[i][j] +
            (*se[j].lower_bound(i + 1) - (i + 1)) * c[j] * (i + 1 - *it);
      }
    }
    t[i] = y;
    se[t[i]].insert(i + 1);
    ans += s[i][t[i]];
    for (int j = 0; j < 26; j++) {
      ans -= (i + 1 - *se[j].rbegin()) * c[j];
    }
  }
  for (int i = 0; i < 4000000; i++) {
    y = ra[rand() % 100000];
    x = rand() % (d - y) + 1;
    y += x;
    v = 0LL;
    v += s[x - 1][t[y - 1]] - s[x - 1][t[x - 1]] + s[y - 1][t[x - 1]] -
         s[y - 1][t[y - 1]];
    set<ll>::iterator it = se[t[x - 1]].find(x);
    it--;
    ll z = *se[t[x - 1]].upper_bound(x);
    v -= c[t[x - 1]] * (z - x) * (x - *it);
    se[t[x - 1]].erase(x);
    it = se[t[y - 1]].find(y);
    it--;
    z = *se[t[y - 1]].upper_bound(y);
    v -= c[t[y - 1]] * (z - y) * (y - *it);
    se[t[y - 1]].erase(y);
    it = se[t[y - 1]].lower_bound(x);
    it--;
    v += c[t[y - 1]] * (*se[t[y - 1]].lower_bound(x) - x) * (x - *it);
    it = se[t[x - 1]].lower_bound(y);
    it--;
    v += c[t[x - 1]] * (*se[t[x - 1]].lower_bound(y) - y) * (y - *it);
    if (v > 0LL) {
      ans += v;
      se[t[x - 1]].insert(y);
      se[t[y - 1]].insert(x);
      ll temp = t[x - 1];
      t[x - 1] = t[y - 1];
      t[y - 1] = temp;
    } else {
      se[t[x - 1]].insert(x);
      se[t[y - 1]].insert(y);
    }
  }
  for (int i = 0; i < d; i++) {
    cout << t[i] + 1 << endl;
  }
}

Measured memory_bytes: 4868
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

int ceil(int x, int y) { return (x % y == 0) ? x / y : x / y + 1; }

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

int lcm(int x, int y) { return x / gcd(x, y) * y; }

int digit(int n){
  int c = 0;
  while(n > 0){
    n /= 10;
    c++;
  }
  return c;
}

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

  int n;
  cin >> n;

  int ans = 0;
  for(int i = 1; i <= n; i++){
    if(digit(i) % 2 == 1) ++ans;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256