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

int N;
vector<string> S;
int cnt_bxa, cnt_xa, cnt_bx;

void input_init(void) {
	cin >> N;
	S.resize(N);
	cnt_bxa = cnt_xa = cnt_bx = 0;
	for (int i = 0; i < N; ++i) {
		cin >> S[i];
		int len = S[i].length();
		if (S[i][0] == 'B' && S[i][len - 1] == 'A')
			++cnt_bxa;
		else if (S[i][0] == 'B')
			++cnt_bx;
		else if (S[i][len - 1] == 'A')
			++cnt_xa;
	}
}

int count_ab(void) {
	int cnt = 0;
	for (int i = 0; i < N; ++i) {
		int p = 0;
		while (p <= (int)S[i].length() - 2) {
			if (S[i][p] == 'A' && S[i][p + 1] == 'B') {
				++cnt;
				p += 2;
			}
			else
				++p;
		}
	}
	return cnt;
}

int add_check(void) {
	int cnt_1 = max(cnt_bxa - 1, 0);
	int cnt_2 = min(cnt_xa, cnt_bx);
	int cnt;
	if (cnt_bxa == 0)
		cnt = cnt_2;
	else {
		if (cnt_xa == 0 && cnt_bx == 0)
			cnt = cnt_1;
		else 
			cnt = cnt_bxa + cnt_2;
	}
	return cnt;
}

int main(void) {
	input_init();
	int normal_cnt = count_ab();
	int add_cnt = add_check();
	int ans = normal_cnt + add_cnt;

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i <= (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

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

	int N, X, Y;
	cin >> N >> X >> Y;

	vector<int> ans(N+5);

	repk(i,1,N-1) {
		repk(j, i+1, N) {
			int kyori = min(j - i, abs(X - i)+abs(Y - j)+1);
			ans[kyori]++;
		}
	}

	repk(i,1,N-1) {
		cout << ans[i] << endl;
	}


	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define pb push_back 
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ll long long
#define sc(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)

int main(int argc, char** argv) {
	int a;
	sc(a);
	cout<<a+a*a+a*a*a;
	return 0;
}

Measured memory_bytes: 3684
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#pragma region macro
#include <bits/stdc++.h>
typedef long long int64;
using namespace std;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const int64 INF = 1LL << 62;
const int inf = 1<<30;
const char bn = '\n';
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, const vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        os << "\n";
    }
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, pair<T,S> const&P){
    os << "(";
    os << P.first;
    os << " , ";
    os << P.second;
    os << ")";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
    os<<endl;
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, map<T,S> const&M){
    for(auto e:M){
        os<<e;
    }
    os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
#pragma endregion
//fixed<<setprecision(10)<<ans<<endl;

int find_max_idx(int r, vector<int64> const& A){
    int max_idx = 0;
    REP(i,r){
        if(A[i] > A[max_idx]){
            max_idx = i;
        }
    }
    return max_idx;
}

int64 rec(int64 L, map<int64,int>& D, map<int64,int64>& next_){
    auto ne = next_[L];

    if(D[ne] == 0) return 0;
    int64 res = rec(ne, D, next_);
    int64 tmp = D[ne];
    D[L] += tmp;
    D[ne] = 0;
    return res + tmp * (ne - L);
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<int64> A(N+1);
    REP(i,N) cin >> A[i+1];//番兵として0を入れる
    N++;
    map<int64,int> D;
    for(auto a:A){
        D[a]++;
    }

    auto B=A;
    sort(ALL(B));
    B.erase(unique(ALL(B)), B.end());
    map<int64,int64> next_;
    REP(i,B.size()-1){
        next_[B[i]] = B[i+1];
    }
    next_[B.back()] = -1;

    vector<int64> ans(N);
    // int max_idx = 0;
    vector<int> max_idxes = {0};
    REP(i,N){
        if(A[i] > A[max_idxes.back()]){
            max_idxes.emplace_back(i);
        }
    }
    reverse(ALL(max_idxes));
    REP(i,max_idxes.size()-1){
        // debug(L)
        int max_idx = max_idxes[i];
        int L_idx = max_idxes[i+1];
        int64 L = A[L_idx];
        ans[max_idx] = rec(L, D, next_);
        max_idx = L_idx;
    }   

    for(int i=1; i<N; i++){
        cout << ans[i] << bn;
    }
}

Measured memory_bytes: 27776
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using static System.Math;

namespace _20190420
{
    class Program
    {
        public static void Main(string[] args)
        {
            using (var sc = new SetConsole())
            {
                var ABC = GetArray<int>();
                int c = ABC[2];
                if (ABC[0] < ABC[1])
                {
                    if (ABC[0] > c || c > ABC[1])
                    {
                        CWrite("No");
                    }
                    else
                    {
                        CWrite("Yes");
                    }
                }
                else
                {
                    if (ABC[0] < c || c < ABC[1])
                    {
                        CWrite("No");
                    }
                    else
                    {
                        CWrite("Yes"); 
                    }
                }
            }
        }

        static void CWrite<T>(T str) => Console.WriteLine(str);
        static string GetString() => Console.ReadLine();
        static T[] GetArray<T>()
        {
            var t = typeof(T);
            var str = Console.ReadLine();
            if (t == typeof(string))
            {
                return (T[])(object)str.Split();
            }
            if (t == typeof(int))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            if (t == typeof(long))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            if (t == typeof(double))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            throw new NotSupportedException($"{t} is not supported.");
        }
    }

    class SetConsole : IDisposable
    {
        readonly StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
        public SetConsole()
        {
            sw.AutoFlush = false;
            Console.SetOut(sw);
        }
        public void Dispose()
        {
            Console.Out.Flush();
            sw.AutoFlush = true;
            Console.SetOut(sw);
        }
    }
    static class ExtentionsLibrary
    {
        public static T[] ToNumArray<T>(this string str)
        {
            var t = typeof(T);
            if (t == typeof(int))
            {
                return (T[])(object)str.Split().Select(int.Parse).ToArray();
            }
            if (t == typeof(long))
            {
                return (T[])(object)str.Split().Select(long.Parse).ToArray();
            }
            if (t == typeof(double))
            {
                return (T[])(object)str.Split().Select(double.Parse).ToArray();
            }
            throw new NotSupportedException();
        }
        public static int ToInt(this string str) => int.Parse(str);
    }
}


Measured memory_bytes: 13268
#include <algorithm>
#include <cstring>
#include <cstdio>
const int N=1005,inf=1000000000;
int f[N],g[5005],fst[N],nxt[N],a[N];
void addedge(int x,int y){
	nxt[y]=fst[x];fst[x]=y;
}
bool dfs(int x){
	for (int y=fst[x];y;y=nxt[y])
		if (!dfs(y)) return 0;
	memset(g,0,sizeof g);
	for (int y=fst[x];y;y=nxt[y])
		for (int i=a[x];i>=0;i--){
			int z=inf;
			if (i>=a[y]) z=g[i-a[y]]+f[y];
			if (i>=f[y]) z=std::min(z,g[i-f[y]]+a[y]);
			g[i]=z;
		}
	f[x]=g[a[x]];
	return f[x]<inf;
}
int main(){
	int n;
	scanf("%d\n",&n);
	for (int i=2;i<=n;i++){
		int p;
		scanf("%d",&p);
		addedge(p,i);
	}
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	if (dfs(1)) printf("POSSIBLE\n");
		else printf("IMPOSSIBLE\n");
}

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

int main() {
	int n,m,i,j,c,a=0;
	cin>>n;
		vector<string> s(n);
	for(i=0;i<n;i++){
		cin>>s.at(i);
	}
	cin>>m;
	vector<string> t(m);
	for(i=0;i<m;i++){
		cin>>t.at(i);
	}	
	for(i=0;i<n;i++){
		c=0;
		for(j=0;j<n;j++){
			if(s.at(i)==s.at(j))c++;
		}
		for(j=0;j<m;j++){
			if(s.at(i)==t.at(j))c--;
		}
		if(c>a)a=c;
	}
	cout<<a;
	
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;


int main(){
  int a[5];
  rep(i,5) cin >> a[i];
  int k;
  cin >> k;
  rep(i,5){
    for(int j = i+1; j < 5; j++){
      if(a[j] - a[i] > k){
        printf(":(\n");
        return 0;
      }
    }
  }
  printf("Yay!\n");
  return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N,M = map(int, readline().decode("utf-8").split())

aclist = [0 for _ in range(0, N+1)]
walist = [0 for _ in range(0, N+1)]

for _ in range(0, M):
    p,s = readline().decode('utf-8').split()
    p = int(p)

    if s == "AC":
        aclist[p] = 1
    if s == "WA" and aclist[p] == 0:
        walist[p] += 1

sum_wa = 0
for i,x in enumerate(walist):
    if aclist[i] == 1:
        sum_wa += x

print(sum(aclist), sum_wa)

Measured memory_bytes: 47408
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1

template <typename U>
map<U, int> doPrimeFactorization(U n) {

  map<U, int> rs;
  U a = 1;

  while (!(n & 1)) {
    n >>= 1;
    rs[2]++;
  }

  for (U i = 3; i * i <= n; /*NOP*/) {
    auto q = n / i;
    auto r = n - i * q;
    if (r == 0) {
      rs[i]++;
      n = q;
    }
    else {
      i += 2;
    }
  }

  if (n > 1) {
    rs[n]++;
  }

  return move(rs);
}

template<typename T>
vector<T> getCompositeNums(map<T, int> primeNums) {

  vector<T> results;

  if (primeNums.empty()) {
    return results;
  }

  // どの素数を何個ずつ掛け合わせるか
  auto cur(primeNums);
  for (auto& c : cur) {
    c.second = 0;
  }

  auto it = cur.begin();
  while (true) {
    if (++it == cur.end()) {
      u64 com = 1;
      for (auto& c : cur) {
        com *= pow<u64>(c.first, c.second);
#if 0
        cout << c.first << "," << c.second << '\n';
#endif
      }
      if (com > 1) {
        results.push_back(com);
#if 0
        cout << com << '\n';
#endif
      }

      bool end = false;
      while (true) {
        if (it == cur.begin()) {
          end = true;
          break;
        }
        it--;
        if (++(it->second) > primeNums[it->first]) {
          it->second = 0;
          continue;
        }
        break;
      }
      if (end) {
        break;
      }
    }
  }

  sort(results.begin(), results.end());
  return results;
}

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  i64 N;
  cin >> N;

  auto ns = getCompositeNums(doPrimeFactorization(N));
  
  i64 a = *lower_bound(rng(ns), sqrt(N));
  i64 b = N / a;

  cout << (a+b - 2);
}
#endif


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define INF 1000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  // ll N;
  // cin >> N;
  // ll ans;
  // cout << ans << endl;
  string N;
  cin >> N;
  bool ok = false;
  for (ll i = 0; i < 3; ++i)
  {
    if (N[i] == '7')
    {
      ok = true;
    }
  }
  if (ok)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3592
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──██████████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define int long long
#define read(a) int a; cin >> a;
#define readarr(a, n) int a[(n) + 1] = {}; fori(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; fori(i, 1, n) {fori(j, 1, m) cin >> a[i][j];}
#define pb push_back
#define fi first
#define se second
#define rz resize
#define fori(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define sort1(v) sort(v.begin(), v.end()) 
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair <int, int>> vpi;
typedef vector < vector <int> > vvi;

const long long inf2 = (long long)1e18;
const long long mod = (long long)(1e9+7);
const long long inf1 =(long long)(1e6+1);
 
signed main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int h, n; cin >> h >> n;
    readarr(a, n);
    int sum = 0; fori(i, 1, n) sum += a[i];
    if(sum >= h) cout << "Yes";
    else cout << "No";

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
int main() {
    int h, w;
    for (std::cin >> h >> w; h !=0 && w != 0; std::cin >> h >> w) {
        for (int i = 0; i < h; ++i) {
            for (int j = 0; j < w; ++j) {
                std::cout << '#';
            }
            std::cout << std::endl;
        }
        std::cout << std::endl;
    }
}



Measured memory_bytes: 3092
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <climits>
#include <memory>
#include <sstream>
#include <iomanip>
#include <cstdio>

using namespace std;

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

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<int> dp(n);
	dp[0] = a[0];
	for (int i = 1; i < n; i++) {
		dp[i] = gcd(max(dp[i - 1], a[i]), min(dp[i - 1], a[i]));
	}
	vector<int> dpr(n);
	dpr[n-1] = a[n-1];
	for (int i = n-2; i >= 0; i--) {
		dpr[i] = gcd(max(dpr[i + 1], a[i]), min(dpr[i + 1], a[i]));
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int num;
		if (i == 0) {
			num = dpr[1];
		}
		else if (i == n - 1) {
			num = dp[n - 2];
		}
		else {
			num = gcd(max(dp[i - 1], dpr[i + 1]), min(dp[i - 1], dpr[i + 1]));
		}
		ans = max(ans, num);
	}

	cout << ans << endl;

	return 0;
}

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

int main() {
int d;
cin>>d;
if(d==25)
{
    cout<<"Christmas";
}
else if (d==24)
{
    cout<<"Christmas Eve";
}
else if(d==23)
{
    cout<<"Christmas Eve Eve" ;
}
else if(d==22)
{
    cout<<"Christmas Eve Eve Eve" ;
}
    return 0;
}


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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  string s;
  cin >> s;
  int ans = 300;
  int n = s.size();
  bool oneFlag = true;
  rep(i,n-1){
    if(s[i] == s[i+1]) continue;
    else{
      oneFlag = false;
      break;
    }
  }
  if(oneFlag){
    cout << 0 << endl;
    return 0;
  }
  rep(i,n){
    //set target
    char terget = s[i];
    //first string
    string c_tmp = s;
    //目標が達成されたかのフラグ
    bool flag = true;
    rep(j,n){
      //変化先の文字列
      string p_tmp = "";
      flag = true;
      rep(k,c_tmp.size()-1){
        if(c_tmp[k] == terget){
          p_tmp.push_back(terget);
          continue;
        }
        if(c_tmp[k+1] == terget){
          p_tmp.push_back(terget);
          continue;
        }
        flag = false;
        p_tmp.push_back(c_tmp[k]);
      }
      //cout << p_tmp << endl;
      if(flag == true){
        ans = min((int)(s.size() - p_tmp.size()),ans);
        break;
      }else{
        c_tmp = p_tmp;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair


int main()
{
	int n;
	
	cin>>n;
	
	int cnt=0;
	
	for(int i=0;i<4;i++)
	{
		// cout<<n<<endl;
		if(n%10==2) cnt++;
		n=n/10;
	}
	
	cout<<cnt<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <bitset>
using namespace std;
typedef long long int ll;

const int MAX=4000400;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<int> a(n);
	ll sum=0;
	for(int i=0;i<n;i++){
		cin >> a[i]; 
		sum+=a[i];
	}
	bitset<MAX> dp;
	dp[0]=1;
	for(int i=0;i<n;i++){
		dp|=(dp<<a[i]);
	}
	for(ll i=(sum+1)/2;;i++){
		if(dp[i]){
			cout << i << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;

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

    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (int i = 0; i < N; i++) {
        cin >> B[i];
    }
    for (int i = 0; i < N; i++) {
        cin >> C[i];
    }

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

    long long ans = 0;
    for (int i = 0; i < N; i++) {
        long long Alower = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
        long long Cupper = N - (upper_bound(C.begin(), C.end(), B[i]) - C.begin());
        ans += Alower * Cupper;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1408
#include<iostream>
using namespace std;
typedef long long ll;
int main() {
	int n; cin >> n;
	ll a[10010], b[10010], suma = 0, sumb = 0;
	for (int i = 0; i < n; i++) { cin >> a[i]; suma += a[i]; }
	for (int i = 0; i < n; i++) { cin >> b[i]; sumb += b[i]; }
	ll dif = sumb - suma;
	ll ra = dif, rb = dif;
	for (int i = 0; i < n; i++) {
		if (a[i] > b[i]) 
			rb -= a[i] - b[i];
		else  if (a[i] < b[i]) {
			if ((b[i] - a[i]) % 2 != 0) {
				b[i]++;
				rb--;
			}
			ra -= (b[i] - a[i]) / 2;
		}
	}
	cout << ((ra >= 0 && rb >= 0 && ra * 2 - rb == 0) ? "Yes\n" : "No\n");
	return 0;
}

Measured memory_bytes: 384
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n, a, b = LI()
    print(min(n * a, b))
    return

#B
def B():
    n, d = LI()
    x = LIR(n)
    a = list(itertools.combinations(range(n), 2))
    ans = 0
    for a1,a2 in a:
        b = 0
        for bi in range(d):
            b += (x[a1][bi] - x[a2][bi])** 2
        if float.is_integer(math.sqrt(b)):
            ans += 1
    print(ans)
    return

#C
def C():
    l, r = LI()
    if l // 2019 == r // 2019:
        print((l * (l + 1)) % 2019)
    else:
        print(0)
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 4720
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] line1 = line.split(" ");
        int a = Integer.parseInt(line1[0]);
        int b = Integer.parseInt(line1[1]);
        if(a >= 13)
        System.out.println(b);
        else if(a <= 12 && a >= 6)
        System.out.println(b / 2);
        else
        System.out.println(0);
    }
}

Measured memory_bytes: 23124
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

long long factorial (long n){
	
	if (n == 0LL || n == 1LL){
		return 1LL;
	} // end if
	return n*factorial(n-1);
}

int main()
{
	string str = "";

	while (getline (cin, str )){
		long long res;
		long long n;
		stringstream ssn(str);
		ssn >> n;
		res = factorial(n);
		cout << res << endl;	
	} // end while
		
	return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 10000000000000;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
ll powd(ll a){
    return a*a*a*a*a;
}
int main()
{
    fastio;
    ll n=0;
    cin>>n;
    for(ll i=-1000;i<=1000;++i){
        for(ll j=-1000;j<=1000;++j){
            ll a=powd(i),b=powd(j);
            if(b-a==n){
                cout<<j<<" "<<i;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3612
import java.util.Scanner;
	public class Main {
	 
	 
	 public static void main(String[] args) {
	 
	 Scanner sc = new Scanner(System.in);
	 
	 int a = sc.nextInt();
	 int b =sc.nextInt();
	 int c =sc.nextInt();
	 
	 if(a+b+c>=22){
	 System.out.println("bust");
	 }else if(a+b+c<=21){
	 System.out.println("win");
	 }
	 
	 
	 
	 }
	 }

Measured memory_bytes: 22868
def main():

    N = int(input())
    past=[]
    past.append(input())

    for i in range(N-1):
        word = input()
        if past[-1][-1] != word[0] or word in past:
            print('No')
            exit()
        past.append(word)

    print('Yes')


        
    
if __name__== "__main__":
    main() 


Measured memory_bytes: 2940
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
    int n,m,a[100];
    cin >> n >> m;
    while ((n!=0)||(m!=0)){
        for (int i=0;i<100;i++)
            a[i]=0;
        for (int i=1;i<=n;i++){
            int b,c;
            cin >> b;
            for (int j=1;j<=b;j++){
                cin >> c;
                a[c]++;
            }
        }
        int max=0;
        for (int i=1;i<100;i++){
            if ((a[i]>a[max])&&(a[i]>=m))
                max=i;
        }
        cout << max << endl;
        cin >> n >> m;
    }
}


Measured memory_bytes: 2984
#include <stdio.h>
int main(void){
    int n, k, m, l;
    scanf("%d %d", &n, &k);
    int num[n];
    for(int i = 0; i < n; i++) num[i] = 0;
    
    for(int i = 0; i < 2*k; i++){
        // printf("%d\n",i);
        if(i % 2 == 0){
            scanf("%d", &m);
            // printf("m : %d\n", m);
            for(int j = 0; j < m; j++){
                scanf("%d", &l);
                // printf("l : %d\n", l);
                num[l-1]++;
            }
        }
    }
    int cnt = 0;
    for(int i = 0; i < n; i++){
        // printf("%d", num[i]);
        if(num[i] == 0) cnt++;
    }
    printf("%d", cnt);
    
}


Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/
const int dx[] = { -1, 0, 0, 1 }, dy[] = { 0, -1, 1, 0 };
//[const int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy[] = { 0, -1, 1, -1, 1, 0, -1, 1 };
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
int place(int x, int y, int w) { return w*x + y; }


map<int, int> zip;
vi unzip;

typedef pair<pii, pii> rect;

void compress(vi v, map<int,int>& zip, vi& unzip)
{
	sort(ALL(v));
	v.erase(unique(v.begin(), v.end()), v.end());
	unzip.resize(v.size());
	REP(i, v.size())
	{
		zip[v[i]] = i;
		unzip[i] = v[i];
	}
}

void debug(vector<vector<bool>>& v)
{
	REP(i, v.size())
	{
		REP(j, v[i].size()) cout << (v[i][j] ? '#' : '.');
		cout << endl;
	}
}


int main()
{
	int n;
	while (cin >> n, n)
	{
		vector<rect> v;
		vi x, y;
		map<int, int> xzip, yzip;
		vi xunzip, yunzip;
		v.emplace_back(pii(-INF, INF), pii(INF, -INF));
		x.push_back(-INF), x.push_back(INF);
		y.push_back(INF), y.push_back(-INF);
		REP(i, n)
		{
			int a, b, c, d;
			cin >> a >> b >> c >> d;
			v.emplace_back(pii(a, b), pii(c, d));
			x.push_back(a), x.push_back(c);
			y.push_back(b), y.push_back(d);
		}
		compress(x, xzip, xunzip);
		compress(y, yzip, yunzip);
		int h = x.size() * 3, w = y.size() * 3;
		vector<vector<bool>> fld(h, vector<bool>(w));
		REP(i, v.size())
		{
			int lx = xzip[v[i].first.first] * 3, rx = xzip[v[i].second.first] * 3;
			int ty = yzip[v[i].first.second] * 3, by = yzip[v[i].second.second] * 3;
			FOR(i, lx, rx + 1)
			{
				fld[i][ty] = true;
				fld[i][by] = true;
			}
			FOR(i, by, ty + 1)
			{
				fld[lx][i] = true;
				fld[rx][i] = true;
			}
		}
		//debug(fld);
		int ans = 0;
		REP(i, h)REP(j, w)
		{
			if (fld[i][j]) continue;
			ans++;
			queue<pii> que;
			que.push(pii(i, j));
			while (que.size())
			{
				int tmpx = que.front().first, tmpy = que.front().second;
				que.pop();
				fld[tmpx][tmpy] = true;
				REP(k, 4)
				{
					int nx = tmpx + dx[k], ny = tmpy + dy[k];
					if (!valid(nx, ny, h, w)) continue;
					if (!fld[nx][ny])
					{
						fld[nx][ny] = true;
						que.push(pii(nx, ny));
					}
				}
			}
		}
		cout << ans-1 << endl;
	}
	return 0;
}

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

int main()
{
  int N, T;
  cin >> N >> T;
  vector<vector<int>> data(N, vector<int>(2));
  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < 2; j++)
    {
      cin >> data[i][j];
    }
  }
  bool tle = true;
  for (int i = 0; i < N; i++)
  {
    if (data[i][1] <= T)
      tle = false;
  }
  int ans = 10000;
  for (int i = 0; i < N; i++)
  {
    if (data[i][1] <= T)
    {
      ans = min(ans, data[i][0]);
    }
  }
  if (tle)
    cout << "TLE" << endl;
  else
    cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
num = [int(x) for x in input().split()]

array = []
for i in range(num[1]):
    array.append([int(x) for x in input().split()])

res = [0 for x in range(num[0])]

for j in array:
    res[j[0]-1] = res[j[0]-1] +1
    res[j[1]-1] = res[j[1]-1] +1

for k in res:
    print(k)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pi pair<int,int>
#define ff first
#define ss second
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#include "string"
#define int long long

const int inf = 1e18;
int32_t main() { 
   boost;
   int n,ans = 0;
   cin>>n;
   map<int,int>mp;
   int cur  = n;
   for(int i=2;i*i<=n;i++){
      int cnt = 0;
      while(cur%i == 0){
         cur/=i;
         cnt++;
      }
      if(cnt>0)
         mp[i] = cnt;
   }
   if(cur>=2)
      ans++;
   for(pi p:mp){
      int cur = 1;
      while(p.ss >= cur){
         p.ss-=cur;
         cur++;
         ans++;
      }
   }
   cout<<ans<<endl;
}

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

int main(){
    long long n, k;
    cin >> n >> k;
    vector<long long> p(n);
    long long sum = 0;

    for(long long i = 0; i < n; i++){
        cin >> p[i];
    }

    sort(p.begin(), p.end());

    for(long long i = 0; i < k; i++){
        sum += p[i];
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3628
class Dice:
    def __init__(self, numbers):
        self.dice = {"上" :numbers[0],
                     "下":numbers[5], 
                     "前":numbers[1],
                     "後":numbers[4],
                     "左":numbers[3],
                     "右":numbers[2]
                    }
    
    def order(self, order_seq):
        for _, order in enumerate(order_seq):
            if order == "N":
                self.north()
            elif order == "E":
                self.east()
            elif order == "W":
                self.west()
            elif order == "S":
                self.south()
        
        return self.dice["上"]

    def north(self):
        U, D, F, B = [self.dice["上"], self.dice["下"], self.dice["前"], self.dice["後"]]
        self.dice["上"] = F
        self.dice["前"] = D
        self.dice["下"] = B
        self.dice["後"] = U

    def east(self):
        U, D, L, R = [self.dice["上"], self.dice["下"], self.dice["左"], self.dice["右"]]
        self.dice["上"] = L
        self.dice["下"] = R
        self.dice["左"] = D
        self.dice["右"] = U

    def west(self):
        U, D, L, R = [self.dice["上"], self.dice["下"], self.dice["左"], self.dice["右"]]
        self.dice["上"] = R
        self.dice["下"] = L
        self.dice["左"] = U
        self.dice["右"] = D

    def south(self):
        U, D, F, B = [self.dice["上"], self.dice["下"], self.dice["前"], self.dice["後"]]
        self.dice["上"] = B
        self.dice["前"] = U
        self.dice["下"] = F
        self.dice["後"] = D   

    def set_position(self, n, position_seq):
        self.ans = []
        for i in range(n):
            self.up = position_seq[i][0]
            self.front = position_seq[i][1]
            
            self.search()
            self.west()
            self.search()
            self.west()
            self.search()
            self.north()
            self.search()
            self.west()
            self.search()
            self.west()
            self.search()
        
        return self.ans
    
    def search(self):
        # print("goal:now", self.up, ":", self.dice["上"])
        if self.dice["上"] == self.up:
            for _ in range(4):
                # print("goal:now|up ", self.front, ":", self.dice["前"], "|", self.dice["上"], "→", self.dice["右"])
                if self.dice["前"] == self.front:
                    break
                self.rotate()
            self.ans.append(self.dice["右"])

    def rotate(self):
        F, R, B, L = [self.dice["前"], self.dice["右"], self.dice["後"], self.dice["左"]]
        self.dice["前"] = R
        self.dice["右"] = B
        self.dice["後"] = L
        self.dice["左"] = F
        
numbers = list(map(int, input().split()))
n = int(input())
pos_seq = []
for _ in range(n):
    pos_seq.append(list(map(int, input().split())))

dice = Dice(numbers)
ans = dice.set_position(n, position_seq = pos_seq)
for i in range(n):
    print(ans[i])


Measured memory_bytes: 5704
#include<bits/stdc++.h>
using namespace std;
#define IO {ios_base::sync_with_stdio(false); cin.tie(0);}
#define ll   long long
#define pi pair<ll,ll>

ll a[300000];

int main()
{
    IO;
    ll i, j, k = 1, n, g=1, r, mod=1e9+7, l=1, t, mn;
        cin>>n;
        for(i=1; i<=n; i++){
            k = (k*10)%mod;
            l = (l*8)%mod;
            g = (g*9)%mod;
        }
        cout<<(k-2*g+l+3*mod)%mod<<endl;
        return 0;
}


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

int main() {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if (e - a <= k) {
    cout << "Yay!" << endl;
  }
  else {
    cout << ":(" << endl;
  }
}


Measured memory_bytes: 256
import sys
from itertools import accumulate

def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    A.sort()
    Ac = list(accumulate(A))

    ans = 1
    # print(Ac)

    for i in range(N - 2, -1, -1):
        if Ac[i] * 2 >= A[i + 1]:
            ans += 1
        else:
            print(ans)
            return

    print(ans)


def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

if __name__ == '__main__':
    solve()

Measured memory_bytes: 14432
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define LL long long 
using namespace std;

const int N=100007;
int num[N];
int res[N];
int main(void)
{
	int n;
	scanf("%d",&n);
	rep(i,0,n)
	{
		scanf("%d",&num[i]);
		
	}
	sort(num,num+n);
	int x,y;
	int cnt=0;
	rep(i,0,n)
	{
		if(i+1==n)break;
		if(num[i]==num[i+1])
		{
			res[cnt++]=num[i++];
		}
	}
	LL max=0;
	rep(i,0,cnt-1)
	{
		LL area=res[i]*1ll*res[i+1];
		max=max>area?max:area;
	}
	printf("%lld",max);
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int main(){
  char a[3];
  int b,d,n,sum;
  while(cin>>n,n!=0){
    b=d=sum=0;
    for(int i=0;i<n;i++){
      scanf("%s",a);
      if(b==1&&a[0]=='l')b--;
      else if(d==1&&a[0]=='r')d--;
      else if(a[0]=='l')b++;
      else if(a[0]=='r')d++;
      if(b==1&&d==1){sum++;b=0;d=0;}
    }
    cout<<sum<<endl;
}}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	string S;
	cin >> S;
	bool flag = true;
	if(S[0]!='A') flag = false;
	vector<int> tmp;
	REP(i, S.size()){
		if(S[i]=='C') tmp.push_back(i);
	}
	if(tmp.size()!=1) flag = false;
	if(tmp.size()>0){
		if(tmp[0]<=1 || tmp[0]>=S.size()-1) flag = false;
		REP(i, S.size()){
			if(i != 0 && i!=tmp[0]){
				if(S[i]-'a'>=26 || S[i]-'a'<0) flag = false;
			}
		}
	}
	cout << (flag ? "AC" : "WA" ) << endl;
    return 0;
}

Measured memory_bytes: 256
//==========================================================================
    #define mod 1e9+7
    #include<decimal/decimal>
    #include <iostream>           //  CCCCC RRRRR  EEEEE  AAA   TTTTT EEEEE DDDD
    #include<algorithm>           //  C     R  R   E     A   A    T   E     D  D
    #include<bits/stdc++.h>       //  C     RRRR   EEEE  AAAAA    T   EEEE  D  D
    #include<cstring>             //  C     R  R   E     A   A    T   E     D  D
    #include<vector>              //  CCCCC R   R  EEEEE A   A    T   EEEEE DDDD
    //==========================================================================
    #include<stack>               //  BBBB   Y   Y
    #include<queue>               //  B   B   Y Y
    #include<deque>               //  BBBB     Y
    #include<cmath>               //  B   B    Y
    #include<numeric>             //  BBBB     Y
    //==========================================================================
    #include<utility>             //   AAA  M   M M   M IIIII TTTTT
    #include<unordered_map>       //  A   A MMMMM MMMMM   I     T
    #include<unordered_set>       //  AAAAA M M M M M M   I     T
    #include<set>                 //  A   A M   M M   M   I     T
    #include<map>                 //  A   A M   M M   M IIIII   T
    #include<list>
    #include<set>
    #include<string>
    //==========================================================================
    //==========================================================================
     
using namespace std;
bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 

int main() 
 {
      ios_base::sync_with_stdio(false); 
      cin.tie(NULL); 
      int n;
      cin>>n;
      for(int i=n;i<=200000;i++)
      {
           //cout<<"OO\n";
           if(isPrime(i)==true)
           {
                cout<<i<<endl;
                break;
           }
      }
      
}

Measured memory_bytes: 256
#include <iostream>
#include<cstring> 
#include<cstdlib> 
using namespace std;
void LCS(string text1 ,string text2 ,int len1,int len2){
    int dp[len1+1][len2+1];
    for(int i=0;i<=len1;i++){
        for(int j=0;j<=len2;j++){
            if(i==0 || j==0){
                dp[i][j]=0;
            }
           else if(text1[i-1]==text2[j-1]){
                dp[i][j]=dp[i-1][j-1]+1;
           }
           else{
               dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
           }
        }
    }
    int index= dp[len1][len2];
    char lcs[index+1];
    lcs[index] = '\0';
    int i=len1;
    int j=len2;
    while(i>0 && j>0){
        if(text1[i-1]==text2[j-1]){
            lcs[index-1]=text1[i-1];
            i--;
            j--;
            index--;

        }
        else if(dp[i-1][j]>dp[i][j-1]){
            i--;
        }
        else {
            j--;
        }
    }
    
        cout<<lcs;
    
}
int main() 
{ 
    string text1;
    string text2;
  
    
    getline(cin, text1); 
    getline(cin,text2);
    LCS(text1,text2,text1.length(),text2.length());
  
    return 0; 
}

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

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

    ll ans = 0;
    ans += 1000L * (N / 500L);
    N = N % 500L;
    ans += 5L * (N / 5L);
    cout << ans << endl;
}

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

#define ll long long

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

    if (a == 0) {
        cout << b / x + 1<< endl;
    } else {
        cout << b / x - (a - 1) / x << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s;
	cin>>s;
	for(ll i=0;i<s.size();i++){
		cout << "x";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
S = ['.'*(W+2)] + ['.'+input()+'.'for _ in[0]*H] + ['.'*(W+2)]
cells = [[0] * W for _ in[0] * H]
for i in range(H):
    for j in range(W):
        if S[i+1][j+1] == '#':
            cells[i][j] = '#'
        else:
            surrounder = S[i][j:j+3] + S[i+1][j:j+3:2] + S[i+2][j:j+3]
            cells[i][j] = surrounder.count('#')
for x in cells:
    print(''.join(map(str, x)))

Measured memory_bytes: 3064
import java.util.Scanner;

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

String[] t=s.split("");
for(int i=0;i<t.length;i++){
    t[i]="x";
}
String u=String.join("",t);
System.out.println(u);
}
}


Measured memory_bytes: 21972
using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.IO;
    using System.Text;

    class Program
    {
        static void Main()
        {
            string input = Console.ReadLine();
            var n = int.Parse(Right(input,1));

            var ans = string.Empty;
            if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9)
            {
                ans = "hon";
            }
            else if(n == 3)
            {
                ans = "bon";
            }
            else
            {
                ans = "pon";
            }
            Console.WriteLine(ans.ToString());
        }

        /// <summary>
        /// 文字列の末尾から指定した長さの文字列を取得する
        /// </summary>
        /// <param name="str">文字列</param>
        /// <param name="len">長さ</param>
        /// <returns>取得した文字列</returns>
        public static string Right(string str, int len)
        {
            if (len < 0)
            {
                throw new ArgumentException("引数'len'は0以上でなければなりません。");
            }
            if (str == null)
            {
                return "";
            }
            if (str.Length <= len)
            {
                return str;
            }
            return str.Substring(str.Length - len, len);
        }
    }
    

Measured memory_bytes: 17628
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)
//============================================================
var sc = bufio.NewScanner(os.Stdin)

func setScSplit() { sc.Split(bufio.ScanWords) }

func readStr() string {
	sc.Scan()

	return sc.Text()
}

func readInt() int {
	i, _ := strconv.Atoi(readStr())

	return i
}

func readFloat() float64 {
	f, _ := strconv.ParseFloat(readStr(), 64)

	return f
}
//=============================================================
var N int
var A[100][3] int

func dfs(n, cnt int) int {
	if n == N {
		if cnt > 0 { return 1
		}else { return 0 }
	}

	ret := 0

	for i := 0; i < 3; i++ {
		if (A[n][i] % 2 == 0) { ret += dfs(n + 1, cnt + 1)
		}else { ret += dfs(n + 1, cnt) }
	}

	return ret
}

func main(){
	setScSplit()

	N = readInt()
	for i := 0; i < N; i++ {
		a := readInt()
		A[i][0] = a - 1
		A[i][1] = a
		A[i][2] = a + 1
	}

	fmt.Println(dfs(0, 0))
}

Measured memory_bytes: 640
# A - Task Scheduling Problem
# https://beta.atcoder.jp/contests/abc103/tasks/abc103_a

# A_Task_Scheduling_Problem.py

A = list(map(int, input().strip().split()))

l = [[0,1,2],[0,2,1], [1,0,2], [1,2,0], [2,0,1], [2,1,0]]

min_cost = 300
for i in range(6):
    cost = 0
    first, second, third = l[i]
    if A[second] - A[first] >= 0:
        cost += A[second] - A[first]
    else:
        cost += (A[second] - A[first]) * (-1)
    if A[third] - A[second] >= 0:
        cost += A[third] - A[second]
    else:
        cost += (A[third] - A[second]) * (-1)
    if cost < min_cost:
        min_cost = cost

print(min_cost)


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

int main() {
    int a, b, c;

    cin >> a >> b >> c;

    if(a > b) {
        if (a > c) {
            cout << "A" << endl;
        } else {
            cout << "C" << endl;
        }
    } else {
        if (b > c) {
            cout << "B" << endl;
        } else {
            cout << "C" << endl;
        }
    }
}




Measured memory_bytes: 3068
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

# なんこか入力
n,d = map(int, input().split())

if n % (2*d + 1)==0:
    print(n//(2*d+1))
else:
    print(n//(2*d+1) + 1)



Measured memory_bytes: 21552
N,M = map(int,input().split())
XYZ = [tuple(map(int,input().split())) for i in range(M)]

class UnionFind:
    def __init__(self,N):
        self.parent = [i for i in range(N)]
        self._size = [1] * N
        self.count = 0
    def root(self,a):
        if self.parent[a] == a:
            return a
        else:
            self.parent[a] = self.root(self.parent[a])
            return self.parent[a]
    def is_same(self,a,b):
        return self.root(a) == self.root(b)
    def unite(self,a,b):
        ra = self.root(a)
        rb = self.root(b)
        if ra == rb: return
        if self._size[ra] < self._size[rb]: ra,rb = rb,ra
        self._size[ra] += self._size[rb]
        self.parent[rb] = ra
        self.count += 1
    def size(self,a):
        return self._size[self.root(a)]
uf = UnionFind(N)
for x,y,_ in XYZ:
    x,y = x-1,y-1
    if uf.is_same(x,y): continue
    uf.unite(x,y)
print(N - uf.count)

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

int main() {
    int n;
    ll k;
    cin >> n >> k;
    ll nx = 0;
    for (int i = 0; i < n - 1; i++) {
        nx += 1 + nx / (k - 1);
    }
    cout << nx << endl;
    return 0;
}



Measured memory_bytes: 3092
#include<stdio.h>
#include<algorithm>
using namespace std;
int p[110];
int t[110];
int v[110];
double dp[110][110];
double prob[110][110];
int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	for(int i=0;i<a;i++){
		scanf("%d%d%d",p+i,t+i,v+i);
		for(int j=0;j<=b;j++)for(int k=0;k<=b;k++)dp[j][k]=0;
		dp[0][0]=1;
		for(int j=0;j<b;j++){
			for(int k=0;k<=j;k++){
				dp[j+1][k+1]+=dp[j][k]*p[i]/100;
				dp[j+1][k]+=dp[j][k]*(100-p[i])/100;
			}
		}
		for(int j=0;j<=b;j++)prob[i][j]=dp[b][j];
	}
	double EPS=1e-12;
	for(int i=0;i<a;i++){
		double ret=0;
		for(int j=0;j<=b;j++){
			if(!v[i])continue;
			double time=(double)c/v[i]+j*t[i];
			double ks=prob[i][j];
			for(int k=0;k<a;k++){
				if(i==k)continue;
				double tmp=0;
				for(int l=0;l<=b;l++){
					if(v[k]&&time+EPS>(double)c/v[k]+l*t[k])continue;
					tmp+=prob[k][l];
				}
				ks*=tmp;
			}
			ret+=ks;
		}
		printf("%.12f\n",ret);
	}
}

Measured memory_bytes: 1200
#include<stdio.h>

int main(){
	int P;
	int Q;
	int R;
	scanf("%d %d %d",&P,&Q,&R);

	if(P>=Q&&Q>=R){
		printf("%d",Q+R);
	}else if(P>=R&&R>=Q){
		printf("%d",Q+R);
	}else if(Q>=R&&R>=P){
		printf("%d",P+R);
	}else if(Q>=P&&P>=R){
		printf("%d",P+R);
	}else if(R>=P&&P>=Q){
		printf("%d",P+Q);
	}else{
		printf("%d",P+Q);
	}

	return 0;
}

Measured memory_bytes: 128