akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



enum Type{
	YES,
	NO,
	UNDEFINED,
};


int M;
int index_table;
int NUM[3][8005];
char INPUT[3][3005],table[3][8005];
Type type[26],ans_type[26];
bool is_OK,IS_UPPER[3][8005];


bool is_upper(char ch){

	return ch <= 'Z';
}

int get_num(char ch){

	if(is_upper(ch)){

		return ch-'A';
	}else{

		return ch-'a';
	}
}

bool check(int index){

	for(int row = 0; row < 3; row++){

		int tmp_ch = get_num(table[row][index]);

		if((IS_UPPER[row][index] == true && type[tmp_ch] == NO) ||
				(IS_UPPER[row][index] == false && type[tmp_ch] == YES)){

			return true;
		}
	}

	int ch[3];
	for(int row = 0; row < 3; row++){

		ch[row] = NUM[row][index];
	}

	//同種で大小が異なる文字がある
	for(int i = 0; i < 3; i++){
		if(ch[i] == ch[(i+1)%3] && table[i][index] != table[(i+1)%3][index]){
			return true;
		}
	}

	return false;
}

bool recursive(int index){

	if(is_OK)return true;

	if(index == index_table){

		for(int i = 0; i < 26; i++){

			ans_type[i] = type[i];
		}
		is_OK = true;
		return true;
	}

	//分岐不要
	if(check(index)){

		return recursive(index+1);
	}

	int undef[3];
	int undef_index = 0;
	for(int row = 0; row < 3; row++){
		if(type[NUM[row][index]] == UNDEFINED){

			undef[undef_index++] = row;
		}
	}

	if(undef_index == 0)return false;

	int ch;

	//このままでは通れない
	for(int i = 0; i < undef_index; i++){

		ch = NUM[undef[i]][index];
		if(type[ch] == UNDEFINED){
			if(IS_UPPER[undef[i]][index]){

				type[ch] = NO;

			}else{

				type[ch] = YES;
			}
			if(recursive(index+1)){

				return true;
			}
			if(IS_UPPER[undef[i]][index]){

				type[ch] = YES;

			}else{

				type[ch] = NO;
			}
		}
	}
	for(int i = 0 ; i < undef_index; i++){

		type[NUM[undef[i]][index]] = UNDEFINED;
	}

	return false;
}

void func(){

	for(int row = 0; row < 3; row++){

		scanf("%s",INPUT[row]);
	}

	is_OK = false;
	for(int i = 0; i < 26; i++){

		type[i] = UNDEFINED;
	}

	index_table = 0;
	for(int i = 0; i < M; i++){

		int base_col = 3*i;

		for(int state = 0; state < 8; state++){
			for(int row = 0; row < 3; row++){
				if(state & (1 << row)){

					table[row][index_table] = INPUT[row][base_col+1];

				}else{

					table[row][index_table] = INPUT[row][base_col+2];
				}
				IS_UPPER[row][index_table] = is_upper(table[row][index_table]);
				NUM[row][index_table] = get_num(table[row][index_table]);
			}
			index_table++;
		}
	}

	recursive(0);

	if(!is_OK){

		printf("-1\n");

	}else{

		vector<int> ANS;

		for(int loop = 0; loop < 26; loop++){
			if(ans_type[loop] == YES){
				ANS.push_back(loop);
			}
		}

		printf("%lld",ANS.size());

		for(int i = 0; i < ANS.size(); i++){

			printf(" %c",'A'+ANS[i]);
		}
		printf("\n");
	}
}

int main(){

	while(true){

		scanf("%d",&M);

		if(M == 0)break;

		func();
	}

	return 0;
}



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

int main() {
  int64_t N=0;
  int64_t K=0;
  cin>>N>>K;
  int64_t total=0;
  for(int64_t i=K; i<N+2; i++){
    total+=N*i-i*(i-1)+1;
  }
  total %=1000000007LL;
  cout<< total;
}


Measured memory_bytes: 3636
n, m = map(int, input().split())
mod = 10 ** 9 + 7
if m == 1:
    print(1)
    exit()

f = [1 for _ in range(10 ** 7)]
f_inv = [1 for _ in range(10 ** 7)]
for i in range(1, 10 ** 6):
    f[i] = f[i-1] * i % mod
    f_inv[i] = pow(f[i], mod-2, mod)

def comb(n, k):
    return f[n] * f_inv[k] * f_inv[n-k] % mod
def factorization(n):
    arr = []
    tmp = n
    for i in range(2, int(n**0.5)+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            arr.append([i, cnt])

    if tmp != 1:
        arr.append([tmp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr

arr = factorization(m)

ans = 1
for _, k in arr:
    ans *= comb(n+k-1, k)
    ans %= mod

print(ans)

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

int main(){
    int n;
    cin >> n;
    string s;
    int bit[n];
    long count = 0;
    map <string, long> map;
    for(int i = 0; i < n; i++){
        cin >> s;
        sort(s.begin(), s.end());
        auto itr = map.find(s);
        if(itr != map.end()){
            count += map[s];
            map[s]++;
        }else{
            map[s] = 1;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 11136
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//#define int long long
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; }
template<class T>void println(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void) {
    int a, b, c; cin >> a >> b >> c;
    if(b - a == c - b) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
 
static class MainClass {

  public static void Main (string[] args) {
    var X = ReadLineInt_1();
    var ans = 0;

    for(var i = 1; i <= 9; i++){
      if(X <= i * 111){
          ans = i * 111;
          break;
      }
    }

    Console.WriteLine(ans);
  }

  static int ReadLineInt_1() {
    return int.Parse(Console.ReadLine());
  }
 static string ReadLineString() {
    return Console.ReadLine();
  }
  static IEnumerable<long> ReadLineLongList() {
    return Console.ReadLine().Split(' ').Select(long.Parse);
  }

}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e8
#define MOD 1000000007
typedef long long ll;



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

      string s; cin >> s;
      if(s[0]=='7' || s[1] == '7' || s[2]=='7'){
            cout << "Yes" << endl;
      }else{
            cout << "No" << endl;
      }


      return 0;
}


Measured memory_bytes: 3640
// Problem B

#include <stdio.h>
#include <iostream>
#include <vector>
#include <string.h>
#include <cassert>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <stack>

#define MAXN 300000
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long int ll;
typedef pair<int, int> ii;

char num[MAXN];

int main() {
  cin >> num;
  int l = strlen(num);
  int sum = 0;
  for (int i=0; i<l; i++)
    sum = (sum + num[i] - '0')%9;
  
  if (sum == 0) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


Measured memory_bytes: 3784
fun main(args: Array<String>) {

    abc143b()
}


fun abc143b() {
    var result = 0

    val n = readLine()!!
    val dList = readLine()!!.split(" ").map(String::toInt)

    for ((i, d1) in dList.withIndex()) {

        for (i2 in (i + 1) until dList.size) {
            result += d1 * dList[i2]
        }
    }

    println(result)
}


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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (max({ a,b }) - min({ a,b }) <= d && max({ b,c }) - min({ b,c }) <= d) {
		cout << "Yes" << endl;
	}
	else if (max({ a,c }) - min({ a,c }) <= d) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

Measured memory_bytes: 256
s=input()
k=int(input())
ls=[]
lord=[]
for i in range(len(s)):
    ls.append(s[i])
    lord.append(ord(s[i]))
i=0
while k>0 and i<len(s):#z的码值为122，再变成a，次数需要增加1，则123。
    if lord[i]!=97 and k>=123-lord[i]:    #如原本为a,则不变
        k=k-(123-lord[i])
        lord[i]=97
        ls[i]='a'
    i+=1

if k>0:
    lord[-1]=lord[-1]+k%26
    ls[-1]=chr(lord[-1])
for x in ls:
    print(x,end="")






Measured memory_bytes: 6404
import java.util.Scanner;
import java.util.Stack;	

public class Main {
	public static void main(String[] args) {
		//System.out.println("t");
		
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scan = new Scanner(System.in);
		
		int value = 0;
		
		while(scan.hasNext()) {
			String e = scan.next();
			if(e.equals("+")) {
				stack.push(stack.pop() + stack.pop());
			} else if(e.equals("-")) {
				stack.push(-1*(stack.pop() - stack.pop()));
			} else if(e.equals("*")) {
				stack.push(stack.pop() * stack.pop());
			}else {
				stack.push(Integer.parseInt(e));
			}
			value = stack.peek();
			//System.out.println(value);
		}
		//System.out.println("here");
		System.out.println(value);
		
	}
}



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

using namespace std;

long A, B;

int main() {
  cin >> A >> B;

  if (A > B) {
    swap(A, B);
  }

  long hoge = B + A;
  if (hoge % 2 == 0) {
    long x = hoge / 2;
    cout << x << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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

int main(){
ll n,k;
cin>>n>>k;
string s;
cin>>s;
s[k-1]=s[k-1]+' ';
cout<<s<<endl;
}










Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt", "r", stdin)
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long LL;
void read(int& val) { int x = 0; int bz = 1; char c; for (c = getchar(); (c<'0' || c>'9') && c != '-'; c = getchar()); if (c == '-') { bz = -1; c = getchar(); }for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48; val = x * bz; }
const int maxn = 1e6+10;

struct node{
    int x,id;
    bool operator<(const node b){
        return x<b.x;
    }
}p[maxn];

bool ok[maxn];
vector<int>ans;

int main(){

    int n;read(n);
    fo(i,1,n){
        read(p[i].x);p[i].id=i;
    }
    sort(p+1,p+1+n);

    fo(i,1,n){
        if(ok[p[i].x]) continue;
        if(p[i].x!=p[i+1].x) ans.push_back(p[i].id);
        for(int j = p[i].x;j<=1e6;j+=p[i].x){
            ok[j]=true;
        }
    }

    printf("%d\n",ans.size());
    return 0;
}

Measured memory_bytes: 6260
from collections import defaultdict

d = {1:"a", 2:"b", 3:"c", 4:"d", 5:"e", 6:"f", 7:"g", 8:"h", \
     9:"i", 10:"j", 11:"k", 12:"l", 13:"m", 14:"n", 15:"o", 16:"p", 17:"q", \
      18:"r", 19:"s", 20:"t", 21:"u", 22:"v", 23:"w", 24:"x", 25:"y", 0:"z"}

N = int(input())
n = N
ans = ""

while n > 0:
    x = n%26
    ans += d[x]
    if(x == 0):
        n = n//26-1
    else:
        n //= 26

print(ans[::-1])

Measured memory_bytes: 9420
#include<stdio.h>
int main(){
int n,i,ans=0;
char a='A',b;
  scanf("%d\n",&n);
  for(i=0;i<n;i++){
    scanf("%c",&b);
    if(i!=0 && a!=b){
      ans++;
    }
    a=b;
  }
  printf("%d\n",ans+1);
return 0;
}

Measured memory_bytes: 128
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    N = II()
    print((pow(10,N,P)-2*pow(9,N,P)+pow(8,N,P))%P)
    
main()

Measured memory_bytes: 65132
#include <iostream>
#include <limits.h>
#include <vector>

using namespace std;

int main()
{
  int N,M,C;
  vector<int> B;

  cin >> N >> M >> C;
  
  for (int ii=0; ii<M; ++ii) {
    int b;
    cin >> b;
    B.push_back(b);
  }

  int count = 0;
  for (int ii=0; ii<N; ++ii) {
    int64_t sum = 0;
    for (int m=0; m<M; ++m) {
      int a;
      cin >> a;
      sum += a*B[m];
    }
    if ((sum+C)>0)
      ++count;
  }
  
  cout << count << endl;

  return 0;
}

Measured memory_bytes: 888
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var S = Console.ReadLine();
            var answer = S == "ABC" ? "ARC" : "ABC";
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 25900
N = int(input())
Value_list = [int(x) for x in input().split()]
Cost_list = [int(x) for x in input().split()]
diff_sum = 0

for i in range(N):
    
    difference = Value_list[i] - Cost_list[i]
    
    if difference < 0:
        pass
    else:
        diff_sum += difference

print(diff_sum)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <iomanip>
using namespace std;
int n;
int cnt[3]={0};
vector<vector<vector<double>>>dp;
double cal(int a,int b,int c)
{
  if(a+b+c==0)return 0;
  double res=0;
  if(a>0){res+=dp[a-1][b][c]*a;}
  if(b>0){res+=dp[a+1][b-1][c]*b;}
  if(c>0){res+=dp[a][b+1][c-1]*c;}
  res+=n;
  res=res/(a+b+c);
  return res;
}
int main()
{
  ios::sync_with_stdio(false);
  std::cout<<fixed<<setprecision(10);
  cin>>n;

  for(int i=0;i<n;i++)
  {
    int tmp;
    cin>>tmp;
    cnt[tmp-1]++;
  }
  dp=vector<vector<vector<double>>>(n+1,vector<vector<double>>(cnt[1]+cnt[2]+1,vector<double>(cnt[2]+1,-1)));
  dp[0][0][0]=0.0;
  for(int i=0;i<cnt[2]+1;i++)
  {
    for(int j=0;j<cnt[1]+cnt[2]+1-i;j++)
    {
      for(int k=0;k<n+1-i-j;k++)
      {
        dp[k][j][i]=cal(k,j,i);
      }
    }
  }
  cout<<dp[cnt[0]][cnt[1]][cnt[2]]<<endl;
  return 0;

}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int N = nextInt();
  cout << (N-2)*180 << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 256
//
// Created by GGG1235 on 2019/11/24.
//

#include <bits/stdc++.h>

#pragma GCC optimize(3)

using namespace std;

typedef long long LL;

int main(int argc,const char **argv,const char **envp)
{
    ios::sync_with_stdio(false);
    cin.tie();

    int nN;
    
    int nRes = 0;
    
    cin >> nN;
    vector<int> kvLi(2 * nN + 1,0);
    for (int i = 1; i <= 2 * nN; i++)
    {
        cin >> kvLi[i];
    }
    sort(kvLi.begin() + 1, kvLi.end());
    for (int i = 1; i <= 2 * nN; i += 2)
    {
        nRes += kvLi[i];
    }
    kvLi.clear();
    cout << nRes << endl;
    return 0;
}

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

int main()
{
    string str, res = "";

    while( cin >> str )
    {
        int size = str.size();
        if( size <= 2 );
        else if( size == 3 )
        {
            if( str[2] == '.' || str[2] == ',' );
            else
                res += " " + str;
        }
        else if( 4 <= size && size <= 6 )
        {
            if( str[size-1] == '.' || str[size-1] == ',' )
            {
                res += " ";
                for( int i = 0; i < size - 1; i++ )
                    res += str[i];
            }
            else
                res += " " + str;
        }
        else if( size == 7 )
        {
            if( str[6] == '.' || str[6] == ',' )
            {
                res += " ";
                for( int i = 0; i < size - 1; i++ )
                    res += str[i];
            }
            else;
        }
        else;
    }
    for( int i = 1; i < res.size(); i++ )
        cout << res[i];
    cout << endl;
    return 0;
}


Measured memory_bytes: 3148
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//
//#include <immintrin.h>
//#include <emmintrin.h>

#include <bits/stdc++.h>
//#pragma GCC optimize("O2")
#define vi vector<int>
#define pii pair<int, int >
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define LL long long
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define all2(x,n) (x+1), (x+1+n)
#define sz(x) ((int)(x).size())
#define mod(x) ((x)%MOD)
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define mt make_tuple
#define eb emplace_back
#define o(X) (1<<(X))
#define oL(X) (1LL<<(X))
#define contain(S,X) (((S)&o(X))!=0)
#define containL(S,X) (((S)&oL(X))!=0)
using namespace std;
const int INF=0x3f3f3f3f,N=1e6+5,MOD=998244353;
const LL INF_LL=0x3f3f3f3f3f3f3f3fLL;
inline int getplc(int x,int y) { return (x>>y)&1; }
template<typename T>
T square(T x) {return x*x;}
LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
	LL res=1;
	for(;b;b>>=1,a=a*a%_MOD){
		if(b&1)res=res*a%_MOD;
	}
	return res;
}
// Smax
//int Smax() { return -INF; }
template <typename T>
T Smax(T x) { return x; }
template<typename T, typename... Args>
T Smax(T a, Args... args) { return max(a, Smax(args...)); }
// Smin
template <typename T>
T Smin(T x) { return x; }
template<typename T, typename... Args>
T Smin(T a, Args... args) { return min(a, Smin(args...)); }
template <typename T>
// erro
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); errl(_it, args); }

void errl(istream_iterator<string> it) {}
template<typename T, typename... Args>
void errl(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	errl(++it, args...);
}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl;}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << "=" << a << " # ";
	err(++it, args...);
}
void Solve();
int main() {
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//    freopen("o1.txt","w",stdout);
#endif
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	Solve();
	return 0;
}

//////////////////////////////////////////////////////////////////

int n,a[N];

LL check(int mid){
  LL res=0;
  rep(i,1,n){
    res+=(a[i]-1)/mid;
  }
  return res;
}
void Solve(){
  int k,maxn=0;
  cin>>n>>k;
  rep(i,1,n){
    cin>>a[i];
    maxn=max(maxn,a[i]);
  }
  int l=1,r=maxn,mid,ans=-1;
  while(l<=r){
    mid=(l+r)>>1;
    if(check(mid)<=k)ans=mid,r=mid-1;
    else l=mid+1;
  }
  cout<<ans<<endl;
}

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

int main () {
  int A, B, C;
  cin >> A >> B >> C;
  
  if ((A == C) && (B == C)) cout << 1 << endl;
  else if (A == B) cout << 2 << endl;
  else if (A == C) cout << 2 << endl;
  else if (B == C) cout << 2 << endl;
  else cout << 3 << endl;
}

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

#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=2e5+5;
int a[N],q[N],ans[N];
bool a_xiao(int x,int y)
{
	return a[x]<a[y];
}

int main()
{
	int n;
	cin>>n;
	rep(i,1,n)scanf("%d",a+i);
	rep(i,1,n)q[i]=i;
	sort(q+1,q+n+1,a_xiao);
	rep(i,1,n)ans[q[i]]=a[q[n/2+(i<=n/2)]];
	rep(i,1,n)printf("%d\n",ans[i]);
}

Measured memory_bytes: 4480
N, A, B = map(int, input().split())
S = input()
Ans = []
passed = 0
oversee = 0
for c in S:
    f = False
    if c=="a":
        if passed < A+B:
            passed += 1
            f = True
    elif c=="b":
        if passed < A+B and oversee < B:
            passed += 1
            oversee += 1
            f = True
    Ans.append(f)
print("\n".join(map(lambda x: ["No", "Yes"][x], Ans)))


Measured memory_bytes: 5108
/* be name khoda */

// #define stream_enable
#define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;

#ifdef stream_enable
#define cin sss
#endif
#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

const ll MOD = 1000000007;
const long long BIG = 1446803456761533460;
const int Big = 336860180;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()

#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debugp(x) cout << #x << " -> " << "(" << (x).F << ", " << (x).S << ")" << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugap(x, n) cout << #x << " ->\n"; fori (i1_dap, n) { cout << "(" << (x)[i1_dap].F << ", " << (x)[i1_dap].S << ")\n"; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl
#define debugav(x, n) cout << #x << " ->\n"; fori (i1_dav, n) { fori (i2_dav, (x)[i1_dav].size()) { cout << (x)[i1_dav][i2_dav] << ' '; } cout << '\n'; } cout << endl
#define debugia(x, n) cout << #x << " ->\n"; fori (i1_dia, n) { cout << i1_dia << " : " << (x)[i1_dia] << '\n'; } cout << endl

#define forifrom(i, s, n) for(ll i = (s); i < (n); ++i)
#define forirto(i, n, e) for(ll i = (n) - 1; i >= (e); --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define Add(a, b) a = (a + (b)) % MOD
#define Mul(a, b) a = (a * (b)) % MOD

stringstream sss;

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

const ll maxn = 200010;

ll ar[maxn], vis[maxn];

inline void assign(ll i, ll v) {
    ar[i] = v;
    vis[v] = 1;
}

void MAIN() {

    ll n, k;
    cin >> n >> k;
    if (k == 1 || k == n * 2 - 1) {
        cout << "No\n";
        return;
    }
    assign(n - 1, k);
    if (k <= n) assign(n, k - 1);
    else assign(n, k + 1);
    ll j = 1;
    fori (i, n * 2 - 1) {
        if (ar[i] == 0) {
            while (vis[j]) ++j;
            assign(i, j);
        }
    }
    cout << "Yes\n";
    fori (i, n * 2 - 1) cout << ar[i] << '\n';

}

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

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(10);
    sss << R"(
4 4
    )";
    MAIN();
    return 0;
}


Measured memory_bytes: 4608
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    while (true) {
        size_t n;
        scanf("%zu", &n);
        if (!n) return 0;

        double sum=0, sq_sum=0;
        for (size_t i=0; i<n; ++i) {
            double s;
            scanf("%lf", &s);

            sum += s;
            sq_sum += s*s;
        }

        double stdev=sqrt((sq_sum-sum*sum/n)/n);
        printf("%.12f\n", stdev);
    }
}

Measured memory_bytes: 2688
from fractions import gcd
import sys
from collections import Counter

read = lambda: sys.stdin.readline().rstrip()

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

class Solution(object):
    def disjoint_set_of_common_divisors(self, A, B):
        return len(Counter(prime_factorize(gcd(A, B))).keys())+1

def main():
    
    A0, B0 = map(int, read().split())
    #A0 = tuple(map(int, read().split()))

    res = Solution().disjoint_set_of_common_divisors(A0, B0)

    print(res)
 
if __name__ == "__main__":
    main()

Measured memory_bytes: 5076
mod = 10 ** 9 + 7
n = int(input())
s = list(input())
ans = 1
cur = 0
for i in range(0, 2 * n, 2):
    if s[i] == "W":
        ans *= (i - cur * 2)
        ans %= mod
        cur += 1
    if s[i + 1] == "B":
        ans *= (i + 1) - cur * 2
        ans %= mod
        cur += 1
if cur != n:
    print(0)
else:
    for i in range(1, n + 1):
        ans *= i
        ans %= mod
    print(ans)

Measured memory_bytes: 10720
#include<iostream>
using namespace std;
bool run(int n,int a,int b){
  for(int i=a;i<=b;i++){
    if(i%n==0){
      return true;
      break;
    }
  }
    return false;
}
 
int main(){
   int n,a,b;
  cin>>n>>a>>b;
  if(run(n,a,b)==true)
    cout<<"OK";
  else
    cout<<"NG";
 
  return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
ll n,m,l,q;
ll s[300][300];
bool WF(){
    For(i,0,n){
        For(j,0,n){
            For(k,0,n){
                s[j][k] = min(s[j][k], s[j][i] + s[i][k]);
            }
        }      
    }
}
void Main(){    
    cin>>n>>m>>l;
    For(i,0,n){
        For(j,0,n){
            s[i][j]=1000000000000;
        }
    }
    For(i,0,m){
        ll a,b,c;cin>>a>>b>>c;a--;b--;
        s[a][b]=c;s[b][a]=c;
    }
    WF();
    For(i,0,n){
        For(j,0,n){
            if(s[i][j]<=l) s[i][j]=1;
            else s[i][j]=1000000000000;
        }
    }
    WF();
    cin>>q;
    vector<pair<ll,ll>> st(q);
    For(i,0,q){
        cin>>st.at(i).first>>st.at(i).second;
        st.at(i).first--;
        st.at(i).second--;
    }
    For(i,0,q){
        if(s[st.at(i).first][st.at(i).second]>1000) cout<<-1<<endl;
        else cout<<s[st.at(i).first][st.at(i).second]-1<<endl;
    }
}
int main(){
    Main();
    return 0;
}


Measured memory_bytes: 2688
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        n: usize,
        aa: [usize; n]
    };
    if n == 1 {
        println!("{}", aa[0]);
        return;
    }
    // 1 -> 0
    // 2 -> 1 0
    // 3 -> 2 0 1
    // 4 -> 3 1 0 2
    // 5 -> 4 2 0 1 3
    // 6 -> 5 3 1 0 2 4
    let evens = (0..(n + 1) / 2)
        .map(|i: usize| aa[2 * i])
        .collect::<Vec<usize>>();
    let odds = (0..n / 2)
        .map(|i: usize| aa[2 * i + 1])
        .collect::<Vec<usize>>();
    let (mae, ato) = if n % 2 == 0 {
        (odds, evens)
    } else {
        (evens, odds)
    };
    println!(
        "{}",
        mae.iter()
            .rev()
            .chain(ato.iter())
            .map(|a| a.to_string())
            .collect::<Vec<_>>()
            .join(" ")
    );
}


Measured memory_bytes: 20324
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h> 
int main() {
 int n;
 int d, min, max;
 long long sum;
 scanf("%d%d", &n, &d);
 sum = min = max = d;
 while (--n > 0) {
  scanf("%d", &d);
  if (d < min) min = d;
  if (d > max) max = d;
  sum += d;}
 printf("%d %d %lld\n", min, max, sum);
 return 0;
} 


Measured memory_bytes: 2104
n=int(input())
a=list(map(int,input().split()))
""" 
print(a) """

alice=0
bob=0
a.sort(reverse=True)
alice = [a[i]for i in range(n) if i%2==0]
bob=[a[i]for i in range(n) if i%2==1 ]
print(sum(alice)-sum(bob))
""" for i in range(n):
    if i%2==0:
        alice+=a[i]
    else:
        bob+=a[i] """


Measured memory_bytes: 9072
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>//pair
#include<cmath>//abs,sqrt
#include<cstring>
#include<map>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
ll fact[100010];
void mod_pow(){
  fact[0]=1;
  rep1(i,100000){
    fact[i]=(fact[i-1]*3)%MOD;
  }
}
int main(){
  mod_pow();
  string s;cin>>s;
  int n=s.size();
  ll dp[100010][3];
  ll cnt=0;
  fill(dp,0);
  rep1(i,n){
    if(s[i-1]=='A'){
      dp[i][0]=(dp[i-1][0]+fact[cnt])%MOD;
      dp[i][1]=dp[i-1][1];
      dp[i][2]=dp[i-1][2];
    }
    else if(s[i-1]=='B'){
      dp[i][0]=dp[i-1][0];
      dp[i][1]=(dp[i-1][1]+dp[i-1][0])%MOD;
      dp[i][2]=dp[i-1][2];
    }
    else if(s[i-1]=='C'){
      dp[i][0]=dp[i-1][0];
      dp[i][1]=dp[i-1][1];
      dp[i][2]=(dp[i-1][2]+dp[i-1][1])%MOD;
    }
    else{
      dp[i][0]=(dp[i-1][0]*3+fact[cnt])%MOD;
      dp[i][1]=(dp[i-1][1]*3+dp[i-1][0])%MOD;
      dp[i][2]=(dp[i-1][2]*3+dp[i-1][1])%MOD;
      cnt++;
    }
  }
  prin(dp[n][2]);
  

    

  return 0;
}


Measured memory_bytes: 3712
#include<stdio.h>
void main()
{
    int n,x,t;
    scanf("%d %d %d",&n,&x,&t);
    if(n%x==0)
    {
        printf("%d",(n/x)*t);
    }
    else
    {
        printf("%d",(n/x+1)*t);
    }
}

Measured memory_bytes: 1732
S = input()
T = input()
S_len = len(S)
T_len = len(T)
ans = 10 ** 5
for i in range(S_len - T_len + 1):
    t = 0
    for j in range(T_len):
        s = S[i:i+T_len]
        if s[j] != T[j]:
            t += 1
    ans = min(ans, t)
print(ans)


Measured memory_bytes: 9112
/**
 *    author:  math2do
 *    created: 04.09.2020 14:40:48 IST
**/

#include <bits/stdc++.h>

using namespace std;

const int pinf = numeric_limits<int>::max();

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector <int> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  } 
  vector <int> dp(n, pinf);
  dp[0] = 0;
  for (int i = 0; i < n - 1; i++) {
    if (i + 1 < n) {
      int cost = abs(arr[i + 1] - arr[i]);
      dp[i + 1] = min(dp[i + 1], cost + dp[i]);
    }
    if (i + 2 < n) {
      int cost = abs(arr[i + 2] - arr[i]);
      dp[i + 2] = min(dp[i + 2], cost + dp[i]);
    }		
  }	
  cout << dp[n - 1] << endl;
  return 0;
}


Measured memory_bytes: 3960
/*
 * じょえチャンネル
 * 高評価・チャンネル登録よろしくおねがいします！
 * https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
 */
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define inf (int)(3e18)
#define P pair<int,int>
#define mod (int)(1e9+7)
template<class T> inline void chmin(T &a, T b) {
	a = min(a, b);
}
template<class T> inline void chmax(T &a, T b) {
	a = max(a, b);
}


signed main(){
	string s;cin>>s;
	if(s.size()%2)cout<<"No"<<endl;
	else {
		rep(i,s.size()){
			if(i%2==0&&s[i]!='h'){
				cout<<"No"<<endl;return 0;
			}else if(i%2&&s[i]!='i'){
				cout<<"No"<<endl;return 0;
			}
		}
		cout<<"Yes"<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  
  cin >> a;
  cin >> b;
  
  if (0 == (a + b) % 2) {
    cout << (a + b) / 2 << endl;
  } else {
    cout << (a + b) / 2 + 1 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::{min, max};
use std::collections::{HashMap, HashSet, VecDeque, BinaryHeap};

fn main() {
    input!{
        x: usize,
        y: usize
    }
    for i in 0..x + 1 {
        if 2 * (x + i) == y {
            println!("Yes");
            return;
        }
    }
    println!("No");
}


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

int main() {
  int N,K;
  int S = 0;
  cin >> N >> K;
  
  for(int i = 0; i < N; i++) {
    int l;
    cin >> l;
  
    if(K - l > l) {
      S += 2*l;
    }
    
    if(K - l <= l) {
      S += 2*(K - l);
    }
  }
  cout << S << endl;
}
    


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
H,W=map(int,input().split())
L=[]
for i in range(H):
    L.append([i for i in input()])
flg=0
cnt=0
#print(L)
for i in range(H):
    for j in range(1,W-1):
        if L[i][j]=='#' and L[i][j-1]!='#' and L[i][j+1]!='#':
            if L[i-1][j]!='#' and L[i+1][j]!='#':
                print('No')
                flg=1
                break
    cnt+=1
    if flg==1:
        break

#print(cnt)
if cnt==H:
    print('Yes')

Measured memory_bytes: 39152
#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define w(t) while(t--)
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
#define what_is(x) cerr << #x << " is " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 1 * 1e5 + 5;
const ll mod = 1e6 + 3;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int main(){
    //freopen("in","r",stdin);
    //freopen("out","w",stdout);
    fin;
    int k, a, b;
    cin >> k >> a >> b;
    fore(i, a, b + 1){
        if(i % k == 0){
            cout << "OK\n";
            return 0;
        }
    }
    cout << "NG\n"; 
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";

    return 0;
}   

Measured memory_bytes: 3788
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int D = sc.nextInt();
    String a= "Christmas";
    if(D==24) a+= " Eve";
    if(D==23) a+= " Eve Eve";
    if(D==22) a+= " Eve Eve Eve";
    System.out.println(a);
  }
}


Measured memory_bytes: 38496
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fr(i,j,n)   for(int i=j;i<(n);++i)
#define bk(i,j,n)   for(int i=j;i>n;--i)
#define mset(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define pop pop_back
#define mod 1000000007
#define all(x) x.begin(),x.end()
#define inf 1e18
#define iosbase ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F first
#define S second
#define bye return

int main()
{
    ll N,ans=0,a,i,M;
    cin>>N>>M;

    for(i=0;i<M;i++)
    {
        cin>>a;
        ans+=a;
    }

    if(ans>N)
    {
        cout<<"-1"<<endl;
    }
    else
    {
        cout<<N-ans<<endl;
    }

}

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

bool sieve[1000001];
vector<UL> P;

int main() {
	rep(i, 1000001) sieve[i] = true;
	sieve[0] = sieve[1] = false;
	for (UL p = 2; p <= 1000000; p++) {
		if (!sieve[p]) continue;
		P.push_back(p);
		if (p <= 1000) for (UL j = p * p; j <= 1000000; j += p)
			sieve[j] = false;
	}

	UL N;
	while (true) {
		cin >> N;
		if (N == 0) break;
		UL ans = 0;
		rep(i, P.size()) {
			UL p = P[i];
			if (p + p > N) break;
			if (sieve[N - p]) ans++;
		}
		cout << ans << "\n";
	}
	cout << flush;

	return 0;
}



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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

const int N = 300, inf = 100000000000000000LL;
int n, m, l;

int dist[N+1][N+1];
int d2[N+1][N+1];

void prep() {
    for(int i = 1; i <= n; ++i) {
        dist[i][i] = 0;
    }
    
    for(int k = 1; k <= n; ++k) {
        for(int i = 1; i <= n; ++i) {
            for(int j = 1; j <= n; ++j) {
                if(dist[i][j] > dist[i][k] + dist[k][j]) {
                    dist[i][j] = dist[i][k] + dist[k][j];
                }
            }
        }
    }

    for(int i = 1; i <= n; ++i) {
        for(int j = 1; j <= n; ++j) {
            if(i == j) {
                d2[i][j] = 0;
            } else if(dist[i][j] <= l) {
                d2[i][j] = 1;
            } else {
                d2[i][j] = inf;
            }
        }
    }

    for(int k = 1; k <= n; ++k) {
        for(int i = 1; i <= n; ++i) {
            for(int j = 1; j <= n; ++j) {
                if(d2[i][j] > d2[i][k] + d2[k][j]) {
                    d2[i][j] = d2[i][k] + d2[k][j];
                }
            }
        }
    }
}

int solve(int s, int t) {
    if(d2[s][t] == inf) return -1;
    return d2[s][t]-1;
}

int32_t main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> m >> l;
    
    for(int i = 1; i <= n; ++i) {
        for(int j = 1; j <= n; ++j) {
            dist[i][j] = inf;
        }
    }
    
    for(int i = 0; i < m; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        if(c <= l) {
            dist[a][b] = c;
            dist[b][a] = c;
        }
    }
    prep();

    int q; cin >> q;
    while(q--) {
        int s, t; cin >> s >> t;
        int ans = solve(s, t);
        cout << ans << '\n';
    }
    
    return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> s(n);
    for(int i=0; i<n; ++i)cin>>s[i];

    sort(s.begin(),s.end());
    int sum = accumulate(s.begin(),s.end(),0);

    if(sum%10) {
        cout << sum << endl;
        return 0;
    }

    for (int i=0; i<n; ++i) {
        if(s[i]%10){
            cout << sum-s[i] << endl;
            return 0;
        }
    }

    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

string S;
int t;

int and3(int n1, int n2) {
  if(n1 == 2 && n2 == 2) return 2;
  if(n1 == 0 || n2 == 0) return 0;
  return 1;
}

int or3(int n1, int n2) {
  if(n1 == 0 && n2 == 0) return 0;
  if(n1 == 2 || n2 == 2) return 2;
  return 1;
}

int dfs(int p, int q, int r) {
  if(S[t] == '0') {
    t++;
    return 0;
  }
  if(S[t] == '1') {
    t++;
    return 1;
  }
  if(S[t] == '2') {
    t++;
    return 2;
  }
  if(S[t] == 'P') {
    t++;
    return p;
  }
  if(S[t] == 'Q') {
    t++;
    return q;
  }
  if(S[t] == 'R') {
    t++;
    return r;
  }
  if(S[t] == '-') {
    t++;
    return 2 - dfs(p, q, r);
  }
  if(S[t] == '(') {
    t++;
    int n1 = dfs(p, q, r);
    char op = S[t++];
    int n2 = dfs(p, q, r);
    int ret;
    if(op == '*') ret = and3(n1, n2);
    if(op == '+') ret = or3(n1, n2);
    // cout << n1 << " " << op << " " << n2 << " = " << ret << endl;
    t++;
    return ret;
  }
}

int main(void) {
  while(cin >> S, S != ".") {
    int ans = 0;
    REP(i, 0, 3) REP(j, 0, 3) REP(k, 0, 3) {
      t = 0;
      if(dfs(i, j, k) == 2) ans++;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3080
def main():
    import sys
    import time
    K=int(sys.stdin.readline())
    return [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][K-1]
print(main())


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
using namespace std;

void solve(){
  unsigned long long int n, k; cin >> n >> k;
  cout << k * (unsigned long long)pow(k - 1, n - 1) << endl;
  return;
}

int main(){
  solve();
  return 0;
}


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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 2e5 + 5;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);



int n , m;


void solve(int testCase){

    scanf("%d %d" , &n , &m);

    vector < int > ok(n  + 1 , 0);

    for(int i = 0 ; i < m ; i ++) {
            int d;
            scanf("%d" , &d);

            while(d --) {
                    int x;
                    scanf("%d" , &x);

                    ok[x] = 1;
            }
    }

    int ans = 0;
    for(int i = 1 ; i <= n ; i ++) ans += 1 - ok[i];

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

}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


Measured memory_bytes: 3768
/*
declare function require(id:string);
const {stdin} = require('process');
let input = "";
stdin.on('data', x => {input += x});
stdin.on('end', () => {
    let [n, aline] = input.split('\n');
    let alist = aline.split(' ')
        .map(x=>x.trim()).map(x=>parseInt(x));
    let count = 0;
    for (let a of alist) {
        while (a % 2 === 0) {
            a = a / 2;
            count += 1;
        }
    }
    console.log(count);
});
*/

var stdin = require('process').stdin;
var input = "";
stdin.on('data', function (x) { input += x; });
stdin.on('end', function () {
    var _a = input.split('\n'), n = _a[0], aline = _a[1];
    var alist = aline.split(' ')
        .map(function (x) { return x.trim(); }).map(function (x) { return parseInt(x); });
    var count = 0;
    for (var _i = 0, alist_1 = alist; _i < alist_1.length; _i++) {
        var a = alist_1[_i];
        while (a % 2 === 0) {
            a = a / 2;
            count += 1;
        }
    }
    console.log(count);
});


Measured memory_bytes: 8096