akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

ll Q, A, B;

// [B,A)と(B,A)でAB未満のペアをk個作ることができるか
bool check(ll k) {
    // 最適にペアを作ったとき、k/2番目が最大になる
    ll idx = k / 2;
    if ((B + idx) * (B + k - idx) < A * B) {
        return true;
    } else {
        return false;
    }
}

int main() {
    cin >> Q;
    for (int q = 0; q < Q; q++) {
        cin >> A >> B;
        if (A < B) swap(A, B);

        ll l = 0, r = A - B;
        while (r - l > 1) {
            ll mid = (l + r) / 2;
            if (check(mid)) {
                l = mid;
            } else {
                r = mid;
            }
        }

        cout << 2 * (B - 1) + l << "\n";
    }

    return 0;
}

Measured memory_bytes: 504
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String s[]=line.split("",0);
        int num=s.length;
        boolean b=false;
        if(num==2){
            if(s[0].equals(s[1])){
                System.out.println("1 2");
                b=true;
            }
        }
        else {
            for(int i=0;i<num-2;i++){
                int k=0;
                if(s[i].equals(s[i+1]))
                    k++;
                if(s[i].equals(s[i+2]))
                    k++;
                if(s[i+1].equals(s[i+2]))
                    k++;
                    if(k>0){
                        System.out.println(i+1+" "+(i+3));
                        b=true;
                        break;
                    }
            }
            
        }if(!b)System.out.println("-1 -1");
        
        
    }
}

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

int main(){
  long long N;
  cin >> N;
  vector<char> C(N);
  for (long long i = 0; i < N; i++){
    cin >> C.at(i);
  }
  long long W = 0;
  long long R = 0;
  
  for (long long i = 0; i < N; i++){
    if (C.at(i) == 'R'){
      R++;
    }
  }
  
  long long ans = R;//仕切りが一番左
  for (long long i = 1; i <= N; i++){//仕切りが左からi番目
    if (C.at(i - 1) == 'W'){
      W++;
      ans = min(ans, max(W,R));
    } else {
      R--;
      ans = min(ans, max(W,R));
    }
  }
  cout << ans;
} 


Measured memory_bytes: 3632
a,b,c,k = gets.chomp.split(' ').map(&:to_i)
ans = 0
if k >= a
  ans += a
  k -= a
else
  ans += k
  k = 0
end

if k >= b
  k -= b
else
  k = 0
end

if k >= c
  ans -= c
else
  ans -= k
  k = 0
end

puts ans

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

    //long long
    using ll = long long;

    // pair<int, int>
    using PII = pair<int, int>;

    //最大値、mod
    const int MOD = 1000000007;
    const int INF = 1000000000;
    const long long LINF = 1e18;

    //出力系
    #define print(x) cout << x << endl
    #define prints(x) cout << fixed << setprecision(10) << x << endl
    #define printc(x) cout << setw(2) << setfill('0') << x << endl;
    #define yes cout << "Yes" << endl
    #define YES cout << "YES" << endl
    #define no cout << "No" << endl
    #define NO cout << "NO" << endl
    
    // begin() end()
    #define all(x) (x).begin(),(x).end()

    //for
    #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

    //最大公約数 
    unsigned gcd(unsigned a, unsigned b) {
      if(a < b) return gcd(b, a);
      unsigned r;
      while ((r=a%b)) {
        a = b;
        b = r;
      }
      return b;
    }

    // 最小公倍数
    unsigned lcm(unsigned a, unsigned b){
        return a / gcd(a, b) * b; 
    }

    // a = max(a, b), a = min(a, b)
    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 dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};









int main(){
 string S;
 cin >> S;
 ll Q;
 cin >> Q;
 int cnt = 1;
 deque<string> dq;
 dq.push_back(S);
 REP(i, Q){
   int x;
   cin >> x;
   if(x == 1) cnt *= -1;
   else if(x == 2){
     int f;
     cin >> f;
     string c;
     cin >> c;
    if(f == 1) if(cnt == 1) dq.push_front(c); else dq.push_back(c);
    if(f == 2) if(cnt == 1) dq.push_back(c); else dq.push_front(c);
   }
 }

// while(!dq.empty()){
//   if(cnt == 1) {
//     cout << dq.front();
//     dq.pop_front();
//   }
//   else {
//     cout << dq.back();
//     dq.pop_back();
//   }
// }

string ans;
  while(!dq.empty()){
    ans += dq.front();
    dq.pop_front();
  }
  if(cnt == -1) reverse(all(ans));
  print(ans);
  return 0;
// cout << endl;

}

Measured memory_bytes: 12132
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

using namespace std;

int main(void)
{
	//変数の宣言
	int n;
	int a;
	int num[100];

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;



	//データの読み込み


	scanf("%d",&n);
//	scanf_s("%d",&n);

	for(i=0;i<100;i++){
		num[i]=0;
	}

	for(i=0;i<n;i++){
		scanf("%d",&a);
//		scanf_s("%d",&a);
		num[a]++;
		min=min(min,a);
		max=max(max,a);
	}


	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

	if((max+1)/2!=min){
		printf("Impossible");
		return 0;
	}

	if(max%2==0){
		if(num[min]!=1){
			printf("Impossible");
			return 0;
		}
	}else{
		if(num[min]!=2){
			printf("Impossible");
			return 0;
		}
	}

	for(i=min+1;i<=max;i++){
		if(num[i]<2){
			printf("Impossible");
			return 0;
		}
	}

	//	printf("計算部分終了\n");

	//出力

	printf("Possible");

	//	printf("結果の出力終了\n");


	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[333][333];int n;
int main(){
	scanf("%d",&n);
	for(int i=0; i<n; i++)
		scanf("%s",s[i]);
	int res = 0;
	for(int k=0; k<n; k++){
		bool flag = true;
		for(int i=0; i<n && flag; i++)
		for(int j=0; j<n && flag; j++){
			if(s[i][(j+k)%n] != s[j][(i+k)%n]){
				flag = false;
				break;
			}
		}
		if(flag)res += n;
	}
	printf("%d\n",res);
	return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i = 0; i < n; i++) cin >> s[i];
  int AC = 0, WA = 0, TLE = 0, RE = 0;
  for(int i = 0; i < n; i++){
    if(s[i] == "AC") AC++;
    if(s[i] == "WA") WA++;
    if(s[i] == "TLE") TLE++;
    if(s[i] == "RE") RE++;
  }
  cout << "AC x " << AC << endl;
  cout << "WA x " << WA << endl;
  cout << "TLE x " << TLE << endl;
  cout << "RE x " << RE << endl;
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++)
    cin >> a.at(i);
  sort(a.begin(),a.end());
  
  int k=0;
  
  for(int i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      
      for(int l=j+1;l<n;l++){
        if(a.at(l)<a.at(i)+a.at(j)){
          k++;
        }
      }
      
    }
  }
  
  cout << k << endl;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <cmath>
# include <tuple>
# include <vector>
# include <queue>
# include <string>

typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k, q; cin >> n >> k >> q;
    vector<ll> points(n, k);
    int border = 0;
    for (int i = 0; i < q; i++) {
        int a; cin >> a;
        a--;
        points[a]++;
        border++;
    }
    for (int i = 0; i < n; i++) {
        if (points[i] <= border) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    return 0;
}


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

const int INF = 1e9;

int main() {
  int h, w, n;
  cin>>h>>w>>n;
  int sr,sc;
  cin>>sr>>sc;
  --sr;
  --sc;
  string s, t;
  cin>>s>>t;
  int l = 0,
      r = w - 1,
      u = 0,
      d = h - 1;

  if (s[n-1] == 'L') {
    l = 1;
  } else if (s[n-1] == 'R') {
    r = w - 2;
  } else if (s[n-1] == 'U') {
    u = 1;
  } else {
    d = h - 2;
  }
  for (int i=n-2; i>=0; i--) {
    if (t[i] == 'L') {
      r = min(r + 1, w - 1);
    } else if (t[i] == 'R') {
      l = max(l - 1, 0);
    } else if (t[i] == 'U') {
      d = min(d + 1, h - 1);
    } else {
      u = max(u - 1, 0);
    }
    if (s[i] == 'L') {
      l = l + 1;
    } else if (s[i] == 'R') {
      r = r - 1;
    } else if (s[i] == 'U') {
      u = u + 1;
    } else {
      d = d - 1;
    }
    if (l > r || u > d) {
      cout<<"NO"<<endl;
      return 0;
    }
  }
  if (sc >= l && sc <= r && sr >= u && sr <= d) {
    cout<<"YES"<<endl;
  } else {
    cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 776
N = int(input())
A = list(map(int, input().split()))
alice = []
bob = []

for i in range(len(A)):
  max_n = max(A)
  A.remove(max_n)
  if i%2 == 0:
    alice.append(max_n)
  else:
    bob.append(max_n)
print(sum(alice) - sum(bob))

Measured memory_bytes: 3060
N = int(input())
a_list = list(map(int,input().split()))
b_list = list(map(int,input().split()))
cnt = 0
for i in range(N):
    if b_list[i] <= a_list[i]:
        cnt += b_list[i]
    else:
        cnt += min(b_list[i],a_list[i]+a_list[i+1])
        a_list[i+1] = max(0,a_list[i+1]-b_list[i]+a_list[i])
#    print(cnt)
#    print(a_list)
print(cnt)

Measured memory_bytes: 18624
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n,W;
    cin>>n>>W;
    ll w[n],v[n];
    for(ll i=0;i<n;i++) cin>>w[i]>>v[i];
    ll dp[n+1][W+1];
    for(int i=0;i<=n;i++) dp[i][0]=0;
    for(int j=0;j<=W;j++) dp[0][j]=0;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=W;j++){
            if(w[i-1]<=j) dp[i][j]=max(v[i-1]+dp[i-1][j-w[i-1]],dp[i-1][j]);
            else dp[i][j]=dp[i-1][j];
        }
    }
    cout<<dp[n][W];

}

Measured memory_bytes: 79104
N, M = map(int, raw_input().split())
A = map(int, raw_input().split())

AX = []
s = 0
for a in A:
    s += a
    AX.append(s)

B = {}
B[0] = 1
for i in range(N):
    e = AX[i] % M
    if e not in B:
        B[e] = 1
    else:
        B[e] += 1

res = 0
for _,v in B.items():
    res += v * (v-1) / 2

print(res)




Measured memory_bytes: 21124
n = int(input())
a = list(map(int, input().split()))
rank = [0] * 9
for i in a:
    if i < 3200:
        rank[i // 400] += 1
    else:
        rank[8] += 1

s = 0
for i in range(8):
    if rank[i] > 0:
        s += 1
if s > 0:
    s1 = s
else:
    s1 = 1
s2 = s + rank[8]
print(s1, s2)


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

using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int l, r;
		cin >> l >> r;
		ans += r - l + 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int n, num[100] = {0}, c = 0;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> num[i];
  }
  for(int i = 0; i < n - 1; i++){
    for(int j = i + 1; j < n; j++){
      c += num[i] * num[j];
    }
  }
  cout << c << endl;
  return 0;
}

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

using namespace std;

void trace(int a[], int n) {
    for (int i = 0; i < n; i++) {
        if (i != 0) cout << " " << a[i];
        else cout << a[i];
    }
    cout << endl;
}

void insertionSort(int a[], int n) {
    for (int i = 1; i < n; i++) {
        int v = a[i];
        int j = i - 1;
        while (j >= 0 && a[j] > v) {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = v;
        trace(a, n);
    }
}

int main() {
    int n;
    cin >> n;
    int a[n];
    
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    trace(a, n);
    insertionSort(a, n);

    return 0;
}


Measured memory_bytes: 3120
#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 enld endl //* missspell check
const ll INF = 1LL << 60;


void solve(long long A, long long B, long long C, long long D, long long E, long long F){
    ll xA, xB, xC, xD ; 
    double ans=0.;
    ll ans_sw=A*100, ans_s=0;
    for(xB = 0; xB <= (F/100 /B); xB++){
        if((xB *B)*100 > F) break;
        for(xA=0; xA <= (F/100 /A); xA++){
            if(xA == 0 && xB == 0) continue;
            ll w = (xA *A + xB *B)*100;
            if((xA *A + xB *B)*100 > F) break;
            for(xD=0; xD <= F/D; xD++){
                if((xA *A + xB *B)*100 + xD*D >F) break;
                if((xD*D) > E*(xA*A + xB*B)) break;
                for(xC=0; xC <= F/C; xC++){
                    ll s = xC *C + xD *D, sw = w  + s;
                    if(sw >F) break;
                    if((s) > E*(xA*A + xB*B)) break;

                    double tmp=0.;
                    
                    tmp = (double) (s) / (double)(sw);
                    if(tmp > ans){
                        ans_sw = sw; ans_s = s;
                        ans = tmp;
                    }
                }
                
            }
        }
    }
    cout<< ans_sw <<" "<<ans_s<<endl;
}

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


Measured memory_bytes: 256
def counting_sort(a, k)
  n = a.length
  b = Array.new(n)
  c = Array.new(k+1,0)

  n.times do |i|
    c[a[i]]+=1
  end

  1.upto(k) do |i|
    c[i]+=c[i-1]
  end

  (n-1).downto(0) do |i|
    b[c[a[i]]]=a[i]
    c[a[i]]-=1
  end
  return b.compact
end

n = STDIN.gets
a = STDIN.gets.split(' ').map{ |i| i.to_i }

print "#{counting_sort(a, a.max).join(' ')}\n"

Measured memory_bytes: 173552
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll A,B;
  cin>>A>>B;
  if(A%3==0||B%3==0||(A+B)%3==0) {
cout<<"Possible"<<endl;
  }
  else {
cout<<"Impossible"<<endl;
  }
}


Measured memory_bytes: 3612
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
 
long long f(int a,int b){
	return Comb(a+b+2,a+1)-1;
}
int main(){
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	init_C(2100000);
	long long ret=0;
	ret+=f(c,d);
	ret+=f(a-1,b-1);
	ret+=mod-f(c,b-1)%mod;
	ret+=mod-f(a-1,d)%mod;
	ret%=mod;
	printf("%lld\n",ret);
}

Measured memory_bytes: 55424
// 初手15分では思い浮かばなかった
// シンプルに全探索ベースで考えていく問題
// 愚直な実装をささっと見つけて、そこからいじっていくことを考えるのは必要

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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;

ll N;

int cnt_digits(ll N) {
    int digit = 0;

    while (N > 0) {
        N /= 10;
        digit++;
    }

    return digit;
}

int main(void) {

    cin >> N;

    int ans = cnt_digits(N);

    for (ll i = 1LL; i*i <= N; ++i ) { // A * B = B * Aであることを考えると、 A = B になるポイントより先は調べる必要がない
        if (N % i != 0) continue;
        ll n = N / i;

        int digit = max(cnt_digits(i), cnt_digits(n));

        if (ans > digit) {
            ans = digit;
        }
    }

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

Measured memory_bytes: 256
from collections import defaultdict
d = defaultdict(int) 

n = int(input()) 
A = list(map(int, input().split())) 
for i in range(n):
    d[A[i]] += 1
    d[A[i]+1] += 1
    d[A[i]-1] += 1
ans = 0
for j,k  in d.items():
    ans = max(k,ans) 
print(ans)

Measured memory_bytes: 23704
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

int main(void){
	ll N;
	cin>>N;
	string S[100000];
	ll ans[100000];
	rep(i,N)cin>>S[i];
	rep(i,N){
		set<string> A;
		A.insert(S[i]);
		ll n=S[i].size();
		reg(j,1,n-1){
			string a=S[i].substr(0,j), b=S[i].substr(j);
			string c=a, d=b;
			reverse(a.begin(),a.end());
			reverse(b.begin(),b.end());
			A.insert(a+b);
			A.insert(a+d);
			A.insert(c+b);
			A.insert(b+a);
			A.insert(d+a);
			A.insert(b+c);
			A.insert(d+c);
		}
		ans[i]=A.size();
	}
	rep(i,N)cout<<ans[i]<<endl;

	return 0;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define sci(x) int x; scanf("%d", &x);
#define TC(x) sci(x); while(x--)
typedef long long ll;
using namespace std;
int main()
{
    double l;
    cin>>l;
    l=l/3;
    double vol = l*l*l;
    cout<<fixed<<setprecision(12)<<vol<<endl;
    return 0;
}


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

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

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

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

int n, a[100], b[100], r, t;

signed main() {
	cin >> n;
	rep(i,n) cin >> a[i];
	rep(i,n) cin >> b[i];
	rep(c,n) {
		t = 0;
		rept(j,c) t += a[j];
		reps(j,c,n) t += b[j];
		chmax(r, t);
	}
	cout << r << ln;
}

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

string s;
int x, y;

int d[8000];
vector<int> vx;
vector<int> vy;
int sumx, sumy;
bool mycmp(const int& a, const int& b)
{
	return a>b;
}

int main() {
    ios::sync_with_stdio(false);
    cin >> s;
    cin >> x >> y;


    int countF, countT;
    countF = countT = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'F')
            countF++;
        else {//meet T
            if (countT % 2 == 0) {//even is x postion move
                vx.push_back(countF);
            }
            else
                vy.push_back(countF);
            countT++;
            countF = 0;
        }
    }

    if (countF > 0) {
        if (countT % 2 == 0)
            vx.push_back(countF);
        else
            vy.push_back(countF);
    }
    sort(vx.begin() + 1, vx.end(), mycmp);
	sort(vy.begin(), vy.end(), mycmp);
	sumx += vx[0];
	for (int i = 1; i<vx.size(); i++)
	{
		if (sumx <= x)
			sumx += vx[i];
		else
			sumx -= vx[i];
	}
	for (int i = 0; i<vy.size(); i++)
	{
		if (sumy <= y)
			sumy += vy[i];
		else
			sumy -= vy[i];
	}
	if (sumx == x&&sumy == y)
		printf("Yes");
	else
		printf("No");
	return 0;



    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    ll x,y;
    cin >> x >> y;

    ll count=0;
    while(x<=y){
        x*=2;
        count++;
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3652
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

string s;
int i;

void cat(){
    char c=s[i++];
    if(c!='m'){
        i--;
        return;
    }
    cat();
    c=s[i++];
    if(c!='e'){
        i--;
        return;
    }
    cat();
    c=s[i++];
    if(c!='w'){
        i--;
        return;
    }
    return;
}

void run(){
    cin>>s;
    s+="$";
    cat();
    cout<<(s[i]=='$'?"Cat":"Rabbit")<<endl;
}


Measured memory_bytes: 3220
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#define MAX 2000
int A[MAX], M[MAX];
int a,b,i,j,k,f=0;

int solve(int p, int t){
	if (t - A[p] == 0){
		return 1;
	}
	if (p+1>a){
		return 0;
	}
	if (solve(p + 1, t - A[p]) || solve(p + 1, t) ){
		return 1;
	}
	return 0;
}


int main(){
	

	scanf("%d",&a);
	for (i = 0; i < a;i++){
		scanf("%d",&A[i]);
	}
	scanf("%d",&b);

	for (i = 0; i < b;i++){
		scanf("%d",&M[i]);
	}

	for (i = 0; i < b; i++){
		if (solve(0, M[i])){
			printf("yes\n");
		}else{
			printf("no\n");
		}
	}

	return 0;

}

Measured memory_bytes: 588
H,W = map(int,input().split())
grid = []

for h in range(H):
    s = input()
    if '#' in s:
        grid.append(s)

dl = []
ans = [''] * len(grid)
for i in range(W):
    l = ''
    for j in range(len(grid)):
        g = grid[j]
        ans[j] += g[i]
        l += g[i]
    if '#' not in l:
        for k in range(len(grid)):
            ans[k] = ans[k][:-1]

for i in range(len(ans)):
    str = ''
    for j in range(len(ans[i])):
        str += ans[i][j]
    print(str)


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

typedef long long ll;

const int maxn = 2e5 + 1e2;
int l[maxn], r[maxn];
int p[maxn], q[maxn];
std::vector<int> train[maxn];
std::vector<std::vector<int>> recipe[maxn];
int res[maxn];

int tree[maxn];

int query(int pos){
	pos++;

	int res = 0;
	while(pos > 0){
		res += tree[pos];
		pos -= pos & -pos;
	}

	return res;
}

void update(int pos, int upd = 1){
	pos++;

	while(pos < maxn){
		tree[pos] += upd;
		pos += pos & -pos;
	}
}

int main(){
	std::ios::sync_with_stdio(false);

	int n, m, qq;
	std::cin >> n >> m >> qq;

	for(int i = 0; i < m; i++){
		std::cin >> l[i] >> r[i];
		l[i]--, r[i]--;
		train[l[i]].push_back(r[i]);
		update(r[i]);
	}

	for(int i = 0; i < qq; i++){
		std::cin >> p[i] >> q[i];
		p[i]--, q[i]--;
		recipe[p[i]].push_back({q[i], i});
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < recipe[i].size(); j++){
			res[recipe[i][j][1]] = query(recipe[i][j][0]);
		}
		for(int j = 0; j < train[i].size(); j++){
			update(train[i][j], -1);
		}
	}

	for(int i = 0; i < qq; i++){
		std::cout << res[i] << '\n';
	}
}


Measured memory_bytes: 21120
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"

	"sort"
	"strconv"
	"strings"
)

func parseInt(s string) int {
	i, _ := strconv.Atoi(s)
	return i
}

func Run(in io.Reader, out io.Writer) error {
	sc := bufio.NewScanner(in)
	sc.Scan()
	n := parseInt(sc.Text())
	a := make([]int, n)

	sc.Scan()
	for i, ai := range strings.Split(sc.Text(), " ") {
		a[i] = parseInt(ai)
	}
	sort.Ints(a)
	alice := 0
	bob := 0
	for idx, x := range a {
		if idx%2 == n%2 {
			bob += x
		} else {
			alice += x
		}
	}

	fmt.Fprintf(out, "%d\n", alice-bob)

	return nil
}

func main() {
	err := Run(os.Stdin, os.Stdout)

	if err != nil {
		log.Fatal(err)
	}
}


Measured memory_bytes: 640
S = input()
N = len(S)
S_1 = []
S_2 = []

for i in range(int((N-1)/2)):
    S_1.append(S[i])

for j in range(int((N+3)/2-1), int(N)):
    S_2.append(S[j])

S_2.reverse

if S_1 == S_2 :
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
using namespace std;

double x[4], y[4];

bool solve() {
  if(x[0] > x[1]) swap(x[0], x[1]);
  if(y[0] > y[1]) swap(y[0], y[1]);
  if(x[2] > x[3]) swap(x[2], x[3]);
  if(y[2] > y[3]) swap(y[2], y[3]);
  if(x[1] < x[2]) return false;
  if(y[1] < y[2]) return false;
  if(x[3] < x[0]) return false;
  if(y[3] < y[0]) return false;
  return true;
}

int main() {
  string line;
  while(getline(cin, line)) {
    stringstream ss;
    ss << line;
    for(int i = 0; i < 4; ++i) ss >> x[i] >> y[i];
    cout << (solve() ? "YES" : "NO") << endl;
  }
  return 0;
}

Measured memory_bytes: 0
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String[] c1 = saori.nextHayami().split("");
		String[] c2 = saori.nextHayami().split("");
		if(c1[0].equals(c2[2]) && c1[1].equals(c2[1]) && c1[2].equals(c2[0])){
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

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

using namespace std;

typedef long long ll;

int n, k;
const int N = 1e5 + 10;
int inf = 1e9;
int c[N];
int dp[N];

int solve(int idx)
{
	if(idx == n - 1)
		return 0;
	int &ans = dp[idx];
	if(ans != -1)
		return ans;
	ans = inf;
	for(int i = 1; i <= k; i++)
	{
		if(idx + i < n)
			ans = min(ans, solve(idx + i) + abs(c[idx + i] - c[idx]));
	}
	return ans;
}
int main()
{
	cin >> n >> k;
	for(int i = 0; i< n; i++)
		cin >> c[i];
	memset(dp, -1, sizeof(dp));
	cout << solve(0);
	return 0;
}

Measured memory_bytes: 5760
#include<iostream>
#include<cstdio>
using namespace std;
const int maxn = 500000;
const int INFTY  = 1000000010;
int cnt = 0;
int L[maxn/2 + 2],R[maxn/2 + 2];
void Merge(int *A,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] = INFTY;
	
	int i = 0,j = 0; 
	for(int k = left;k < right ;k++){
		cnt++;
		if(L[i] <= R[j]){
			A[k] = L[i++];
			//i++;
		}
		else {
			A[k] = R[j++];
			//j++;
		}
	}
}
void Merge_sort(int *A,int left,int right)//归并排序 
{
	if(left < right - 1){
		//int mid = (right - left)/2 + left;
		int mid = (right + left) / 2;
		Merge_sort(A,left,mid);				//分治递归 
		Merge_sort(A,mid,right);		//分治递归 
		Merge(A,left,mid,right);			//归并 
	}
}
int main()
{
	//freopen("guibing1.txt","r",stdin);
	int num = 0;
	int A[maxn];
	scanf("%d",&num);
	for(int i = 0;i < num;i++){
		scanf("%d",&A[i]);
	}
	//int left = 0,right = num;
	Merge_sort(A,0,num);
	for(int i = 0 ;i < num;i++){
		if(i > 0){
			printf(" ");
		}
		printf("%d",A[i]);
	}
	printf("\n");
	printf("%d\n",cnt);
	return 0;
 } 


Measured memory_bytes: 7040
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <bitset>
#include <list>
#include <iomanip>
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rrep(i,a,n) for(ll i=n;i>=a;i--)
#define elif else if
#define all(s) s.begin(),s.end()
typedef long long ll;
typedef pair<string,ll> P;
const ll INF = 1e+17;
const ll MODcdf = 998244353;
const ll MODatc = 1000000007;
bool pairCompare(const P& firstElof,const P& secondElof){
    return firstElof.first<secondElof.first;
}
bool pairCompare2(P firstElof,P secondElof){
    return (firstElof.second)%1000>(secondElof.second)%1000;
}
bool less_mod1000(int lhs, int rhs) {
  if ((lhs - rhs) % 1000 != 0)
    return lhs % 1000 < rhs % 1000;
  else // 5で割った余りが等しいなら普通に大小比較する
    return lhs < rhs;
}
string Alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alpha="abcdefghijklmnopqrstuvwxyzaaaaaaa";
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n;cin>>n;
    ll l[n];
    rep(i,0,n)cin>>l[i];
    sort(l,l+n);
    bool flag=true;
    ll sum=0;
    rep(i,0,n-2){
      rep(j,i+1,n-1){
        flag=false;
        rep(k,j+1,n){
          if(l[i]+l[j]>l[k]&&l[i]+l[k]>l[j]&&l[j]+l[k]>l[i]){
            sum++;
            flag=true;
            //cout<<l[i]<<" "<<l[j]<<" "<<l[k]<<endl;
          }
          if(!flag){
          break;
        }
        }
      }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// #define inf 100000000000000000
#define ll long long int
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}

int main(){
	//mahakal();fast;
	ll h , a;
	cin>>h>>a;
	if(h%a==0)cout<<h/a<<endl;
	else{
		cout<<h/a+1<<endl;
	}
	return 0;
}

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

int main() {
    string N;
    cin >> N;
    int a=N.size()-1;
    if(N.at(N.size()-1)=='3') cout << "bon" << endl;
    else if(N.at(a)=='0'||N.at(a)=='1'||N.at(a)=='6'||N.at(a)=='8') cout << "pon" << endl;
    else cout << "hon" << endl;
}

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

#define PrintLn(X) cout << X << endl
int main(void)
{
	int N;
	cin >> N;
	if(N / 100 == N % 10){
		PrintLn("Yes");
	}else{
		PrintLn("No");
	}
	return 0;
}


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

int main(void) {
	int i,size,m,h;
	char c[200],cc[200];
	
	while (1){
		scanf("%s",&c);
		if (c[0]=='-') break;
		
		size=strlen(c);
		scanf("%d",&m);
		while (m--){
			scanf("%d",&h);
			for (i=0;i<h;i++){
				cc[i]=c[i];
			}
			for (i=h;i<size;i++){
				c[i-h]=c[i];
			}
			for (i=0;i<h;i++){
				c[i+size-h]=cc[i];
			}
		}
		printf("%s\n",c);
	}
  return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#include <sstream>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007
#define M 998244353

using namespace std;

int main() {
    lli n,k,x,sum=0,Min=N,cost;
    vector<lli> vec;
    lli i,j;
    cin>>n>>k;
    rep(i,0,n){
        cin>>x;
        Min=min(Min,abs(x));
        vec.push_back(x);
    }
    if(k==1){
        cout<<Min<<endl;
    }
    else{
        Min=N;
        rep(i,0,n-k+1){
//            cout<<i+1<<"番目から"<<i+k<<"番目の蝋燭をつけるときのコストは"<<endl;
            if(vec[i]*vec[i+k-1]>=0){
                cost=max(abs(vec[i]),abs(vec[i+k-1]));
//                cout<<cost<<endl;
                Min=min(Min,cost);
            }
            else{
                cost=abs(vec[i]-vec[i+k-1])+min(abs(vec[i]),abs(vec[i+k-1]));
//                cout<<cost<<endl;
                Min=min(Min,cost);
            }
        }
        cout<<Min<<endl;
    }
}


Measured memory_bytes: 4300
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

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

vector< vector<int> > Graph;
vector< int > value;





bool ProductDay(int month,int day10,int day1) {
    if(day10*day1 == month) return true;
    else return false;
}



int main(int argc, const char * argv[]) {
    
    
    
    
    int a,b; cin >> a >> b;
    if( (b-1)%(a-1) == 0) cout << (b-1)/(a-1) << endl;
    else cout << (b-1)/(a-1) + 1 << endl;
    
    return 0;
    
    


    
    

    
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var Si = ReadLine();
            if (Si.Contains('Y'))
                WriteLine("Four");
            else
                WriteLine("Three");
        }
        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28188
#include<stdio.h>

int A[500001];

void maxheap(int H,int i)
{
  int l,r,max;

  l = i*2;
  r = i*2+1;

  if (l <= H && A[l] > A[i]) max = l;
  else max = i;

  if(r <= H && A[r] > A[max]) max = r;

  if(max != i)
  {
    l = A[i];
    A[i] = A[max];
    A[max] = l;
    maxheap(H,max);
  }
}

void build(int H)
{
  int i;
  for(i = H/2;i > 0;i--) maxheap(H,i);
}

int main()
{
  int n,i;

  scanf("%d",&n);

  for(i = 1;i <= n;i++) scanf("%d",&A[i]);

  build(n);

  for(i = 1;i <= n;i++)printf(" %d",A[i]);

  printf("\n");

  return 0;
}



Measured memory_bytes: 3676
import sys;
s = input().split();
n = int(s[0]);
m = int(s[1]);
h = list(map(int,input().split()));
c = [];
cnt = 0;
for i in range(n):
    c.append(True);
for i in range(m):
    tmp = input().split();
    n1 = int(tmp[0]);
    n2 = int(tmp[1]);
    if(h[n1 - 1] <= h[n2 - 1]):
        c[n1 - 1] = False;
    if(h[n1 - 1] >= h[n2 - 1]):
        c[n2 - 1] = False;

for i in range(n):
    if(c[i] == True):
        cnt += 1;


print(cnt);


Measured memory_bytes: 20136
import numpy as np


def prepare(n, m):
    f = 1
    for i in range(1, n + 1):
        f = f * i % m
    fn = f
    f = pow(f, m - 2, m)
    invs = [1] * (n + 1)
    invs[n] = f
    for i in range(n, 0, -1):
        f = f * i % m
        invs[i - 1] = f

    return fn, invs


def nik(n2, k, m):
    ret = 1
    yield ret
    for _ in range(k):
        ret = ret * n2 % m
        yield ret


n, m = map(int, input().split())

fn, invs = prepare(n, m)
np_range = np.arange(2, n + 3, dtype=np.int64)
dp = np.zeros(n + 2, dtype=np.int64)
dp[0] = 1

nn2 = [2]
for i in range(n):
    nn2.append(nn2[-1] ** 2 % m)

ans = 0
parity = 1

for i in range(n + 1):
    n2 = pow(2, n - i, m)
    coef = np.fromiter(nik(n2, i, m), dtype=np.int64)
    ncr = fn * invs[i] * invs[n - i] % m
    left = (dp[:i + 1] * coef % m).sum() % m
    ans = (ans + ncr * left % m * nn2[n - i] % m * parity) % m
    dp[1:i + 2] = (dp[1:i + 2] * np_range[:i + 1] + dp[:i + 1]) % m
    parity *= -1

print(ans)


Measured memory_bytes: 14664
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

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

    ll N;
    cin >> N;
    string S;
    cin >> S;

    ll ans = 0;
    for (char a = '0'; a <= '9'; a++) {
        for (char b = '0'; b <= '9'; b++) {
            for (char c = '0'; c <= '9'; c++) {
                string pin;
                pin += a;
                pin += b;
                pin += c;
                ll cnt = 0;
                for (char d : S) {
                    if (d == pin[cnt]) {
                        cnt++;
                        if (cnt == 3) {
                            // cout << pin << "\n";
                            ans++;
                            break;
                        }
                    }
                }

            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
import sys
from io import StringIO
import unittest
import os
from collections import deque
import collections

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


# 実装を行う関数
def resolve(test_def_name=""):
    n, x, y = map(int, input().split())

    ans = []

    for i in range(1, n + 1):

        que = deque()
        que.append(i)
        work_ans = [9999 for i in range(n + 1)]
        work_ans[i] = 0

        while len(que) is not 0:

            now = que.pop()
            # 移動する方向を設定
            target = []
            if now > 1:
                target.append(now - 1)
            if now < n:
                target.append(now + 1)
            if now == x:
                target.append(y)
            if now == y:
                target.append(x)

            for j in target:
                # 既に最適解が設定されている場合は処理をしない
                if work_ans[j] < work_ans[now] + 1:
                    continue
                # 最適解の設定と、キュー追加を実施。
                work_ans[j] = work_ans[now] + 1
                que.appendleft(j)

        ans += work_ans

    # Counter()で、各数字の個数を数える。
    counter = collections.Counter(ans)

    # 各距離の個数を出力(全網羅しているので、「÷2」して集計時の重複を排除する。)
    for i in range(1, n):
        print(counter.get(i, 0)//2)


# テストクラス
class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """5 2 4"""
        output = """5
4
1
0"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """3 1 3"""
        output = """3
0"""
        self.assertIO(test_input, output)

    def test_input_3(self):
        test_input = """7 3 7"""
        output = """7
8
4
2
0
0"""
        self.assertIO(test_input, output)

    def test_input_4(self):
        test_input = """10 4 8"""
        output = """10
12
10
8
4
1
0
0
0"""
        self.assertIO(test_input, output)

    # 自作テストパターンのひな形(利用時は「tes_t」のアンダーバーを削除すること
    def tes_t_1original_1(self):
        test_input = """データ"""
        output = """データ"""
        self.assertIO(test_input, output)


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main()


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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int a, b;

signed main(int argc, char *argv[], char *envp[]){
	cin >> a >> b;
	if ((a > 0) && (a < 10) && (b > 0) && (b < 10)){
		cout << a*b << '\n';
	}else{
		cout << -1 << '\n';
	}
	return 0;
}


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

int main(){
	long long a, b, x, result;
	cin >> a >> b >> x;
	if (a == 0){
		result = b/x + 1;
	}else{
		result = ( b/x +1) - (((a-1)/x) + 1);		
	}
	cout << result << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

int a[500010],ans[500010],pre[500010];
int n;
int main()
{
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;++i)
		scanf("%1d",&a[i]);
	for(i=1;i<=n;++i)
		pre[i]=a[i]==0?i:pre[i-1];
	int pre2=0;
	for(i=1;i<=n;++i)
	{
		if(i>=3&&a[i]==1&&a[i-1]==0&&a[i-2]==1)	pre2=i;
		ans[i]=ans[i-1];
		if(i>=3&&a[i-2]==1&&a[i-1]==0&&a[i]==1)
		{
			ans[i]=max(ans[i],ans[pre[i-2]]+(i-2-pre[i-2]));
			ans[i]=max(ans[i],ans[pre[i-2]+1]+(i-2-(pre[i-2]+1)));
		}
		if(pre2>pre[i])
		{
			ans[i]=max(ans[i],ans[pre2-3]+(i-pre2+1));
		}
		//printf("1t%d %d\n",i,ans[i]);
	}
	printf("%d",ans[n]);
	return 0;
}

Measured memory_bytes: 6016
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 200005
#define FH 400005
#define inf INT32_MAX
#define MOD 1000000007LL

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pr;

vector<vector<pr>> g;
vector<int> used;

void dfs(int v, int c)
{
	if (used[v] != -1)
		return;
	used[v] = c;
	for (pr x : g[v])
		if (x.second % 2)
			dfs(x.first, !c);
		else
			dfs(x.first, c);
}


inline void solve()
{
	int n;
	cin >> n;
	g.resize(n + 1);
	used.assign(n + 1, -1);
	int t1, t2, t3;
	fore(i, 0, n)
	{
		cin >> t1 >> t2 >> t3;
		g[t1].push_back({ t2,t3 });
		g[t2].push_back({ t1,t3 });
	}
	dfs(1, 0);
	fore(i, 1, n + 1)
		cout << used[i] << '\n';
}



int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
}

Measured memory_bytes: 8832