akhauriyash/Code-Regression huggingface dataset:
//--- pB ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Reader reader;
	public Solution () {
		reader = new Reader();
		while (reader.hasNext()) {
			run_case();
		}
	}
	private void run_case() {
		int n = reader.ni();
		String str = reader.ns();
		String a = str.substring(str.length()/2);
		String b = str.substring(0, str.length()/2);
		if (a.equals(b)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		return;
	}
}

class Reader {
	BufferedReader br;
	StringTokenizer st;
	public Reader(){
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String next() {
		if (st.hasMoreTokens()) return st.nextToken();
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return st.nextToken();
	}
	public boolean hasNext() {
		try {
			if (!st.hasMoreTokens() && !br.ready()) return false;
			else return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	public int ni() {return Integer.parseInt(this.next());}
	public String ns() {return this.next();}
}


Measured memory_bytes: 21460
#include <stdio.h>

int digitNumber(int n){
	int c = 1;
	while(n / 10 > 0){
		c++;
		n /= 10;
	}
	return c;	
}

int main(void){
	int a, b;
	while(scanf("%d %d", &a, &b) != EOF){
		printf("%d\n", digitNumber(a + b));
	}
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
const long long int mod = 1e9+7;
int main(){
  	long long int n,k,i;
  	cin>>n>>k;
  	long long int sum = 0;
  	for(i=k;i<=n+1;i++){
    	sum += (n*i - i*(i-1) + 1);
      	sum %= mod;
    }
    cout<<sum<<"\n";
}	


Measured memory_bytes: 3640
#include<iostream>
#include<queue>
#define mp(a,b) make_pair(a,b)
using namespace std;
struct edge{int to,cost,danger;};
typedef pair<int, int > P;
typedef pair<int, P > PP;

int main(){
  int n,m,l;
  int inf = 1<<20;
  cin >> n >> m >> l;
  while(n!=0){
    int i,j,k;
    priority_queue<PP,vector<PP>,greater<PP> > q;
    P x,b;
    edge e;
    vector<edge> v[100];
    for(i=0;i<m;i++){
      cin >> k >> e.to >> e.cost >> e.danger;
      k--;e.to--;
      v[k].push_back(e);
      //cout << k << ":" << e.to << endl;
      int buf=k;
      k=e.to;e.to=buf;
      //cout << k << ":" << e.to << endl;
      v[k].push_back(e);
    }
    int o=inf;
    int d[101][101];
    fill(d[0],d[100],inf);
    d[0][l]=0;
    q.push(mp(0,mp(0,l)));
    
    while(!q.empty()){
      PP p=q.top();q.pop();
      x = p.second;
      if(d[x.first][x.second] < p.first) continue; 
      //d[x.first][x.second] =p.first;
      //cout << p.first << endl;

      for(i=0;i<v[x.first].size();i++){
	//cout << x.first <<":"<<v[x.first][i].to<<endl;
	if(d[v[x.first][i].to][x.second]>d[x.first][x.second]+v[x.first][i].danger){
	  d[v[x.first][i].to][x.second]=d[x.first][x.second]+v[x.first][i].danger;
	  q.push(mp(d[v[x.first][i].to][x.second],mp(v[x.first][i].to,x.second)));
	}
	if(x.second>=v[x.first][i].cost){
	  if(d[v[x.first][i].to][x.second-v[x.first][i].cost]>d[x.first][x.second]){
	    d[v[x.first][i].to][x.second-v[x.first][i].cost]=d[x.first][x.second];
	    q.push(mp(d[v[x.first][i].to][x.second-v[x.first][i].cost],
		      mp(v[x.first][i].to,x.second-v[x.first][i].cost)));
	  }
	}
      }
    }
    for(i=0;i<=l;i++) o=min(o,d[n-1][i]);
    cout << o << endl;
    cin >> n >> m >> l;
  }

}

Measured memory_bytes: 1904
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
#include <iterator>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> v(n);
  rep(i, n) cin >> v[i];

  ll ans = 0;
  for (int l = 0; l <= k; ++l) {
    if (l > n) break;
    vector<int> v1;
    int sum1 = 0;
    for (int i = 0; i < l; ++i) {
      sum1 += v[i];
      if (v[i] < 0) v1.push_back(v[i]);
    }
    for (int r = 0; r <= k; ++r) {
      if (l + r > k or r > n or n - l < r) break;
      vector<int> v2;
      int sum2 = sum1;
      for (int i = n - 1; i >= n - r; --i) {
        sum2 += v[i];
        if (v[i] < 0) v2.push_back(v[i]);
      }

      copy(v1.begin(), v1.end(), back_inserter(v2));
      sorti(v2);
      for (int i = 0; i < k - l - r and i < v2.size(); ++i) {
        sum2 += -v2[i];
      }
      chmax(ans, (ll)sum2);
    }
  }

  cout << ans << "\n";
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int R;
	cin >> R;
	if (R < 1200) cout << "ABC" << endl;
	else if (R >= 2800) cout << "AGC" << endl;
	else cout << "ARC" << endl;
}

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

using namespace std;

int main() {
  vector<string> a(3);
  for (int i=0; i<3; i++) cin >> a[i];

  sort(a.begin(), a.end(), greater<string>());
  int b = stoi(a[0] + a[1]);
  int c = stoi(a[2]);

  cout << ( b + c ) << endl;
}


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

int main(void){
    int k;
    scanf("%d",&k);
    int count = 0;
    for(int i = 1;i <= k;i += 2){
        for(int j = 2;j <= k;j += 2){
            count++;
        }
    }

    printf("%d",count);

}

Measured memory_bytes: 128
#pragma GCC optimize("O3")
#pragma GCC optimize("O1")
#pragma GCC optimize("O2")
#pragma GCC optimize("Os")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
using namespace std;
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
void vok()
{
    FAST
    FO
    FI
}
int main()
{
    vok();
    ll n,k;
    IN n>>k;
    vll a(n);
    bitset<50> b[n];
    loop(i,0,n)
    {
        IN a[i];
        bitset<50> temp(a[i]);
        b[i]=temp;
    }
    bitset<50> ans(0);
    rloop(i,49,0)
    {
        int countt=0;
        loop(j,0,n)
        {
            if(b[j][i])
            {
                countt++;
            }
          	cout<<"";
        }
      	//cout<<"";
        ans[i]=1;
        if((countt*2)<n && ans.to_ullong()<=k)
        {
            //Do Nothing
        }
        else
        {
            ans[i]=0;
        }
    }
    ll fans=0LL;
  	//cout<<"";
    ll X=ans.to_ullong();
    loop(i,0,n)
    {
      	cout<<"";
        fans+=(X^a[i]);
    }
    OUT fans<<endl
    return 0;
}

Measured memory_bytes: 1792
n = int(input())
a = list(map(int, input().split()))
ans = 1
x_min = min(a)
if x_min == 0:
    print(0)
else:
    for x in a:
        ans *= x
        if ans > 10 ** 18:
            print(-1)
            break
    else:
        print(ans)

Measured memory_bytes: 21624
n = int(input())
x = list(map(int,input().split()))
ans = 0
for i in range(n-2) :
    if x[i] <= x[i+1] <= x[i+2] :
        ans += 1
    elif x[i] >= x[i+1] >= x[i+2] :
        ans += 1
print(ans)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleTest
{
    static partial class Program
    {
  

        static void Main(string[] args)
        {
            var r = Int();
            Console.WriteLine(2*r * Math.PI);


        }

    }
    static partial class Program
    {
        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }
        public static int[] Ints()
        {
            return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        }
        public static long[] Longs()
        {
            return Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
        }
        public static int[][] MultiInts(int num)
        {
            var result = new int[num][];
            for(int i = 0; i < num; ++i)
            {
                result[i] = Ints();
            }
            return result;
        }
        public static T[] MultiItems<T>(int num, Func<string,T> parser)
        {
            var result = new T[num];
            for(int i =0; i < num; ++i)
            {
                result[i] = parser(Console.ReadLine());
            }
            return result;
        }
    }
}


Measured memory_bytes: 27624
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int n, m;
string s;
vector<int> vec(100);


int main() {
	int a[10];
	int temp = 0;
	for (int i = 0; i < 5; i++)
	{
		cin >> a[i];
	}
	int ans = 0;
	int min = 0;
	for (int i = 0; i < 5; i++)
	{
		temp= (a[i] + 9) / 10;
		if (temp*10-a[i]>=min)
		{
			min = temp * 10 - a[i];
		}
		ans += temp;
	}
	cout << ans*10 - min;

}

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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;


unsigned long long N;

int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	cin >> N;

	if (N & 1) {
		cout << "0\n";
	} else {
		unsigned long long twos = 1, fives = 0;
		N >>= 1;
		V<unsigned long long> v{2, 5};

		for (auto& x : v) {

			unsigned long long y = x;

			unsigned long long cnt = 0;

			while (y <= N) {

				cnt += N / y;

				y *= x;

			}

			if (x == 2)
				twos += cnt;
			else
				fives += cnt;

		}

		cout << min(twos, fives) << '\n';

	}



	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
    return 0;
}


Measured memory_bytes: 256
// ------------------
// author: MatsuTaku
// date  : 22/02/2020
// ------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

constexpr ll MOD = (ll)1e9+7;
constexpr ll MAX = 200000;

ll mod_pow(ll x, ll p) {
  ll t = 1;
  ll u = x;
  while (p) {
    if (p & 1)
      t = t*u%MOD;
    u = u*u%MOD;
    p>>=1;
  }
  return t;
}

ll fact_ft(ll f, ll t) {
  ll x = f;
  for (ll i = f+1; i <= t; i++) {
    x = x*i%MOD;
  }
  return x;
}

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

  int n,a,b; cin>>n>>a>>b;


  ll ans = mod_pow(2, n)+MOD-1;
  ans %= MOD;
  ans = ans + MOD - (fact_ft(n-a+1, n)*mod_pow(fact_ft(1,a)%MOD, MOD-2))%MOD;
  ans %= MOD;
  ans = ans + MOD - (fact_ft(n-b+1, n)*mod_pow(fact_ft(1,b)%MOD, MOD-2))%MOD;
  ans %= MOD;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
s= input()


ans = 0
left = 0
right = len(s)-1

while left<right:
    #print(left,right)
    if s[left]==s[right]:
        left+=1
        right-=1
    elif s[left]=="x":
        left+=1
        ans +=1
    elif s[right]=="x":
        right-=1
        ans +=1
    else:
        print(-1)
        exit(0)

print(ans)

Measured memory_bytes: 3316
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
 
using namespace std;
int MOD = 1000000007;

signed main(){

    int n;
    cin >> n;
    int ans = 0;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> b = a;
    SORT(a);
    rep(i,n){
        auto itr = lower_bound(a.begin(),a.end(),b[i]);
        b[i] = itr-a.begin();
        if(i%2 == 0 && b[i]%2 == 1)ans++;
    }

    cout << ans << endl;    

    return 0;   
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://agc003.contest.atcoder.jp/tasks/agc003_c
// rm -r -f test;oj dl http://yahoo-procon2017-qual.contest.atcoder.jp/tasks/yahoo_procon2017_qual_c

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

#define int long long

using namespace std;

const int N = 2e5 + 5;
int occ[N], cnt[N], res[N], c[N], delt, n;
vector<int> g[N];

inline int square(int x) {
  return x * (x - 1) / 2;
}

void dfs(int u, int p = -1) {
  int before = cnt[c[u]] + delt;
  int parold = 0;
  if (p != -1) {
    parold = cnt[c[p]] + delt;
  }
  for (int v : g[u]) {
    if (v != p) {
      dfs(v, u);
    }
  }
  ++delt;
  cnt[c[u]] = -delt + before;
  if (p != -1) {
    res[c[p]] += square(cnt[c[p]] + delt - parold);
  } else {
    for (int i = 0; i < n; i++) {
      res[i] += square(cnt[i] + delt);
    }
  }
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    --c[i];
    ++occ[c[i]];
  }
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0);
  for (int i = 0; i < n; i++) {
    cout << square(n) - res[i] + occ[i] << '\n';
  }
  return 0;
}


Measured memory_bytes: 36388
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const ll N = 100 + 5, MOD = 1e9+7;

ll n;
ll v[N],c[N];
ll contri[N],ans;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin>>n;

    for( ll i=1; i<=n; i++ )     cin>>v[i];
    for( ll i=1; i<=n; i++ )     cin>>c[i];

    for( ll i=1; i<=n; i++ ){
        contri[i]=v[i]-c[i];
        if(contri[i]>0)   ans+=contri[i];
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
inline int in();
inline void wr(int);
const int N=(int)1e6+5;
char s1[N],s2[N];
int main(int argc,char**argv){
	scanf("%s%s",s1,s2);
	register int ans=0,len=strlen(s1);
	for(register int i=0;i<strlen(s1);++i)
		ans+=(s1[i]==s2[i]);
	wr(ans),putchar('\n');
}
inline int in(){
	register char c=getchar();
	register int x=0,f=1;
	for(;c<'0'||c>'9';c=getchar())
		if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=getchar())
		x=(x<<1)+(x<<3)+(c&15);
	return x*f;
}
inline void wr(int x){
	if(x<0)putchar('-'),x=-x;
	if(x/10)wr(x/10);
	putchar(x%10+'0');
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for (int i = n - 1; i >= 0; i--)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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

using namespace std;
using uif = uint_fast64_t;
using ll = long long int;
using tTree = __gnu_pbds::tree<ll, __gnu_pbds::null_type, less<ll>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

int qp(int a, ll b)
{
  int ans = 1;
  do
  {
    if (b & 1)
      ans = 1ll * ans * a % mod;
    a = 1ll * a * a % mod;
  } while (b >>= 1);
  return ans;
}
int qp(int a, ll b, int mo)
{
  int ans = 1;
  do
  {
    if (b & 1)
      ans = 1ll * ans * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return ans;
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll, ll);
ll mod_add(ll, ll);
ll mod_mul(ll, ll);
ll mod_div(ll, ll);
void make_fact(ll);
void make_invfact(ll);

int main(void)
{
  string s;
  cin >> s;
  ll n = s.size();
  ll ans = 0;
  for (ll i = 0; i < n / 2; i++)
  {
    if (s[i] != s[n - 1 - i])
      ans++;
  }
  cout << ans << endl;

  return 0;
}

ll mod_pow(ll x, ll r)
{
  if (r == 0)
    return 1;
  else if (r == 1)
    return x % mod;
  else if (r % 2 == 0)
  {
    ll t = mod_pow(x, r / 2) % mod;
    return t * t % mod;
  }
  else
  {
    ll t = mod_pow(x, r / 2) % mod;
    ll k = t * t % mod;
    return k * x % mod;
  }
}
ll mod_add(ll a, ll b)
{
  return (a + b) % mod;
}

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

ll mod_div(ll a, ll b)
{
  return mod_mul(a, mod_pow(b, mod - 2));
}

void make_fact(ll n)
{
  fac[0] = 1;
  rep(i, n)
  {
    fac[i + 1] = mod_mul(fac[i], i + 1);
  }
}

void make_invfact(ll n)
{
  invfac[n] = mod_pow(fac[n], mod - 2);
  for (int i = n - 1; i >= 0; i--)
  {
    invfac[i] = mod_mul(invfac[i + 1], i + 1);
  }
}

Measured memory_bytes: 256
def main():
    N = int(input())
    N %= 10
    if N in {2, 4, 5, 7, 9}:
        print('hon')
    elif N in {0, 1, 6, 8}:
        print('pon')
    else:
        print('bon')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9044
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <cmath>
using namespace std;
const int N = 2e5 + 100;
int n, ans, m;
int main()
{
    cin >> n >> m;
    for (int i = 1; i <= sqrt(m); i++)
    {
        if (m % i == 0)
        {
            if (i >= n)
                ans = max(m/i, ans);
            if (m / i >= n)
                ans = max(i, ans);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(s: str):
    n = len(s)
    for i, c in enumerate(s):
        if i == n-1:
            print('-1 -1')
            return
        if i <= n-3:
            if c == s[i+2]:
                print(i+1, i+3)
                return
        if c == s[i+1]:
            print(i+1, i+2)
            return
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    solve(s)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#define ll long long

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    int curr_range_s = 1;
    int curr_range_e = n;
    for (int i = 0; i < m; i++) {
        int l, r;
        cin >> l >> r;
        curr_range_s = max(curr_range_s, l);
        curr_range_e = min(curr_range_e, r);
    }
    cout << max(0, curr_range_e - curr_range_s + 1);
}

Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>

int main() {

	int A, B, C, X, Y, cost, m, left;

	std::cin >> A >> B >> C >> X >> Y;

	if (2 * C >= A + B) {
		cost = A * X + B * Y;
	}
	else {
		m = std::min(X, Y);
		cost = 2 * C * m;
		X = X - m;
		Y = Y - m;
		left = std::max(X, Y);
		cost += std::min( 2 * C*left, std::max(A*X, B*Y));
	}

	std::cout << cost << std::endl;

	return 0;
}

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

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

    int sum, p, ma;

    sum = ma = 0;
    for (int i = 0; i < n; i++) {
        cin >> p;
        sum += p;
        ma = max(ma, p);
    }

    cout << sum - ma / 2 << endl;

    return 0;
}


Measured memory_bytes: 256
import sys
import math
import string
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect

MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()


def func(a, b):
    return a+b


class SegmentTree:
    """
    各ノードが半開区間に対応した完全二分木。
    子は親を半分にした区間を持つ。
    構築O(n), 区間に対する操作O(logn), 値の更新O(logn)
    区間に対する操作は最小値, 最大値, 区間に対する和など柔軟に変更して用いよう！
    """

    def __init__(self, x, init_val):  # 構築, init_valは配列の初期値
        self.init_val = init_val
        self.length = 2 ** ((len(x) - 1).bit_length())
        self.data = [init_val] * 2 * self.length
        for i in range(len(x)):
            self.data[i + self.length - 1] = x[i]
        for i in range(self.length - 2, -1, -1):
            self.data[i] = func(self.data[2 * i + 1], self.data[2 * i + 2])

    def teach_current_val(self, index):
        return self.data[index + self.length - 1]

    def replace(self, index, val):  # indexの値をvalに更新
        index += self.length - 1
        self.data[index] = val
        while index:
            index = (index - 1) // 2
            self.data[index] = func(self.data[2 * index + 1], self.data[2 * index + 2])

    def query(self, left, right):  # 半開区間の最小値等を求める, 葉からさかのぼっていくイメージ。
        if right <= left:
            return self.init_val
        left += self.length - 1  # self.dataの位置に合わせる。
        right += self.length - 2  # self.dataの位置に合わせる。半開区間
        ans_ = self.init_val
        while right > left + 1:
            if left & 1 == 0:  # if left_index%2 == 0:
                ans_ = func(ans_, self.data[left])
            if right & 1 == 1:  # if right_index%2 == 1:
                ans_ = func(ans_, self.data[right])
                right -= 1
            left //= 2
            right = (right - 1) // 2
        if left == right:
            ans_ = func(ans_, self.data[left])
        else:
            ans_ = func(func(ans_, self.data[left]), self.data[right])
        return ans_


N = int(input())
S = input()
Q = int(input())
alphabets = string.ascii_lowercase
segs = []
check = dict()
for i in alphabets:
    segs.append([1 if S[l] == i else 0 for l in range(N)])
for i in range(26):
    segs[i] = SegmentTree(segs[i], 0)
for _ in range(Q):
    Query = list(map(str, input().split()))
    if Query[0] == "1":
        i, c = int(Query[1]), Query[2]
        if check.get(str(i - 1)):
            segs[ord(check[str(i - 1)]) - 97].replace(i - 1, 0)
            segs[ord(c) - 97].replace(i - 1, 1)
            check[str(i - 1)] = c
        else:
            segs[ord(S[i - 1]) - 97].replace(i - 1, 0)
            segs[ord(c) - 97].replace(i - 1, 1)
            check[str(i - 1)] = c
    else:
        l, r = map(int, (Query[1], Query[2]))
        ans = 0
        for i in segs:
            if i.query(l-1, r) > 0:
                ans += 1
        print(ans)


Measured memory_bytes: 378220
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
#define fori(i,s,n) for(int i=s;i<=n;i++)
#define ford(j,s,n) for(int i=n;i>=s;i--)
#define pb push_back
#define TEST int t; cin>>t; for(int T=1;T<=t;T++)
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   string a;
    cin>>a;
   	if(a[1]=='R')
    	a[1]='B';
    else a[1]='R';
    cout<<a;
    return 0;
}


Measured memory_bytes: 3640
H, W = map(int, input().split())
MAP = [input() for i in range(H)]
NUM = [[0 for i in range(W)] for j in range(H)]

for i in range(H):
    for j in range(W):
        if MAP[i][j] == '#':
            if i != 0:
                NUM[i-1][j] += 1
                if j != 0:
                    NUM[i-1][j-1] += 1
                if j != W-1:
                    NUM[i-1][j+1] += 1
            if j != 0:
                NUM[i][j-1] += 1
            if j != W-1:
                NUM[i][j+1] += 1
            if i != H-1:
                NUM[i+1][j] += 1
                if j != W-1:
                    NUM[i+1][j+1] += 1
                if j != 0:
                    NUM[i+1][j-1] += 1
for i in range(H):
    for j in range(W):
        if MAP[i][j] == '#':
            NUM[i][j] = '#'
    else:
        print(''.join(map(str, NUM[i])))


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

struct bou{
    int p,q,r,b;
    bou(){}
    bou(int pp,int qq,int rr,int bb){
        p=pp;q=qq;r=rr;b=bb;
    }
};
vector<bou> ins;
int solve(int at){
    if(at==0) return 1;
    else{
        at--;
        int rm=solve(ins[at].r),bm=solve(ins[at].b);
        int lcm=ins[at].p*rm/__gcd(ins[at].p*rm,ins[at].q*bm)*ins[at].q*bm;
        return lcm/ins[at].p+lcm/ins[at].q;
    }
}
int main(){
    int n;
    for(;;){
        scanf("%d",&n);
        if(n==0) break;
        ins=vector<bou>(n);
        vector<bool> isroot(n,true);
        for(int i=0;i<n;i++){
            int p,q,r,b;
            scanf("%d%d%d%d",&p,&q,&r,&b);
            int gcd=__gcd(p,q);
            p=p/gcd;
            q=q/gcd;
            ins[i]=bou(p,q,r,b);
            if(r!=0) isroot[r-1]=false;
            if(b!=0) isroot[b-1]=false;
        }
        for(int i=0;i<n;i++){
            if(isroot[i]){
                printf("%d\n",solve(i+1));
            }
        }
    }
}

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

const int MAXSIZE = 25;
const int END = -1;
struct StNod
{
  int m_nDept;
  int m_nHigh;
  int m_nParnt;
  int m_nLeft;
  int m_nRigt;

  StNod() :
    m_nDept(END), m_nHigh(END), m_nParnt(END), m_nLeft(END), m_nRigt(END)
  { }
};

void fnInput(vector<StNod> &rvoNod)
{
  StNod oNod;
  rvoNod.resize(MAXSIZE, oNod);

  int nMaxSiz;
  cin >> nMaxSiz;

  for (int i = 0; i < nMaxSiz; i++)
  {
    int nParnt, nLeft, nRigt;
    cin >> nParnt >> nLeft >> nRigt;

    rvoNod[nParnt].m_nLeft = nLeft;
    rvoNod[nParnt].m_nRigt = nRigt;
    if (nLeft != END)  rvoNod[nLeft].m_nParnt = nParnt;
    if (nRigt != END)  rvoNod[nRigt].m_nParnt = nParnt;
  }
}

void fnSetDepth(vector<StNod> &rvoNod, int nx, int nDept)
{
  rvoNod[nx].m_nDept = nDept;
  
  if (rvoNod[nx].m_nLeft != END)
    fnSetDepth(rvoNod, rvoNod[nx].m_nLeft, nDept + 1);

  if (rvoNod[nx].m_nRigt != END)
    fnSetDepth(rvoNod, rvoNod[nx].m_nRigt, nDept + 1);
}

int fnSetHight(vector<StNod> &rvoNod, int nx)
{
  int nLHigh =0, nRHigh = 0;

  if (rvoNod[nx].m_nLeft != END)
    nLHigh = fnSetHight(rvoNod, rvoNod[nx].m_nLeft) + 1;
  if (rvoNod[nx].m_nRigt != END)
    nRHigh = fnSetHight(rvoNod, rvoNod[nx].m_nRigt) + 1;
  
  return rvoNod[nx].m_nHigh = max(nLHigh, nRHigh);
}

void fnBinTree(vector<StNod> &rvoNod)
{
  int nx = 0;
  while (rvoNod[nx].m_nParnt != END)
    nx = rvoNod[nx].m_nParnt;

  int nDept = 0;
  fnSetDepth(rvoNod, nx, nDept);
  fnSetHight(rvoNod, nx);
}

void fnResult(const vector<StNod> &cnrvoNod)
{
  for (int i = 0; i < cnrvoNod.size(); i++)
  {
    if (cnrvoNod[i].m_nDept == END)  break;
    cout << "node " << i << ": parent = " << cnrvoNod[i].m_nParnt << ", sibling = ";

    if (cnrvoNod[i].m_nParnt == END)  cout << END;
    else
    {
      int nx = cnrvoNod[i].m_nParnt;
      if (i == cnrvoNod[nx].m_nLeft)  cout << cnrvoNod[nx].m_nRigt;
      else                            cout << cnrvoNod[nx].m_nLeft;
    }
    
    cout << ", degree = ";
    int nCCnt = 0;
    if (cnrvoNod[i].m_nLeft != END)  nCCnt++;
    if (cnrvoNod[i].m_nRigt != END)  nCCnt++;
    cout << nCCnt << ", depth = " << cnrvoNod[i].m_nDept << ", height = " << cnrvoNod[i].m_nHigh;

    if (!cnrvoNod[i].m_nDept)       cout << ", root";
    else if (!cnrvoNod[i].m_nHigh)  cout << ", leaf";
    else                            cout << ", internal node";
    cout << endl;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<StNod> voNod;

  fnInput(voNod);
  fnBinTree(voNod);
  fnResult(voNod);
  return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    ll x,t;
    cin>>x>>t;
    if (x<=t)
        cout<<"0\n";
    else
        cout<<x-t<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
using namespace std;
int main(){
	multiset<int>s;
	int q;
	cin>>q;
	while(q--){
		int c,x;
		cin>>c>>x;
		if(c==0){
			s.insert(x);
			cout<<s.size()<<endl;
		}
		else if(c==1){
			cout<<s.count(x)<<endl;
		}
		else if(c==2){
			s.erase(x);
		}
		else if(c==3){
			int y;
			cin>>y;
			for(set<int>::iterator i=s.lower_bound(x); i!=s.upper_bound(y); i++)
				cout<<*i<<endl;
		}
	}
	return 0;
}


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

const int MOD=1000000007;

int main(){
  int n;
  cin>>n;
  vector<ll> a(n);
  rep(i,n) cin>>a[i];
  ll ans=0;
  rep(i,60){
    ll X=0, Y=0;
    rep(j,n){
      if((a[j]>>i)&1){
        X++;
      }else{
        Y++;
      }
    }
    ll now=X*Y%MOD;
    rep(j,i){
      now=now*2%MOD;
    }
    ans+=now;
    ans%=MOD;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 5508
#include <stdio.h>

int x[200010],y[200010];
long long int s[200010],t[200010];
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	for(int i=1;i<=a;i++) scanf("%d",&x[i]);
	for(int i=1;i<=b;i++) scanf("%d",&y[i]);
	for(int i=1;i<=a;i++) s[i] = s[i-1] + x[i];
	for(int i=1;i<=b;i++) t[i] = t[i-1] + y[i];
	
	int ans = 0;
	for(int i=0;i<=a;i++)
	{
		if(s[i]<=c)
		{
			int min = 0, max = b;
			int C = 0;
			while(min<=max)
			{
				int h = (min+max)/2;
				if(s[i]+t[h]<=c)
				{
					C = h;
					min = h+1;
				}
				else max = h-1;
			}
			ans = ans>i+C?ans:i+C;
		}
	}
	printf("%d",ans);
}

Measured memory_bytes: 6416
fun main(args: Array<String>) {
    val inputs = readInputLine().split(" ").map { Integer.parseInt(it) }
    val n = inputs[0]
    val k = inputs[1]
    
    // うにの場合の最大数を超えるKはありえない
    // 最大数は1 to (N-1)までの総和
    if (k > (n - 1) * (n - 2) / 2) {
        println("-1")
        return
    }
    
    // 辺の本数を出す
    println("${n - 1 + (n - 1) * (n - 2) / 2 - k}")
    
    // まずはうにを構成する辺を作る
    for (i in 2..n) {
        println("1 $i")
    }
    
    // 条件を満たす点を減らす辺を生やす
    var s = 2
    var e = 3
    for (i in 1..(n - 1) * (n - 2) / 2 - k) {
        println("$s $e")
        e++
        if (e > n) {
            s++
            e = s + 1
        }
    }
}
 
fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 38556
n,m=list(map(int,input().split()))
k=[]
s=[]

def cntbin(num):
    bin_num = bin(num)[2:]
    count = 0
    for i in bin_num:
            count += int(i)
    return count

for i in range(m):
    kk,*ss=list(map(int,input().split()))
    k.append(kk)
    s.append(ss)

p=list(map(int,input().split()))

ans=0
for i in range(2**n):
    ok=True
    for mm in range(m):
        if not ok:break
        mask=0
        for ss in s[mm]:
            mask+=1 << ss-1
        on=cntbin(i&mask)
        if p[mm]!=on%2:
            ok=False

    if ok:ans+=1

print(ans)

Measured memory_bytes: 9136
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
ll pow2(ll a, int b){
    ll ret = 1LL;
    ll cur = a;
    while(b > 0){
        if(b % 2){
            ret = MUL(ret, cur);
        }
        cur = MUL(cur, cur);
        b /= 2;
    }
    return ret;
}

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

    int n; cin >> n;
    ll A, B; cin >> A >> B;

    ll res = SUB(pow2(2LL, n), 1LL);

    for(auto X : {A, B}){
        ll cur = 1LL;
        rep(i, X){
            cur = MUL(cur, n - i);
        }
        rep(i, X){
            cur = DIV(cur, i + 1);
        }
        res = SUB(res, cur);
    }

    cout << res << endl;

    return 0;
}


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

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

  bool ans=false;

  if(A==7 && B==5 && C==5){
  cout << "YES" << endl;
  }
  else if(B==7 && A==5 && C==5){
  cout << "YES" << endl;    
  }
  else if(C==7 && A==5 && B==5){
  cout << "YES" << endl;
  }
  else{
  cout << "NO" << endl;
  }

return 0;
}


Measured memory_bytes: 256
n = int(input())
#文字列を同一か判別するために全てsortして格納する
#インプットした文字列をソートして文字列として格納する
s = [''.join(sorted(input())) for _ in range(n)]
#babacaba >>> aaaabbbcとする
######################
#同一性を判定するのにはハッシュテーブルを活用すると良い
#辞書はハッシュテーブルとして高速なために使用
s_dict = {}
for i in range(n):
	if s[i] in s_dict:
		s_dict[s[i]] += 1
	else:
		s_dict[s[i]] = 1
		#辞書内になくとも自動で追加される
		#>>>{xxx:1 yyy:1 zzz:1}
ans = 0
#辞書内の加算された数字についてnCrで2つの組み合わせを検討する
for j in s_dict.values():
	ans += j*(j-1)//2
	#xxxについて、2以上あれば1組は存在するということで+
print(ans)

Measured memory_bytes: 23880
while(n=gets.to_i)>0
r=0..u=n-1
l=r.map{{}}
gets.to_i.times{a,b,c=eval"[#{gets}]";l[a][b]=l[b][a]=c/100-1}
m=r.to_a-o=[s=0]
u.times{a,b=o.product(m).min_by{|i,j|l[i][j]||1e9};s+=l[a][b];m-=o+=[b]}
p s
end

Measured memory_bytes: 6972
#include <stdio.h>
long long n,x,i,ans;
int main(){
scanf("%lld%lld",&n,&x);
ans=(n-1)/x;
for(i=0;i<4;i++){scanf("%lld",&x);ans=(ans>(n-1)/x?ans:(n-1)/x); }
printf("%lld",5+ans);
return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 300 + 10;
const int MOD = 1000000000 + 7;

struct State
{
	int x, y, z;
};

int n, m;
vector<pair<int, int> > lim[MAXN];

queue<State> q;
int f[MAXN][MAXN][MAXN];
bool vis[MAXN][MAXN][MAXN];

void add(int x, int y, int z, int v)
{
	if(x > n || y > n || z > n)
		return ;
	f[x][y][z] = (f[x][y][z] + v) % MOD;
	if(vis[x][y][z])
		return ;
	vis[x][y][z] = true;
	q.push((State){x, y, z});
}

void work()
{
	int ans = 0;
	add(0, 0, 0, 1);
	while(!q.empty())
	{
		int x = q.front().x, y = q.front().y, z = q.front().z;
		q.pop();
		int r = max(x, max(y, z));
		for(int i = 0; i < lim[r].size(); i++)
		{
			int tmp = (lim[r][i].first <= x) + (lim[r][i].first <= y) + (lim[r][i].first <= z);
			if(tmp != lim[r][i].second)
				f[x][y][z] = 0;
		}
		if(r == n)
			ans = (ans + f[x][y][z]) % MOD;
		add(r + 1, y, z, f[x][y][z]);
		add(x, r + 1, z, f[x][y][z]);
		add(x, y, r + 1, f[x][y][z]);
	}
	cout << ans << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n >> m;
	for(int i = 1; i <= m; i++)
	{
		int l, r, x;
		cin >> l >> r >> x;
		lim[r].push_back(make_pair(l, x));
	}

	work();

	return 0;
}


Measured memory_bytes: 146944
#include <iostream>
using namespace std;
int main(){
	int n,b,f,r,v;
	cin>>n;
	int ninzu[4][3][10]={0};
	for(int i=0;i<n;i++){
		cin>>b>>f>>r>>v;
		ninzu[b-1][f-1][r-1]=ninzu[b-1][f-1][r-1]+v;

	}
	for(int j=0;j<4;j++){
		for(int k=0;k<3;k++){
			for(int l=0;l<10;l++){
				cout<<" "<<ninzu[j][k][l];
				if(l==9){
					cout<<endl;
				}
				if((l==9&&k==2)&&j!=3){
				cout<<"####################"<<endl;
				}

			}
		}

	}
return 0;
}

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

int main() {
  int W, a, b;
  cin >> W >> a >> b;
  if (a < b) {
    cout << max(b-a-W, 0) << endl;
  } else {
    cout << max(a-b-W, 0) << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(lli i=0, i##_len=(lli)(n); i<i##_len; i++)
#define repf(i, n) for(lli i=1, i##_len=(lli)(n+1); i<i##_len; i++)
#define per(i, n) for(lli i=((lli)(n))-1; i>=0; i--)
#define perf(i, n) for(lli i=((lli)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<lli>
#define vvi vector<vector<lli>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
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; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    lli a, b;
    cin >> a >> b;
    lli pin = 1, cnt = 0;
    while(pin < b){
        cnt++;
        pin = pin-1+a;
    }
    cout << cnt << endl;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> P(N);
    vector<int> Q(N);
    for(int i=0; i<N; i++){
        cin >> P.at(i);
    }
    for(int i=0; i<N; i++){
        cin >> Q.at(i);
    }
    int p,q;
    int cnt=0;
    vector<int> base(N);
    for(int i=0; i<N; i++){
        base.at(i) = i+1;
    }
    do{
        bool same_P = true;
        bool same_Q = true;
        for(int i=0; i<N; i++){
            if(base.at(i) != P.at(i)) same_P = false;
            if(base.at(i) != Q.at(i)) same_Q = false;
        }
        if(same_P) p=cnt;
        if(same_Q) q=cnt;
        cnt++;
    }while(next_permutation(base.begin(), base.end()));
    cout << abs(p-q) << endl;
}

Measured memory_bytes: 3556
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)
MOD = 998244353


def main():
    N = int(input())
    if N % 2 == 0:
        print(N // 2 - 1)
    else:
        print(N // 2)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<string,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
    int n,k;cin >> n >> k;
    vector<LL> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    LL ans = 0;
    vector<LL> a(n+1,0),b(n+1,0);
    for (int i = 0; i < n; i++) {
        a[i+1]=a[i]+v[i];
    }
    for (int i = 0; i < n; i++) {
        b[i+1]=b[i]+v[n-i-1];
    }
    for (int i = 0; i <= k; i++) {
        vector<LL> m;
        LL sum = 0;
        for (int j = 0; j < i; j++) {
            if(v[j]<0) m.pb(v[j]);
        }
        for (int j = 0; j <= min(n-i,k-i); j++) {
            sum = a[i]+b[j];
            vector<LL> mm;
            mm=m;
            for (int s = 0; s < j; s++) {
                if(v[n-s-1]<0) mm.pb(v[n-s-1]);
            }
            int res = k-i-j;
            sort(ALL(mm));
            for (int s = 0; s < min((int)mm.size(),res); s++) {
                sum-=mm[s];
            }
            ans=max(ans,sum);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define RREP(i,a,n) for(int i=n-1;i>=a;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define all(a) (a).begin(),(a).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define sz(x) ((int)(x).size())
#define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define fs first
#define sc second

#define MOD 1000000007
#define INF 1LL<<55

#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)

using namespace std;

using ll = long long;

template<typename T1,typename T2> using P = pair< T1, T2 >;
using Pii = P<int,int>;
using Pll = P<ll,ll>;
using Pdd = P<double,double>;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<ll>;
using Vs = V<string>;

template<typename T1,typename T2> using M = map< T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

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

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

// please declaration dx[8], dy[8]
#define DX {-1,0,1,0,-1,-1,1,1}
#define DY {0,-1,0,1,-1,1,1,-1}
#define DX2 {-1,0,1,0}
#define DY2 {0,-1,0,1}

// 最大公約数
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
// 最大公倍数
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
// 階乗
ll factorial(ll n){if(n > 1)return n * factorial(n - 1);else return 1;}
// io 高速化
struct io{io(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}io;

signed main() {
  ll n, k;
  in(n, k);

  ll count = 0;
  ll count2 = 0;
  if (k % 2 == 0) {
    REP(i, 1, n+1) {
      if (i % k == 0) {
        count++;
      }
      if (i % k == k / 2) {
        count2++;
      }
    }
    count = count * count * count + count2 * count2 * count2;
  } else {
    REP(i, 1, n+1) {
      if (i % k == 0) {
        count++;
      }
    }
    count = count * count * count;
  }
  out(count);

  return 0;
}


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

int main() {
  long long N;
  cin >> N;
  int count = 1;
  int M;
  
  vector<long long> P(N);
  cin >> P.at(0) ;
  M = P.at(0);
  for (int i = 1; i < N; i++) {
    cin >> P.at(i);
    int m = P.at(i);
    M = min(m,M);
    if (M == P.at(i)){
      count++;
    }
  }
  cout << count << endl;
}
  
 

Measured memory_bytes: 1792
use std::io::Read;

fn main() {
    let mut buff = String::new();
    std::io::stdin().read_to_string(&mut buff).unwrap();
    let mut iter = buff.split_whitespace();

    let n: i32 = iter.next().unwrap().parse().unwrap();

    if n % 2 == 0 {
        println!("{}", n);
    } else {
        println!("{}", n * 2);
    }

    ()
}


Measured memory_bytes: 4352
import numpy as np

# 整数の入力
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

antennas = np.array([a, b, c, d, e])
xx0, xx1 = np.meshgrid(antennas, antennas)

distance = np.abs(xx0 - xx1)

if np.all(distance <= k):
    print('Yay!')
else:
    print(':(')


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

int
main ()
{
    int n, m;
    std::cin >> n >> m;

    std::vector<bool> solved(n + 1, false);
    std::vector<int>  penalty_count(n + 1, 0);

    for (int i = 1; i <= m; ++i) {
      int p;          // 1 <= p <= n
      std::string s;  // "AC" or "WA"
      std::cin >> p >> s;

      if ( solved[p] )
        continue;

      if ( s == "AC" ) {
        solved[p] = true;
      } else {
        penalty_count[p]++;
      }
    }

    int ac_count = 0;
    int penalty_count_sum = 0;
    for (int i = 1; i <= n; ++i) {
      if ( solved[i] ) {
        ac_count++;
        penalty_count_sum += penalty_count[i];
      }
    }

    std::cout << ac_count << " " << penalty_count_sum << std::endl;
}


Measured memory_bytes: 640