akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  // n件の情報
  int n;
  cin >> n;

  // 棟-->階-->フロア
  vector<vector<vector<int>>> a(4, vector<vector<int>>(3, vector<int>(10, 0)));

  // b棟
  // f階
  // r番目の部屋
  // v人が追加で入居（マイナスの場合は退去）
  for (int i = 0; i < n; i++) {
    int b, f, r, v;
    cin >> b >> f >> r >> v;

    // 0-indexedにする
    b--;
    f--;
    r--;

    a.at(b).at(f).at(r) += v;
  }

  // 棟
  for (int b = 0; b < 4; b++) {
    // 階
    for (int f = 0; f < 3; f++) {
      // 部屋番号
      for (int r = 0; r < 10; r++) {
        cout << " " << a.at(b).at(f).at(r);
      }
      cout << endl;
    }

    // 最後は出力しない
    if (b != 3) {
      for (int i = 0; i < 20; i++) { cout << "#"; }
      cout << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3156
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

const int MX = 210000;
ll bit[MX];
ll sum(int i){
	ll res = 0;
	for(; i; i -= i & -i) res += bit[i];
	return res;
}
void add(int i, int x){
	for(; i < MX; i += i & -i) bit[i] += x;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	string s; cin >> s;
	int cnt[256] = {}, cur[256] = {}, odd = 0;
	for(char c : s) cnt[c]++;
	rep(i, 256) odd += cnt[i] % 2;
	
	if(odd > 1){
		cout << -1 << endl;
		return 0;
	}
	
	string t;
	for(char c : s){
		if(cnt[c] / 2 == cur[c]) continue;
		t += c;
		cur[c]++;
	}
	rep(i, 256) if(cnt[i] % 2) t += (char)i;
	for(int i = t.size() - odd - 1; i >= 0; i--) t += t[i];
	
	assert(s.size() == t.size());
	
	map<char, vi> pos;
	for(int i = t.size() - 1; i >= 0; i--) pos[t[i]].pb(i);
	vi ord;
	for(char c : s){
		ord.pb(pos[c].back());
		pos[c].pop_back();
	}
	//dbg(t); dbg(ord);
	
	ll ans = 0;
	rep(i, ord.size()){
		ans += sum(ord.size() - ord[i]);
		add(ord.size() - ord[i], 1);
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 4876
<?php

$w = intval(fgets(STDIN));
$arr = array();
for($i = 1; $i <= $w; $i++){
	$arr[$i] = $i;
}

$n = intval(fgets(STDIN));
for($i = 0; $i < $n; $i++){
	fscanf(STDIN, "%d,%d", $a, $b);
	$tmp = $arr[$a];
	$arr[$a] = $arr[$b];
	$arr[$b] = $tmp;
}

for($i = 1; $i <= $w; $i++){
	echo $arr[$i]."\n";
}

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

#define ll long long
#define ull long long unsigned
#define vii vector<int>
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pdd pair<double,double>
#define pldld pair<long long double, long long double>
#define ff first
#define ss second
#define pb push_back
#define read freopen("alu.txt","r",stdin);
#define write freopen("vorta.txt","w",stdout);
#define fastio ios::sync_with_stdio(false); cin.tie(NULL);
#define PI 2*acos(0.0)

const int MAX=100005, MOD=1000000007;
const ll inf=1e9;

int arr[MAX];
vector<ll>v;
map<ll,int>cnt;
int main(){

    fastio;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        ll val;
        cin>>val;
        if(!cnt[val]){
            v.pb(val);
        }
        cnt[val]++;
    }
    sort(v.begin(),v.end(),greater<ll>());
    ll a=0,b=0;
    ll ans=0;
    for(int i=0;i<v.size();i++){
        if(cnt[v[i]]>=4) ans=max(ans,(v[i]*v[i]));
    }
    for(int i=0;i<v.size();i++){
        if(!a && cnt[v[i]]>=2) a=v[i];
        else if(!b && cnt[v[i]]>=2) b=v[i];
    }
    ans=max(ans,(a*b));
    cout<<ans<<"\n";


}











Measured memory_bytes: 7284
#include<bits/stdc++.h>
#define DIST(x1,x2, y1, y2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)))
#define DIST3D(x1,x2, y1, y2, z1, z2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)) + ((z1-z2)*(z1-z2)))
#define CLR(a) a.clear()
#define VCLR(a, n) for(int i=0; i<=n+3; i++) a[i].clear()
#define SIZE(a) a.size()
#define ERASE(a, b) memset(a, b, sizeof a)
#define PB(a, b) a.push_back(b)
#define PB2(a,i,b) a[i].push_back(b)
#define LL long long
#define ULL unsigned long long
#define DBG cout<<"I Am Here"<<endl
#define DBGA(a) cout<<a<<endl
#define DBGI(b,a) cout<<b<<' '<<a<<endl
#define DBGL(i,s,e,b) or(int i=s; i<=e; i++) cout<<b<<endl
#define INF 1e9
#define INV 1e-6
#define sll(a) scanf("%I64d", &a)
#define pll(a) printf("%I64d\n", a)
#define si(a) scanf("%d", &a)
#define pii pair<int,int>
#define MAX 100006
#define CASE(i) printf("Case %d:\n", i);
#define PI acos(-1)
#define piis pair<int, string>
#define fast1 ios_base::sync_with_stdio(false);
#define fast2 cin.tie(0)

using namespace std;

int arr[100005], cnt[100005];
int current[100005];

int main()
{
    int n, m;
    scanf("%d %d", &n, &m);
    for(int i=1; i<=n; i++) cnt[i] = 1, current[1] = 1;

    for(int i=0; i<m; i++)
    {
        int x, y;
        scanf("%d %d", &x, &y);
        cnt[y]++;
        cnt[x]--;
        if(current[x]>0){
            current[y]++;
        }
        if(cnt[x]==0){
            current[x] = 0;
        }
    }

    int c = 0;
    for(int i=1; i<=n; i++) if(current[i]>0)  c++;

    printf("%d", c);
}


Measured memory_bytes: 1024
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;

int N;
int cnt[13] = { 0 };
int vis[24] = { 0 };

int count() {
	int mi = INF;
	REP(i, 24) {
		REP(j, 24) {
			if (vis[i] && vis[j] && i != j) {
				//cout << "K" << endl;
				int d1 = abs(i - j);
				int d2 = 24 - d1;
				int d = min(d1, d2);
				mi = min(mi, d);
			}
		}
	}
	return mi;
}

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

	
	cin >> N;
	VI D(N);
	REP(i, N) {
		cin >> D[i];
		cnt[D[i]]++;
	}
	if (cnt[0]) {
		cout << 0 << endl;
		return 0;
	}
	vis[0] = 1;
	VI v;
	FOR(i, 1, 12) {
		if (cnt[i] == 1)v.push_back(i);
		else if (cnt[i] == 2) {
			vis[i] = 1;
			vis[24 - i] = 1;
		}
		else if (cnt[i] > 2) {
			cout << 0 << endl;
			return 0;
		}
	}
	
	if (cnt[12] == 1)vis[12] = 1;
	else if (cnt[12] >= 2) {
		cout << 0 << endl;
		return 0;
	}


	int M = v.size();
	if (M == 0) {
		cout << count()<< endl;
		return 0;
	}
	

	int ans = 0;
	REP(k, 1 << M) {
		REP(i, M) {
			if (k&(1 << i))vis[v[i]] = 1, vis[24 - v[i]] = 0;
			else vis[v[i]] = 0, vis[24 - v[i]] = 1;
		}
		ans = max(ans, count());
	}
	cout << ans << endl;
	
	return 0;
}



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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

typedef long long ll;
using namespace std;

int main() {
  char a[4];
  bool flag = false;
  
  rep(i,0,4){
    scanf("%c", &a[i]);
  }
  if(a[0] == a[1] && a[1] == a[2]) flag = true;
	if(a[1] == a[2] && a[2] == a[3]) flag = true;

  if(flag == true){
    printf("Yes\n");
  }
  else printf("No\n");
  

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main () {
    int a, b;
    char op;

    while (true) {
        cin >> a >> op >> b;
        
        if (op == '?') break;

        if (op == '+') {
            cout << a + b << endl;
        } else if (op == '-') {
            cout << a - b << endl;
        } else if (op == '*') {
            cout << a * b << endl;
        } else {
            cout << a / b << endl;
        }
    }
}


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

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);

void header() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

void solve() {
    ll x, y, z;
    cin >>x >>y >>z;
    cout <<z <<" " <<x <<" " <<y <<endl;
}

int main() {
	header();
	solve();
	return 0;
}


Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx2,tune=native") // Auto-Vectorisation

#include "bits/stdc++.h"
#include "chrono"
#include "random"
using namespace std;

/*
//large integers
#include <boost/multiprecision/cpp_int.hpp>
__int128 s128; // pollard rho
__uint128_t u128;

//policy based data structures
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace boost::multiprecision; 
using namespace __gnu_pbds;
*/

typedef long long int ll;
typedef long double ld;
typedef double db;
typedef pair<ll,ll> pll;
typedef unsigned long long u64;
typedef vector<ll> vl;
typedef vector<pll> vpl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef unordered_set<ll> usl;
typedef set<ll> sl;
typedef multiset<ll> mul;
typedef unordered_map<ll,ll> umll;
typedef map<ll,ll> mll;

#define int long long int
#define sz(a) (ll)a.size()
#define lt(a) (ll)a.length()
#define tc(x) ll x; cin>>x; while(x--)
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define bac(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define print(a)  for (auto x : a) cout << x << " "; cout << endl
#define mt make_tuple
#define eb emplace_back
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define all(a) a.begin(),a.end()
#define Sort(x) sort(all((x)))
#define setbits(a) __builtin_popcountll(a)
#define ps(x,y) fixed<<setprecision(y)<<x;
#define hell cout<<"hello"<<'\n'
#define deb(x) cerr<<#x<<" = "<<x<<'\n'
#define F first
#define S second
#define teevra_gati ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //shuffle(all(v), rng);

const string alpha   =   "zabcdefghijklmnopqrstuvwxyz";
const ld PI          =   ld(3.14159265359);
const ll P           =   1e9 + 7; // 998244353; // 1e9 + 9 // 7340033 // 4294967296;
const ll Q           =   1e9 + 6; // 998244352; // 1e9 + 8 // 7340032;
const ll ninf        =   LONG_MIN;
const ll inf         =   8e18;
const ll M           =   2e3 + 5;
const ll N           =   2e5 + 5;

void solve(){
    char a;
    cin>>a;
    if(a>96) cout<<'a';
    else cout<<'A';
}

signed main(){
    teevra_gati
    
    solve();

    //cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 3528
using System;
 
public class Program
{
  static private readonly int MAX = 100;
  static private readonly int INFINITY = (1<<21);
  static private readonly int WHITE = 0;
  static private readonly int GRAY = 1;
  static private readonly int BLACK = 2;
 
  static private int n = -1;
  static private int[,] M = new int[MAX, MAX];
 
  private static void dijkstra()
  {
    int minv;
    int[] d = new int[n];
    int[] color = new int[n];
 
 //   Console.Write("n={0}, d.length={1}, color.length={2}\n", n, d.Length, color.Length);
 
    for(int i=0; i<n; i++)
    {
      d[i] = INFINITY;
      color[i] = WHITE;
    }
 
    d[0] = 0;
    color[0] = GRAY;
    while(true)
    {
      minv = INFINITY;
      int u = -1;
      for(int i=0; i<n; i++)
      {
        if(minv > d[i] && color[i] != BLACK)
    {
      u = i;
      minv = d[i];
    }
      }
 
      if(u == -1) { break; }
      color[u] = BLACK;
      for(int v=0; v<n; v++)
      {
    if(color[v] != BLACK && M[u,v] != INFINITY)
    {
      if(d[v] > d[u] + M[u,v])
      {
        d[v] = d[u] + M[u,v];
        color[v] = GRAY;
      }
    }
      }
    }
 
    for(int i=0; i<n; i++)
    {
      Console.Write("{0} {1}\n", i, (d[i] == INFINITY ? -1 : d[i]));
    }
  }
 
  public static void Main()
  {
    n = int.Parse(Console.ReadLine());
    M = new int[n, n];
 
    for(int i=0; i<n; i++)
    {
      for(int j=0; j<n; j++)
      {
    M[i,j] = INFINITY;
      }
    }
 
    int k, c, u, v;
    for(int i=0; i<n; i++)
    {
      int s=0;
      string [] str = Console.ReadLine().Split(' ');
      u = int.Parse(str[s++]);
      k = int.Parse(str[s++]);
//      Console.Write("{0}, {1}\n", u, k);
      for(int j=0; j<k; j++)
      {
    v = int.Parse(str[s++]);
    c = int.Parse(str[s++]);
    M[u,v] = c;
//  Console.Write("{0}, {1}\n", v, c);
      }
    }
 
    dijkstra();
  }
}

Measured memory_bytes: 432092
import heapq

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

# 準備
left, right = A[:N], A[-N:]

right = list(map(lambda x: -x, right))
left_sum, right_sum = [sum(left)], [-sum(right)]
heapq.heapify(left)
heapq.heapify(right)

# left処理
for i in range(N, 2*N):
    heapq.heappush(left, A[i])
    low = heapq.heappop(left)
    left_sum.append(left_sum[-1] + A[i] - low)

# right処理
for i in range(2*N-1, N-1, -1):
    heapq.heappush(right, -A[i])
    high = -heapq.heappop(right)
    right_sum.append(right_sum[-1] + A[i] - high)

# rightを逆順にしてleftの挙動と合わせる
right_sum = right_sum[::-1]

ans = max([l-r for l, r in zip(left_sum, right_sum)])
print(ans)


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

int main() {
	int A, B;
	cin >> A >> B;
	if (A <= 8 && B <= 8) {
		cout << "Yay!" << endl;
	}
	else {
		cout << ":(" << endl;
	}
}

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


int main() {
  int A, B;
  cin >> A >> B;
  int cnt = 0;
  for (int i = A; i <= B; i++){
    int a1 = i / 10000;
    int a5 = i % 10;
    int a2 = (i % 10000 - i % 1000) / 1000;
    int a4 = (i % 100 - i % 10) / 10;
    if (a1 == a5 && a2 == a4) cnt ++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define REP_IN(i, n, x) for (ll i = 0; i < n; i++)in>>x;
#define REP_OUT(i, n, x) for (ll i = 0; i < n; i++)out<<x<<endl;
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
#define endl '\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; }
// template end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N;
    in >> N;
    ll sum=0;
    REP_AB(i,1,N+1){
        if(i%3!=0 && i%5!=0){
            sum+=i;
        }
    }
    if(N==1){
        out << 1 << endl;
    }else if(N==2){
        out << 3 << endl;
    }else if(N==4){
        out << 7 << endl;
    }else{
        out << sum << endl;
    }
    

    
}

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

string kk(string a,int b){
  int buf[103];
  for(int i=0;i<100;i++) buf[i]=0;
  for(int i=0;i<100;i++){
    int d = 0;
    if( i <(int)a.size() ) d=(a[i]-'0')*b;   
    buf[i+2] += (d/100);
    d %= 100;
    buf[i+1] += (d/10);
    d %= 10;
    buf[i] += d;
    if( buf[i]/100 ) buf[i+2] += buf[i]/100;
    buf[i]%=100;
    if( buf[i]/10 ) buf[i+1] += buf[i]/10;
    buf[i]%=10;
  }
  string res="";
  for(int i=99;i>0;i--){
    if( 1 <= buf[i-1]  && buf[i-1] <= 9 ){
      buf[i] = -1;
      break;
    }
  }
  for(int i=0;i<100;i++) {
    if( buf[i]==-1 ) break;
    res += (buf[i]+'0');
  }
  //cout << res.size() << endl;
  //  cout << a << " " << b << " " << res << endl;
  return res;
}

string pows(int m,int n){
  stringstream s;
  string a;
  s << m;
  s >> a;
  reverse(a.begin(),a.end());
  //  cout << a << endl;
  if( n == 1 ) return a;
  for(int i=1;i<n;i++){
    a = kk( a, m );
    // cout << i << endl;
    //cout << a<< endl;
  }
  return a;
}

string tab[]={"_","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts","err","err","err"};

bool check( string a, int id ){
  for(int j=id+1; j<id+5&&j<(int)a.size();j++ ){
    if( '1'<=a[j] && a[j] <='9' ) return true;
  }
  return false;
}

int main(){
  int n,m;
  while(cin >> m >> n && (n||m) ){
    string res;
    res = pows(m,n);
    for(int i=res.size()-1;i>=0;i--){
      if( i == 0 && check(res,i-1) ){
	bool f = false;
	for(int j=min(i+3,(int)res.size()-1);j>=i;j--){
	  if( res[j] != '0' ) f = true;
	  if( f ) cout << res[j];
	}
      }
      if( (i+1)%4 == 0 && check(res,i)) {
	bool f = false;
	for(int j=min(i+4,(int)res.size()-1);j>i;j--){
	  if( res[j] != '0' ) f = true;
	  if( f ) cout << res[j];
	}
	if( tab[(i+1)/4] != "err" )  cout << tab[(i+1)/4];
      }
    }
    cout << endl;
  }

}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int a,b;

int main(){
	cin>>a>>b;
	if(a==b) cout<<2*a<<endl;
	else cout<<max(a,b)*2-1<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,ans =-1;
  cin >> n;
  for (int i=1;i<n+1;i++)
  {
    if(int(i*(1.08)) == n)
      ans = i;
  }
  if( ans != -1)
    cout << ans;
  else
    cout << ":(";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n,m;cin>>n>>m;
    vector<ll> h(n);
    rep(i,n) cin>>h[i];
    vector<vector<int>> g(n);
    rep(i,m){
        int u,v;cin>>u>>v;u--,v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    int ans=0;
    rep(i,n){
        bool f=true;
        for(auto to:g[i]){
            if(h[to]>=h[i]){
                f=false;break;
            }
        }
        ans+=f;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 9244
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >>n;
  int count=0;
  int a[n]={};
  for(int i=1;i<=n;i++){
    cin >> a[i];
    if(a[i]%2==1 && i%2==1)count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 3548
#include<bits/stdc++.h>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
const int N=2e5+5;
const int MOD=1e9+7;
ll a[N],sum[N];

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

    ll n;
    cin >>n;
    ll t=sqrt(n);
    cout <<t*t<<endl;

    return 0;
}


Measured memory_bytes: 256
x,y = map(int,input().split())

m = 10**9 + 7

if (x + y) % 3 != 0:
    print(0)
else:
    s = (x + y) // 3
    k = y - s
    l = x - s
    if k < 0 or l < 0:
        print(0)
    else:
        a = 1
        b = 1
        for i in range(k + 1,k + l + 1):
            a = (a * i) % m
        for i in range(1,l + 1):
            b = (b * i) % m
        ans = a * pow(b,m-2,m) % m
        print(ans)


Measured memory_bytes: 3064
#include<stdio.h>
int main(){
int a,b,i;char c[12],d[12],e[12];scanf("%s%s%d%d%s",c,d,&a,&b,e);
for(i=0;i<12;i++){if(d[i]!=e[i]){printf("%d %d",a-1,b);break;}
if(c[i]!=e[i]){printf("%d %d",a,b-1);break;}} 
}


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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def area(xy):
    xy = sorted(xy)
    x = [xy[i][0] - xy[0][0] for i in range(3)]
    y = [xy[i][1] - xy[0][1] for i in range(3)]
    return abs(x[1]*y[2] - x[2]*y[1]) / 2

def main():
    n = I()
    s = int(n**0.5) - 1
    while s*s < n:
        s += 1
    xy = [(0,0),(s,1),(s*s-n,s)]
    # print(area(xy))

    return JAA(xy," ", " ")


print(main())





Measured memory_bytes: 6160
#include<stdio.h>

int main(void)
{
	char str1[10000];
	char str2[1000];
	int N;
	int A;

	fgets(str1, sizeof(str1), stdin);
	sscanf(str1, "%d", &N);
	fgets(str2, sizeof(str2), stdin);
	sscanf(str2, "%d", &A);

	if (N % 500 <= A) {
		printf("Yes");
	}
	else {
		printf("No");
	}

	return 0;
}


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


Measured memory_bytes: 2036
def isLast(m1, d1, m2, d2):
  return m2 > m1
 
if __name__ == "__main__":
  import sys
  in_str = ''
  for line in sys.stdin:
    in_str += line
  m1, d1, m2, d2 = [int(_) for _ in in_str.split()]
  print(int(isLast(m1, d1, m2, d2)))

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

int main() {
	int N, M;
	vector<vector<int> > PY;
	cin >> N >> M;
	for (int i = 0; i < M; ++i) {
		int P, Y;
		cin >> P >> Y;
		vector<int> tmp = {i,P,Y};
		PY.push_back(tmp);
	}
	vector<int> P(N+1, 0);
	sort(PY.begin(), PY.end(), [](vector<int> a, vector<int> b) {return a[2] < b[2]; });
	for (int i = 0; i < M; ++i) {
		
		PY[i].push_back(++(P[PY[i][1]]));
	}
	sort(PY.begin(), PY.end(), [](vector<int> a, vector<int> b) {return a[0] < b[0]; });
	for (auto tmp: PY) {
		printf("%06d%06d\n", tmp[1],tmp[3] );
	}
	return 0;
}

Measured memory_bytes: 8160
#include <iostream>

using namespace std;

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

	if (n % 2 == 0){
		ans = 1.0/2.0;
	}else{
		ans = (n+1.0)/ (2.0*n);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map> 
#include <queue>
#include <math.h>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std; 

typedef long long ll; 
const int up=1000005; 

int main(){
	int n; cin>>n; 
	int ans=0;
	for(int i=1;i<=n;i++){
		int d=0; 
		if(i%2==1){
			for(int j=1;j<=i;j++){
				if(i%j==0) d++; 
			}
		}
		if(d==8) ans++; 
	}
	cout<<ans; 
}


Measured memory_bytes: 256
L = int(input()) #縦、横、高さ、３つの総和

#x =  L/3 (-L/6 ～+L/6)
#y = L/3

x = L/3
y = L/3
h = L/3

N = int((((L/6)/0.1)))

Max = 0

for i in range(-N,N+1):
  x = L /3 + 0.1 * i
  y = L/ 3 - 0.1 * i
  h = L/ 3
  L3 = x * y *h
  if L3 > Max:
    Max = L3
print(Max)

Measured memory_bytes: 3060
#include <stdio.h>
#include <algorithm>

#define LIM_S 100002
#define LIM_N 101

char str[LIM_S];

int a, b, c;

void receive_input() {
	fgets(str, sizeof(str), stdin);
	sscanf(str, "%d %d %d", &a, &b, &c);
}

void initialize() {
	// nop
}

int main(void) {
	receive_input();
	initialize();

	if (a == b && b == c && c == a) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define forn(i,n) for(int i=0; i<(int)n; i++)
ll power(ll x,ll n);
bool isprime(ll n);
ll mod=1e9+7;


void test_case()
{
    ll n;
    cin>>n;
    cout<<n+n*n+n*n*n;
}

int main()
{
    fastio
//    int t;
//    cin>>t;
//    while(t--)
    test_case();
}
ll power(ll x,ll n)
{
    ll ans=1;
    while(n>0) {
        if(n&1)
            ans*=x;
        n>>=1;
        x*=x;
    }
    return ans;
}

bool isprime(ll n)
{
    if(n==2 || n==3)
        return true;
    if(n<=1 || n%2==0 || (n%6!=1 && n%6!=5))
        return false;
    for(int i=3;i*i<=n;i+=2) {
        if(n%i==0)
            return false;
    }
    return true;
}


Measured memory_bytes: 3596
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut it = buf.split_whitespace().map(|x| x.parse::<i64>().unwrap());
    // 固定小数点として計算する
    let a = it.next().unwrap();
    let b = it.next().unwrap();
    for x in 0..2000 {
        if x * 8 / 100 != a {
            continue;
        }
        if x / 10 != b{
            continue;
        }
        println!("{}", x);
        return;
    }
    println!("-1");
}


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

using namespace std;

int main(){
    int n, k;
    scanf("%d %d", &n, &k);

    vector<int> trees(n);
    for(int i = 0; i < n; i++)
        scanf("%d", &trees[i]);

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

    int ans = 1000000000 + 500;

    for(int i = 0; i < n - k + 1; i++){
        ans = min(ans, trees[i + k - 1] - trees[i]);
    }

    printf("%d", ans);
}


Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>

#define p(a, b) pair<a, b>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string a, b;
    cin >> a >> b;
    int r = stoi(a + b);
    double s = sqrt(r);
    int q = (int)s;
    if(abs(q-s) < 1e-6){
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
selectCombinations :: Int -> Int -> [[Int]]
selectCombinations n x = filter (\[a, b, c] -> a < b && b < c && a+b+c == x) $ sequence [[1..n], [2..n], [3..n]]

main :: IO ()
main = do
    [n, x] <- getLine >>= return.(map $ \n -> read n :: Int).words
    if n == 0 && x == 0 then
        return ()
    else do
        putStrLn $ show $ length $ selectCombinations n x
        main


Measured memory_bytes: 5592
n,c,k = map(int,input().split())
t = [int(input()) for _ in range(n)]
t.sort()

ans = 0
i = 0
while i < n:
    cnt = 0
    a = t[i]+k
    for j in range(c):
        if i+j < n:
            if t[i+j] <= a:
                cnt += 1
            else:
                break
        else:
            break
    ans += 1
    i += cnt
print(ans)

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

void print(vector<int> v){
    for(const auto& i : v)
        cout << i << " ";
    cout << "\n";
}
const int INF = 1e9 + 5;
int main(int argc, char ** argv){
    int n =0, k = 0;
    cin >> n >> k;
    vector<int> s(n);
    vector<int> dp(n, INF);
    dp[0] = 0;
    for(int i = 0; i < n; ++i){
        cin >> s[i];
    }
    for(int i = 0;i < dp.size();++i){
        for(int j = i + 1; j < i + k +1; ++j ){
            if(j < n)
                dp[j] = min(abs(s[i] - s[j]) + dp[i], dp[j]);
        }
    }
    printf("%d\n", dp[n-1]);
    return 0;
}

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

using namespace std;
 
int main() {
	int n; cin >> n;
	string ans;
	if (n == 0) ans += '0';
	while (n) {
		if (n % 2) ans = '1' + ans, n--;
		else ans = '0' + ans;
		n /= -2;
	}
	cout << ans << endl;

	return 0;
}

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

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

int main()
{
	int n, k, max = 0, gAll = 0;
	std::cin >> n >> k;
	
	for (int i = 0; i < n; ++i)
	{
		int x;
		std::cin >> x;
		if (gAll != 0)
			gAll = gcd(x, gAll);
		else
			gAll = x;
		if (x > max)
			max = x;
	}
	
	if (max >= k && k % gAll == 0)
		std::cout << "POSSIBLE";
	else
		std::cout << "IMPOSSIBLE";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

ll n;
int ans;

int main()
{
    scanf("%lld",&n);
    if(n==2) return printf("1"),0;
    ll i;
    for(i=1;i*i<=n-1;i++) if((n-1)%i==0)
        if(i==1||(n-1)/i==i) ans++; else ans+=2;
    for(i=2;i*i<=n;i++) if(n%i==0)
    {
        ll t=n;
        while(t%i==0) t/=i;
        if(t%i==1) ans++;
    }
    printf("%d",ans+1);
    return 0;
}

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

signed main() {
  cout<<fixed<<setprecision(12);
double N,B,x,box,a,b,ans;
int c;
float ave,A;
 ave=0.0;
 ans=0;
 cin >>N >>A >>B;
 vector<int> v(N);
 for(int i=0;i<N;i++){
   cin >>v[i];
 }
 sort(v.begin(),v.end());
 for(int i=N-1;i>N-A-1;i--){
   ave=ave+v[i];
 }
 ave=ave/A;
 cout <<ave <<endl;
 for(a=0;v[N-A]==v[N-A+a+1];a++){
   if(a+1>A-1){break;}
 }
 for(b=0;v[N-A]==v[N-A-b-1];b++){
   if(N-A-b-1<0){break;}
 }
 if(v[N-A]<v[N-1]){
   c=1;
   for(int i=0;i<a+1;i++){
     c=c*(a+1+b-i)/(i+1);
   }
     ans=ans+c;
 }else{
for(int j=0;j<b+1;j++){
  if(A+j>B){
    break;
  }
  c=1;
   for(int i=0;i<a+1+j;i++){
     c=c*(a+1+b-i)/(i+1);
   }
     ans=ans+c;
       }
     }
   cout<<ans <<endl;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
a[0] = (a[0]-1)%k
for i in range(1,n):
  a[i] = (a[i]+a[i-1]-1)%k
ans = 0
b = {0:1}
for i in range(n):
  if i>0:
    b[a[i-1]] = b.get(a[i-1],0) + 1
  if i>=k:
    b[a[i-k]] -= 1
  if i==k-1:
    b[0] -= 1
  ans += b.get(a[i],0)
print(ans)

Measured memory_bytes: 109772
use std::io::stdin;
use std::vec::Vec;

mod utils {
    use std::io::BufRead;
    use std::str::{self, FromStr};

    pub struct StdinReader<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> StdinReader<R> {
        pub fn new(reader: R) -> StdinReader<R> {
            StdinReader {
                reader: reader,
                buf: Vec::new(),
            }
        }

        #[allow(unused)]
        #[inline]
        pub fn reads<T: FromStr>(&mut self) -> T {
            self.read_until(b' ')
        }

        #[allow(unused)]
        #[inline]
        pub fn readl<T: FromStr>(&mut self) -> T {
            self.read_until(b'\n')
        }

        #[allow(unused)]
        #[inline]
        pub fn read_vec<T: FromStr>(&mut self) -> Vec<T> {
            return self.read_until::<String>(b'\n').trim().split_whitespace().map(|c| c.parse().ok().unwrap()).collect();
        }

        #[inline]
        pub fn read_until<T: FromStr>(&mut self, delim: u8) -> T {
            loop {
                self.buf.clear();
                let len = self.reader
                    .read_until(delim, &mut self.buf)
                    .expect("failed reading bytes");
                match len {
                    0 => panic!("early eof"),
                    1 if self.buf[0] == delim => (),
                    _ => {
                        if self.buf[len - 1] == delim {
                            self.buf.truncate(len - 1);
                        }
                        break;
                    }
                }
            }

            let elem = unsafe { str::from_utf8_unchecked(&self.buf) };
            elem.parse().unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
         }
    }
}


fn main(){
    let stdin = stdin();
    let mut r = utils::StdinReader::new(stdin.lock());
    let n:u64 = r.reads();
    let m:u64 = r.readl();
    let mut a_s:Vec<u64> = r.read_vec();

    a_s.sort();

    a_s.reverse();

    let mut sum = 0;

    for a in &a_s {
        sum += *a;
    }

    let mut ans = "Yes";

    for idx in 0..m {
        let el = a_s[idx as usize];

        if(el * 4 * m < sum ) {
            ans = "No";
            break
        }
    }

    println!("{}", ans);

}


Measured memory_bytes: 4352
#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 getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#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 ll inf =1LL << 62;
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) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

string f;
int idx, len;

const ll NG = -1;

ll shift(ll a, ll b){
    rep(loop, b){
        a >>= 1;
        if(a == 0) return 0;
    }
    return a;
}

ll S(ll x){
    return MUL(x, x, mod);
}

ll expr();
ll term();

ll expr(){
    ll ret = term();
    while(f.substr(idx, 2) == ">>"){
        int tmp = idx;
        idx += 2;
        ll rhs = term();
        if(rhs == NG){
            idx = tmp;
            break;
        }
        ret = shift(ret, rhs);
    }
    return ret;
}

ll term(){
    ll ret;

    if(f[idx] == 'S'){
        idx++;
        assert(f[idx++] == '<');
        ret = S(expr());
        assert(f[idx++] == '>');
    }
    else if(isdigit(f[idx])){
        ret = 0;
        while(isdigit(f[idx])){
            ret = 10 * ret + (f[idx] - '0');
            idx++;
        }
    }
    else ret = NG;

    return ret;
}

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

    while(true){
        getline(cin, f);
        if(f == "#") break;

        string t;
        for(auto& c : f) if(c != ' ') t += c;
        f = t;

        idx = 0;
        cout << expr() << endl;
    }

    return 0;
}

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

using namespace std;

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

    for (int i = 0; i < s.size(); i++) {
        s[i] += n;
        if (s[i] > 'Z') s[i] = 'A' + s[i] % 'Z' - 1;
    }

    cout << s << endl;
}

Measured memory_bytes: 256
#include <cstdio>

int N, D;
int X[20][20];
int ans = 0;
int r = 0;
bool check(int hoge)
{
    //    printf("\n check %d\n", hoge);
    int max = hoge;
    int min = 1;
    int mid;
    while (true) {
        mid = (max + min) / 2;
        if (mid * mid == hoge) {
            return true;
        }
        if (max - min <= 2) {
            return false;
        }
        if (mid * mid < hoge) {
            min = mid;
        } else if (mid * mid > hoge) {
            max = mid;
        }
        //        printf("mid: %d", mid);
    }
}

int main()
{
    scanf("%d %d", &N, &D);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < D; j++) {
            scanf("%d", &X[i][j]);
        }
    }

    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            r = 0;
            for (int k = 0; k < D; k++) {
                r += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            }
            if (check(r)) {
                ans += 1;
                //                printf("i:%d j:%d\n", i, j);
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include<map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
typedef long long ll;
using namespace std;

ll a[10];

int main() {
	REP(i, 1, 7) {
		cin >> a[i];
	}
	ll s = a[1] + a[2] + a[4] + a[5];
	ll ans1 = s - a[1] % 2 - a[4] % 2 - a[5] % 2;
	if (a[1] == 0 || a[4] == 0 || a[5] == 0) {
		cout << ans1 << endl;
		return 0;
	}
	ll ans2 = s - (a[1] - 1) % 2 - (a[4] - 1) % 2 - (a[5] - 1) % 2;
	cout << max(ans1, ans2) << endl;
	

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define pb              push_back
#define int             long long
#define mp              make_pair
#define pr              pair<long long,long long>
#define vr              vector<long long>
#define mod1            1000000007
#define mod2            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define ll              long long
#define ld	            long double
#define w(x)            int x; cin>>x; while(x--)

bool isPerfectSquare(int x) 
{   
  // Find floating point value of  
  // square root of x. 
  int n=sqrt(x);
  if(n*n==x)
  return true;
  else return false;
  
  // If square root is an integer 
 
} 



int32_t main()
{ 
    int n;
    cin>>n;
    int a[n]={0};
    for(int x=1;x<sqrt(n);x++)
    {
        for(int y=1;y<sqrt(n);y++)
        {
            for(int z=1;z<sqrt(n);z++)
            {
                int temp=((x+y)*(x+y)+(y+z)*(y+z)+(z+x)*(z+x))/2;
                if(temp<=n)
                {
                    a[temp-1]++;
                }
                
                
            }
        }
    }
    for(int i=0;i<n;i++)
    cout<<a[i]<<"\n";
        
    
    return 0;
	}

Measured memory_bytes: 3480
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}


int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);

	string days[] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};

	string s;
	cin >> s;

	for(int i = 0; i < 7; ++i){
		if(s == days[i]){
			int res = 6 - i;
			if(res == 0) res = 7;
			cout << res << endl;
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
a, b, k = map(int, input().split())
l = []
for i in range(a, min(a + k, b + 1)):
    if i not in l:
        l.append(i)
for i in range(b, max(b - k, a - 1), -1):
    if i not in l:
        l.append(i)
l.sort()
for i in l:
    print(i)


Measured memory_bytes: 3064
import java.util.*;

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

        int N = scanner.nextInt();
        int M = scanner.nextInt();

        PriorityQueue<City>[] queue = new PriorityQueue[N + 1];

        for (int i = 0; i <= N; i++) {
            queue[i] = new PriorityQueue<>(Collections.reverseOrder());
        }

        for (int i = 0; i < M; i++) {
            int p = scanner.nextInt();
            int y = scanner.nextInt();

            queue[p].offer(new City(i, p, y));
        }

        PriorityQueue<NewCity> newCities = new PriorityQueue<>();
        for (int i = 1; i <= N; i++) {
            while(!queue[i].isEmpty()) {
                City c = queue[i].poll();
                StringBuilder sb = new StringBuilder();

                String id = String.valueOf(c.prefectureId);
                for(int j = 0; j < 6 - id.length(); j++){
                    sb.append("0");
                }
                sb.append(id);

                String size = String.valueOf(queue[i].size() + 1);
                for(int j = 0; j < 6 - size.length(); j++){
                    sb.append("0");
                }
                sb.append(size);

                newCities.add(new NewCity(c.id, sb.toString()));
            }
        }

        while (!newCities.isEmpty()) {
            NewCity c = newCities.poll();
            System.out.println(c.code);
        }
    }
}

class NewCity implements Comparable<NewCity> {
    public int id;
    public String code;

    public NewCity(int id, String code) {
        this.id = id;
        this.code = code;
    }

    @Override
    public int compareTo(NewCity c) {
        if(this.id > c.id) {
            return 1;
        } else if(this.id < c.id) {
            return -1;
        } else {
            return 0;
        }
    }
}

class City implements Comparable<City> {
    public int id;
    public int prefectureId;
    public int born;

    public City(int id, int prefectureId, int born) {
        this.id = id;
        this.prefectureId = prefectureId;
        this.born = born;
    }

    @Override
    public int compareTo(City c) {
        if(this.born > c.born) {
            return 1;
        } else if(this.born < c.born) {
            return -1;
        } else {
            return 0;
        }
    }
}


Measured memory_bytes: 105600
#include<iostream>
#include<cmath>

using namespace std;

int main(){
  unsigned long long N, ans = 0;

  cin >> N;

  if (N%2==0){
    unsigned long long b = 10;
    while(N >= b){
      ans += N / b;
      b *= 5;
    }
    printf("%llu\n",ans);
  }else{
    printf("0\n");
  }
  
}



Measured memory_bytes: 3752
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

int main() {
    string s; cin >> s;
    map<char, ll> mp;
    ll n = sz(s);
    rep(i, n) mp[s[i]]++;
    ll tot = n*(n-1ll)/2ll+1ll;
    for(const auto& m: mp) {
        ll cnt = m.se;
        tot -= cnt * (cnt-1ll) / 2ll;
    }
    cout << tot << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector <string> W(N);
  set <string> s;
  bool ans = true;
  for (int i = 0; i < N; i++) {
	  cin >> W[i];
	  if (s.count(W[i]) > 0) {
		  ans = false;
		  continue;
		}
	  s.insert(W[i]);
	}
  for (int i = 0; i < N - 1; i++) {
	  if (W[i][W[i].size() - 1] != W[i + 1][0]) {
		  ans = false;
		}
	}
  if (ans) {
	  cout << "Yes" << endl;
	} else {
	  cout << "No" << endl;
	}
  return 0;
}


Measured memory_bytes: 256