akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <deque>
#include <utility>
#include <algorithm>
using namespace std;

int main(void){

    int n;
    cin>>n;

    vector<char> a(n);
    
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    
    bool bb=false;
    for(int i=0; i<n; i++){
        if(a[i]=='Y'){
            bb=true;
            break;
        }
    }
    
    if(bb){
        cout<<"Four"<<endl;
    }else{
        cout<<"Three"<<endl;
    }
}


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

int main() {
	string S;
	cin >> S;
	char al[26];
	int n[26]={0};
	for(int i=0; i<26; ++i) al[i] = 'a' + i;
	for(int i=0; i<S.size(); ++i) for(int j=0; j<26; ++j) if(S[i]==al[j]) ++n[j];
	int p=100;
	for(int i=0; i<26; ++i){
	    if(n[i]==0){
	        p=i;
	        break;
	    }
	}
	if(p==100) cout << "None" << endl;
	else cout << al[p] << endl;
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>
using namespace std;

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

	//1:すでにacか
	vector<pair<int, bool>> condition(N);
	
	for (int i = 0; i < N; i++) {
		condition[i].first = 0;
		condition[i].second = false;
	}

	int acCount = 0, waCount = 0;

	for (int i = 1; i <= M; i++) {
		int q;
		string result;
		cin >> q >> result;
		
		if (result == "AC" && !condition[q - 1].second) {
			acCount++;
			waCount += condition[q - 1].first;
			condition[q - 1].second = true;
		}
		else if (result == "WA" && !condition[q - 1].second) {
			condition[q - 1].first++;
		}
		
	}

	cout << acCount << " " << waCount << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

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

/*
    freopen("input","r",stdin);
    freopen("output","w",stdout);
*/

vector<vector<int> > G;

int H[110];
int D;

void dfs(int a, int p, int d) {
    D = max(D, d);
    int q = G[a].size();
    if (p != -1) q--;
    H[d] = max(H[d], q);
    for (int i = 0;i < G[a].size();i++) {
        if (G[a][i] != p) {
            dfs(G[a][i], a, d + 1);
        }
    }
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    G.resize(N);
    vector<PP> T;
    for (int i = 1;i < N;i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
        T.push_back(make_pair(a, b));
    }
    map<int, ll> sol;
    // Check every node
    for (int i = 0;i < N;i++) {
        memset(H, 0, sizeof(H));
        D = 0;
        dfs(i, -1, 1);
        ll v = 1;
        for (int i = 1;i < D;i++) v *= H[i];
        if (sol.find(D) == sol.end()) sol[D] = v;
        else sol[D] = min(sol[D], v);
    }
    for (int i = 0;i < T.size();i++) {
        memset(H, 0, sizeof(H));
        D = 0;
        dfs(T[i].first, T[i].second, 1);
        dfs(T[i].second, T[i].first, 1);
        ll v = 2;
        for (int i = 1;i < D;i++) v *= H[i];
        if (sol.find(D) == sol.end()) sol[D] = v;
        else sol[D] = min(sol[D], v);
    }
    map<int, ll>::iterator it;
    it = sol.begin();
    cout << it->first << ' ' << it->second << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FF ios_base::sync_with_stdio(0);cin.tie(0)
#define binary(value, size) cout << bitset<size>(value) << '\n'
#define PI acos(-1.0)   //3.1416(180 degree to radian)
#define PIby2 asin(1)     //(3.1416/2) for angle(90 degree to radian)
#define eps 1e-67
#define pf printf
#define sf scanf
#define sz size()
#define rr read
#define ww write
#define clr(arr) memset((arr),0,(sizeof(arr)))
#define rep(i,a,b) for(long long int i=a;i<b;i++)
#define repb(i,a,b) for(long long int i=a;i>=b;i--)
#define repa(i,a,b,c) for(long long int i=a;i<b;i=i+c)
#define reps(i,a,b,c) for(long long int i=a;i>b;i=i-c)
#define asort(a) sort(a.begin(),a.end())
#define asort2(a,comp) sort(a.begin(),a.end(),comp)
#define arev(a) reverse(a.begin(),a.end())
#define all(v) (v).begin(),(v).end()
#define all2(v,a,b) (v).begin()+a,(v).end()-b
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define pbb pop_back
#define mp make_pair
#define mt make_tuple
#define BS(v,x) binary_search(v.begin(),v.end(),x) //return true /false
#define LB(v,x) lower_bound(v.begin(),v.end(),x) //found and that value and not found than greater value pos
#define UB(v,x) upper_bound(v.begin(),v.end(),x) //found and greater value pos && not found also greater pos
#define convertlower(c) towlower(c)
#define root(x) sqrt(x)
#define power(a,n) pow(a,n)
#define tu(c) towupper(c)
#define sq(a) ((a)*(a))
#define cube(a) ((a)*(a)*(a))
#define mx 1000
#define MX 100000
#define mod 1000000007
#define INF 2000000000
#define N 10000000
#define Ceil(n) (long long int)ceil(n)
#define Floor(n) (long long int)floor(n)
#define deb(x) std::cout << #x << " = " << x << std::endl;
#define out(ans) cout<<ans<<endl
#define outs(ans) cout<<ans<<" "<<endl
using namespace std;
typedef string str;
typedef long long int ll;
typedef double lf;
typedef long double llf;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef char ch;
typedef map<ll,ll> mpl;




int main()
{
    ll n;
    cin>>n;
    vll v;
    rep(i,0,n)
    {
        ll d; cin>>d; v.pb(d);
    }
    ll sign=1,sum=0,ans1=0,ans2=0;
    rep(i,0,n)
    {
        sum+=v[i];
        if(sign*sum<=0) ans1+=labs(sign-sum),sum=sign;
        sign*=-1;
    }
    sign=-1,sum=0;
    rep(i,0,n)
    {
        sum+=v[i];
        if(sign*sum<=0) ans2+=labs(sign-sum),sum=sign;
        sign*=-1;
    }
    cout<<min(ans1,ans2)<<endl;
    return 0;
}


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

int main(){
  long N,M,K;cin>>N>>M>>K;
  vector<long> A(N+1),B(M+1);
  A.at(0)=0;
  for(long i=1;i<=N;i++){
    long X;cin>>X;
    A.at(i)=X+A.at(i-1);
  }
  B.at(0)=0;
  for(long i=1;i<=M;i++){
    long X;cin>>X;
    B.at(i)=X+B.at(i-1);
  }
  long best;
  for(long i=M;i>=0;i--){
    if(B.at(i)<=K){
      best=i;
      break;
    }
  }
  priority_queue<long> ans;
  ans.push(best);
  long read;
  for(long i=1;i<=N;i++){
    if(A.at(i)>K) break;
    for(long j=best;j>=0;j--){
      if(A.at(i)+B.at(j)<=K){
        read=i+j;
        best=j;
        break;
      }
    }
    ans.push(read);
  }
  cout<<ans.top()<<endl;
}


Measured memory_bytes: 8324
#include <iostream>
#include <string>
using namespace std;
int main(){
string a;
cin >>a;
int b;
b=a.size();
int d;
cin >>d;
int e;
e=0;
string f;
int g;
int i;
int j;
j=0;
while(e<d){
cin >>f;
string c(f,0,b-1);
f=f+c;
g=0;
i=0;
while(g<10){
string h(f,g,b);
if(h==a){i=1;}
g=g+1;}
if(i==1){j=j+1;}
e=e+1;}
cout << j<<endl;}

Measured memory_bytes: 1212
package main

import "fmt"

func main() {
	var t [5]int

	for i := 0; i < 5; i++ {
		fmt.Scan(&t[i])
	}

	// find maximum setsuyaku time
	var setsuyaku = 0
	for i := 0; i < 5; i++ {
		tmp := (10 - t[i] % 10) % 10
		if setsuyaku < tmp {
			setsuyaku = tmp
		}
	}

	var accum = 0
	for i := 0; i < 5; i++ {
		accum += (t[i] + 9) / 10 * 10
	}

	fmt.Println(accum - setsuyaku)
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;

int main()
{
  int n;
  cin >> n;
  char c;
  bool isyexist = 0;
  for(int i = 0; i < n; i++){
    cin >> c;
    if(c == 'Y'){
      isyexist = 1;
      break;
    }
  }
  
  if(isyexist) cout << "Four" << endl;
  else cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N, M, K;
    cin >> N >> M >> K;
    if(N*M==K*2){
        cout << "Yes" << endl;
        return 0;
    }
    bool isok = false;
    rep(n,(N-1)/2+1){
        ll dn = N - 2*n, s = n * M;
        if (K - s < 0) continue;
        if ((K - s) % dn == 0 and (K - n * M) / dn <= M) isok = true;
    }
    cout << (isok ? "Yes" : "No") << endl;
}

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll cnt=0;
    while(1){
        bool div=false;
        rep(i,n){
            if(a[i]%2==0){
                a[i]/=2;
                cnt++;
                div=true;
            }
        } 
        if(!div) break;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3588
function Main(input) {
  var n = input.split("\n")[0];
  var n_d;

  do {
    n_d = n % 4;
    n -= 7;
  } while (n_d > 0 && n > 0);
  console.log(n_d === 0 || n === 0 ? "Yes":"No");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 11340
import sys
from itertools import accumulate
def input(): return sys.stdin.readline().strip()

def main():
    N, K = map(int, input().split())
    points = []
    X = set()
    Y = set()
    for _ in range(N):
        x, y = map(int, input().split())
        points.append((x, y))
        X.add(x)
        Y.add(y)
    X = list(X)
    Y = list(Y)
    X.sort()
    Y.sort()

    mapX = {} # mapX[x] = (点のx座標が小さい方から何番目か)
    mapY = {} # mapY[y] = (点のy座標が小さい方から何番目か)
    for i, x in enumerate(X): mapX[x] = i + 1
    for i, y in enumerate(Y): mapY[y] = i + 1

    # 圧縮後の座標平面に対してグリッドを張るので、そのサイズを求めておく
    h, w = len(mapX), len(mapY)
    grid = [[0] * (w + 1) for _ in range(h + 1)]
    for x, y in points:
        grid[mapY[y]][mapX[x]] = 1
    sum_grid = [list(accumulate(grid[y])) for y in range(h + 1)]
    for y in range(1, h + 1):
        for x in range(1, w + 1):
            sum_grid[y][x] += sum_grid[y - 1][x]

    ans = 10**20
    for sx in range(1, w + 1):
        for sy in range(1, h + 1):
            for ex in range(sx, w + 1):
                for ey in range(sy, h + 1):
                    cnt = sum_grid[ey][ex] - sum_grid[ey][sx-1] - sum_grid[sy-1][ex] + sum_grid[sy-1][sx-1]
                    if cnt < K: continue
                    area = (X[ex - 1] - X[sx - 1]) * (Y[ey - 1] - Y[sy - 1])
                    ans = min(ans, area)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 69044
n = int(input())
lisA = list(map(int,input().split()))
dic  = {}
for item in lisA:
    if item in dic:
        dic[item] += 1
    else:
        dic[item] = 1
q = int(input())
ans = sum(lisA)
for i in range(q):
    b,c = map(int,input().split())
    if b not in dic:
        print(ans)
    else:
        tmp = dic[b]
        if c in dic:
            dic[c] += dic[b]
        else:
            dic[c] = dic[b]
        dic[b] = 0
        if b > c:
            ans -= (b-c) * tmp
        else:
            ans += (c-b) * tmp
        print(ans)



Measured memory_bytes: 20688
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef tuple<int, int> ii;
typedef tuple<int, int, int> iii;
const int INF = 900000;
const ll INFL = 9000000;

#define vi vector<int>
#define vii vector<vector<int> >
#define vi_def(n) vector<int>((n))
#define vii_def(n,m) vector<vector<int> >((n), vector<int>((m)))
#define vi_def_dflt(n, def) vector<int>((n), (def))
#define vii_def_dflt(n, m, def) vector<vector<int> >((n), vector<int>((m), (def)))

#define rep(i, n) for(int i=0; i < (n); ++i)
#define per(i, n) for(int i=(n)-1; i >= 0; --i)
#define range(i, begin, end) for(int i=(begin); i < (end); ++i)

#define ALL(vec) vec.begin(), vec.end()

#ifdef DBG_FLAG
#define pdbg(msg) cout << (msg)
#define pdbgl(msg) cout << (msg) << endl
#define dbg if(true)
#else
#define pdbg(msg) ;
#define pdbgl(msg) ;
#define dbg if(false)
#endif

int main(){
  char c;
  cin >> c;
  if('A' <= c && c <= 'Z') {
    cout << "A" << endl;
  }
  else{
    cout << "a" << endl;
  }
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define fori(i, a, b) for(int i = (int) a; i <= (int) b; ++i)
#define rofi(i, b, a) for(int i = (int) b; i >= (int) a; --i)
#define foreach(tt, a) for(auto &tt: a)
#define all(a) begin(a), end(a)
#define csz(a) (int) a.size()
#define pb push_back
#define epb emplace_back
#define mp make_pair
#define load(a, v) fill(begin(a), end(a), v)
#define load_mem(a, v) memset(a, v, sizeof(a));
#define iostream_optimize() ios::sync_with_stdio(false); cin.tie(0);
using ll = long long;
const ll MOD = 1e9+7, LINF = 1e16+1;
const int INF = 1e9+1;
const double EPS = 1e-10;
const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
const ll P1 = 31, P2 = 37, M1 = 1e9+7, M2 = 1e9+9;

// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/* <<<<<<<<<<<<<<<<<<<<<<<<<<<< END TEMPLATE >>>>>>>>>>>>>>>>>>>>>>>>>>> */
const int N = 1e5+1;

int n, L, T, x[N], w[N];
int main() {
	iostream_optimize();
	cin >> n >> L >> T;
	ll cnt = 0;
	fori(i, 0, n-1) {
		cin >> x[i] >> w[i];
		if(w[i] == 1) x[i] += T;
		else x[i] -= T;
		cnt += x[i] / L;
		x[i] %= L;
		if(x[i] < 0) {
			--cnt;
			x[i] += L;
		}
	}
	cnt = (cnt % n + n) % n;
	sort(x, x+n);
	fori(i, 0, n-1) cout << x[(i + cnt) % n] << '\n';
}


Measured memory_bytes: 2048
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D&lang=jp
#include<iostream>
#include<string>
#include<cstring>
using namespace std;



class CAREA
{
	public:
		CAREA();
		void CalcArea(string str);			//各水たまりの面積を計算する関数
		void DispArea(void);				//結果表示関数
		static const int INPUT_MAX = 20000;
		static const int INPUT_MIN = 1;
	private:
		int indexbackSlash;
		int indexPuddle;
		int backSlash[INPUT_MAX];			//＼が出た位置
		int cpy;							//水たまりの面積の計算用
		int area[INPUT_MAX/2];				//各水たまりの面積
		int areaPosition[INPUT_MAX/2];		//水たまりがある左端の位置
		int sumArea;						//水たまりの面積の合計
};

CAREA::CAREA() : indexbackSlash(0), indexPuddle(0), backSlash(), cpy(0),
				 area(), areaPosition(), sumArea(0){
}

/*
-------------------------------------
関数名：CalcArea
	入力：str(地域の断面図)
	return：なし
-------------------------------------
*/
void CAREA::CalcArea(string str){
	for(int i = 0; i < (int)str.size(); i++){
		if(str[i] == '\0'){
			break;
		}
		else if(str[i] == '\\'){
			//＼の位置を格納
			backSlash[indexbackSlash] = i;
			indexbackSlash++;
		}
		else if(str[i] == '_'){
			//処理なし
		}
		else if(str[i] == '/'){
			if(indexbackSlash == 0){
				//対になる＼がなければ処理なし
			}
			else{
				cpy = i - backSlash[indexbackSlash - 1];
				
				if(indexPuddle == 0){
					//水たまりの面積が1つも格納されていなければ面積と位置をそのまま格納
					areaPosition[indexPuddle] = backSlash[indexbackSlash - 1];
					area[indexPuddle] = cpy;
					indexPuddle++;
				}
				else{
					//すでに格納されている水たまりと合わせて1つの場合、水たまりを足し合わせる
					while(backSlash[indexbackSlash - 1] < areaPosition[indexPuddle - 1]){
						indexPuddle--;
						cpy += area[indexPuddle];
						area[indexPuddle] = 0;
						areaPosition[indexPuddle] = 0;
						
						if(indexPuddle == 0){
							break;
						}
					}
					
					area[indexPuddle] = cpy;
					areaPosition[indexPuddle] = backSlash[indexbackSlash - 1];
					indexPuddle++;
				}
				
				indexbackSlash--;
			}
		}
		else{
			//入ってくることはない
		}
	}
}


/*
-------------------------------------
関数名：DispArea
	入力：なし
	return：なし
-------------------------------------
*/
void CAREA::DispArea(void)
{
	for(int i = 0; i < indexPuddle; i++){
		sumArea += area[i];
	}
	//水たまりの面積の合計を表示
	cout << sumArea << endl;
	//水たまりの数を表示
	cout << indexPuddle;
	
	//各水たまりの面積を表示
	for(int i = 0; i < indexPuddle; i++){
		cout << ' ' << area[i];
	}
	cout << endl;
}


int main(void)
{
	CAREA* pArea = new CAREA;
	
	string str;
	cin >> str;
	
	pArea->CalcArea(str);
	pArea->DispArea();
	
	delete pArea;
	
	return 0;
}




Measured memory_bytes: 3280
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define elnd endl //* missspell check
const ll INF = 1LL << 60;


void solve(long long N, std::vector<long long> A){
    map<ll, ll> B;
    REP(i, N){
        B[A[i]]++;
    }
    priority_queue<pll> C;
    for(auto x:B){
        C.push(pll(x.second, x.first));
    }
    while(C.top().first>1){
        pll x = C.top(); C.pop();
        if(C.empty()){
            cout << 1 << endl;
            return;
        }
        else{
            if(C.top().first> 1){
                auto y = C.top(); C.pop();
                y.first --;
                C.push(y);
                x.first --;
                C.push(x);
            }
            else{
                if(x.first > 2){
                    x.first -= 2;
                    C.push(x);
                }
            }
        }
    }
    cout << C.size() <<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dijkstra geo2 kruskal graph uf lca BIT
// matrix dinic next_combination topcoder lcm

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

    string st;
    cin >> st;
    if (st.size() < 4) {
        cout << "No" << endl;
        return 0;
    }
    if (st[0] == 'Y' && 
            st[1] == 'A' &&
            st[2] == 'K' &&
            st[3] == 'I') {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


    return 0;
}


Measured memory_bytes: 384
s = input().strip()
K = int(input())
if K>len(s)*26:
    d = (K-len(s)*26)//26
    K = K-26*d
x = ""
for i in range(len(s)):
    if i<len(s)-1 and (26-(ord(s[i])-ord("a")))%26 <= K:
        x += "a"
        K -= (26-(ord(s[i])-ord("a")))%26
    elif i<len(s)-1:
        x += s[i]
    elif i==len(s)-1:
        k = ord(s[i])+K%26
        if k<=122:
            x += chr(k)
        else:
            x += chr(k-26)
print(x)

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = 998244353;
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
inline void dump(){cout<<endl;}
template<class Head,class... Tail>inline void dump(Head&& head, Tail&&... tail){cout<<head<<", ";dump(forward<Tail>(tail)...);}
template<typename T>inline istream &operator>>(istream&input,vector<T>&v){for(auto &elemnt:v)input>>elemnt;return input;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}

template<ll MOD=ll(1e9+7)>
ll mod_pow(ll n,ll p){
  ll ans=1LL;
  while(p){
    if(p&1)ans*=n;
    n*=n;
    p>>=1;
    ans%=MOD;
    n%=MOD;
  }
  return ans;
}


main(){

  ll n;
  cin>>n;
  vector<ll> a(n);
  cin>>a;

  if(a[0]!=0){
    cout<<0<<endl;
    return 0;
  }

  map<ll,ll> cnt;
  for(auto x:a)cnt[x]++;
  if(cnt[0]>1){
    cout<<0<<endl;
    return 0;
  }

  ll ans = 1;
  ll mx = *max_element(a.begin(),a.end());
  for(int i=2;i<=mx;++i){
    ans *= mod_pow<MOD>(cnt[i-1],cnt[i]);
    ans %= MOD;
  }
  cout<<(ans)<<endl;

}

Measured memory_bytes: 7296
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		double r,pi,a,b;
		pi=Math.PI;
		r=sc.nextDouble();
		a=pi*r*r;
		b=2*pi*r;
	System.out.printf("%f %f\n",a,b);
	}
}



Measured memory_bytes: 28452
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, k;
    cin >> a >> b >> k;
    ll m = a-k;
    if (m<=0){
        b += m;
        cout << max(0LL, m) << ' ' << max(0LL, b) << endl;
    }else{
        cout << m << ' ' << b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int N, len = 0; cin >> N;

    bool all_one = true;
    while(N) {
        all_one &= (N % 2 == 1);
        len++;
        N >>= 1;
    }

    if(all_one) cout << len << endl;
    else cout << len - 1 << endl;
    return 0;
}


Measured memory_bytes: 3088
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
ans = 0

end_a = 0
start_b = 0
both = 0
for i in range(N):
    S = input()
    ans += S.count("AB")
    if S[-1] == 'A' and S[0] == 'B':
        both += 1
    elif S[-1] == 'A':
        end_a += 1
    elif S[0] == 'B':
        start_b += 1

if both == 0:
    ans += min(start_b, end_a)
else:
    if start_b + end_a > 0:
        ans += both + min(start_b, end_a)
    else:
        ans += both - 1
# if end_a > start_b:
#     ans += start_b
#     end_a -= start_b
#     start_b = 0
# else:
#     ans += end_a
#     start_b -= end_a
#     end_a = 0

# if both >= 1:
#     ans += both - 1
#     if start_b > 0:
#         ans += 1
#     if end_a > 0:
#         ans += 1
print(ans)



Measured memory_bytes: 9368
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    string S;
    cin >> S;
    ll N = S.size();
    vector<ll> L(N, 0), R(N, 0), ans(N, 0);
    
    R[0] = 1; L[N-1] = 1;
    
    rep(i, 1, N){
        if(S[i] == 'R') R[i] = R[i-1] + 1;
    }
    
    for(ll i = N-2; i >= 0; i--){
        if(S[i] == 'L') L[i] = L[i+1] + 1;
    }
    
    rep(i, 0, N-1){
        if(S[i] == 'R' && S[i+1] == 'L'){
            ans[i] = (R[i] + 1)/2 + (L[i+1])/2;
            ans[i+1] = (R[i])/2 + (L[i+1] + 1)/2;
        }
    }

    rep(i, 0, N) cout << ans[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    set<int> A;
    int tmp;
    for (int i = 0; i < n; i++) {
        cin >> tmp;
        auto cnt = A.count(tmp);
        if (cnt == 1) {
            cout << "NO" << endl;
            return 0;
        }
        else A.insert(tmp);
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

int main() {
  int N;
  cin >> N;
  vector<vector<int>> A(2, vector<int>(N));
  rep(i, 2) {
    rep(j, N) { cin >> A[i][j]; }
  }

  int ans = 0;
  rep(i, N) {
    int temp = 0;
    repp(j, 0, i) { temp += A[0][j]; }
    repp(j, i, N - 1) { temp += A[1][j]; }
    chmax(ans, temp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
const int MOD = 1000000007;

vector<int> to[200000];
int value[200000], v[200000];
int visited[200000] = {};

int main(){
  int M,D;
  cin >> M >> D;
  int count = 0;
  for(int i=4;i<=M;i++){
    for(int j=22;j<=D;j++){
      if(j%10 < 2) continue;
      if(j/10 < 2) continue;
      if(i == ((j%10)*(j/10))) count++;
    }
  }
  cout << count;
}


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

int main(){
    int a, b;
    cin >> a >> b;

    if(a == 1 && b != 1){
        cout << "Alice" << endl;
    }else if (a > b && b !=1){
        cout << "Alice" << endl;
    }else if (b == 1 && a != 1)
    {
        cout << "Bob" << endl;
    }else if (a < b && a != 1){
        cout << "Bob" << endl;
    }else{
        cout << "Draw" << endl;
    }
    return 0;
}

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


long long p[5001];
long long c[5001];
int n;
long long k;

vector<long long> getPermutationValues(int start) {
	int startProxy = start; 
    vector<long long> vals;
    long long curr = 0;
    do {
      curr = curr + c[p[startProxy]]; 
      vals.push_back(curr);
      startProxy = p[startProxy];
    } while(startProxy != start);
    return vals; 
}

int main() {
   cin >> n >> k;
   for(int i = 1 ; i <= n; i++) {
      cin >> p[i];
   }

   for(int i = 1 ; i <= n; i++) {
      cin >> c[i];
   }

   long long ans = LLONG_MIN;

   for(int i = 1; i <= n; i++) {
      vector<long long> vals = getPermutationValues(i); 
      long long cycleSum = vals[vals.size()-1];
      for(int j = 0; j < vals.size(); j++) { 
            if(j + 1 > k) break;
            int cyclesFinished = (k-j-1)/vals.size();
        	if(cycleSum < 0) {
              ans = max(ans, vals[j]);
            } else {
              ans = max(ans, vals[j] + cyclesFinished*cycleSum);
            }
      }
   }

   cout << ans;

	return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>                        
#define pb push_back                            
#define mp make_pair                            
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)((x).size())
#define jonathan ios_base::sync_with_stdio(0)
#define livingston cin.tie(0)
using namespace std;                            
                                                
void yes() {cout << "YES" << endl;}                                               
void no() {cout << "NO" << endl;}                                                        
                                                
int dx[] = {1, 0, -1, 0, -1, -1, 1, 1};         
int dy[] = {0, 1, 0, -1, -1, 1, -1, 1}; 

const int INF = 1e9 + 9;
const long long LINF = 1e18 + 8;
const double EPS = 1e-9;
const long long MOD = 1e9 + 7; //998244353
const double PI = acos(-1);

void solve() {
    int n, m; cin >> n >> m;
    vector<int> used(n + 1, false);
    vector<int> cnt(n + 1, 1);
    used[1] = true;
    for (int i = 0; i < m; i++) {
        int x, y; cin >> x >> y;
        used[y] = used[y] | used[x];
        cnt[x]--;
        cnt[y]++;
        if (cnt[x] == 0) used[x] = false;
    }
    int res = 0;
    for (int i = 1; i <= n; i++) {
        res += used[i];
    }
    cout << res << endl;
} 

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

Measured memory_bytes: 3984
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};



int main(){
    int d,e;
    while(cin >> d >> e){
        if(d == 0 && e == 0)return 0;
        double E = e;
        double w = 100000;
        for(int i = 0;i <= d;i++){
            double dist = sqrt(i*i + (d-i)*(d-i));
            w = min(w, abs(dist - E));
        }
        cout<<w<<endl;
    }
}



Measured memory_bytes: 3192
#include <bits/stdc++.h> 
#define ll long long int
#define ld long double
#define ull unsigned long long
const double pi=3.14159265358979323846;
using namespace std;

bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 
ll bigd(ll n) 
{
    ll in=1;
    for (ll i =2; i < n; i++)
    {
        if (n % i == 0) 
        {
            in= i;
            break;
        }    
    }   
    return in;
} 

ll ipow(ll base, ll exp)
{
    ll result = 1;
    for (;;)
    {
        if (exp & 1)
            result *= base;
        exp >>= 1;
        if (!exp)
            break;
        base *= base;
    }
    return result;
}
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    ll n;
    cin>>n;
    ll a[n],sum=0;
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    unordered_map <ll,ll> mp;
    for (int i = 0; i < n; i++) 
    mp[a[i]]++;
    ll q;
    cin>>q;
    for(ll i=0;i<q;i++)
    {
        ll b,c;
        cin>>b>>c;
        if(b<=c)
        {
            if(mp[b]>0)
            {
                mp[c]+=mp[b];
                sum+=mp[b]*(c-b);
                mp[b]=0;
            }
        }
        else if(b>c)
        {
            if(mp[b]>0)
            {
                mp[c]+=mp[b];
                sum-=mp[b]*(b-c);
                mp[b]=0;
            }
        }
        cout<<sum<<"\n";
    } 
}

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

using namespace std;

const int N = 1e5 + 5;

int cost[N];
bool vis[N];
int dp[N];
int mincost [N];
int n;

int calcmincost (int x ) {
	
	
	if (x <= 1 ) return 0;
	
	if (mincost[x] != -1) return mincost[x];
	
	mincost[x]=min ( calcmincost(x-1) + abs(cost[x] - cost[x-1]) , calcmincost(x-2) + abs(cost[x] - cost[x-2])) ;
	return mincost[x];
}

int main (){
	memset(mincost,-1, sizeof mincost);
	scanf("%d",&n);
	
	for (int i=1;i<=n;i++) scanf("%d",&cost[i]);
	
	
	cost[0]=-1e9;
	mincost[1]=0;
	
	cout<<calcmincost(n)<<endl;


}
	
	



Measured memory_bytes: 6776
#include <bits/stdc++.h>
using namespace std;
int main(void){
    char c;
    cin >> c;
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') cout << "vowel" << endl;
    else cout << "consonant" << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func gcd(a, b int) int {
	if a > b {
		a, b = b, a
	}
	if a == 0 {
		return b
	}
	return gcd(b%a, a)
}

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}

	ans := 1000000001
	for i := 0; i < len(a)-1; i++ {
		t := gcd(a[i], a[i+1])
		if t < ans {
			ans = t
		}
	}
	fmt.Println(ans)
}


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

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

    map<string,int> S;
    for (int i=0;i<N;i++){
        string input;
        cin >> input;
        S[input]++;
    }
    cout << S.size() << endl;
}

Measured memory_bytes: 19220
#Ice link game
import math
k=int(input())
lists=list(map(int,input().split()))
lists=lists[::-1]
maxi=2
mini=2
flag=True
for i in range(k):
    #maxiとminiについて更新をしてゆく
    a=lists[i]
    upper_bound=math.floor(maxi/a)
    lower_bound=math.ceil(mini/a)
    new_maxi=(upper_bound+1)*a-1
    new_mini=lower_bound*a
    if new_maxi<new_mini:
        flag=False
        break
    else:
        maxi=new_maxi
        mini=new_mini
if flag:
    print(mini,maxi)
else:
    print(-1)

Measured memory_bytes: 15020
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int p[200000], cnt, n;
int main() {
	cin >> n; for (int i = 1; i <= n; i++)cin >> p[i];
	for (int i = 1; i <= n; i++) {
		if (p[i] < i && p[p[i]] == i)cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 768
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let _n: usize = input();
    let a: usize = input();
    let b: usize = input();
    let c: usize = input();
    let d: usize = input();
    let s: Vec<char> = input::<String>().chars().collect();

    let mut ok = true;
    for i in a..c {
        if s[i - 1] == '#' && s[i] == '#' {
            ok = false;
        }
    }
    for i in b..d {
        if s[i - 1] == '#' && s[i] == '#' {
            ok = false;
        }
    }
    if c > d {
        let mut found = false;
        for i in b - 1..d {
            if s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.' {
                found = true;
            }
        }
        if !found {
            ok = false;
        }
    }
    println!("{}", if ok { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(void)
{
	int i, n;
	int count[2][100001];
	int max11, max12, max21, max22, sum = 0;
	int vmax11, vmax12, vmax21, vmax22;
	for(i=0;i<=100000;i++) {
		count[0][i] = 0;
		count[1][i] = 0;
	}

	scanf("%d", &n);
	for(i=0;i<n/2;i++) {
		int m;
		scanf("%d%*c", &m);
		count[0][m]++;
		scanf("%d%*c", &m);
		count[1][m]++;
	}
	max11 = count[0][0]; max12 = count[0][0];
	max21 = count[1][0]; max22 = count[1][0];
	for(i=1;i<=100000;i++) {
		if(count[0][i] > max11) {
			max12 = max11;
			vmax12 = vmax11;
			max11 = count[0][i];
			vmax11 = i;
		} else if(count[0][i] > max12) {
			max12 = count[0][i];
			vmax12 = i;
		}
		if(count[1][i] > max21) {
			max22 = max21;
			vmax22 = vmax21;
			max21 = count[1][i];
			vmax21 = i;
		} else if(count[1][i] > max22) {
			max22 = count[1][i];
			vmax22 = i;
		}
	}
	if(vmax11 != vmax21) {
		printf("%d\n", n-max11-max21);
	} else {
		int max1 = (max11>max21)?max11:max21;
		int max2 = (max12>max22)?max12:max22;
		printf("%d\n", n-max1-max2);
	}

	return 0;
}

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

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

int main(){
    int N;
    std::string S;
    std::cin >> N >> S;

    std::vector< std::vector< int > > dp(N+1, std::vector< int >(N+1, 0));

    int ans = 0;
    for(int i=N-1; i>=0; i--){
        for(int j=N-1; j>i; j--){
            if(S[i] == S[j]){
                if(dp[i][j] < dp[i+1][j+1] + 1){
                    dp[i][j] = dp[i+1][j+1] + 1;
                }
            }
            ans = std::max(ans, std::min(dp[i][j], j-i));
        }
    }
    std::cout << ans << std::endl;
    return 0;
}



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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}

void solve(long long A, long long B, long long C) {
  C -= min(C, A - B);
  cout << C << endl;
}

int main() {
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  long long C;
  scanf("%lld", &C);
  solve(A, B, C);
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
public static void main(String[] args){
    
    Scanner s=new Scanner(System.in);
    
    String a=s.nextLine();
    String b=a+a;
    String c=s.nextLine();
    if(b.contains(c))
        System.out.println("Yes");
    else
        System.out.println("No");
    s.close();
}
}


Measured memory_bytes: 26252
#include <iostream>
#include <set>
#include <string>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

std::set<std::string> st;

int main(void){
	int n;
	std::string s;
	std::cin >> n;
	while(n--){
		std::cin >> s;
		st.insert(s);
	}
	std::cout << st.l_ength() << std::endl;
	return 0;
}


Measured memory_bytes: 19180
#include <cstdio>
#include <algorithm>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

constexpr int MAX_N = 100000;

int N;
int a[MAX_N];
int k, l;

int main()
{
  scanf( "%d", &N );
  rep( i, N )
  {
    scanf( "%d", a+i );

    if( a[i] % 4 == 0 )
      ++k;
    if( a[i] % 4 != 0 && a[i] % 2 == 0 )
      ++l;
  }

  puts( std::max( 2*k+l, 2*k+1 ) >= N ? "Yes" : "No" );

  return 0;
}

Measured memory_bytes: 512
def calctime(w,dist):
    time=dist/(2000/(70.0+w))
    return time

def solve():
    dist=[[None]*n for _ in xrange(n)]
    for i in xrange(n):
        for j in xrange(n):
            if i==j:
                dist[i][j]=float('inf')
            else:
                dist[i][j]=abs(d[i]-d[j])

    w=[float('inf')]*(1<<n)
    time=[[float('inf')]*n for _ in xrange(1<<n)]
    last=[[0]*n for _ in xrange(1<<n)]
    for i in xrange(n):
        time[1<<i][i]=0
        w[1<<i]=v[i]*20

    for i in xrange(1,1<<n):
        for j in xrange(n):
            if w[i]==float('inf'):continue
            for k in xrange(n):
                if not i>>k&1:
                    nexti=i|(1<<k)
                    w[nexti]=w[i]+v[k]*20
                    if time[nexti][k]>calctime(w[i],dist[j][k])+time[i][j]:
                        time[nexti][k]=calctime(w[i],dist[j][k])+time[i][j]
                        last[nexti][k]=j

    ans=[]
    now=(1<<n)-1
    last_index=time[now].index(min(time[now]))
    while now!=0:
        ans.append(s[last_index])
        nx=last[now][last_index]
        now=now^(1<<last_index)
        last_index=nx
    ans.reverse()
    return ans

n=int(raw_input())
s={}
d={}
v={}
for i in xrange(n):
    S,D,V=map(int,raw_input().split())
    s[i]=S
    d[i]=D
    v[i]=V

ans=solve()
print(' '.join(map(str,ans)))

Measured memory_bytes: 27320
#[allow(unused_imports)]
use std::cmp::{min,max};
#[allow(unused_imports)]
use std::collections::BTreeMap;
#[allow(unused_imports)]
use std::ops::*;

fn main() {
    let mut fact = vec![Mod(1); 312345];
    for i in 1..fact.len() {
        fact[i] = fact[i-1] * Mod(i as u64);
    }
    let (n,a,b,k) = {
        let xs = read_vec_i64();
        (xs[0] as usize, xs[1] as usize, xs[2] as usize, xs[3] as usize)
    };
    let mut res = Mod(0);
    for x in 0..n+1 {
        if x*a > k {
            continue;
        }
        if (k-x*a) % b != 0 {
            continue;
        }
        let y = (k-x*a) / b;
        if ! (y <= n) {
            continue;
        }
        res += fact[n] / (fact[x] * fact[n-x]) * fact[n] / (fact[y] * fact[n-y]);
    }
    println!("{}", res.0);
}


const MOD : u64 = 998244353;
//const MOD : u64 = 1_000_000_007;
#[derive(Clone,Copy,PartialEq)]
struct Mod (u64);
use std::ops::*;

impl Mod {
    fn pow(self, n: u64) -> Mod {
        if n == 0 {
            return Mod(1);
        }
        let t = self.pow(n/2);
        if n % 2 == 0 {
            t * t
        }
        else {
            t * t * self
        }
    }
}

impl Add for Mod {
    type Output = Self;
    fn add(self, rhs: Self) -> Self::Output {
        Mod((self.0 + rhs.0) % MOD)
    }
}

impl AddAssign for Mod {
    fn add_assign(&mut self, rhs: Self) {
        *self = *self + rhs;
    }
}

impl Sub for Mod {
    type Output = Self;
    fn sub(self, rhs: Self) -> Self::Output {
        Mod((self.0 + MOD - rhs.0 % MOD) % MOD)
    }
}

impl SubAssign for Mod {
    fn sub_assign(&mut self, rhs: Self) {
        *self = *self - rhs;
    }
}

impl Mul for Mod {
    type Output = Self;
    fn mul(self, rhs: Self) -> Self::Output {
        Mod(self.0 % MOD * rhs.0 % MOD)
    }
}

impl Div for Mod {
    type Output = Self;
    fn div(self, rhs: Self) -> Self::Output {
        self * rhs.pow(MOD-2)
    }
}




#[allow(dead_code)]
fn read_line() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    ret.pop();
    return ret;
}

#[allow(dead_code)]
fn read_i64() -> i64 {
    let ss = read_line();
    return ss.parse::<i64>().unwrap();
}

#[allow(dead_code)]
fn read_vec_i64() -> Vec<i64> {
    let mut res = vec![];
    let ss = read_line();
    for ts in ss.split_whitespace() {
        let x = ts.parse::<i64>().unwrap();
        res.push(x);
    }
    return res;
}

use std::fmt::Display;
#[allow(dead_code)]
fn write_vec<T: Display>(xs: &Vec<T>) {
    if xs.len() == 0 {
        println!("");
        return;
    }
    print!("{}", xs[0]);
    for i in 1..xs.len() {
        print!(" {}", xs[i]);
    }
    println!("");
}


Measured memory_bytes: 8572
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll p=pow(10,9)+7;
ll phi(ll n) {
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if(n > 1)
        result -= result / n;
    return result;
}
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      
    x = x % p;  
   while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 
 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
}
ll stam(ll arr[],ll n,ll temp)
{
    ll st=0;
    for(ll i=0;i<n;i++)
    {
        st+=pow(temp-arr[i],2);
    }
    return st;
}
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll k,n,i,j;
    cin>>n;
    ll arr[n];
    ll sum=0;
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    ll ans=-1;
    for(i=1;i<=100;i++)
    {
        ll temp=stam(arr,n,i);
        if(ans==-1||temp<ans)
        ans=temp;
    }
    cout<<ans;


    
    return 0;
    
}
    

Measured memory_bytes: 256
#include <iostream>
#include <queue>

using namespace std;

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

signed main() {
  int k;
  cin >> k;
  queue<int> q;
  rep(i,9) q.push(i+1);
  
  while(k != 1) {
    int n = q.front(), x = n % 10;
    q.pop();
    k--;
    if(x != 0) q.push(10 * n + x - 1);
    q.push(10 * n + x);
    if(x != 9) q.push(10 * n + x + 1);
  }
  cout << q.front() << endl;
  return 0;
}

Measured memory_bytes: 4528
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<queue>

using namespace std;

string s;

int main(){
  cin>>s;

  int len = (int)s.length();

  int ans = 0;

  if(len%2){
    int mid = len/2;
    char mc = s[mid];
    for(int i=1;i<=len/2;i++){
      if((s[mid-i] != mc) || (s[mid+i] != mc)){
        ans = mid+i;
        break;
      }
    }
  } else {
    int mid = len/2;
    char mc = s[mid];
    for(int i=0;i<len/2;i++){
      if((s[mid-i-1] != mc) || (s[mid+i] != mc)){
        ans = mid+i;
        break;
      }
    }
  }
  if(ans == 0){
    ans = len;
  }

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

Measured memory_bytes: 512
import re
import doctest

class IO_for_Contest(object):
    @staticmethod
    def my_input():
        #return raw_input()
        return input()

    @staticmethod
    def read_from_input():
        #TODO: impl this for each problem
        pass

    @staticmethod
    def read_line():
        return IO_for_Contest.my_input().strip()

    @staticmethod
    def read_int():
        return int(IO_for_Contest.my_input().strip())

    @staticmethod
    def read_n_int(n):
        return list(map( \
                int, \
                re.split('\s+', IO_for_Contest.my_input().strip())))[ : n]
def solve():
    l = []
    buf = IO_for_Contest.read_line()
    for x in buf:
        if x == 'B':
            if len(l) > 0:
                l.pop()
        else:
            l.append(x)
    print(''.join(l))

if __name__ == '__main__':
    #doctest.testmod()
    solve()

Measured memory_bytes: 8092