akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")

#include<bits/stdc++.h>
#define sp " "
#define endl "\n"
#define MAX 10e9
#define MAXN 100001
#define mod 1000000007
#define inf_int 2e9
#define inf_ll 2e18
#define e 1e-9
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpl vector<pair<ll,ll>>
#define vpc vector<pair<char,char>>
#define adj_list vector<vl>
#define umap unordered_map<ll, ll>
#define pll pair<ll,pair<ll, ll>>
#define clr(x) memset(x,0,sizeof(x))
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl
#define google cout << "Case #" << ++it << ": " << ans << endl;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef long long int ll;

ll it = 0, ans = 0;

ll spf[MAXN];
void sieve()
{
    spf[1] = 1;
    for (auto i=2; i<MAXN; i++)
  		spf[i] = i;
  	for (auto i=4; i<MAXN; i+=2)
        spf[i] = 2;
    for (auto i=3; i*i<MAXN; i++)
    {
        if (spf[i] == i)
        {
            for (auto j=i*i; j<MAXN; j+=i)
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
	return;
}

vl getFactorization(ll x)
{
    vl ret;
    while (x != 1)
    {
        ret.push_back(spf[x]);
        x = x / spf[x];
    }
    return ret;
}


void check()
{
	ll n;
	cin >> n;
	cout << !n << endl;
    return ;
}

int32_t main()
{
    fastio
    ll t = 1;
    // cin >> t;
    while(t--)
        check();
    return 0;
}


Measured memory_bytes: 3648
import math
n=int(input())
x1,y1=0,0
x2,y2=10**9,1
y3 = n//x2 +1
if y3>x2:
    y3=x2
x3 = y3*x2 - n


output=[x1,y1,x2,y2,x3,y3]
output=list(map(str,output))
    
print(" ".join(output))

Measured memory_bytes: 38384
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

//ここから編集 

int a[100010];
vector<vector<int>> g(100010);
int sz[100010];

void dfs(int v){

  for(auto u: g[v]){
    
    dfs(u);
  }

  if(g[v].size() == 0){
  }else if(g[v].size() == 1){
    if(sz[g[v][0]] == 0){
      sz[v] = 1;
    }else{
      sz[v] = sz[g[v][0]] + 1;
    }
  }else{
  
    vector<int> vv;
    for(int i=0; i<g[v].size(); i++){
      vv.emplace_back(sz[g[v][i]]);
    }
    int t = g[v].size();
    int mx = 0;
    sort(all(vv));
    for(int i=0; i<g[v].size(); i++){
      mx = max(mx, t + vv[i]);
      t--;
    }
    sz[v] = mx;
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int N; cin >> N;

  for(int i=2; i<=N; i++) {
    cin >> a[i];
    g[a[i]].push_back(i);
  }

  dfs(1);
  cout << sz[1] << endl;
  return 0;
}


Measured memory_bytes: 18632
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  string s,t;
  cin>>s>>t;
  rep(i,s.size() ){
    if(s[i]!=t[i]){
      cout<<"No"<<endl;
      return 0;
    }
  }
  if(s.size() == t.size()-1){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }

  return 0;
}


Measured memory_bytes: 3652
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int INF = (int)1e9 + 7;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n, m; cin >> n >> m;
    vector<vector<int>> acc(m, vector<int>(n + 1, 0));
    vector<int> cnt(m, 0);
    for (int i = 1; i <= n; i++) {
        int k; cin >> k; k--;
        acc[k][i] = 1;
        cnt[k]++;
    }
    for (int k = 0; k < m; k++) {
        for (int i = 1; i <= n; i++) {
            acc[k][i] += acc[k][i - 1];
        }
    }
    vector<int> dp(1 << m, INF);
    dp[0] = 0;
    for (int b = 0; b < 1 << m; b++) {
        int pos = 0;
        for (int k = 0; k < m; k++) if (b & (1 << k)) pos += cnt[k];
        for (int k = 0; k < m; k++) if (!(b >> k & 1)) {
            int cost = cnt[k] - (acc[k][pos + cnt[k]] - acc[k][pos]);
            chmin(dp[b | 1 << k], dp[b] + cost);
        }
    }
    cout << dp[(1 << m) - 1] << endl;
    return 0;
}


Measured memory_bytes: 14724
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
from itertools import accumulate
from bisect import bisect_left
from collections import Counter
dic=Counter(a)
for i in range(m):
  b,c=list(map(int,input().split()))
  dic[c]=dic.get(c,0)+b

dic=sorted(dic.items(),key=lambda x:x[0],reverse=True)

ans=0
num=0
for i in dic:
  num=num+i[1]
  ans=ans+i[0]*i[1]
  if num>=n:
    r=i[0]
    break
 
print(ans-(num-n)*r)


  


Measured memory_bytes: 47016
// inputに入力データ全体が入る
function Main(input) {

	input = input.split(" ");
	
    const H = parseInt(input[0], 10);
    const A = parseInt(input[1], 10);
  
	const Remainder = H % A;
  	var result = Math.floor(H / A);
    var answer = Remainder === 0 ? result : result + 1; 
  	
	//出力
   console.log(answer);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);

int calc(const string& s, int l1, int l2, vector<vector<int>>& dp) {
  if (s[l1] != s[l2]) {
    return 0;
  }
  if (dp[l1][l2] != 0) return dp[l1][l2];
  int ans = calc(s, l1 + 1, l2 + 1, dp) + 1;
  chmin(ans, l2 - l1);
  dp[l1][l2] = ans;
  return ans;
}

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

  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<vector<int>> t(26, vector<int>());
  rep(i, n) {
    t[s[i] - 'a'].push_back(i);
  }

  vector<vector<int>> dp(n, vector<int>(n, 0));

  int ans = 0;
  for (auto& v : t) {            // 26 文字に対して
    if (v.size() < 2) continue;  // 同じ文字が2回以上出てきて無ければその文字はスキップ
    for (int i = 0; i < v.size() - 1; i++) {    // l1
      int l1 = v[i];
      for (int j = i + 1; j < v.size(); j++) {  // l2
        int l2 = v[j];
        int len = calc(s, l1, l2, dp);
        chmax(ans, len);
      }
    }
  }

  cout << ans << endl;

  return 0;
}


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

int main(void) {
	lli n;
	cin>>n;
	lli younroku = (n/500)*1000;
	lli youn = ((n%500)/5)*5;
	cout<<younroku+youn<<endl;
	return 0;
}

Measured memory_bytes: 256
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

const c = input[0];
const s = 'abcdefghijklmnopqrstuvwxyz'.split('');
let ans = 'a';

for (let i=0; i < 27; i++){
	if (s[i] === c) {
		ans = s[i+1];
	}

}
console.log(ans);


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n,a,b;cin>>n>>a>>b;
	ll x[100010];
	for(int i=0;i<n;i++){
		cin>>x[i];
	}
	ll ans=0;
	for(int i=1;i<n;i++){
		ans+=min((x[i]-x[i-1])*a,b);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n,k;
int main()
{
	cin>>n>>k;
	int p=n/k,q=0;
	if (k%2==0)
		q=(n+k/2)/k;
	cout<<(long long)p*p*p+(long long)q*q*q;
}


Measured memory_bytes: 256
x = gets.to_i
num = 0
if x < 7
  num = 1
elsif x < 11
  num = 2
else
  num = (x / 11) * 2
  y = x % 11
  if y == 0
  elsif y < 7
    num += 1
  else
    num += 2
  end
end
puts num


Measured memory_bytes: 14324
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
      	long diff = A + B;
      	if (diff % 2 == 1) {
          System.out.println("IMPOSSIBLE");
        } else {
		  System.out.println(diff / 2);
        }
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  struct task{
    ll a,b;
  };
  vector<task>ts(n);
  rep(i,n)cin>>ts[i].a>>ts[i].b;
  sort(all(ts),[](task a,task b){if(a.b!=b.b)return a.b<b.b;return a.a<b.a;});
  ll f=1;
  ll t=0;
  rep(i,n){
    if(t+ts[i].a>ts[i].b){
      f=0;
      break;
    }
    t+=ts[i].a;
  }
  if(f){
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }

  return 0;

}


Measured memory_bytes: 3456
import java.util.*;

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

		while(sc.hasNextDouble()){
			String[] s = sc.nextLine().split(" ");
			double len = Double.parseDouble(s[0]);
			r = new double[s.length - 1];

			for(int i=1;i<s.length;i++){
				r[i-1] = Double.parseDouble(s[i]);
			}

			double min = Double.MAX_VALUE;
			dp = new double[1<<12][12];

			for(int i=0;i<r.length;i++){
				min = Math.min(min,r[i]+solve(r.length-1,1<<i,i));
			}

			System.out.println(min <= len ? "OK" : "NA");
		}
	}

	private static double[] r;
	private static double[][] dp;

	private static double solve(int rem,int flg,int last){
		if(dp[flg][last] > 0) return dp[flg][last];
		if(rem == 0) return dp[flg][last] = r[last];

		double res = Double.MAX_VALUE;
		for(int i=0;i<r.length;i++){
			if(((1<<i) & flg) > 0) continue;
			double tmp = Math.sqrt( Math.pow(r[last]+r[i],2) - Math.pow(r[last]-r[i],2) );
			res = Math.min(res,tmp+solve(rem-1,flg|(1<<i),i));
		}

		return dp[flg][last] = res;
	}
}

Measured memory_bytes: 17000
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int ret=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') w=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
	return w*ret;
}
int main()
{
	string s;
	cin>>s;
	if(s=="SUN") cout<<7<<endl;
	if(s=="MON") cout<<6<<endl;
	if(s=="TUE") cout<<5<<endl;
	if(s=="WED") cout<<4<<endl;
	if(s=="THU") cout<<3<<endl;
	if(s=="FRI") cout<<2<<endl;
	if(s=="SAT") cout<<1<<endl;
	return 0;
}

Measured memory_bytes: 764
import java.util.Scanner;
import java.util.Arrays;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		try {
		    Scanner sc = new Scanner(System.in);
		    int t,n,k,s,m;
		    n=sc.nextInt();
		    m=n;
		    n--;
		   s=0;k=1;
		   while((n/k)>0)
		   {
		       s=s+n/k;
		       k++;
		 
		   }
		   System.out.println(s);
		} catch(Exception e) {
		}
	}
}


Measured memory_bytes: 35820
/* Just_Do_It ___________ICARUS__________________*/
                 
#include <bits/stdc++.h>
using namespace std;
       
typedef long long ll;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define te ll t; std::cin >> t; while(t--)
#define SZ 100001
//# define M_PIl  3.141592653589793238462643383279502884L 
/*   Proceed with CAUTION   */
ll frec[30000000];
int main(){
	fastio;
	string s,v; ll n,p=0;
  	cin>>s>>n;
  	v = "1";
  	rep(i,0,min((ll)s.length(),n)) {
  		if(s[i]!='1'){ 
  		  v = s[i] ;
		 break;
  		  }
  		}
  	cout<<v<<endl;
  	return 0;
} 

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n, inp;
    while(cin >> n,n){
    int ice[15] = {0};
    rep(i,n){
        cin >> inp;
        ice[inp]++;
    }
    rep(i,10){
        if(ice[i] == 0){
            cout << '-';
        }else{
            rep(j, ice[i]){
                cout << '*';
            }
        }
        cout << endl;
    }
    }
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <limits>
#include <string>
#include <algorithm>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include "math.h"
#include "assert.h"

using namespace std;

#define ll long long

#define buff ios::sync_with_stdio(false)
#define epsilon 1e-07
#define pi 2 * acos(0.0);
#define mod 1000000007   // 1e9+7
#define cerr if(false)cerr
#define watch(x) cerr << #x << " = " << x << endl;

#define xy pair<int, int>
#define x first
#define y second 

#define inf std::numeric_limits<int>().max()

int main() {
	int n;
	cin >> n;
	for(int i=1; i<=n; i++) {
		cout << "ACL";
	}
	cout << endl;

}


Measured memory_bytes: 3068
def main():
    x, n = map(int, input().split())
    p = list(map(int, input().split()))
    _near = -1
    for i in range(-1, 102):
        if i in p:
            continue
        if abs(_near - x) > abs(i - x):
                _near = i
    print(_near)


if __name__ == "__main__":
    main()


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

int main(){
	int n;
	std::cin >> n;
	std::vector<unsigned> array;
	for (int i = 0; i < n; i++){
		int num;
		std::cin >> num;
		array.push_back(num);
	}
	for (int i = 0; i < n; i++){
		std::cout << array[n-i-1];
		if (i != n-1){
			std::cout << " ";
		}
	}
	std::cout << '\n';
	return 0;
}


Measured memory_bytes: 3160
import scala.io.StdIn

object Main extends App {
  val n = StdIn.readLine().toInt
  val s = StdIn.readLine()

  val a = Array.ofDim[Int](n)

  (0 until n).foldLeft(0) { (acc, i) =>
    a(i) = acc + (if ('W' == s(i)) 1 else 0)
    a(i)
  }

  (n - 1 to 0 by -1).foldLeft(0) { (acc, i) =>
    a(i) = a(i) + acc + (if ('E' == s(i)) 1 else 0)
    acc + (if ('E' == s(i)) 1 else 0)
  }
  //println(a.toList.mkString(" "))
  println(a.min - 1)
}

Measured memory_bytes: 42160
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int h, n;
    cin >> h >> n;
    REP(i,n) {
        int n; cin >> n;
        h -= n;
    }
    ATYN(h <= 0)

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cmath>

using namespace std;
typedef pair<int, int> P;
typedef pair<P, int> PI;
static const long long int INF = 1e18;

class Edge
{
public:
	int to;
	int cost;
};
vector<Edge> edge[100001];

void solve()
{
	int V, E, r;
	cin >> V >> E >> r;
	for (int i = 0; i < E; ++i)
	{
		int s, t, d;
		scanf("%d %d %d", &s, &t, &d);
		Edge e;
		e.to = t;
		e.cost = d;
		edge[s].push_back(e);
	}
	vector<long long int> D(V);
	for (int i = 0; i < V; ++i)
	{
		D[i] = INF;
	}
	D[r] = 0;
	priority_queue<P, vector<P>, greater<P> > pque;
	pque.push(P(0, r));
	while (!pque.empty())
	{
		P p = pque.top();
		pque.pop();
		int v = p.second;
		if (D[v] < p.first)
		{
			continue;
		}
		for (int i = 0; i < edge[v].size(); ++i)
		{
			Edge e = edge[v][i];
			if (D[e.to] > D[v] + e.cost)
			{
				D[e.to] = D[v] + e.cost;
				pque.push(P(D[e.to], e.to));
			}
		}
	}
	for (int i = 0; i < V; ++i)
	{
		if (D[i] == INF)
		{
			cout << "INF" << endl;
		}
		else
		{
			cout << D[i] << endl;
		}
	}
}

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


Measured memory_bytes: 13496
#include <iostream>
#define llint long long

using namespace std;

llint x;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> x;
	for(int i = 1; i <= 1000; i++){
		llint rem = x-i*100;
		if(rem < 0) continue;
		if((rem+4)/5 <= i){
			cout << 1 << endl;
			return 0;
		}
	}
	cout << 0 << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    double N, a;
    cin >> N;
    a = N / 3;
    double ans = a * a * a;
    cout << setprecision(10) <<ans << endl;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;

int64_t solve(int64_t n, int64_t m, std::vector<int64_t> xs) {
  if (m <= n) {
    return 0;
  }

  std::vector<int64_t> xxs(m - 1);
  int64_t previous = xs[0];
  for (int i = 1; i < m; ++i) {
    xxs[i - 1] = xs[i] - previous;
    previous = xs[i];
  }
  int64_t ret = xs.back() - xs.front();
  std::sort(xxs.rbegin(), xxs.rend());
  for (int i = 0; i < n - 1; ++i) {
    ret -= xxs[i];
  }
  return ret;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int64_t n;
  std::cin >> n;
  int64_t m;
  std::cin >> m;
  std::vector<int64_t> xs(m);
  for (int i = 0; i < m; i++) {
    std::cin >> xs[i];
  }
  std::sort(xs.begin(), xs.end());
  auto const res = solve(n, m, std::move(xs));
  std::cout << res << std::endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

int n;
int a[100100],b[100100],c[100100];
int dp_a[100100],dp_b[100100],dp_c[100100];


int vac(int i,char estado){

    if(i>n) return 0;

    int resp;

    if(i==0){
        resp=max(a[i]+vac(i+1,'a'),b[i]+vac(i+1,'b'));
        return resp=max(resp, c[i]+vac(i+1,'c'));
    }
    else{
        switch(estado){
            case 'a':
                if(dp_a[i]!=-1) return dp_a[i];
                return dp_a[i] =max(b[i]+vac(i+1,'b'),c[i]+vac(i+1,'c')); break;
            case 'b':
                if(dp_b[i]!=-1) return dp_b[i];
                return dp_b[i] =max(a[i]+vac(i+1,'a'),c[i]+vac(i+1,'c')); break;
            case 'c':
                if(dp_c[i]!=-1) return dp_c[i];
                return dp_c[i] =max(a[i]+vac(i+1,'a'),b[i]+vac(i+1,'b')); break;
        }
    }
}

int main(){

    memset(dp_a,-1,sizeof(dp_a));
    memset(dp_b,-1,sizeof(dp_b));
    memset(dp_c,-1,sizeof(dp_c));

    cin>>n;

    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }

    cout<<vac(0,'d');
}


Measured memory_bytes: 10528
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>

using namespace std;

int main()
{
    size_t n, m;
    cin >> n >> m;
    vector<pair<int, int>> ds(m);
    for(auto& p : ds) cin >> p.first >> p.second;
    
    sort(begin(ds), end(ds), [](const auto& pa, const auto& pb){ return pa.first < pb.first; });
    
    for(size_t i = 1; i < m; ++i)
    {
        auto& pa = ds[i-1];
        auto& pb = ds[i];
        if(pb.first < pa.second) // has union
        {
            pb.second = min(pb.second, pa.second);
            pa.first = pa.second = 0;
        }
    }
    
    ds.erase(remove_if(begin(ds), end(ds), [](const auto& p){ return p.first == 0; }), end(ds));
    
    cout << ds.size() << '\n';
  
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
int main() {
	int ans = 0;
	int num;
	cin >> num;
	vector<string> vec(num);
	REP(i, num) {
		cin >> vec[i];
	}
	int end_a = 0, beg_b = 0;
	int begend = 0;
	REP(i, num) {
		REP(k, vec[i].size() - 1) {
			if (vec[i][k] == 'A' && vec[i][k + 1] == 'B') {
				ans++;
			}
		}
		if (vec[i][0] == 'B') {
			beg_b++;
		}
		if (vec[i][vec[i].size() - 1] == 'A') {
			end_a++;
		}
		if (vec[i][0] == 'B' && vec[i][vec[i].size() - 1] == 'A') {
			begend++;
		}
	}
	if (begend == beg_b && begend == end_a) {
		ans += (min(beg_b, end_a) - 1) >= 0 ? (min(beg_b, end_a) - 1) : 0;
	}
	else {
		ans += min(beg_b, end_a);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 768
#include<stdio.h>

int main(void){
  int n,a[101],max=0,min=1000000000;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(max<a[i])  max=a[i];
    if(min>a[i])  min=a[i];
  }

  printf("%d",max-min);

  return 0;
}

Measured memory_bytes: 128
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
    n: usize,
    m: usize,
    c: i64,
    b: [i64; m],
    a: [[i64; m]; n]
    }
    let mut ans = 0;
    for i in 0..n {
        let t:i64 = (0..m).map(|x| a[i][x] * b[x]).sum::<i64>() + c;
        if t > 0 {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2176
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    char a;
    cin >> a;
    if(0<=(int) (a-'A') && (int) (a-'A')<=25){
        cout << 'A' << endl;
    }else{
        cout << 'a' << endl;
    }
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define fore(i,a,b) for(int i=a,almo5t=b;i<almo5t;++i)
#define SZ(x) ((int)x.size())
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int N = 0;

typedef long long int ll;

using namespace std;

int main(){
    ll n,k;cin>>n>>k;
    ll positions[100010];
    std::fill_n(positions,100010,0);
    fore(i,0,n){
        int val,rep;cin>>val>>rep;
        positions[val] += rep;
    }
    ll pos = 0;
    while(k>0){
        k -= positions[pos];
        pos++;
    }
    pos--;
    cout<<pos;
    
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{
    public static void main (String[] args){
        try(Scanner sc = new Scanner(System.in)){
            while(true){
                int n = sc.nextInt();
                if(n == 0){break;}
                int[] scores = new int[n];
                for(int i = 0;i < scores.length;i++){
                    scores[i] = sc.nextInt();
                }
                double average = 0,deviation = 0,variance = 0;
                int sum = 0;
                for(int i = 0;i < scores.length;i++){
                    sum = sum + scores[i];
                }
                average = (double)sum / scores.length;
                for(int i = 0;i < scores.length;i++){
                    deviation = deviation + (scores[i] - average)*(scores[i] - average);
                }
                variance = deviation / scores.length;
                System.out.println(Math.sqrt(variance));
            }
        }
    }
}


Measured memory_bytes: 31232
#include <cstdio>
int main(){
  int n, num, i, j, vec[4][13];
  char card;
  scanf("%d%*c", &n);
  for (i=0; i<n; i++) {
    scanf("%c %d%*c", &card, &num);
    if (card=='S') vec[0][num-1]=num;
    else if (card=='H') vec[1][num-1]=num;
    else if (card=='C') vec[2][num-1]=num;
    else vec[3][num-1]=num;
  }

  for (i=0; i<4; i++) {
    if (i==0) card='S';
    else if (i==1) card='H';
    else if (i==2) card='C';
    else card='D';
    for (j=0; j<13; j++) {
      if (vec[i][j]!=j+1) {
        printf("%c %d\n", card, j+1);
      }
    }
  }
}


Measured memory_bytes: 2620
# -*- coding: utf-8 -*-


N, K = map(int, input().split())

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

cnt = {}

for a in As:
    cnt.setdefault(a, 0)
    cnt[a] += 1

c = len(cnt)
ans = 0

for k, v in sorted(cnt.items(), key=lambda x:x[1]):
    if c <= K:
        break
    c -= 1
    ans += v

print(ans)


Measured memory_bytes: 38964
#include<stdio.h>

int main(){
	int i, j, H, W;
	while (1){
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0)break;
		for (i = 0; i < W; i++){
			printf("#");
		}
		printf("\n");
		for (i = 0; i < H-2; i++){
			printf("#");
			for (j = 0; j < W-2; j++){
				printf(".");
			}
			printf("#");
			printf("\n");
		}
		for (i = 0; i < W; i++){
			printf("#");
		}
		printf("\n");
		printf("\n");

	}
	return 0;
}


Measured memory_bytes: 1992
#include <iostream>
#define int long long
using namespace std;

const int N = 400;

int n, k, s[N], val[N], mini[N][N];

int sum(int d, int f) {
  return val[d] + s[f] - s[d];
}

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  
  cin >> n;
  
  for(int i = 0; i < n; i++)
    cin >> val[i];
  s[0] = val[0];
  for(int i = 1; i < n; i++)
    s[i] = s[i-1] + val[i];
  
  for(int t = 1; t < n; t++) {
    for(int i = 0, j = t; j < n; i++, j++) {
      int cost = mini[i][i] + mini[i+1][j];
      for(int m = i+1; m < j; m++)
        cost = min(cost, mini[i][m] + mini[m+1][j]);
      mini[i][j] = cost + sum(i, j);
    }
  }
  cout << mini[0][n-1];
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define name "bai1"
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
int m,d;
int main()
{
    //freopen(name".inp", "r", stdin);
   // freopen(name".out", "w", stdout);
    cin >> m >> d;
    int ans=0;
    while(d){
        int a=d/10;
        int b=d%10;
        int t=a*b;
        if(t!=0 && t<=m && a>=2 && b>=2)++ans;
        --d;
    }
    cout <<ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#include <sstream>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=(n)-1;i>j-1;i--)
typedef long long int lli;
#define N 1000000007
#define M 998244353

using namespace std;

struct handv{
    
    lli sum;
    vector<string> vec;
    
    handv(lli h,lli w){
        lli i,d=0;
        string s;
        rep(i,0,h){
            cin>>s;
            d+=count(s.begin(),s.end(),'#');
            vec.push_back(s);
        }
        sum=d;
    }
    
    
    vector<lli> totwo(lli a,lli b){
        vector<lli> two;
        lli i;
        rep(i,0,a){
            two.push_back(b%2);
            b/=2;
        }
        return two;
    }
    
    lli answer(vector<lli> hig,vector<lli> wid){
        lli cnt=sum,i,j;
        rep(i,0,hig.size()){
            rep(j,0,wid.size()){
                if((hig[i]==1 || wid[j]==1)&&(vec[i][j]=='#')){
                    cnt--;
                }
            }
        }
        return cnt;
    }
    
    lli analysis(lli h,lli w,lli k){
        lli i,j,ans=0;
        vector<lli> hight,width;
        rep(i,0,pow(2.0,h)){
            rep(j,0,pow(2.0,w)){
                hight=totwo(h,i);
                width=totwo(w,j);
                if(k==answer(hight,width)){
                    ans++;
                }
            }
        }
        return ans;
    }
    
};

int main(){
    lli h,w,k,ans;
    lli i,j;
    cin>>h>>w>>k;
    handv hav(h,w);
    ans=hav.analysis(h,w,k);
    cout<<ans<<endl;
}


Measured memory_bytes: 4056
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> P;
typedef pair<int64_t, int64_t> Pll;
  
int main() {
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    if (A == max({A, B, C})) {
        cout << A * pow(2, K) + B + C << endl;
    }
    else if (B == max({A, B, C})) {
        cout << B * pow(2, K) + A + C << endl;
    }
    else if (C == max({A, B, C})) {
        cout << C * pow(2, K) + B + A << endl;
    }
}

Measured memory_bytes: 256
# coding: utf-8
#ABC166C_Peaks.rb
n,m = gets.split.map(&:to_i)
h = gets.split.map(&:to_i)
ar = Array.new(n){[]}

(1..m).each do |mm|
  a,b = gets.split.map(&:to_i)
  ar[a-1] << b
  ar[b-1] << a
end

#puts "ar=#{ar}"
#puts "h=#{h}"
#puts "------"
count = 0
(1..n).each do |mm1|
  #puts "No:#{mm1} H=#{h[mm1-1]} ar=#{ar[mm1-1]}"
  flag = 0
  ar[mm1-1].each do |mm2|
    #puts "#{h[mm1-1]} to #{h[mm2-1]}"
    
    if h[mm1-1] > h[mm2-1]
      flag += 1
    end
  end
  
  if flag == ar[mm1-1].size
    count += 1
  elsif ar[mm1-1].empty?
    count += 1
  end
  #puts "----"
end

puts count


Measured memory_bytes: 26560
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sstream> //C++
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
#include <map> //C++

using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)



/*
int N, i;
int H[100];
scanf("%d", &N);
for (i = 0; i < N; i++) scanf("%s", &H[i]);
*/



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

	cin >> k >> a >> b;

	for (int i = a; i <= b; i++) {
		if (i % k == 0) {
			cout << "OK";
			return 0;
		}
	}

	cout << "NG";


	




	return 0;

}

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

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

using namespace std;

int n,m,mp[9][9],win[9],border,cnt;

int dfs(int x,int y) {
  if( y >= n ) return ++cnt; 
  
  int nx = x + 1, ny = y;
  if( nx >= ny ) nx = 0, ++ny;

  if( mp[x][y] != -1 ) return dfs(nx,ny);

  int c[2] = {x,y};
  rep(i,2) {
    mp[c[i]][c[(i+1)%2]] = 0, mp[c[(i+1)%2]][c[i]] = 1, ++win[c[i]];
    if( win[c[i]] <= border ) dfs(nx,ny);
    --win[c[i]];
  }

  mp[x][y] = mp[y][x] = -1;
  
}

int main() {
  while( cin >> n, n ) {
    memset(mp,-1,sizeof mp);
    memset(win,0,sizeof win);
    border = ( n * n - n ) / ( n * 2 );
    cnt = 0;
    cin >> m;
    int x,y;
    rep(i,m) {
      cin >> x >> y;
      --x, --y;
      mp[x][y] = 1, mp[y][x] = 0, ++win[x];
    }
    rep(i,n) mp[i][i] = 0;
    bool fail = false;
    rep(i,n) if( win[i] > border ) { fail = true; break; }
    if( !fail ) dfs(0,0);
    cout << cnt << endl;
  }
  return 0;
}



Measured memory_bytes: 3044
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  
  while(n > 0){
	  if(n % 10 == 7){
		  cout << "Yes" << "\n";
		  return 0;
	  }
	  n = n / 10;
  }
  cout << "No" << "\n";
 
  return 0;
}



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

using namespace std;

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

int main(){
  string s;
  cin >> s;
  int ans = 0;
  rep(i, 4){
    if (s[i] == '+') ++ans;
    else --ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
if __name__ == '__main__':
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    count = 0
    for i in range(A + 1):
        for j in range(B + 1):
            for k in range(C + 1):
                if X == 500 * i + 100 * j + 50 * k:
                    count += 1

    print(count)


Measured memory_bytes: 3060
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if(a > b){
            System.out.println("a > b");
        }
        else if(a < b){
            System.out.println("a < b");
        }
        else{
            System.out.println("a == b");
        }
    }
}


Measured memory_bytes: 26336
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

bool sosu1(long long x)
{
    bool jgd = true;
    
    if (x == 1 || x == 2){
        return jgd;
    }
    else {
        long long i = 2;
        while(i <= sqrt(x)){
            if (x%i == 0){
                jgd = false;
                break;
            }
            i++;
        }
    }
    return jgd;
}


int main()
{
    long long a,b;
    
    cin >> a >> b;
    
    long long l = max(a,b);
    long long k = min(a,b);
    long long i = 1;
    vector<long long> koyakusu;
    while (i <= sqrt(k)){
        if (k%i == 0){
            if (l%i == 0){
                koyakusu.push_back(i);
            }
            
            if (l%(k/i) == 0 && k != 1){
                koyakusu.push_back(k/i);
            }
        }
        i++;
    }
    
    long long ans = 0;
    for (long long i = 0;i < koyakusu.size();i++){
        if (sosu1(koyakusu[i])){
            ans++;
        }
    }
    cout << ans << endl;
    
}



Measured memory_bytes: 384
//om namah shivaaay//
#include <bits/stdc++.h>
#define Om_namah_Shivaay ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
 #define ll long long
 using namespace std;
 int main()
 {
    Om_namah_Shivaay;
 ll n;
    cin>>n;
    cout<<(n/500)*1000+((n%500)/5)*5;
}
    


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    if(n%2 == 0)
        impare = n/2;
    else
        impare = n/2 + 1;

    float rezultat = (float)impare / n;
    cout << rezultat << endl;
}

Measured memory_bytes: 256
/*
本宝的程序外人别想看！！

name: [夏宝宝]
run time：[] ms
compilation time: [] ms
output memory: [] MiB
where: []
state: []
*/
#include<bits/stdc++.h>
using namespace std;

int main()
{
	long long int s1, s2=1;
  
	cin>>s1;
  
    long long int sum;
  
    while(s1>0)
    {
        sum+=s2;
        s2*=2;
        s1=floor(s1/2);
    }
  
    cout<<sum<<endl;
  
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
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; }

const int N = 52;
char l[N][N], r[N][N];
int dp[N][N][N][N];

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	for (int W, H; cin >> W >> H&&H;) {
		memset(l, 0, sizeof(l));
		memset(r, 0, sizeof(r));
		memset(dp, 0x3f, sizeof(dp));
		int sli, slj, sri, srj;
		int gli, glj, gri, grj;
		rep(i, 0, H) {
			rrep(j, 0, W) {
				cin >> l[i][j];
				if (l[i][j] == 'L') {
					sli = i, slj = j;
				}
				if (l[i][j] == '%') {
					gli = i, glj = j;
				}
			}
			rep(j, 0, W) {
				cin >> r[i][j];
				if (r[i][j] == 'R') {
					sri = i, srj = j;
				}
				if (r[i][j] == '%') {
					gri = i, grj = j;
				}
			}
		}
		using T = tuple<int, int, int, int, int>;
		queue<T> q;
		q.emplace(sli, slj, sri, srj, 0);
		auto inrange = [&](int i, int j) { return i >= 0 && i < H && j >= 0 && j < W; };
		while (q.size()) {
			int li, lj, ri, rj, c;
			tie(li, lj, ri, rj, c) = q.front(); q.pop();
			if (dp[li][lj][ri][rj] != INF)continue;
			if (li == gli && lj == glj && ri == gri && rj == grj) {
				cout << "Yes" << endl;
				dp[li][lj][ri][rj] = c;
				break;
			}
			else if (li == gli&&lj == glj) {
				continue;
			}
			else if (ri == gri&&rj == grj) {
				continue;
			}
			dp[li][lj][ri][rj] = c;
			static const int di[] = { 1,0,-1,0 };
			static const int dj[] = { 0,1,0,-1 };
			rep(k, 0, 4) {
				int nli = li + di[k],
					nlj = lj + dj[k],
					nri = ri + di[k],
					nrj = rj + dj[k];
				if (!inrange(nli, nlj) || l[nli][nlj] == '#')nli -= di[k], nlj -= dj[k];
				if (!inrange(nri, nrj) || r[nri][nrj] == '#')nri -= di[k], nrj -= dj[k];
				if (dp[nli][nlj][nri][nrj] != INF)continue;
				q.emplace(nli, nlj, nri, nrj, c + 1);
			}
		}
		//rep(li, 0, H)rep(lj, 0, W)rep(ri, 0, H)rep(rj, 0, W) {
		//	if (dp[li][lj][ri][rj] == INF)continue;
		//	dump(li, lj, ri, rj, dp[li][lj][ri][rj]);
		//}
		if (dp[gli][glj][gri][grj] == INF) {
			cout << "No" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 33616
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<cctype>
using namespace std;
const int L = 6;
const int N = 1000100;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)

string to_s(int n, int l){
    stringstream ss;
    ss <<n;
    string ret = ss.str();
    while(ret.length() < l) ret = "0" + ret;
    return ret;
}

int main(){
    int fir, l;
    while(cin >>fir >>l && (fir || l)){
        vector<int> v(N, -1);
        string now = to_s(fir, l);
        v[atoi(now.c_str())] = 0;
        for(int i = 1; ; i++){
            string tmp = now;
            sort(tmp.rbegin(), tmp.rend());
            string max = tmp;
            tmp = now;
            sort(tmp.begin(), tmp.end());
            string min = tmp;
            now = to_s(atoi(max.c_str()) - atoi(min.c_str()), l);
            if(v[atoi(now.c_str())] != -1){
                cout <<v[atoi(now.c_str())] <<" " <<atoi(now.c_str()) <<" " <<i - v[atoi(now.c_str())] <<endl;
                break;
            } else{
                v[atoi(now.c_str())] = i;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 5152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    ll d[n]; zep(i, 0, n)cin >> d[i];

    sort(d, d + n);
    ll ans = 1;
    zep(i, 1, n){
        if(d[i] > d[i - 1])ans++;
    }
    print(ans)
    
    return 0;
}

Measured memory_bytes: 256
/*
Wai u read my code xD
*/
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vi vector <ll> 
#define qu queue <ll>
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


void solve()
{
    int a[3];
    for (int i = 0; i < 3; i++) cin >> a[i];
    sort(a,a+3);
    if (a[0]==a[1]&&a[1]!=a[2]) nout("Yes");
    else if (a[1]==a[2]&&a[1]!=a[0]) nout("Yes");
    else nout("No");
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits//stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;int a, b,c;a = 0; b = 0;c = 1;
    vector<int> p(n), q(n),v(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i]; v[i] = i + 1;
    }
    for (int i = 0;i < n;i++)cin >> q[i];
    do {
        if (v == q) a = c;
        if (v == p) b = c;
        c++;
    } while (next_permutation(v.begin(),v.end()));
    cout << abs(a - b) << endl;
}


Measured memory_bytes: 3624
def main():
    r, c = map(int, input().split())
    table = []
    for _ in range(r):
        table.append(list(map(int, input().split())))
    table.append([0] * (c+1))
    for index, line in enumerate(table[:-1]):
        table[index].append(sum(line))
        for index1, value in enumerate(table[index]):
            table[-1][index1] += value
    for line in [map(str, line) for line in table]:
        print(' '.join(line))
    return


if __name__ == '__main__':
    main()



Measured memory_bytes: 5724
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int size = 4;
  char mae;
  bool flag = true;
  for (int i = 0; i < size; i++) {
  	if (i == 0) {
    	mae = S[i];
    } else {
      if (mae == S[i]) {
      	flag = false;
        break;
      } else {
      	mae = S[i];
      }
    }
  }
  if (flag) {
  	cout << "Good" << endl;
  } else {
    cout << "Bad" << endl;
  }
}

Measured memory_bytes: 3628
#include<stdio.h>
int main()
{
int n,i;
  scanf("%d",&n);
long long int dp[n+2];
  dp[0]=2;
  dp[1]=1;
  for(i=0;i<n;++i)
  {
  dp[i+2]=dp[i+1]+dp[i];
  }
  printf("%lld",dp[n]);

return 0;}

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

int main() {
  int n, m;
  cin >> n >> m;
  dsu d(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    d.merge(a, b);
  }
  int cnt = 0;
  rep(i, n) {
    if (d.leader(i) == i) cnt++;
  }
  cout << cnt-1 << endl;
  return 0;
}


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

int main(void) {

	int N1;
	cin >> N1;

	int* A = new int[N1];

	for (int i = 0; i < N1; i++) {
		cin >> A[i];
	}
	int N2;
	cin >> N2;

	int* B = new int[N2];

	for (int i = 0; i < N2; i++) {
		cin >> B[i];
	}
	int c = 0;

	for (int i = 0; i < N2; i++) {


		int left = 0;
		int right = N1;
		while (left < right) {
			int mid = (right + left) / 2;

			if (A[mid] == B[i]){
				c++;
				break;
			}
			else if (A[mid] < B[i])
				left = mid + 1;
			else
				right = mid;
		}
	}

	cout << c << "\n";
}


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

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

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

  long long int sum = 0;
  vector<int> vr(n), vg(n), vb(n);
  int ir = 0, ig = 0, ib = 0;

  for (int i = n-1; i >= 1; i--) {
    if (s[i] == 'R') ir++;
    if (s[i] == 'G') ig++;
    if (s[i] == 'B') ib++;
    vr[i-1] = ir;
    vg[i-1] = ig;
    vb[i-1] = ib;
  }

  for (int i = 0; i < n-2; i++) {
    for (int j = i+1; j < n-1; j++) {
      if (s[i] != s[j]) {
        if (s[i] == 'R' && s[j] == 'G' || s[i] == 'G' && s[j] == 'R') {
          sum += vb[j];
          if (2*j-i < n && s[2*j-i] == 'B') sum--;
        } else if (s[i] == 'B' && s[j] == 'G' || s[i] == 'G' && s[j] == 'B') {
          sum += vr[j];
          if (2*j-i < n && s[2*j-i] == 'R') sum--;
        } else {
          sum += vg[j];
          if (2*j-i < n && s[2*j-i] == 'G') sum--;
        }
      }
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 3684
#include <algorithm>
#include <cmath>
#include <iostream>
#include <utility>
#include <vector>

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

using namespace std;

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

int main() {
  ll n;
  int x;
  cin >> n, cin >> x;

  vector<int> vec;
  REP(i, n) {
    int t;
    cin >> t;
    vec.push_back(t);
  }

  // 右端を優先してreduce
  // それでも足りない場合は左も減らす

  ll cnt = 0;
  for (ll i = 0; i < n - 1; i++) {
    int left = vec[i];
    int right = vec[i + 1];
    if (left + right > x) {
      int diff = left + right - x;
      if (diff >= right) {
        right = 0;
        left = left - (diff - right);
      } else {
        right = right - diff;
      }
      vec[i] = left;
      vec[i + 1] = right;
      cnt += diff;
    }
  }

  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> len(N);
  for(int i = 0;i < N;i++){
    cin >> len.at(i);
  }
  int count = 0;
  sort(len.begin(),len.end());
  if(N < 3){
    cout << 0 << endl;
  }else{
    for(int i = 0;i < N;i++){
      for(int j = i + 1;j < N;j++){
        for(int l = j + 1;l < N;l++){
          //cout << len.at(i) << len.at(j) << len.at(l) << endl;
          //cout << i << j << l << endl;
          if((len.at(i) != len.at(l)) && (len.at(j) != len.at(l)) &&(len.at(i) != len.at(j))){
            if(len.at(i) + len.at(j) > len.at(l)){
              count++;
            }
          }
        }
      }
    }
    cout << count << endl;
  }
}


Measured memory_bytes: 3628