akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

class Main {

	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Q = sc.nextInt();
		long[][] STX = new long[N][3];
		for (int i = 0; i < N; i++) {
			STX[i][0] = sc.nextLong();
			STX[i][1] = sc.nextLong();
			STX[i][2] = sc.nextLong();
			STX[i][0] -= STX[i][2];
			STX[i][1] -= STX[i][2];
		}
		Arrays.sort(STX, (a, b) -> Long.compare(a[2], b[2]));

		NavigableSet<long[]> s = new TreeSet<>((a, b) -> Long.compare(a[0], b[0]));
		for (int i = 0; i < Q; i++) {
			long d = sc.nextLong();
			s.add(new long[]{d, i});
		}

		long[] answer = new long[Q];
		Arrays.fill(answer, Long.MAX_VALUE);

		for (int i = 0; i < N; i++) {
			long[] stx = STX[i];
			while (true) {
				if (s.isEmpty()) break;
				long[] x = s.ceiling(new long[]{stx[0], 0});
				if (x == null) break;
				if (x[0] >= stx[1]) break;
				answer[(int) x[1]] = stx[2];
				s.remove(x);
			}
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < Q; i++) {
			if (answer[i] == Long.MAX_VALUE) {
				sb.append(-1);
			} else {
				sb.append(answer[i]);
			}
			sb.append("\n");
		}

		System.out.print(sb.toString());
	}


}


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

using namespace std;

int main(void){
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++) cin >> p[i];
    int ans = 0;
    for(int i = 1; i < n - 1; i++){
        if(p[i - 1] < p[i] && p[i] < p[i + 1] || p[i - 1] > p[i] && p[i] > p[i + 1]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

S = input()
TAP = 'x'

TAP += S

for i in range(1,len(S)+1):
  if i % 2 == 1:
    if TAP[i] != 'R' and TAP[i] != 'U' and TAP[i] != 'D':
      print('No')
      sys.exit()
  else:
    if TAP[i] != 'L' and TAP[i] != 'U' and TAP[i] != 'D':
      print('No')
      sys.exit()

print('Yes')


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

int main(){
    int x; cin >> x;
    vector<int> prime = {2,3};
    for(int i = 5; i < 110000; i++){
        for(int p : prime){
            if(i%p==0) break;
            else if(p*p>i){
                prime.push_back(i);
                break;
            }
        }
    }
    for(int p : prime){
        if(p >= x){
            cout << p << endl;
            break;
        }
    }
}

Measured memory_bytes: 384
#include<stdio.h>

int V[150][150],d[150],f[150],color[150],Q[150];
int time, n,head,tail;

void enqueue(int x){
  Q[tail] = x;
  tail++;
}

int dequeue(){
  int x = Q[head];
  head++;

  return x;
}

BFS(int s){
  int u,v;

  for(u = 1; u <= n; u++){
    color[u] = 0;
    d[u] = -1;
  }

  color[s] = 1;
  d[s] = 0;
  enqueue(s);

  while(head != tail){
    u = dequeue();
    for(v = 1; v <= n; v++){
      if(color[v] == 0 && V[u][v] == 1){
	color[v] = 1;
	d[v] = d[u] + 1;
	enqueue(v);
      }
    }
    color[u] = 2;
  }
}

int main(){
  int i,j,v,m,k,s=1;

  scanf("%d",&n);

  for(i = 1; i <= n; i++){
    scanf("%d%d",&v,&m);
    for(j = 1; j <= m; j++){
      scanf("%d",&k);
      V[v][k] = 1;
    }
  }

  BFS(s);

  for(i = 1; i <= n; i++){
    printf("%d %d\n",i,d[i]);
  }

  return 0;
}

Measured memory_bytes: 656
#include <iostream>

using namespace std;

int main()
{
    int a, b, c, x;
    cin >> a;   // 500 yen
    cin >> b;   // 100 yen
    cin >> c;   // 50 yen
    cin >> x;

    int count = 0;
    for (int i = 0; i <= a; ++i) {
        for (int j = 0; j <= b; ++j) {
            for (int k = 0; k <= c; ++k) {
                if ((500 * i + 100 * j + 50 * k) == x)
                    ++count;
            }
        }
    }

    cout << count << '\n';
}


Measured memory_bytes: 888
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=200010;
priority_queue<int>q;
pair<int,int>ints[N];
int rest[N],rs=0;
int main(){
	int n=ni,l=1,r=ni;
	for(int i=1;i<=n;i++){
		ints[i].first=ni,ints[i].second=ni;
	}
	sort(ints+1,ints+n+1);
	for(int i=1;i<=n;i++){
		q.push(-ints[i].second);
		if(l<=r&&l<=ints[i].first){
			l++;
		}else{
			rest[++rs]=-q.top();
			q.pop();
		}
	}
	sort(rest+1,rest+rs+1);
	int cnt=0;
	for(int i=rs;i>=1;i--){
		if(l<=r&&rest[i]<=r){
			r--;
		}else{
			cnt++;
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        ll n, a, b;
        in >> n >> a >> b;
        out << min(n*a, b) << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, int> P;
#define MOD (1000000007ll)

int main(void){
	int n,i,p=-1;
	string s;
	char ans[100];
	cin >> s;
	n = s.length();
	for(i=0; i<n; ++i){
		if(s[i] == 'B'){
			p = max(-1,p-1);
		}else{
			p++;
			ans[p] = s[i];
		}
	}
	for(i=0; i<=p; ++i){
		cout << ans[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){

 
  int j, i, m, n;

  while(1){
    scanf("%d", &n);
 long long int a[5000]={0}, b[5000]={0}, c[5000]={0}, d[5000]={0}; 


    if(n == 0) break;

 

    m = 0;
    for(i = 0; i < n; i++){
      scanf("%lld %lld %lld", &a[i], &b[i], &c[i]);
      d[i] = b[i] * c[i];
    }
    for(i = 0; i < n; i++){
      for(j = 0; j < n; j++){
	if(a[i] == a[j] && i != j){
	  d[i] = d[i] + d[j];
	  a[j] = 0;
	}
      }
    }



    for(i = 0; i < n; i++){


      if(d[i] >= 1000000 && a[i] != 0){
	m++;
	printf("%lld\n", a[i]);
      }
    }
    if(m == 0)
      printf("NA\n");
  }


  return 0;
}

Measured memory_bytes: 0
public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        long n = scanner.nextInt(), m = scanner.nextInt(), n1 = 1, m1 = 1;
        if (Math.abs(n - m) >= 2) {
            System.out.println(0);
        } else {
            for (long i = 2; i <= n; i++)
                n1 = i * n1 % 1000000007;
            for (long i = 2; i <= m; i++)
                m1 = i * m1 % 1000000007;
            if (n == m) System.out.println(n1 * m1 % 1000000007L * 2L % 1000000007L);
            else System.out.println(n1 * m1 % 1000000007L);
        }
    }
}

Measured memory_bytes: 22740
program atcoder
implicit none
integer :: n, m, i, j, r, z, dz
integer, allocatable :: a(:), b(:), dp(:)
character(len=16384) :: ans

read(*,*) n,m
allocate(a(m),b(m),dp(0:n)) ! i本のマッチをちょうど使って作れる最大の桁数
read(*,*) (a(i), i=1,m)

call reverse_sort(m,a)

do i = 1, m
	call num(a(i), b(i))
end do

dp = -1 !初期値

dp(0) = 0

do i = 1, n
	do j = 1, m
    	if(i-b(j) >= 0)then
			call chmax(dp(i),dp(i-b(j))+1)
        end if
    end do
end do

ans = ''
z = n
do j = 1, maxval(dp)
	do i = 1, m
		if(dp(z)-1 == dp(z-b(i)) .and. z-b(i) >= 0)then
    		ans(j:j) = achar(48+a(i))
			z = z - b(i)
            exit
    	end if
	end do
end do

deallocate(a,b,dp)
write(*,'(a)') trim(ans)

contains

subroutine chmax(dp,x)
implicit none
integer :: dp, x

if (dp < x) then
	dp = x
	return
end if
end subroutine

subroutine num(r,s)
implicit none
integer :: r, s
if(r == 1)then
    s = 2
end if
if(r == 2 .or. r == 3 .or. r == 5)then
	s = 5
end if
if(r == 4)then
    s = 4
end if
if(r == 6 .or. r == 9)then
    s = 6
end if
if(r == 7)then
	s = 3
end if
if(r == 8)then
	s = 7
end if
end subroutine

subroutine reverse_sort(m,a)
    implicit none
    integer, intent(in)    :: m
    integer, intent(inout) :: a(m)
    integer                :: i, j
    do i = m-1, 1, -1
      do j = 1, i
        if (a(j) .lt. a(j+1)) call swap(a(j),a(j+1))
      end do
    end do
    return
end subroutine reverse_sort
 
subroutine swap(a,b)
    implicit none
    integer, intent(inout) :: a, b
    integer                :: c
    c = a
    a = b
	b = c
	return
end subroutine swap

end program atcoder


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <bits/stdc++.h>
#include <algorithm>

using namespace std;

int main() {
    int n, a, b;
    scanf("%d %d %d", &n, &a, &b);

    if (n*a > b) {
        cout << b << endl;
    } else {
        cout << n*a << endl;
    }
}


Measured memory_bytes: 256
N = int(input())
ts = list(map(int, input().split()))
vs = list(map(int, input().split()))

maxv = [0] # vel=0 at initial
for v,t in zip(vs,ts):
    maxv[-1] = min(maxv[-1], v)
    for ti in range(t*2):
        maxv.append(v)
maxv[-1] = 0 # vel=0 at last
T = len(maxv)
# print(T)

for i in range(T-1):
    maxv[i+1] = min(maxv[i+1], maxv[i]+0.5)

for i in reversed(range(T-1)):
    maxv[i] = min(maxv[i], maxv[i+1]+0.5)
    
ans = 0
for i in range(T-1):
    ans += (maxv[i] + maxv[i+1])/4
print(ans)


Measured memory_bytes: 3500
import Data.List
main = do
  [n,_] <- map read . words <$> getLine :: IO [Int]
  ds <- map (map read . words) . lines <$> getContents :: IO [[Int]]
  let solve = [() | i <- [0..(n-1)],
                    j <- [0..(n-1)],
                    let x = sum $ map (\[a,b] -> (abs (a-b))^2) $ transpose [(ds !! i), (ds !! j)],
                    (sqrt $ realToFrac x) - realToFrac (floor $ sqrt $ realToFrac x) == 0.0,
                    i /= j]
  print $ (length solve) `div` 2

Measured memory_bytes: 1020
#include <iostream>
#include <cmath>
#define MAX_NUM 1000001
#define MAX 100
using namespace std;
long long int seq[MAX_NUM];
//int seq[MAX_NUM];

int inputnumber(int *n){
	cin >> *n;
	return 0;
}

int inputsequence(int n,long long int *sq){
	for(int i=0;i<n;i++){
		cin >> *(sq+i);
		/*if(i>100467)
			cout << i << " " << *(sq+i) << endl;*/
	}
	return 0;
}

void printsequence(int n,long long int *s){
	for(int i=0;i<n;i++)
		cout << *(s+i) << endl;
}

void printsequence1(int n,int *s){
	for(int i=0;i<n-1;i++)
		cout << *(s+i) << ' ';
	cout << *(s+n-1) << endl;
}

int insertionSort(int n,long long int *s,int g,int *count){
	int i,j;
	long long int value;
	for(i=g;i<n;i++){
		value=*(s+i);
		j=i-g;
		while(j>=0 && *(s+j)>value){
			*(s+j+g)=*(s+j);
			j-=g;
			*count = *count +1;
		}
		*(s+j+g)=value;
	}
	return 0;
}

int shellSort(int n,int m,int *g,long long int *s,int *count){
	for(int i=0;i<m;i++){
		insertionSort(n,s,*(g+i),count);
	}
	return 0;
}

int makeg(int n, int *m, int *g, long long int *s){
	int i=0,mt,et[MAX];
	if(n<4){
		*m=1;
		*g=1;
	}else{
		et[0]=n-1;
		mt=n-1;
		i++;
		while((mt=(mt*2)/4)>0 && i<MAX){
			et[i]=mt;
			i++;
			//cout << i << ' ' << mt << endl;
		}
		if(i>=MAX){
			et[i-1]=1;
		}
		*m=i;
		//cout << i << ' ' << *m << endl;
		//for(int j=0;j<i;j++)
		//	cout << et[j] << ' ';
		//cout << endl;
		i--;
		for(;i>=0;i--){
			g[i]=et[i];
		}
	}
	return 0;

}


int main() {
	int n;

	int m,count,g[MAX];
	//float mn;

	//m=3;
	//g[0]=4;
	//g[1]=4;
	//g[2]=1;
	count=0;

	inputnumber(&n);
	inputsequence(n,seq);

	makeg(n,&m,g,seq);

	//cout << "g" << ' ' << m << endl;
	//printsequence1(m,g);
	//cout << n << endl;
	//printsequence1(n,seq);

	//m=1;
	//g[0]=1;

	shellSort(n,m,g,seq,&count);
	cout << m << endl;
	printsequence1(m,g);
	cout << count << endl;
	printsequence(n,seq);
	//mn=(float)n;
	//mn=sqrt(mn) * mn;
	//cout << "n1.5 = " << mn << endl;


	return 0;
}



Measured memory_bytes: 10896
N = int(input())
a = list(map(int, input().split()))
c = 0
color = []
for a_i in a:
    if a_i>=3200:
        c += 1
    else:
        color.append(a_i//400)
    
ans_min = len(set(color))

print(max(ans_min, 1), ans_min+c)

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

int main() {
    string s;
    cin >> s;

    string key = "keyence";
    int cur = 0;

    rep(i, s.length()) rep(j, s.length()) {
        string t = s;
        t.erase(i, j);
        if (t == "keyence") {
            cout << "YES" << endl;
            return 0;
        }
    }

    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
let rec solve n k candidates =
  if k < n
  then List.nth candidates k
  else
    let n', candidates' =
      List.fold_left (fun (n', candidates') x ->
        match x mod 10 with
        | 0 -> (n' + 2, 10 * x + 1 :: 10 * x :: candidates')
        | 9 -> (n' + 2, 10 * x + 9 :: 10 * x + 8 :: candidates')
        | _ -> (n' + 3, 10 * x + x mod 10 + 1 :: 10 * x + x mod 10 :: 10 * x + x mod 10 - 1 :: candidates')) (0, []) candidates in
    solve n' (k - n) @@ List.rev candidates'
let solve k = solve 9 k [1; 2; 3; 4; 5; 6; 7; 8; 9]

let () = Scanf.scanf "%d" @@ fun k ->
  Printf.printf "%d\n" @@ solve @@ k - 1

Measured memory_bytes: 8576
loop do
    n, k, m = gets.split.map &:to_i
    break if n == 0

    a = (1..n).to_a
    m -= 1

    until a.size == 1
        a.delete_at(m)
        m = (m + k - 1) % a.size
    end
    p a[0]
end

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

using namespace std;

int main(){
    string a,b;
    while(cin>>a>>b){
        int i = 0,j = 0;
        while(1){
            if(i < a.size()) cout<<a[i],i++;
            if(j < b.size()) cout<<b[j],j++;
            if(i == a.size()&&j == b.size()) break;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int main() {
	int n;
	while (cin >> n && n) {
		VI a(n); rep(i, n)cin >> a[i];

		int ans = 0;
		for (int i = n - 1; i >= 0; i--) {
			for (int j = 0; j < i; j++) {
				if (a[j] > a[j + 1]) {
					swap(a[j], a[j + 1]);
					ans++;
				}
			}
		}
		Cout(ans);
	}
}


Measured memory_bytes: 2996
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n;i++)
#define ll long long
#include <bits/stdc++.h>
using namespace std;
#define mo 1000000007
#define ull unsigned long long 

int main(){
  ull a,b,c;cin>>a>>b>>c;
  ull s=4*a*b;
  if(a+b<c){
  ull t=(c-a-b)*(c-a-b);
  if(s<t)
    cout<<"Yes";
  else
    cout<<"No";
  }
  else{
    cout<<"No";
  }

  
}
  
  
  


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

//-----------------------------------------------------------------------------

int n;
string s[2]={"..##",".#.#"};

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

	cin>>n;
	string t[2];
	REP(i,4) {
		char res;
		cout<<s[0][i]<<endl<<s[1][i]<<endl;
		cin>>res;
		if(res=='T') {
			t[0]=s[0][i],t[1]=s[1][i];
			break;
		}
	}
	while (true) {
		bool flg=false;
		REP(j,4) {
			REP(i,2) {
				cout<<t[i]<<s[i][j]<<endl;
			}
			char res;
			cin>>res;
			if(res=='T') {
				REP(k,2) t[k]+=s[k][j];
				flg=true;
				break;
			}
		}
		if(!flg||t[0].size()==n) break;
	}
	if(t[0].size()==n) {
		REP(i,2) cout<<t[i]<<endl;
		return 0;
	}
	while (true) {
		bool flg=false;
		REP(j,4) {
			REP(i,2) {
				cout<<s[i][j]<<t[i]<<endl;
			}
			char res;
			cin>>res;
			if(res=='T') {
				REP(k,2) t[k]=s[k][j]+t[k];
				flg=true;
				break;
			}
		}
		if(!flg||t[0].size()==n) break;
	}
	REP(i,2) cout<<t[i]<<endl;

	return 0;
}


Measured memory_bytes: 724
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <cctype>
#include <fstream>
#include <cstring>
#include <unordered_map>

using namespace std;

#define ll long long
#define MOD 1000000007
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define du(x) cout<<#x<<'='<<x<<endl
#define du2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define du3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());


int main() {

    int A, B;
    cin >> A>>B;
    int ans = B;
    if (A >= 13) {
        ans = B;
    }
    else if (A >= 6) {
        ans /= 2;
    }

    else ans = 0;
    cout << ans << endl;



}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc046/tasks/abc046_b
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    int ans = k;
    REP(i, n - 1) { ans *= (k - 1); }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

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

	int fe[10][10] = {0};
	rep(i, 1, n + 1) {
		int num = i;
		int end = num % 10;
		while ( num / 10 ) num /= 10;
		int first = num;
		fe[first][end]++;
	}
	int ans = 0;
	rep(f, 0, 10) {
		rep(e, 0, 10) {
			ans += fe[f][e] * fe[e][f];
		}
	}
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	static final int INF = 1000000000;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		Node[] inn = new Node[101];
		int[][] dp = new int[101][101];
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			int l = sc.nextInt();
			if(n == 0 && m == 0 & l == 0){
				break;
			}
			for(int i = 1; i <= n; i++){
				inn[i] = new Node(i);
			}
			for(int i = 0; i < m; i++){
				int a = sc.nextInt();
				int b = sc.nextInt();
				int d = sc.nextInt();
				int e = sc.nextInt();
				
				inn[a].edges.add(new Edge(e, d, inn[b]));
				inn[b].edges.add(new Edge(e, d, inn[a]));
			}
			boolean[] flg = new boolean[n + 1];
			for(int i = 0; i <= n; i++){
				flg[i] = false;
			}
			for(int i = 1; i <= n; i++){
				for(int j = 0; j <= l; j++){
					dp[i][j] = INF;
				}
			}
			PriorityQueue<Node> q = new PriorityQueue<Node>();
			int len = 0;
			dp[1][0] = 0;
			q.add(inn[1]);
			while(!q.isEmpty()){
				Node node = q.poll();
				len = node.c;
				for(Edge e : node.edges){
					// ???????????£????????????
					if(len + e.d <= l){ // ?????¨??????????????????
						// ?????¨?????£?????´???????\???????????????°????°???????????????????
						if(dp[e.t.n][len + e.d] > dp[node.n][len]){
							Node nnode = new Node(e.t.n);
							nnode.edges = e.t.edges;
							nnode.c = len + e.d;
							q.add(nnode);
							dp[e.t.n][len + e.d] = dp[node.n][len] ;
						}
					}
					// ????????£???????????????
					// ?????¨??????????????´???????\???????????????°????????????
					if(dp[e.t.n][len] > dp[node.n][len] + e.e){
						Node nnode = new Node(e.t.n);
						nnode.edges = e.t.edges;
						nnode.c = len;
						q.add(nnode);
						dp[e.t.n][len] = dp[node.n][len] + e.e;
					}
				}
			}
			
			int min = INF;
			for(int i = 0; i <= l; i++){
				min = Math.min(min, dp[n][i]);
			}
			System.out.println(min);
			System.gc();
		}
		
		
		sc.close();
	}
}
class Node implements Comparable<Node>{
	int n;
	int c;
	LinkedList<Edge> edges;
	Node(int number){
		edges = new LinkedList<Edge>();
		n = number;
		c = 0;
	}
	public int compareTo(Node o) {
		// TODO Auto-generated method stub
		return n - o.n;
	}
}
class Edge{
	boolean flg;
	int e;
	int d;
	Node t;
	Edge(int enemy, int dist, Node to){
		e = enemy;
		d = dist;
		t = to;
		flg = false;
	}
}

Measured memory_bytes: 73920
n=int(input())
L=[0,0,0,0,0]
for _ in range(n):
    s=input()
    if s[0]=="M":
        L[0]+=1
    elif s[0]=="A":
        L[1]+=1
    elif s[0]=="R":
        L[2]+=1
    elif s[0]=="C":
        L[3]+=1
    elif s[0]=="H":
        L[4]+=1
ans=0
for i in range(5):
    for j in range(i+1,5):
        for k in range(j+1,5):
            ans+=L[i]*L[j]*L[k]
print(ans)

Measured memory_bytes: 3064
first=list(map(int,input().split()))
n,w=first[0],first[1]
data=[]
for i in range(n):
    a=list(map(int,input().split()))
    vpwi=a[0]/a[1]
    data.append([vpwi,a[0],a[1]])
data.sort(reverse=True)

wtot=0
vtot=0
i=0
for i in range(n):
    if wtot+data[i][2]<=w:
        wtot+=data[i][2]
        vtot+=data[i][1]
    else:
        vtot+=data[i][0]*(w-wtot)
        break

print(vtot)



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

const int MAX = 1000001;
char p[MAX] = {};
inline void foo(int n){
	if( n >= MAX || p[n] ) return;
	p[n] = 1;
	foo(n*2);
	foo(n*3);
	foo(n*5);
}

int main(){
	int n,m;
	foo(1);

	while( cin >> m >> n ){
		int ans = 0;
		for(int i=m ; i<=n ; ++i ){
			if( p[i] )
				++ans;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 0
#include <stdio.h>

#define INF 1000000000

#define min(a, b) (((a) < (b)) ? (a) : (b))

const int di[2][9] = {{-2, -1, -1, 0, 0, 0, 1, 1, 2}, {-2, -1, -1, 0, 0, 0, 1, 1, 2}};
const int dj[2][9] = {{1, 1, 2, 1, 2, 3, 1, 2, 1}, {-1, -2, -1, -3, -2, -1, -2, -1, -1}};

typedef struct {
	int i, j, f, d;
} PairCoordDis;

PairCoordDis heap[32400];
int hsize;

void insert(int i, int j, int f, int d) {
	int ii;
	for (ii = hsize++; ii > 0 && d < heap[ii - 1 >> 1].d; ii = ii - 1 >> 1)
		heap[ii] = heap[ii - 1 >> 1];
	heap[ii] = (PairCoordDis){i, j, f, d};
}

int calcNextIdx(int i) {
	return i * 2 + 1 + (i * 2 + 2 < hsize && heap[i * 2 + 1].d > heap[i * 2 + 2].d);
}

PairCoordDis delete(void) {
	int i;
	int nextIdx;
	const PairCoordDis root = heap[0], last = heap[--hsize];

	for (i = 0; i * 2 + 1 < hsize && last.d > heap[nextIdx = calcNextIdx(i)].d; i = nextIdx)
		heap[i] = heap[nextIdx];
	heap[i] = last;

	return root;
}

char field[60][30];
int cost[60][30];
int d[60][30][2];

void dijkstra(int h, int w, int si, int sj, int sf) {
	int i, j;

	for (i = 0; i < h; i++)
		for (j = 0; j < w; j++)
			d[i][j][0] = d[i][j][1] = INF;

	d[si][sj][sf] = 0;
	insert(si, sj, sf, 0);
	while (hsize > 0) {
		const PairCoordDis fromP = delete();
		const int nf = fromP.f ^ 1;

		if (fromP.d > d[fromP.i][fromP.j][fromP.f])
			continue;

		for (i = 0; i < 9; i++) {
			const int ni = fromP.i + di[fromP.f][i], nj = fromP.j + dj[fromP.f][i];
			if (ni >= 0 && ni < h && nj >= 0 && nj < w)
				if (fromP.d + cost[ni][nj] < d[ni][nj][nf]) {
					d[ni][nj][nf] = fromP.d + cost[ni][nj];
					insert(ni, nj, nf, d[ni][nj][nf]);
				}
		}
	}
}

int main(void) {
	int i, j, k;
	int w, h;

	while (scanf("%d %d", &w, &h), w) {
		int min;

		for (i = 0; i < h; i++)
			for (j = 0; j < w; j++) {
				scanf(" %c", field[i] + j);
				cost[i][j] = field[i][j] == 'X' ? INF : field[i][j] <= '9' ? field[i][j] - '0' : 0;
			}

		min = INF;
		for (i = 0; i < w; i++)
			if (field[h - 1][i] == 'S')
				for (j = 0; j < 2; j++) {
					dijkstra(h, w, h - 1, i, j);
					for (k = 0; k < w; k++)
						if (field[0][k] == 'T') {
							min = min(min, d[0][k][0]);
							min = min(min, d[0][k][1]);
						}
				}

		printf("%d\n", min == INF ? -1 : min);
	}

	return 0;
}

Measured memory_bytes: 632
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int A = sc.nextInt();
        int B = sc.nextInt();
        if(B % A == 0) System.out.println(A + B);
        else System.out.println(B - A);
    }
}


Measured memory_bytes: 21844
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <regex>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
const long long INF =  999999999;

int N,M;

int main(){
  cin>>N>>M;
  if(N==M)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef long long int ll;

int main()
{
    int A,B;
    cin>>A>>B;
    if(B==1){cout<<0;return 0;}
    B-=A;
    if(B>0)cout<<1+(B+A-2)/(A-1);
    else cout<<1;
}


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

int main()
{
    ll n;
    cin >> n;
    string s, t;
    cin >> s >> t;

    rep(i, n){
        bool flg = true;
        rep(j, n-i){
            if (s[i+j] != t[j]){
                flg = false;
            }
        }
        if (flg){
            ll ans = n + i;
            cout << ans << endl;
            return 0;
        }
    }
    ll ans = n + n;
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3580
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        List<List<Character>> list = new ArrayList<>();
        for (int i = 0; i < h; i++) {
            List<Character> list2 = new ArrayList<>();
            String s = sc.next();
            for (int j = 0; j < w; j++) {
                list2.add(s.charAt(j));
            }
            list.add(list2);
        }
        while(true) {
            int size = list.size();
            List<Integer> list3 = new ArrayList<>();
            int index = 0;
            for (List<Character> list2 : list) {
                boolean flag = true;
                for (int i = 0; i < list2.size(); i++) {
                    if(list2.get(i) == '#') {
                        flag = false;
                        break;
                    }
                }
                if(flag) {
                    list3.add(index);
                }
                index++;
            }
            Collections.sort(list3);
            Collections.reverse(list3);
            for (int i : list3) {
                list.remove(i);
            }
            if(size == list.size()) {
                break;
            }
        }
        while(true) {
            int size = list.get(0).size();
            List<Integer> list3 = new ArrayList<>();
            for (int i = 0; i < size; i++) {
                boolean flag = true;
                for (int j = 0; j < list.size(); j++) {
                    char tmp = list.get(j).get(i);
                    if(tmp == '#') {
                        flag = false;
                        break;
                    }
                }
                if(flag) {
                    list3.add(i);
                }
            }
            Collections.sort(list3);
            Collections.reverse(list3);
            for (int i : list3) {
                for (int j = 0; j < list.size(); j++) {
                    list.get(j).remove(i);
                }
            }
            if(size == list.get(0).size()) {
                break;
            }
        }
        for (List<Character> list2 : list) {
            for (int i = 0; i < list2.size(); i++) {
                System.out.print(list2.get(i));
            }
            System.out.println();
        }
    }
}

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

typedef long long ll;

int main()
{
  int n, a[100000], b[100000];

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

  ll ans = 0;
  for(int i = n-1; i>= 0; i--){
    if((a[i] + ans) % b[i] != 0)
      ans += b[i] - (a[i] + ans)%b[i];
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<12;
LL dp[SIZE][SIZE];
void solve() {
    MOD=998244353;
    int A,B,C,D;
    R(A,B,C,D);
    dp[A][B]=1;
    FOR(i,A,C)FOR(j,B,D){
        ADD(dp[i][j],dp[i-1][j]*j+dp[i][j-1]*i-dp[i-1][j-1]*(i-1)%MOD*(j-1));
    }
    W(dp[C][D]);
}
int main(){
#define MULTITEST 0
#if MULTITEST    
    CASET{
        solve();
    }
#else
    solve();
#endif
    return 0;
}


Measured memory_bytes: 75652
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    vector<int> p(n);
    int mx = 0;
    int sum = 0;
    rep(i, 0, n){
        cin >> p[i];
        mx = max(mx, p[i]);
        sum += p[i];
    }
    cout << sum - mx/2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

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

const long long MOD = 1e9+7;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os; 
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> s(h + 1, vector<char>(w + 1, '.'));
    rep(i, h) rep(j, w) cin >> s[i + 1][j + 1];
    
    vector<vector<P>> cnt(h + 1, vector<P>(w + 1));
    rep(i, h) rep(j, w) {
        cnt[i + 1][j + 1].first = cnt[i + 1][j].first;
        if (s[i + 1][j] == '.' && s[i + 1][j + 1] == '#') cnt[i + 1][j + 1].first++;
        cnt[i + 1][j + 1].second = cnt[i][j + 1].second;
        if (s[i][j + 1] == '.' && s[i + 1][j + 1] == '#') cnt[i + 1][j + 1].second++;
    }
    
    //print(cnt, " ");
    
    const int INF = 1000;
    vector<vector<int>> dp(h + 1, vector<int>(w + 1, INF));
    dp[0][1] = dp[1][0] = 0;
    
    rep(i, h) rep(j, w) {
        rep(pj, j + 1) {
            chmin(dp[i + 1][j + 1], dp[i + 1][pj] + (cnt[i + 1][j + 1].first - cnt[i + 1][pj].first));
        }
        rep(pi, i + 1) chmin(dp[i + 1][j + 1], dp[pi][j + 1] + (cnt[i + 1][j + 1].second - cnt[pi][j + 1].second));
    }
    
    cout << dp[h][w] << endl;
    //print(dp, " ");
}

Measured memory_bytes: 384
/**
*	created: 11.08.2020 17:34:57
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
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;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

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

    // 競プロにおいて，bit演算の話が出てくるのは大概"bit全探索"のときになります
    // bit全探索というのは，合計2^n通りの場合を全て調べるときに使われます．
    // この問題では，2^H * 2^W 通りの塗り方がありますが，1 <= H,W <= 6 という制約を考えると，
    // その全てをチェックしても制限時間に間に合うので，bit全探索をします．

    // 入力
    int h, w, k; cin >> h >> w >> k;
    char mp[h][w]; // charを要素に持つ二次元配列(vectorとは違って可変長ではない)の宣言
    rep(i,h) rep(j,w) cin >> mp[i][j]; // 入力
    int ans = 0;
    // 各々の塗り方について，黒いマスがいくつ残っているかを調べたい
    // 2重ループで計2^H * 2^W 通りを調べる
    // bit1は行の情報，bit2は列の情報を保持していると考えます．
    rep(bit1,(1<<h)) rep(bit2,(1<<w)) {
        int cnt = 0; // 黒いマスの個数を保持する変数
        // 2重ループで，黒いマスがいくつあるかを調べる
        rep(i,h) rep(j,w) {
            // いま，i行目j列目のマスを見ています．
            // ここで，bit1, bit2を二進数表記にして見たとき，
            // "右から"i,j番目が1であるならば，i行目とj列目は赤く塗られていると考える．
            // では，その判定をどのように行うか
            // 一つ目のアイデアとしては，bit1とbit2を二進数に変換する関数を考えて
            // それを更にstringに変換し各桁が0か1かチェックをする
            // →面倒臭い
            // ここでbitシフト&演算の出番！
            // bit演算において，足りない部分のbitは0で埋められることに注意すると
            // bit1,bit2を"右に"i,jだけシフトして，1とAND演算を行うことを考える
            // 結果が1の時，bit1,bit2の"右から"i,j番目は赤く塗られていると判定すればよい
            // ここで，bit1,bit2を"右から眺める"ということが必要になる
            // これは10進数で"n桁目"を考える時と逆なので，若干直感に反します．
            // c++では1はtrueと同義であることに注意して
            if ((bit1 >> i) & 1) continue; // i行目が塗られている時はスルー
            else if ((bit2 >> j) & 1) continue; // j行目が塗られている時もスルー
            else if (mp[i][j] == '#') cnt++; // 赤色に塗られていなくて，黒色のマスだったらカウント
        }
            if (cnt == k) ans++; //カウントした結果がkと等しかったら，答えを+1
        
    }
    cout << ans << endl; // 出力して終了
    return 0;
}

Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main() {
	int S;
	cin >> S;
	int h = S / 3600;
	S -= 3600 * h;
	int m = S / 60;
	S -= 60 * m;
	cout << h << ":" << m << ":" << S << endl;
	return 0;
}


Measured memory_bytes: 3096
#include<iostream>
#include<string>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<cstdlib>
#include<queue>
#include<utility> //pair
using namespace std;

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

typedef long long ll;

int main() {
	//入力;
	int d;
	cin >> d;

	cout << "Christmas";
	REP(i, 25 - d) {
		cout << " Eve";
	}
	cout << endl;

	//小数点以下の桁数表示;
	//cout << fixed << setprecision(15);


	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int main(){
	int n=0,a[125],count=0,mini=0;
	scanf("%d", &n);
	for(int i=0;i<n;i++){
		scanf("%d", &a[i]);
	}
	for(int i=0;i<n-1;i++){
		mini=i ;
		for(int j=i;j<n;j++)
			if(a[j]<a[mini])mini=j;
				if(i!=mini){
				int b=a[i];
				a[i]=a[mini];
				a[mini]=b;
				count++;	
			}
		}
    
	for(int i=0;i<n;i++){
		if(i)printf(" ");
		printf("%d",a[i]);
	}
	printf("\n%d\n",count);
	return 0;
} 

Measured memory_bytes: 2752
/***
**   AUTHOR::ASHUTOSH MOUDGIL
***/


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

#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F first
#define S second
#define int long long
//#define ll long long
#define all(x) x.begin(),x.end()
#define rsort(x) sort(all(x)); reverse(all(x));
#define endl '\n'
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define vi vector<int>
#define vlli vector<long long>
#define pii pair<int,int>
#define mod 1000000007
#define LMAX 1e18
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define PI 3.141592654
#define dbg1(x) cout << #x <<"="<< x <<endl;
#define dbg2(x,y) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<endl;
#define dbg3(x,y,z) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<", "<<#z<<"="<<z<<endl;
#define dbg4(x,y,z,a) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<", "<<#z<<"="<<z<< ", "<<#a <<"="<<a << endl;
#define dbgarr(x) cout << #x<<endl;for(int i : x){cout << i <<" ";} cout <<endl;



void mymain(){
   int x,y,a,b,c;
   cin >> x >> y >> a >> b >> c;
   vector<pair<int,char>> arr;
   vi a1,b1,c1;

   for(int i=0;i<a;i++){
        int tmp;cin >> tmp;
        //arr.pb(mp(tmp,'R'));
        a1.pb(tmp);
   }
   for(int i=0;i<b;i++){
        int tmp;cin >> tmp;
        //arr.pb(mp(tmp,'G'));
        b1.pb(tmp);
   }
   for(int i=0;i<c;i++){
        int tmp;cin >> tmp;
        arr.pb(mp(tmp,'C'));
        c1.pb(tmp);
   }

    rsort(a1);
    rsort(b1);
    rsort(c1);


    for(int i=0;i<x;i++)
        arr.pb(mp(a1[i],'R'));
    for(int i=0;i<y;i++)
        arr.pb(mp(b1[i],'G'));
    rsort(arr);
    int ans=0;
    for(int i=0;i<x+y;i++)
        ans += arr[i].F;
    cout << ans << endl;
    /*
    int ans1 = 0,ans2=0,x1=x,x2=x,y1=y,y2=y;
    for(pair<int,char> p : arr){
        if((p.S == 'R' || p.S == 'C') && x1>0){
            ans1 += p.F; x1--;
        }else if((p.S == 'G' || p.S == 'C') && y1>0){
            ans1 += p.F; y1--;
        }

        if((p.S == 'G' || p.S == 'C') && y2>0){
            ans2 += p.F; y2--;
        }else if((p.S == 'R' || p.S == 'C') && x2>0){
            ans2 += p.F; x2--;
        }
    }

    cout << max(ans1,ans2) << endl;
    */
}

signed main(){
IOS;
///freopen("input.txt", "r", stdin);
///freopen("output.txt", "w", stdout);
int t=1;
//cin>>t;
for(int tt=0;tt<t;tt++){
   ///cout << "Case #" << tt+1 <<": ";
   mymain();
   }
return 0;
}
/*

*/


Measured memory_bytes: 13164
N, K = map(int, input().split())
P = list(map(int, input().split()))

res = 0

P2 = []
for i in P:
  P2.append(0.5 * (i + 1))
num = 0
for i in range(K):
  num += P2[i]
res = num
for i in range(1,N-K+1):
  temp = num + P2[i+K-1] - P2[i-1]
  if temp > res:
    res = temp
  num = temp
  
print(res)

Measured memory_bytes: 100232
N, K = map(int,input().split())
R,S,P = map(int,input().split())
T = input()
V = {'r':P, 's':R, 'p':S}
ans = 0

for i in range(K):
    check = T[i]
    ans += V[check]
    while True:
        i += K
        if i >= N:
            break
        if check == T[i]:
            check = '-1'
        else:
            ans += V[T[i]]
            check = T[i]
print(ans)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define pb push_back
#define f first
#define s second     
#define fio ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define mp make_pair
#define int long long
using namespace std;
const int INF = 1e9;
const int MAX = 1e5+3;
int MOD = 1e9+7;
int n, m, v, p;
int arr[MAX];

bool is_pos(int mid)
{
   int temp_arr[MAX];
   memcpy(temp_arr, arr, n*sizeof(int));
   int ind = mid, tot = v*m;
   while(tot > 0 && ind >= 0)
   {
      temp_arr[ind] += m;
      tot -= m;
      ind--;
   }
   int to_be_equal = temp_arr[mid];
   ind = mid+1;
   while(tot > 0 && ind < n)
   {
      if(temp_arr[ind] >= to_be_equal)
         break;
      tot -= (to_be_equal-temp_arr[ind]);
      temp_arr[ind] = to_be_equal;
      ind++;
   }
   int last_ind = ind;
   if(tot > 0)
   {
      ind = n-1;
      while(tot > 0 && ind >= 0)
      {
         int to_add = min(m-(temp_arr[ind]-arr[ind]), tot);
         temp_arr[ind] += to_add;
         tot = tot - to_add;
         ind--;
      }
   }
   vector<pair<pair<int, int>, int> > dis;
   dis.pb({{-temp_arr[mid], -10}, mid});
   int curr_prior = 1;
   for(int i=0;i<n;i++)
   {
      if(i != mid){
         dis.pb({{-temp_arr[i], curr_prior}, i});
         curr_prior++;
      }
   } 
   sort(dis.begin(), dis.end());
   for(int i=0;i<p;i++)
   {
      if(dis[i].s == mid)
         return true;
   }

   return false;

}

int32_t main()
{
   cin>>n>>m>>v>>p;
   for(int i=0;i<n;i++)
      cin>>arr[i];
   sort(arr, arr+n);
   int ans = n, mid, low = 0, hi = n-1;
   while(low <= hi)
   {
      mid = (low+hi)/2;
      bool curr_pos = is_pos(mid);
      if(curr_pos)
      {
         ans = mid;
         hi = mid-1;
      }
      else
         low = mid+1;
   }

   cout<<n-ans;

}




         

Measured memory_bytes: 8056
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RSORT(x) sort(x.begin(), x.end(), std::greater<int>())
#define swap(a, b) \
  do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
#define vi vector<int>
using namespace std;

const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main() {

  vector<char> v;
  
  REP(i, 3) {
    REP(j, 3) {
      char c;
      cin >> c;
      if(i == j) {
        v.push_back(c);
      }
    }
  }

  for(auto _v: v)
    cout << _v;
  cout << endl;
  
}


Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

int main(){
	int N, M, sum;
	scanf("%d%d", &N, &M);
	int A[M];
	sum = 0;
	for(int i = 0; i<M; i++){
	    scanf("%d", &A[i]);
	    sum += A[i];
	}
	if(sum <= N){
	    printf("%d", N-sum);
	}
	else{
	    printf("-1");
	}
	return 0;
	
}


Measured memory_bytes: 1772
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <list>
#include <iomanip>
#define rep(i,n) for(int i=0; i<n; ++i)
using namespace std;

int main() {
    int n;
    cin >> n;
    int x[n], y[n];
    for (int i = 0; i < n; ++i) cin >> x[i] >> y[i];
    long double ans = 0;
    for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) {
        ans += sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
    }
    cout << setprecision(15) << ans / n << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int n;
  scanf("%d", &n);
  
  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) {
      if(i*j == n) {
        printf("Yes\n");
        return 0;
      }
    }
  }
  
  printf("No\n");
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	int n, c, k;
	cin >> n >> c >> k;
	int t[n];
	REP(i, 0, n) cin >> t[i];
	
	sort(t, t+n);
	int ans = 0;
	REP(i, 0, n){
		int dep_time = t[i], dep_people=c;
		while(i<n && dep_people > 0 && t[i] <= dep_time + k){
			--dep_people;
			++i;
			//cout << dep_people << " " << i << " " << t[i] << " " << dep_time << " " << dep_time+k<< endl;
		}
		++ans;
		--i;
	}
	cout << ans;

}


Measured memory_bytes: 640
import sys
def input():
    return sys.stdin.readline()[:-1]
N = int(input())
l = list(map(int, input().split()))
l.sort()

cnt = 0
pre_a = -1
for i in range(N-1,1,-1):
    tmp = 0
    a = l[i]
    lm = a//2
    pre_k = 0
    for j in range(i-1,0,-1):
        b = l[j]
        if b<=lm:
            continue
        a_b = a+b
        for k in range(pre_k,j):
            c = l[k]
            if (b+c>a):
                tmp += j-k
                pre_k = k
                break
    cnt += tmp
print(cnt)

Measured memory_bytes: 44508
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[]{sc.nextInt(), sc.nextInt()};
        int sum = 0;
        int n = 100 * (a[0] - a[1]);
        int m = a[1] * 1900;

        System.out.println((n + m) * (2 << a[1] - 1));
    }
}


Measured memory_bytes: 23124