akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
typedef std::pair<int,int> ipair;

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

ll count_num(ll num) {
    ll nownum = num;
    ll nowsub = 1;
    ll funans = 0;
    while(nownum > 0) {
        nownum = nownum - nowsub;
        nowsub++;
        if (nownum >= 0) {
            funans++;
        }
    }
    return funans;
}

int main()
{
    ll n;
    cin >> n;
    const auto &res = prime_factorize(n);

    ll ans = 0;
    for (auto p : res) {
        ans += count_num(p.second);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

int main() {
  int N, K; cin >> N >> K;
  vector<int> a(N);
  rep(i, N) cin >> a[i];
  vector<bool> dp(K, false);
  rep(i, K + 1) {
    rep(j, N) {
      if(i - a[j] >= 0) {
	dp[i] = dp[i] | !dp[i - a[j]];
      }
    }
  }
  if(dp[K]) cout << "First" << endl;
  else cout << "Second" << endl;
}

Measured memory_bytes: 3656
#include <iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
    int n; cin >> n; int r[200000]; int m = 0; bool y = false;
    for (int i = 0; i < n; i++) {
        cin >> r[i];
    }
    for (;;) {
        if (n != 1) {
            for (int i = 0; i < n - 1; i++) {
                if (r[i] > r[i + 1]) {
                    swap(r[i], r[i + 1]);
                    ++m;
                    break;
                }
                if (i == n - 2 || n - 1 == 0) {
                    y = true;
                    break;
                }
            }
            if (y)
                break;
        }
        else
            break;
    }
    for (int i = 0; i < n - 1; i++) {
        cout << r[i] << " ";
    }
    cout  << r[n - 1]<< endl;
    cout << m << endl;
}


Measured memory_bytes: 3096
#include<stdio.h>
#include<math.h>

typedef struct{ double x,y; }Point;

Point Rotate(Point pivot, Point tgt, double deg){
	double angle=M_PI*deg/180.0;

	tgt.x-=pivot.x;		tgt.y-=pivot.y;

	Point ret;
	//(x+yi)(cos+sini)
	//=(xcos-ysin) + (xsin+ycos)i

	ret.x=tgt.x*cos(angle) - tgt.y*sin(angle);
	ret.y=tgt.x*sin(angle) + tgt.y*cos(angle);

	ret.x+=pivot.x;		ret.y+=pivot.y;

	return ret;
}

void Koch(int n,Point s, Point e){
	if(n==0)return;

	Point a,b,c;
	
	a.x=(2*s.x + 1*e.x)/3;	a.y=(2*s.y + 1*e.y)/3;
	c.x=(1*s.x + 2*e.x)/3;	c.y=(1*s.y + 2*e.y)/3;

	b=Rotate(a,c,60);

	Koch(n-1,s,a);
	printf("%.8lf %.8lf\n",a.x, a.y);
	Koch(n-1,a,b);
	printf("%.8lf %.8lf\n",b.x, b.y);
	Koch(n-1,b,c);
	printf("%.8lf %.8lf\n",c.x, c.y);
	Koch(n-1,c,e);
}

int main(){
	int n;	scanf("%d",&n);
	Point s={0,0},e={100,0};

	printf("%.8lf %.8lf\n",s.x, s.y);
	Koch(n,s,e);
	printf("%.8lf %.8lf\n",e.x, e.y);

	return 0;
}



Measured memory_bytes: 2824
#include <iostream>
#include <vector>

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

  int height, width;
  std::cin >> height >> width;

  std::vector<std::string> grid(height);
  std::vector<std::vector<int>> count(height, std::vector<int>(width, 0));

  for (int r = 0; r < height; r++) {
    std::cin >> grid[r];

    // 左を何マス照らせるか
    {
      int cnt = 0;
      for (int c = 0; c < width; c++) {
        if (grid[r][c] == '.') {
          count[r][c] += cnt;
          cnt++;
        } else {
          cnt = 0;
        }
      }
    }

    // 右を何マス照らせるか
    {
      int cnt = 0;
      for (int c = width - 1; c >= 0; c--) {
        if (grid[r][c] == '.') {
          count[r][c] += cnt;
          cnt++;
        } else {
          cnt = 0;
        }
      }
    }
  }

  for (int c = 0; c < width; c++) {
    // 上を何マス照らせるか
    {
      int cnt = 0;
      for (int r = 0; r < height; r++) {
        if (grid[r][c] == '.') {
          count[r][c] += cnt;
          cnt++;
        } else {
          cnt = 0;
        }
      }
    }

    // 下を何マス照らせるか
    {
      int cnt = 0;
      for (int r = height - 1; r >= 0; r--) {
        if (grid[r][c] == '.') {
          count[r][c] += cnt;
          cnt++;
        } else {
          cnt = 0;
        }
      }
    }
  }

  int answer = 0;
  for (int r = 0; r < height; r++) {
    for (int c = 0; c < width; c++) {
      if (grid[r][c] == '.') {
        answer = std::max(answer, count[r][c] + 1);
      }
    }
  }

  std::cout << answer << std::endl;

  return 0;
}

Measured memory_bytes: 20224
n,m,c = map(int,raw_input().split(" "))
b = map(int,raw_input().split(" "))
a = []
for x in range(n):
  q = map(int,raw_input().split(" "))
  a.append(q)

ans = 0

for x in range(n):
  q = 0
  for y in range(m):
    q += a[x][y] * b[y]
  q += c
  if q > 0:ans += 1

print ans


Measured memory_bytes: 2696
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split()))
import math;floor,ceil=math.floor,math.ceil
from collections import deque
Yes=lambda b:print('Yes')if b else print('No');YES=lambda b:print('YES')if b else print('NO')
is_even=lambda x:True if x%2==0 else False

def main():
  l=aint();print(l**3/27)

if __name__ == '__main__':
  main()

Measured memory_bytes: 3316
// luogu-judger-enable-o2
//Code by : Y-k-y
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#define ll long long
const int N=100010;
using namespace std;
inline int rnd(){
	int res=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){res=res*10+ch-'0';ch=getchar();}
	return res*f;
}
inline void wr(int x){
	if(x<0){putchar('-');x=-x;}if(x>9) wr(x/10);putchar(x%10+'0');
}
vector<int>vec[N];
int n,sg[N];
inline void dfs(int u,int f){
	sg[u]=0;
	for(int i=0;i<vec[u].size();i++){
		int v=vec[u][i];
		if(v==f)continue;
		dfs(v,u);
		sg[u]^=(sg[v]+1);
	}
}
int main(){
	cin>>n;int x,y;
	for(int i=1;i<n;i++){
		x=rnd();y=rnd();
		vec[x].push_back(y);
		vec[y].push_back(x);
	}
	dfs(1,0);
	if(sg[1])puts("Alice");
	else puts("Bob");
	return 0;
}


Measured memory_bytes: 10112
S = str(input())

if 12 >= int(S[0:2]) >= 1:

    if 12 >= int(S[2:4]) >= 1:
        print("AMBIGUOUS")

    else:
        print("MMYY")

else:
    if 12 >= int(S[2:4]) >= 1:
        print("YYMM")

    else:
        print("NA")


Measured memory_bytes: 2940
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <cassert>
#define SIZE 1005

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int id[SIZE][SIZE];

int main()
{
	int n;
	scanf("%d",&n);
	int k=1,sum=0;
	while(sum<n)
	{
		sum+=k;
		k++;
	}
	if(sum>n)
	{
		puts("No");
		return 0;
	}
	int now=1;
	for(int i=0;i<k;i++)
	{
		for(int j=i+1;j<k;j++)
		{
			id[i][j]=id[j][i]=now++;
		}
	}
	puts("Yes");
	printf("%d\n",k);
	for(int i=0;i<k;i++)
	{
		printf("%d",k-1);
		for(int j=0;j<k;j++)
		{
			if(j==i) continue;
			printf(" %d",id[i][j]);
		}puts("");
	}
	return 0;
}


Measured memory_bytes: 3072
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
typedef long long ll;
#define N 100010
using namespace std;
set <int> v[N];
int h[N];

ll getPow(ll i,int n)
{
	int j=i;
	i=1;
	while (n--)
		i*=j;
	return i;
}
void solve()
{
	int x;
	cin>>x;
	for (int i=-200;i<=200;i++) 
		for (int j=-200;j<=200;j++)
			if (getPow(i,5)-getPow(j,5)==x)
			{
				cout<<i<<" "<<j;
				return ;
			}
				
}

int main() 
{
	ios::sync_with_stdio(false);
	solve();
	return 0;
}

Measured memory_bytes: 8284
import bisect
import collections
import itertools

def getint(): return int(input())
def getints(): return list(map(int, input().split()))
def getint2d(rows): return [getints() for _ in range(rows)]
def getgrid(rows): return [input() for _ in range(rows)]
def array1d(n, value): return [value for _ in range(n)]
def array2d(n, m, value): return [array1d(m, value) for _ in range(n)]

n=getint()
s=input()

west_count = [0]*n
west_count[0] = 1 if s[0] == 'W' else 0
for i in range(1, n):
    west_count[i] = west_count[i - 1] + (1 if s[i] == 'W' else 0)

east_count = [0]*n
east_count[-1] = 1 if s[-1] == 'E' else 0
for i in range(n-2,-1,-1):
    east_count[i] = east_count[i + 1] + (1 if s[i] == 'E' else 0)

res = n
for i in range(n):
    tmp = west_count[i - 1] if i > 0 else 0
    tmp += east_count[i + 1] if i < n - 1 else 0
    res = min(res, tmp)

print(res)


Measured memory_bytes: 47320
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sz size()
#define ll long long
#define all(_v) _v.begin(), _v.end()
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pvllvll pair <vector <ll>, vector <ll> >
#define ld long double
#define veci vector <int>
#define vecll vector <ll>


const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const double PI = 3.1415926535897932384626433832795;
const double eps = 1e-9;
const int MOD1 = 1e9 + 7;
const int MOD2 = 998244353;

int a[110][2];

bool che(int x) {
    return (a[x][1] == a[x][2]);
}

void solve() {
    bool ch = 0;
    int n;
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        for(int j = 1; j <= 2; ++j) cin >> a[i][j];
    }
    for(int i = 1; i + 2 <= n; ++i) {
        if(che(i) && che(i + 1) && che(i + 2)) {
            ch = 1;
            break;
        }
    }
    if(ch) cout << "Yes";
    else cout << "No";
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int T = 1;
    ///cin >> T;
    while(T--) solve(), cout << '\n';
    return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;

const int N = 105;

int n, k, a[N];
vector<int> ans;
priority_queue<pair<int, int>> pq;

int main()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        pq.push(make_pair(a[i], i));
    }
    for (int u, i = 0; i <= k; i++)
    {
        while (!pq.empty())
        {
            u = pq.top().second;
            if (a[u] == 0)
                return cout << -1, 0;
            a[u]--;
            ans.push_back(u);
            pq.pop();
        }
        for (int j = 1; j <= n; j++)
            if (j != u)
                pq.push(make_pair(a[j], j));
    }
    cout << ans.size() << '\n';
    for (int &v : ans)
        cout << v << " ";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
constexpr ll INF = LLONG_MAX;
constexpr double DINF = DBL_MAX;
constexpr ll mod = 1e9+7;
constexpr double PI = M_PI;

template<typename T>
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...));
}

int main(){
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
 
  long long n;
  cin >> n;
  vector<ll> a(n-1), b(n-1);
  vector<vector<ll> > graph(n);
  map<pair<ll, ll>, int> mp;
  for(int i = 0; i < n-1; i++){
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
    graph[a[i]].push_back(b[i]);
    graph[b[i]].push_back(a[i]);
    mp[make_pair(a[i], b[i])]++;
  }
  int k = 0;
  for(int i = 0; i < n; i++){
    k = max(k, (int)graph[i].size());
  }
  queue<pair<ll, int> > que;
  vector<bool> visited(n, false);
  que.push(make_pair(0, -1));
  while(!que.empty()){
    int now = que.front().first;
    int precol = que.front().second;
    que.pop();
    visited[now] = true;
    int nextcol = 0;
    for(int i = 0; i < (int)graph[now].size(); i++){
      long long next = graph[now][i];
      if(!visited[next]){
        nextcol++;
        if(nextcol == precol) nextcol++;
        que.push(make_pair(next, nextcol));
        if(mp[make_pair(now, next)] == 1){
          mp[make_pair(now, next)] = nextcol;
        }else{
          mp[make_pair(now, next)] = nextcol;
        }
      }
    }
  }
  cout << k << endl;
  for(int i = 0; i < n-1; i++){
    cout << mp[make_pair(a[i], b[i])] << endl;
  }
  return 0;
}


Measured memory_bytes: 14592
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef vector<int> VI;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
constexpr auto INF = 1000000000;
constexpr auto LLINF = 9223372036854775807;
constexpr auto mod = 1000000007;

int main() {
	
	string s; int k;
	cin >> s >> k;
	vector<string> a;
	FOR(i, s.length())eFOR1(j, k) {
		if (i + j > s.length())continue;
		a.push_back(s.substr(i, j));
	}
	SORT(a);
	unique(a.begin(), a.end());
	cout << a[k - 1] << endl;

	return 0;
}

Measured memory_bytes: 1660
#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++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;
const ll mod = 1e9 + 7;

int main() {
  int h, a;
  cin >> h >> a;
  cout << (h - 1) / a + 1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<int>>
constexpr auto mod = 1000000007;


//2のn乗を求めるよ！！！
int ni(int n) {
	if (n == 0)return 1;
	int x = ni(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;
}

//フィボナッチ数列のx番目を求めるよ！
int f(int x,vector<int> s) {
	if (x == 0)return 0;
	if (x == 1)return 1;
	if (s[x] != 0)return s[x];
	s[x] = f(x - 1,s) + f(x - 2,s);
	return s[x];
}

//aとｂの最大公約数を求めるよ！
int gcd(int a, int b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}



// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b,ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}

//2進数のn桁を全列挙やで
llint dfs(string s,int n) {
	llint sum = 0;
	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			ll ans=0;
			string t;
			for (int j = 0; j < n; j++) {
				t+=s[j];
				if (now[j]-'0' == 1)ans+=stoll(t),t="0";
			}
			t += s[n];
			ans += stoll(t);
			sum += ans;
			ans = 0;
		}
		else {
			for (int i = 1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
	return sum;
}



int  main() {
	string s;
	cin >> s;
	int a = s.size() - 1;
	llint ans=dfs(s, a);
	cout<<ans<<endl;
	return 0;
}

  


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

int main() {
    int N, K, C;
    cin >> N >> K >> C;
    string S;
    cin >> S;
    int sus = 0;
    vector<int> front, behind;
    REP(i, 0, N){
        if(S[i] == 'o' && i >= sus){
            front.emplace_back(i);
            sus = i + C + 1;
            //cout << i << endl;
        }
        if(front.size() >= K) break;
    }
    sus = N-1;
    for(int i = N-1; i >= 0; i--){
        if(S[i] == 'o' && i <= sus){
            behind.emplace_back(i);
            sus = i - C - 1;
            //cout << i << endl;
        }
        if(behind.size() >= K) break;
    }
    reverse(behind.begin(), behind.end());
    vector<int> ans;
    REP(i, 0, K){
        if(front[i] == behind[i]) ans.emplace_back(front[i] + 1);
    }    
    for(int x: ans) cout << x << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 4216
import math
while True:
    s=input().split()
    if s[1]=="?":
        break
    elif s[1]=="+":
        print(int(s[0])+int(s[2]))
    elif s[1]=="-":
        print(int(s[0])-int(s[2]))
    elif s[1]=="*":
        print(int(s[0])*int(s[2]))
    elif s[1]=="/":
        print(math.floor(int(s[0])/int(s[2])))


Measured memory_bytes: 5660
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
typedef long long int ll;
const int N=1e5+5,M=105;
int n,mx,w[M],v[M];
ll memo[M][N];
ll solve(int ind, int wght){
    if(ind==n)
        return 0;
    if(~memo[ind][wght])
        return memo[ind][wght];
    ll op1=0,op2;
    if(wght+w[ind]<=mx)
    op1=v[ind]+solve(ind+1,wght+w[ind]);
    op2=solve(ind+1,wght);
    return memo[ind][wght]=max(op1,op2);
}
int main(){
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    memset(memo,-1,sizeof memo);
    cin>>n>>mx;
    for(int i=0;i<n;i++)
        cin>>w[i]>>v[i];
    cout<<solve(0,0)<<'\n';
    return 0;
}


Measured memory_bytes: 82304
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c) { return b / c - (a - 1) / c; }

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}

int main() {
    long long n, m;
    cin >> n;
    m = n / 3;
    double a = double(n) / 3 - m;
    cout << m * m * m + 3 * m * m * a + 3 * a * a * m + a * a * a << endl;
}

Measured memory_bytes: 256
/* Author: $%U%$
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/
#include <bits/stdc++.h>
using namespace std;
#define fore(i, a, b) for (int i = a, to = b; i < to; i++)
#define all(v) v.begin(), v.end()
#define SZ(v) (int)v.size()
typedef long long Long;
typedef pair<int, int> Pair;
bool pal(string s) {
  string w = s;
  reverse(all(w));
  fore(i, 0, SZ(s)) if (s[i] != w[i]) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  string s;
  cin >> s;
  int n = SZ(s);
  int mid = n / 2;
  string pa = s.substr(0, mid);
  string pb = s.substr(mid + 1, mid);
  if (pal(s) && pal(pa) && pal(pb))
    cout << "Yes\n";
  else
    cout << "No\n";

  return 0;
}

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

using namespace std;

struct Edge {
    int u;
    int v;
    long long c;
    Edge() {}
    Edge(int u, int v, long long c): u(u), v(v), c(c) {}
};

struct PqEle {
    int u;
    int num;
    long long content;
    PqEle() {}
    PqEle(int u, int num, long long content): u(u), num(num), content(content) {}
    bool operator <(const PqEle& o) const {
        return make_pair(num, content) > make_pair(o.num, o.content);
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    auto t0 = clock();
    int n, m;
    long long l;
    cin >> n >> m >> l;
    vector<vector<Edge>> adj_list(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        long long c;
        cin >> a >> b >> c;
        --a;
        --b;
        if (c <= l) {
            adj_list[a].push_back(Edge(a, b, c));
            adj_list[b].push_back(Edge(b, a, c));
        }
    }
    int q;
    cin >> q;
    vector<pair<int, int>> queries(q);
    for (int i = 0; i < q; ++i) {
        cin >> queries[i].first >> queries[i].second;
        --queries[i].first;
        --queries[i].second;
    }
    auto dijkstra = [&](int start_id) {
        priority_queue<PqEle> pq;
        pq.push(PqEle(start_id, 0, 0LL));
        vector<bool> visited(n, false);
        vector<int> dist(n, -1);
        while (!pq.empty()) {
            auto p = pq.top();
            int node_id = p.u;
            pq.pop();
            if (visited[node_id]) {
                continue;
            }
            dist[node_id] = p.num;
            visited[node_id] = true;
            for (auto& edge : adj_list[node_id]) {
                if (!visited[edge.v]) {
                    if (edge.c + p.content > l) {
                        pq.push(PqEle(edge.v, p.num + 1, edge.c));
                    } else {
                        pq.push(PqEle(edge.v, p.num, edge.c + p.content));
                    }
                }
            }
        }
        return dist;
    };
    vector<vector<int>> dists(n);
    for (int i = 0; i < n; ++i) {
        dists[i] = dijkstra(i);
    }
    for (auto q : queries) {
        cout << dists[q.first][q.second] << "\n";
    }
    cerr << "time used = " << (clock() - t0) << endl;
    return 0;
}

Measured memory_bytes: 7400
#include <iostream>

using namespace std;

const int INF = 1 << 30;

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

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

    int ans = INF;

    for (int y = -100; y <= 100; ++y) {
        int cost = 0;
        // 全要素をyに変える場合のコスト

        for (int i = 0; i < N; ++i) {
            cost += (a[i] - y) * (a[i] - y);
        }

        ans = min(ans, cost);
    }

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


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        a: isize,
        b: isize,
        c: isize,
        k: isize,
    }
    let mut r = 0;
    r += a.min(k);
    if k - a - b > 0 {
        r -= k - a - b;
    }
    println!("{}", r);
}


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

int main()
{
	int N;


	cin>>N;
	int a =1;
        if(N<2)
		a =1;
	else if(N>=2&&N<4)
		a = 2;
	else if(N>=4&&N<8)
		a = 4;
	else if(N>=8&&N<16)
		a = 8;
	else if(N>=16&&N<32)
		a = 16;
	else if(N>=32&&N<64)
		a = 32;
	else
		a = 64;
	cout<<a;
	return 0;
}

Measured memory_bytes: 256
n = int(input())

counts = [0] * 5
for i in range(n):
    name = input()
    
    if name[0] == 'M':
        counts[0] += 1
    elif name[0] == 'A':
        counts[1] += 1
    elif name[0] == 'R':
        counts[2] += 1
    elif name[0] == 'C':
        counts[3] += 1
    elif name[0] == 'H':
        counts[4] += 1
 
ans = 0       
for i in range(5):
    for j in range(5):
        for k in range(5):
            if i == j or j == k or k == i:
                continue
            
            #print(i, j, k, ':', counts[i], counts[j], counts[k])
            ans += counts[i] * counts[j] * counts[k]

print(ans // 6)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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; }
int const INF = 1001001001;


// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0) val += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator - () const noexcept {
return val ? MOD - val : 0;
}
constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
constexpr Fp& operator += (const Fp& r) noexcept {
val += r.val;
if (val >= MOD) val -= MOD;
return *this;
}
constexpr Fp& operator -= (const Fp& r) noexcept {
val -= r.val;
if (val < 0) val += MOD;
return *this;
}
constexpr Fp& operator *= (const Fp& r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp& operator /= (const Fp& r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
val = val * u % MOD;
if (val < 0) val += MOD;
return *this;
}
constexpr bool operator == (const Fp& r) const noexcept {
return this->val == r.val;
}
constexpr bool operator != (const Fp& r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
return os << x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0) return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1) t = t * a;
return t;
}
};

const int MOD = 1000000007;
using mint = Fp<MOD>;

int H,W;
char fi[1010][1010];
mint dp[1010][1010] = {0};

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

int H,W;
cin >> H >> W;
rep(h,H) rep(w,W) cin >> fi[h][w];

dp[0][0] = 1;

for(int h = 0; h < H; ++h) {
    for(int w = 0; w < W; ++w) {
        if(h+1 < H && fi[h+1][w] == '.') dp[h+1][w] += dp[h][w];
        if(w+1 < W && fi[h][w+1] == '.')  dp[h][w+1] += dp[h][w];
    }
}
cout << dp[H-1][W-1] << endl;
return 0;
}

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

int main() {
    long long s; cin >> s;
    long long u = sqrt(s);
    for (long long d = u; d <= 1e9; d++) {
        long long remain = d * d - s;
        if (remain < 0) continue;
        if (remain == 0) {
            cout << "0 0 " << d << " 0 0 " << d << endl;
            return 0;
        }
        for (long long i = 1; i * i <= remain; i++) {
            if (remain % i == 0 && remain / i <= ((long long) 1e9)) {
                cout << "0 0 " << d << " " << i << " " << remain / i << " " << d << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N;cin>>N;
    string ans;
    int sig=-1;
    while(N){
        if(abs(N)&1){
            ans.push_back('1');
            N+=sig;
        }
        else ans.push_back('0');
        N/=2;
        sig*=-1;
    }
    if(ans.empty()){
        cout<<0<<endl;
        return 0;
    }
    reverse(All(ans));
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int A, B, C, D, N, M;
	string S, T;
	cin >> N >> M;

	if (N < 10) {
		cout << M + 100 * (10 - N) << endl;
	
	}
	else {
		cout << M << endl;
	}


	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAX = 10005;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;

int main()
{
    LL k;
    cin >> k;
    puts("50");
    for(int i = 0; i < 50; ++i)
        cout << 49-i+((49-i+k)/50) << " ";
    puts("");
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define RFOR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)

using namespace std;

typedef complex<double> point;
typedef pair<int, int> paii;
typedef long long ll;

double cross(point va, point vb){
	return real(va) * imag(vb) - imag(va) * real(vb);
}

int is_parallel(point a1, point a2, point b1, point b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}

int main()
{
	int n;
	cin >> n;
	
	FOR(i, 0, n)
	{
		double x, y;
		point pt[4];
		
		FOR(j, 0, 4)
		{
			cin >> x >> y;
			pt[j] = point(x, y);
		}
		
		if( is_parallel(pt[0], pt[1], pt[2], pt[3]) )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1224
#include <stdio.h>
#include <ctype.h>

int main() {
  int i, str_a_length, str_b_length;
  scanf("%d %d", &str_a_length, &str_b_length);
  char str[str_a_length+str_b_length+2];
  scanf("%s", str);
  for(i = 0; i < str_a_length + str_b_length + 1; i++) {
    if(i < str_a_length || str_a_length < i) {
      if(!isdigit(str[i])) {
        i--;
        break;
      }
    } else {
      if(str[i] != '-') break;
    }
  }
  if(i == str_a_length + str_b_length + 1) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>

int main() {

    char n[3];

    scanf("%s", n);

    int l = strlen(n);
    char c = n[l - 1];


    if (c == '3') {
        puts("bon");
    } else if (c == '0' || c == '1' || c == '6' || c == '8') {
        puts("pon");
    } else {
        puts("hon");
    }




    return 0;

}


Measured memory_bytes: 1620
using System;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int a = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            Console.WriteLine(a >= 3200 ? s : "red");
        }
    }
}

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

using namespace std;
using ll = long long int;
using ull = unsigned long long int;
#define vll vector<ll>

#define FOR(i, b, e) for(int i = (b); i < (e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define REV(v) reverse((v).begin(), (v).end())
#define IN(v) cin >> (v);
#define VIN(v, n) REP(i, n) cin >> v[i];
#define OUT(v) cout << (v) << endl;
#define YN(b) OUT((b) ? "YES" : "NO")
#define Yn(b) OUT((b) ? "Yes" : "No")
#define yn(b) OUT((b) ? "yes" : "no")

const ll MOD = 1000000007;

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

  ll n;
  cin >> n;
  string s;

  while (n != 0) {
    s += 'a' + (n - 1) % 26;
    n = (n - 1) / 26;
  }

  REV(s);
  cout << s << endl;

  return 0;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    int n, k;
    cin >> n >> k >> s;
    --k;
    cout << s.substr(0, k);
    cout << (char) (s[k] - 'A'+'a');
    cout << s.substr(k+1) << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var stdInScanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	stdInScanner.Scan()
	return stdInScanner.Text()
}

func main() {
	stdInScanner.Split(bufio.ScanWords)

	S := nextString()

	max := 0
	now := 0
	for _, c := range strings.Split(S, "") {
		if c == "R" {
			now++
			if max < now {
				max = now
			}
		} else {
			now = 0
		}
	}
	fmt.Println(max)
}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    ll n,k; cin>>n>>k;
    ll ans=0, c;
    if(k%2==0){
        ll l=k/2;
        if(l<=n){
            c=(n-l)/k+1;
            ans+=c*c*c;
        }
    }
    c=n/k;
    ans+=c*c*c;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
S = input()
for i in range(0, len(S), +2):
    if S[i] == "L":
        print("No")
        sys.exit()    
if len(S) == 1:
    print("Yes")
    sys.exit()
for i in range(1, len(S), +2):
    if S[i] == "R":
        print("No")
        sys.exit()
print("Yes")


Measured memory_bytes: 8904
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = [0]*n
for i in range(n):
    a[i] = list(map(int,input().split()))
count = 0
for i in range(n):
    x = 0
    for j in range(m):
        x += a[i][j]*b[j]
    if x + c > 0:
        count += 1
print(count)

Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
    int a,b,c,d;
    scanf("%d%d%d",&a,&b,&c);
    if(a>b){
        d=a;
        a=b;
        b=d;
    }
    if(a>c){
        d=a;
        a=c;
        c=d;
    }
    if(b>c){
        d=b;
        b=c;
        c=d;
    }


    printf("%d %d %d\n",a,b,c);
    return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

int n, k, r, s, p;

int main(){

    int n, k;

    cin >> n  >> k;

    int i = 1;

    while(1){
        
        if(pow(k, i) > n) break;

        i++;
    }

    cout << i;

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mset(a,b) memset(a,b,sizeof a)
#define mcpy(a,b) memcpy(a,b,sizeof b)
#define lb(x) ((x)&(-(x)))
#define dalao 1000000007
#define inf 0x3f3f3f3f
#define N 300010
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;};
int main(){
	int n;cin>>n;
	ll ans=1;
	while(n--){
		ll t;cin>>t;
		ans=lcm(ans,t);
	}
	cout<<ans;
	return 0;
}

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

const ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

string n;
int k, len;

ll notgiri(int p, int K) {
    ll re = 1;
    rep(i, K) re *= (len - p - i) * 9;
    rep(i, K) re /= i + 1;
    return re;
}

ll giri(int p, int K) {
    if(K <= 0) return 1;
    if(p >= len) return 0;
    if(n[p] == '0') return giri(p + 1, K);
    return giri(p + 1, K - 1) + notgiri(p + 1, K - 1) * (n[p] - '1') +
           notgiri(p + 1, K);
}

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

    cin >> n >> k;
    len = n.size();
    cout << giri(0, k) << endl;
}

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

int main(){
  vector<int> v,s(10001);
  int a,b,n,o=0;
  while(cin>>b){
    fill(s.begin(),s.end(),0);
    o =0;
    if(b==0) break;
    else{
    for(int i=0;i<b;i++){
      cin>>a;
      v.push_back(a);
    }
    for(int i = 0; i < b; i++){
      int sum = 0;
      for(int j = i; j < b; j++){
	sum += v[j];
	s.push_back(sum);
      }
    } 


  int d = *max_element(s.begin(),s.end());
  cout<<d<<endl;
    }
    s.clear(),v.clear();
  }
}

Measured memory_bytes: 20000
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        Arrays.sort(s);
        if (s[0].equals("a") && s[1].equals("b") && s[2].equals("c")) {
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }

}


Measured memory_bytes: 21844
N = int(input())
taro_cnt, hana_cnt = 0, 0
for _i in range(N):
    taro, hana = map(str, input().split())
    if taro > hana:
        taro_cnt += 3
    elif taro == hana:
        taro_cnt += 1
        hana_cnt += 1
    else:
        hana_cnt += 3
print(f'{taro_cnt} {hana_cnt}')


Measured memory_bytes: 5616
ABC = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 
       'h', 'i', 'j', 'k', 'l', 'm', 'n', 
       'o', 'p', 'q', 'r', 's', 't', 'u', 
       'v', 'w', 'x', 'y', 'z']
L = [0 for i in range(26)]
S = input()
for s in S:
  L[ABC.index(s)]+=1
f = True
for i in range(26):
  if L[i] == 0:
    f = False
    print(ABC[i])
    break
if f:
  print("None")

Measured memory_bytes: 3188
# include <algorithm>
# include <cassert>
# include <cctype>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <set>
# include <sstream>
# include <stack>
# include <string>
# include <vector>
# include <iomanip>

# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)

using namespace std;
typedef long long ll;


int main() {

  int N;
  cin >> N;

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

  double mean = 0.0;
  rep (i, N) mean += A[i];
  mean /= A.size();
  mean = roundf(mean);

  ll ans = 0;

  rep (i, N) {
    ans += pow(A[i] - mean, 2);
  }

  cout << ans << endl;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(){
  int n,d[100010],c=0,i;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&d[i+1]);
  for(i=1;i<=n;i++){
    if(d[d[i]]==i)c++;
  }
  printf("%d\n",c/2);
  return 0;
}


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

int main () {
    
    int n;
    cin >> n;
    for (int t = 0; t < n; t++) {
        string c;
        cin >> c;
        if (c == "Y") {
            cout << "Four" << endl;
            break;
        } else if (c != "Y" && t+1 != n) {
            continue;
        } else if (c != "Y" && t+1 == n) {
            cout << "Three" << endl;
        }
    }
}


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

int main(){
int A,B;
char S[100],T[100],U[100];

scanf("%s %s", &S,&T);
scanf("%d %d", &A, &B);
scanf("%s", &U);
if (strcmp(S,U)==0){
printf("%d %d",A-1,B);
}
else if (strcmp(T,U)==0){
printf("%d %d",A,B-1);
}
else {
printf("%d %d",A,B);
}

return 0;
}

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

typedef long long ll;
const int N = 2e5 + 7;
const ll mod = 1e9 + 7;

int n, fa[N], m, vis[N], rk[N];

int find(int x) {
    if (x != fa[x]) {
        return fa[x] = find(fa[x]);
    }
    return fa[x];
}

int main() {
    ios::sync_with_stdio(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        fa[i] = i;
        rk[i] = 1;
    }
    while (m--) {
        int u, v;
        cin >> u >> v;
        int fx = find(u);
        int fy = find(v);
        if (fx != fy) {
            fa[fx] = fy;
            rk[fy] += rk[fx];
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int fy = find(i);
        if (vis[fy] == 0) {
            ans = max(ans, rk[fy]);
            vis[fy] = 1;
        }
    }
    cout << ans << endl;

   
}

Measured memory_bytes: 11352
#include <iostream>
using namespace std;
const int MAX=500000;
const int SENTINEL=2000000000;

int L[MAX/2+2];
int R[MAX/2+2];
int cnt;

void merge(int A[],int n,int left,int mid,int right) {
  int n1=mid-left;
  int n2=right-mid;
  for (int i=0; i<n1; i++) {
    L[i]=A[left+i];
  }
  for (int i=0; i<n2; i++) {
    R[i]=A[mid+i];
  }
  L[n1]=R[n2]=SENTINEL;
  int i=0, j=0;
  for (int k=left; k<right; k++) {
    cnt++;
    if (L[i]<=R[j]) {
      A[k]=L[i++];
    } else {
      A[k]=R[j++];
    }
  }
}
void mergeSort(int A[],int n,int left,int right) {
  int mid;
  if (left+1<right) {
    mid=(left+right)/2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid,right);
    merge(A,n,left,mid,right);
  }
}
int main() {
  int A[MAX];
  cnt=0;
  int n;
  cin>>n;
  for (int i=0; i<n; i++) {
    cin>>A[i];
  }
  mergeSort(A,n,0,n);
  for (int i=0; i<n; i++) {
    cout<<(i==0?"":" ")<<A[i]<<flush;
  }
  cout<<endl;
  cout<<cnt<<endl;
  return 0;
}



Measured memory_bytes: 6968
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;


int32_t N;
int32_t a[200000];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N;
	for (int32_t i = 0; i < N; i++)
	{
		in >> a[i];
	}
	std::sort(a, a + N);
	auto v = a[N - 1];
	out << a[N - 1] << ' ';
	--N;
	int32_t tmp = 0;
	int32_t diff = -2000000000;
	for (size_t i = 0; i < N; i++)
	{
		auto D = std::min(std::abs(v - a[i]), a[i]);
		if (D > diff) {
			diff = D;
			tmp = i;
		}
	}

	out << a[tmp] << endl;

	return 0;
}
#endif


Measured memory_bytes: 640
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;


ll comb(ll N_, ll C_) {
	const int NUM_ = 3000001;
	static ll fact[3000002], factr[3000002], inv[3000002];
	if (fact[0] == 0) {
		inv[1] = fact[0] = factr[0] = 1;
		for (int i = 2; i <= NUM_; ++i) inv[i] = inv[mod % i] * (mod - mod / i) % mod;
		for (int i = 1; i <= NUM_; ++i) fact[i] = fact[i - 1] * i%mod, factr[i] = factr[i - 1] * inv[i] % mod;
	}
	if (C_<0 || C_>N_) return 0;
	return factr[C_] * fact[N_] % mod*factr[N_ - C_] % mod;
}
ll modpow(ll a, ll n = mod - 2) {
	ll r = 1;
	while (n) r = r * ((n % 2) ? a : 1) % mod, a = a * a%mod, n >>= 1;
	return r;
}

long long modinv(long long a) {
	return modpow(a, mod - 2);
}

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

	int K; cin >> K;
	string S; cin >> S;
	int N = K + S.size();
	int ans = 0;
	FOR(i, 0, S.size()) {
	
		int cnt = modpow(25, N - i);

		cnt *= comb(N, i);
		cnt %= mod;
		ans += cnt;
		ans %= mod;
		
		
	}

	
	cout << (modpow(26, N) - ans + mod) % mod << endl;
	return 0;
}



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

int main(){
    int N,M;cin >> N>>M;
    vector<char> C(N,' ');
    for(int i=0;i<M;i++){
        int s;char c;
        cin >> s >> c;
        s--;
        if((C[s]==' ')||(C[s]==c)){
            C[s]=c;
        }else{
            cout << -1<<endl;
            return 0;
        }
    }
    if((C[0]=='0')&&(N!=1)){
        cout << -1<<endl;
        return 0;
    }
    vector<char> ans(N,' ');
    for(int i=0;i<N;i++){
        if(C[i]!=' '){
            ans[i]=C[i];
        }else if((i==0)&&(N!=1)){
            ans[i]='1';
        }else{
            ans[i]='0';
        }
        cout << ans[i];
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define print(n) cout << n << endl
#define YN(c) (c)?(print("YES")):(print("NO"))
#define Yn(c) (c)?(print("Yes")):(print("No"))
#define yn(c) (c)?(print("yes")):(print("no"))
#define in(v) int v; cin >> v
#define vint vector<int>
#define pb push_back
typedef long long int ll;

int main(){
  in(n);in(m);
  int sum=0;
  rep(i,m){
  	int tmp;
  	cin>>tmp;
  	sum+=tmp;
  }
  if(n<sum){
  	print(-1);
  }else{
  	print(n-sum);
  }
  return 0;
}

Measured memory_bytes: 3636
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(N):
    temp = C
    for j in range(M):
        temp += A[i][j]*B[j]
    if temp > 0:
        ans += 1
print(ans)


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main(void)
{
    
    
    int array[3];
    int num = 0;
    
    for (int i = 0; i < 3; i++) {
        
        cin >> array[i];
        
    }
    
    for (int i = 0, j = 100; i < 3; i++, j /= 10) {
        
        num += array[i] * j;
        
    }
    
    if (num % 4 == 0) {
        
        cout << "YES" << endl;
        
    }
    else {
        
        cout << "NO" << endl;
        
    }
    
    
    
    
    return 0;
    
}

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


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

int main(){
  int K ;
  cin >> K ;
  int sum =0;
  int s =0;
  for(int i=1;i<=K;i++){
    for(int j=1;j<=K;j++){
      for(int k=1;k<=K;k++){
        s = gcd(i,j);
        sum += gcd(s,k);
      }
    }
  }
  
  cout << sum << endl;
}



Measured memory_bytes: 3604