akhauriyash/Code-Regression huggingface dataset:
n = int(input())
rate = list(map(int, input().split()))
colo = []

for i in rate:
    if 1 <= i < 400:
        if 1 in colo:
            continue
        else:
            colo.append(1)
    if 400 <= i < 800:
        if 2 in colo:
            continue
        else:
            colo.append(2)
    if 800 <= i < 1200:
        if 3 in colo:
            continue
        else:
            colo.append(3)
    if 1200 <= i < 1600:
        if 4 in colo:
            continue
        else:
            colo.append(4)
    if 1600 <= i < 2000:
        if 5 in colo:
            continue
        else:
            colo.append(5)
    if 2000 <= i < 2400:
        if 6 in colo:
            continue
        else:
            colo.append(6)
    if 2400 <= i < 2800:
        if 7 in colo:
            continue
        else:
            colo.append(7)
    if 2800 <= i < 3200:
        if 8 in colo:
            continue
        else:
            colo.append(8)
    if 3200 <= i:
        colo.append(-1)

if -1 not in colo:
    print("{} {}".format(len(colo), len(colo)))
else:
    cnt = 0
    cnt_upto3200 = 0
    for i in range(1, 9):
        if i in colo:
            cnt += 1
    for j in colo:
        if j == -1:
            cnt_upto3200 += 1
    if cnt == 0:
        print("{} {}".format(1,  cnt_upto3200))
    else:
        print("{} {}".format(cnt, cnt + cnt_upto3200))


Measured memory_bytes: 61952
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

T RD(T = long)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool INSIDE(T)(T x, T b, T e) { return x >= b && x < e; }

long mod = pow(10, 9) + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

struct UnionFind
{
	void init(long n) { par = new long[](n); foreach (i; 0..n) par[i] = i; }
	long root(long i) { return par[i] == i ? i : (par[i] = root(par[i])); }
	bool same(long i, long j) { return root(i) == root(j); }
	void unite(long i, long j) { i = root(i); j = root(j); if (i == j) return; par[i] = j; }
	long[] par;
}

long[] dijkstra(long from, long to, long[][] edges)
{
	long[] path;
	auto cost = new long[](edges.length); fill(cost, long.max); cost[from] = 0;
	long[][] open = [[from]];
	while (!open.empty)
	{
		auto n = open.front; open.popFront;
		auto p = n[0];
		foreach (i; 0..edges.length)
		{
			if (edges[p][i] == -1) continue;
			auto c = cost[p] + edges[p][i];
			if (c < cost[to] && c < cost[i]) { cost[i] = c; if (i == to) path = i ~ n; else open ~= i ~ n; }
		}
	}
	return cost[to] ~ path;
}

void main()
{
	auto S = RD!string;
	auto tokens = S.split("/");

	writeln(tokens[1].to!long >= 5 ? "TBD" : "Heisei");
	stdout.flush();
}

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

inline int input_time() {
	int h, m;
	char semicolon;
	cin >> h >> semicolon >> m;
	return h * 60 + m;
}

inline string input_name() {
	string name;
	cin >> name;
	return name;
}

inline void input_null() {
	string null;
	cin >> null;
}

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

	int n, t;
	cin >> n >> t;

	if(n == 1) {
		cout << 0 << endl;
	}
	else {
		input_null();
		input_null();

		vector<pair<string, int>> ans;

		for(int i = 0; i < n - 1; ++i) {
			const int prev_time = input_time();
			const string station_name = input_name();
			const int next_time = input_time();
			input_null();

			const int stay_time = next_time - prev_time;
			if(stay_time >= t)
				ans.emplace_back(station_name, stay_time);
		}

		cout << ans.size() << endl;
		for(int i = 0; i < (int)ans.size(); ++i)
			cout << ans[i].first << " " << ans[i].second << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1212
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

int main(){
    char str[7];
    scanf("%9s",str);
    if(strcmp(str,"Sunny")==0){
        cout << "Cloudy" << endl;
    }
    if(strcmp(str,"Cloudy")==0){
        cout << "Rainy" << endl;
    }
    if(strcmp(str,"Rainy")==0){
        cout << "Sunny" << endl;
    }
    return 0;
}

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

//#define int long long
#define reps(i,s,n) for(ll (i)=(s);(i)<(ll)(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) reps(i,0,n+1)
#define repst(i,s,n) reps(i,s,n+1)
#define reprt(i,n,t) for(ll (i)=(n);(i)>=t;--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define dbg(x) cout<<#x" = "<<(x)<<ln
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<n;++i){cout<<x[i]<<(i==n-1?'\n':' ');}}

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

/*
 * 完全2分木の頂点を交互に塗っていくゲームと言い換えられる
 * ある点が塗られている場合その先祖と子孫は全て塗れない 自分のターンが回ってきたときに塗れる点がなければ負け
 * 初期状態で塗れる点の部分木がいくつかあるとき、それらのgrundy数のxor和を求めればいける
 * 解説放送いわくgrundy数の法則は理論で見つけて証明するのは超大変だから実験して法則を見つけるべきらしい
 * 実際に考えてみると部分木の深さをd、そのときのgrundy数をg[d]とおくと、
 * g = {1, 2, 1, 4, 1, 2, 1, 8, ...} (d>=1) となる
 * このことから g[d] = (dを割り切れる最大の2の冪) = d&-d と予想できる
 */

int n, g[200200][2], cnt = 1;
string s;
ll l, x;

int rec(int v, int d) {
	if (g[v][0]==-1 && g[v][1]==-1) return 0;
	else if (g[v][0]==-1) x ^= (l-d)&-(l-d), rec(g[v][1], d+1);
	else if (g[v][1]==-1) x ^= (l-d)&-(l-d), rec(g[v][0], d+1);
	else rec(g[v][0], d+1), rec(g[v][1], d+1);
}

signed main() {
	cin >> n >> l;
	memset(g,-1,sizeof(g));
	rep(i,n) {
		cin >> s;
		int v = 0;
		each(j,s) {
			int c = j-'0';
			if (g[v][c]==-1) g[v][c] = cnt++;
			v = g[v][c];
		}
	}
	rec(0,0);
	cout << (x ? "Alice" : "Bob") << ln;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  sort(A.begin(), A.end());
  int M = A.at(N - 1);
  vector<bool> DP(M + 1, true);
  for (int i = 0; i < N; i++) {
    for (int j = 2; A.at(i) * j <= M; j++) DP.at(A.at(i) * j) = false;
    if (i > 0 && A.at(i) == A.at(i - 1)) DP.at(A.at(i)) = false;
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (DP.at(A.at(i))) ans++;
  }
  cout << ans << endl;
}

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

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> a(N);
    for(int i = 0; i < M; i++){
        int k;
        cin >> k;
        for(int j = 0; j < k; j++){       
            int s;                        
            cin >> s;                     
            s--;                         // 16行目 ビット演算による処理
            a[s] |= 1 << i;              // '|'はOR演算 
        }

    }
    int p = 0;
    for(int i = 0; i < M; i++){
        int x;
        cin >> x;
        p |= x << i;
    }
    
    int ans = 0;
    for(int s = 0; s < (1 << N); s++){ //N=5なら,1 << N とは32(10)のこと
        int t = 0;
        for(int i = 0; i < N; i++){ //スイッチを点けたり消したりする処理
            if((s >> i) & 1){       //sを2進数に変換,i番目のビットが立ってるか判定
                t ^= a[i];             
            }
        }
        if(t == p){ //電球が全て点いている状態pとスイッチングによって出来た電球の状態tを比較
            //cout << "s = " << s << endl;
            ans++;
        }
    }      
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define e "\n"
#define MaRiaMa { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
#define fix(n) cout << fixed << setprecision(n);
using namespace std;
int main()
{
	MaRiaMa;
	int k;
	int ar[3];
	cin >> ar[0] >> ar[1] >> ar[2] >> k;
	sort(ar, ar + 3, greater<int>());
	int s= ar[0]*pow(2, k);
	s += (ar[1] + ar[2]);
	cout << s;
}





Measured memory_bytes: 4096
#include <iostream>
#include <cmath>
 
using namespace std;
 
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        double x[4],y[4];
        for(int j=0;j<4;j++)
            cin>>x[j]>>y[j];
        if(abs((x[3]-x[2])*(y[1]-y[0])-(x[1]-x[0])*(y[3]-y[2]))<1e-10)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
     
    return 0;
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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;}


char s[55][55];
int main() {
    int h,w;
    cin >> h >> w;
    for(int i = 1;i<=h;i++) {
        for(int j = 1; j<=w;j++) {
            cin >> s[i][j];
        }
    }
    int cnt = 0;
    for(int i = 1;i<=h;i++) {
        for(int j = 1;j<=w;j++) {
            if(s[i][j] == '#' && s[i-1][j] != '#' && s[i+1][j] != '#' && s[i][j-1] != '#' && s[i][j+1] != '#') cnt++;
        }
    } 
    if(cnt==0) cout<<"Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

//つねに10億7などの剰余をとる構造体
//参考: https://www.youtube.com/watch?v=L8grWxBlIZ4&t=9858
//参考: https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a#4-%E7%B4%AF%E4%B9%97-an
int mod  = MODA;
struct modint {
	ll x;
	modint (ll x):x(x%mod){}
	modint& operator+=(const modint a){
		(x += a.x ) %= mod;
		return *this;
	}
	modint& operator-=(const modint a){
		(x -= a.x ) %= mod;
		if (x < 0) x += mod;
		return *this;
	}
	modint& operator*=(const modint a){
		(x *= a.x ) %= mod;
		return *this;
	}
	modint& operator/=(modint a){
		ll exp = mod - 2;
		while(exp > 0){
			if(exp & 1) *this *= a.x;
			a *= a.x;
			exp >>= 1;
		}
		return *this;
	}
	modint operator+(const modint a) const{
		modint res(*this);
		return res+=a;
	}
	modint operator-(const modint a) const{
		modint res(*this);
		return res-=a;
	}
	modint operator*(const modint a) const{
		modint res(*this);
		return res*=a;
	}
	modint operator/(const modint a) const{
		modint res(*this);
		return res/=a;
	}
};
modint modpow(modint x, ll n){
	modint res=1;
	while(n > 0){
		if(n & 1) res = res * x.x;
		x = x * x;
		n >>= 1;
	}
	return res;
}
//

//さらにnCrのために、x!とその逆元を配列で持つ
const int NMAX = 500000; // 10^7くらいまではいけそう
ll fact[NMAX], finv[NMAX], inv[NMAX];

void ncr_init(){ //はじめにinitする
	fact[0] = fact[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i = 2; i < NMAX; i++){
		fact[i] = fact[i-1] * i % MODA;
		inv[i] = MODA - inv[MODA%i] * (MODA / i) % MODA;
		finv[i] = finv[i-1]* inv[i] % MODA;
	}
}
ll ncr(int n, int r){
	if(n<r) return 0;
	if(n<0 || r<0) return 0;
	return fact[n] * (finv[n-r] * finv[r] % MODA) % MODA;
}
//

int main() {
	modint ans = 0;
	int tmp;
	int n,k;
	cin >> n >> k;
	vector<ll> a(n);
	REP(i, n) cin >> a[i];
	sort(a.begin(), a.end());
	ncr_init();
	for(int i=0; i <= n-k; i++) ans -= a[i] * ncr(n-1-i, k-1);
	for(int i=k-1; i <= n-1; i++) ans += a[i] * ncr(i, k-1);  
	cout << ans.x << endl;
}

Measured memory_bytes: 12800
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>

struct node {
  int id;
  int weight;
  struct node *next;
};
struct node **list;
int *dist;

void Insert(int, int, int);
int Bellman(int, int);

int main(void)
{
  int i, v, e, r, s, t, d;
  scanf("%d %d %d", &v, &e, &r);
  dist = (int*)malloc(sizeof(int) * v);
  list = (struct node**)malloc(sizeof(struct node*) * v);
  for (i = 0; i < v; i++) list[i] = NULL;
  for (i = 0; i < e; i++) {
    scanf("%d %d %d", &s, &t, &d);
    Insert(s,t,d);
  }
  if (Bellman(r, v) == 1) {
    for (i = 0; i < v; i++) {
      if (dist[i] == INT_MAX) printf("INF\n");
      else printf("%d\n", dist[i]);
      free(list[i]);
    }
  } else {
    printf("NEGATIVE CYCLE\n");
    for (i = 0; i < v; i++) {
      free(list[i]);
    }
  }
  free(dist);
  free(list);
  return 0;
}

void Insert(int a, int b, int weight)
{
  struct node *p = (struct node*)malloc(sizeof(struct node));
  p->id = b;
  p->weight = weight;
  p->next = list[a];
  list[a] = p;
}

int Bellman(int p, int size)
{
  int i, j, update;
  struct node *n;
  for (i = 0; i < size; i++) dist[i] = INT_MAX;
  dist[p] = 0;
  for (i = 0; i < size; i++) {
    update = 0;
    for (j = 0; j < size; j++){
      if (dist[j] == INT_MAX) continue;
      for (n = list[j]; n != NULL; n = n->next) {
        int w = n->weight;
        if (w + dist[j] < dist[n->id]) {
          dist[n->id] = w + dist[j];
          update = 1;
        }
      }
    }
    if (!update) break;
  }
  if (update) return 0;
  else return 1;
}


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


public class Main {

	public static void main(String[] args) throws IOException {
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			String W = in.readLine();

			double R= Integer.parseInt(W.split(" ")[0]);


         System.out.println(R*2*3.14159);
	}

}


Measured memory_bytes: 33052
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n, l, h=0, a=0;
    cin >> n;
    for(int i=0; i<n; i++)
    {
        cin >> l;
        h+=l;
        a=max(a,l);
    }
    h-=a;
    if(h>a)
        cout << "Yes\n";
    else
        cout << "No\n";
}

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

int main(){
    int n, q, t;
    string name;
    
    queue<pair<string, int > > Q;
    
    cin >> n >> q;
    
    for(int i = 0; i < n; i++){
        cin >> name >> t;
        Q.push(make_pair(name, t));
    }
    
    pair<string, int> u;
    int elaps = 0, a;
    
    while( !Q.empty()){
        u = Q.front(); Q.pop();
        a = min(u.second,q);
        u.second -= a;
        elaps += a;
        if( u.second > 0){
            Q.push(u);
        }else{
            cout << u.first << " " << elaps << endl;
        }
        
    }
    return 0;
}


Measured memory_bytes: 6368
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstring>
#include <tuple>
#include <utility>
#include <list>
#include <cmath>

using namespace std;

typedef long long LL;
typedef vector<int> Array;
typedef pair<int, int> P;

const LL LINF = 1LL << 60;
const LL MOD = 100000;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define all(c) (c).begin(), (c).end()

struct edge{ LL to, cost; edge(int t, LL c) :to(t), cost(c){} };

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

int main()
{
	int n;
	LL m;
	while (cin >> n >> m && n)
	{
		vector<LL> nums(n);
		rep(i, n) cin >> nums[i];
		vector<LL> arr(n*n + n);
		rep(i, n) rep(j, n)
		{
			arr[i * n + j] = nums[i] + nums[j];
		}
		rep(i, n) arr[n*n + i] = nums[i];
		sort(all(arr));

		LL ans = 0;
		for (auto x : arr)
		{
			LL rem = m - x;
			auto it = upper_bound(all(arr), rem);
			if (it != arr.begin())
			{
				LL num = *(--it);
				ans = max(ans, num + x);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 9524
<?php
  $n = trim(fgets(STDIN));
  $a = explode(" ", trim(fgets(STDIN)));
  $ans = 1;
  if(min($a) == 0){
      echo "0";
      exit;
      
  }
  for($i=0; $i<$n; $i++){
      $ans *= $a[$i]%((10**18)+3);
      if($ans > 10**18){
          echo "-1";
          exit;
      }
  }
  echo $ans;


Measured memory_bytes: 25596
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var ti = Array.ConvertAll(line, int.Parse);
        line = Console.ReadLine().Trim().Split(' ');
        var ve = Array.ConvertAll(line, int.Parse);
        var vmax = setData(ti, ve, ti.Sum() * 2 + 1);
        getAns(vmax);
        Console.WriteLine(vmax.Sum()/2);
    }
    public static void getAns(double[] v)
    {
        for (int i = 1; i < v.Length - 1; i++)
            v[i] = Math.Min(v[i], v[i - 1] + 0.5);
        for (int i = v.Length - 2; i >= 1; i--)
            v[i] = Math.Min(v[i], v[i + 1] + 0.5);
    }
    public static double[] setData(int[] ti, int[] ve, int vL)
    {
        var n = ti.Length;
        var ret = new double[vL];
        var p = 0;
        for (int i = 0; i < n; i++)
            foreach (var x in Enumerable.Repeat(ve[i], ti[i] * 2))
                ret[p++] = x;
        ret[0] = 0;
        var wp = 0;
        for (int i = 0; i < n-1; i++)
        {
            wp += ti[i] * 2;
            ret[wp] = Math.Min(ve[i], ve[i + 1]);
        }
        return ret;
    }
}


Measured memory_bytes: 13408
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	int i, j;
	int n, k;
	vector<int>list;


	cin >> n;


	if (n == 25) {
		cout << "Christmas" << endl;
	}
	else if (n == 24) {
		cout << "Christmas Eve" << endl;
	}
	else if (n == 23) {
		cout << "Christmas Eve Eve" << endl;
	}
	else if (n == 22) {
		cout << "Christmas Eve Eve Eve" << endl;
	}













	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
import copy

N = int(input())
A = []
for i in range(N):
    a = int(input())
    A.append(a)

S = copy.deepcopy(A)
S.sort()

first = S[-1]
second = S[-2]

for a in A:
    if a == first:
        print(second)
    else:
        print(first)


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

int main(){
  int n, count;
  cin >> n;
  count = 0;
  vector<int> length(n);
  for(int i = 0; i < n; i++){
    cin >> length.at(i);
  }
  sort(length.begin(),length.end());
  for(int j = 0; j < n; j++){
    if(j > 0 && length.at(j) == length.at(j - 1)){
      continue;
    }
    count++;
  }
  cout << count << endl;
}

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

int N;
string S;

int dp[30010][11][11][11];
bool used[10][10][10];
int ans;

void dfs(int n, int a, int b, int c) {
  if ( dp[n][a][b][c] ) return;
  dp[n][a][b][c] = 1;  
  if ( n == N || c < 10 ) {
    if ( a < 10 && b < 10 && c < 10 ) {
      if ( !used[a][b][c] ) ans++;
      used[a][b][c] = true;
    }
    return;
  }

  dfs(n+1, a, b, c);  
  if ( a == 10 ) {
    dfs(n+1, S[n]-'0', b, c);
  } else if ( b == 10 ) {
    dfs(n+1, a, S[n]-'0', c);
  } else if ( c == 10 ) {
    dfs(n+1, a, b, S[n]-'0');
  }

  return;
}

struct St {
  int n, a, b, c;
  St(int n, int a, int b, int c): n(n), a(a), b(b), c(c) {};  
};

void solve() {
  stack<St> st;  
  st.push(St(0, 10, 10, 10));
  while ( st.size() ) {
    St q = st.top(); st.pop();
    int n = q.n, a = q.a, b = q.b, c = q.c;    
    if ( dp[n][a][b][c] ) continue;
    dp[n][a][b][c] = 1;  
    if ( n == N || c < 10 ) {
      if ( a < 10 && b < 10 && c < 10 ) {
	if ( !used[a][b][c] ) ans++;
	used[a][b][c] = true;
      }
      continue;
    }

    st.push(St(n+1, a, b, c));    
    if ( a == 10 ) {
      st.push(St(n+1, S[n]-'0', b, c));
    } else if ( b == 10 ) {
      st.push(St(n+1, a, S[n]-'0', c));
    } else if ( c == 10 ) {
      st.push(St(n+1, a, b, S[n]-'0'));
    }
  
  }
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin >> N;
  cin >> S;

  // dfs(0, 10, 10, 10);
  solve();  

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


Measured memory_bytes: 156288
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,m,q;
int A[505][505],B[505][505],C[505][505];
int main(){
	//freopen("in.txt","r",stdin);
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=m;i++)
	{
		int l,r;scanf("%d%d",&l,&r);
		A[l][r]++;
	}
	for(int i=1;i<=n;i++)
		for(int j=i;j<=n;j++)
			B[i][j]=B[i][j-1]+A[i][j];
	for(int i=n;i>=1;i--)
		for(int j=i;j<=n;j++)
			C[i][j]=C[i+1][j]+B[i][j];
	for(int i=0;i<q;i++)
	{
		int l,r;scanf("%d%d",&l,&r);
		printf("%d\n",C[l][r]);
	}
	return 0;
}


Measured memory_bytes: 3840
import sys

def compute_gcd(x, y):
   while(y):
       x, y = y, x % y
   return x
 
def compute_lcm(x, y):
   lcm = (x*y)//compute_gcd(x,y)
   return lcm

def lcm(a):
	x = a[0]
	for i in range(1, len(a)):
		x = compute_lcm(x, a[i])
	return x

n = int(input())

a = list(map(int, input().split()))

MOD = 10 ** 9 + 7

ans = lcm(a)
cur = 0

for i in a:
	cur += ans // i

print(cur % MOD)


Measured memory_bytes: 4084
#include <iostream>
using namespace std;
int main(void){
    
    int A, B;
    cin >> A >> B;
    
    int ans = 0;
    for(int i = 0; i < 2; i++){
        if(A > B){
            ans += A;
            A--;
        }
        else{
            ans += B;
            B--;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3128
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int monsters = Integer.parseInt(sc.nextLine());
		long[] hp = Stream.of(sc.nextLine().split(" ", 0)).mapToLong(Long::parseLong).toArray();
		sc.close();
		long ans = 0;
		Arrays.sort(hp);
		Main main = new Main();
		for (int i = 0; i < monsters; i++) {
			ans = main.GCD(ans, hp[i]);
		}

		System.out.println(ans);
	}

	public long GCD(long num1, long num2) {
		if (num2 == 0) {
			return num1;
		} else {
			return GCD(num2, num1 % num2);
		}
	}


}

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

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    int dx = tx - sx, dy = ty - sy;
    
    string res = "";

    // 1 回目
    for (int i = 0; i < dx; ++i) res += "R";
    for (int i = 0; i < dy; ++i) res += "U";
    for (int i = 0; i < dx; ++i) res += "L";
    for (int i = 0; i < dy; ++i) res += "D";

    // 2 回目
    res += "D";
    for (int i = 0; i <= dx; ++i) res += "R";
    for (int i = 0; i <= dy; ++i) res += "U";
    res += "L";
    res += "U";
    for (int i = 0; i <= dx; ++i) res += "L";
    for (int i = 0; i <= dy; ++i) res += "D";
    res += "R";
    cout << res << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<utility>
#include<functional>
#include<cmath>
#include<vector>
//using namespace std;
using std::min;
using std::max;
using std::swap;
using std::sort;
using std::reverse;
using std::random_shuffle;
using std::lower_bound;
using std::upper_bound;
using std::unique;
using std::vector;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef std::pair<int,int> pii;
typedef std::pair<ll,ll> pll;
void open(const char *s){
#ifndef ONLINE_JUDGE
	char str[100];sprintf(str,"%s.in",s);freopen(str,"r",stdin);sprintf(str,"%s.out",s);freopen(str,"w",stdout);
#endif
}
int rd(){int s=0,c,b=0;while(((c=getchar())<'0'||c>'9')&&c!='-');if(c=='-'){c=getchar();b=1;}do{s=s*10+c-'0';}while((c=getchar())>='0'&&c<='9');return b?-s:s;}
void put(int x){if(!x){putchar('0');return;}static int c[20];int t=0;while(x){c[++t]=x%10;x/=10;}while(t)putchar(c[t--]+'0');}
int upmin(int &a,int b){if(b<a){a=b;return 1;}return 0;}
int upmax(int &a,int b){if(b>a){a=b;return 1;}return 0;}
const ll p=1000000007;
const int N=100010;
int cmp(pii a,pii b)
{
	if(a.first!=b.first)
		return a.first<b.first;
	return a.second>b.second;
}
int n,m,t,t2;
int a[N],b[N],d[N];
pii c[N];
ll e[N];
ll add(ll a,ll b)
{
	a+=b;
	return a>=p?a-p:a;
}
void add(int x,ll v)
{
	for(;x<=t2;x+=x&-x)
		e[x]=add(e[x],v);
}
ll sum(int x)
{
	ll s=0;
	for(;x;x-=x&-x)
		s=add(s,e[x]);
	return s;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=m;i++)
		scanf("%d",&b[i]);
	for(int i=1;i<=n;i++)
		if(a[i]>b[1]&&a[i]<b[m])
		{
			int x=lower_bound(b+1,b+m+1,a[i])-b;
			if(b[x]==a[i])
				continue;
			c[++t]=pii(a[i]-b[x-1],b[x]-a[i]);
			d[++t2]=b[x]-a[i];
		}
	sort(d+1,d+t2+1);
	t2=unique(d+1,d+t2+1)-d-1;
	for(int i=1;i<=t;i++)
		c[i].second=lower_bound(d+1,d+t2+1,c[i].second)-d;
	sort(c+1,c+t+1,cmp);
	t=unique(c+1,c+t+1)-c-1;
	ll ans=1;
	for(int i=1;i<=t;i++)
	{
		ll s=sum(c[i].second-1)+1;
		ans+=s;
		add(c[i].second,s);
	}
	ans%=p;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2432
h,w=map(int,input().split())
q=[list(map(str,input().split()))for i in range(h)]
p=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
for i in range(h):
    for j in range(w):
        if q[i][j]=="snuke":
            print(p[j]+str(i+1))

Measured memory_bytes: 3064
#![allow(unused_imports)]
#![allow(unused_variables)]

use itertools::Itertools;
use proconio::marker::*;
use proconio::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        a: [i32; m],
    }
    // annotate for rust-analyzer
    let n: usize = n;
    let m: usize = m;
    let a: Vec<i32> = a;

    let ans = n as i32 - a.iter().sum::<i32>();
    println!("{}", if ans < 0 { -1 } else { ans });
}


Measured memory_bytes: 2232
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, D = LMIIS()
    D2 = D**2
    ans = 0
    for i in range(N):
        x,y = LMIIS()
        if x**2 + y ** 2 <= D2:
            ans += 1
    print(ans)



    
main()

Measured memory_bytes: 68800
n = int(input())
b = list(map(int, input().split()))
ans = 0
for i in range(n):
    if i == 0:
        ans += b[0]
    elif i < n - 1:
        ans += min(b[i-1],b[i])
    else:
        ans += b[-1]
print(ans)

Measured memory_bytes: 3060
import sys
N=int(input())
wordlist=[]
wordbefore=input()
wordlist.append(wordbefore)
for i in range (1,N):
    word=input()
    if word in wordlist:
        print("No")
        sys.exit()
    if wordbefore[len(wordbefore)-1] !=word[0]:
        print("No")
        sys.exit()        
    wordlist.append(word)
    wordbefore=word    
print ("Yes")  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(int i=0;i<N;i++)
typedef long long ll;
int gcd(int a,int b){
    if(a<b){swap(a,b);}
    if(a%b==0){return b;}
    return gcd(b,a%b);
}
const ll MOD=1000000007;
int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
	ll A,B,C,D;
    cin>>A>>B>>C>>D;
    ll num=0;
    num+=B/C;
    num-=(A-1)/C;
    num+=B/D;
    num-=(A-1)/D;
    ll CD=C*D/gcd(C,D);
    num-=B/CD;
    num+=(A-1)/CD;
    cout<<B-A+1-num<<endl;
}

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

#define FOR(a, b, c) for(int a = b; a <= c; ++a)
#define FORW(a, b, c) for(int a = b; a >= c; --a)
#define fi first
#define se second
#define pb push_back
#define int long long

typedef pair<int, int> ii;
typedef pair<int, ii> iii;

const int N = 2e3 + 100;
const int oo = 1e8;
const int mod = 1e9 + 7;

int n, x, y;
int a[N];

signed main()  {
//    freopen("test.inp", "r", stdin);
//    freopen("test.out", "w", stdout);
    ios_base::sync_with_stdio(false); cout.tie(0);
    cin >> n >> x >> y;
    FOR(i, 1, n) FOR(j, i + 1, n)   {
        if(j <= x || y <= i) a[j - i] ++;
        else if(i <= x && j >= y) a[x - i + j - y + 1] ++;
        else if(x <= i && i <= y && x <= j && j <= y)
            a[min(j - i, i - x + y - j + 1)] ++;
        else if(x <= i && i <= y)
            a[min(j - i, i - x + j - y + 1)] ++;
        else a[min(j - i, y - j + 1 + x - i)] ++;
    }
    FOR(i, 1, n - 1) cout << a[i] << '\n';
}


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

using namespace std;

typedef long long ll;

int T, A, X, B, Y, C, ans;

int gcd(int a, int b) {
	return b ? gcd(b, a%b) : a;
}

void exgcd(int a, int b, int &x, int &y) {
	if (!b) {
		x = 1, y = 0;
		return;
	}
	// ax + by = gcd(a,b)
	// bx + (a-b[a/b])y = gcd(a,b)
	// ya + (x-[a/b]y)b = gcd(a,b)
	int x_ = 0, y_ = 0;
	exgcd(b, a%b, x_, y_);
	x = y_, y = x_ - (a / b) * y_;
}

int inverse(int a, int mod) {
	int x = 0, y = 0;
	// ax - mod k = 1
	exgcd(a, mod, x, y);
	return (x % mod + mod) % mod;
}

int solve(int k, int p, int l, int r) {
    if (r >= l + p) r = l + p - 1;
    if (r >= p) {
        int x = (l + k - 1) / k;
        int res = solve(k, p, l - k * x, r - k * x);
        if (res == -1) return -1;
        return x + res;
    }
    k %= p;
    if (l <= -p) {
        int x = ((- p - l) / p) + 1;
        l += p * x, r += p * x;
    }
    if (!k) {
        if (l <= 0 && r >= 0)
            return 0;
        else 
            return -1;
    }
    int q = solve(p, k, -r, -l);
    if (q == -1) return -1;
    // ki >= l + qp
    int ret = max(0ll, (l + 1LL * q * p + k - 1) / k);
	if (k * ret > r + 1LL * q*p) {
		puts("???");
	}
	return ret;
}

int solve(int k, int p, int l, int r, int a) {
	int v = 1LL * k * a % p;
	l -= v, r -= v;
	return solve(k, p, l, r) + a;
}

int main() {
	scanf("%d", &T);
	while (T --) {
		scanf("%d%d%d%d%d", &A, &X, &B, &Y, &C);
		int d = gcd(gcd(A, B), C);
		A /= d, B /= d, C /= d;
		int dA = gcd(A, C), dB = gcd(B, C);
		X /= dB, Y /= dA, C /= (dA * dB);
		A /= dA, B /= dB;
		ans = 0;
		A %= C, B %= C;
		if (!A || !B) {
			if (!A && !B) {
				printf("%d\n", X+Y);
			} else if (!A) {
				printf("%d\n", X+Y/C);
			} else {
				printf("%d\n", X/C+Y);
			}
			continue;
		}
		int k = 1LL * inverse(B, C) * A % C;
		int cur_x = 0, cur_y = C;
		while (cur_x != C) {
			int nxt_x = solve(C - k, C, 0, cur_y-1, cur_x+1);
			int nxt_y = 1LL * (C - k) * nxt_x % C;
			int delta_x = nxt_x - cur_x, delta_y = cur_y - nxt_y;
			int c = cur_y / delta_y;
			nxt_x = cur_x + delta_x * c;
			nxt_y = cur_y - delta_y * c;
			int L = 0, R = min(cur_x ? (X / cur_x) : 0x3f3f3f3f, nxt_y ? (Y / nxt_y) : (0x3f3f3f3f)), res = 0;
			while (L <= R) {
				int mid = (L + R) >> 1;
				ll lb = max(0LL, (1LL * mid * cur_y - Y + delta_y - 1) / delta_y), rb = min(1LL*mid*c, (X - 1LL * mid * cur_x) / delta_x);
				if (lb <= rb) {
					res = mid;
					L = mid + 1;
				} else R = mid - 1;
			}
			ans = max(ans, res);
			cur_x = nxt_x, cur_y = nxt_y;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3820
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
bool p[N];
bool is[N];
int a[N];
bool isPrime(int n) {
    for (int i = 2; i <= sqrt(n); ++i) {
        if (n % i == 0) return false;
    }
    return true;
}
void solve(){
    for (int i = 2; i <= N; ++i) {
        p[i] = isPrime(i);
    }
    for (int i = 3; i <= N; i += 2) {
        if (p[i] && p[(i + 1) / 2]) is[i] = true;
    }
    int cnt = 0;
    for (int i = 3; i <= N; ++i) {
        cnt += is[i];
        a[i] = cnt;
    }
    int q;
    cin >> q;
    while (q--) {
        int x, y;
        cin >> x >> y;
        cout << a[y] - a[x- 1] << endl;
    }
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

Measured memory_bytes: 1280
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
	while(1){
        int n,k;
        int sum = 0,mx = 0;
        int ans[100000] = {0};
        cin >> n >> k;
        if(n == 0 && k == 0) break;
        for(int i = 0; i < n; i++) cin >> ans[i];
        for(int i = 0; i < k; i++){
            sum += ans[i];
        }
        mx = sum;
        for(int i = k; i < n; i++){
            sum += ans[i];
            sum -= ans[i-k];
            mx = max(mx,sum);
        }
        cout << mx << endl;
	}
	return 0;
}

Measured memory_bytes: 1556
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

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

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

    vector<int> H(N); rep(i, N) cin >> H[i];

    vector<int> A(2 * M), B(2 * M);
    rep(i, M) {
        cin >> A[i] >> B[i];
    }    
    rrep(j, M, 2 * M - 1) {
        A[j] = B[j - M];
        B[j] = A[j - M];
    }    

    // int good_obs = 0; // いい展望台の数
    // rep(i, N) {
    //     bool found = false;
    //     bool touched = false;
    //     rep(j, 2 * M) {
    //         if (i == A[j] - 1) {
    //             touched = true;
    //             if (H[B[j] - 1] < H[i]) {
    //                 found = true;
    //             }
    //         }
    //     }
    //     if (found || !touched) good_obs++;
    // }

    vector<bool> C(N);
    rep(i, N) C[i] = true;

    rep(j, 2 * M) {
        if (H[A[j] - 1] > H[B[j] - 1]) {
            if (C[A[j] - 1]) C[A[j] - 1] = true;
        } else {
            C[A[j] - 1] = false;
        }
    }

    int ans = 0;
    rep(i, N) {
        if (C[i]) ans++;
    }

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


Measured memory_bytes: 5384
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

using P = pair<int, int>;
s64 k;
vector< vs32 > dp(1 << 9, vs32(100001, -1));
vector< P > vw;

int rec(int v, int l, bool mode)
{
    if (v == 0) return 0;
    if (mode)
    {
        if ((1 << k) > v)
        {
            return dp[v][l];
        }
    }
    else
    {
        if (dp[v][l] >= 0)
        {
            return dp[v][l];
        }
    }

    int ret = rec(v / 2, l, mode);
    if (l >= vw[v - 1].second) ret = max(ret, rec(v / 2, l - vw[v - 1].second, mode) + vw[v - 1].first);

    if (!mode) dp[v][l] = max(dp[v][l], ret);
    return ret;
}


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

    int n;
    cin >> n;

    vw.resize(n);
    rep (i, n)
    {
        cin >> vw[i].first >> vw[i].second;
    }

    while ((1ll << (2 * k)) < n) ++k;
    for (int v = 1; v < (1 << k); ++v)
    {
        rep (l, 100000 + 1)
        {
            rec(v, l, false);
        }
    }

    int q;
    cin >> q;
    while (q--)
    {
        int v, l;
        cin >> v >> l;
        cout << rec(v, l, true) << "\n";
    }

    return 0;
}



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

typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N, c = 0, m = 0;
    string S;
    cin >> N >> S;
    rep(i, N) {
        if (S[i] == '(') c++;
        else c--;
        m = min(m, c);
    }
    rep(i, -m) {
        cout << "(";
    }
    cout << S;
    rep(i, c - m) {
        cout << ")";
    }
    cout << "\n";
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String[] w = new String[N];
        List<String> l = new ArrayList<>();
        String ans = "Yes";
        w[0] = sc.next();
        l.add(w[0]);
        for(int i=1; i<N; i++) {
            w[i] = sc.next();
            if(l.contains(w[i])) {
                ans = "No";
                break;
            }else if(w[i].charAt(0) != w[i-1].charAt(w[i-1].length()-1)) {
                ans = "No";
                break;
            }else {
                l.add(w[i]);
            }
        }
        System.out.println(ans);
    }
    
}

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

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int,int> pii;

#define pb push_back
#define odd(x) ((x)&1)
#define even(x) (!odd(x))
#define ff it->first
#define ss it->second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(auto i=0;i<n;++i)
#define LOOP_IT(it,s) for(auto it=(s).begin();it!=(s).end();++it)
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);


#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


map<ll,ll> mp;

void primeFactors(ll n)
{
    while (n % 2 == 0)
    {
        ++mp[2];
        n = n/2;
    }

    for (ll i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            ++mp[i];
            n = n/i;
        }
    }

    if (n > 2)
        ++mp[n];

}

int main(int argv, char* argc[])
{
    FASTIO

    ll n,ans=0;
    cin>>n;
    primeFactors(n);
    LOOP_IT(it,mp)
    {
        ll d = (int)floor(sqrt(double(8*ss+1)));
        ll k = (d-1)/2;
        ans+=k;
    }
    cout<<ans;

    return 0;
}



Measured memory_bytes: 3676
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>

typedef long double ld;
typedef long long ll;

void print(){ std::cout << std::endl; }
template<typename H> void print(H&& head){ std::cout << head << std::endl; }
template<typename H, typename... T> void print(H&& head, T&&... tail){
  std::cout << head << " ", print(std::forward<T>(tail)...);
}

int main()
{
  ll H, W;
  std::cin >> H >> W;

  if (H == 1 || W == 1) {
    print(1);
    return 0;
  }

  ll ans = (H * W + 1) / 2;

  print(ans);

  return 0;
}



Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define ms(s,x) memset(s,x,sizeof(s))
#define ls rt<<1
#define rs rt<<1|1
#define pb push_back
#define inf 0x3f3f3f3f
typedef long long ll;
using namespace std;

const double PI = acos(-1.0);
const double eps = 1e-8;
const int MAXN = 1e5+5;
const ll MOD = 1e9+7;

int main()
{
    int n;
    cin >> n;
    cout << ((n+1)>>1) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<stdio.h>
#include<queue>
#include<iomanip>
#define pi 3.1415927
using namespace std;
typedef long long  ll;
const long long maxt=1e18;
int main()
{
	char a[10];
	cin>>a;
	if(a[1]=='B')
	cout<<"ARC";
	else
	cout<<"ABC";
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<x<<endl
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
typedef vector<int> vi;

int K,S,ans;

int main(void){
    cin>>K>>S;
    rep(i,K+1)rep(j,K+1){
        if(i+j>=S-K && i+j<=S){ans++;}
    }
    p(ans);
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAX 50
#define MAX2 105

int n;
int ay[MAX],ax[MAX],by[MAX],bx[MAX];
vector<int> Y,X;
map<int,int> my,mx;

void func(vector<int> &Y,map<int,int> &my,int ay[MAX],int by[MAX]){
  sort(Y.begin(),Y.end());
  int cnt=1;
  for(int i=0;i<n*2;i++){
    if(i&&Y[i]==Y[i-1])continue;
    my[Y[i]]=cnt++;
  }
  for(int i=0;i<n;i++){
    ay[i]=my[ay[i]];
    by[i]=my[by[i]];
  }
}

bool visited[MAX2][MAX2];
bool t[MAX2][MAX2][2];

void rec(int y,int x){
  if(y<0||x<0)return;
  if(y>=MAX2||x>=MAX2)return;
  if(visited[y][x])return;
  visited[y][x]=true;
  
  if(t[y][x+1][0]){
    rec(y,x+1);
  }
  if(t[y+1][x][1]){
    rec(y+1,x);
  }
  if(t[y][x][0]){
    rec(y,x-1);
  }
  if(t[y][x][1]){
    rec(y-1,x);
  }
}

int solve(){
  for(int i=0;i<MAX2;i++){
    for(int j=0;j<MAX2;j++){
      visited[i][j]=false;
      t[i][j][0]=t[i][j][1]=true;
    }
  }
  for(int i=0;i<n;i++){
    for(int y=ay[i];y<by[i];y++)
      t[y][ax[i]][0]=t[y][bx[i]][0]=false;
    for(int x=ax[i];x<bx[i];x++)
      t[ay[i]][x][1]=t[by[i]][x][1]=false;
  }
  
  int res=0;
  for(int i=0;i<MAX2;i++){
    for(int j=0;j<MAX2;j++){
      if(visited[i][j])continue;
      rec(i,j);
      res++;
    }
  }
  return res;
}

void init(){
  Y.clear();
  X.clear();
  my.clear();
  mx.clear();
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    init();
    for(int i=0;i<n;i++){
      cin>>ay[i]>>ax[i]>>by[i]>>bx[i];
      if(ay[i]>by[i])swap(ay[i],by[i]);
      if(ax[i]>bx[i])swap(ax[i],bx[i]);
      Y.push_back(ay[i]);
      Y.push_back(by[i]);
      X.push_back(ax[i]);
      X.push_back(bx[i]);
    }  
    
    func(Y,my,ay,by);
    func(X,mx,ax,bx);
    
    cout<<solve()<<endl;
  }
  return 0;
}

Measured memory_bytes: 2104