akhauriyash/Code-Regression huggingface dataset:
public class Main {

	public void run(java.util.Scanner sc, java.io.PrintStream out) {
		for (;;) {
			final int w = sc.nextInt();
			final int h = sc.nextInt();
			if (w == 0 && h == 0) break ;
			final Cell[][] map = new Cell[w][h];
			for (int i = 0; i < w; ++i)
			for (int j = 0; j < h; ++j)
				map[i][j] = new Cell();
			for (int i = 1; i < w; ++i) {
				if (sc.nextInt() == 0) {
					map[i - 1][0].right = map[i][0];
					map[i][0].left = map[i - 1][0];
				}
			}
			for (int j = 1; j < h; ++j) {
				for (int i = 0; i < w; ++i) {
					if (sc.nextInt() == 0) {
						map[i][j].top = map[i][j - 1];
						map[i][j - 1].bottom = map[i][j];
					}
				}
				for (int i = 1; i < w; ++i) {
					if (sc.nextInt() == 0) {
						map[i - 1][j].right = map[i][j];
						map[i][j].left = map[i - 1][j];
					}
				}
			}
			
			java.util.Queue<Cell> lis = new java.util.LinkedList<Cell>();
			map[0][0].visited = 1;
			lis.add(map[0][0]);
			while (!lis.isEmpty()) {
				final Cell e = lis.remove();
				if (e == map[w - 1][h - 1])
					break ;
				if (e.top != null && e.top.visited == 0) {
					e.top.visited = e.visited + 1;
					lis.add(e.top);
				}
				if (e.left != null && e.left.visited == 0) {
					e.left.visited = e.visited + 1;
					lis.add(e.left);
				}
				if (e.right != null && e.right.visited == 0) {
					e.right.visited = e.visited + 1;
					lis.add(e.right);
				}
				if (e.bottom != null && e.bottom.visited == 0) {
					e.bottom.visited = e.visited + 1;
					lis.add(e.bottom);
				}
			}
			out.println(map[w - 1][h - 1].visited);
		}
	}
	
	public static void main(String[] args) {
		(new Main()).run(new java.util.Scanner(System.in), System.out);
	}

	private class Cell {
		public int visited;
		public Cell top, left, right, bottom;
		public Cell() {
			this.visited = 0;
			this.top = null;
			this.left = null;
			this.right = null;
			this.bottom = null;
		}
	}
	
}

Measured memory_bytes: 70088
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<cctype>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#include<sstream>
#define X first
#define Y second
using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

const int N=1000010,mod=1e9+7;

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

string s,rs;

int main()
{
//	ios::sync_with_stdio(false);
//	cin.tie(0);
	
	bool flag=true;

	cin>>s;
	rs=s;
	reverse(rs.begin(),rs.end());
	
	string t1,t2,tt1,tt2;
	
//	cout<<(s.length()-1)/2<<endl;
	
	tt1=t1=s.substr(0,(s.length()-1)/2);
	tt2=t2=s.substr((s.length()+3)/2-1);

	reverse(tt1.begin(),tt1.end());
	reverse(tt2.begin(),tt2.end());

//	cout<<rs<<endl;
//	cout<<tt1<<endl;
//	cout<<tt2<<endl;

	if(s!=rs||t1!=tt1||t2!=tt2)
		flag=false;
	
	if(flag) puts("Yes");
	else puts("No");
















	return 0;
}











Measured memory_bytes: 256
#include <stdio.h>
#define N 100
int main(){

  int i,j,n,A[N],temp,count=0,minj;

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

  for(i=0;i<n;i++){
    minj=i;
    for(j=i;j<n;j++){
      if(A[j]<A[minj]){
	minj=j;
      }
    }
    if(i!=minj){
      temp=A[i];
      A[i]=A[minj];
      A[minj]=temp;
      count++;
    }
  }


  for(j=0;j<n;j++){
    printf("%d",A[j]);
    if(j==n-1) break;
    printf(" ");
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2140
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	int A, B, C;
	cin >> A >> B >> C;
	if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0)cout << 0;
	else {
		int a = A * B;
		int b = B * C;
		int c = C * A;
		int ans = min({ a,b,c });
		cout << ans;
	}
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int S, h, m, s;
	cin >> S;
	h = S / 3600;
	m = (S - h * 3600) / 60;
	s = (S - h * 3600 - m * 60);

	cout << h << ":" << m << ":" << s << endl;
	return 0;
}

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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);

bool nega(ll a) {
    if(a < 0) return true;
    else return false;
}

bool posi(ll a) {
    if(a > 0) return true;
    else return false;
}

int main() {
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0, sum = 0;

    // +-+-...
    rep(i, n) {
        sum += a[i];
        // +
        if((i%2) == 0) {
            if(sum <= 0) {
                ans += (my_abs(sum)+1);
                sum += (my_abs(sum)+1);
            }
        }
        // -
        else {
            if(sum >= 0) {
                ans += (sum+1);
                sum -= (sum+1);
            }
        }

    }

    ll tmp = 0;
    sum = 0;
    // -+-+...
    rep(i, n) {
        sum += a[i];
        // +
        if((i%2) == 1) {
            if(sum <= 0) {
                tmp += (my_abs(sum)+1);
                sum += (my_abs(sum)+1);
            }
        }
        // -
        else {
            if(sum >= 0) {
                tmp += (sum+1);
                sum -= (sum+1);
            }
        }
    }

    if(ans > tmp) ans = tmp;
    cout << ans << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 3888
#include<iostream>
using namespace std;
 
int main(){
  int a, b;
  cin >> a >> b;
  if (b%2 == 0){
    if (a > 12){
      cout << b << endl;
    }
    else if (5 < a && a < 13){
      cout << b/2 << endl;
    }
    else if (0 <= a && a <= 5){
      cout << 0 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<map>
#include<iterator>
using namespace std;
#define tt int t;cin>>t;while(t--)
#define ll long long
#define nl endl
#define srt(v) sort(v.begin(),v.end());
#define rsrt(v) sort(v.begin(),v.end(),greater<int>());
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define amax(a,n) *max_element(a,a+n)
#define amin(a,n) *min_element(a,a+n)
#define vmax(a) *max_element(a.begin(),a.end())
#define vmin(a) *min_element(a.begin(),a.end())
#define so ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define a_size 100
ll i,j;
vector<ll>adj[100001];
ll vist[100001];
void dfs(ll u)
{
          if(!vist[u])
          {
                    vist[u]=1;
                    for(auto it : adj[u])
                    dfs(it);
          }
          return;
}
int main()
{
        so

        ll n,m,a,b,ans=-1;
        cin>>n>>m;
        for(i=0;i<m;i++){
          cin>>a>>b;
          adj[a].push_back(b);
          adj[b].push_back(a);
        }
        memset(vist,0,sizeof vist);
        for(i=1;i<=n;i++){
          if(vist[i]==0){
                    ans++;
                    dfs(i);
          }
        }
        cout<<ans;




        return 0;
}



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

typedef long long ll;

const ll INF = 1ll << 61;

ll N, K;
vector<ll> A;
ll fdiv(ll x, ll y) { return x >= 0ll ? x / y : -((-x + y - 1) / y); }
ll count(ll x) {
  ll cnt = 0;
  // x 以下になるペアの個数
  for (ll i = 0; i < N; ++i) {
    if (A[i] == 0) {
      if (x >= 0) cnt += i;
    } else if (A[i] > 0) {
      ll f = fdiv(x, A[i]); // floor(x / A[i])
      ll j = upper_bound(A.begin(), A.end(), f) - A.begin();
      cnt += min(j, i);
    } else {
      ll c = -fdiv(x, (-A[i])); // ceil(x / A[i]) = - floor(x / -A[i])
      ll k = lower_bound(A.begin(), A.end(), c) - A.begin();
      cnt += max(0ll, i - k);
    }
  }
  return cnt;
}
int main() {
  cin >> N >> K;
  for (ll i = 0; i < N; ++i) {
    ll a;
    cin >> a;
    A.push_back(a);
  }
  sort(A.begin(), A.end());
  ll ok = INF, ng = -INF;
  while (ok - ng > 1) {
    ll mid = (ok + ng) / 2;
    if (count(mid) >= K)
      ok = mid;
    else
      ng = mid;
  }
  cout << ok << endl;
  return 0;
}


Measured memory_bytes: 2420
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define all(x) x.begin(),x.end()
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1'000'000'000'000'000'000ll;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
int main()
{
    fast();
    ll n,l,i,ans=0,temp=-1,s=INT_MAX;
    cin>>n>>l;
    vll a(n);
    rep(i,n)
    {
        a[i]=l+i;
        if(abs(a[i])<s)
        {
            s=abs(a[i]);
            temp=i;
        }
    }
    rep(i,n)
    {
        if(i!=temp)
            ans+=a[i];
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include<iomanip>

using namespace std;
typedef long long ll;

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include<iomanip>

using namespace std;
typedef long long ll;

int N;
vector<int> x(10);
vector<int> y(10);


double dist(int i, int j) {
	double dx = x[i] - x[j];
	double dy = y[i] - y[j];
	return pow(dx * dx + dy * dy, 0.5);
}
int main() {
	cin >> N;

	for (int i = 0; i < N; i++) cin >> x[i] >> y[i];
	long double ans = 0;
	vector<int> vec(N);
	for (int i = 0; i < N; i++) vec[i] = i ;
	do {
		for (int i = 0; i < N - 1; i++) ans += dist(vec[i], vec[i + 1]);
	} while (next_permutation(vec.begin(), vec.end()));
	int factorial = 1;
	for (int i = 2; i <= N; i++) factorial *= i;
	cout << fixed << setprecision(10) << ans / factorial << endl;
}


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

int toVal(string s) {
	int ret = 0;
	ret += (s[0]-'0')*100;
	ret += (s[1]-'0')*10;
	ret += (s[2]-'0')*1;
	return ret;
}

int main()  
{   
    cin.tie(0); ios::sync_with_stdio(false);  
	//freopen("input.txt", "rt", stdin);
	string s; cin >> s;
	int ans = INT_MAX;
	for (int i = 0; i < s.size()-2; i++) {
		//cout << s.substr(i, 3) << endl;
		ans = min(ans, abs(753-toVal(s.substr(i, 3))));
	}
	cout << ans << endl;
	
	
	return 0;   
}  


Measured memory_bytes: 256
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

import heapq

h = []
for a in A:
    if len(h) < 2:
        heapq.heappush(h, a)
    else:
        heapq.heappushpop(h, a)

for a in A:
    if a == h[1]:
        print(h[0])
    else:
        print(h[1])

Measured memory_bytes: 12640
<?php

while($line = fgets(STDIN)){
    $x = floatval($line);
    $s = $x;
    for($i = 2; $i <= 10; $i++){
    	if($i % 2 == 0){
    		// ??¶??°???
    		$x = $x*2.0;
    	}else{
    		// ?\???°???
    		$x = $x/3.0;
    	}
    	$s += $x;
    }
    
    echo $s."\n";
}

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);


typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

const int mod = 1e9 + 7;


inline ll add(ll a,ll b){
	return (a%mod + b%mod)%mod;
}

inline ll sub(ll a,ll b){
	return(a%mod - b%mod + mod)%mod;
}

inline ll mul(ll a,ll b){
	return(a%mod * b%mod)%mod;
}

// inline ll div(ll a,ll b){
// 	return(a%mod * modexpo(b,mod - 2)%mod)%mod;
// }

int main(int argc, char const *argv[])
{
	int h,w;
	cin >> h >> w;
	int grid[h + 1][w + 1];
	int i,j;
	string s;
	forn(1,h + 1,i){
		cin >> s;
		forn(1,w + 1,j){
			grid[i][j] = ((s[j - 1] == '.') ? 1 : 0);
		}
	}
	int dp[h + 1][w + 1];
	memset(dp,0,sizeof(dp));

	dp[1][1] = 1;

	forn(1,h + 1,i){
		forn(1,w + 1,j){
			if(i == 1 && j == 1);
			else{

				if(grid[i][j] == 1){
					dp[i][j] = add(dp[i - 1][j],dp[i][j - 1]);
				}
				else{
					dp[i][j] = 0;
				}
			}
		}
	}
	cout << dp[h][w] << '\n';
	return 0;
}

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

namespace AtCoder2
{
	class Program
	{
		static void Main(string[] args)
		{
			var s = Console.ReadLine();
			var l = s.Length;
			var b = Enumerable.Repeat(1, l).ToArray();

			for (int i = 0; i < l - 2; i++)
			{
				if (s[i] == 'R' && s[i + 1] == 'R')
				{
					b[i + 2] += b[i];
					b[i] = 0;
				}
			}

			for (int i = l - 1; i > 0; i--)
			{
				if (s[i] == 'L' && s[i - 1] == 'L')
				{
					b[i - 2] += b[i];
					b[i] = 0;
				}
			}

			Console.WriteLine(String.Join(' ', b));
		}
	}
}


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

}
if(b>c){
    int q,r;
    q=b,r=c;
    b=r,c=q;
}
if(a>b){
    int n,m;
    n=a,m=b;
    a=m,b=n;
}
printf("%d %d %d\n",a,b,c);
    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <utility>

using namespace std;

int main(){
  int i,j,k;
  int n;
  cin >> n;
  for(i=1;i*i<=n;i++){
    if(i*i<=n)j=i*i;
  }
  cout << j << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<string>
#include<cmath>
#include<stack>
#include <vector>
#include<queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include<utility>
using namespace std;
using ll = long long;

string solve(ll a, ll b, ll c, ll d);
ll asd(ll a, ll b);

int main() {
	int T;
	string ans[300];
	cin >> T;
	for (int i = 0; i < T; i++) {
		ll a, b, c, d;
		cin >> a >> b >> c >> d;
		ans[i]=solve(a, b, c, d);
	}
	for (int i = 0; i < T; i++) {
		cout << ans[i] << endl;
	}
		return 0;
}

string solve(ll a, ll b, ll c, ll d) {
	if (a < b || d < b) {
		return "No";
	}
	else if (c + 1 >= b) {
		return "Yes";
	}
	ll p = c / b * b + a % b;
	if (p < c)p += b; 
	p -= c;
	ll s = asd(b, d);
	if(((b-p)/s+1)*s>=(2*b-c-p))return "Yes";
	else return "No";
}

ll asd(ll a, ll b) {
	if (max(a, b) % min(a, b) == 0)return min(a, b);
	else return asd(min(a, b), max(a, b) % min(a, b));
}

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

int main() {
  std::string w;
  std::cin >> w;
  int f[26] = {};
  for (auto w_i: w) ++f[w_i-'a'];
  for (int i = 0; i < 26; ++i)
    if (f[i] % 2 > 0) return puts("No"), 0;
  puts("Yes");
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int N, M;
  cin >> N >> M;

  cout << N * (N-1)/2 + M * (M-1) / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pi 3.14159265358979323846
#define mod 1000000007
int main()
{
    IOS;
    ll a,b,c,d,e,cnt=7;
    cin>>a;
    if(a%2==0)
    {
        cout<<"-1"<<endl;
    }
    else
    {
        for(b=0;b<1000000;b++)
        {
            cnt=cnt%a;
            if(cnt==0) break;
            cnt=(cnt*10)+7;
        }
        if(cnt==0) cout<<b+1<<endl;
        else cout<<-1<<endl;
    }
}

Measured memory_bytes: 3664
#include <stdio.h>
 
int main(void) {

	int i;
	long int x, m = 100;
	
	scanf("%ld", &x);
	
	for(i = 1; ; i++){
		m += (m * 0.01);
		if(m >= x){
			printf("%d", i);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1732
import java.util.Scanner;

class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    String a = sc.next();
    String b = sc.next();
    String c = sc.next();
//toUpperで大文字に変える
//toLowerで小文字に変える
     String ua = a.toUpperCase();
     String ub = b.toUpperCase();
     String uc = c.toUpperCase();
//substringで出力の文字数の指定
    System.out.println(ua.substring(0,1) + ub.substring(0,1) + uc.substring(0,1));
  }
}


Measured memory_bytes: 23764
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#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 eb emplace_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 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;
}
    
void run(){
    int h,w;
    cin>>h>>w;
    if(h==1||w==1)cout<<1<<endl;
    else cout<<w*(h/2)+(w+1)/2*(h%2)<<endl;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  a,b=LI()
  if a>=13:
    print(b)
  elif 6<=a and a<=12:
    print(b//2)
  else:
    print(0)

main()
# print(main())


Measured memory_bytes: 6312
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
typedef pair<char, char> c_c;
typedef pair<int, int> i_i;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b, c;
    cin >> a >> b >> c;

    if(a==b && b==c) cout << "No" << endl;
    else if((a==b) || (b==c) || (c==a)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.rbegin(),a.rend())
#define lb(a,b) lower_bound(a.begin(),a.end(),b)
#define ub(a,b) upper_bound(a.begin(),a.end(),b)
#define MOD ((int)(1e9+7))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double
#define sqrt sqrtl
#define cbrt cbrtl
typedef vector<int> vi;
typedef vector<float> vf;
typedef pair<float,int> fi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<fi> vfi;
typedef vector<vi> vvi;
typedef vector<vf> vvf;
typedef vector<vii> vvii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<fi> pqfi;
typedef priority_queue <int, vector<int>, greater<int> > rpqi; 
typedef priority_queue <ii, vector<ii>, greater<ii> > rpqii; 
typedef priority_queue <fi, vector<fi>, greater<fi> > rpqfi; 

const int N=100001;
vector<int> par[N];
int cache[N];
int mx=0;

int dp(int u)
{
	if(cache[u]!=-1)return cache[u];
	if(par[u].size()==0)return cache[u]=0;
	cache[u]=0;
	for(int i=0;i<(int)par[u].size();i++)
	cache[u]=max(cache[u],dp(par[u][i])+1);
	return cache[u];
}
int32_t main()
{
	IOS
	// Topological sorting or memoisations
	// Lest do memoisation first
	int n,m;cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int u,v;cin>>u>>v;
		par[v].push_back(u);
	}
	memset(cache,-1,sizeof(cache));
	for(int i=1;i<=n;i++)
	mx=max(mx,dp(i));
	
	cout<<mx<<endl;
	
}
		


Measured memory_bytes: 11008
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = a;
    int c = 0;
    int d;
    while (b>0) {
      c += (b % 10);
      b /= 10;
    }
    if (a % c == 0) System.out.println("Yes");
    else System.out.println("No");
  }
}


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

int main() {
  int N;
  cin >> N;
  
  int digitSum = 0;
  int X = N;
  for( int digit=1; digit<=8; digit++ ){
    digitSum += (X % 10);
    X /= 10;
  }
  
  
  if( (N % digitSum) == 0 ){
    cout << "Yes" << endl;
  }
  else{
  	cout << "No" << endl;
  }
}

Measured memory_bytes: 3596
#include <algorithm>
#include <climits>
#include <cstdio>
#include <numeric>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < int(n); ++(i))
#define repeat_from_reverse(i, m, n) for (int i = (n)-1; (i) >= int(m); --(i))
#define whole(x) begin(x), end(x)
using namespace std;
template <class T> inline void setmax(T & a, T const & b) { a = max(a, b); }

int solve(vector<int> const & a) {
    const int max_a = *max_element(whole(a));
    int result = INT_MIN;
    repeat_from (k, 1, max_a + 1) {
        vector<int> b;
        for (int a_i : a) {
            if (a_i % k == 0 and __builtin_popcount(a_i / k) == 1) {
                b.push_back(a_i / k);
            }
        }
        int sum_b = accumulate(whole(b), 0);
        vector<int> dp(sum_b + 1, INT_MIN);
        dp[0] = 0;
        for (int b_i : b) {
            repeat_from_reverse (x, 1, sum_b + 1) {
                if (x % b_i == 0) {
                    setmax(dp[x], dp[x - b_i] + 1);
                }
            }
        }
        for (int x = 1; x <= sum_b; x *= 2) {
            setmax(result, dp[x]);
        }
    }
    return result;
}

int main() {
    while (true) {
        int n; scanf("%d", &n);
        if (n == 0) break;
        vector<int> a(n); repeat (i, n) scanf("%d", &a[i]);
        int result = solve(a);
        printf("%d\n", result);
    }
    return 0;
}

Measured memory_bytes: 3148
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define deba(a) cout << #a << " " <<a << endl;
vector <int> adj[100001];
bool visited[100001];
void dfs(ll s, ll &ans) {
	// cout << s << " ->";
	visited[s] = true;
	if (s == 2)
		return;
	ans++;
	for (int i = 0; i < adj[s].size(); ++i)    {
		if (visited[adj[s][i]] == false)
			dfs(adj[s][i], ans);
	}
}
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("D:\\input.txt", "r", stdin);
	freopen("D:\\output.txt", "w", stdout);
#endif
	int t = 1;
	// cin >> t;
	while (t--)
	{
		ll n;
		cin >> n;
		rep(i, 1, n + 1)
		{
			ll x;
			cin >> x;
			adj[i].pb(x);
		}
		ll ans = 0;
		dfs(1, ans);

		if (visited[2] == true)
			cout << ans;
		else
			cout << -1;
	}
	return 0;
}

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

typedef unsigned long long ll;

using namespace std;

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


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const   int MaxN=1e5+5;
int n;
struct data
{
    int a,b,c;
}p[MaxN];
typedef long long ll;
ll f[MaxN][5];

void Xuli()
{
    for(int i=1;i<=n;i++)
    {
        f[i][1]=max(f[i-1][2],f[i-1][3])+p[i].a;
        f[i][2]=max(f[i-1][1],f[i-1][3])+p[i].b;
        f[i][3]=max(f[i-1][2],f[i-1][1])+p[i].c;
    }
    printf("%lld",max(f[n][1],max(f[n][2],f[n][3])));
}

int main()
{
 
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d%d%d",&p[i].a,&p[i].b,&p[i].c);
    Xuli();
}


Measured memory_bytes: 5376
n = int(input())
if n%2:
    print(0)
else:
    ans = 0
    base = 10
    while base<=n:
        ans+=n//base
        base*=10
    five = 50
    while five<=n:
        tmp = five+0
        while  tmp<= n:
            ans += n//tmp - n//(tmp*2)
            tmp *= 10
        five*=5
    print(ans)


Measured memory_bytes: 3060
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

#define N 55
#define M 50

int parent[M][N];

void uft_init(int n, int m)
{
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++)
      parent[i][j] = -1;
}

int uft_root(int a, int b)
{
  if (parent[a][b] < 0)
    return b;
  return parent[a][b] = uft_root(a, parent[a][b]);
}

int uft_size(int a, int b)
{
  return -parent[a][b];
}

void uft_unite(int a, int b, int c)
{
  int rb = uft_root(a, b), rc = uft_root(a, c);
  if (rb == rc)
    return;
  if (uft_size(a, rb) > uft_size(a, rc))
  {
    parent[a][rb] += parent[a][rc];
    parent[a][rc] = rb;
  }
  else
  {
    parent[a][rc] += parent[a][rb];
    parent[a][rb] = rc;
  }
}

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int a[m], b[m], ans = 0;
  for (int i=0; i<m; i++)
    scanf("%d%d", a+i, b+i);
  uft_init(n, m);
  for (int i=0; i<m; i++) {
    for (int j=0; j<m; j++) {
      if (i == j)
        continue;
      uft_unite(i, a[j]-1, b[j]-1);
    }
    int cnt = 0;
    for (int j=0; j<n; j++)
      if (parent[i][j] < 0)
        cnt++;
    if (cnt > 1)
      ans++;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long n = long.Parse(input[0]);
		long l = long.Parse(input[1]);
    long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long maxSum = 0;//最大の2和
    long maxPoint = 0;//最大2和の部分

    for(long i = 0; i < n-1; i++)
    {
      if(nums[i]+nums[i+1] > maxSum)
      {
        maxSum = nums[i]+nums[i+1];
        maxPoint = i;
      }
    }

    if(maxSum < l) Console.WriteLine("Impossible");
		else
    {
      Console.WriteLine("Possible");
      for(long i = 1; i < maxPoint+1; i++) Console.WriteLine(i);
      for(long i = n-1; i > maxPoint+1; i--) Console.WriteLine(i);
      Console.WriteLine(maxPoint+1);
    }
	}
}

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

int main() {
	int n, q; scanf("%d%d", &n, &q);
	string back;
	rep(i, n) {
		int y; string s; cin >> y >> s;
		if (q < y) {
			if (back == "")puts("kogakubu10gokan");
			else cout << back << endl;
			return 0;
		}
		back = s;
	}
	cout << back << endl;
}

Measured memory_bytes: 3300
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;

lint n, k;
vector<lint> p, c;

vector<vector<pair<lint, lint>>> doubling;

template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

pair<lint, lint> doubling_calc(lint start, lint x) {
    lint ans = 0;
    bitset<33> b(x);
    for (int i = 0; i < 33; i++) {
        if (b[i] == 1) {
            ans += doubling[start][i].second;
            start = doubling[start][i].first;
        }
    }
    return {start, ans};
}

// startから1~x回やる時の最大
lint simulate(lint start, lint x) {
    lint ans = LLONG_MIN;
    lint cost = 0;
    for (int i = 0; i < x; i++) {
        cost += c[p[start]];
        start = p[start];
        chmax(ans, cost);
    }
    return ans;
}

int main() {
    cin >> n >> k;
    p.resize(n);
    c.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }
    for (int i = 0; i < n; i++) {
        cin >> c[i];
    }
    // iから2^j回移動
    doubling.resize(n, vector<pair<lint, lint>>(33, {0, 0}));
    for (int i = 0; i < n; i++) {
        doubling[i][0] = {p[i], c[p[i]]};
    }
    for (int i = 0; i < 32; i++) {
        for (int j = 0; j < n; j++) {
            auto next = doubling[doubling[j][i].first][i];
            doubling[j][i + 1].first = next.first;
            doubling[j][i + 1].second = doubling[j][i].second + next.second;
        }
    }
    lint ans = LLONG_MIN;
    if (k <= 2 * n) {
        for (int i = 0; i < n; i++) {
            chmax(ans, simulate(i, k));
        }
    } else {
        for (int i = 0; i < n; i++) {
            chmax(ans, simulate(i, n));
        }
        for (int i = 0; i < n; i++) {
            auto before = doubling_calc(i, k - n * 2);
            lint cand = before.second + simulate(before.first, 2 * n);
            chmax(ans, cand);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 6464
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <utility>

using namespace std;

template <class T>
using lp_queue=priority_queue<T, deque<T>, greater<T>>;

using Weight=int;
using DArray=vector<Weight>;
using DMatrix=vector<DArray>;

static const Weight INF=(1<<30)-1;

struct Edge {
    size_t src, dst;
    Weight weight;
    Edge() {}
    Edge(size_t src, size_t dst, Weight weight=1):
        src(src), dst(dst), weight(weight)
    {}
};

bool operator<(const Edge &e, const Edge &f) {
    if (e.weight != f.weight) {
        return e.weight > f.weight;
    } else {
        return e.src!=f.src? e.src<f.src : e.dst<f.dst;
    }
}

using Edges=vector<Edge>;
using Vertex=vector<Edge>;
using Graph=vector<Vertex>;

void join(Graph &g, size_t s, size_t d, Weight w=1) {
    // non-directed
    g[s].push_back(Edge(s, d, w));
    g[d].push_back(Edge(d, s, w));
}

void connect(Graph &g, size_t s, size_t d, Weight w=1) {
    // directed
    g[s].push_back(Edge(s, d, w));
}

vector<Weight> shortest_distance(const Graph &g, size_t s) {
    /* Bellman-Ford */
    size_t V=g.size();
    vector<Weight> d(V, INF); d[s]=0;
    for (size_t k=0; k<V; ++k)
        for (size_t i=0; i<V; ++i)
            for (const Edge &e: g[i])
                if (d[e.dst] > d[e.src] + e.weight && d[e.src] < INF) {
                    d[e.dst] = d[e.src] + e.weight;
                    if (k == V-1)
                        return vector<Weight>();
                }

    return d;
}

int main() {
    size_t V, E, r;
    scanf("%zu %zu %zu", &V, &E, &r);

    Graph g(V);
    for (size_t i=0; i<E; ++i) {
        size_t s, t;
        Weight d;
        scanf("%zu %zu %d", &s, &t, &d);

        connect(g, s, t, d);
    }

    vector<Weight> d=shortest_distance(g, r);
    if (d.empty())
        return !printf("NEGATIVE CYCLE\n");

    for (Weight w: d)
        if (w < INF) {
            printf("%d\n", w);
        } else {
            printf("INF\n");
        }

    return 0;
}

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

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

int N;
string S;

vector<char> memo;

int main() {
	cin >> N >> S;
	memo.reserve(50);

	int best = 0;

	rep(i, N) {
		memo.clear();
		int count = 0;

		for (int j = 0; j <= i; j++) {
			if (find( memo.begin(), memo.end(), S[j]) == memo.end()) {
				memo.push_back(S[j]);

				for(int ri = i + 1; ri < N; ri++) {
					if (S[ri] == S[j]) {
						count++;
						break;
					}
				}
			}
		}


		if (count > best) best = count;
	}

	cout << best << endl;


	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main (void) 
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a < c && c < b)  printf("Yes");
    else if(b < c && c < a)    printf("Yes");
    else    printf("No");
    return 0;
}

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

int main(void) {
	int n;
	cin >> n;
	vector<int> d(n);
	set<int> dset;
	for (int i = 0; i < n; i++) {
		cin >> d[i];
		dset.insert(d[i]);
	}
	cout << dset.size() << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
s=input()
if n%2!=0:
  print("No")
else:
  s=list(s)
  x=n//2
  ss=''.join(s[:x])
  sss=''.join(s[x::])
  if ss==sss:
    print("Yes")
  else:
    print("No")


Measured memory_bytes: 3060
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,c,l[100005]={},ans=0;
  P p[100005]={};
  cin >> n >> m >> c;
  for(int i=0; i<c; i++) {
    cin >> l[i];
  }
  for(int i=0; i<n; i++) {
    cin >> p[i].second >> p[i].first;
  }
  sort(p,p+n,greater<P>());
  for(auto a:p) {
    if(l[a.second-1]) {
      ans+=a.first;
      l[a.second-1]--;
      m--;
      if(m==0) {
        break;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4784
#include <iostream>
#include<iomanip>
using namespace std;
int main(){
    long a,b;
    long max,min,sum = 0;
    cin >> a;
    for(int i = 0;i < a;i++){
        cin >> b;
        if(i == 0){
            max = b;
            min = b;
        }
        if(max < b){
            max = b;
        }
        if(min > b){
            min = b;
        }
        sum = sum + b;
    }
    cout << min << " " << max << " " << sum << endl;
}



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

int main() {
  	int N; 
    cin >> N;
    for (int i=0; i<N; i++){
    	string a;
    	cin >> a;
    	if (a=="Y"){
        	cout << "Four" << endl;
        	break;
        }
        else if (i==N-1){
        	cout << "Three" << endl;
        	break;}
    }
}




Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define MP make_pair
/*unordered_map<int,int>mp;
mp.reserve(1024);
mp.max_load_factor(0.25);
*/
int main()
{
  //  #ifndef ONLINE_JUDGE
   // freopen("input.txt","r", stdin);
   // #endif // ONLINE_JUDGE
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    lli n,t,i,j,k,ans=0;
    cin>>n>>k;
    n*=(n-1);
    n/=2;
    cout<<n;
    return 0;
}


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

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n = 1) : n(n), f(n + 1) {
    f[0] = f[1] = -1;
    for(ll i = 2; i <= n; ++i) {
      if(f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for(ll j = i * i; j <= n; j += i) {
        if(!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x; }
  vector<int> factorList(int x) {
    vector<int> res;
    while(x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if(fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for(int p : fl) {
      if(res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};

int main() {
  int q;
  cin >> q;
  vi l(q), r(q);
  rep(i, q) cin >> l[i] >> r[i];
  int n = 1e5;
  Sieve s(n + 1);
  vi a(n + 1, 0);
  rep2(i, 1, n + 1) {
    a[i] = a[i - 1];
    if(s.isPrime(i) && s.isPrime((i + 1) / 2)) a[i]++;
  }
  rep(i, q) cout << a[r[i]] - a[l[i] - 1] << endl;
}

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

using namespace std;

typedef long long ll;

template<typename T>
void _dump(const char* s, T&& head)
{
  cerr << s << "=" << head << endl;
}

template<typename T, typename... Args>
void _dump(const char* s, T&& head, Args&&... tail)
{
  while (*s != ',') {
    cerr << *s++;
  }
  cerr << "=" << head << ",";
  _dump(s + 1, tail...);
}

template<typename T>
void _dumpv(const char* s, T&& v)
{
  cerr << s << "=";
  for (auto it = v.begin(); it != v.end(); it++) {
    cerr << *it << " ";
  }
  cerr << endl;
}

template<typename T>
void _dumpv2(const char* s, T&& v)
{
  cerr << s << "=";
  for (auto it = v.begin(); it != v.end(); it++) {
    cerr << it->first << ":" << it->second << " ";
  }
  cerr << endl;
}

#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__)
#define dumpv(...) _dumpv(#__VA_ARGS__, __VA_ARGS__)
#define dumpv2(...) _dumpv2(#__VA_ARGS__, __VA_ARGS__)

const ll MOD = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("template.1", "r", stdin);

  string S;
  cin >> S;
  int N;
  N = S.size();
  list<int> lt;
  for (int i = 0; i < N; i++) {
    int s = S[i] == '0' ? 0 : 1;
    if (lt.empty()) {
      lt.push_back(s);
    } else {
      if (lt.back() != s) {
        lt.pop_back();
      } else {
        lt.push_back(s);
      }
    }
    // dumpv(lt);
  }
  cout << N - lt.size() << endl;
  return 0;
}


Measured memory_bytes: 3536
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cctype>
#include <functional>
#include <map>
#include <cmath>

using namespace std;
typedef long long ll;

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

int main(){
    int x,y = 0;
    int ans = 2;
    cin >> x;
    int sqrtX = sqrt(x);
    if(x != 1){
        reps(j,2, sqrtX+1){
            y = j;
            while(y*j <= x){
                y *= j;
            }
            if(y > ans && y <= x) ans = y;
        }
    }else{
        ans = 1;
    }
        cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int N;
	const int NMAX = 100;
	int score[NMAX];

	while (1) {
		cin >> N;
		if (N==0) break;
		
		int max, min;
		int sum = 0;
		for (int i=0; i<N; ++i) {
			cin >> score[i];
			sum += score[i];
			if (i == 0) {
				max = min = score[0];
			} else {
				if ( score[i] > max ) max = score[i];
				if ( score[i] < min ) min = score[i];
			}
		}
		cout << (sum-max-min)/(N-2) << endl;

	}

	return 0;
}

Measured memory_bytes: 3080
#include <cstdio>           // scanf()
#include <iostream>         // cout, cerr, endl
#include <list>

using namespace std;
typedef list<int> List;

int
main(int argc, char** argv)
{
	List v;
	char command[15];
	int key = 0;
	int n = 0;
	int i;

	scanf("%d", &n);
	for (i = 0; i < n; ++i)
	{
		scanf("%s", command);
		switch (command[0])
		{
		case 'i':
			scanf("%d", &key);
			v.push_front(key);
			break;

		case 'd':
			if (command[6] == 'F')
				v.pop_front();

			else if (command[6] == 'L')
				v.pop_back();

			else
			{
				scanf("%d", &key);
				for (List::iterator it = v.begin(); it != v.end(); ++it)
				{
					if (*it == key)
					{
						v.erase(it);
						break;
					}
				}
			}

			break;
		}
	}

	const char* sep = "";
	for (List::iterator it = v.begin(); it != v.end(); ++it)
	{
		printf("%s%d", sep, *it);
		sep = " ";
	}

	printf("\n");
	return 0;
}

Measured memory_bytes: 32364
package main

import "fmt"

func main() {
	var n, p, a, odd, even int
	fmt.Scan(&n, &p)

	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		odd += a % 2
		even += (a % 2) ^ 1
	}
	if odd == 0 {
		fmt.Println(pow(2, even) * toInt(p == 0))
	} else {
		fmt.Println(pow(2, odd-1) * pow(2, even))
	}
}

func pow(a, b int) int {
	result := 1
	for i := 0; i < b; i++ {
		result *= a
	}
	return result
}

func toInt(ok bool) int {
	if ok {
		return 1
	}
	return 0
}


Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> b;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  copy(a.begin(), a.end(), back_inserter(b) );
  sort(b.rbegin(), b.rend());

  for (int i = 0; i < n; i++) {
    if(a[i] == b[0]){
      cout << b[1] << endl;
    }else{
      cout << b[0] << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 4848
N=int(input())
A=[0]*N
B=[0]*N
diff=[0]*N
for i in range(N):
  A[i],B[i]=map(int,input().split())
  diff[i]=[A[i]+B[i],i]
  
diff=sorted(diff,key=lambda x:x[0])[::-1]
taka=0
aoki=0
for i in range(len(diff)):
  if i%2==0:
    taka+=A[diff[i][1]]
  else:
    aoki+=B[diff[i][1]]

print(taka-aoki)

Measured memory_bytes: 30056
#include<iostream>
using namespace std;
int main()
{
	int a[5000], b[5000];
	int na, nb;
	int cnt;
	int max = 0;
	int i, j, k;
	cin >> na >> nb;
	for (i = 0;i<na;i++)
	{
		cin >> a[i];
	}
	for (i = 0;i<nb;i++)
	{
		cin >> b[i];
	}
	for (i = 0;i<nb;i++)
	{
		if (nb - i <= max) break;
		j = i;
		cnt = 0;
		for (k = 0;k<na;k++)
		{
			if (b[j] == a[k])
			{
				j++;
				cnt++;
				if ((na - k) - 1 + cnt <= max) break;
			}
		}
		if (max<cnt)
		{
			max = cnt;
		}
	}
	cout << max << endl;
	return 0;
}

Measured memory_bytes: 3168
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << fixed << setprecision(8) << pow((pow((x1 - x2), 2.0) + pow((y1 - y2), 2.0)), 0.5) << endl;
}


Measured memory_bytes: 3480
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define pb push_back
#define ld long double
#define mk make_pair
#define ull unsigned long long
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
int main()
{
    fastIO;
    ll n;
    cin>>n;
    string str;
    cin>>str;
    vector<vector<ll>>v(10);
    ll val,val1,x,y;
    for(int i=0;i<n;i++)
    {
        val=str[i]-'0';
        v[val].pb(i);
    }
    ll ans=0;
    for(int i=0;i<10;i++)
    {
        if(v[i].size()>0)
        {
            x=v[i][0];
            for(int j=0;j<10;j++)
            {
                if(lower_bound(v[j].begin(),v[j].end(),x+1)!=v[j].end())
                {
                    y=lower_bound(v[j].begin(),v[j].end(),x+1)-v[j].begin();
                    val=v[j][y];
                    for(int k=0;k<10;k++)
                    {
                        if(lower_bound(v[k].begin(),v[k].end(),val+1)!=v[k].end())
                        {
                            ans++;
                        }
                    }
                }
            }
        }
    }
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define int long long
using namespace std;
int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

signed main(){
    int N,K;
    cin >> N >> K;
    
    int h[N];
    for(int i=0;i<N;i++){
        cin >> h[i];
    }
    
    sort(h,h+N);
    int ans = MOD;
    for(int i=0;i<=N-K;i++){
        ans = min(ans,h[i+K-1]-h[i]);
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024