akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
static const int MAX = 10000;

bool is_prime(int n) {
  if (n == 1 || (n != 2 && n % 2 == 0))
    return false;
  for (int i = 3; i <= sqrt(n); i += 2) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}

int main() {
  int data[MAX];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> data[i];

  int count = 0;
  for (int i = 0; i < n; i++)
    if (is_prime(data[i]))
      count++;
  cout << count << endl;
}

Measured memory_bytes: 3104
/*  
    Talkin' to myself and feelin' old
    Sometimes I'd like to quit, nothin' ever seems to fit
    Hangin' around, nothin' to do but frown
    Rainy days and Mondays always get me down
    _________________________
    _________________________
    936 Hours of Solitude
    Quarantine_Day : 39
*/

#include<bits/stdc++.h>

using namespace std;

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

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<int>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define REP(i,n)        for(int i = (int)(0); i < (int)(n); i++)
#define FOR(i, a, b)    for(int i = (int)a; i <= (int)b; i++)    

#define MAX 90

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

    int a, b; cin>>a>>b;
    string s; cin>>s;
    bool flag = true;
    REP(i, s.size()){
        if(s.size() > (a + b + 1) || s.size() < (a + b + 1)){
            flag = false;
            break;
        }
        if(i == a){
            if(s[i] != '-'){
                flag = false;
                break;
            }
        }
        else if(s[i] >= '0' && s[i] <= '9') continue;
        else{
            flag = false;
            break;
        }
    }
    cout<<(flag?"Yes\n":"No\n");

    return 0;
}


Measured memory_bytes: 256
N = int(input())
if N == 1:
    print("1")
elif N == 2 or N == 3:
    print("2")
elif 4 <= N and N < 8:
    print("4")
elif 8 <= N and N < 16:
    print("8")
elif 16 <= N and N < 32:
    print("16")
elif 32 <= N and N < 64:
    print("32")
else:
    print("64")


Measured memory_bytes: 9112
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
#include<utility>

using namespace std;

bool isK(string s) {
  for(int i = 0; i < s.size() / 2; i++) if(s[i] != s[s.size() - 1 - i]) return false;
  return true;
}

int main() {
  string s;
  cin >> s;
  if(isK(s)) {
    cout << 0 << endl;
    return 0;
  }
  string ss;
  for(int i = 0; i < s.size(); i++) if(s[i] != 'x') ss.push_back(s[i]);
  if(!isK(ss)) {
    cout << -1 << endl;
    return 0;
  }
  int index = s.size() - 1, ans = 0;
  for(int i = 0; i <= index; i++) {
    if(s[i] == s[index]) {
      index--;
      continue;
    }
    if(s[i] == 'x') {
      ans++;
      continue;
    }
    if(s[index] == 'x') {
      ans++;
      index--;
      i--;
      continue;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    
    int r[n];
    
    for(int i = 1; i <= n; i++) {
        int a;
        cin >> a;
        
        r[a-1] = i;
    }
    
    for(int i = 0; i < (n-1); i++) {
        cout << r[i] << " ";
    }
    cout << r[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
const int MAXN = 200045;
char s[MAXN*10+10];
int quickmod(int a,int b,int mod){
    int dd = 1;
    while(b){
        if(b&1) dd = 1ll*dd*a%mod;
        a= 1ll*a*a%mod;
        b/=2;
    }
    return dd%mod;
}
int dfs(int num){
    if(num==0)
        return 0;
    int cnt = 0 ;
    int temp=num;
    while(temp){
        if(temp&1)cnt++;
        temp/=2;
    }
    return 1+dfs(num%cnt);
}
int main()
{
    //cout << quickmod(2,2,14) << endl;
    //cout << 1%-1 << endl;
    int n;
    cin >> n;
    cin >> s;
    int cnt = 0 ;
    for(int i=0;i<n;i++){
        if(s[i]=='1')
            cnt++;
    }
    int num1 =0 ;
    int num2= 0 ;
    for(int i=0;i<n;i++){
        if(cnt-1!=0){
            num1=(num1*2+s[i]-'0')%(cnt-1);
        }
        num2=(num2*2+s[i]-'0')%(cnt+1);
    }
    for(int i=0;i<n;i++){
        if(s[i]=='1'){
            if(cnt-1==0){
                cout << 0 << endl;
            }
            else
                cout << 1+dfs(((num1-quickmod(2,n-i-1,cnt-1))%(cnt-1)+cnt-1)%(cnt-1)) << endl;
        }
        else
            cout << 1+dfs((num2+(quickmod(2,n-i-1,cnt+1))%(cnt+1))%(cnt+1)) << endl;
    }
    return 0;
}


Measured memory_bytes: 3780
#include <iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include<iomanip>

using namespace std;
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define i64 int64_t
#define tos(x) to_string(x)

int main() {
	string n;
	cin >> n;
	ff(i, 0, n.size() / 2 + 1) {
		if (n[i] != n[n.size() - 1 - i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>

#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/range/numeric.hpp>

#ifdef _MSC_FULL_VER
#include"randomizer.hpp"
#include"debug_print.hpp"
#endif

#include<cstdlib>
#include<ctime>

namespace lib
{
	template<class T>using pair = std::pair<T, T>;
	template<class T>constexpr T pow(T base, std::uint64_t p)
	{
		T ret = T(1);
		for (std::uint64_t i = 0; i <= 63; ++i)
		{
			if (((1ull << i) & p) != 0)
			{
				ret *= base;
			}
			base *= base;
		}
		return ret;
	}
	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

	struct union_find
	{
		std::vector<int> upper;
		union_find(std::size_t size):upper(size, -1) {}

		int group(int index)
		{
			if (upper[index] == -1)
			{
				return index;
			}
			else
			{
				return upper[index] = group(upper[index]);
			}
		}

		bool merge(int x, int y)
		{
			auto gx = group(x);
			auto gy = group(y);
			if (gx != gy)
			{
				upper[gx] = gy;
				return true;
			}
			return false;
		}

		auto get()
		{
			std::map<int, std::set<int>> ret;
			for (int i = 0; i < upper.size(); ++i)
			{
				ret[group(i)].emplace(i);
			}
			return ret;
		}

		auto tops()
		{
			std::set<int> ret;
			for (int i = 0; i < upper.size(); ++i)
			{
				ret.emplace(group(i));
			}
			return ret;
		}

		bool is_same_group(int x, int y)
		{
			return group(x) == group(y);
		}
	};
}

namespace out
{
	namespace detail
	{
		template<class>struct void_out
		{
			typedef void type;
		};
		template<class T>auto write(std::ostream& ost, T const& val)
			->typename void_out<decltype(ost << val)>::type
		{
			ost << val;
		}
		template<class T, class... Ts>void write(std::ostream& ost, T const& val, Ts const&... nexts)
		{
			write(ost, val);
			ost << " ";
			write(ost, nexts...);
		}
	}
	void write_line()
	{
		std::cout << std::endl;
	}
	template<class...Ts>void write_line(Ts const&... args)
	{
		detail::write(std::cout, args...);
		write_line();
	}
	template<class Range>void write_range(Range const& rng)
	{
		for (auto const& v : rng)
		{
			write_line(v);
		}
	}
}

namespace adaptor = boost::adaptors;

void Main()
{
	int A, B, C;
	std::cin >> A >> B >> C;
	int doku = std::min(C, A + B + 1);
	out::write_line(doku + B);
}

int main()
{
	std::cin.tie(nullptr);
	std::cin.sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 256
S = input()

A = 'gp' * (len(S)//2)
if len(S) % 2 == 1:
  A += 'g'
ans = 0
for i in range(len(S)):
  if S[i] == 'p' and A[i] == 'g':
    ans -= 1
  elif S[i] == 'g' and A[i] == 'p':
    ans += 1
print(ans)

Measured memory_bytes: 40048
/* template.cpp {{{ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)(s))
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)(s))
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
/* }}} */

using T = array<int, 4>;

int n;
T c[400];
map<T, int> d;

T rotate(T a){
  rep(i, 3) swap(a[i], a[i + 1]);
  return a;
}

T normalize(T a){
  T res = a;
  rep(i, 4){
    chmin(res, a);
    a = rotate(a);
  }
  return res;
}

int main(){
  cin >> n;
  rep(i, n) rep(j, 4) cin >> c[i][j];
  rep(i, n) c[i] = normalize(c[i]);
  rep(i, n){
    d[normalize(c[i])] = 0;
    rep(j, 4){
      if (c[i] == normalize(c[i])) d[normalize(c[i])]++;
      c[i] = rotate(c[i]);
    }
  }

  map<T, int> s;
  rep(i, n) s[c[i]]++;

  ll res = 0;

  rep(i, n) rep(j, i){
    s[c[i]]--;
    s[c[j]]--;
    
    rep(k, 4){
      T b[4] = {
        normalize({c[i][1], c[i][0], c[j][1], c[j][0]}),
        normalize({c[i][2], c[i][1], c[j][0], c[j][3]}),
        normalize({c[i][3], c[i][2], c[j][3], c[j][2]}),
        normalize({c[i][0], c[i][3], c[j][2], c[j][1]})
      };

      ll t = 1;
      rep(l, 4){
        t *= s[b[l]] * d[b[l]];
        s[b[l]]--;
      }

      res += t;

      rep(l, 4) s[b[l]]++;
      c[j] = rotate(c[j]);
    }
    
    s[c[i]]++;
    s[c[j]]++;
  }

  cout << res / 3 << endl;
}


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

using ll = long long;
using p = pair<ll, ll>;
constexpr ll INF = 1LL << 62;

int main(void) {
  ll N;
  cin >> N;
  vector<ll> A, B;
  for (ll i = 0; i < N; i++) {
    ll a, b;
    cin >> a >> b;
    A.emplace_back(a);
    B.emplace_back(b);
  }

  sort(A.begin(), A.end());
  sort(B.begin(), B.end());

  if (N % 2) {
    ll amid = A[A.size() / 2];
    ll bmid = B[B.size() / 2];
    cout << bmid - amid + 1 << endl;
  } else {
    ll amid = A[A.size() / 2] + A[A.size() / 2 - 1];
    ll bmid = B[B.size() / 2] + B[B.size() / 2 - 1];
    cout << bmid - amid + 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 6556
# 2020/08/16
# AtCoder Beginner Contest 030 - A

# Input
h = int(input())
w = int(input())
n = int(input())

# Calc
ans = n // max(h, w)
if n % max(h, w) > 0:
    ans = ans + 1

# Output
print(ans)


Measured memory_bytes: 9156
#include<bits/stdc++.h>
#define ll long long

using namespace std;

ll n,a[100010],x,ans;

int main()
{
	scanf("%lld%lld",&n,&x);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]+a[i-1]>x)
		{
			ans+=(a[i]+a[i-1])-x;
			a[i]-=(a[i]+a[i-1])-x;
		}
		if(a[i]>x)
		{
			ans+=(a[i]-x);
			a[i]-=(a[i]-x);
		}
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <map>
#include <set>
using namespace std;

int main()
{
	string s;
	cin >> s;

	string t = "";
	for (size_t i = 0; i < s.size(); i++) {
		switch (s[i]) {
		case '0':
			t += "0";
			break;
		case '1':
			t += "1";
			break;
		case 'B':
			if (t.size() > 0)
				t.pop_back();
			break;
		}
	}

	cout << t << endl;

	return 0;
}

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

int main() {
  int T, A, B, C;
  cin >> T >> A >> B;
  C = A*T;

  if (C < B) {
    cout << C << endl;
  }
  else if (C == B) {
      cout << C << endl;
    }
  else {
    cout << B << endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // TODO 自動生成されたメソッド・スタブ
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        System.out.println(Math.max(A + B, Math.max(A - B, A * B)));
    }
}

Measured memory_bytes: 22740
H, W, K = map(int, input().split())

bit = []
for i in range(1 << (W - 1)):
    flag = True
    for j in range(W - 1):
        if i & 1 << j and i & 1 << (j + 1):
            flag = False
            break

    if flag:
        bit.append(i)

MOD = 10 ** 9 + 7
dp = [[0] * W for i in range(H + 1)]
dp[0][0] = 1
for i in range(H):
    for j in range(W):
        for k in bit:
            ne = j
            if k & 1 << j:
                ne = j + 1
            elif j - 1 >= 0 and k & 1 << (j - 1):
                ne = j - 1

            dp[i + 1][ne] += dp[i][j]
            dp[i + 1][ne] %= MOD

print(dp[H][K - 1])

Measured memory_bytes: 3064
#include <algorithm>
#include <array>
#include <iostream>
#include <vector>

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

#define INF 1000000000

using namespace std;

int main() {
    int A, B;
    cin >> A >> B;

    int ans = 0;
    for (int i = A; i <= B; i++) {
        auto str1 = to_string(i);
        auto str2 = str1;

        reverse(ALL(str2));

        if (str1 == str2) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
using namespace std;
typedef long long ll;
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
 
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b){
	ll g=gcd(a,b);
	return a/g*b;
}
 
ll digitsum(ll a){
	ll x=0;
	while(a>0){
		x+=a%10;
		a/=10;
	}
	return x;
}
int main(){
	ll x,a,b;
	cin>>x>>a>>b;
	ll s=abs(x-a);
	ll t=abs(x-b);
	if(s<t)cout<<'A'<<endl;
	else cout<<'B'<<endl;
}

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

const int INF = 1001001001;
const int NV=100100;

int main() {
  int N;
  vector<int> a;
  a={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cin>>N;
  cout<<a[N-1]<<endl;
}


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

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

const LL  INF=1<<31;
const LL MOD=1000000007;



int main(){
     int a,b,c,d;
     cin>>a>>b>>c>>d;
     LL x,y;
     x=a*b;
     y=c*d;
     cout<<max(x,y)<<endl;
}

Measured memory_bytes: 256
# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
ans = 0
now = 1
for i in range(N):
    if now == A[i]:
        now += 1
    else:
        ans += 1
if now == 1 and N != 1:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 24744
#include<stdio.h>

int main(void){
  int railroad[10]={};
  int car;
  int i=0;
  while((scanf("%d",&car))!=EOF){
    if(car==0){//出ていく
      i--;
      printf("%d\n",railroad[i]);
    }else{//入ってくる
      railroad[i]=car;
      i++;
    }
  }

  return 0;
}



Measured memory_bytes: 2028
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("atcoder-problems/abc108_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  int x3 = x2 - (y2 - y1);
  int y3 = y2 + (x2 - x1);
  int x4 = x1 - (y2 - y1);
  int y4 = y1 + (x2 - x1);

  printf("%d %d %d %d", x3, y3, x4, y4);
}

Measured memory_bytes: 256
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(stdin.readLine().replaceAll(" ", ""));
		int r = (int)Math.floor(Math.sqrt(n));
		String ans = n == r*r ? "Yes" : "No";
		System.out.println(ans);
	}

}

Measured memory_bytes: 21972
N, M = map(int, input().split())
from collections import*
c = Counter(map(int, input().split()))
for _ in range(M):
    B, C = map(int, input().split())
    c[C] = c[C] + B if C in c else B
s = 0
for i in sorted(c.items())[::-1]:
    m = min(i[1], N)
    s += i[0] * m
    N -= m
print(s)


Measured memory_bytes: 113736
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
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; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;


signed main(){
	//cout << fixed << setprecision(10);
	ll n; cin >> n;
	ll sum_gcd;
	ll m = 0;
	map<ll,ll> mp;
	bool ans = 1;
	vector<bool> vec(1001000,false);
	rep(i,0,n){
		ll a; cin >> a;
		if(mp[a] > 0 && a != 1){
			ans = 0;
		}
		mp[a]++;
		vec[a] = 1;
		if(i == 0)sum_gcd = a;
		else sum_gcd = __gcd(a,sum_gcd);
		chmax(m,a);
	}
	for(ll i = 2;i <= m;i++){
		ll cnt = 0;
		ll j = i;
		bool ok = true;
		while(j <= m){
			if(vec[j])cnt++;
			if(cnt > 1){
				ok = 0;
				break;
			}
			j += i;
		}
		if(!ok){
			ans = 0;
			break;
		}
	}
//	cout << sum_gcd << endl;
	if(ans)cout << "pairwise coprime" << endl;
	else if(sum_gcd == 1)cout << "setwise coprime" << endl;
	else cout << "not coprime" <<endl;


	return 0;
}


Measured memory_bytes: 66160
def dimensional_world_tale(x, y, xs, ys):
    xs = sorted(xs)
    maxx = xs[-1]
    if not(x < maxx <= y):
        return "War"
    ys = sorted(ys)
    miny = ys[0]
    if not(x < miny <= y):
        return "War"
    if not(maxx < miny):
        return "War"
    return "No War"

n, m, x, y = map(int, input().split())
xs = map(int, input().split())
ys = map(int, input().split())
print(dimensional_world_tale(x, y, xs, ys))


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int n;
  int s[100];
  
  cin>>n;
  for(int i=0;i<n;i++){cin>>s[i];}
  int maxScore=n;
  while(1){
      int kazu=0;
      for(int i=0;i<n;i++){
          if(maxScore<=s[i]){kazu++;}
      }
      if(maxScore<=kazu){
          cout<<maxScore<<endl;
          break;
      }
      maxScore--;
  }
  return 0;
}


Measured memory_bytes: 3112
import itertools
def main():
    n=int(input())
    A=[int(i) for i in input().split()]
    rui = list(itertools.accumulate(A))
    mi = 300000000000
    ind = n-1

    for i in range(n-1):
        mi=min(abs(rui[i]-(rui[ind]-rui[i])),mi)

    print(mi)

if __name__ == '__main__':
    main()


Measured memory_bytes: 101460
use std::io::Write;

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let n: usize = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.parse().unwrap()
    };

    let a: Vec<usize> = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.split_whitespace().map(|x| x.parse().unwrap()).collect()
    };
    let b: Vec<usize> = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.split_whitespace().map(|x| x.parse().unwrap()).collect()
    };
    let c: Vec<usize> = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.split_whitespace().map(|x| x.parse().unwrap()).collect()
    };

    let mut ans = 0;
    for i in 0..n {
        ans += b[a[i] - 1];

        if i >= 1 && a[i - 1] + 1 == a[i] {
            ans += c[a[i - 1] - 1];
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

using namespace std;
using ll = long long;



int main()
{

    ll X;
    cin >> X;

    int num = 10000;
    ll table[num];
    
    for(int i = 0;i<num;i++){
        table[i] = pow(i,5);
    }

    ll ans_a = 0;
    ll ans_b = 0;
    for(int a = 0;a < num;a++){
        int hugou = 0;
        ll nokori = X - table[a];
        if(nokori > 0) hugou = -1;
        else hugou = 1;
        
        for(int b = 0;b < num;b++){
            if( table[a] - hugou * table[b] == X){
                ans_a = a;
                ans_b = hugou * b;
                cout << ans_a << " "<< ans_b << endl;
                return 0;
            }else if( table[b] > abs(nokori)){
                break;
                
            }
        }
    }

    return 0;
}


Measured memory_bytes: 4272
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n,a2=0,a4=0;
    int a[100001];
    cin >>n;
    for(int i=0;i<n;i++){
        cin >>a[i];
        if(a[i]%2==0){
            a2++;
            if(a[i]%4==0){
                a4++;
            }
        }
    }
    a2-=a4;
    if(a4+(a2/2)>=n/2)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}


Measured memory_bytes: 768
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>

using namespace std;

typedef pair<long long, long long> pl;

long long N, M, K,a,b,c,d,e,H,W;
long long A,AB,ABC,Z;
//long long t[200001] = {};
bool f[1000][1000] = {};
bool ff;
string S,SS;
set <long long>sll;
pl buf;
vector <pl>vpl;

int main() {
	cin >> S;
	K = 1000000007;
	A = 0;
	AB = 0;
	ABC = 0;
	Z = 1;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'A') {
			A+=Z;
		}
		if (S[i] == 'B') {
			AB += A;
		}
		if (S[i] == 'C') {
			ABC += AB;
		}
		if (S[i] == '?') {
		
			ABC *= 3;
			ABC += AB;
			AB *= 3;
			AB += A;
			A *= 3;
			A+=Z;
			Z *= 3;
		}
		A %= K;
		AB %= K;
		ABC %= K;
		Z %= K;
	}

	cout << ABC << endl;

	return 0;
}


/*int main() {
	cin >> N>>M;

	for (int i = 1; i <= N; i++) {
		cin >> A[i][0] >> A[i][1];
		A[i][2] = (A[i][1] + A[i][0] * 100 * i);
		A[i][3] = A[i][2] / A[i][0];
	}
	ff = false;
	a = 0;
	b = 0;
	c = 0;
	while (ff == false) {
		
		for (int i = 1; i <= N; i++) {
			if (A[i][3] >= N * 100) {
				if (A[i][2] >= M) {


				}

			}


		}

	}

	
	cout << c << endl;

	return 0;
}*/

Measured memory_bytes: 512
#
# abc090 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """11009 11332"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """31415 92653"""
        output = """612"""
        self.assertIO(input, output)


def resolve():
    A, B = map(int, input().split())
    ans = 0
    for i in range(A, B+1):
        s = str(i)
        if s[0] == s[-1] and s[1] == s[-2]:
            ans += 1
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 16124
package main

import "fmt"

func main() {
	var H, W int
	fmt.Scanf("%d %d", &H, &W)
	if H == 1 || W == 1 {
		fmt.Println(1)
		return
	}
	var h int
	if H%2 == 0 {
		h = H / 2
		fmt.Println(h * W)
		return
	}
	h = (H - 1) / 2
	var w int
	if W%2 == 0 {
		w = W / 2
	} else {
		w = (W-1)/2 + 1
	}
	fmt.Println(h*W + w)
}


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

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}
std::vector<std::vector<long long>> c(9-0+1, std::vector<long long>(9-0+1));
ll INF = numeric_limits<ll>::max();

ll sp(ll s) {
  ll d[10];
  for(int i=0; i<10; i++) d[i] = INF;
  d[s] = 0;
  while(true) {
    bool update = false;
    for(int i=0; i<10; i++) {
      for(int j=0; j<10; j++) {
	if(d[i] != INF and d[j] > d[i]+c[i][j]) {
	  d[j] = d[i] + c[i][j];
	  update = true;
	}
      }
    }
    if(!update) break;
  }
  return d[1];
}

void solve(long long H, long long W, std::vector<std::vector<long long>> A){
  ll d[10];
  for(int i=0; i<10; i++) {
    d[i] = sp(i);
  }
  ll ans = 0;
  for(int i=0; i<H; i++) {
    for(int j=0; j<W; j++) {
      if(A[i][j] != -1 and A[i][j] != 1) {
	ans += d[A[i][j]];
      }
    }
  }
  std::cout << ans << std::endl;
}

int main(){
    long long H;
    scanf("%lld",&H);
    long long W;
    scanf("%lld",&W);

    for(int i = 0 ; i < 9-0+1 ; i++){
        for(int j = 0 ; j < 9-0+1 ; j++){
            scanf("%lld",&c[i][j]);
        }
    }
    std::vector<std::vector<long long>> A(H, std::vector<long long>(W));
    for(int i = 0 ; i < H ; i++){
        for(int j = 0 ; j < W ; j++){
            scanf("%lld",&A[i][j]);
        }
    }
    solve(H, W, std::move(A));
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
int a[2][230];
//int t[100005] , x[100005] , y[100005];
int main(){
	dhoom;
	vector< int > a;
	int n;
	cin >> n;
	int sum = 0 , si = 0;
	for(int i = 0,x ; i < n ;i++){
			cin >> x;
			a.push_back(x);
			sum += x;
	}
	sort(a.rbegin() , a.rend());
	for(int i = 0 ; i < n ; i += 2){
		si += a[i];
	}
	cout << abs(sum - 2 * si) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main() {
    int N;
    cin >> N;
    ull mod = 1000000007;
    if (N == 1) {
        cout << 0 << endl;
    }
    else if (N == 2) {
        cout << 2 << endl;
    }
    else {
        ull ans = 1;
        for (int i=0; i<N; i++) {
            ans *= 10;
            if (ans>=mod) {
                ans %= mod;
            }
        }
        ull del = 1;
        for (int i=0; i<N; i++) {
            del *= 9;
            if (del>=mod) {
                del %= mod;
            }
        }
        ull plus = 1;
        for (int i=0; i<N; i++) {
            plus *= 8;
            if (plus >= mod) {
                plus %= mod;
            }
        }
        del = del * 2;
        ans = ans + mod + mod - del + plus;
        ans %= mod;
        cout << ans << endl;
    }
}

Measured memory_bytes: 3632
n,m=gets.split(' ').map(&:to_i)
#h=gets.split(' ').map(&:to_i)
#tajigen = Array.new(4) { Array.new(2,0) }

flag = Array.new(n+1,0)
ac=0
wa=0
wa_array = Array.new(n+1,0)
for i in 0..m-1
  string = gets.split(' ')
  pro = string[0].to_i
  result = string[1].to_s

  if result == "AC"
    flag[pro]=1
    wa+=wa_array[pro]
    wa_array[pro]=0
  elsif result=="WA" && flag[pro] == 0
    wa_array[pro]+=1
  end


end

for i in 0..n
  if flag[i]==1
    ac+=1
  end
end

puts ac
puts wa

Measured memory_bytes: 3324
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    string t;
    cin >> t;
    int n = t.size();
    string ans = t;
    for (int i=0; i<n; i++) {
        if (ans[i] == '?') ans[i] = 'D';
    }


    cout << ans << endl;
}

Measured memory_bytes: 3488
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i=0; i<n; i++)
#define loop(i, j, n) for(int i=j; i<n; i++)
using namespace std;
int main()
{
	bool ans = true;
	int n, m, X, Y;
	cin >> n >> m >> X >> Y;
	vector<int> x(n);
	vector<int> y(m);

	rep(i,n) cin >> x[i];
	rep(i,m) cin >> y[i];

	int k = *max_element(x.begin(), x.end());
	int t = *min_element(y.begin(), y.end());

	for(int i=X+1; i<=Y; i++){
		if(k < i && t >= i){
			goto Rooped;
		}
	}
	ans = false;

Rooped:
	if(ans) cout << "No War" <<endl;
	else cout << "War" <<endl;
	return 0;
}


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

int main() {
    string Ss[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string S;
    cin >> S;
    int d = 7;
    for (int i = 0; !(S == Ss[i]); i++) {
        d--;
    }
    cout << d;
    return 0;
}

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

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
const int INF = 1001001001;
const ll mod = 1e9+7;

int main() {
    int n,m; // 数列のサイズとクエリの数
    cin>>n>>m;

    vector<int> b(m);
    vector<int> a(m);

  //  vector<int> v(m);
    vector<int> v={2,5,5,4,5,6,3,7,6};
    rep(i,m){
      //int a1;
      cin>>b[i];
    }
    sort(b.rbegin(),b.rend());

    rep(i,m) a[i]=v[(b[i]-1)];
    vector<int> dp(20000);
    rep(i,20000)dp[i]=-INF;
    dp[0]=0;
    rep(i,n){
      rep(j,m){
        dp[i+a[j]]=max(dp[i]+1,dp[i+a[j]]);
      }
    }
    int D=dp[n];
    vector<int> ans(D);
    int res=n;


    rep(i,D){
      rep(j,m){
        if (res-a[j]<0) continue;
        if (dp[res-a[j]]+1==dp[res]){
          ans[i]=b[j];
          res-=a[j];
          break;
        }

      }
    }
    rep(i,D)cout<<ans[i];



}


Measured memory_bytes: 384
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var X = cin.ReadInt;
            var ans = "No";
            for (int i = 0; i <= X/4; ++i)
                for (int j = 0; j <= X/7; ++j)
                        if (4 * i + 7 * j == X)
                            ans = "Yes";
            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 11220
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  string str;
  int flag[3],cnt=0;
  for(int i=0;i<3;i++)flag[i]=0;
  cin>>str;
  for(int i=0;i<3;i++){
  	if(str[i]=='a')flag[0]=1;
  	else if(str[i]=='b')flag[1]=1;
  	else if(str[i]=='c')flag[2]=1;
  }
  for(int i=0;i<3;i++){
  	if(flag[i]==1)cnt++;
  }
  if(cnt==3)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,v[2010][2010],mp[2010],a[2010],ru[2010];
priority_queue<int>q;
vector<int>zh[2010];
void dfs(int x){
	int i;
	mp[x]=1;
	for(i=1;i<=n;i++)if(!mp[i]&&v[x][i]){
		ru[i]++;
		zh[x].push_back(i);
		dfs(i);
	}
}
void topsort(){
	int i,j,x;
	for(i=1;i<=n;i++)if(!ru[i])q.push(i);
	while(!q.empty()){
		x=q.top();
		q.pop();
		printf("%d ",a[x]);
		for(i=0;i<zh[x].size();i++)q.push(zh[x][i]);
	}
}
int gcd(int x,int y){
	if(!y)return x;
	return gcd(y,x%y);
}
int main(){
	int i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for(i=1;i<=n;i++)
	 for(j=i+1;j<=n;j++)if(gcd(a[i],a[j])!=1)v[i][j]=v[j][i]=1;
	for(i=1;i<=n;i++)if(!mp[i])dfs(i);
	topsort();
}

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

using namespace std;

int main(){
	int x,y, res = 0;
	cin >> x >> y;
	switch(x){
		case 1:
			res += 300000;
			break;
		case 2:
			res += 200000;
			break;
		case 3:
			res += 100000;
			break;
	}
	switch(y){
		case 1:
			res += 300000;
			break;
		case 2:
			res += 200000;
			break;
		case 3:
			res += 100000;
			break;
	}
	if(res == 600000){
		res += 400000;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <chrono>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <unordered_set>
#include <vector>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <fstream>
#include <functional>
#include <map>
#include <deque>
#include <string.h>

#define MAX(a, b) (a > b ? a : b)
#define MIN(a, b) (a < b ? a : b)
#define ABS(a) (a < 0 ? -a : a)
#define YesNo(flag) (flag ? "Yes\n" : "No\n")
#define YESNO(flag) (flag ? "YES\n" : "NO\n")

constexpr auto NMAX = (int)2e5 + 20;
constexpr auto INF_ULL = 18446744073709551615;
constexpr auto INF_INT = 2147483647;
using namespace std;

typedef unsigned long long ull;

int n;

int main()
{
	cin >> n;
	if (n % 10 == 3) {
		cout << "bon\n";
	}
	else if (n % 10 == 0 || n % 10 == 1
		|| n % 10 == 6 || n % 10 == 8) {
		cout << "pon\n";
	}
	else {
		cout << "hon\n";
	}
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  cin >> n >> t;
  int c, tt;
  int minn =1010;
  vector<pair<int, int>> vec(n);
  for(int i=0; i<n; i++){
    cin >> c >> tt;
    vec[i] = make_pair(c, tt);
    if(vec[i].second <= t){
      minn = min(minn, vec[i].first);
    }
  }
  if(minn == 1010){
    cout << "TLE" << endl;
  }
  else{
    cout << minn << endl;
  }
}

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

public class Main{

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        // input
        int[] antennas = new int[5];
        for(int i = 0; i < 5; i++){
            antennas[i] = scan.nextInt();
        }
        int k = scan.nextInt();

        // search
        String answer = "Yay!";
        for(int i = 0; i < 4; i++){
            for(int j = i + 1; j < 5; j++){
                if(antennas[j] - antennas[i] > k){
                    answer = ":(";
                }
            }
        }
        
        // answer
        System.out.println(answer);


    }
}

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

int main() {
    long L, R;
    cin >> L >> R;

    long range = min(R, L + 2019) - L;
    int min_num = 2019;
    for(long i = 0;i < range + 1;i++)
    {
        for(long j = i + 1;j < range + 1;j++)
        {
            unsigned long long number = (L + i) * (L + j);
            number %= 2019;
            min_num = min((int) number, min_num);
        }
    }
    cout << min_num << endl;
 }



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

const int maxn = 1e5+5;
int N,M;
vector<int> edges[maxn], toporder;
int dp[maxn],vis[maxn];

void dfs(int node){
    vis[node] = 1;
    int n = edges[node].size();
    for(int i = 0; i < n; i++){
        int v = edges[node][i];
        if(!vis[v])dfs(v);
    }
    toporder.push_back(node);
}

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>N>>M;
    int x,y;
    for(int i = 0; i<M; i++){
        cin>>x>>y;
        edges[x].push_back(y);
    }
    
    
    memset(vis, 0, sizeof(vis));
    for(int i = 1; i <= N; i++)if(!vis[i])dfs(i);
    reverse(toporder.begin(), toporder.end());
    
    for(auto node : toporder){
        for(auto v: edges[node]){
            dp[v] = max(dp[v], dp[node] +1);
        }
    }
    
    int ans = 0;
    for(auto i:dp)ans = max(ans, i);
    cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 9080
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる





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

  char x;
  rep(i,n){
    cin>>x;
    if(x=='Y'){
      cout << "Four" << endl;
      return 0;
    }
  }


  cout << "Three" << endl;
}

Measured memory_bytes: 256
use std::str::FromStr;
use std::io::*;
use std::cmp::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(&mut i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: &mut R, o: &mut W) {
    let mut i = AtRead::from(i);
    let n = i.read::<usize>();
    let mut a = Vec::new();
    for _ in 0..2 {
        a.push(i.read_vec::<usize>(n));
    }
    a[1][0] += a[0][0];
    for n in 1..n {
        a[0][n] += a[0][n - 1];
        a[1][n] += max(a[1][n - 1], a[0][n]);
    }

    writeln!(o, "{}", a[1][n - 1]).unwrap();
}
struct AtRead<'a, R: BufRead + 'a> {
    r: &'a mut R,
    s: String,
}

impl<'a, R: BufRead + 'a> AtRead<'a, R> {
    fn from(r: &'a mut R) -> Self {
        AtRead {
            r: r,
            s: String::new(),
        }
    }
    fn next(&mut self) -> &str {
        self.s.clear();
        self.r.read_line(&mut self.s).unwrap();
        self.s.trim()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.next().parse().ok().unwrap()
    }

    fn read_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        self.next()
            .split(' ')
            .take(n)
            .map(|x| x.parse().ok().unwrap())
            .collect()
    }
}


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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int d[] = new int[N];
		for (int i = 0; i < d.length; i++) {
			d[i] = sc.nextInt();
		}
		Arrays.sort(d);
		if (d[N/2-1] == d[N/2]) {
			System.out.println(0);
		} else {
			System.out.println(d[N/2] - d[N/2-1]);
		}
	}
}


Measured memory_bytes: 49776
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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 main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int k;
	cin >> k;
	if(k <= 10){
		cout << k << endl;
		return 0;
	}
	queue<ll> que;
	for(int i = 1; i <= 9; i++) que.push(i);
	int cur = 10;
	while(!que.empty()){
		ll x = que.front();
		que.pop();
		ll r = x % 10;
		x *= 10;
		rep(i,10){
			if(abs(r - i) <= 1){
				if(cur++ == k){
					cout << x + i << endl;
					return 0;
				}
				que.push(x + i);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,a[5],b[5];
  cin>>n;
  for(ll i=0;i<5;i++){
    cin>>a[i];
    b[i]=a[i];
  }
  sort(a,a+5);
  ll u=ceil((double)n/a[0]);
  cout<<4+u<<endl;
}



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

int dp[46][100000];
bool done[46][100000];
int res = 45;
int x,k;
int main(){
	cin >> k;
	dp[0][0] = 1;
	
	for(int sum = 0;sum < 46;sum++){
		for(int mod = 0;mod < k;mod++){
			if(dp[sum][mod] == 0)continue;
			int x = mod;
			while(!done[sum][x]){
				done[sum][x] = true;
				dp[sum][x*10%k] = 1;
				x = x*10%k;
			}
		}
		for(int mod = 0;mod < k;mod++){
			if(dp[sum][mod] == 0)continue;
			if(mod == 0 && sum != 0){
				cout << sum << endl;
				return 0;
			}
			for(int dig = 1;dig < 10;dig++){
				if(sum + dig > 45)continue;
				dp[sum+dig][(mod*10+dig)%k] = 1;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 20864
#include <iostream>

#include <algorithm>

int main() {

	int N;
	int d[100];
	int mochi;

	std::cin >> N;

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

	std::sort(d, d + N);

	mochi = 1;
	for (int i = 1; i < N; i++) {
		if (d[i] != d[i - 1])mochi++;
	}
	
	std::cout << mochi;


	return 0;
}

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

int main(){
  int X, Y;
  cin >> X >> Y;

  int ans = 0;

  if(X == 1){
    ans += 300000;
  } else if (X == 2){
    ans += 200000;
  } else if (X == 3){
    ans += 100000;
  }

  if(Y == 1){
    ans += 300000;
  } else if (Y == 2){
    ans += 200000;
  } else if (Y == 3){
    ans += 100000;
  }

  if(X == 1 && Y==1){
    ans += 400000;
  }

  cout << ans << endl;
  
}

Measured memory_bytes: 384
#include <stdio.h>
#include <limits.h>

int main(void)
{
    int n;
    int i;
    long long int sum;

    scanf("%d", &n);
    sum = 1;
    for (i = n; i > 1; i--){

        sum *= i;
        //printf("<%lu>", sum);
    }
    printf("%lld\n", sum);
    return (0);
}


Measured memory_bytes: 2032
import java.util.*;
class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    final int N = sc.nextInt();
    final int K = sc.nextInt();
    int[] l = new int[N];
    for (int i = 0; i < N; i++)
      l[i] = sc.nextInt();
    Arrays.sort(l);

    int result = 0;
    for (int i = N-K; i < N; i++)
      result += l[i];

    System.out.println(result);
  }
}

Measured memory_bytes: 21716
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

x = I()

if x == 0:
    print(1)
else:
    print(0)

Measured memory_bytes: 65480
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()
}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}


// PD?D??P
// PDDDDDP
fn main(){
    let t = read_as_string();
    let t = t.replace('?', "D");
    println!("{}", t);
    //println!("{}", t.matches("DP").count() + t.matches("D").count());
}


Measured memory_bytes: 2372