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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N,K,Q;
    Scd3(N,K,Q);

    vector<int> pt(N,K-Q);

    int a;
    Rep(i,Q){
        Scd(a);
        pt[--a]++;
    }

    Rep(i,N){
        YesNo( pt[i] > 0 );
    }

    return 0;
}





Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    ll S;
    cin>>S;
    ll x1, x2, y1, y2;
    x1 = 1000000000;
    y2 = (S-1)/x1+1;

    S = x1*y2 - S;
    y1 = 1;
    x2 = S;

    cout<<"0 0 "<<x1<<" "<<y1<<" "<<x2<<" "<<y2;
    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
const int mod = (int)1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	lli a,b,c,d;
	cin >> a >> b >> c >> d;
	lli ans = max(a*c, max(a*d, max(b*c,b*d)));
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
    int N;
    int A[1000];

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

    for(int i = 0; i < N; i++) {
        int v = A[i];
        int j = i - 1;
        while(j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            A[j] = v;
            j--;
            // A[j+1] = v;
        }

        //表示
        for(int l = 0; l < N; l++) {
            cout << A[l];
            if(l != N-1) cout << ' ';
        }
        cout << endl;
    }

    return 0;
}


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


int main()
{
	int N;
	cin>>N;
	vector<int> D(N);
	rep(i,N)
	{
		cin>>D[i];
	}
	sort(D.begin(),D.end(),greater<int>());
	int ans=0;
	int now=101;
	for(int d : D)
	{
		if(now>d)
		{
			now=d;
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define REP(i, n) for(int i=0;i<(n);++i)
typedef long long ll;

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

	int n; cin >> n;
	vector<ll> a(300000);
	REP(i, 3*n) cin >> a[i];

	priority_queue<ll, vector<ll>, greater<ll>> left;
	priority_queue<ll> right;

	ll lsum = 0; vector<ll> lmax(n+2);
	REP(i, n) lsum += a[i];
	lmax[0] = lsum;
	REP(i, 2*n){
		left.push(a[i]);
		if(i >= n){
			ll tmp = left.top(); left.pop();
			lsum += a[i]; lsum -= tmp;
			lmax[i+1-n] = lsum;
		}
	}

	ll rsum = 0; vector<ll> rmin(n+2);
	for(int i = 3*n-1; i >= 2*n; i--) rsum += a[i];
	rmin[n] = rsum;
	for(int i = 3*n-1; i >= n; i--){
		right.push(a[i]);
		if(i < 2*n){
			ll tmp = right.top(); right.pop();
			rsum += a[i]; rsum -= tmp;
			rmin[i-n] = rsum;
		}
	}

	ll MAX = -1145141919810931;
	REP(i, n+1){
		MAX = max(MAX, lmax[i]-rmin[i]);
	}
	cout << MAX << endl;

	return 0;
}


Measured memory_bytes: 6516
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)


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

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
int mp[500][500];
bool used[500][500];
int main()
{
  int H, W;
  cin >> H >> W;
  vector<pair<int, int>> vb;
  REP(i, H) {
    REP(j, W) {
      char c; cin >> c;
      if (c == '#') {
        vb.PB(MP(i, j));
        mp[i][j] = 1;
      } else mp[i][j] = 0;
    }
  }

  ll ans = 0;
  for (auto pos : vb) {
    if (used[pos.FI][pos.SE]) continue;
    queue<pair<int, int>> q;
    ll col[2] = { };
    q.push(MP(pos.FI, pos.SE));
    col[1]++;
    used[pos.FI][pos.SE] = true;
    while (! q.empty()) {
      pair<int, int> tmp = q.front(); q.pop();
      int y = tmp.FI;
      int x = tmp.SE;
      REP(i, 4) {
        int ny = y + dy[i];
        int nx = x + dx[i];
        if (ny < 0 || H <= ny || nx < 0 || W <= nx) continue;
        if (used[ny][nx]) continue;
        if (mp[ny][nx] ^ mp[y][x] == 0) continue;
        col[mp[ny][nx]]++;
        used[ny][nx] = true;
        q.push(MP(ny, nx));
      }
    }
    ans += col[0] * col[1];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3188
import java.io.*;
import java.util.*;

public class Main
{
    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok;
    long INF = 10000000000000000L;

    public void go() throws IOException
    {
        ntok();
        int n = ipar();
        ntok();
        long[] arr = lapar(n);
        long[][] dp = new long[n+5][2 + n%2];
        for (int i = n-1; i >= 0; i--) {
            for (int e = 0; e < 2+n%2; e++) {
                if (i + e >= n) {
                    dp[i][e] = dp[i+1][e-1];
                } else {
                    dp[i][e] = dp[i+2][e] + arr[i];
                    if (e > 0) {
                        dp[i][e] = Math.max(dp[i][e], dp[i+1][e-1]);
                    }
                }
            }
        }
        out.println(dp[0][1 + n%2]);

        out.flush();
        in.close();
    }

    public void ntok() throws IOException
    {
        tok = new StringTokenizer(in.readLine());
    }

    public int ipar()
    {
        return Integer.parseInt(tok.nextToken());
    }

    public int[] iapar(int n)
    {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++)
        {
            arr[i] = ipar();
        }
        return arr;
    }

    public long lpar()
    {
        return Long.parseLong(tok.nextToken());
    }

    public long[] lapar(int n)
    {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++)
        {
            arr[i] = lpar();
        }
        return arr;
    }

    public double dpar()
    {
        return Double.parseDouble(tok.nextToken());
    }

    public String spar()
    {
        return tok.nextToken();
    }

    public static void main(String[] args) throws IOException
    {
        new Main().go();
    }
}


Measured memory_bytes: 56744
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
char mp[55][55];
int a[8][2]={{1,0},{0,1},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};
int main()
{
    int h,w;
    scanf("%d%d",&h,&w);
    for(int i=0;i<h;i++)
    	scanf("%s",mp[i]);
    for(int i=0;i<h;i++)
    {
    	for(int j=0;j<w;j++)
    	{
    		int flag=0;
    		if(mp[i][j]=='#')
    		{
    			printf("#");
    			continue;
			}	
    		for(int k=0;k<8;k++)
    		{
    			int x=i+a[k][0];
    			int y=j+a[k][1];
    			if(x<0||y<0||x>=h||y>=w)
            		continue;
            	if(mp[x][y]=='.')
            		continue;
            	if(mp[x][y]=='#')
            		flag++; 
			}
			printf("%d",flag);
		}
		printf("\n");
	}
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin >> a >> b;
    if(a > 12){
        cout << b << endl;
    }else if(a >= 6){
        cout << b / 2 << endl;
    }else{
        cout << 0 << endl;
        
    }
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	float xa1,ya1,xa2,ya2,xb1,yb1,xb2,yb2;
	while (~scanf("%f%f%f%f%f%f%f%f",&xa1,&ya1,&xa2,&ya2,&xb1,&yb1,&xb2,&yb2)) {
		puts(xa1>xb2||xa2<xb1||ya1>yb2||ya2<yb1?"NO":"YES");
	}
	return 0;
}

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

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

int main(){

	int n, total = 0;
	scanf("%d", &n);
	
	vector<int> v(n);
	rep(i,n){
		scanf("%d ", &v[i]);
		total += v[i];
	}

	int s, min = 1e5;
	
	rep(t,n){
		s = 0;
		rep(i,t){
			s += v[i]; 
		}
		if ( abs(total - 2*s) <= min ) min = abs(total - 2*s);

	}
	
	printf("%d\n", min);
	return 0;
}

Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h,w,K;
    cin >> h >> w >> K;
    vector<vector<int>> c(h, vector<int>(w));
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            char x;
            cin >> x;
            if(x == '.'){
                c.at(i).at(j) = 0;
            }
            else{
                c.at(i).at(j) = 1;
            }
        }
    }
    int ans=0;
    for(int i=0; i<(1<<h); i++){
        for(int j=0; j<(1<<w); j++){
            vector<int> yoko(h,1);
            vector<int> tate(w,1);
            for(int k=0; k<h; k++){
                if(i & (1<<k)){
                    yoko.at(k) = 0;
                }
            }
            for(int k=0; k<w; k++){
                if(j & (1<<k)){
                    tate.at(k) = 0;
                }
            }
            int count=0;
            for(int k=0; k<h; k++){
                for(int l=0; l<w; l++){
                    count+=c.at(k).at(l) * yoko.at(k) * tate.at(l);
                }
            }
            if(count == K) ans++;
        }
    }
    cout << ans << endl;  
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
constexpr int mo2 = 998244353;
constexpr ll infl = 1ll<<60;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin>>n;
    for(int i=1;i<=50000;++i){
        if((int)(i*1.08) == n){cout << i << endl;return 0;}
    }
    cout << ":(" << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll i,j,k,x,y,m,n,t;
	cin>>n>>x>>y;
	ll a,b;
	a=min(x,y);
	b=max(x,y);
	map<ll,ll> mp;
	for(i=1;i<=n;i++)
	{
		for(j=i+1;j<=n;j++)
		{
//			if(i<=x and j>=y)
			{
				mp[min(j-i,abs(j-y)+abs(x-i)+1)]++;
			}
		}
	}
	for(i=1;i<n;i++)
	cout<<mp[i]<<endl;
}

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


int main(){
  int N, K, i, s = 1;

  cin >> N >> K;
  
  for(i = 0; i < N; i++){
    if(s > K)
      s += K;
    else
      s *= 2;
  }
  cout << s << endl;    
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
using namespace std;
int main(){
	int n,k,x,y;
	cin>>n>>k>>x>>y;
	int ans=0;
	if(n>k) ans+=k*x+(n-k)*y;
	else ans+=n*x;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh

ll a[nax],pre[nax];
int main()
{
	string s;
	cin >> s;
	s= "ABC" + s;
	cout << s << endl;
	return 0;
} 




Measured memory_bytes: 256
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_map>
# include <unordered_set>
# include <thread>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using ui32 = unsigned int;
constexpr ll INFLL = 1e18;

#define CHECK_IMPL1(cond)              \
if (!(cond)) {                         \
    DEBUG("expected cond: " << #cond); \
    assert(cond);                      \
}

#define CHECK_IMPL2(cond, message)                                            \
if (!(cond)) {                                                                \
    DEBUG("expected cond: " << #cond << " failed with message: " << message); \
    assert(cond);                                                             \
}
#define CHECK_IMPL(_1, _2, NAME, ...) NAME
#define CHECK(...) CHECK_IMPL(__VA_ARGS__, CHECK_IMPL2, CHECK_IMPL1, CHECK_IMPL0)(__VA_ARGS__)

#ifdef __APPLE__
#define DEBUG(message) std::cerr << message << std::endl;
#else
#define DEBUG(message)
#endif

void solve() {
  int x, y;
  cin >> x >> y;

  int ans = 2e9;

  for (int i = 0; i <= 1; i++) {
    for (int j = 0; j <= 1; j++) {
      int a = x * (1 - 2 * i);
      int b = y * (1 - 2 * j);

      if (a <= b) {
        ans = min(ans, b - a + i + j);
      }
    }
  }

  cout << ans << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
#ifdef __APPLE__
  freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
#endif
  int t = 1;
//  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}

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

const long double EPS = 1e-10;
const long long INF = 1e18;
const int MOD = (int)1e9 + 7;
const long double PI = acos(-1.0L);

int main() {  // TODO
  int N;
  cin >> N;
  vector<ll> L(N + 1);
  rep(i, N) cin >> L[i + 1];
  int ans = 0;
  for (int i = 1; i <= N - 2; i++) {
    for (int j = i + 1; j <= N - 1; j++) {
      for (int k = j + 1; k <= N; k++) {
        if (L[i] == L[j] || L[j] == L[k] || L[k] == L[i]) continue;
        if (L[i] + L[j] > L[k] && L[j] + L[k] > L[i] && L[k] + L[i] > L[j]) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int N; cin >> N;
    vector<int> adrs(N);
    rep(i, N) cin >> adrs[i];

    int ans = INF;
    FOR(i, 1, 101) {
        int tmp = 0;
        for(const auto & ad: adrs) {
            tmp += pow((ad - i), 2);
        }
        ans = min(ans, tmp);
    }

    cout << ans << endl;
}

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

struct Solver {
	void solve() {
		int N, D;
		cin >> N >> D;

		int ans = 0;
		for( int i = 0; i < N; ++i ) {
			double X, Y;
			cin >> X >> Y;
			if( sqrt( X*X + Y*Y ) <= D ) { ans += 1; }
		}

		cout << ans << endl;
	}
};

int main() {
	ios::sync_with_stdio( false );
	cout << fixed << setprecision( 10 );
	Solver().solve();
	return 0;
}


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

int main() {
 int n,m,x,cnta=0,cntb=0,ans;
 cin >> n >> m >> x;
  vector<int> num(m);
  for(int i=0;i<m;i++){
   cin >> num[i];
  }
 
  for(int i=0;i<m;i++){
   if(num[i]<x){
    cnta++;
   }
   else if(num[i]>x){
    cntb++;
   }
  }
  ans =min(cnta,cntb);
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

string month[12]=
{"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};

void solve() {
	string S;
	cin >> S;
	bool mmyy = false, yymm = false;
	rep(i, 0, 12) {
		if(S.substr(0, 2) == month[i]) mmyy = true;
		if(S.substr(2, 2) == month[i]) yymm = true;
	}
	if(mmyy && yymm) cout << "AMBIGUOUS" << "\n";
	else if(mmyy) cout << "MMYY\n";
	else if(yymm) cout << "YYMM\n";
	else cout << "NA\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = (1<<30);

int main() {
  int k,n;
  cin >> k >> n;
  int a[n+1];
  for(int i = 0; i < n; i++)
    cin >> a[i];
  
  int mi = k+1,sum;
  for(int i = 0; i < n; i++) {
    if(i == 0) {
      sum = min(k - (a[1]-a[0]),
      k - (k-a[n-1]) - a[0]);
    }
    else if(i == n-1) {
      sum = min(k - (k-a[n-1]) - a[0],
      k - (a[n-1]-a[n-2]));
    }
    else {
      sum = min(k - (a[i]-a[i-1]), 
      k - (a[i+1]-a[i]));
    }
    mi = min(mi, sum);
  }

  cout << mi << endl;
}

Measured memory_bytes: 4420
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

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

int main()
{
    int n;
    cin >> n;
    string s[n];
    REP(i, n)
    {
        cin >> s[i];
    }
    for (int i = 0; i < n; i++)
    {
        if (s[i] == "Y")
        {
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}

Measured memory_bytes: 256
/* 
 * Project: AtCoder Beginners Contest 134 A - Dodecagon
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/09/12
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cstdint>
using namespace std;

int32_t r;

void solve() {

    printf("%d\n", 3*r*r);
}

int main() {

    scanf("%d", &r);

    solve();

}

Measured memory_bytes: 3196
#include <iostream>
#include <string>
#include <vector>
#include <map>

using namespace std;

int main()
{
    int xl,yl;
    string inp;
    vector<bool> vec;
    cin>>inp;
    for(auto n:inp){
        if(n=='F')vec.push_back(true);
        else vec.push_back(false);
    }
    cin>>xl>>yl;

    vector<int>x_susumi;
    vector<int>y_susumi;
    bool is_x=true;
    int tes=0;
    for(auto v:vec){
        if(v){
            tes++;
        }else{
            if(is_x)x_susumi.push_back(tes);
            else y_susumi.push_back(tes);
            is_x^=1;
            tes=0;
        }
    }
    if(is_x)x_susumi.push_back(tes);
    else y_susumi.push_back(tes);

    vector<map<int,bool>> x_map;
    x_map.resize(x_susumi.size()+1);
    x_map.at(0).insert(std::make_pair(0,true));
    for(int i=1;i<x_susumi.size()+1;++i){
        for(auto j:x_map.at(i-1)){
            x_map.at(i).insert(std::make_pair(j.first+x_susumi.at(i-1),true));
            if(i!=1)x_map.at(i).insert(std::make_pair(j.first-x_susumi.at(i-1),true));
        }
    }


    vector<map<int,bool>> y_map;
    y_map.resize(y_susumi.size()+1);
    y_map.at(0).insert(std::make_pair(0,true));
    for(int i=1;i<y_susumi.size()+1;++i){
        for(auto j:y_map.at(i-1)){
            y_map.at(i).insert(std::make_pair(j.first+y_susumi.at(i-1),true));
            y_map.at(i).insert(std::make_pair(j.first-y_susumi.at(i-1),true));
        }
    }

    bool flagx=false;
    bool flagy=false;
    for(auto tes:x_map.at(x_susumi.size())){
        if(tes.first==xl)flagx=true;
    }
    for(auto tes:y_map.at(y_susumi.size())){
        if(tes.first==yl)flagy=true;
    }
    cout<<(flagx&&flagy?"Yes":"No")<<endl;

    return 0;
}


Measured memory_bytes: 232192
n, x, m = map(int, input().split())
P = [] # (x,pre_sum)
sum_p = 0 # sum of pre + cycle
X = [-1] * m # for cycle check
for i in range(n):
    if X[x] > -1:
        cyc_len = len(P) - X[x]
        nxt_len = (n - X[x]) % cyc_len
        pre = P[X[x]][1]
        cyc = (sum_p - pre) * ((n - X[x]) // cyc_len)
        nxt = P[X[x]+nxt_len][1] - P[X[x]][1]
        print(pre + cyc + nxt)
        exit()
    P.append([x, sum_p])
    sum_p += x
    X[x] = i
    x = x*x % m
print(sum_p)


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

int ary[1010], dp[1010][8];

int main() {
	int N;
	cin >> N;
	char ch;
	for (int i = 1; i <= N; i++) {
		cin >> ch;
		if (ch == 'J') ary[i] = 0;
		else if (ch == 'O') ary[i] = 1;
		else ary[i] = 2;
	}

	int in = 0, ou = 1;
	dp[0][1] = 1;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j < 8; j++) {
			if (!(j&(1 << ary[i]))) continue;
			for (int k = 1; k < 8; k++) {
				if (!(j&k)) continue;
				dp[i][j] = (dp[i - 1][k] + dp[i][j]) % 10007;
			}
		}
	}
	int res = 0;
	for (int i = 1; i < 8; i++) {
		res = (res + dp[N][i]) % 10007;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 3104
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;


int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << min(a, b) + min(c, d) << endl;
}


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

using namespace std;

int main() {

    int n;
    cin>>n;
    vector<vector<int>> points(n, vector<int>(3, 0));
    for(int i = 0; i < n; i++ ) {
        for(int j = 0; j < 3; j++ ) {
            cin>>points[i][j];
        }
    }
    vector<vector<int>> dp(n, vector<int>(3, INT_MIN));
    
    for(int i = 0; i < 3; ++i) {
        dp[n-1][i] = points[n-1][i];
    }

    for(int i = n-2; i >= 0; i--) {
        for(int r = 0; r < 3; r++) {
            for(int j = 0; j < 3; j++) {
                if(j != r) {
                    dp[i][r] = max(dp[i][r], dp[i+1][j] + points[i][r]);
                }
            }
        }
    }


    cout<<*max_element(dp[0].begin(), dp[0].end())<<endl;
}

Measured memory_bytes: 11136
x=int(input())
if x%100<13 and x%100>0:
  if x//100<13 and x//100>0:
    print("AMBIGUOUS")
  else:
    print("YYMM")
else:
  if x//100<13 and x//100>0:
    print("MMYY")
  else:
    print("NA")

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
	int X;

	cin >> X;

	int c500 = X / 500;
	X -= (c500 * 500);
	int c5 = X / 5;
	X -= (c5 * 5);

	cout << (c500 * 1000 + c5 * 5) << endl;

	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

int main() {
  ll n; cin >> n;
  ll cnt = 0;
  for (ll i = 1; i <= n; i++) {
    if (i <= 9) cnt += 1;
    if (100 <= i && i <= 999) cnt += 1;
    if (10000 <= i && i <= 99999) cnt += 1;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
bool pali(string s){
  for(int i=0;i<s.size()/2;i++){
    if(s[i]!=s[s.size()-i-1]) return false;
  }
  return true;
}

int main() {
  string s, a="", b="";
  cin>>s;
  int n = s.size();
  int n1 = (n-1)/2;
  int n2 = (n+1)/2;
  for(int i=0;i<n1;i++) a = a + s[i];
  for(int i=n2;i<n;i++) b = b + s[i];
  if(pali(s)&&pali(a)&&pali(b)) cout<<"Yes";
  else cout<<"No";
  return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
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):
    a,b=map(int,input().split())
    uf.union(a-1,b-1)
print(uf.group_count()-1)

Measured memory_bytes: 12764
n=int(input())
a=list(map(int,input().split()))
b=[(v,s) for s,v in enumerate(a)]
b.sort(reverse=True)

dp=[[0 for i in range(n+1)] for i in range(n+1)]
for i in range(n+1):
    for j in range(n+1-i):
        if i+j==0:
            continue
        v=b[i+j-1][0]
        pos=b[i+j-1][1]
        if i==0:
            dp[0][j]=dp[0][j-1]+v*abs(n-j-pos)
        elif j==0:
            dp[i][0]=dp[i-1][0]+v*abs(i-1-pos)
        else:
            dp[i][j]=max(dp[i-1][j]+v*abs(i-1-pos),dp[i][j-1]+v*abs(n-j-pos))
ans=0
for i in range(n):
    happy=dp[i][n-i]
    if happy>ans:
        ans=happy
print(ans)

Measured memory_bytes: 107468
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;
 
int main() {
 
  int a,b,c;
  cin >> a;
  
  if(a%2==0){
    cout << a*a/4 <<endl;
  }else{
	cout << (a+1)/2*(a-1)/2<<endl;
  }
  
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

long long digit_sum(long long b, long long n){
	if(b<=1){
		return 0;
	}
	if(n<b){
		return n;
	}else{
		return n%b + digit_sum(b,n/b);
	}
}

int main(){
	long long i,b,n,s;
	cin >> n >> s;
	if(n==s){
		cout << n+1 << endl;
		return 0;
	}
	
	for(i=2;i<=sqrt(n);i++){
		if(digit_sum(i,n)==s){
			cout << i << endl;
			return 0;
		}
	}
	
	for(i=1000000;i>=1;i--){
		b = (n-s)/i + 1;
		if((n-s)%i==0 && digit_sum(b,n)==s){
			cout << b << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

int main(){
  int n;
  cin>>n;
  vector<int> vec(n);
  rep(i,n) cin>>vec[i];

  vector<int> v;
  for(long k=1; k*k<=n; k++) if(n%k==0){
    v.pb(k);
    v.pb(n/k);
  }
  uniq(v);
  reverse(all(v));

  for(auto k : v){//dbg(k);
    bool ok = true;
    rep(i,n/k){
      rep(j,k){
        if(vec[j*(n/k)+i]!=vec[i]){
          ok=false;
          i=n;j=n;
        }
      }
    }
    if(ok){
      cout << k << endl;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 3624
import java.util.*


data class Coordinate(val x:Int, val y:Int) {
    operator fun plus(that:Coordinate): Coordinate = Coordinate(x + that.x, y + that.y)
}
val Coordinate.neighbors: Iterable<Coordinate>
    get() {
        return listOf(Coordinate(0, 1), Coordinate(0, -1), Coordinate(1, 0), Coordinate(-1, 0)).map{this + it}
    }
fun main(args:Array<String>){
    val (h, w) = readLine()!!.trim().split(' ').map(String::toInt)
    val forest = Array(h){readLine()!!.trim().split(' ').map(String::toInt).toIntArray()}
    val queue = PriorityQueue<Triple<Int, Int, Coordinate>>(compareBy(Triple<Int, Int, Coordinate>::first)).apply{add(Triple(0, 0, Coordinate(0, 0)))}
    val memo = Array(h){Array(w){IntArray(h * w){Int.MAX_VALUE}}}.apply{this[0][0][0] = 0}
    while (queue.peek().third != Coordinate(h - 1, w - 1)){
        val (time, distance, coordinate) = queue.poll()
        if (distance < h * w - 1 && memo[coordinate.x][coordinate.y][distance] == time){
            for ((x, y) in coordinate.neighbors){
                if (x in 0 until h && y in 0 until w && memo[x][y][distance + 1] > time + (2 * distance + 1) * forest[x][y]){
                    memo[x][y][distance + 1] = time + (2 * distance + 1) * forest[x][y]
                    queue.add(Triple(memo[x][y][distance + 1], distance + 1, Coordinate(x, y)))
                }
            }
        }
    }
    println(queue.peek().first)
}


Measured memory_bytes: 118884
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

string str;


int main()
{
	cin >> str;
	if (str.length() <= 2)
	{
		cout << str << endl;
	}
	else
	{
		for (int i = 2; i >= 0; i--)
		{
			cout << str[i];
		}
		cout << endl;
	}
	




	//system("pause");
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cassert>
#define ll long long
using namespace std;
inline ll read(){
	ll re=0,flag=1;char ch=getchar();
	while(ch>'9'||ch<'0'){
		if(ch=='-') flag=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') re=(re<<1)+(re<<3)+ch-'0',ch=getchar();
	return re*flag;
}
ll d,len,ans=0,mi[20],me[20],cur[20];
void dfs(ll n,ll val,ll tmp){
//	cout<<"dfs "<<n<<' '<<val<<' '<<tmp<<' '<<d<<' '<<mi[len-n-1]<<' '<<mi[n-1]<<'\n';
	if(n>(len/2-1)){
		
		if(len%2) tmp*=10;
		if(val==d) ans+=tmp;
		return;
	}
	ll i=-9;
	while(i<=9&&i*(mi[len-n-1]-mi[n])+val<=d) i++;
	i--;cur[n]=i;
	dfs(n+1,val+i*(mi[len-n-1]-mi[n]),tmp*(me[i+10]-(n==0&&i>=0)));
	if(i==9) return;
	i++;cur[n]=i;
	dfs(n+1,val+i*(mi[len-n-1]-mi[n]),tmp*(me[i+10]-(n==0&&i>=0)));
} 
int main(){
	d=read();ll i,j;
	mi[0]=1;
	for(i=1;i<=18;i++) mi[i]=mi[i-1]*10;
	for(i=0;i<=9;i++) for(j=0;j<=9;j++) me[i-j+10]++; 
	for(len=0;len<=19;len++) dfs(0,0,1);
	printf("%lld\n",ans);
//	system("pause");
}

Measured memory_bytes: 256
import itertools

n, m = map(int, input().split())

path = [[False]*n for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    path[a][b] = True
    path[b][a] = True

ans = 0

for i in itertools.permutations(range(n), n):
    #print(i)
    if i[0]==0:
        for j in range(n):
            if j==n-1:
                ans += 1
                break
            if not path[i[j]][i[j+1]]:
                break

print(ans)


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

int main() {

  char C11, C12, C13, C21, C22, C23;
  cin >> C11 >> C12 >> C13 >> C21 >> C22 >> C23;
  if (C11 == C23 && C12 == C22 && C13 == C21) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
    
}


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

map<ll,ll> flag;

ll attck(ll h)
{
	if(h==1)
		return 1;
	else if(flag[h]!=0)
		return flag[h];
	else
	{
		flag[h] = 1 + attck(h/2) + attck(h/2);
	}
	return flag[h];
}

int main()
{
	ll h;
	cin >> h;
	cout << attck(h) << endl;
	return 0;
}

Measured memory_bytes: 256
import heapq

N = int(input())
graph = [[] for i in range(N+1)]
visited = [False] * (N+1)
cost = [10**20 for i in range(N+1)]

for i in range(N-1):
    a, b, c = map(int, input().split())
    graph[a].append((c, b))
    graph[b].append((c, a))
    
Q, K = map(int, input().split())
q = []

for cr in graph[K]:
    heapq.heappush(q, cr)
visited[K] = True
cost[K] = 0

while q:
    c, r = heapq.heappop(q)
    
    if not visited[r]:
        visited[r] = True
        cost[r] = c
        
        for c_n, r_n in graph[r]:
            if not visited[r_n]:
                heapq.heappush(q, (c+c_n, r_n))
                
for i in range(Q):
    x, y = map(int, input().split())
    print(cost[x] + cost[y])

Measured memory_bytes: 47024
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<long long>> VVLL;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) (a).begin(),(a).end()

const int MOD = 1000000007;

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(a>b){
		a=b;
		return true;
	}
	return false;
}

void debug(VI &arr){
	int n=arr.size();
	rep(i,n){
		cout<<arr.at(i)<<endl;
	}
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

void debug(VVLL &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout<<board.at(i).at(j)<<" ";
		}
		cout<<endl;
	}
}

void debug(VS &board){
	int h = board.size();
	rep(i,h){
		cout<<board.at(i)<<endl;
	}
	return;
}

LL gcd(LL a,LL b){
	return b==0?a:gcd(b,a%b);
}

LL lcm(LL a,LL b){
	return a*b/gcd(a,b);
}

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	double r;
	cin>>r;
	cout<<fixed;
	cout<<setprecision(4)<<2*acos(-1)*r<<endl;
	return 0;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const double pi=3.14159265358979323846;
int ctoi(const char c) {
    if ('0' <= c && c <= '9') return (c - '0');
    return -1;
}
vector<int> input(int n) {
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }
    return vec;
}
void output(vector<int> vec) {
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    return;
}
vector<vector<int>> input(int n, int m) {
    vector<vector<int>> table(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> table. at(i).at(j);
        }
    }
    return table;
}
void output(vector<vector<int>> table) {
    for (int i = 0; i < table.size(); i++) {
        for (int j = 0; j < table.at(0).size(); j++) {
            cout << table.at(i).at(j) << " ";
        }
        cout << endl;
    }
}
long long perm(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long perm = 1;
    for (int i = n; i > n - r; i--) {
        perm *= i;
    }
    return perm;
}
long long comb(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long comb = perm(n,r);
    for (int i = r; i > 0; i--) {
        comb /= i;
    }
    return comb;
}
long long homo(int n, int r) {
    return comb(n + r - 1, n - 1);
}
long long fact(int n) {
    long long fact = 1;
    for (int i = n; i > 0; i--) {
        fact *= i;
    }
    return fact;
}
int gcd(int a, int b){
    if (a % b == 0){
        return(b);
    }else{
        return(gcd(b, a % b));
    }
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
bool isprime(int n){
    if (n < 2) return false;
    else if (n == 2) return true;
    else if (n % 2 == 0) return false;

    for (int i = 3; i <= sqrt(n); i += 2){
        if (n % i == 0){
            return false;
        }
    }
    return true;
}
void sayYes(bool f) {
    if (f) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}
void sayYES(bool f) {
    if (f) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

int main() {
  ll a,v,b,w,t;
  cin >> a >> v >> b >> w >> t;
  if(v<=w){
    cout << "NO" << endl;
  }else{
    if(abs(a-b)<=(v-w)*t){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}

Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	ll x;
	cin >> x;
	
	ll m = 100;
	int ans = 0;

	while( m < x ) {
		m += m / 100;
		ans++;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  cout << max(0, C-(A-B)) << endl;
  return 0;
}

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

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

    string S;
    cin >> S;
    stack<int> st1;
    stack<pair<int, int> > st2;
    int ans = 0;

    for (int i = 0; i < S.size(); ++i) {
        if (S.at(i) == '\\') {
            st1.push(i);
        } else if (S.at(i) == '/' && !st1.empty()) {
            int j = st1.top();
            st1.pop();
            int num = i - j;
            ans += num;
            while (!st2.empty() && st2.top().first > j) {
                num += st2.top().second;
                st2.pop();
            }
            st2.push(make_pair(j, num));
        }
    }
    vector<int> V;
    while (!st2.empty()) {
        V.push_back(st2.top().second);
        st2.pop();
    }
    cout << ans << endl;
    cout << V.size();
    for (int i = V.size() - 1; i >= 0; --i) {
        cout << ' ' << V.at(i);
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3280
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(2000005);

int main() {
    ll n,m,k;
    cin >> n >> m >> k;
    mint ans = 0;
    rep(i, k+1) {
        mint ret = m-1;
        ret = ret.pow(n-1-i);
        ret *= c(n-1, i);
        ret *= m;
        ans += ret; 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 34184
#include <bits/stdc++.h>
using namespace std;
int main () {
  int K, S;
  cin >> K >> S;
  int ans = 0;
  for (int i = 0; i < K+1; i++) {
    for (int j = 0; j < K+1; j++) {
      int z = S - i - j;
      if(z >= 0 && z <= K) ans++;
      }
    }
  
  cout << ans << endl;
        
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int num;
  cin >> N;
  for(int i=0;i <N;i++){
    int x,y;
    y=0;
    cin >> x;
    while(true){
      if(x%2==0){
        y++;
        x /=2;
      }else{
        if(y<num||i==0){
          num =y;
        }
        break;
      }
    }
  }
  cout << num << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
using namespace std;
#include<vector>
//√640= 25が最大
int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    int n,d;
    cin >> n >> d;
    vector<vector<int>> x(n,vector<int>(d,0));
    
    for(int i=0; i<n; i++){
        for(int j=0; j<d; j++){
            cin >> x[i][j];
        }
    }
    int cnt=0;
    double sum;
    for(int a=0; a<n-1; a++){
        for(int b=a+1; b<n; b++){
            sum= 0;
            for(int i=0; i<d; i++){
                sum+=pow((x[a][i]-x[b][i]),2);
            }
            sum= sqrt(sum);
            cerr << sum << endl;
            if(sum-(int)sum==0) cnt++;
        }
    }
    cout << cnt << endl;
}

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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<string> S(N);
	map<string, bool> M;
	int kind = 0;
	for (int i = 0; i < N; i++) {
		cin >> S[i];
		if (M[S[i]]) continue;
		else {
			M[S[i]] = true;
			kind++;
		}
	}
	cout << kind << endl;
	return 0;
}

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

#define fi first
#define se second

const int N = 500500;
const int mod = 1e9 + 7;

using namespace std;

int orien(long long x1, long double y1, long long x2, long double y2, long long x3, long double y3) {
	long double O = (long double) (x2 - x1) * (y3 - y1) - (long double) (y2 - y1) * (x3 - x1);

        if(O < 0) return 1; // clock
        else if(O > 0) return -1; // anti
        return 0;
}

int n, L;

int main()
{
        ios_base::sync_with_stdio(0);

        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        cin >> n >> L;
        deque < pair < long long, long double > > d;
        long long sum = 0;
        long double res = 0;
        for(int i = 1; i <= n; i++){
                long long x, xx;
                cin >> x >> xx;
                swap(x, xx);
                long double y = x * xx;

                L -= x;
                while(sum > L){
                        auto p = d.back();
                        d.pop_back();
                        long long G = p.fi - min(sum - L, p.fi);
                        long double k = (long double) G / p.fi;
                        sum += G - p.fi;
                        p.fi = G;

                        res += k * p.se - p.se;
                        p.se *= k;
                        if(p.fi > 0){
                                d.push_back(p);
                        }
                }
                sum += x;
                res += y;
                L += x;
                while(d.size() > 0 && orien(0, 0, x, y, x + d[0].fi, y + d[0].se) != 1){
                        x += d[0].fi;
                        y += d[0].se;
                        d.pop_front();
                }
                d.push_front({x, y});
                cout << fixed << setprecision(9) << res / L << "\n";
        }
}


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

using namespace std;
vector<int> arr[100001];
bool vis[100001];
int dist[100001];


void dfs(int node){
	vis[node] = 1;

	for(auto child: arr[node]){
		if(vis[child] == 0)
			dfs(child);
		dist[node] = max(dist[node], 1+ dist[child]);

		
	}
}
int main(){
	//https://atcoder.jp/contests/dp/tasks/dp_g
	int n, m;
	cin >> n >> m;
	int a, b;
	for(int i=0;i<=n;i++){
		vis[i] = 0;
		dist[i] = 0;
		arr[i].clear();
	}
	for(int i=0;i<m;i++){
		cin >> a >> b;
		arr[a].push_back(b);

	}

	for(int i=1;i<=n;i++){
		if(vis[i] == 0)
			dfs(i);
	}
	int maxi = 0;
	for(int i=1;i<=n;i++){
		maxi  = max(maxi, dist[i]);
	}
	cout << maxi << endl;

	return 0;
}

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

int main(){
    int n, m;
    cin >> n >> m;

    vector<int> x(m), y(m-1);
    for(int i=0; i<m; i++) cin >> x[i];
    sort(x.begin(), x.end());
    for(int i=1; i<m; i++) y[i-1] = x[i] - x[i-1];
    sort(y.begin(), y.end());
    int last = (m-1) - (n-1);
    int ans = 0;
    if(last > 0) for(int i=0; i<last; i++) ans += y[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024