akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const ll mod = 1e9 +7;

int main() {

    
    ll n;
    cin >> n;
    
    if (n >= 195)
    {
        cout << 5 << endl;
        return 0;
    }
    if (n >= 189)
    {
        cout << 4 << endl;
        return 0;
    }
    if (n >= 165)
    {
        cout << 3 << endl;
        return 0;
    }
    if (n >= 135)
    {
        cout << 2 << endl;
        return 0;
    }
    if (n >= 105)
    {
        cout << 1 << endl;
        return 0;
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
	long long h,w;
	cin >> h >> w;

	long long ans=100000000009;

	for(int i=1;i<=h;i++)
	{
		long long a=i*w;
		long long b=(h-i)*(w/2);
		long long c=h*w-a-b;

		long long div=abs(a-b);
		if(div<abs(a-c))div=abs(a-c);
		if(div<abs(b-c))div=abs(b-c);

		if(ans>div)ans=div;

		b=w*((h-i)/2);
		c=h*w-a-b;

		div=abs(a-b);
		if(div<abs(a-c))div=abs(a-c);
		if(div<abs(b-c))div=abs(b-c);

		if(ans>div)ans=div;

	}

	for(int i=1;i<=w;i++)
	{
		long long a=i*h;
		long long b=(w-i)*(h/2);
		long long c=h*w-a-b;

		long long div=abs(a-b);
		if(div<abs(a-c))div=abs(a-c);
		if(div<abs(b-c))div=abs(b-c);

		if(ans>div)ans=div;

		b=h*((w-i)/2);
		c=h*w-a-b;

		div=abs(a-b);
		if(div<abs(a-c))div=abs(a-c);
		if(div<abs(b-c))div=abs(b-c);

		if(ans>div)ans=div;

	}


	cout << ans << endl;

	
}

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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    int n, k; cin >> n >> k;
    vector<int> a(n);
    REP(i, n) cin >> a[i];

    REP(o, k) {
        vector<int> b(n + 1, 0);
        REP(i, n) {
            int l = max(0, i - a[i]);
            int r = min(n, i + a[i] + 1);
            b[l]++;
            b[r]--;
        }
        REP(i, n) b[i + 1] += b[i];
        b.pop_back();
        if (a == b) break ;
        a = b;
    }

    REP(i, n) {
        cout << a[i];
        if (i != n - 1) cout << ' ';
    }
    cout << '\n';
    return 0;
}

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

#define int long long

typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int N;
int A[100];

signed main(){
    cin>>N;
    rep(i,N)cin>>A[i];
    
    int counter=0;
    bool flag=true;
    while(flag){
        flag=false;
        for(int i=N-1;i>0;i--){
            if(A[i]<A[i-1]){
                swap(A[i],A[i-1]);
                counter++;
                flag=true;
            }
        }
    }
    
    rep(i,N){
        if(i)cout<<" ";
        cout<<A[i];
    }cout<<endl;
    cout<<counter<<endl;
    return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>
#include <numeric>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<30)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

ll num[10]={2,5,5,4,5,6,3,7,6};
string dp[11000];
const string MINUS_INF = "-";

void chmax(string &a, string b){
  if(a==MINUS_INF) a=b;
  else if(a.size()<b.size())a=b;
  else if(a.size()==b.size()){
    if(a<b)a=b;
  }
}



int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N,M;
  cin >> N >> M;
  vector<int> A(M);
  for(int i=0;i<M;i++){
    cin >> A[i];
  }
  for(int i=0;i<11000;i++){
    dp[i]=MINUS_INF;
  }
  dp[0]="";
  for(int i=0;i<=N;i++){
    if(dp[i]==MINUS_INF)continue;
    for(auto a:A){
      chmax(dp[i+num[a-1]],dp[i]+char('0'+a));
    }
  }
  cout << dp[N] << endl;
  /*string a="122";
  string b="21";
  if(a<b){
    cout << b<< endl;
  }else{
    cout << a << endl;
  }*/
  return 0;
}

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

#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 reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  stack<int> st;
  int n;
  while (cin >> n) {
    if (n == 0) {
      cout << st.top() << '\n';
      st.pop();
    } else {
      st.push(n);
    }
  }
}



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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/23  Problem: 082_arc_b / Link: https://arc082.contest.atcoder.jp/tasks/arc082_b?lang=en  ----- */
/* ------問題------

1,2,..,N からなる順列 p1,p2,..,pN が与えられます。 次の操作を何回か (0回でもよい) 行うことが出来ます。
操作: 順列で隣り合う二つの数を選んでスワップする。
何回か操作を行って、任意の 1≤i≤N に対して pi≠i となるようにしたいです。 必要な操作の最小回数を求めてください。

-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	cin >> N;
	VL a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}

	FOR(i, 0, N-1) {
		if (a[i] == i+1) {
			swap(a[i], a[i + 1]);
			ans++;
		}
	}
	if (a[N - 1] == N)ans++;
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1024
N=int(input())
def ketasuu(n):
  keta=0
  while n>0:
    n//=10
    keta+=1
  return keta
N_keta=ketasuu(N)
ans=0
if N_keta%2==0:
  for i in range(1,N_keta//2+1):
    ans+=10**(2*i-1)-10**(2*i-2)
else:
  for i in range(1,N_keta//2+1):
    ans+=10**(2*i-1)-10**(2*i-2)
  ans+=N-10**(N_keta-1)+1
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

int main() {
    char s[200000],t[200000];
    int ans = 0;
    scanf("%s",s);
    scanf("%s",t);
    for(int i = 0;s[i] != '\0' && t[i] != '\0';i++){
        if(s[i] != t[i])ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 2076
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	string s,t;
	cin>>s>>t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end(),greater<char>());
	cout << (s<t?"Yes":"No") << endl;
}
#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

inline int read()
{
	int data = 0, w = 1; char ch = getchar();
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') w = -1, ch = getchar();
	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();
	return data * w;
}

const int maxn(100010), Mod(1e9 + 7);
int n, m, A[maxn], B[maxn], S[maxn], c[maxn], f[maxn], tot;
struct node { int x, y; } P[maxn];
inline bool operator == (const node &lhs, const node &rhs)
	{ return lhs.x == rhs.x && lhs.y == rhs.y; }
void Add(int x, int v) { for (; x <= tot; x += x & -x) c[x] = (c[x] + v) % Mod; }
int Sum(int x) { int ans = 0; for (; x; x -= x & -x) ans = (ans + c[x]) % Mod; return ans; }

int main()
{
	n = read(), m = read();
	for (int i = 1; i <= n; i++) A[i] = read();
	for (int i = 1; i <= m; i++) B[i] = read();
	P[tot = 1] = (node) {0, 0};
	for (int i = 1, j; i <= n; i++)
	{
		j = std::upper_bound(B + 1, B + m + 1, A[i]) - B;
		if (j > 1 && j <= m) P[++tot] = (node) {A[i] - B[j - 1], B[j] - A[i]};
	}
	P[n = ++tot] = (node) {(int)1e9, (int)1e9}, tot = 0;
	for (int i = 1; i <= n; i++) S[i] = P[i].y;
	std::sort(S + 1, S + n + 1), tot = std::unique(S + 1, S + n + 1) - S - 1;
	for (int i = 1; i <= n; i++)
		P[i].y = std::lower_bound(S + 1, S + tot + 1, P[i].y) - S;
	std::sort(P + 1, P + n + 1, [] (const node &lhs, const node &rhs)
			{ return lhs.x != rhs.x ? lhs.x < rhs.x : lhs.y < rhs.y; });
	n = std::unique(P + 1, P + n + 1) - P - 1;
	Add(P[1].y, 1);
	for (int i = 2, j; i <= n; i = j)
	{
		for (j = i; j <= n && P[j].x == P[i].x; j++);
		for (int k = i; k < j; k++) f[k] = Sum(P[k].y - 1);
		for (int k = i; k < j; k++) Add(P[k].y, f[k]);
	}
	printf("%d\n", f[n]);
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long int llint;

int main(){
	int w, h, n, i;
	int x[110], y[110], a[110];
	cin>>w>>h>>n;
	int maxx=0, minx=w, maxy=0, miny=h;
	for(i=0; i<n; i++) cin>>x[i]>>y[i]>>a[i];
	for(i=0; i<n; i++){
		if(a[i]==1 && x[i]>maxx) maxx=x[i];
		if(a[i]==2 && x[i]<minx) minx=x[i];
		if(a[i]==3 && y[i]>maxy) maxy=y[i];
		if(a[i]==4 && y[i]<miny) miny=y[i];
	}
	if((minx-maxx)>0 && (miny-maxy)>0) cout<<(minx-maxx)*(miny-maxy)<<endl;
	else cout<<0<<endl;
	return 0;
}

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

long long int dp[100005][13];

int main() {
	string s; cin >> s;
	
	int n = s.length();
	
	dp[0][0] = 1;
	for (int i=0; i<n; ++i) {
		int c;
		if (s[i] == '?') c = -1;
		else c = s[i] - '0';
		
		for (int j=0; j<10; ++j) {
			if (c != -1 && c != j) continue;
			for (int k=0; k<13; ++k) {
				dp[i+1][(k*10+j)%13] += dp[i][k];
			}			
		}
		for (int j=0; j<13; ++j) dp[i+1][j] %= 1000000007LL;
	}
	cout << dp[n][5] << endl;
	return 0;	
}


Measured memory_bytes: 10624
lst=[]
lt=[]
for i in range (10):
    n=int(input())
    lst.append(n)
lst.sort()
for i in range(7):
    lst.pop(0)

    
for i in range (10):
    m=int(input())
    lt.append(m)
lt.sort()
for i in range(7):
    lt.pop(0)

    
a=sum(lst)
b=sum(lt)
print(f'{a:.3g} {b:.3g}')


Measured memory_bytes: 5624
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 1; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
 
int main(){
    ll N, a, ans;   	
  	cin >> N;
  	ans = 0;
  	rep(a, N) ans += (N-1)/a;
  	cout << ans;
    return 0;
}

Measured memory_bytes: 3632
using System;
	class Program
    {
        static void Main(string[] args)
        {
			string[] input = Console.ReadLine().Split();
			double a = double.Parse(input[0]);
			double b = double.Parse(input[1]);
			double x = double.Parse(input[2]);
			double s = x / a;
			bool overHalf = s > a * b / 2;
			if (overHalf) s = (a * b) - s;
			double edge = overHalf ? a : b;
			double c = 2 * s / edge;
			double t = Math.Atan2(edge, c) * 180 / Math.PI;
			if (overHalf) t = 90 - t;
			Console.WriteLine(t.ToString("F10"));
        }
    }


Measured memory_bytes: 13140
#include <iostream>
#include <string>
//#include<windows.h>
using namespace std;
int i = 0,j=0,k=0;//ループ用

int main() {
	int n,q=1,temp=1;
	int a[10];
	cin >> n;
	for (i = 0; i < n;i++)cin >> a[i];
	for (i = 0; i < n; i++) {
		if (a[i] % 2 == 1)temp *= 1;
		else temp *= 2;
	}
	for (i = 0; i < n; i++)q *= 3;
	cout << q-temp;
	//Sleep(1000);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;
int main(){
    // 自分の回答
    // int n;
    // cin >> n;
    // vector<int> a(n-1);
    // vector<int> b(n);
    // for (int i=0;i<n-1;i++){
    //     cin >> a[i];
    //     b[i] = 0;
    // }
    // b[n] = 0;
    // for (int i=0;i<n-1;i++){
    //     b[a[i]-1]++;
    // }
    // for (int i=0;i<n;i++){
    //     cout << b[i] << endl;
    // }
    // return 0;

    // 正解
    int n;
    cin >> n;
    vector<int> ans(n);
    for (int i = 0; i < n-1; i++) {
        int a;
        cin >> a;
        ans[a-1]++;
    }
    for (int x : ans) {
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
from collections import Counter
import sys
import math
N = int(input())
M = N
Nso = []
Nruto = math.sqrt(N)
Nruto = math.ceil(Nruto)
for i in range(2, Nruto+1):
    while N % i == 0:
        N = N//i
        Nso.append(i)
    if N == 1:
        break
    Nruto = math.sqrt(N)
    Nruto = math.floor(Nruto)

Nso.append(N)
if 1 in Nso:
    Nso.remove(1)

if len(Nso) == 0:
    if M == 1:
        print(0)
    else:
        print(1)
    sys.exit()

ans = 0
Nso = Counter(Nso)

for i in Nso.values():
    x = math.sqrt(2*i)
    x = math.floor(x)
    for j in range(x, 0, -1):
        if j*j+j <= 2*i:
            ans += j
            break
print(ans)


Measured memory_bytes: 9480
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 1000000
#define mod 1000000007
#define INF2 1000000000000000000

int a[40], b[40], c[40];
int dp[41][401][401];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A, B;
    cin >> N >> A >> B;

    rep(i, N) cin >> a[i] >> b[i] >> c[i];

    rep(i, N+1) rep(j, 401) rep(k, 401) dp[i][j][k] = INF;

    dp[0][0][0] = 0;

    rep(i, N) rep(j, 401) rep(k, 401) {
        if(dp[i][j][k] == INF) continue;
        dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k]);
        dp[i+1][j+a[i]][k+b[i]] = 
            min(dp[i+1][j+a[i]][k+b[i]], dp[i][j][k] + c[i]);
    }
    int ans = INF;
    for (int j = 1; j <= 400; j++) {
        for (int k = 1; k <= 400; k++) {
            if (j * B == k * A) ans = min(ans, dp[N][j][k]);
        }
    }

    if (ans == INF) ans = -1;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 25984
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll MOD=1e9+7 ;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    int n,k;cin >> n >> k;
    int ary[n];
    rep(i,n) cin >> ary[i];
    int ans = 0;
    rep(i,n)
    {
        ans += (int)(ary[i] >= k);
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  double a, a2, b, b2, h, m;
  double ans, theta, thetaA, thetaB;
  cin >> a >> b >> h >> m;
  
  thetaA = m*2.0*M_PI/60.0;
  thetaB = h*2.0*M_PI/12.0;
  thetaB += 2*M_PI*m/720.0;
  if(thetaA == 0) thetaA = 2.0*M_PI;
  if(thetaA > thetaB) theta = thetaA - thetaB;
  else if(thetaA < thetaB) theta = thetaB - thetaA;
  else theta = 0;
  //cout << theta << endl;
  

  a2 = a * a;
  b2 = b * b;
  ans = a2 + b2 - (2.0 * a * b * cos(theta));
  ans = sqrt(ans);
  cout << fixed << setprecision(15) << ans << endl;
  return 0;
}

Measured memory_bytes: 4216
#include<bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    int a[10][10];
    for(int i=0;i<10;i++)for(int j=0;j<10;j++) a[i][j]=i*j;
    for(int i=0;i<10;i++)for(int j=0;j<10;j++){
        if(a[i][j]==n){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
import collections

n = int(input())
d = [int(_) for _ in input().split()]
m = int(input())
t = [int(_) for _ in input().split()]

D = collections.Counter(d)
nd = dict.fromkeys(D, 0)

for i in range(m):
    if t[i] in nd:
        get_cnt = nd[t[i]] + 1
        if get_cnt <= D[t[i]]:
            nd[t[i]] = get_cnt
        else:
            print('NO')
            exit()
    else:
        print('NO')
        exit()
print('YES')

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){


}

Node treeSearch(Node u, int k){
  while(u!=NIL){
    if(u->key == k)return u;
    else if(u->key < k) u=u->right;
    else u=u->left;
  }

  return NIL;
}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while(x!=NIL){
    y=x;
    if(z->key < x->key)x=x->left;
    else x=x->right;
  }
  z->parent = y;

  if(y==NIL)root=z;
  else if(z->key < y->key) y->left =z;
  else y->right = z;
  
}

void inorder(Node u){
  if(u->left!=NIL)inorder(u->left);
  printf(" %d",u->key);
  if(u->right!=NIL)inorder(u->right);
			
}
void preorder(Node u){
  printf(" %d",u->key);
  if(u->left!=NIL)preorder(u->left);
  if(u->right!=NIL)preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 19364
#include <stdio.h>
#include <math.h>

int main (void)
{
    unsigned long n, m, sum=0;
    long ans;
    unsigned long a[10000];
    int i;

    scanf("%lu %lu", &n, &m);

    for (i = 0; i < m; i++) {
        scanf("%lu", &(a[i]));
        sum += a[i];
    }

    ans = n - sum;

    if (ans >= 0) {
        printf("%ld", ans);
    } else {
        puts("-1");
    }

    return 0;
}



Measured memory_bytes: 1752
#include<iostream>
#include<cstdio>
#include<set>
#define MN 200000
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
long long ans;
int n,p[MN+5],c1[MN+5],c0[MN+5],s[MN+5];
inline double V(int x){return c0[x]?(double)c1[x]/c0[x]:1e9;}
struct cmp{bool operator()(int x,int y){return V(x)==V(y)?x<y:V(x)<V(y);}};
inline int getfa(int x){return s[x]?s[x]=getfa(s[x]):x;}
set<int,cmp> st;
int main()
{
    n=read();
    for(int i=2;i<=n;++i) p[i]=read();
    for(int i=1;i<=n;++i) read()?++c1[i]:++c0[i];
    for(int i=2;i<=n;++i) st.insert(i);
    for(int i=1;i<n;++i)
    {
        int x=*st.begin(),y=getfa(p[x]);
        ans+=1LL*c1[y]*c0[x];s[x]=y;st.erase(x);
        if(y>1) st.erase(y);
        c1[y]+=c1[x],c0[y]+=c0[x];
        if(y>1) st.insert(y);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 12928
/*
 * @Author: Kaizyn
 * @Date: 2020-03-28 19:57:58
 * @LastEditTime: 2020-03-28 21:03:32
 */
#include <bits/stdc++.h>

// #define DEBUG

using namespace std;

const int N = 1e5+7;
const int MOD = 998244353;
const double eps = 1e-7;
const int INF = 0x3f3f3f3f;
typedef pair<int, int> pii;

int X, Y, A, B, C;
vector<int> a, b, c;
priority_queue<int, vector<int>, greater<int>> q;

signed main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> X >> Y >> A >> B >> C;
    a.resize(A);
    b.resize(B);
    c.resize(C);
    for (int i = 0; i < A; ++i) cin >> a[i];
    for (int i = 0; i < B; ++i) cin >> b[i];
    for (int i = 0; i < C; ++i) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    reverse(c.begin(), c.end());
    long long sum = 0;
    for (int i = 0; i < X && i < A; ++i) q.push(a[i]), sum += a[i];
    for (int i = 0; i < Y && i < B; ++i) q.push(b[i]), sum += b[i];
    int t = 0;
    for (int i = A; i < X; ++i) q.push(c[t++]), sum += c[i];
    for (int i = B; i < Y; ++i) q.push(c[t++]), sum += c[i];
    while (t < C && c[t] > q.top()) {
        sum += c[t++]-q.top();
        q.pop();
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 2552
import numpy as np
K,N=map(int, input().split())
A=list(map(int, input().split()))
K,N=int(K),int(N)
b=[]
for i in range(0,N-1):
    b.append(A[i+1]-A[i])
b.append(A[0]+K-A[N-1])
c=np.sum(b)
print(c-max(b))
    


Measured memory_bytes: 43168
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
    int N, Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    vector<int> AC(N + 1, 0);
    for (int i = 1; i <= N; i++)
        AC[i] = AC[i-1] + (S[i-1] == 'A' && S[i] == 'C');
    int l, r;
    for (int i = 0; i < Q; i++) {
        cin >> l >> r;
        cout << AC[r-1] - AC[l-1] << endl;
    }
}

Measured memory_bytes: 1536
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7



N, K = list(map(int, sys.stdin.readline().split()))
H = list(map(int, sys.stdin.readline().split()))

H = np.array(H, dtype=int)
a = np.count_nonzero(H >=K)
print(a)


Measured memory_bytes: 22916
N=input()
if N[-1]=="2" or N[-1]=="4" or N[-1]=="5" or N[-1]=="7" or N[-1]=="9":
	print("hon")
elif N[-1]=="0" or N[-1]=="1" or N[-1]=="6" or N[-1]=="8":
	print("pon")
else:
	print("bon")

Measured memory_bytes: 8992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<int,int>
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define FORR(I,A,B) for(int I = ((B)-1); I >= (A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
int gcd(int a,int b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
int lcm(int a,int b){int c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	int ans = MOD;
	FOR(i,0,s.size()-2){
		string k = s.substr(i,3);
		ans = min(ans,abs(753-stoi(k)));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <iomanip>
#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 <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#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 <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;

double Minkowski_D(double p, int n, vector<double> X, vector<double> Y){
  double d_sum = 0;
  double XY;
  for(int i = 0; i < n; i++){
    if(X.at(i) - Y.at(i) >= 0) XY = X.at(i) - Y.at(i);
    else XY = -(X.at(i) - Y.at(i));
    d_sum += pow(XY, p);
  }
  return pow(d_sum, 1 / p);
}
double Chebyshev_D(int n, vector<double> X, vector<double> Y){
  vector<double> Z(n);
  for(int i = 0; i < n; i++){
    if(X.at(i) - Y.at(i) >= 0) Z.at(i) = X.at(i) - Y.at(i);
    else Z.at(i) = -(X.at(i) - Y.at(i));
  }
  sort(Z.begin(), Z.end());
  reverse(Z.begin(), Z.end());
  return Z.at(0);
}

int main(){
  int n;
  cin >> n;
  vector<double> X(n);
  vector<double> Y(n);
  for(int i = 0; i < n; i++){
    cin >> X.at(i);
  }
  for(int i = 0; i < n; i++){
    cin >> Y.at(i);
  }
  cout << fixed << setprecision(10);
  cout << Minkowski_D(1, n, X, Y) << endl;
  cout << Minkowski_D(2, n, X, Y) << endl;
  cout << Minkowski_D(3, n, X, Y) << endl;
  cout << Chebyshev_D(n, X, Y) << endl;
}


Measured memory_bytes: 3484
#include <iostream>
int main() {
    int h, w;
    for (std::cin >> h >> w; h != 0 || w != 0; std::cin >> h >> w) {
        for (int i = 0; i < h; ++i) {
            for (int j = 0; j < w; ++j) {
                char c;
                if ((i + j) % 2 == 0) {
                    c = '#';
                } else {
                    c = '.';
                }
                std::cout << c;
            }
            std::cout << std::endl;
        }
        std::cout << std::endl;
    }
}



Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
#define erase(s) s.erase(s.end()-1) //文字列sの末尾削除

ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
string RLE(string s){
  ll n=s.size();
  char now='.';
  ll count=1;
  string press;
  loop(i,n){
    if(s[i]!=now){
      if(i){
        press+=now;
        press+=to_string(count);
      }
      now=s[i];
      count=1;
      continue;
    }
    else count++;
  }
  press+=now;
  press+=to_string(count);
  return press;
}

int main() {
  cout << fixed << setprecision(30);
  ll n;
  cin>>n;
  vec s(n);
  loop(i,n)cin>>s[i];
  ll q;
  cin>>q;
  vec t(q);
  loop(i,q)cin>>t[i];
  ll ans=0;
  loop(i,q)if(count2way(s,t[i]))ans++;
  putout(ans);
  return 0;
}


Measured memory_bytes: 3772
// #include <fstream>
#include <vector>
#include <cstring>
#include <iostream>


// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;

#define MOD 1000000007
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = (b-1); i >= a; i--)
#define RF0(i,b) RFO(i,0,b)
#define lli long long int
#define pii pair<int,int>
#define add(a,b) ((int) (((lli) a + b)%MOD))
#define mul(a,b) ((int) (((lli) a * b)%MOD))

// ifstream cin ("cinput.in");
// ofstream cout ("coutput.out");

int N, a, b;
vector<int> graph [200000];
int fct [200001][2];
int dp [200000];
int nbel [200000];

int mod_exp(int x, int y) {  
    int res = 1; 
    x = x % MOD;
    while (y > 0) { 
        if (y & 1) res = mul(res,x);
        y = y>>1;
        x = mul(x,x);  
    }
    return res;  
}

int bc(int n, int k)
{
    return mul(mul(fct[n][0], fct[k][1]), fct[n-k][1]);
}

int dfs(int node, int par) { // returns # below
    vector<int> ks;
    dp[node] = 1;
    nbel[node] = 0;
    for(int ne: graph[node]) {
        if (ne == par) continue;
        int res = dfs(ne, node);
        nbel[node] += res;
        ks.emplace_back(res);
    }
    int nbl2 = nbel[node];
    for(int ne: graph[node]) {
        if (ne == par) continue;
        int k = *(--ks.end()); ks.pop_back();
        dp[node] = mul(mul(dp[ne], bc(nbl2, k)), dp[node]);
        nbl2 -= k;
    }
    return nbel[node]+1;
}

void dfs2(int node, int par) {
    if (par != -1) {
        // dp[par]/bc(N-1, nbel[node]+1)*bc(N,N-nbel[node]-1)
        dp[node] = mul(dp[par], mul(mod_exp(bc(N-1, nbel[node]+1), MOD-2), bc(N-1,N-nbel[node]-1)));
    }
    for(int ne: graph[node]) {
        if (ne == par) continue;
        dfs2(ne,node);
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    fct[0][0] = 1; fct[0][1] = mod_exp(1,MOD-2);
    FOR(i,1,200001) {fct[i][0] = mul(fct[i-1][0], i); fct[i][1] = mod_exp(fct[i][0], MOD-2);}
    cin >> N;
    F0R(i,N-1) {
        cin>>a>>b;
        graph[a-1].emplace_back(b-1);
        graph[b-1].emplace_back(a-1);
    }
    dfs(0,-1);
    dfs2(0,-1);
    F0R(i,N) cout << dp[i] << '\n';
}

Measured memory_bytes: 17252
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <utility>
#include <queue>

using namespace std;
typedef long long ll;
const int LEN = 100000;

struct fastio {
  int it, len;
  char s[LEN + 5];
  fastio() {
    it = len = 0;
  }
  char get() {
    if(it < len) return s[it++];
    it = 0, len = fread(s, 1, LEN, stdin);
    return len ? s[it++] : EOF;
  }
  bool notend() {
    char c;
    for (c = get();c == ' ' || c == '\n' || c == '\r';c = get());
    if (it) it--;
    return c != EOF;
  }
  void put(char c) {
    if(it == LEN) fwrite(s,1,LEN,stdout), it = 0;
    s[it++] = c;
  }
  void flush() {
    fwrite(s, 1, it, stdout);
  }
}buff, bufo;
inline int getint() {
  char c; int res = 0, sig = 1;
  for (c = buff.get(); c < '0' || c > '9'; c = buff.get()) if(c == '-') sig = -1;
  for (;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline ll getll() {
  char c; ll res = 0, sig = 1;
  for (c = buff.get(); c < '0' || c > '9'; c = buff.get()) if (c == '-') sig = -1;
  for (; c >= '0' && c <= '9'; c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline void putint(int x, char suf) {
  if (!x) bufo.put('0');
  else {
    if (x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[15];
    while (x) {
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for (; k; k--) bufo.put(s[k]);
  }
  bufo.put(suf);
}
inline void putll(ll x, char suf) {
  if (!x) bufo.put('0');
  else {
    if (x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[25];
    while (x) {
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for (; k; k--) bufo.put(s[k]);
  }
  bufo.put(suf);
}
inline char get_char() {
  char c;
  for (c = buff.get(); c == ' ' || c == '\n' || c == '\r'; c = buff.get());
  return c;
}
#define maxn 15
#define maxq 55
int ans, n, m, q, res[maxn], a[maxq], b[maxq], c[maxq], d[maxq];
int calc() {
  int tmp = 0;
  for (int i = 1; i <= q; i++) {
    tmp += d[i] * (res[b[i]] - res[a[i]] == c[i]);
  }
  return tmp;
}
void dfs(int x) {
  if (x > n) ans = max(ans, calc());
  else {
    for (res[x] = res[x - 1]; res[x] <= m; res[x]++) dfs(x + 1);
  }
}
int main() {
  res[0] = 1;
  n = getint(), m = getint(), q = getint();
  for (int i = 1; i <= q; i++) {
    a[i] = getint(), b[i] = getint(), c[i] = getint(), d[i] = getint();
  }
  dfs(1);
  putint(ans, '\n');
  bufo.flush();
  return 0;
}



Measured memory_bytes: 3644
#include <stdio.h>

int main(void)
{
	int c1,c5,c10,c50,c100,c500,a;
	scanf("%d %d %d %d %d %d",&c1,&c5,&c10,&c50,&c100,&c500);
	a=(c1*1)+(c5*5)+(c10*10)+(c50*50)+(c100*100)+(c500*500);
	if(a>=1000){
		printf("1\n");
	}
	else{
		printf("0\n");
	}
	return 0;
}


Measured memory_bytes: 2120
from collections import defaultdict

class BIT(object):
    def __init__(self, N, init=0):
        self.N = N
        self.bit = [init for _ in range(N)]

    def add(self, k, w):
        x = k
        while x < self.N:
            self.bit[x] += w
            x |= x + 1

    def sum(self, k):
        s = 0
        x = k - 1
        while x >= 0:
            s += self.bit[x]
            x = (x & (x + 1)) - 1
        return s

n = int(input())
s = list(input())
q = int(input())

d = defaultdict(lambda: BIT(n))
for i, si in enumerate(s):
    d[si].add(i, 1)

for i in range(q):
    k, x, y = input().split()
    if k == '1':
        x = int(x) - 1
        d[s[x]].add(x, -1)
        d[y].add(x, 1)
        s[x] = y
    else:
        l = int(x) - 1
        r = int(y) - 1
        ans = 0
        for v in d.values():
            ans += (v.sum(r + 1) - v.sum(l)) > 0
        print(ans)


Measured memory_bytes: 253084
import copy

def BubbleSort(c, n):
    for i in range(0, n):
        for j in range(n-1, i, -1):
            if c[j][1] < c[j-1][1]:
                x = c[j]
                c[j] = c[j-1]
                c[j-1] = x
    return c

def SelectionSort(c, n):
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if c[j][1] < c[minj][1]:
                minj = j
        x = c[i]
        c[i] = c[minj]
        c[minj] = x
    return c

n = int(input())
c = list(map(str, input().split()))
c1 = copy.deepcopy(c)
c2 = copy.deepcopy(c)

c1 = BubbleSort(c1, n)
print(*c1)
print('Stable')

c2 = SelectionSort(c2, n)
print(*c2)
if c1 == c2:
    print('Stable')
else:
    print('Not stable')


Measured memory_bytes: 6344
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np

def main():
    restaurants=[]
    n = int(input())
    restaurants=[list(input().split()) for _ in range(n)]

    for idx,restaurant in enumerate(restaurants):
        restaurants[idx][1]=int(str(restaurant[1]))
        restaurants[idx].append(idx+1)
    restaurants.sort(key=lambda x:x[1],reverse=True)
    restaurants.sort(key=lambda x:x[0].lower())
    for restaurant in restaurants:
        print(restaurant[2])

if __name__=="__main__":
    main()

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

typedef long long ll;

#define rep(i,a) for(int i=0;i<(a);++i)
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

const int MAX_N = 10000000;
bool primes[MAX_N + 1];

bool sieve()
{
    //primes[2] = true;
    fill(primes, primes + MAX_N + 1, true);
    for(int i = 2; i * i <= MAX_N; i++) 
        if(primes[i])
            for(int j = i + i; j <= MAX_N; j += i)
                primes[j] = false;
}

int main()
{
    int n;
    sieve();
    
    while(cin >> n && n) {
        for(int a = n; a >= 13; a--) {
            if(primes[a] && primes[a-2] && primes[a-6] && primes[a-8]) {
                cout << a << endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 10000
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String[] sizes = scan.nextLine().split(" ");
        int size = Integer.parseInt(sizes[0]);
        int maxJ = Integer.parseInt(sizes[1]);

        String heights = scan.nextLine();
        String[] hstr = heights.split(" ");
        int[]hs = new int[hstr.length];
        for (int i = 0 ; i<hstr.length ; i++) {
          hs[i] = Integer.parseInt(hstr[i]);
        }
        
        scan.close();
        
        int[] res = new int[size];
        res[0] = 0;
          
        for (int i = 1 ; i < size ; i++) {
            res[i] = Math.abs(hs[i]-hs[i-1]) + res[i-1];
            for (int j = 2 ; j <= maxJ ; j++) {
                if (i-j < 0) break;
                res[i] = Math.min(res[i], Math.abs(hs[i] - hs[i-j]) + res[i-j]);
            }
        }
        
        System.out.print(res[size-1]);
    }
}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;
const int mod = 1000000007;

typedef pair<ll, ll> P;

int main() {

    map<string, bool> dict;
    int n;
    cin >> n;
    rep(i, n) {
        string command, key;
        cin >> command >> key;
        if (command == "insert") {
            dict[key] = true;
        } else if (command == "find") {
            if (dict.find(key) != dict.end()) {
                cout << "yes" << endl;
            } else {
                cout << "no" << endl;
            }
        }
    }

}



Measured memory_bytes: 36444
// 2020-09-19 21:03:47
// clang-format off
#include <bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
// #include <atcoder/convolution>
// #include <atcoder/dsu>
// #include <atcoder/fenwicktree>
// #include <atcoder/lazysegtree>
// #include <atcoder/math>
// #include <atcoder/maxflow>
// #include <atcoder/mincostflow>
// #include <atcoder/modint>
// #include <atcoder/scc>
// #include <atcoder/segtree>
// #include <atcoder/string>
// #include <atcoder/twosat>
// #include <atcoder/all>
// using namespace atcoder;

// clang-format on
void answer() {
  ll n;
  cin >> n;
  ll ans = 0;
  REPC(a, 1, n - 1) {
    for (int b = a; ll(a) * ll(b) < n; b++) {
      if (a == b)
        ans++;
      else
        ans += 2;
    }
  }
  cout << ans << '\n';
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3648
a=list(map(int, input().split()))
n=a[0]
m=a[1]
l=list(map(int, input().split()))
lm=sum(l)
l=sorted(l, reverse=True)
for i in range(m):
    if l[i]*4*m<lm:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll  long long
#define Cr7 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define N   100100
vector<ll> v;
int main()
{
    Cr7
    ll X;   cin>>X;
    v.push_back(0);
    for(ll i=1 ; ; i++)
    {
     ll x=i*i*i*i*i;
     if(x-v.back() > 1e9)    break;
     v.push_back(x);
    }
    for(ll i=0 ; i<v.size() ; i++)
    {
        for(ll j=i ; j<v.size() ; j++)
        {
            if(v[i]+v[j]==X)
            {
                cout<<i<<" "<<-1*j<<endl;
                return 0;
            }
        }
    }
    for(ll i=1 ; i<v.size() ; i++)
    {
        for(ll j=0 ; j<=i ; j++)
        {
            if(v[i]-v[j]==X)
            {
                cout<<i<<" "<<j<<endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3628
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define pb push_back
#define lowbit(x) x&(-x)
#define PII  pair<int, int> 
#define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int mod = (int)1e9 + 7;
const int maxn = (int)1e5 + 5;
using namespace std;

string s[105];

int main()
{
	int n; cin >> n;
	bool flag = true;
	for(int i = 1; i <= n; i++){
		cin >> s[i];
	}
	for(int i = 1; i <= n - 1; i++){
		if(s[i][s[i].size()-1] != s[i+1][0]) flag = false;
	}
	sort(s + 1, s + n + 1);
	for(int i = 1; i <= n - 1; i++){
		if(s[i] == s[i+1]) flag = false;
	}
	if(flag) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main(){
	
	fastio;
	int h,w,m;
	cin >> h >> w >> m;
	int fans = 0;
	int Row[h+3]={0};
	int Col[w+3]={0};
	int maxxc = 0;
	int maxxr = 0;
	map<pair<int,int>,int>MAP;
	while(m--){
		int r,c;
		cin >> r >> c;
		MAP[{r,c}] = 1;
		Row[r]++;
		Col[c]++;
	}
	for(int i =  1; i <= w; i ++)
		maxxc = max(maxxc , Col[i]);
	 vector<int>maxx_cnt;
	 vector<int>maxx_r;
	 for(int i =  1; i <= h; i ++)
		maxxr = max(maxxr,Row[i]);
	for(int i = 1 ; i <= w ; i ++){
		if(maxxc==Col[i])
			maxx_cnt.push_back(i);
	}
	for(int i = 1 ; i <= h ; i ++){
		if(maxxr==Row[i])
			maxx_r.push_back(i);
	}
	int flg1 = 0; int flg2 = 0;
	for(int i = 0 ;i < maxx_r.size(); i ++){
		for(int j = 0 ;j < maxx_cnt.size(); j ++){
			if(MAP[{maxx_r[i],maxx_cnt[j]}]==1){
				fans = max(fans,maxxr + maxxc - 1);
				flg1 = 1;
			}
			else
				fans = max(fans , maxxr+maxxc),flg2 = 1;
		}
		if(flg1&&flg2)
		break;
	}
	cout << fans << "\n";
}


Measured memory_bytes: 45408