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

struct edge{
    int to;
    long long cost;
};

typedef pair<long long, int> P;
const long long INF = 100000000000000000;
vector<long long> dist;

typedef vector<vector<edge> > AdjList;
AdjList graph;

void dijkstra(int n, int s){
    dist = vector<long long>(n,INF);
    dist[s] = 0;
    priority_queue<P, vector<P>, greater<P> > que;
    que.push(P(0,s));

    while(!que.empty()){
        P p = que.top();
        que.pop();
        int v = p.second;
        if(dist[v] < p.first){
            continue;
        }
        for(int i=0; i<graph[v].size(); i++){
            edge e = graph[v][i];
            if(dist[e.to] > dist[v] + e.cost){
                dist[e.to] = dist[v] + e.cost;
                
                que.push(P(dist[e.to],e.to));
            }
        }
    }
}

int main(void){
    int n;
    cin >> n;
    graph = AdjList(2*n);
    for(int i=0; i<n-1; i++){
        int a, b;
        long long c;
        cin >> a >> b >> c;
        a--;
        b--;
        graph[a].push_back((edge){b,c});
        graph[b].push_back((edge){a,c});
    }
    int q, k;
    cin >> q >> k;
    k--;
    dijkstra(n,k);
    for(int i=0; i<q; i++){
        int x, y;
        long long ans = 0;
        cin >> x >> y;
        x--;
        y--;
        ans = dist[x] + dist[y];
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 13424
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int n, a[6], cnt;
int main() {
	scanf("%d", &n);
	a[1] = n / 1000, a[2] = n / 100 % 10, a[3] = n % 100 / 10, a[4] = n % 10;
	for(int i = 1; i <= 3; i++)if(a[i] == a[1])cnt++;
	if(cnt >= 3)printf("Yes\n");
	else {
		cnt = 0;
		for(int i = 2; i <= 4; i++)if(a[i] == a[2])cnt++;
		if(cnt == 3)printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

void set_bool_name(string t, string f) {
  cout.imbue(locale(cout.getloc(), new BoolName(t, f)));
}

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << (a <= c && c <= b ? "Yes" : "No") << endl;
}



Measured memory_bytes: 256
n = gets.to_i
s = (1..n).map{ gets }
compress = s.map{|i| i.chomp.chars.sort.join}.sort
ans = 0
count = 0
compress.inject {|before, c| 
    if before == c
        count += 1
        ans += count 
    else
        count = 0
    end
    before = c
}
p ans

Measured memory_bytes: 33384
#include <iostream>
using namespace std;
int main(void){
    int n;
    string taro, hanako;
    int score_taro, score_hanako;
    
    cin >> n;
    
    score_taro = 0;
    score_hanako = 0;
    while(cin >> taro >> hanako){
        if(taro > hanako){
            score_taro += 3;
        }
        
        if(taro == hanako){
            score_taro += 1;
            score_hanako += 1;
        }
        
        if(taro < hanako){
            score_hanako += 3;
        }
    }
    cout << score_taro << " " << score_hanako << endl;
}

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

typedef long long ll;

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

    int N;
    cin>>N;

    int A[N+1];
    for (int i=1;i<=N;++i) cin>>A[i];

    int left[N+1], right[N+2];
    left[0] = 0; right[N+1] = 0;

    for (int i=1;i<=N;++i) left[i] = max(left[i-1], A[i]);
    for (int i=N;i>=1;--i) right[i] = max(right[i+1], A[i]);

    for (int i=1;i<=N;++i){
        cout<<max(left[i-1], right[i+1])<<endl;
    }

    return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")

bool isprime(int p) {
  if (p==1) return false;
  FOR(i,2,p) {
    if (p%i==0) return false;
  }
  return true;
}

int main(){
  int a,b;
  cin >> a >> b;
  cout << max({a+b,a-b,a*b});
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
using namespace std;
int main(){
	long long int res = 0, n;
	cin >> n;
	for(long long int i=0;i<n-1;++i)
	{
		res += (i+1) * (n-i);
		long long int x, y;
		cin >> x >> y;
		if(x>y)
		{
			long long int tmp=x;
			x=y,y=tmp;
		}
		res -= x*(n-y+1);
	}
	cout << res+n;
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define mem(a, b) memset(a, b, sizeof(a))
#define inf (1e4)
#define pi acos(-1)
using namespace std;

int n, m;
char ch[55][55], ch2[55][55];

bool jg(int a, int b)
{
    for(int i = 0;i < m;i++)
    {
        for(int j = 0;j < m;j++)
        {
            if(ch[a + i][b + j] != ch2[i + 1][j + 1])
                return false;
        }
    }
    return true;
}

int main()
{
    scanf("%d%d", &n, &m);
    for(int i = 1;i <= n;i++)
        scanf("%s", ch[i] + 1);
    for(int i = 1;i <= m;i++)
        scanf("%s", ch2[i] + 1);
    bool flag = 0;
    for(int i = 1;i <= n - m + 1;i++)
    {
        for(int j = 1;j <= n - m + 1;j++)
        {
            if(jg(i, j))
            {
                flag = 1;
                break;
            }
        }
        if(flag)
            break;
    }
    if(flag)
        puts("Yes");
    else
        puts("No");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=5e5+10;
const ll mod=1e9+7;
struct node{
	int b,k,id;
}v[N];
int n;
int kmax[N],kmin[N],l[N],r[N];
vector<int>q[N];
ll f[N];
bool cmp(node x,node y)
{
	return x.b<y.b;
}
bool cmp1(node x,node y)
{
	return x.k<y.k;
}
bool cmp3(int x,int y){
     return x>y;
}
int fi(int l,int r,int s) 
{
     if (l==r) return l;
     int mid=(l+r)/2;
     if (s==v[mid].k) return mid;
     else if (s>v[mid].k) return fi(mid+1,r,s);
     else return fi(l,mid-1,s);
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {
		scanf("%d%d",&v[i].b,&v[i].k);
	}
	sort(v+1,v+n+1,cmp);
	kmin[n+1]=1000000001;
	for (int i=1;i<=n;i++) kmax[i]=max(kmax[i-1],v[i].k);
	for (int i=n;i>=1;i--) kmin[i]=min(kmin[i+1],v[i].k);
	for (int i=1;i<=n;i++) v[i].id=i;	
	sort(v+1,v+n+1,cmp1); 
    for (int i=1;i<=n;i++) l[i]=fi(1,n,kmin[v[i].id]),r[i]=fi(1,n,kmax[v[i].id]);	
	for (int i=1;i<=n;i++) q[r[i]].push_back(l[i]);
	for (int i=1;i<=n;i++) sort(q[i].begin(),q[i].end(),cmp3);	
	f[0]=1;
	for (int i=1;i<=n;i++)	
	{
		int len=q[i].size();
		ll ans=1,ans1=1;
		for (int j=0;j<len;j++){
		ans=(ans*2ll)%mod;
		if (j==len-1||((j!=len-1)&&q[i][j]!=q[i][j+1]))
		{
            f[i]=(f[i]+(ll)(ans-ans1+mod)%mod*(f[i-1]-(q[i][j]-1?f[q[i][j]-2]:0)+mod)%mod)%mod;
            ans1=ans;
		} 
	    }
		f[i]=(f[i-1]+f[i])%mod;
	}
	printf("%lld\n",(f[n]-f[n-1]+mod)%mod);
}

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

int main(){
  double r;
  cin >> r;
  double pie = M_PI;
  double area = r * r * pie;
  double circa = 2 * r * pie;
  cout << fixed << setprecision(10);
  cout << area << " " << circa << endl;
}


Measured memory_bytes: 3224
import statistics
N = int(input())
A = list(map(int,input().split()))
MEAN = statistics.mean(A)
D = [abs(a -MEAN) for a in A]
MIN = 100
MIN_I = 0
for i in range(N):
    if MIN > D[i]:
        MIN = D[i]
        MIN_I = i
print(MIN_I)

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

int main()
{
    int arr[3][3];
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> arr[i][j];
        }
    }
    int n;
    cin >> n;
    for (int k = 0; k < n; k++)
    {
        int ab;
        cin >> ab;

        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                if (ab == arr[i][j])
                {
                    arr[i][j] = 0;
                }
            }
        }
    }

    if ((arr[0][0] + arr[0][1] + arr[0][2] == 0) || (arr[1][0] + arr[1][1] + arr[1][2] == 0) || (arr[2][0] + arr[2][1] + arr[2][2] == 0) ||
        (arr[0][0] + arr[1][0] + arr[2][0] == 0) || (arr[0][1] + arr[1][1] + arr[2][1] == 0) || (arr[0][2] + arr[1][2] + arr[2][2] == 0) ||
        (arr[0][0] + arr[1][1] + arr[2][2] == 0) || (arr[0][2] + arr[1][1] + arr[2][0] == 0))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int main () {
  int n, k;
  cin >> n >> k;
  vll num(k, 0); // num[x] = (kで割ってx余る数が1以上N以下に何個あるか)
  for (int i = 1; i <= n; ++i) num[i%k]++;
  ll ans = 0;
  for (int a = 0; a < k; ++a) {
    int b = (k-a)%k;
    int c = (k-a)%k;
    if ((b+c)%k != 0) continue;
    ans += num[a]*num[b]*num[c];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const long long MOD = 1000000007;

ll N, X[20], Y[20], P[20];
ll cost[1 << 20];
ll dp[1 << 20][20];

void init(){
    REP(st, 1 << N){
        ll z = INT64_MAX / 2;
        REP(i, N){
            ll x = 0, y = 0;
            if((st & (1 << i)) == 0) continue;
            REP(j, N){
                if((st & (1 << j)) == 0) continue;
                x += P[j] * abs(X[i] - X[j]);
                y += P[j] * abs(Y[i] - Y[j]);
            }
            z = min(z, min(x, y));
        }
        cost[st] = z;
    }
}

void solve(){
    init();
    REP(st, 1 << N){
        REP(i, N){
            if(st & (1 << i)) dp[st][0] += P[i] * min(abs(X[i]), abs(Y[i]));
        }
    }
    REP(i, N){
        REP(s, 1 << N){
            ll m = INT64_MAX / 2;
            for(int t = s; t >= 0; t--){
                t &= s;
                m = min(m, dp[s - t][i] + cost[t]);
            }
            dp[s][i + 1] = m;
        }
    }
}

signed main(){
    cin >> N;
    REP(i, N) cin >> X[i] >> Y[i] >> P[i];
    solve();
    REP(i, N + 1) PRINT(dp[(1 << N) - 1][i]);
    return 0;
}

Measured memory_bytes: 9012
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
#sort = sorted(a)[::-1] 降順
#if l[i] == l[j]: continue
n, m = map(int, input().split())
req = [list(map(int, input().split())) for _ in range(m)]

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

uf = UnionFind(n)
for i in range(m):
    uf.union(req[i][0]-1, req[i][1]-1)

print(uf.group_count() - 1)


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

typedef pair<ll, ll> P; // おいしさ、種類

int main() {
    ll N, K;
    cin >> N >> K;
    vector<P> sushi(N);
    rep(i, N) {
        P p;
        cin >> p.second >> p.first;
        sushi[i] = p;
    }

    sort(sushi.rbegin(), sushi.rend()); // おいしさの順にソート

    // まずはおいしさの順番に貪欲に食べていく
    ll sum = 0;
    set<ll> kinds; // 食べた寿司の種類
    priority_queue<ll, vector<ll>, greater<>> minQ; // 既に食べた種類（２番目以降の）のおいしさ
    rep(i, K) {
        P s = sushi[i];
        if (kinds.find(s.second) == kinds.end()) { // 初めて食べた種類の寿司の場合
            kinds.insert(s.second);
        } else {
            minQ.push(s.first);
        }
        sum += s.first;
    }

    ll ans = sum + pow((ll) kinds.size(), 2); // おいしさの順番に貪欲に食べた場合のまんぞくポイント

    map<ll, ll> typeToDelicious; // まだ食べていない種類 => おいしさの最大値
    for (int i = N - 1; i >= K; i--) { // 貪欲に選ばれなかった寿司をおいしさの低い順に見ていく
        P s = sushi[i];
        if (kinds.find(s.second) == kinds.end()) typeToDelicious[s.second] = s.first; // 食べていない場合はおいしさを記録する
    }

    priority_queue<ll> maxQ; // まだ食べていない種類でおいしさが最大の寿司
    for (auto x: typeToDelicious) maxQ.push(x.second);

    // minQとmaxQの寿司を入れ替えて,まんぞくポイントが増えるか試す
    ll typeCount = 0;
    while (minQ.size() && maxQ.size()) {
        sum -= minQ.top();
        minQ.pop();
        sum += maxQ.top();
        maxQ.pop();
        typeCount++;
        chmax(ans, (ll) (sum + pow((ll) kinds.size() + typeCount, 2)));
    }

    cout << ans << endl;
}


Measured memory_bytes: 7932
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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 INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int N;
int A[100010];
int B[100010];

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

	cin >> N;
	rep(i, 0, N + 1)
	{
		cin >> A[i];
	}
	int ans = 0;
	rep(i, 0, N)
	{
		cin >> B[i];
		int t = min(A[i], B[i]);
		A[i] -= t;
		B[i] -= t;
		ans += t;
		t = min(A[i + 1], B[i]);
		A[i + 1] -= t;
		B[i] -= t;
		ans += t;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define N 110000
#define lowbit(x) (x&(-x))
using namespace std;
int a[3][N],n,d[5],flip[2],inv[2],s[N],lt[N],w[N];
void change(int x,int d) { for(int i=x;i;i-=lowbit(i)) lt[i]+=d; }
int find(int x) { int sum=0; for(int i=x;i<=n;i+=lowbit(i)) sum+=lt[i]; return sum; }
int main() {
    scanf("%d",&n); for(int i=0;i<=2;i++) for(int j=1;j<=n;j++) scanf("%d",&a[i][j]);
    for(int i=1;i<=n;i++) {
        d[0]=a[0][i];d[1]=a[1][i];d[2]=a[2][i]; sort(d,d+3); if(d[2]%3 || d[0]+1!=d[1] || d[1]+1!=d[2] || d[1]!=a[1][i]) {printf("No\n");return 0;} int j=d[2]/3;
        if((i-j)%2) {printf("No\n");return 0;} inv[i%2]=(inv[i%2]+(a[0][i]>a[2][i]))%2; s[i]=j;
    }
    for(int i=1;i<=n;i++) w[s[i]]=i; for(int i=1;i<=n;i+=2) { int now=w[i]+2*find(w[i]); flip[1]=(flip[1]+abs(i-now)/2)%2; change(w[i],1); }
    for(int i=1;i<=n;i++) lt[i]=0; for(int i=2;i<n;i+=2) { int now=w[i]+2*find(w[i]); flip[0]=(flip[0]+abs(i-now)/2)%2; change(w[i],1); }
    if(flip[0]!=inv[1] || flip[1]!=inv[0]) printf("No\n"); else printf("Yes\n");
    return 0;
}

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

using namespace std;

struct UnionFind {
    vector<int> par;
    
    UnionFind(int N) : par(N) {
        for(int n=1; n<=N; n++) {
            par[n]=n;
        }
    }
    
    int root(int x) {
        if(par[x]==x) return x;
        return par[x] = root(par[x]);
    }
    
    bool is_same(int x, int y) {
        return root(x)==root(y);
    }
    
    void unite(int x, int y) {
        int rx=root(x);
        int ry=root(y);
        if(rx==ry) return ;
        par[rx] = ry;
    }
    
    int group_num() {
        int count=0;
        for(int n=1; n<par.size(); n++) {
            if(par[n]==n) count++;
        }
        return count;
    }
};

int main() {
    int N, M;
    cin >> N >> M;
    UnionFind tree(N+1);
    
    for(int m=0; m<M; m++) {
        int x, y, z;
        cin >> x >> y >> z;
        tree.unite(x, y);
    }
    
    cout << tree.group_num() << endl;

    return 0;
    
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
#define pi 3.1415926535
typedef long long ll;

int main(){
    int N,K;
    cin>>N>>K;
    if((N+1)/2>=K){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 1000000;
const int INF = 1e9;
const double pi=acos(-1);
using namespace std;

int main(){
  string s;
  cin >> s;
  rep(i,s.size()){
    for(int j=i;j<s.size();j++){
      string t=s.substr(0,i)+s.substr(j);
      if(t=="keyence"){
        cout << "YES"<<endl;
        return 0;
      }
    }
  }
  cout <<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	char buf[101];
	scanf("%s",buf);

	char pre = 'A',current;

	int ans = 0;

	for(int i = 0; buf[i] != '\0'; i++){

		current = buf[i];

		if(current <= pre){
			ans++;
		}
		pre = current;
	}

	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 3184
fun main(args: Array<String>) {
    val (h, w) = readIntegerList()
    var costMatrix = Array(10) { readLongList().toLongArray() }
    warshallFloyd(costMatrix)
    val aMtrix = Array(h) { readIntegerList() }
    var ans = 0L
    for (row in aMtrix) {
        for (i in row) {
            if (i != -1) {
                ans += costMatrix[i][1]
            }
        }
    }
    println(ans)
}

/** O((costMatrix.size)^3) costMatrix is changed */
fun warshallFloyd(costMatrix: Array<LongArray>): Array<LongArray> {
    val indices = costMatrix.indices
    for (k in indices) {
        for (i in indices) {
            for (j in indices) {
                if (costMatrix[i][k] != Long.MAX_VALUE && costMatrix[k][j] != Long.MAX_VALUE) {
                    costMatrix[i][j] = Math.min(costMatrix[i][j], costMatrix[i][k] + costMatrix[k][j])
                }
            }
        }
    }
    return costMatrix
}


fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


Measured memory_bytes: 41616
import sys
sys.setrecursionlimit(10000000)
import numpy as np
from heapq import heapify, heappop, heappush
import copy


def main():
    K = int(input())
    S = input()

    if len(S) > K: 
        print(S[:K] + '...')
    else:
        print(S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 27140
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
using namespace std;

// 最大公約数を求める関数
int gcd(int a, int b) {
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}

int main() {

	int K;
	cin >> K;

	// ３つの数が全て異なる場合
	long long sum3 = 0;
	for (int i = 1; i <= K - 2; i++) {
		for (int j = i + 1; j <= K - 1; j++) {
			for (int l = j + 1; l <= K; l++) {
				sum3 += gcd(l, gcd(j, i));
			}
		}
	}

	// 数字が２種類しかない場合
	long long sum2 = 0;
	for (int j = 1; j <= K - 1; j++) {
		for (int l = j + 1; l <= K; l++) {
			sum2 += gcd(l, j);
		}
	}

	// 数字が１種類しかない場合
	long long sum1 = K * (K + 1) / 2;

	long long ans = 6 * sum3 + 6 * sum2 + sum1;

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <string>

void solve() {
    int n, k;
    std::string s;
    std::cin >> n >> k >> s;

    std::string u = s;
    std::reverse(u.begin(), u.end());
    u = s + u;

    int si = 0;
    for (int i = 1; i < n; ++i) {
        if (u.substr(i, n) < u.substr(si, n)) si = i;
    }
    u = u.substr(si, n);

    int l;
    for (l = 0; l < n; ++l) {
        if (u[l] != u[0]) break;
    }
    auto back = u.substr(l);

    --k;
    while (l < n && k > 0) {
        l = std::min(n, l * 2);
        --k;
    }

    auto ans = std::string(l, u[0]) + back;
    ans = ans.substr(0, n);
    std::cout << ans << std::endl;
}

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

    solve();

    return 0;
}


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


void solve(long long N, std::vector<long long> A, std::vector<long long> B, std::vector<long long> C){
    ll ans = 0;
    for(int i = 0; i < N; ++i){
        ans += B[A[i]-1];
        if(A[i+1] == A[i] + 1) ans += C[A[i]-1];
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    std::vector<long long> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&B[i]);
    }
    std::vector<long long> C(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&C[i]);
    }
    solve(N, std::move(A), std::move(B), std::move(C));
    return 0;
}


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

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vector<int>> mi;
typedef vector<vector<pair<int, int>>> w_graph;
typedef vector<vector<int>> uw_graph;

const ll mod = 1e9 + 7;
const int maxH = 1e3 + 5;
const int maxW = 1e3 + 5;
ll dp[maxH][maxW];
int h, w;

vector<vector<char>> grid(maxH, vector<char>(maxW));

ll solve(int i, int j){
	if (i == h && j == w) return 1;
	if (i > h || j > w || grid[i][j] == '#') return 0;
	if (dp[i][j] != -1) return dp[i][j];
	return dp[i][j] = ((solve(i + 1, j) % mod) + (solve(i, j + 1) % mod)) % mod;
}

void init(){
	for (int i = 0; i < maxH; i++){
		for (int j = 0; j < maxW; j++){
			dp[i][j] = -1;
		}
	}
}



int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   	#ifdef DEBUG
		freopen("out.txt", "w", stdout);
	#endif

	init();
	cin >> h >> w;
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++){
			cin >> grid[i][j];
		}
	}

	cout << solve(1, 1) << endl;

	return 0;
}


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

 
int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<bool>> TF(H, vector<bool> (W,true));
  vector<vector<char>> shoki(H, vector<char> (W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      char x;
      cin >> x;
      shoki.at(i).at(j) = x;
    }
  }
  for (int i = 0; i < H; i++) {
    bool x = true;
    for (int j = 0; j < W; j++) {
      if (shoki.at(i).at(j) == '#') {
        x = false;
        break;
      }
    }
    if (x) {
      for (int j = 0; j < W; j++) {
        TF.at(i).at(j) = false;
      }
    }
  }
  int count = W;
  for (int j = 0; j < W; j++) {
    bool x = true;
    for (int i = 0; i < H; i++) {
      if (shoki.at(i).at(j) == '#') {
        x = false;
        break;
      }
    }
    if (x) {
      for (int i = 0; i < H; i++) {
        TF.at(i).at(j) = false;
      }
      count -= 1;
    }
  }
  for (int i = 0; i < H; i++) {
    int total = 0;
    for (int j = 0; j < W; j++) {
      if (TF.at(i).at(j)) {
        cout << shoki.at(i).at(j);
        total += 1;
      }
      if (total == count) {
        cout << endl;
        break;
      }
    }
  }
}   

Measured memory_bytes: 256
n, q = map(int, input().split())
s = input()

cnt = [0]
for i in range(n - 1):
    cnt.append(cnt[-1])
    if s[i:i+2] == "AC":
        cnt[-1] += 1
for _ in range(q):
    l, r = map(int, input().split())
    ans = cnt[r - 1] - cnt[l - 1]
    print(ans)

Measured memory_bytes: 53212
// 0012 を使い回す
#include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

bool same_side(double x1, double y1, double x2, double y2, double x, double y, double x0, double y0) {
  return ((y1 - y2) * (x - x2) - (x1 - x2) * (y - y2)) * ((y1 - y2) * (x0 - x2) - (x1 - x2) * (y0 - y2)) >= 0;
}


bool in_triangle(double x1, double y1, double x2, double y2, double x3, double y3, double xp, double yp) {
  return same_side(x1,y1,x2,y2,xp,yp,x3,y3) && same_side(x2,y2,x3,y3,xp,yp,x1,y1) && same_side(x3,y3,x1,y1,xp,yp,x2,y2);
}


int main() {
  double x[4];
  double y[4];
  char c,d;
  while (cin >> x[0] >> c >> y[0]) {
    for (int i = 1; i < 4; i++)
      cin >> c >> x[i] >> d >> y[i];

    bool res = true;
    int k[4];
    for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 4; j++)
        k[j] = (j + i) % 4;
      if (in_triangle(x[k[0]], y[k[0]], x[k[1]], y[k[1]], x[k[2]], y[k[2]], x[k[3]], y[k[3]]))
        res = false;
    }

    if (res) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

Measured memory_bytes: 1216
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static final String EOL = System.getProperty("line.separator");
	public static final String BUILD_SEPARATOR = "####################";
    public void exec() throws IOException {
    	try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	PrintWriter out = new PrintWriter(System.out);){
            int n = Integer.parseInt(br.readLine());
            int[][][] bfr = new int[4][3][10];
            for(int i=0; i<n; i++) {
            	String[] str = br.readLine().split(" ");
            	int b = Integer.parseInt(str[0]);
            	int f = Integer.parseInt(str[1]);
            	int r = Integer.parseInt(str[2]);
            	int v = Integer.parseInt(str[3]);
            	bfr[b-1][f-1][r-1] += v;
            }
            
            StringBuilder sb = new StringBuilder();
            for(int b=0; b<4; b++) {
            	if(b>0) {
                	sb.append(BUILD_SEPARATOR).append(EOL);
            	}
            	for(int f=0; f<3; f++) {
                	for(int r=0; r<10; r++) {
                		sb.append(' ').append(bfr[b][f][r]);
                	}
                	sb.append(EOL);
            	}
            }
            out.print(sb.toString());
            out.flush();
    	}
    }
 
    public static void main(String[] args) throws IOException {
    	new Main().exec();
    }
}

Measured memory_bytes: 24496
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
#include <functional>
using namespace std;
typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA cerr << "AAAAA" << endl
#define debug_ cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    cout << #v << endl;                \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    cout << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

template <typename T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T &b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using P1 = pair<int, pair<int, int>>; // クラスカル法とかで、{cost, {from, to}}的に使う。
const ll INF = 1001001001001001001;
const double pi = acos(-1);

int main()
{
    int n, k;
    cin >> n >> k;
    if (k > (n - 1) * (n - 2) / 2)
    {
        cout << -1 << endl;
        return 0;
    }
    cout << (n - 1) * n / 2 - k << endl;

    for (int i = 2; i <= n; i++)
    {
        cout << 1 << " " << i << endl;
    }
    int cnt = 0;
    for (int i = 2; i <= n; i++)
    {
        for (int j = i + 1; j <= n; j++)
        {
            if (cnt >= (n - 1) * (n - 2) / 2 - k)
            {
                return 0;
            }
            cnt++;
            cout << i << " " << j << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define ks ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fr first
#define sc second
#define pb push_back
#define pf push_front
#define mp make_pair
using namespace std;
typedef pair<int,int>pa;
typedef long long ll;
typedef unsigned long long ull;
const int maxn=1e6+177;
const ll mod=0x3f3f3f3f3f3f3f3f;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
template<class T>inline void read(T &res){
    char c;T flag=1;
    while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
    while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
void wenjian(){freopen("concatenation.in","r",stdin);freopen("concatenation.out","w",stdout);}
void tempwj(){freopen("hash.in","r",stdin);freopen("hash.out","w",stdout);}
ll gcd(ll a,ll b){return b == 0 ? a : gcd(b,a % b);}
ll qpow(ll a,ll b,ll mod){a %= mod;ll ans = 1;while(b){if(b & 1)ans = ans * a % mod;a = a * a % mod;b >>= 1;}return ans;}

int a[maxn],b[maxn];

ll suma[maxn],sumb[maxn];

int main(){

    int n,m;
    scanf("%d%d",&n,&m);
    ll k;
    scanf("%lld",&k);
    suma[0]=0,sumb[0]=0;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        suma[i]=suma[i-1]+a[i];
    }
    for(int i=1;i<=m;i++){
        scanf("%d",&b[i]);
        sumb[i]=sumb[i-1]+b[i];
    }
    int ans=-1;
    for(int i=0;i<=n;i++){

        ll now=k-suma[i];
        if(now<0){
            break;
        }
        int index=upper_bound(sumb,sumb+m+1,now)-sumb;
        ans=max(ans,index-1+i);


    }
    printf("%d\n",ans);





}


Measured memory_bytes: 8528
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<queue>	

using namespace std;

namespace MyLib {
#define ALL(a) begin(a),end(a)
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(0)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long
}
using namespace MyLib;

queue<int> towns;
const int INF = 1000000000;

int n, m, l, k, a, h;
int c[100];
int r[100][100];
int v[100][100];
int used[100];

int main() {
	int buf;
	int x, y, t;
	while (cin >> n >> m >> l >> k >> a >> h, n) {
		fill(c, c + 100, 0);
		REP(i, 100)
			REP(j, 100)
			r[i][j] = INF;
		fill(used, used + 100, INF);
		REP(i, l) {
			cin >> buf;
			c[buf] = 1;
		}
		REP(i, k) {
			cin >> x >> y >> t;
			r[x][y] = r[y][x]=t;
		}
		REP(i, n)
			r[i][i] = 0;
		REP(k, n)
			REP(i, n)
				REP(j, n)
					r[i][j] = min(r[i][j], r[i][k] + r[k][j]);
		towns.push(h);
		int now;
		int co = 1;
		int mi=INF;
		used[h] = 0;
		debug(r[a][h]);
		for (;;) {
			now = towns.front();
			towns.pop();
			co--;
			if (r[a][now] <= m)
				mi = min(mi, used[now] + r[a][now]);
			REP(i,n)
				if (c[i] == 1 && r[i][now] <= m && used[i] > used[now] + r[i][now]) {
					used[i] = used[now] + r[i][now];
					towns.push(i);
					co++;
				}
			if (co == 0)
				break;
		}
		debug(mi);
		if (mi == INF)
			cout << "Help!" << endl;
		else if (mi > m)
			cout << mi + (mi - m) << endl;
		else
			cout << mi << endl;
			



			









	}

	return 0;
}

Measured memory_bytes: 1264
a = list(input())
for i in range(8):
    b = []
    for j in range(4):
        b.append(a[j])
        if j == 3:
            pass
        else:
            if((i>>j)&1):
                b.append('+')
            else:
                b.append('-')
    c = ''.join(b)
    if eval(c) == 7:
        break
    else:
        pass
print(c+'=7')

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

int main(){
    int x,y,i=2;
    scanf("%d%d",&x,&y);
    if(x%y==0){
        printf("-1");
    }
    else{
        while( (x*i)%y ==0 ){
            if( (x*i++)%y ==0 ){
                continue;
            }
        }
        printf("%d",x*i);
    }


}


Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;

int main()
{
  double a, b, x;
  cin >> a >> b >> x;
  double v = a * a * b;
  
  double t = ((x * 2 > v) ? atan((v - x) * 2 / (a * a * a)) : atan(a * b * b / (x * 2))) * 180 / M_PI;
  
  cout << setprecision(10) << t << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main(){
	int n, ans = 0;
	cin >> n;
    vector<int> a(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        if(a[a[i]] == i) ans++;
    }
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
    int a[10];
    int n;

    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        bool ans = false;
        for (int i = 0; i < 10; i++){
            scanf("%d", a + i);
        }
        for (int i = 0; i < (1 << 10); i++){
            int stack[2];
            int j;
            stack[0] = stack[1] = 0;
            for (j = 0; j < 10; j++){
                int k = ((i >> j) & 1);
                if (stack[k] < a[j]){
                    stack[k] = a[j];
                }
                else {
                    break;
                }
            }
            if (j == 10){
                ans = true;
                break;
            }
        }
        puts(ans ? "YES" : "NO");
    }

    return (0);
}

Measured memory_bytes: 1008
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <inttypes.h>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

[[maybe_unused]] constexpr ll LL_MAX = numeric_limits<ll>::max();
[[maybe_unused]] constexpr ll LL_MIN = numeric_limits<ll>::min();
[[maybe_unused]] constexpr ull ULL_MAX = numeric_limits<ull>::max();

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

template<typename T>
void chmin(T& x, T y) {
    x = min(x, y);
}

template<typename T>
void chmax(T& x, T y) {
    x = max(x, y);
}

ll csum(ll x, ll y) {
    if (x > 0 && y > 0 && x > LL_MAX - y) {
        return LL_MAX;
    }
    if (x < 0 && y < 0 && x < LL_MIN - y) {
        return LL_MIN;
    }
    return x + y;
}

ll readl() {
    ll ret;
    scanf("%" PRId64 "", &ret);
    return ret;
}

vector<ll> readvl(ll n) {
    vector<ll> ret(n);
    rep(i, 0, n) { ret[i] = readl(); }
    return ret;
}

void writel(ll x) {
    printf("%" PRId64 "\n", x);
}

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

int main() {
	ll H = readl();
	ll W = readl();
	ll K = readl();
	auto goods = make_vec_nd(0, W, H+1);
	rep(i,0,K) {
		ll y = readl(), x = readl();
		x--;
		y--;
		goods[x][y] = readl();
	}
	auto dp = make_vec_nd(LL_MIN, W, H+1, 4);
	dp[0][0][0] = 0;
	rep(x,0,W) rep(y,0,H+1) rep(c,0,4) {
		if (c == 0 && y > 0) {
			chmax(dp[x][y][0], dp[x][y-1][0] + goods[x][y-1]);
			chmax(dp[x][y][0], dp[x][y-1][1] + goods[x][y-1]);
			chmax(dp[x][y][0], dp[x][y-1][2] + goods[x][y-1]);
			chmax(dp[x][y][0], dp[x][y-1][3]);
		}
		if (x > 0) {
			chmax(dp[x][y][c], dp[x-1][y][c]);
			if (c > 0) {
				chmax(dp[x][y][c], dp[x-1][y][c-1] + goods[x-1][y]);
			}
		}
	}
	writel(dp[W-1][H][0]);
}



Measured memory_bytes: 671436
#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	
	int x,y;
	scanf("%d%d",&x,&y);
	
	cout<<(n-x)*(m-y)<<endl;
	
	return 0;
} 

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

int main() {
    double a, b, c, C, S, L, h;
    cout << fixed << setprecision(12);
    cin >> a >> b >> C;
    C = C / 180 * M_PI;
    S = a * b * sin(C) / 2;
    c = sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(C));
    L = a + b + c;
    h = b * sin(C);
    cout << S << endl << L << endl << h << endl;
    
    return 0;
}


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

int main(void){
    int a, b, c, d;
  cin >> a >> b >> c >> d;
  if((abs(a-b) <= d && abs(b-c) <= d) || abs(a-c) <= d) cout << "Yes" << endl;
  else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3596
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BC
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  [a, b, c] <- map readInt . BC.words <$> BC.getLine
  k <- readInt <$> BC.getLine
  print $ solve a b c k

solve :: Int -> Int -> Int -> Int -> Int
solve a b c k = maximum [a, b, c] * (2^k - 1) + sum [a, b, c]

readInt :: BC.ByteString -> Int
readInt = fst . fromJust . BC.readInt


Measured memory_bytes: 380
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}

void solve();
main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


void solve(){
    ll n, m;
    cin >> n >> m;
    ll v[n][m]; mem(v, 0);
    char a[n][m];
    rep(i, n) rep(j, m) cin >> a[i][j];
    rep(i, n)
    {
        ll f = 0;
        rep(j, m)
        {
            if(a[i][j] == '#') f = 1;
        }
        if(!f) rep(j, m) v[i][j] = 1;
    }
    rep(j, m)
    {
        ll f = 0;
        rep(i, n) if(a[i][j] == '#') f = 1;
        if(!f) rep(i, n) v[i][j] = 1;
    }
    rep(i, n)
    {
        ll f = 0;
        rep(j, m) if(!v[i][j]) cout << a[i][j], f = 1;
        if(f)cout << endl;
    }
}


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

template<typename ... Ts> void read(Ts& ...vs){(std::cin >> ... >> vs);}

int main()
{
   constexpr double pi =  3.141592653589793238462643383279502884;

    std::int32_t A, B, H, M;
    read(A, B, H, M);

    const std::int32_t theta_2H = (60 * H) + M;
    const std::int32_t theta_2M = (12 * M);

    std::int32_t d2theta = theta_2H - theta_2M;
    if(360 < d2theta)
    {
        d2theta -= 720;
    }
    else if(d2theta < -360)
    {
        d2theta += 720;
    }

    const auto theta = d2theta * pi / 360.0;

    const double a = A;
    const double b = B;
     if(B <= A)
    {
        std::cout << std::setprecision(20)
            << std::sqrt(a * a + b * (b - 2.0 * a * std::cos(theta))) << std::endl;
    }
    else
    {
        std::cout << std::setprecision(20)
            << std::sqrt(b * b + a * (a - 2.0 * b * std::cos(theta))) << std::endl;
    }

    return 0;
}


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

int main() {
    int x[3000], y[3000], i;
    for (i = 0; i < 3000; i++) {
        cin >> x[i] >> y[i];
        if (x[i] == 0 && y[i] == 0) break;
    }
    for (int j = 0; j < i; j++) {
        if (x[j] < y[j]) {
            cout << x[j] << " " << y[j] << endl;
        } else {
            cout << y[j] << " " << x[j] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1180
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define fi first
#define se second
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; }

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

  int n; cin >> n;
  int a[n][3]; rep(i, n) cin >> a[i][0] >> a[i][1] >> a[i][2];

  int dp[100010][3] = {0};
  rep(i, 3) dp[0][i] = 0;

  for (int i = 0; i < n; ++i){
    for (int j = 0; j < 3; ++j){
      for (int k = 0; k < 3; ++k){
        if (j == k) continue;
        chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
      }
    }
  }
  print(max({dp[n][0], dp[n][1], dp[n][2]}));

  return 0;
}

Measured memory_bytes: 2560
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPL(i,f,n) for(int i=f, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
typedef vector<long long> vll;

// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	return a/ gcd(a,b)*b;
}
int hin[100010];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N,A[100010];
	scanf("%d", &N);
	REP(i, N) {
		cin >> A[i];
		hin[A[i]]++;
	}
	int ans = 0;
	REPL(i,1, 100010-1) {
		ans = max(ans, hin[i - 1] + hin[i] + hin[i + 1]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024