akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long   ll;
typedef pair<int,int> pii;
typedef pair<int,int> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii > vpi;

//#define ONLINE_JUDGE

#ifndef ONLINE_JUDGE
  #define db(x) cerr << #x << " == " << x << endl
  #define dbs(x) cerr << x << endl
  #define _ << ", " <<
#else
  #define db(x) ((void)0)
  #define dbs(x) ((void)0)
#endif

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
#define cl(x, v) memset((x), (v), sizeof(x))
#define all(x) x.begin(),x.end()
#define sz(x) int(x.size())
#define MOD 1000000007LL
#define endl '\n'
#define mdc(a, b) (__gcd((a), (b)))
#define mmc(a, b) (( (a)/__gcd((a), (b)) )*(b))

int n;

struct M{
	ll m[52][52];
	
	M mult(M x){
		M aux;
		
		for(int i=0; i<n; i++){
			for(int j=0; j<n; j++){
				aux.m[i][j] = 0LL;				
				for(int k=0; k<n; k++)
					aux.m[i][j] = (aux.m[i][j] + ((m[i][k] * x.m[k][j])%MOD) )%MOD;				
			}
		}
		
		return aux;
	}	
};

M base;

M solve(M x, ll k){
	if(k == 1LL)
		return x;
		
	if((k%2LL) == 0LL){
		M r = solve(x, k/2LL);
		return r.mult(r);
	}else{
		M r = solve(x, k/2LL);
		r = r.mult(r);
		return r.mult(x);
	}
}

int main() {	
	cin.sync_with_stdio(0);
	cin.tie(0);
	ll k;
	
	cin >> n >> k;

	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			cin >> base.m[j][i];
		}
	}
	
	ll ans = 0LL;
	M mAns = solve(base, k);
	
	for(int i=0; i<n; i++)
		for(int j=0; j<n; j++)
			ans = (ans + mAns.m[i][j])%MOD;
		
	cout << ans << endl;

	return 0;	
}


Measured memory_bytes: 6400
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
typedef long long int ll;
using namespace std;
int main()
{
	int d,n;
	cin >> d >> n;
	if(d==0){
		if(n==100){
			cout<<"101" << endl;
        }else{
			cout << n << endl;
        }
    }else if(d==1){
		if(n==100){
			cout << "10100" << endl;
        }else{
			cout << n << "00" << endl;
        }
    }else if(d==2){
		if(n==100){
			cout << "1010000" << endl;
        }else{
			cout << n << "0000" << endl;
        }
    }
  
	return 0;
}

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

public class Main {
	public static void main(String[] args) throws IOException  {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int x = Integer.parseInt(br.readLine());
			System.out.println(x*x*x);
	}
}

Measured memory_bytes: 24072
use proconio::input;

fn main() {
    input! {
        n: u64,
        m: u64,
        k: u64,
        book_a: [u64; n],
        book_b: [u64; m],
    }

    let mut accum_a = vec![0];
    let mut accum_b = vec![0];
    
    let mut acc = 0;
    for a in &book_a {
        acc += a;
        accum_a.push(acc);
    }
    acc = 0;
    for b in &book_b {
        acc += b;
        accum_b.push(acc);
    }

    let mut maximum = 0;
    let mut index_b = accum_b.len() - 1;
    for (i, a) in accum_a.iter().enumerate() {
        if k < *a {
            break;
        }
        while k - a < accum_b[index_b] {
            if index_b == 0 {
                break;
            }
            index_b -= 1;
        }
        if maximum < i + index_b {
            //println!("i {} index_b {}", i, index_b);
            maximum = i + index_b;
        }
    }

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


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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
 
  int ans = C - (A - B);
  if(ans > 0){
    cout << ans << endl;
  }else{
    cout << "0" << endl;
  }
   
  return 0;
}



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

using namespace std;


int main(){
    string s, t;
    cin>>s>>t;
    for(int i=0;i<s.size();i++){
        if(s[i]!=t[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;



    return 0;
}

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

using namespace std;
typedef long long ll;
#define len(str) (int)(str.length())
int main() {
	int L, R;
	cin >> L >> R;
	vector<vector<bool> > visit(2019, vector<bool>(2019, false));
	int min_ = 1e9;
	for (int i = L; i < R; i++)
	{
		for (int j = i + 1; j <= R; j++)
		{
			int modi = i % 2019;
			int modj = j % 2019;
			if (visit[modi][modj]) {
				cout << min_ << endl;
				return 0;
			}
			else {
				visit[modi][modj] = true;
				min_ = min(min_, (modi * modj) % 2019);
			}
		}
	}
	cout << min_ << endl;
}


Measured memory_bytes: 896
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    int N, K;
    cin >> N >> K;

    vector<ll> A(N);
    FOR(i, 0, N){
        cin >> A.at(i);
    }

    sort(ALL(A), greater<ll>());

    int sum = 0;
    FOR(i, 0, K){
        sum += A[i];
    }

    p(sum);
    
    return 0;
}

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

int s, w;

int main()
{
    cin >> s >> w;
    if(w >= s)
    {
        cout << "unsafe" << endl;
    }
    else
    {
        cout << "safe" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3620
import Data.Bits
import Data.List
import Data.Maybe(fromJust)
import Control.Monad
--import Data.Array as A ((!))
--import Data.Graph
import qualified Data.Vector.Unboxed as V
--import qualified Data.Vector.Unboxed.Mutable as VM
import Control.Monad.ST
import Data.Maybe (fromMaybe)
import qualified Data.ByteString.Char8 as BS
--import Debug.Trace

toTuple :: [a] -> (a,a)
toTuple (x:y:_) = (x,y)
toTuple _ = undefined

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

getIntList :: IO [Int]
getIntList = unfoldr (BS.readInt . BS.dropWhile (== ' ')) <$> BS.getLine

getLineB :: (Read a) => IO [a]
getLineB = map (read.BS.unpack) . BS.words <$> BS.getLine

cnt :: Int -> Int
cnt n = if even n then (1+) $ cnt $ n `div` 2 else 0

main :: IO ()
main = do
  _ <- getLine
  as <- getIntList
  print $ foldl' (\a b -> (a+) $ cnt b) 0 as


Measured memory_bytes: 1148
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列以外を出力する
    void write(){

    }
    template<typename First, typename... Rest>
    void write(First first, Rest... rest){
        cout << first << " ";
        write(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;

    int A, B, C, D, E;
    io.read(A, B, C, D, E);
    int ans = 0;
    ans += A + (10 - A % 10) % 10;
    ans += B + (10 - B % 10) % 10;
    ans += C + (10 - C % 10) % 10;
    ans += D + (10 - D % 10) % 10;
    ans += E + (10 - E % 10) % 10;

    int m = 0;
    m = max(m, (10 - A % 10) % 10);
    m = max(m, (10 - B % 10) % 10);
    m = max(m, (10 - C % 10) % 10);
    m = max(m, (10 - D % 10) % 10);
    m = max(m, (10 - E % 10) % 10);
    ans -= m;
    io.write(ans);
    return 0;
}

Measured memory_bytes: 256
from itertools import*
n=int(input())
a=[input().split()for _ in[0]*n]
for b in a:
 b[3:5]=b[4],b[3]
def f():
 for d,e in combinations(a,2):
  for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):
   f=[d[i]for i in p]
   if f[0]==e[0]and f[5]==e[5]:
    f=f[1:5]*2
    for k in range(4):
     if f[k:k+4]==e[1:5]:return'No'
 return'Yes'
print(f())


Measured memory_bytes: 5660
import java.util.*;

/**
 * Copyright © 2018 Chris. All rights reserved.
 *
 * @author Chris
 * 2018/7/5 22:51
 *
 */
public class Main {

    private static void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        int max = Math.max(a * 9, Math.max(b * 9, c * 9));
        System.out.println(max + a + b + c);
    }

    public static void main(String args[]) {

        solve(new Scanner(System.in));
    }
}


Measured memory_bytes: 21844
// #include <bits/stdc++.h>
#include <cctype>
#include <cstdio>
#include <algorithm>
#include <emmintrin.h>

using std::scanf;
using std::printf;
using std::max;
using std::isdigit;

typedef long long ll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)

#define __my_getchar getchar_unlocked
inline void read(unsigned int &x){
  x=0;char c;
  while(!isdigit(c=__my_getchar()));
  x=c-'0';
  while(isdigit(c=__my_getchar()))x=10*x+(c-'0');
}

unsigned int n,m;
const int MAX_N = 5000;
const int MAX_M = 200;
unsigned int a[MAX_N] __attribute__((aligned(16)));
unsigned int b[MAX_N * MAX_M] __attribute__((aligned(16)));
unsigned int mx[MAX_M] __attribute__((aligned(16)));

static inline __m128i __attribute__((always_inline))
po_mm_max_epi32(__m128i a, __m128i b){
  __asm__("pmaxsd %1, %0" : "+x" (a) : "xm" (b));
  return a;
}
unsigned long long tmp[2] __attribute__((aligned(16)));

// // max of two array
// // a[i] = max(a[i], b[i])
// void vec_chmax(int n, unsigned int *a, unsigned int *b){
//   for(int i=0;i<n;i+=4){
//     __m128i xx = _mm_load_si128((__m128i*)(a+i));
//     __m128i yy = _mm_load_si128((__m128i*)(b+i));
//     xx = po_mm_max_epi32(xx,yy);
//     _mm_store_si128((__m128i*)(a+i), xx);
//   }
// }

// // sum of array
// // Σa[i]
// ll vec_sumll(int n, unsigned int *a){
//   __m128i x = _mm_setzero_si128();
//   __m128i y = _mm_setzero_si128();
//   const __m128i zero = _mm_setzero_si128();
 
//   for(int i=0;i<n;i+=4){
//     __m128i xx = _mm_load_si128((__m128i*)(a+i));
//     __m128i yy = _mm_unpackhi_epi32(xx,zero);
//             xx = _mm_unpacklo_epi32(xx,zero);
//     x = _mm_add_epi64(x,xx);
//     y = _mm_add_epi64(y,yy);
//   }
//   x = _mm_add_epi64(x,y);
//   _mm_store_si128((__m128i*)tmp, x);
//   return tmp[0] + tmp[1];
// }

inline ll func(int z,ll sub){
  // vec_chmax(m,mx,b+MAX_M*z);
  // return vec_sumll(m,mx)-sub;
  __m128i x = _mm_setzero_si128();
  const __m128i zero = _mm_setzero_si128();
  for(int i=0;i<m;i+=4){
    __m128i xx = _mm_load_si128((__m128i*)(mx+i));
    __m128i yy = _mm_load_si128((__m128i*)(b+MAX_M*z+i));
    xx = po_mm_max_epi32(xx,yy);
    _mm_store_si128((__m128i*)(mx+i), xx);
    yy = _mm_unpackhi_epi32(xx,zero);
    xx = _mm_unpacklo_epi32(xx,zero);
    x = _mm_add_epi64(x,xx);
    x = _mm_add_epi64(x,yy);
  }
  _mm_store_si128((__m128i*)tmp, x);
  return tmp[0]+tmp[1]-sub;
}

int main(){
  read(n);read(m);
  REP(i,n-1)read(a[i]);
  REP(i,n)REP(j,m)read(b[MAX_M*i+j]);

  ll ans = 0;
  REP(l,n){
    ll lensum = 0;
    REP(j,m)mx[j]=0;
    ans = max(ans, func(l,lensum));

    FOR(r,l+1,n){
      lensum += a[r-1];
      ans = max(ans, func(r,lensum));
    }
  }
  printf("%lld\n",ans);
  return 0;
}


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

//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimaxze("O3", "Ofast", "unroll-loops", "fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define endl '\n'

using namespace std;

vector < string > nums;

signed main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    int i, n;
    cin >> n;
    vector < string > nums = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
    for (i = 0; i < 40000; i++){
        string ne;
        string pref = nums[i];
        if (pref.back() != '0'){
            ne = pref;
            ne.push_back(pref.back() - 1);
            nums.push_back(ne);
        }
        ne = pref;
        ne.push_back(pref.back());
        nums.push_back(ne);
        if (pref.back() != '9'){
            ne = pref;
            ne.push_back(pref.back() + 1);
            nums.push_back(ne);
        }
    }
    cout << nums[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 8068
#include <iostream>
using namespace std;
int main() {
	long long K, A, B;
	cin >> K >> A >> B;
	if (B - A <= 2 || K <= A) {
		cout << 1 + K << endl;
	}
	else {
		long long rem = (K - (A - 1)) / 2;
		cout << (B - A) * rem + (K - rem * 2) + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

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

const int INF = 10000000;
using namespace std;
typedef long long  ll;
const int MAX = 10000;

/** Problem0137 : Middle-Square Method **/
int main()
{
	int n, s, ts;
	string str, sq;
	cin >> n;
	rep(k, n) {
		cin >> s;
		
		cout << "Case " << k+1 << ":" << endl;
		rep(j, 10) {
			ts = s*s;
			str = "";
			while (ts!=0) {
				str += ts%10+'0';
				ts/=10;
			}
			reverse(str.begin(), str.end());
			if (str.length()<8) {
				string tt;
				rep(i, 8-str.length()) tt+='0';
				str = tt+str;
			}
			string sub = str.substr(2, 4);
			s=0;
			rep(i, 4) {
				s*=10; s+=sub[i]-'0';
			}
			cout << s << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,T,t[ohara];
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>T;
    rep(i,n)cin>>t[i];
    t[n]=LINF;
    rep(i,n){
        if(t[i]+T>=t[i+1])ans+=t[i+1]-t[i];
        else ans+=T;
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        sc.close();

        int N = S.length();
        String result = "";

        if (!isKaibun(S)) {
            result = "No";
        } else {
            int firstLength = (N - 1) / 2;
            if (firstLength < 0) {
                firstLength = 0;
            }
            String judge1 = S.substring(0, firstLength);
            if (!isKaibun(judge1)) {
                result = "No";
            } else {
                int secondLength = (N + 3) / 2;
                if (secondLength >= N) {
                    secondLength = N - 1;
                }
                String judge2 = S.substring(secondLength, N - 1);
                if (!isKaibun(judge2)) {
                    result = "No";
                } else {
                    result = "Yes";
                }
            }
        }

        System.out.println(result);
    }

    public static boolean isKaibun(String s) {
        int length = s.length();
        for (int i = 0; i < s.length() / 2; i++) {
            int lastIndex = length - 1 - i;
            char sentou = s.charAt(i);
            char last = s.charAt(lastIndex);
            if (sentou != last) {
                return false;
            }
            if (i == lastIndex) {
                break;
            }
        }
        return true;
    }

}


Measured memory_bytes: 23508
n = gets.to_i
a = gets.split.map(&:to_i)

if (n > 0 && a[0] == 1) || (n == 0 && a[0] != 1)
  puts -1 
  exit
end

asum = 0
a.each{|e| asum += e}
b = Array.new(n+1,0)
b[0] = 1-a[0]
asum -= a[0]

flag = 1
for d in 1..n
  asum -= a[d]
  bmax = [b[d-1]*2-a[d], asum].min
  if bmax < 0
    flag = 0
    break
  end
  b[d] = bmax
end

if flag == 1
  ans = 0
  for d in 0..n
    ans += a[d]
    ans += b[d]
  end
  puts ans
else
  puts -1
end

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

int main() {
  vector<int> suuretu={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  cout << suuretu.at(K+-1)<< endl;
}


Measured memory_bytes: 256
from itertools import accumulate
from bisect import bisect

def resolve():
    n, m, k  = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    aac = [0] + list(accumulate(a))
    bbc = [0] + list(accumulate(b))
    ans = 0
    for i, aa in enumerate(aac):
        if aa > k:
            break
        tmp = k - aa
        idx = bisect(bbc, tmp)
        if ans < i + idx - 1:
            ans = i + idx - 1
    print(ans)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 50572
n = int(input())
dp = [0] *101
dp[0] = 1
for i in range(4,101):
  if dp[i-4] != 0:
    dp[i] = 1
for i in range(7,101):
  if dp[i-7] != 0:
    dp[i] = 1
if dp[n] == 1:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
n = int(input())
s = input()
mod = 998244353
ans = 1
z, o, t = n, 0, 0
pre = ["", ["", ""]]
for i in range(3*n):
  if t != 0 and s[i] not in pre[1]:
    ans *= t
    ans %= mod
    t -= 1
    if t == 0:
      pre[1] = ["", ""]
  elif s[i] == pre[0] or o == 0:
    o += 1
    ans *= z
    ans %= mod
    z -= 1
    pre[0] = s[i]
  else:
    t += 1
    ans *= o
    ans %= mod
    o -= 1
    pre[1] = [pre[0], s[i]]
    if o == 0:
      pre[0] = ""

print(ans)


Measured memory_bytes: 4048
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#define pb push_back
#define f first
#define s second




int dfs(int k){
  int ret=0;
  if(k==0)return 0;
  if(k==1)ret+=1;
  else{
    ret+=1+dfs(k-1)*3;
  }
  return ret;
}

main(){
  int n;
  while(cin>>n){
    int h1=n/2;
    int h2=n-h1;
    cout<<dfs(h1)+dfs(h2)<<endl;
  }
}

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

int main() {
    ll n;
    cin >> n;
    if (n%2 == 1) {
        cout << 0 << endl;
        return 0;
    }
    ll out=0;
    ll divide = 10;
    while (divide <= n) {
        out += n/divide;
        divide*= 5;
    }
    cout << out << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <stdio.h>

int main(void){
  int a,b,c;
  scanf("%d %d %d", &a, &b, &c);
  
  if(a == b && a == c) printf("No");
  else if(a == b || b == c || c == a) printf("Yes");
  else printf("No");
  return 0;
}

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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define size(a) int(a.size())

const int mod = 1e9 + 7;
const ll inf = ll(1e18);
const double PI = acos(-1);

ll modexp(ll x,ll n,int md){
    if(n==0)return 1;
    if(n%2==0)return modexp((x*x)%md,n/2,md);
    return (x*modexp((x*x)%md,n/2,md))%md;
}

set<int> g[200001];
int main(){
    fastio;
    //clock_t tm = clock();
    int n;
    cin>>n;
    vi a(n),b(n),na(n+1,0),nb(n+1,0);
    priority_queue<pii>g1;
    f(i,0,n){
        cin>>a[i];na[a[i]]++;
        g[a[i]].insert(i);
    }
    f(i,0,n){
        cin>>b[i];nb[b[i]]++;
    }
    priority_queue<pii>g2;
    f(i,1,n+1){
        if(na[i]+nb[i]>n){
            cout<<"No"<<endl;
            return 0;
        }
        if(nb[i]>0){
            g2.push({nb[i],-i});
        }
        if(na[i]>0){
            g1.push({na[i],i});
        }
    }
    reverse(all(b));
    vi ans(n,0);
    while(!g2.empty()){
        auto pr=g2.top();
        g2.pop();
        if(pr.first>1){
            --pr.first;
            g2.push(pr);
        }
        pr.second*=-1;
        auto qr=g1.top();
        g1.pop();
        if(qr.second!=pr.second) {
            if (qr.first > 1) {
                --qr.first;
                g1.push(qr);
            }
            ans[*g[qr.second].begin()]=pr.second;
            g[qr.second].erase(*g[qr.second].begin());
        }
        else{
            if(g1.empty())break;
            auto qr1=g1.top();
            g1.pop();g1.push(qr);qr=qr1;
            if (qr.first > 1) {
                --qr.first;
                g1.push(qr);
            }
            ans[*g[qr.second].begin()]=pr.second;
            g[qr.second].erase(*g[qr.second].begin());
        }
    }
    cout<<"Yes"<<endl;
    fr(i,ans)cout<<i<<" ";
    cout<<endl;
    //cout<<((clock()-tm)*1.0)/CLOCKS_PER_SEC<<endl;
}

Measured memory_bytes: 29112
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
from bisect import bisect_right

N, M = mapint()

from heapq import heappop, heappush
days = [[] for _ in range(M)]
for _ in range(N):
    a, b = mapint()
    if a>M:
        continue
    days[a-1].append(-b)

queue = []

ans = 0
for i in range(M):
    lis = days[i]
    for b in lis:
        heappush(queue, b)
    if queue:
        ans += heappop(queue)

print(-ans)

Measured memory_bytes: 86300
#include<iostream>
#include<vector>

using namespace std;

int main(void)
{
	int N;
	vector<int> l;
	vector<int> r;
	int result = 0;
	int input;

	cin >> N;

	for (int i = 0; i < N; i++)
	{
		cin >> input;
		l.push_back(input);
		cin >> input;
		r.push_back(input);

		result += r[i] - l[i] + 1;
	}
	cout << result << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	string line;
	cin >> line;
	bool flag1 = false, flag2 = false;
	for (int i = 0; i < line.size(); i++){
		if (line[i] == 'C')
			flag1 = true;
		if (flag1 && line[i] == 'F')
			flag2 = true;
	}
	if (flag1 && flag2)
		cout << "Yes" << endl;
	else 
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <bits/stdc++.h>
#include <iomanip>
#include <numeric>
#include <utility>
#include <map>
#include <algorithm>
typedef long long ll;
#define rep(i, n) for (ll(i) = 0; i < (ll)(n); ++i)
#define MD 998244353
using namespace std;

struct str
{
    ll dis;
    ll roop;
};
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> A(N + 1);
    vector<ll> B(N);
    rep(i, N + 1) cin >> A[i];
    rep(i, N) cin >> B[i];
    //後ろから倒すべきである
    ll ans = 0;
    for (ll i = N - 1; i >= 0; --i)
    {
        if (B[i] - A[i + 1] >= 0) //まだ余力がある場合
        {
            B[i] -= A[i + 1];
            ans += A[i + 1];
            A[i + 1] = 0;
            if (B[i] >= A[i])
            {
                B[i] -= A[i];
                ans += A[i];
                A[i] = 0;
            }
            else
            {
                A[i] -= B[i];
                ans += B[i];
                B[i] = 0;
            }
        }
        else
        {
            A[i + 1] -= B[i];
            ans += B[i];
            B[i] = 0;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a.at(i);
  set<int> S;
  bool c = 0;
  for(int i : a) {
    if(S.count(i)) {
      c = 1;
      break;
    }
    else S.insert(i);
  }
  if(c) cout << "NO" << endl;
  else cout << "YES" << endl;
}

Measured memory_bytes: 13352
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
#include <climits>
#include <algorithm>
#include <functional>
#include <string.h>
#include <numeric>
#include <math.h>

#define LOOP(N) for(int i=0; i<(N); ++i)
#define REP(i, N) for(int i=0; i<(N); ++i)
#define FOR(i, start, end) for(int i=(start); i<(end); ++i)

using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using Graph = vector< vector<int> >;


int main() {
    int N; cin >> N;
    vector<double> v(N);
    REP(i, N) cin >> v[i];
    
    sort(v.begin(), v.end());

    double ans = v[0];
    FOR(i, 1, N) {
        ans = (ans + v[i]) / 2;
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_set>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<unordered_set<int>> g(n);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g.at(a).insert(b);
    g.at(b).insert(a);
  }

  vector<int> n_friends(n, 0);
  vector<bool> visited(n, false);
  queue<int> q;
  
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (visited.at(i)) continue;
    visited.at(i) = true;
    q.push(i);
    
    int tmp = 0;
    while (!q.empty()) {
      ++tmp;
      int v = q.front();
      q.pop();
      for (auto x : g.at(v)) {
        if (!visited.at(x)) {
          visited.at(x) = true;
          q.push(x);
        }
      }
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 35724
def dp(Map,i,j):
    ans = 0
    if i == 0 and j == 0:
        return 1
    elif Map[i][j] >= 0:
        return Map[i][j]
    else:
        if i>0:
            if vert[i-1][j]:
                ans += dp(Map,i-1,j)
        if j>0:
            if hori[i][j-1]:
                ans += dp(Map,i,j-1)
        Map[i][j] = ans
        return dp(Map,i,j)
n = int(input())
for _ in range(n):
    gx,gy = map(int,input().split())
    m = int(input())
    matatabi = []
    for _ in range(m):
        matatabi.append(list(map(int,input().split())))
    hori = [[True]*(gx+1) for _ in range(gy+1)]
    vert = [[True]*(gx+1) for _ in range(gy+1)]
    for lis in matatabi:
        if lis[0] == lis[2]:
            vert[min(lis[1],lis[3])][lis[0]] = False
        if lis[1] == lis[3]:
            hori[lis[1]][min(lis[0],lis[2])] = False
    Map = [[-1]*(gx+1) for _ in range(gy+1)]
    ans = dp(Map,gy,gx)
    if ans > 0:
        print(ans)
    elif ans == 0:
        print("Miserable Hokusai!")



Measured memory_bytes: 5620
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
inf = 10**9


def main():
    n, a, b = list(map(int, input().split()))

    print(min(n*a, b))


if __name__ == '__main__':
    main()


Measured memory_bytes: 7584
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int n, m, l, r, lma, rmi;
	//vector<int> v;

	cin>> n >> m;

	lma=0;
	rmi=n+1;

	for(int i=0;i<m;i++){
		cin>> l >> r;
		lma=max(l, lma);
		rmi=min(r, rmi);
	}

	cout<< max(0, rmi-lma+1) << endl;


}

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



typedef long long ll;

string s;
int p;
map<char,int> t;
ll f(ll a,char ch,ll b){
  if(ch=='+')return a+b;
  else if(ch=='-')return a-b;
  else return a*b;
}


ll calc(int X);

ll getNum(){
  if(s[p]=='('){
    p++;
    return calc(0);
  }else{
    ll res=0;
    while('0'<=s[p]&&s[p]<='9'){
      res=res*10+s[p]-'0';
      p++;
    }
    return res;
  }
}

ll calc(int X){
  if(X==3) return getNum();
  ll res=calc(X+1);
  while(1){
    char ch=s[p++];
    if(ch==')'||ch=='='||t[ch]<X){
      if(X!=0)p--;
      break;
    }
    res=f(res,ch,calc(X+1));
  }
  return res;
}

int main(){
  cin>>s;
  s.push_back('=');
  ll ans=LONG_LONG_MIN;
  
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        t['+']=i;
        t['-']=j;
        t['*']=k;
        p=0;
        ans=max(ans,calc(0));
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define endl '\n'

ll a[26],ans;



int main()
{
   // #ifndef ONLINE_JUDGE
   // freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
   // #endif
    int n;
    cin>>n;
    string s;
    cin>>s;
    for(auto i:s) a[i-'a']++;
    ll ans=1;
    ffor(i,0,26) ans=ans*(a[i]+1)%mod;
    cout<<(ans-1+mod)%mod;
    return 0;
}



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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int n,k;
  cin >> n;
  int a[n] = {};
  int maxA = 0;
  priority_queue<int, vector<int>, greater<int> > queue;
  for(int i=0;i<n;i++){
    cin >> a[i];
    queue.push(a[i]);
    if(maxA<a[i]) maxA=a[i];
  }
  bool isMultiple[maxA+1] = {};
  int count = 0;
  int prevX = 0;
  bool isCounted = false;

  while(!queue.empty()){
    int x = queue.top();
    queue.pop();
    if(prevX == x && isCounted){
      count--;
    }
    prevX = x;
    int y = x;
    isCounted = false;
    while(y<=maxA){
      //if(isMultiple[y]) break;
      if(x==y&&!isMultiple[y]){
        count++;
        isCounted = true;
      }
      isMultiple[y] = true;
      y += x;
    }
  }
  cout << count << endl;
  return 0;
}

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

int main(){
  	int n; cin >> n;
	set<char> arare;
  	char c;
  	for(int i = 0; i < n; ++i){
      cin >> c;
      arare.insert(c);
    }
    if(arare.size() == 3){
    	cout << "Three";
    }
    else if (arare.size() == 4){
    	cout << "Four";
    }
	return 0; 
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
bool Eratosthenes[999999+30];

int main()
{
    int n,pos;
    int c;

    while(cin>>n)
    {
        c=0;
        Eratosthenes[1]=false;

        for(int i=2; i<=n; i++) Eratosthenes[i]=true;
        for(int i=2; i<=n; i++)
        {
            if(Eratosthenes[i]==true)
            {
                pos=2*i;
                while(pos<=n)
                {
                    Eratosthenes[pos]=false;
                    pos=pos+i;
                }
            }
        }
        for(int i=1; i<=n; i++)
        {
            if(Eratosthenes[i]==true)
                c++;
        }
        cout<<c<<endl;

    }
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    vector<int> dp(n);
    rep(i,n){
        cin >> h[i];
    }
    dp[0] = 0;
    dp[1] = abs(h[0]-h[1]);
    for(int i=2;i<n;i++){
        dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
    }
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>

int main(){
  int N,M;
  scanf("%d %d",&N,&M);
  int L[M],R[M];
  for(int i=0;i<M;i ++){
    scanf("%d %d",&L[i],&R[i]);
  }
  int min = 0, max = N;
  for(int i=0;i<M;i++){
    max = R[i] < max ? R[i] : max;
    min = L[i] > min ? L[i] : min;
  }
  if(min > max) printf("0\n");
  else          printf("%d\n",max - min + 1);
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long int lli;
typedef long long ll;

int main() {
    int n,k; cin >> n >> k;
    string s;
    cin >> s;
    
    int ans = 0;
    int cnt = 0;
    int right = 0, left = 1;
    char before = s.front();
    repm(i,1,n){
        if(s[i] != before){
            before = s[i];
            if(cnt%2 == 0) right++;
            else left++;
            cnt++;
        }
        else{
            ans++;
        }
    }
    
    if(min(right,left) <= k) ans = n-1;
    else ans += 2*k;
    
    cout << ans << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>

using namespace std;
#define MAX  1000000000
#define ll long long int

int main()
{
	int w, a, b;
	int sa;
	cin >> w >> a >> b;
	if (a > b) {
		swap(a, b);
	}

	sa = - (a + w) + b;
	if (sa < 0) {
		cout << 0 << endl;
	}
	else {
		cout << sa << endl;
	}

	return (0);
}

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

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

const long long INF = numeric_limits<long long>::max();
int main(){
    long long N;
    cin >> N;
    vector<long long>S(N);
    REP(i,N)cin >> S[i];
    long long q;
    cin >> q;
    long long t,ans=0;
    REP(i,q){
        cin>>t;
        REP(i,N){
            if(S[i]==t){
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int i=0;
  while(A>0&&C>0){
    if(i%2==0){
      C -= B;
    }
    else {
      A -= D;
    }
    i++;
  }
  
  if (A<=0){
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 3620
#define ll long long
#define MOD 1000000007
#define MOD2 998244353
#define INF 1e12
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define set2d(array, val, m, n) memset(array, val, sizeof(array[0][0]) * m * n);
#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORE(i, a, b) for (int i = a; i <= b; i++)
#define pii pair<int, int>
#define pll pair<ll, ll>
#include <bits/stdc++.h>
using namespace std;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x %= p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
ll po(ll base, ll powerRaised)
{
    if (powerRaised != 0)
        return (base * po(base, powerRaised - 1));
    else
        return 1;
}
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b)
{
    return (a * b) / gcd(a, b);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif //*/
    string s;
    cin >> s;
    int dp[2019] = {0};
    dp[s[0] - '0'] = 1;
    ll ans = 0;
    for (int i = 1; i < s.size(); i++)
    {
        int tmp[2019] = {0};
        int num = (s[i] - '0');
        tmp[num] = 1;
        for (int j = 0; j < 2019; j++)
        {
            if (dp[j] > 0)
            {
                int rem = (10 * j + num) % 2019;
                if (rem == 0)
                    ans += dp[j];
                tmp[rem] += dp[j];
            }
        }
        for (int j = 0; j < 2019; j++)
            dp[j] = tmp[j];
    }
    cout << ans;
}

Measured memory_bytes: 3800
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n) - 1; 0 <= i; --i)
#define rep(i, n) for (int i = 1; i <= (n); ++i)
using namespace std;
using ll = long long;
using arr = vector<ll>;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;

ll n, k, a[55];

int main()
{
  cin >> n >> k;
  REP(i, n) cin >> a[i];

  ll ans = 0;
  for(int l = 0; l <= k; ++l) {
    for(int r = 0; r <= k - l; ++r) {
      if (l + r > n) break;
      vector<ll> tmp;
      REP(i, l) tmp.push_back(a[i]);
      REP(i, r) tmp.push_back(a[n - i - 1]);
      sort(tmp.begin(), tmp.end());
      
      int idx = 0;
      for(int i = 0; i < tmp.size() && i < k - l - r; ++i) {
        if (tmp[idx] >= 0) break;
        ++idx;
      }
      ll x = 0;
      while (idx < tmp.size()) {
        x += tmp[idx++];
      }
      ans = max(ans, x);
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
ns = list(map(int, input().split()))
cnt = sum(ns[:k])
max_cnt = cnt
for i in range(n - k):
    cnt += ns[i+k]
    cnt -= ns[i]
    max_cnt = max(max_cnt, cnt)
print((max_cnt+k)/2)


Measured memory_bytes: 71792
#include<iostream>
using namespace std;
#include<algorithm>
#include<string>
#include<map>
map<string, int>mp;
map<string, int>mp1;
string a[201000];
int main()
{
    int n, max1 = 0, i;
    ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0);
    cin >> n;
    for (i = 0;i < n;i++)
    {
        cin >> a[i];
        mp[a[i]]++;
        max1 = max(max1, mp[a[i]]);
    }
    std::sort(a, a + n);
    for (i = 0;i < n;i++)
    {
        if (mp[a[i]] == max1 && mp1[a[i]] == 0)
        {
            int len = a[i].size();
            for (int j = 0;j < len;j++)
            {
                putchar(a[i][j]);
            }
            puts("");
            mp1[a[i]] = 1;
        }
        else continue;
        //cout << a[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 47360
#include <iostream>
using namespace std;
int main()
{
	int n, x, kq=0;
	cin >> n >> x;
	int a[n], b[n+1];
	for(int i=0; i<n+1; i++)
	{
		if(i<n) cin >> a[i];
		if(i==0) b[i]=0;
		else b[i]=b[i-1]+a[i-1];
		if(x>=b[i]) kq++;
		else break;
	}
	cout << kq;
}

Measured memory_bytes: 256
def examA():
    St = S()
    ans = "2018" + St[4:]
    print(ans)


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()


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

using namespace std;
const int MAX_N = 200000 + 7;
int N, K;

double p[MAX_N];
double sum[MAX_N];//前缀和数组

int main(){
    ios::sync_with_stdio(0);
    cin >> N >> K;
    for (int i = 1; i <= N; i++){
        cin >> p[i];
        p[i] = (p[i] + 1) / 2.0;
        sum[i] = sum[i - 1] + p[i];
    }
    
    double ans = 0;
    for (int i = 1; i <= N + 1 - K; i++){
        int j = i + K - 1;
        ans = max(ans, sum[j] - sum[i - 1]);
        
    }
    //cout << ans << endl;
    printf("%.10lf", ans);
}

Measured memory_bytes: 3456
import java.util.NoSuchElementException

fun main(args: Array<String>) = FastScanner().run {
    val h = nextInt()
    val w = nextInt()
    val a = Array(h){next().toCharArray()}
    var p = Pair(0, 0)
    outer@while (true) {
        a[p.first][p.second] = '.'
        for (next in adjacent2(p.first, p.second, h, w)) if (a[next.first][next.second] == '#') {
            p = next
            continue@outer
        }
        break
    }

    var possible = true
    for (y in 0 until h)
        for (x in 0 until w)
            if (a[y][x] == '#') possible = false
    if (possible) println("Possible") else println("Impossible")
}

fun adjacent2(y: Int, x: Int, h: Int, w: Int): List<Pair<Int, Int>> {
    return listOf(Pair(1, 0), Pair(0, 1)).mapNotNull {
        val ny = y + it.first
        val nx = x + it.second
        if (nx in 0 until w && ny in 0 until h) {
            Pair(ny, nx)
        } else null
    }
}

class FastScanner {
    private val printable = 33..126
    val `in` = System.`in`
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0
    fun hasNextByte(): Boolean {
        if (ptr < buflen) {
            return true
        } else {
            ptr = 0
            buflen = `in`.read(buffer)
            if (buflen <= 0) {
                return false
            }
        }
        return true
    }
    fun readByte(): Byte {
        return if (hasNextByte()) buffer[ptr++] else return -1
    }
    fun hasNext(): Boolean {
        while (hasNextByte() && buffer[ptr] !in printable) ptr++
        return hasNextByte()
    }
    fun next(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (b in printable) {
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }
    fun nextLong(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
        if (b !in '0'.toByte()..'9'.toByte()) {
            throw NumberFormatException()
        }
        while (true) {
            if (b in '0'.toByte()..'9'.toByte()) {
                n *= 10
                n += b - '0'.toByte()
            } else if (b == (-1).toByte() || b !in printable) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }
    fun nextInt(): Int {
        val nl = nextLong()
        if (nl !in Integer.MIN_VALUE..Integer.MAX_VALUE) throw NumberFormatException()
        return nl.toInt()
    }
    fun nextDouble(): Double {
        return next().toDouble()
    }
}

Measured memory_bytes: 33868
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,a,b)for(int i=a;i<b;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define sortV(v) v.begin(),v.end()
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
// DSU
/*
const int maxn=100009;
int arr[maxn];
int sz[maxn];
void init(){rep(i,maxn){arr[i]=i;sz[i]=1;}}
int root(int a){while(a!=arr[a]){arr[a]=arr[arr[a]];a=arr[a];}return a;}
int check(int a,int b){if(root(a)==root(b))return 1;return 0;}
int un(int a,int b)
{
  int roota=root(a);int rootb=root(b);
  if(sz[roota]>=sz[rootb]){sz[roota]+=sz[rootb];arr[rootb]=roota;}
  else {sz[rootb]+=sz[roota];arr[roota]=rootb;}
}
*/
const int mod=1000000007;;
int dp[100009][15];
string s;
int solve(int index,int rem)
{
  if(index==s.size())
  {
    if(rem==5)return 1;
    else return 0;
  }
  if(dp[index][rem]!=-1)return dp[index][rem];
  int ans=0;
  if(s[index]!='?')
  {
    int newrem=(10*rem+(s[index]-'0'))%13;
    ans=solve(index+1,newrem);
    ans%=mod;
    return dp[index][rem]=ans;
  }
  else
  {
    for(int i=0;i<=9;i++)
    {
      int newrem=(10*rem+i)%13;
      ans+=solve(index+1,newrem);
      ans%=mod;
    }
  }
  ans%=mod;
  return dp[index][rem]=ans;
}
int32_t main()
{
   fastio
   cin>>s;
   repre(i,0,s.size())repre(j,0,13)dp[i][j]=-1;
   cout<<solve(0,0)<<"\n";

   return 0;
}


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

//gcdやり直す

void swap (int *x, int *y) {
  int temp;    

  temp = *x;
  *x = *y;
  *y = temp;
}




/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}




/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  long int n;
  scanf("%ld",&n);
  long int A[n+100];
  for(int i=0;i<n+100;i++){
    A[i]=0;
  }

  for(int i=1;i<=n;i++){
    for(int j=i;j<=n+10;j+=i){
      A[j]++;
    }
  }

  long int ans=0;
  for(long int i=1;i<=n;i++){
    ans+=A[i]*i;
  }

  printf("%ld\n",ans);
  return 0;
}

Measured memory_bytes: 79828