akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-06-26 15:12:37 +0900
# LastModified: 2020-06-26 15:33:28 +0900
#


import os
import sys
from collections import Counter
# import numpy as np
# import pandas as pd


def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    cnt_list = Counter(a)

    a_max = a[-1]
    a_min = a[0]
    cnt_max = 0
    for center in range(a_min-1, a_max+2):
        cnt = 0
        if center in cnt_list.keys():
            cnt += cnt_list[center]
        if center-1 in cnt_list.keys():
            cnt += cnt_list[center-1]
        if center+1 in cnt_list.keys():
            cnt += cnt_list[center+1]
        if cnt > cnt_max:
            cnt_max = cnt
    print(cnt_max)



if __name__ == "__main__":
    main()


Measured memory_bytes: 20784
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef long long ll;
typedef long double ld;

int  main()
{
	int n; cin >> n;
	vector <int> a(n + 1);
	vector <int> b(n + 1);
	int mini = 5001;
	int maxi = -5001;
	rep(i, n)
	{
		cin >> a[i];
		mini = min(mini, a[i]);
		maxi = max(maxi, a[i]);
	}
	int sum = 0;
	rep(i, n)
	{
		if (i == 0)
			b[i] = abs(0 - a[i]);
		else
			b[i] = abs(a[i] - a[i - 1]);
		sum += b[i];
	}

	sum += abs(0 - a[n - 1]);
	a.insert(a.begin(), 0);
	b.insert(b.begin(), 0);
	rep1(i, n)
	{
		int ans = sum - abs(a[i] - a[i-1]);
		ans -= abs(a[i] - a[i+1]);
		ans += abs(a[i+1]- a[i-1]);
		cout << ans << endl;
		// cout << a[i] << endl;
	}
	// cout << a[0] << endl;
	return 0;
}


Measured memory_bytes: 2032
input_str = input()
zenhan = int(input_str[:2])
kouhan = int(input_str[2:])

if zenhan > 12:
  if kouhan > 12 :
    print('NA')
  elif kouhan == 0:
    print('NA')
  else:
    print('YYMM')
elif zenhan == 0:
  if kouhan > 12 :
    print('NA')
  elif kouhan == 0:
    print('NA')
  else:
    print('YYMM')
else:
  if kouhan >= 1:
    if kouhan <= 12:
      print('AMBIGUOUS')
    else:
      print('MMYY')
  else:
    print('MMYY')

Measured memory_bytes: 3064
#include <iostream>
#include <stack>
using namespace std;
static const int N=100;
static const int WHITE=0;
static const int GRAY=1;
static const int BLACK=2;
 
//???¶?????????°
int n;
//?????\??????
int M[N][N];
//???°??????¶????????¢????
int color[N];
//??\???¶?????????°???¶???
int d[N];
//??\???¶????????????¶???
int f[N];
//???¶???
int tt;
 
int nt[N];
 
//????????????????????????u?????????v
int next(int u){
    for(int v=0;v<n;v++){
        nt[u]=v+1;
        if(M[u][v]&&color[v]==WHITE)
            return v;
    }
    return -1;
}
 
//???¨?????????°??????±??????????????´?¢
void dfs_visit(int r){
    for(int i=0;i<n;i++)
        nt[i]=0;
 
    stack<int> S;
    S.push(r);
    color[r]=GRAY;
    //??????°???¶???
    d[r]=++tt;
 
    while(!S.empty()){
        int u=S.top();
        int v=next(u);
        if(v!=-1&&color[v]==WHITE){
            color[v]=GRAY;
            d[v]=++tt;
            S.push(v);
        }
        else{
            //????????????
            S.pop();
            color[u]=BLACK;
            f[u]=++tt;
        }
    }
}
 
void dfs(){
    //?????§????
    for(int i=0;i<n;i++)
        color[i]=WHITE;
    tt=0;
 
    //??\????????????u??????????????????±??????????????´?¢
    for(int u=0;u<n;u++)
        if(color[u]==WHITE)
            dfs_visit(u);
 
    for(int i=0;i<n;i++)
        cout<<i+1<<" "<<d[i]<<" "<<f[i]<<endl;
}
 
int main(){
    int u,k,v;
 
    cin>>n;
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            M[i][j]=0;
 
    for(int i=0;i<n;i++){
        cin>>u>>k;u--;
        for(int j=0;j<k;j++){
            cin>>v;v--;
            M[u][v]=1;
        }
    }
 
    dfs();
}

Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> arm(n);
    for (auto &e: arm) cin >> e.first >> e.second;

    sort(arm.begin(), arm.end(), [&](auto &a, auto &b){
        return a.first + a.second < b.first + b.second;
    });

    if (n == 1) {
        cout << 1 << endl;
        return 0;
    }
    int ans = 0;
    int cur = 1;
    int prev = arm[0].first + arm[0].second;
    for (int i = 1; i < n; ++i) {
        if (arm[i].first - arm[i].second >= prev) {
            prev = arm[i].first + arm[i].second;
            ++cur;
        }
    }
    ans = cur;

    // cur = 1;
    // prev = arm[1].first + arm[1].second;
    // for (int i = 2; i < n; ++i) {
    //     if (arm[i].first - arm[i].second >= prev) {
    //         prev = arm[i].first + arm[i].second;
    //         ++cur;
    //     }
    // }
    // ans = max(cur, ans);

    cout << ans << endl;

    return 0;
}


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

int main(){
  int n,m;
  cin >> n;
  string s[n];
  map<string,int> a;
  rep(i,n){
    cin >> s[i];
    ++a[s[i]];
  }
  cin >> m;
  string t[m];
  rep(i,m){
    cin >> t[i];
    --a[t[i]];
  }
  int ans = 0;
  rep(i,n){
    ans = max(ans,a[s[i]]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 537427207;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int W,a,b;cin>>W>>a>>b;
    int l = b-W-a, r = a-W-b;
    cout<<max({l,r,0})<<endl;
}


Measured memory_bytes: 256
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,m = map(int,ipt().split())
    dp = [10**10 for _ in [0]*(2**n)]
    dp[0] = 0
    for _ in range(m):
        a,b = map(int,ipt().split())
        c = [int(i) for i in ipt().split()]
        opn = 0
        for i in c:
            opn += 2**(i-1)
        for i in range(2**n):
            if i&opn == 0:
                continue
            elif dp[i] > dp[i-(i&opn)]+a:
                dp[i] = dp[i-(i&opn)]+a

    if dp[2**n-1] >= 10**10:
        print(-1)
    else:
        print(dp[2**n-1])
    return

if __name__ == '__main__':
    main()


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

/*
160
1 1 2 0
160
1 0 2 10
0


10 1
50 1
100 1

10 1
100 2


 */
public class Main {
	private static String result(StringBuilder sb,int buy,int c10,int c50,int c100,int c500){
		int total=c10*10+c50*50+c100*100+c500*500;
		int rest=total-buy;
		int x500=rest/500;
		int x100=(rest-x500*500)/100;
		int x50=(rest-x500*500-x100*100)/50;
		int x10=(rest-x500*500-x100*100-x50*50)/10;
		
		if(x10<c10){
			sb.append("10 ");
			sb.append(c10-x10);
			sb.append("\n");
		}
		if(x50<c50){
			sb.append("50 ");
			sb.append(c50-x50);
			sb.append("\n");
		}
		if(x100<c100){
			sb.append("100 ");
			sb.append(c100-x100);
			sb.append("\n");
		}
		if(x500<c500){
			sb.append("500 ");
			sb.append(c500-x500);
			sb.append("\n");
		}
		return sb.toString();
	}

	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder sb=new StringBuilder();
		while(true){
			String  line1 = reader.readLine();
			int buy = Integer.parseInt(line1);
			if(buy==0){
				break;
			}
			if(sb.length()!=0){
				sb.append("\n");
			}
			String[] line2s = reader.readLine().split(" ");
			int counts[]=new int[4];
			for(int i=0;i<4;i++){
				counts[i]=Integer.parseInt(line2s[i]);
			}
			result(sb,buy,counts[0],counts[1],counts[2],counts[3]);
		}
		System.out.print(sb.toString());
		
	}
}

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
// #define int long long

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int n, m;
bool vis[N];
int cnt[N];
int32_t main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n >> m;
	int prob = 0, pen = 0;
	int p;
	string ver;
	while(m--){
		cin >> p >> ver;
		if (vis[p]) continue;
		if  (ver == "AC") {
			vis[p] = true;
			prob++;
			pen += cnt[p];
		} else cnt[p]++;
	}
	cout << prob << ' ' << pen << endl;
	
	return 0;
}


Measured memory_bytes: 896
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18



int main() {
	int n, k; cin >> n >> k;
	vector<double> tb(n);

	for (int i = 0; i < n; i++) {
		int v; cin >> v;
		tb[i] = (v + 1) / 2.0;
	}

	vector<double> s(n + 1);
	s[0] = 0.0;
	for (int i = 1; i < n + 1; i++) {
		s[i] = s[i - 1] + tb[i - 1];
	}

	double ans = 0.0;
	for (int i = 0; i + k <= n; i++) {
		ans = max(ans, s[i + k] - s[i]);
	}
	cout << fixed << setprecision(12) << ans << endl;


	return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>
#include <algorithm>
int n, r, t, x, z;
int d[23];
int e[23];
int main() {
	scanf("%d", &n);
	if (n >= 24) {
		printf("0\n");
		return 0;
	}
	r = 1;
	for (int i = 0; i < n; i++) {
		scanf("%d", d + i);
		r *= 2;
	}
	r /= 2;
	for (int i = 0; i < r; i++) {
		t = i;
		for (int j = 0; j < n; j++) {
			if (t % 2) e[j] = d[j];
			else e[j] = 24 - d[j];
			t /= 2;
		}
		std::sort(e, e + n);
		x = e[0];
		if (x > 24 - e[n - 1])x = 24 - e[n - 1];
		for (int j = 1; j < n; j++) {
			if (x > e[j] - e[j - 1])x = e[j] - e[j - 1];
		}
		if (z < x)z = x;
	}
	printf("%d\n", z);
}

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

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

typedef long long   signed int LL;
typedef long long unsigned int LU;

template<typename T> void swap(T &x, T &y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T &a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T &a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, k;

LL f(int x) {
	LL ans = 0;
	inc1(i, x) {
	inc1(j, 7) {
		if(j == 1 || j == 7) { continue; }
		if(9 * (7 * (i - 1) + j) % 11 == k) { ans++; }
	}
	}
	
	return ans;
}


int main() {
	scanf("%d%d", &n, &k);
	n--;
	printf("%lld\n", n / 11 * f(11) + f(n % 11) - f(1) );
	
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	int N;
	List<Long> A;
	Map<Long, Integer> counts; // 出現数のカウント
	List<Long> keys; // 出現する値自体のリスト
	Map<Long, Long> remainVals;
	long result = 0L;

	Main() {
		Scanner in = new Scanner(System.in);
		this.N = in.nextInt();
		this.A = new ArrayList<>(N);
		this.counts = new HashMap<>();
		for (int i = 0; i < N; ++i) {
			long value = in.nextLong();
			this.A.add(value);
			if (!counts.containsKey(value)) {
				counts.put(value, 1);
			} else {
				counts.put(value, counts.get(value) + 1);
			}
		}
		in.close();
		// 出現する値の集合をとる
		this.keys = new ArrayList<>(counts.size());
		this.keys.addAll(this.counts.keySet());
		Collections.sort(this.keys);
		// 出現する値の2のべき乗への残り値を算出する
		this.remainVals = new HashMap<>();
		long exps = 1L;
		for (int i = 0; i < keys.size(); ++i) {
			long key = keys.get(i);
			if (key < exps) {
				this.remainVals.put(key, exps - key);
			} else if (key == exps) {
				this.remainVals.put(key, 0L);
			} else {
				// expsを更新して，上記2つと同じ処理を行う
				exps = updateExps(exps, key);
				if (key < exps) {
					this.remainVals.put(key, exps - key);
				} else {
					// updateした結果べき乗と一致したパターンのはず
					this.remainVals.put(key, 0L);
				}
			}
		}
	}

	long updateExps(long baseExps, long val) {
		long result = baseExps;
		while (result < val) {
			result *= 2L;
		}
		return result;
	}

	void calc() {
		for (int i = this.keys.size() - 1; i >= 0; --i) {
			long key = keys.get(i);
			int keyRemainNum = this.counts.get(key);
			if (keyRemainNum <= 0) {
				// なにもしない
				continue;
			}
			long remainVal = remainVals.get(key);
			if (remainVal == 0L) {
				// 同じもの同士で合わせるしかない
				int count = this.counts.get(key);
				int addNum = Math.floorDiv(count, 2);
				this.result += (long) addNum;
				this.counts.put(key, count - (addNum * 2));
			} else {
				if (!this.counts.containsKey(remainVal)) {
					// ついとなるのが存在しない
					continue;
				} else {
					int count = this.counts.get(key);
					int remainValCount = this.counts.get(remainVal);
					int addNum = Math.min(count, remainValCount);
					this.result += (long) addNum;
					this.counts.put(key, this.counts.get(key) - addNum);
					this.counts.put(remainVal, this.counts.get(remainVal) - addNum);
				}
			}
		}
	}

	public static void main(String[] args) {
		Main ins = new Main();
		ins.calc();
		System.out.println(ins.result);
	}

}

Measured memory_bytes: 149252
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<map>
#include<cmath>
#define ll long long
#define inf 0x7fffffff;
#define maxn 1000005
using namespace std;
int n,m,a[maxn];
int read()
{
    int l=0,w=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
        w=-1;
        else
        ch=getchar();
    }
    while(ch<='9'&&ch>='0')
    {
        l*=10;
        l+=ch-'0';
        ch=getchar();
    }
    return l*w;
}
int main()
{
	n=read(),m=read();
	int sum=0;
	for(int i=1;i<=m;i++)
	a[i]=read(),sum+=a[i];
	if(sum>n)
	printf("-1\n");
	else
	printf("%d\n",n-sum);
	return 0;
} 

Measured memory_bytes: 3756
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   ll n;
   cin >> n;
   vector<int> a(n + 1);
   vector<ll> s(n + 1);
   vector<ll> cmb(n + 1);

   FOR(i, 1, n + 1)
   {
      cin >> a[i];
      s[a[i]]++;
   }
   FOR(i, 1, n + 1)
   {
      cmb[i] = s[i] * (s[i] - 1LL) / 2LL;
   }
   ll acc = accumulate(cmb.begin()+1, cmb.end(), 0LL);
   FOR(i, 1, n + 1)
   {
      // cout << (acc - s[a[i]] + 1LL) << endl;
      printf("%lld\n", acc - s[a[i]] + 1LL);
   }
   return 0;
}


Measured memory_bytes: 6528
s = list(input())
k = int(input())
coun= 0

if k <= 100:
  for i in range(k):
    coun += 1
    if s[i] != '1':
      print(s[i])
      exit()
    if coun == k:
      print(1)
      exit()
else:
  for i in range(k):
    coun += 1
    if s[i] != '1':
      print(s[i])
      exit()
    if coun == 100:
      print(1)
      exit()
  

Measured memory_bytes: 3064
//きれいな解説コード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
const ll MOD = 1000000007;
// const ll INF = 1000000000000000000LL;

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

    //Path1
    cout << string(dy,'U') << string(dx,'R');
    //Path2
    cout << string(dy,'D') << string(dx,'L');
    //Path3
    cout << 'L' << string(dy+1,'U') << string(dx+1,'R') << 'D';
    //Path4
    cout << 'R' << string(dy+1,'D') << string(dx+1,'L') << 'U';

    //Endline
    cout << endl;
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<long long int>v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    sort(v.rbegin(), v.rend());
    long long int ans = 0;
    for (int i = 1; i < n; i++) ans += v[i/2];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4764
#include <iostream>

using namespace std;

int main(void){
  string S;
  cin >> S;

  int n = S.length();
  int count = 0;
  
  for(int i=0; i<n/2; i++)
    if(S[i] != S[n-1-i])
      count++;
      
  
  cout << count << endl;

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  int F[4] = { };
  int num = 0;

  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    
    if (S == "P" && F[0] == 0) {
      num++;
      F[0] = 1;
    }
    else if (S == "W" && F[1] == 0) {
      num++;
      F[1] = 1;
    }
    else if (S == "G" && F[2] == 0) {
      num++;
      F[2] = 1;
    }
    else if (S == "Y" && F[3] == 0) {
      num++;
      F[3] = 1;
    }
    else {
    }
  }
  
  if (num == 4) {
    cout << "Four" << endl;
  }
  else {
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right; /* ????????? */
  struct node *left;  /* ????????? */
  struct node *parent;/* ??? */
  long key;            /* ??????????????? */
};
typedef struct node * Node;
#define NIL NULL

Node root = NIL;

Node treeMinimum(Node x){
	while(x->left != NIL){
		x = x->left;
	}
	return(x);

}

Node treeSearch(Node u, int k){
	if(u == NIL){
		return(NIL);
	}
	if(u->key < k){
		return(treeSearch(u->right, k));
	}else if(u->key > k){
		return(treeSearch(u->left, k));
	}else{
		return(u);
	}
}

Node treeSuccessor(Node x){
	return(treeMinimum(x->right));
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL || z->right == NIL){
	  y = z;
  }else{
	  y = treeSuccessor(z);
  }

  if(y->left != NIL){
	  x = y->left;
  }else{
	  x = y->right;
  }

  if(x != NIL){
	  x->parent = y->parent;
  }

  if(y->parent == NIL){
	  root = x;
  }else if(y == y->parent->left){
	  y->parent->left = x;
  }else{
	  y->parent->right = x;
  }

  if(y != z){
	  z->key = y->key;
  }

  return;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  /* ??????????????? */
  z = (Node)malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  z->parent = NIL;

  /* 2???????卒蔵??即T?????????????????? */
  while(x != NIL){
	  /* z????????\????????????????????? */
	  y = x;
	  if(z->key < x->key){
		  x = x->left;
	  }else{
		  x = x->right;
	  }
  }

  /* p[z] = y? */
  z->parent = y;

  /* 2???????卒蔵??即T??????(????????属???0)??? */
  if(y == NIL){
	  root = z;
  }else if(z->key < y->key){
	  y->left = z;
  }else{
	  y->right = z;
  }

  return;
}

void inorder(Node u){
	if(u == NIL){
		return;
	}
	inorder(u->left);
	printf(" %d", u->key);
	inorder(u->right);
	return;
}
void preorder(Node u){
	if(u == NIL){
		return;
	}
	printf(" %d", u->key);
	preorder(u->left);
	preorder(u->right);
	return;
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int X;
  cin >> X;
  int P;
  if(X <= 599) {
    P = 8;
  } else if(X <= 799) {
    P = 7;
  } else if(X <= 999) {
    P = 6;
  } else if(X <= 1199) {
    P = 5;
  } else if(X <= 1399) {
    P = 4;
  } else if(X <= 1599) {
    P = 3;
  } else if(X <= 1799) {
    P = 2;
  } else {
    P = 1;
  }
  cout << P << "\n";
}


Measured memory_bytes: 3636
N=int(input())
W=list(map(int, input().split()))
t1=0
t2=0
for i in range(N):
    t2+=W[i]
ans=t2
for i in range(N):
    t1+=W[i]
    t2-=W[i]
    ans=min(ans, abs(t1-t2))
print(ans)


Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
"""
A - Irreversible operation
https://atcoder.jp/contests/agc029/tasks/agc029_a

"""
import sys


def solve(S):
    ans = 0
    black = S.count('B')
    white = S.count('W')
    for ch in S[::-1]:
        if ch == 'B':
            black -= 1
        else:
            ans += black
    return ans


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


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


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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, tmp, sum, a, b, c, d, k, m, h, w, q, x, y;
string s, t;

int main() {
    cin >> n >> d;
    MSG(ceil((double)n / (2 * d + 1)))
}


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

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
clock_t startTime;
long double getTime(){
	return (long double)(clock()-startTime)/CLOCKS_PER_SEC;
}

int main(){
	startTime=clock();
	int n,k;
	cin >> n >> k;
	ll x[n];
	FOR(i,n){
		cin >> x[i];
	}
	ll ans[n-k];
	FOR(i,n-k+1){
		ans[i]=x[i+k-1]-x[i];
		ans[i]+=min(abs(x[i+k-1]),abs(x[i]));
	}
	ll minx;
	FOR(i,n-k+1){
		minx=(i>0)? min(minx,ans[i]) : ans[i];
	}
	cout << minx;

	return 0;
}

Measured memory_bytes: 4712
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    double x;
    string u;
    double ans = 0.0;
    REP(i,0,n) {
        cin >> x >> u;
        ans += x * (u == "BTC" ? 380000 : 1);
    }
    printf("%.06lf\n", ans);
}

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

Measured memory_bytes: 256
#include<cstdio>
#include<queue>
#include<cstring>
#include<map>
#include<algorithm>
#define qw() freopen("x.txt","r",stdin);
using namespace std;
typedef struct Point
{
    int a,b;
    bool operator < (const Point&wu) const{return a<wu.a||a==wu.a&&b<wu.b;}
}point;

map<point,int>w;
int main(void)
{
    int n,m;
    while(~scanf("%d%d",&n,&m))
    {
        w.clear();
        int x,y,flag=0;
        point t,r;
        while(m--)
        {
            scanf("%d %d",&x,&y);
            t.a=x;t.b=y;w[t]=1;
            t.a=y;t.b=x;w[t]=1;
        }
        r.a=1;r.b=n;
        if(w[r]) {printf("POSSIBLE\n");continue;}
        r.a=n;r.b=1;
        if(w[r]) {printf("POSSIBLE\n");continue;}
        for(int c=1;c<=n;c++)
        {
            t.a=n;t.b=c;
            r.a=c;r.b=1;
            if(w[t]&&w[r])
            {
                flag=1;
                break;
            }
        }
        if(flag) printf("POSSIBLE\n");
        else printf("IMPOSSIBLE\n");
    }
    return 0;
}


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

bool isPrime(ll n){
	if(n == 1){
		return false;
	}else{
		for (int i = 2; i*i <= n; ++i) {
			if(n % i == 0) return false;
		}
		return true;
	}
}

int main(){
	ll q;
	cin >> q;
	vector<int> ans(100005,0);
	rep(i,100001){
		if(i%2==0) continue;
		if(isPrime(i) && isPrime((i+1)/2)) ans[i]++;
	}
	rep(i,100001){
		if(i>0){
			ans[i] += ans[i-1];
		}
	}
	rep(i,q){
		int l,r;
		cin >> l >> r;
		cout << ans[r] - ans[l-1] << endl;
	}
	
    return 0;
}



Measured memory_bytes: 1024
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (n, a, b) = get!(usize, usize, usize);
    let xs = get!(String).split_whitespace().map(|s| s.parse::<usize>().unwrap()).collect::<Vec<_>>();
    let mut r: usize = 0;
    for i in 1..n {
        if b > (xs[i] - xs[i-1]) * a {
            r += (xs[i] - xs[i-1]) * a;
        } else {
            r += b;
        }
    }
    println!("{}", r);
}

Measured memory_bytes: 8444
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    int ans = 1;
    while (ans*ans <= n) {
        ans++;
    }
    cout << (int)pow(ans-1,2) << endl;
}

Measured memory_bytes: 256
n, m = map(int,input().split())
if n == 1 and m == 1:print(1);
elif n == 2 or m == 2:print(0);
elif n == 1:print(m-2)
elif m == 1:print(n-2)
else:print((n*m) - (m*2 + (n-2)*2))

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    if(n%2==0)
     cout<<float(n/2)/float(n);
    else 
     cout<<float((n/2)+1)/float(n);
     return 0;
}
     
   




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

#define int long long 

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 24;

signed main(void){
    for(int n, K; cin >> n >> K, n;){
        int nd;
        range(i, 1, 10){
            int diff = pow(10, i - 1) * 9 * i;
            if(n - diff > 0){
                n -= diff;
            }
            else {
                nd = i;
                break;
            }
        }

        n--;
        int start = pow(10, nd - 1) + n / nd;
        int offset = n % nd;

        stringstream ss;
        range(i, start, start + 200){
            ss << i;
        }

        cout << ss.str().substr(offset, K) << endl;
    }

	return 0;
}

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

int main(){
  cin.tie(0);
 	ios::sync_with_stdio(false);
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if(e - a > k){
    cout << ":(\n";
  }else{
    cout << "Yay!";
  }
  return 0;
}

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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    string s;
    cin >> s;

    int ans = 0;
    int cnt = 0;
    for (auto c: s) {
        string mt = "ATGC";
        bool f = false;
        for (auto m: mt) {
            if (m == c) f = true;
        }

        if (f) {
            cnt++;
            chmax(ans, cnt);
        } else {
            cnt = 0;
        }
    }

    cout << ans << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn int

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



int main()
{
  int h, w;
  cin >> h >> w;
  vector<vector<int>> vv(h, vector<int>(w, 0));
  vector<vector<int>> cp(h, vector<int>(w, 0));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> vv[i][j];
      cp[i][j] = vv[i][j];
    }
  }

  int count = 0;

  for (int i = 0; i < h-1; i++) {
    for (int j = 0; j < w-1; j++) {
      if(cp[i][j] % 2 == 1)
      {
        count++;
        cp[i][j]--;
        if(cp[i][j+1] % 2 == 0)
        {
          cp[i+1][j]++;
        }
        else
        {
          cp[i][j+1]++;
        }
      }
    }
    if(cp[i][w-1] % 2 == 1)
    {
      count++;
      cp[i][w-1]--;
      cp[i+1][w-1]++;
    }
  }

  for (int i = 0; i < w-1; i++) {
    if(cp[h-1][i] % 2 == 1)
    {
      count++;
      cp[h-1][i]--;
      cp[h-1][i+1]++;
    }
  }








  cout << count << endl;

  for (int i = 0; i < h-1; i++) {
    for (int j = 0; j < w-1; j++) {
      if(vv[i][j] % 2 == 1)
      {
        count++;
        vv[i][j]--;
        cout << i+1 << " "<< j+1 << " ";
        if(vv[i][j+1] % 2 == 0)
        {
          vv[i+1][j]++;
          cout << i+1+1 << " " << j+1 << endl;
        }
        else
        {
          cout << i+1 << " " << j+1+1 << endl;
          vv[i][j+1]++;
        }
      }
    }
    if(vv[i][w-1] % 2 == 1)
    {
      count++;
      vv[i][w-1]--;
      vv[i+1][w-1]++;
      cout << i+1 << " " << w-1+1 << " " << i+1+1 << " " << w-1+1 << endl;
    }
  }

  for (int i = 0; i < w-1; i++) {
    if(vv[h-1][i] % 2 == 1)
    {
      count++;
      vv[h-1][i]--;
      vv[h-1][i+1]++;
      cout << h-1+1 << " " << i+1 << " " << h-1+1 << " " << i+1+1 << endl;
    }
  }

  // for (int i = 0; i < h; i++) {
  //   for (int j = 0; j < w; j++) {
  //     cout << vv[i][j] << " ";
  //   }
  //   cout << endl;
  // }


}

Measured memory_bytes: 4096
n = int(input())
ls = [input()]
c = 'Yes'

for i in range(1,n) :
   a = input()
   if a in ls :
      c = 'No'
   elif ls[i-1][len(ls[i-1])-1] != a[0] :
      c = 'No'
   ls.append(a)

print(c)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
typedef long long ll;
ll H, W;
int main(){
	cin.tie(0);
	cin.sync_with_stdio(0);
	cin >> H >> W;
	ll area = H*W;
	if(area&1)area++;
	if(H==1||W==1){
		cout << 1 << nl;
	}else{
		cout << area/2 << nl;
	}
	return 0;
}

Measured memory_bytes: 256
import math

N, P = map(int, input().split())
A = list(map(int, input().split()))

odd = list(filter(lambda x:(x % 2 == 1), A))
even = list(filter(lambda x:(x % 2 == 0), A))
#print(odd)
#print(even)
odd_num = len(odd)
even_num = len(even)

ans = 0

def comb(n, r ):
    return math.factorial(n) //\
           (math.factorial(r) * math.factorial(n - r))


ans = 0
for o in range(0, odd_num + 1):
    for e in range(0, even_num + 1):
        #print(o, e)
        if P == 0:
            if o % 2 == 0:
                #print(o,e, comb(odd_num, o) * comb(even_num, e))
                ans += comb(odd_num, o) * comb(even_num, e)
        else:
            if o % 2 == 1:
                ans += comb(odd_num, o) * comb(even_num, e)

print(ans)

Measured memory_bytes: 39408
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

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

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

ll gcd(ll  a,ll b){
    ll r;
    if(a < b){
        ll tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

ll r_fuct[2000];
ll fuct[2000];

//MOD逆元
void conb(ll n,ll k){
    fuct[0] = 1;
    for(int i = 1;i < k+1;i++){
        fuct[i] *= fuct[i-1]%MOD;
        
        ll b = MOD, u = 1, v = 0;
        ll value = fuct[i];
        while (b) {
            ll t = value / b;
            value -= t * b;
            swap(value, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        r_fuct[i] = u;
    }
}

void solve() {
    ll n,m;
    cin >> n >> m;
    ll a[n];
    ll dp[n+1];
    for(int i = 0;i <= n;i++){
        dp[i] = 0;
        if(i!= n) a[i] = true;
    }

    for(int i = 0;i < m;i++){
        int t;
        cin >> t;
        a[t] = false;
    }

    dp[0] = 1;
    for(ll i = 0;i < n;i++){
       for(ll j = i+1;j <= min(n,i+2);j++){
           if(a[j]){
               dp[j] += dp[i];
               dp[j] %= MOD;
           }
       }
    }
    cout << dp[n] << endl;   
}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string str;
    cin >> str;
    long long sum = 0;
    for(int i=0; i< str.size() ; i++){
        sum += (str[i]-48);
    }
    if(sum % 9==0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

using namespace std;

int main()
{
    int n, l;
    cin >> n >> l;
    int sum = (1 + n) * n / 2 + (l-1)*n;
    int min = 0x3f3f3f3f;
    int mins = -1;
    for(int i = 1; i <= n; ++i)
    {
        if(abs(l+i-1)<min)
        {
            mins = sum - l-i+1;
            min = abs(l+i-1);
        }
    }
    cout << mins << endl;
    return 0;
}

Measured memory_bytes: 256
MOD = 1000000007

num = int(input())
arr = map(int, input().split())

group_1 = 0
group_2 = 0
group_3 = 0

ans = 1

for item in arr:
    num_choice = int(group_1 == item) + int(group_2 == item) + int(group_3 == item)
    ans *= num_choice
    ans %= MOD

    if group_1 == item:
        group_1 += 1
    elif group_2 == item:
        group_2 += 1
    elif group_3 == item:
        group_3 += 1
    else:
        print("0")
        exit(0)

print(ans)


Measured memory_bytes: 10644
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <list>
#include <iomanip>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())


void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

int vector_finder(std::vector<string> vec, string number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

#include <sstream> 
std::vector<std::string> StringSplit(const std::string& str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a * b / gcd(a, b);
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str="";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}

int main() {

	int n; cin >> n;
	//vector<int>l(n);
	int cnt = 0;
	string a;
	for (int i = 1; i <= n; i++) {
		a = to_string(i);
		if (a.size() % 2 == 1) cnt++;
	}
	cout << cnt;
	



	//cout<<

	cout << endl;
	return 0;
}

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

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

//typedef long long ll;

//int isFirst = 1;
//template <class T> void print(T t) { if (isFirst) cout << t, isFirst = 0; else cout << " " << t; }

signed main()
{
    cout << fixed << setprecision(9);
    
    double t,x; cin >> t >> x;
    cout << t / x << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  rep(i, n) {
    ll x;
    cin >> x;
    ans += min(x, abs(k - x)) * 2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3624