akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define multitest 0
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pqgreater(x) x, vector<x>, greater<x>
const ll mod=998244353;
int solve();
int main(){ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t=1;
	if(multitest) cin>>t;
	while(t--) solve();
	return 0;
}
ld pi=acos(-1.0);
int solve(){
	int a, b, h, m;
	cin>>a>>b>>h>>m;
	ld angleh=0.5*((ld)h*60.0+(ld)m);
	ld anglem=6*(ld)m;
	ld diff=fabs(angleh-anglem);
	ld ans=(ld)sqrt((ld)pow((ld)a, 2)+(ld)pow((ld)b, 2)-2.0*(ld)a*(ld)b*cos(pi*diff/180.0));
	cout<<fixed<<setprecision(10)<<ans<<endl;
	return 0;
}

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



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

#define all(x) (x).begin(),(x).end()

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  if(n%2==0){
    n/=2;
    ll res=0;
    while(n>0){
      res+=n/5;
      n/=5;
    }
    cout<<res<<endl;
  }
  else {
    ll res=0;
    cout<<res<<endl;


  }
  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  if (a > 2 * b) {
    cout << a - 2 * b << endl;
  } else {
    cout << 0 << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<utility>
#include<iomanip>
using namespace std;
int read(){
    int xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
long long READ(){
    long long xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
char one(){
	char ch=getchar();
	while(ch==' '||ch=='\n')
		ch=getchar();
	return ch;
}
const int maxn=5010,maxm=210;
int N,M,L[maxn][maxn],R[maxn][maxn],stack[maxn],tp;
long long a[maxn],b[maxm][maxn],sum[maxn][maxn];
int main(){
	//freopen("in","r",stdin);
	N=read(),M=read();
	for(int i=1;i<N;i++)
		a[i]=a[i-1]+read();
	for(int i=1;i<=N;i++)
		for(int j=1;j<=M;j++)
			b[j][i]=read();
	for(int i=1;i<=M;i++){
		tp=0;
		for(int j=1;j<=N;j++){
			while(tp&&b[i][stack[tp]]<b[i][j])
				tp--;
			if(tp)
				L[i][j]=stack[tp]+1;
			else
				L[i][j]=1;
			stack[++tp]=j;
		}
		tp=0;
		for(int j=N;j>=1;j--){
			while(tp&&b[i][stack[tp]]<b[i][j])
				tp--;
			if(tp)
				R[i][j]=stack[tp]-1;
			else
				R[i][j]=N;
			stack[++tp]=j;
		}
		for(int j=1;j<=N;j++){
			//(L[i][j],j) (j,R[i][j])
			sum[L[i][j]][j]+=b[i][j];
			sum[j+1][R[i][j]+1]+=b[i][j];
			sum[L[i][j]][R[i][j]+1]-=b[i][j];
			sum[j+1][j]-=b[i][j];
		}
	}
	long long ans=-(1LL<<60);
	for(int i=1;i<=N;i++)
		for(int j=1;j<=N;j++){
			sum[i][j]+=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
			if(i<=j)
				ans=max(ans,sum[i][j]-(a[j-1]-a[i-1]));
		}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 216064
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
using namespace std;

int getint(){
    int n;
    scanf("%d",&n);
    return n;
}


string getstr(){
    string s;
    cin>>s;
    return s;
}

int main(void){
    int N=getint();
    string S=getstr();
    string Sd=S;
    int buf=0;
    for(int i=S.size()-1;i>=0;i--){
        if(S[i]==')')buf++;
        if(S[i]=='(')buf--;
        if(buf<0){Sd+=")";buf=0;}
    }
    while(buf-->0)Sd="("+Sd;
    cout<<Sd<<endl;
}

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

using namespace std;

int main(){
    lli n,sum=0,r=0,g=0,b=0;
    string s;
    lli i,j,k;
    cin>>n>>s;
    rep(i,0,n){
        switch(s[i]){
            case 'R':r++;break;
            case 'G':g++;break;
            case 'B':b++;break;
        }
    }
    rep(i,0,(n-3)/2+1){
        rep(j,0,n-2*(i+1)){
            string t=("AAA");
            t[0]=s[j];
            t[1]=s[j+i+1];
            t[2]=s[j+2*(i+1)];
//            cout<<j<<" "<<j+i+1<<" "<<j+2*(i+1)<<endl;
            if((t=="RGB")||(t=="RBG")||(t=="GRB")||(t=="GBR")||(t=="BRG")||(t=="BGR")){
                sum++;
            }
        }
//        cout<<endl;
    }
    cout<<r*g*b-sum<<endl;
}


Measured memory_bytes: 3636
N = int(input())
a = list(map(int, input().split()))
MAX_a = 10**5 + 1
l = [0] * (MAX_a)

for i in range(N):
    l[a[i]] += 1

tmp = l[0] + l[1] + l[2]
ans = tmp
for i in range(3, MAX_a):
    tmp = tmp + l[i] - l[i-3]
    ans = max(tmp , ans)

print(ans)


Measured memory_bytes: 14092
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (h, w) = listOfInt()
    val line = "#".repeat(w+2)

    println(line)

    repeat(h){
        println("#" + next() + "#")
    }

    println(line)
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 37832
#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
ll bpow(ll,ll,ll);
typedef vector<int> vec;
typedef vector<vec> mat;
mat mul(mat &A,mat &B);
mat pow(mat A,ll n);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
const int MOD = 1000000007;

bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  int N,K,mi=9999999,no=1;
  cin >> N >> K;
  for(int i=0;i<N;i++){
    if(K >= no){
      no *= 2;
    }else
      no += K;
  }
  cout << no << endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}

ll bpow(ll a, ll n,ll mod){
  int i = 0;
  ll res=1;
  while(n){
    if(n & 1)
      res = (res*a) % mod;
    a = (a*a) % mod;
    n >>= 1;
  }
  return res;
}
mat mul(mat &A, mat &B){
  mat C(A.size(),vec(B[0].size()));
    REP(i,A.size())REP(k,B.size())REP(j,B[0].size()){
    C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
  }
  return C;
}

mat pow(mat A,ll n)
{
  mat B(A.size(),vec(A.size()));
  REP(i,A.size()){
    B[i][i] = 1;
  }
  while(n > 0){
    if ( n & 1) B = mul(B,A);
    A = mul(A,A);
    n >>= 1;
  }
  return B;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
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;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    //clock_t st,en;
    vector<ll> num(N);
    rep(i,N)cin >> num[i];
    //st = clock();
    sort(all(num));
    vector<ll> ok(1000005);
    rep(i,N){
        if(ok[num[i]] >= 1){
            ok[num[i]]++;
            continue;
        }
        for(ll j = num[i];j <= 1000000;j += num[i]){
            ok[j]++;
        }
    }
    ll ans = 0;
    rep(i,N){
        if(ok[num[i]] == 1)ans++;
    }
    //en = clock();
    cout << ans << endl;
    //printf("time:%.10lf\n",(dou)(en - st) / CLOCKS_PER_SEC);
}

Measured memory_bytes: 12688
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  int N,M;
  cin >> N >> M;
  vector<int> list(N);
  double sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> list[i];
    sum += list[i];
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (list[i] >= sum / (4 * M)) {
      ans ++;
    }
  }
  if (ans >= M) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}
  /*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
  //配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	long long n, w, a, b; cin >> n >> w >> a >> b;
	for (int h = 0; h < n; h++) {
		for (int i = 0; i < w; i++) {
			if ((h < b && i < a) || (h >= b&&i >= a)) {
				cout << 0;
			}
			else {
				cout << 1;
			}
		}
		cout << endl;
	}
	cin >> n;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
using namespace std;
string s;
int n;

int min(int x,int y){
	if (x<y) return x;
	else return y;
}

int ans0(string s0){
	int ans=0;
	if (s0[0]!='0'){
		s0[0]='0';
		ans++;
	}
	for (int i=1;i<n;i++){
		if (s0[i]==s0[i-1]){
			if (s0[i-1]=='0'){
				s0[i]='1';ans++;
			}else{
				s0[i]='0';ans++;
			}
		}
	}
	return ans;
}
int ans1(string s0){
	int ans=0;
	if (s0[0]!='1'){
		s0[0]='1';
		ans++;
	}
	for (int i=1;i<n;i++){
		if (s0[i]==s0[i-1]){
			if (s0[i-1]=='0'){
				s0[i]='1';ans++;
			}else{
				s0[i]='0';ans++;
			}
		}
	}
	return ans;
}

int main(){
	cin>>s;
	n=s.size();
	int ans=min(ans0(s),ans1(s));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

string s;

int main()
{
    cin >> s;
    int c1=0, c2=0, c3=0;
    rep(i, 3){
        if(s[i] == 'a') c1++;
        else if(s[i] == 'b') c2++;
        else if(s[i] == 'c') c3++;
    }
    if(c1 * c2 * c3 == 1) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<int,ll> Pil;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<Pil,ll> P2;
const ll INF=1000000000000000001;
const int inf=1000000000;
//struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main(){

	int a[4],b[4];
	int total=0;
	int c=0,d=0,e=0,f=0;
	int t1=0,t2=0;

	rep(i,3){
		cin>>a[i]>>b[i];
		if(a[i]==1||b[i]==1)c++;
		if(a[i]==2||b[i]==2)d++;
		if(a[i]==3||b[i]==3)e++;
		if(a[i]==4||b[i]==4)f++;
	}
	if(c==2)t2++;
	if(d==2)t2++;
	if(e==2)t2++;
	if(f==2)t2++;
	if(c==2)t1++;
	if(d==2)t1++;
	if(e==2)t1++;
	if(f==2)t1++;
	if(t1==2&&t2==2)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

struct Edge{
    ll to;
    ll cost;
    Edge(ll to, ll cost): to(to), cost(cost) {}
};

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

    // input
    ll N;
    cin >> N;

    vector<vector<Edge> > G(N);
    vector<ll> d(N, -1); // distance

    FOR(i, 0, N-1){
        ll u, v, w;
        cin >> u >> v >> w;
        u--;
        v--;

        G[u].push_back(Edge(v, w));
        G[v].push_back(Edge(u, w));
    }

    // bfs from zero
    queue<ll> que;
    que.push(0);
    d[0] = 0;

    while(!que.empty()){
        ll id = que.front();
        que.pop();

        for(auto edge : G[id]){
            if(d[edge.to]==-1){
                d[edge.to] = d[id] + edge.cost;
                que.push(edge.to);
            }
        }
    }

    FOR(i, 0, N){
        if(d[i]%2==0){
            p(0);
        }else{
            p(1);
        }
    }
    
    return 0;
}

Measured memory_bytes: 8704
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
using ll = long long;
using P = pair<int, int>;

constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());


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

  int n; cin >> n;
  vector<P> a(2*n);
  rep(i, n) {
    int now; cin >> now;
    a[i] = P(now, 0);
  }
  rep(i, n) {
    int now; cin >> now;
    a[n+i] = P(now, 1);
  }
  sort(a.begin(), a.end());

  int s0 = 0;
  int s1 = 0;
  ll ans = 1;
  rep(i, 2*n) {
    P p = a[i];
    if (p.second == 0) {
      if (s1 == 0) {
        s0++;        
      } else {
        ans *= s1;
        ans %= mod;
        s1--;
      }
    } else {
      if (s0 == 0) {
        s1++;
      } else {
        ans *= s0;
        ans %= mod;
        s0--;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int a[10005],b[10005];
ll sum1,sum2;
ll delta,qwq;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i],sum1+=a[i];
    for(int i=1;i<=n;i++) cin>>b[i],sum2+=b[i];
    if(sum1>sum2) {
        cout<<"No";return 0;
    }
    delta=sum2-sum1;
    for(int i=1;i<=n;i++)
    if(b[i]>a[i])
    qwq+=(b[i]+1-a[i])/2;
    if(qwq>delta) cout<<"No";
    else cout<<"Yes";
    return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
const int N=1e5+20;
int n,a[N];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);

	for(int i=n;i>1;i--)
	{
		if(a[i]>=a[i-1]) continue;
		a[i-1]--;
		if(a[i]<a[i-1]) return 0 * printf("No");
	}
	printf("Yes");
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T> T count_bit(T p){
  if(typeid(p)==typeid(int))return __builtin_popcount(p);
  else if(typeid(p)==typeid(long))return __builtin_popcountl(p);
  else return __builtin_popcountll(p);
}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  long N,D;
  in(N,D);
  out((N+2*D)/(2*D+1));
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#---------------------------------------------------------------------#
#Initialize

num = gets.to_i
ary_original = gets.split

#aryB: array for Bubble Sort
aryB = Marshal.load(Marshal.dump(ary_original))

#aryS: array for Selection Sort
aryS = Marshal.load(Marshal.dump(ary_original))

def stable? (ary, org)

  (ary.size - 1).times do |i|

    if ary[i][1] == ary[i+1][1]
      if org.index(ary[i]) > org.index(ary[i+1])
        return "Not stable"
      end
    end

  end

  return "Stable"

end

#---------------------------------------------------------------------#
#Bubble Sort

index_last = num - 2

while index_last >= 0

  for i in 0 .. index_last

    if aryB[i][1] > aryB[i + 1][1]
      aryB[i], aryB[i + 1] = aryB[i + 1], aryB[i]
    end

  end

  index_last -= 1

end

#---------------------------------------------------------------------#
#Selection Sort

for i in 0 .. num-2

  min = aryS[i][1]
  min_index = i

  for j in i .. num-1

    if min > aryS[j][1]
      min = aryS[j][1]
      min_index = j
    end

  end

  if aryS[i][1] != aryS[min_index][1]
    aryS[i], aryS[min_index] = aryS[min_index], aryS[i]
  end

end

#---------------------------------------------------------------------#
#Output

#Bubble Sort
puts aryB.join(" ")
puts stable?(aryB, ary_original)

#Bubble Sort
puts aryS.join(" ")
puts stable?(aryS, ary_original)



Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
int main(){
	int sum=0;
	int ar[5];
	int cnt=0;
	int ma=0;
	for(int i=0;i<5;i++){
		cin>>ar[i];
		if(ar[i]%10==0){
			sum+=ar[i];
			ar[i]=0;
		}
		else{
			sum+=ar[i]+(10-ar[i]%10);
			cnt+=(10-ar[i]%10);
			ma=max(ma,(10-ar[i]%10));
		}
	}
	//cout<<sum<<" "<<cnt<<endl;
	cout<<sum+(cnt-ma)-cnt<<endl;
	
}

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

int main() {
  int n; cin >> n;
  vector<double> t(n + 1, 0), v(n + 2, 0);
  LL sum_time = 0;
  for (int i = 1; i <= n; i ++) {
    cin >> t[i];
    sum_time += t[i];
    t[i] = sum_time;
  }
  for (int i = 1; i <= n; i ++) cin >> v[i];

  vector<double> L(n + 2, 0), R(n + 2, 0);
  for (int i = 1; i <= n; i ++) {
    L[i] = R[i - 1];
    R[i] = t[i];
  }
  L[n + 1] = R[n], R[n + 1] = R[n];
  
  double ans = 0;
  double l = 0.0, r;
  for (double i = 0.5; i <= R[n]; i += 0.5) {
    r = 100;
    for (int j = 0; j <= n + 1; j ++) {
      if (0.0 <= i && i <= L[j]) r = min(r, v[j] + L[j] - i);
      else if (L[j] <= i && i <= R[j]) r = min(r, v[j]);
      else r = min(r, v[j] + i - R[j]);
    }
    ans += (l + r) * 0.25;
    l = r;
  }

  cout << setprecision(15) << ans << endl;
}

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

void Main() {
  int P, Q, R;
  cin >> P >> Q >> R;
  
  int ans = 500;
  ans = min(ans, P + Q);
  ans = min(ans, P + R);
  ans = min(ans, Q + R);
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;


const int inf = 1e9;
// Dreyfus-Wagner. O(4^k)
int steiner_tree(const vector<vector<PI> > &g, const VI &term) {
  int n = g.size();
  int k = term.size();
  vector<vector<int> > dist(n, vector<int>(n, inf));
  REP(i, 0, n) {
    REP(j, 0, g[i].size()) {
      PI wc = g[i][j];
      int w = wc.first, c = wc.second;
      dist[i][w] = min(dist[i][w], c);
    }
  }
  REP(i, 0, n) dist[i][i] = 0;
  REP(l, 0, n) {
    REP(i, 0, n) {
      REP(j, 0, n) {
        dist[i][j] = min(dist[i][j], dist[i][l] + dist[l][j]);
      }
    }
  }
  vector<vector<int> > dp(n, vector<int>(1 << k, inf));
  // base case: |bits| = 1
  REP(i, 0, k) {
    REP(j, 0, n) {
      dp[j][1 << i] = min(dp[j][1 << i], dist[term[i]][j]);
    }
  }
  REP(bits, 1, 1 << k) {
    // if popcount(bits) == 1 then skip
    if ((bits & -bits) == bits) continue;
    REP(i, 0, n) {
      REP(sub, 1, bits) {
        if ((sub & bits) != sub) continue;
        dp[i][bits] = min(dp[i][bits], dp[i][sub] + dp[i][bits - sub]);
      }
    }
    REP(i, 0, n) {
      REP(j, 0, n) {
        dp[i][bits] = min(dp[i][bits], dp[j][bits] + dist[i][j]);
      }
    }
  }
  int mi = inf;
  REP(i, 0, n) {
    mi = min(mi, dp[i][(1 << k) - 1]);
  }
  return mi;   
}

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w;
  while(cin >> h >> w && h && w) {
    vector<VI> s(h, VI(w));
    REP(i, 0, h) {
      REP(j, 0, w) {
        cin >> s[i][j];
      }
    }
    vector<vector<PI> > g(h * w);
    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};
    VI term;
    REP(i, 0, h) {
      REP(j, 0, w) {
        int v = i * w + j;
        if (s[i][j] == 1) term.push_back(v);
        REP(d, 0, 4) {
          int nx = i + dx[d];
          int ny = j + dy[d];
          if (nx < 0 || nx >= h || ny < 0 || ny >= h) continue;
          int u = nx * w + ny;
          g[v].push_back(PI(u, 1));
          g[u].push_back(PI(v, 1));
        }
      }
    }
    cout << h * w - 1 - steiner_tree(g, term) << endl;
  }
}



Measured memory_bytes: 3276
#include<stdio.h>
int main()
{
  int i,j,N,A[100],flag=1,n=0,x;

  scanf("%d",&N);
  for(i=0;i<N;i++)
    {
      scanf("%d",&A[i]);
    }
  
      while(flag)
	{
	  flag=0;
	  for(j=N-1;j>=1;j--)
	    {
	      if(A[j]<A[j-1])
		{
		  x=A[j];
		  A[j]=A[j-1];
		  A[j-1]=x;
		  flag=1;
		  n++;
		}
	    }
	
    }
  
  for(i=0;i<N-1;i++)
    {
      printf("%d ",A[i]);
    }
  printf("%d\n%d\n",A[N-1],n);

  return 0;
}
	  

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    int cnt=0;
    for (int i=1;i<=a;i++) 
	{
        getchar();
        for (int j=1;j<=b;j++)
	    {
            char ch=getchar();
            if (ch=='#') 
			     cnt++;
        }
    }
    puts ((cnt==a+b-1)?"Possible":"Impossible");
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        //まずは入力
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int r = sc.nextInt();
        int s = sc.nextInt();
        int p = sc.nextInt();
        sc.useDelimiter("");
        sc.next();
        String[] cpu = new String[n];
        String[] player = new String[n];
        for(int i=0;i<n;i++){
            cpu[i]=sc.next();
        }

        //cpuに勝つ手を入れていく
        for(int i=0;i<n;i++){
            if(i-k>=0){
              if(player[i-k].equals(victry(cpu[i]))){
              player[i]="";
              continue;
              }
            }
            player[i]=victry(cpu[i]);
        }
        
        //合計点の計算
        int total = 0;
        for(int i=0;i<n;i++){
            if(player[i].equals("r"))total+=r;
            if(player[i].equals("s"))total+=s;
            if(player[i].equals("p"))total+=p;
        }
        System.out.println(total);
    }
    
    public static String victry(String s){
        if(s.equals("r")){ return "p";}
        else if(s.equals("s")){return "r";}
        else if(s.equals("p")){return "s";}
        return "";
    }
}


Measured memory_bytes: 53924
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ld long double
#define mp make_pair

void print(vector<auto> &a)
{
    for (int i = 0; i<a.size(); i++) cout<<a[i]<<' ';
    cout<<endl;
}

const ll p = 1e9 + 7;

int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    s = s%p;
    if (s<0) s+=p; 
    return s;
}

const ll INF = 100000000000000000;

int n, m;
struct st
{
    int s;
    int f;
    ll cost;
};




int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    int n;
    cin>>n;
    vector<ll> a(n);
    vector<ll> b(n);
    for (int i = 0; i<n; i++) cin>>a[i]>>b[i];
    
    vector<pair<ll, int>> kek;
    for (int i = 0; i<n; i++) kek.push_back(mp(a[i]+b[i], i));
    sort(kek.begin(), kek.end());
    
    ll sum1 = 0;
    ll sum2 = 0;
    for (int i = n-1; i>=0; i-=2) sum1+=a[kek[i].second];
    for (int i = n-2; i>=0; i-=2) sum2+=b[kek[i].second];
    
    cout<<sum1-sum2;
    
}

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define int long long
#define inf (int)1e18+7

int n;
int a[110];

int dp[2][100005];

bool solve(int who, int rem) {
  if (rem < a[0]) {
    return false;
  }
  if (dp[who][rem] != -1) return dp[who][rem];
  bool isWin = false;
  for (int i = 0; i < n; i ++) {
    if (rem < a[i]) break;
    bool res = solve(who ^ 1, rem - a[i]);
    isWin |= !res;
  }
  return dp[who][rem] = isWin;
}

signed main() {

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

  memset(dp, -1, sizeof dp);
  bool isWin = solve(0, k);

  string res[2] = {"Second", "First"};
  cout << res[isWin] << endl;

  return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define PRINT(v) for (auto x : (V)) cout <<x <<" " <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


ll calc(int d, int n){
  // 0,1,2,...,n の n+1 個の整数の中からd個選ぶとき、その和としてあり得るものの個数
  // 但し d は n+1 の中央値的なアレ以下であることが保証されている
  if (d == 1) return n+1;
  // 最小値と最大値から考えれば良いんじゃない？(適当)
  // d = 1 ならmin: 0, max: n で n+1個
  // d = 2 ならmin: 1, max: n+n-1 で2n-1個
  // d = r ならmin: 0+1+...+(r-1), max: n+(n-1)+...(n-r+1)
  //   min = r(r-1)/2, max = (n-r+1)*r + r(r-1)/2
  //   sub = (n-r+1)*r + 1
  ll res = ((ll)n - (ll)d + 1) * d + 1;
  return res;
}

int main() {
  int N,K; cin >>N >>K;
  /*
  0, 1, 2, ..., N の N+1 個の整数の中からK個以上選ぶとき、その和としてあり得るものの個数をmod MOD で求めよ。
  但し、選ぶ個数が異なるものは異なる和としてみなす。
  */
  
  ll res = 0;
  for (int i=K; i<=N+1; i++){
    // 5個の中から3個選ぶとして、それは全ての和から2個の和を除いたものに等しいから
    // i個選ぶのはN+1-i個選ぶことと同じである
    int d = min(i, N+1-i); // なんとなく
    res = (res + calc(d, N) ) % MOD;
  }
  cout <<res <<endl;
}


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

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

    int n, m;
    cin >> n >> m;
    vector<int> dp(1 << n, 1e9);
    dp[0] = 0;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        int mask = 0;
        for (int j = 0; j < b; j++) {
            int k;
            cin >> k;
            k--;
            mask |= 1 << k;
        }
        for (int j = 0; j < 1 << n; j++) {
            dp[j | mask] = min(dp[j | mask], dp[j] + a);
        }
    }
    if (dp[(1 << n) - 1] == 1e9) {
        cout << -1 << endl;
        return 0;
    }
    cout << dp[(1 << n) - 1] << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
	int N;
	char S[104];
	bool k=0;
	cin >> N;
	REP(i,N){
	    cin >> S[i];
	    if(S[i]=='Y'){k=1;}
	}
	if(k==1){cout << "Four" << endl;}else{cout << "Three" << endl;}
	return 0;
}


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

int main(){
   int n;
   cin >> n;
   double a, b;
   int i;
   for(i = 1; i <= n; i++){
       b += 1.0;
       if(i % 2 == 1){
           a += 1.0;
       }
   }
   cout << a/b << endl;
   return 0;
}


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


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

typedef long long int ll;
typedef long long unsigned int ull;
typedef long double ld;
typedef vector<int> vr;
typedef pair<int, int> pr;
#define pb push_back
#define ff first
#define ss second
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433
#define endl "\n"
//cout << fixed << setprecision(2);


int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    int c0 = 0, c1 = 0, c2 = 0, c3 = 0;
    for(int i = 1; i <= n; i++){
        string s;
        cin >> s;
        if(s == "AC"){
            c0++;
        }
        else if(s == "WA"){
            c1++;
        }
        else if(s == "TLE"){
            c2++;
        }
        else if(s == "RE"){
            c3++;
        }
    }
    cout << "AC x " << c0 << endl;
    cout << "WA x " << c1 << endl;
    cout << "TLE x " << c2 << endl;
    cout << "RE x " << c3 << endl;
    return 0;
}


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

using namespace std;

int main()
{
	int n,m,x,y;
	cin>>n>>m>>x>>y;
	int flag=0;
	int t;
	int X=x,Y=y;
	for(int i=0;i<n;i++){
		cin>>t;
		if(X<t){
			X=t;
		}
	}
	for(int i=0;i<m;i++){
		cin>>t;
		if(Y>t){
			Y=t;
		}
	}
	if(X<Y){
		cout<<"No War";
	}
	else{
		cout<<"War";
	}
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 998244353;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
const int biggg = 1000000000;
const long eps = .0000000001;


int main ()
{
  prep();
  int n, m;
  cin >> n >> m;
  long long sum = 0;
  for (int i=0; i<m; i++){
      int num;
      cin >> num;
      sum += num;
  }
  if (sum > n){
      cout << -1;
  }else{
      cout << n-sum;
  }
  return 0;
}


Measured memory_bytes: 3652
#pragma warning (disable:4996)
#include"bits/stdc++.h"
#include<cassert>
#define int long long
#define MRE assert(0);
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const long long mod = 998244353;
const long long inf = 1ll<<61;
typedef pair<int, int> P;
typedef pair<int, P > PP;
signed main() {
	string s; cin >> s;
	if (s == "AAA" || s == "BBB")cout << "No" << endl;
	else puts("Yes");
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            BufferedReader stdReader = new BufferedReader(new InputStreamReader(System.in));
            
            String line;
            
            while((line = stdReader.readLine()) != null) {
                String[] input = line.split(" ", 0);
                int midtermExam = Integer.parseInt(input[0]);
                int finalExam   = Integer.parseInt(input[1]);
                int additional  = Integer.parseInt(input[2]);
                
                // ????????¨???-1????????????
                if(midtermExam == -1 && finalExam == -1 && additional == -1) {
                    break;
                }
                
                // ???????????????????????????????????????????????´????????¶??????F
                if(midtermExam == -1 || finalExam == -1) {
                    System.out.println("F");
                    continue;
                }
                
                int addScore = midtermExam + finalExam;
                
                // ????¨??????°???30?????????F
                if(addScore < 30) {
                    System.out.println("F");
                    continue;
                }
                
                // ????¨??????°???30??\???50????????§D
                // ??????????????????50??\?????§C
                if(addScore >= 30 && addScore < 50) {
                    if(additional >= 50) {
                        System.out.println("C");
                    } else {
                        System.out.println("D");
                    }
                    continue;
                }
                
                // ????¨??????°???50??\???65????????§C
                if(addScore >= 50 && addScore < 65) {
                    System.out.println("C");
                    continue;
                }
                
                // ????¨??????°???65??\???80????????§B
                if(addScore >= 65 && addScore < 80) {
                    System.out.println("B");
                    continue;
                }
                
                // ????¨??????°???80??\?????§A
                if(addScore >= 80) {
                    System.out.println("A");
                    continue;
                }
            }
            stdReader.close();
        } catch(Exception e) {
            System.out.println(e);
            e.getStackTrace();
            System.exit(-1);
        }
    }
}

Measured memory_bytes: 24496
import sys
sys.setrecursionlimit(10**7)

def dfs(f):
    if vis[f] == 1: return
    vis[f] = 1
    for t in V[f]:
        dfs(t)
          
          
n, m = map(int, input().split())
E = [[*map(lambda x: int(x)-1, input().split())] for _ in range(m)]
V = [[] for _ in range(n)]
for a, b in E: V[a].append(b); V[b].append(a)
ans = 0
vis = [0]*n

for a in range(n):
    if vis[a]==1:
      continue
    ans+=1
    dfs(a)
print(ans-1)


Measured memory_bytes: 60284
#include <stdio.h>
#include <math.h>
#define ABS(x)		((x)<0 ? -(x):(x))

int main(){
    double a, b, h, m;
    scanf("%lf %lf %lf %lf", &a, &b, &h, &m);

    double hdeg, mdeg, diff, square;
    hdeg = ( 360.0 * h ) / 12.0 + ( 30.0 * m ) / 60.0;  //時針の角度
    mdeg = ( 360.0 * m ) / 60.0;                        //分針の角度
 
    diff = ABS( hdeg - mdeg );
    if     ( diff == 180.0 ){ printf("%lf", a+b); return 0; }
    else if( diff >  180.0 ){ diff = 360.0 - diff; }

    square = a*a + b*b - 2.0*a*b*cos( diff / 180.0 * M_PI );
    printf("%.20f\n", sqrt(square));

    return 0;
}

Measured memory_bytes: 2488
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;

typedef pair<int, int> P;
int di[] = {1, -1, 0, 0};
int dj[] = {0, 0, 1, -1};

const int INF = 1001001001;

int main() {
  int h, w;
  cin >> h >> w;
  vector <string> g(h);
  rep(i, h) cin >> g[i];

  int ans = 0;
  rep(si, h){
    rep(sj, w){
      if (g[si][sj] == '#') continue;
      vector<vi> dist(h, vi(w, INF));
      dist[si][sj] = 0;

      queue <P> q;
      q.push(P(si, sj));
      while (!q.empty()){
        P cor = q.front(); q.pop();
        rep(idx, 4){
          int dx = cor.second + dj[idx];
          int dy = cor.first + di[idx];
          if (dx < 0 or dx >= w or dy < 0 or dy >= h) continue;
          if (g[dy][dx] == '#') continue;
          if (dist[dy][dx] != INF) continue;
          dist[dy][dx] = dist[cor.first][cor.second] + 1;
          q.push(P(dy, dx));
        }
      }
      rep(i, h) rep(j, w){
        if (dist[i][j] != INF) ans = max(ans, dist[i][j]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main(){
    int N;
    cin>>N;
    vector<long> vec(N*3);

    for(auto &x:vec){
        cin>>x;
    }
    long ans=0;

    sort(vec.begin(),vec.end());    
/*
    for(int i=0;i<3*N;i++){
        cout<<vec[i]<<" ";
    }
*/
    for(int i=3*N-2;i>N-1;i-=2){
        ans+=vec[i];
    }

    cout<<ans<<endl;

}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque> 
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype> 
using namespace std;

int main(){
    string S;
    cin >> S;
    vector<int> a(S.size());
    for (int i=0; i<S.size(); i++) {
        a.at(i) = S.at(i);
    }
    for (int i=0; i<S.size(); i++) {
        for (int j=0; j<S.size(); j++) {
            if (a.at(i)==S.at(j) && i!=j) {
                cout << "no" << endl;
                return 0;
            }
        }
    }
    cout << "yes" << endl;
}

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

N, K = map(int, input().split())
S = '0' + input() + '0'

Sl = [0] + [i for i in range(N + 1) if S[i:(i + 2)] == "01"] + [N]
Sr = [0] + [i for i in range(N + 1) if S[i:(i + 2)] == "10"] + [N]

if len(Sl) - K >= 1:
    print(max([Sr[i + K] - Sl[i] for i in range(len(Sl) - K)]))
else:
    print(N)


Measured memory_bytes: 8792
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { x.modm(y.modpow(mod - 2)); }

void main()
{
	auto N = RD;
	auto M = RD;
	auto X = RD;
	auto C = new long[](N);
	auto A = new long[][](N);
	foreach (i; 0..N)
	{
		A[i] = RDA;
		C[i] = A[i][0];
		A[i].popFront;
		debug writeln(A[i]);
	}

	long ans = long.max;
	foreach (i; 0..2^^N)
	{
		auto arr = new long[](M);
		long cost;
		foreach (j; 0..N)
		{
			auto bit = 1L << j;
			if (i & bit)
			{
				arr[] += A[j][];
				cost += C[j];
			}
		}

		debug writeln(arr);
		bool ok = true;
		foreach (j; 0..M)
		{
			if (arr[j] < X)
				ok = false;
		}
		if (ok)
		{
			ans.chmin(cost);
		}
	}

	if (ans == long.max)
		writeln(-1);
	else
		writeln(ans);
	stdout.flush;
	debug readln;
}

Measured memory_bytes: 3076
/*
    Life Before Death, Strength Before Weakness, Journey Before Destination
    ------------------------------------------------------------------------
    You don't become great by trying to be great.
    You become great by wanting to do something,
    and then doing it so hard that you become great in the process.
    */
 
    //#pragma comment(linker, ack:200000000")
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include <bits/stdc++.h>
    using namespace std;
    
    #define TRACE
    
    #ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
      cerr << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
      const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
    #else
    #define trace(...)
    #endif
    
    #define rep(i, n)    for(ll i = 0; i < (n); ++i)
    #define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
    #define repD(i, a, n)  for(ll i = a; i >= (n); --i)
    #define trav(a, x) for(auto& a : x)
    #define all(x) x.begin(), x.end()
    #define sz(x) (int)(x).size()
    #define fill(a)  memset(a, 0, sizeof (a))
    #define fst first
    #define snd second
    //#define mp make_pair
    #define pb push_back
    #define PI           3.141592653589793238462643383279502884197169399  /* pi */
    #define te  ll ti;   cin >> ti;  while(ti--) solve();  
    typedef long double ld;
    typedef long long ll;
    typedef pair<ll, ll> pii;
    typedef vector<ll> vi;
    const int maxN = 200100;

    void solve(){
        ll n;
        cin >> n;
        ll a[n+10];
        rep(i, n) cin >> a[i];
        a[n] = 1e9+7;
        a[0]--;
        rep(i, n){
            if(a[i]==a[i+1]) continue;
            if((a[i] - a[i+1]) >= 1 ){
                cout << "No" << endl;
                return;
            }
            a[i+1]--;
        }
        cout << "Yes" << endl;
    }
 
    int main() {
      cin.sync_with_stdio(0); cin.tie(0);
      cin.exceptions(cin.failbit);
     /*
      #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
      #endif
     */
      //te
      solve();
      return 0;
    } 

Measured memory_bytes: 1024