akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

long INF = numeric_limits<long>::max();

int main()
{
  long sx, sy, gx, gy;
  cin >> sx >> sy >> gx >> gy;

  int N;
  cin >> N;

  vector<pair<long, long>> F(N);
  for (int i = 0; i < N; ++i) {
    long x, y;
    cin >> x >> y;
    F[i] = make_pair(x, y);
  }

  while (!(sx <= gx && sy <= gy)) {
    tie(sx, sy) = make_pair(-sy, sx);
    tie(gx, gy) = make_pair(-gy, gx);
    for (auto& p : F)
      p = make_pair(-p.second, p.first);
  }

  sort(F.begin(), F.end());

  int bi = lower_bound(F.begin(), F.end(), make_pair(sx, 0),
		       [](pair<long, long> p, pair<long, long> q) {
			 return p.first < q.first;
		       }) - F.begin();
  int ei = upper_bound(F.begin(), F.end(), make_pair(gx, 0),
		       [](pair<long, long> p, pair<long, long> q) {
			 return p.first < q.first;
		       }) - F.begin();

  vector<long> tab(N + 2, INF);
  tab[0] = sy;

  // cerr << "sx = " << sx << ", sy = " << sy << endl;
  // cerr << "gx = " << gx << ", gy = " << gy << endl;

  for (int i = bi; i < ei; ++i) {
    long x, y;
    tie(x, y) = F[i];
    // cerr << i << ": " << x << " " << y << endl;
    if (y < sy || y > gy)
      continue;

    int j = lower_bound(tab.begin(), tab.end(), y) - tab.begin();
    if (tab[j] > y) {
      assert(j > 0);
      --j;
    }
    assert(tab[j] <= y);
    // cerr << "tab =";
    // for (int k = 0; k < 5; ++k)
    //     cerr << ' ' << tab[k];
    // cerr << endl;
    // cerr << "lb = " << j << ": " << tab[j] << endl;
    if (tab[j + 1] > y)
      tab[j + 1] = y;
  }

  int cnt = 0;
  for (int i = N; i >= 0; --i) {
    if (tab[i] != INF) {
      cnt = i;
      break;
    }
  }

  double ans = 100. * (gx - sx + gy - sy) + cnt * (-20. + 5. * M_PI);
  if ( (cnt == min(gx-sx,gy-sy)+1) )
    ans += 5. * M_PI;
  cout << setprecision(20) << ans << '\n';

  return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
const int maxN = 305;
const int64_t INF = 1e18;

int n, k;
int h[maxN], minIdx;

int64_t memo[maxN][maxN][maxN];

int64_t dp(int i, int rem, int idx) {
    if(i == n + 1)
        return 0;

    if(memo[i][rem][idx] != -1)
        return memo[i][rem][idx];

    int64_t ans = INF;

    int64_t cost = 0;

    if(h[idx] < h[i])
        cost = h[i] - h[idx];

    ans = min(ans, dp(i + 1, rem, i) + cost);

    if(rem - 1 >= 0) {
        ans = min(ans, dp(i + 1, rem - 1, idx));
    }

    return memo[i][rem][idx] = ans;
}

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

    cin >> n >> k;

    for(int i = 1; i <= n; i++) {
        cin >> h[i];
        if(!minIdx || h[i] < h[minIdx])
            minIdx = i;
    }

    for(int i = 0; i <= n; i++)
        for(int j = 0; j <= n; j++)
            for(int k = 0; k <= n; k++)
                memo[i][j][k] = -1;

    cout << dp(1, k, 0) << '\n';

    return 0;
}


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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int a,b;
	cin >> a >> b;
	string s0,s1;
	for(int i=0;i<b;i++){
		s0.push_back((char)('0'+a));
	}
	for(int i=0;i<a;i++){
		s1.push_back((char)('0'+b));
	}
	if(s0<s1) cout << s0 << "\n";
	else cout << s1 << "\n";
	return 0;
}

Measured memory_bytes: 256
/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-11-17 22:46:31
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int main()
{
  string S, T;
  cin >> S >> T;
  reverse(T.begin(), T.end());
  if (S == T)
  {
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstdint>
#include <unordered_set>
#include <ctime>
#include <numeric>
#include <cstdint>

using llint = long long int;

template<typename T>
void dump(const T& arr){
  std::cout << "[";
  for(const auto& elem: arr){
    std::cout << elem << ", ";
  }
  std::cout << "]" << std::endl;
}

void solve(void){
  std::string s;
  std::cin >> s;
  if(s[s.size()-1] == 's') std::cout << s << "es" << std::endl;
  else                     std::cout << s << "s"  << std::endl;
  return;

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





Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define mem(x,val) memset(x,val,sizeof(x));
typedef long long ll;

string s,t;

int dp[3005][3005];


int lcs(int n,int m)
{
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i==0 || j==0){
                dp[i][j]=0;
            }
            else if(s[i-1]==t[j-1]){
                dp[i][j]=dp[i-1][j-1]+1;
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    return dp[n][m];
    

}
int main()
{
    //mem(dp,-1);
    cin >>s>>t;
    int len=lcs(s.size(),t.size());
    // cout << len<<endl;
    // return 0;
    if(len==0){
        cout <<" "<<endl;
        return 0;
    }
    char ans[len+1];
    ans[len]='\0';
    int go=0;
    int i=s.size(),j=t.size();
    while(i>0 && j>0){
        if(s[i-1]==t[j-1]){
            ans[len-1]=s[i-1];
            i--,j--;len--;
        }
        else if(dp[i-1][j]>dp[i][j-1]){
            i--;
        }
        else {
            j--;
        }
    }
    cout << ans<<endl;
    return 0;

}

Measured memory_bytes: 35456
#include <stdio.h>

int main()
{
    double N;
    int i, count = 0;
    scanf("%lf", &N);
    for (i = 1; i <= N; i++)
    {
        if (i % 2 == 1)
        {
            count = count + 1;
        }
    }
    printf("%lf", count / N);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define MOD 1000000007
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,l,r) for(ll (i)=(l);(i)<(r);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


void WarshallFloyd(Graph& G, Matrix& d) {//O(V^3)
	d.resize(G.size());
	REP(i, d.size())d[i].resize(G.size());
	REP(i, d.size()) {
		REP(j, d[i].size()) {
			d[i][j] = INF;
		}
	}
	REP(i, G.size()) {
		REP(j, G[i].size()) {
			d[i][G[i][j].to] = G[i][j].cap;
		}
	}
	REP(i, G.size()) {
		REP(j, G.size()) {
			REP(k, G.size()) {
				chmin(d[j][k], d[j][i] + d[i][k]);
			}
		}
	}
}


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

	ll n;
	cin >> n;
	Matrix a(n, Array(n, 0));
	Graph g(n);
	REP(i, n) {
		REP(j, n) {
			cin >> a[i][j];
			if (i < j) add_edge(g, i, j, a[i][j], true, a[i][j]);
		}
	}

	Matrix d;
	WarshallFloyd(g, d);
	ll ans = 0;
	REP(i, n) {
		rep(j,i+1, n) {
				//cout << i <<" "<< j << endl;
				//cout << d[i][j]<<" " << a[i][j] << endl;
				if (d[i][j] != a[i][j]) {
					cout << -1 << endl;
					return 0;
				}

				bool flag = false;
				REP(k, n) {
					if (i != k && j != k) {
						
						if (a[i][k] + a[k][j] == a[i][j]) {
							//cout << i<<" " << j <<" "<< k << endl;
							flag = true;
						}
						
					}
				
				}
				if (!flag) {
					ans += a[i][j];
					//cout << a[i][j] << endl;
				}
		}
	}

	cout << ans << endl;


	return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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



void solve() {
	int N; cin >> N;
    vec v(N);
    rep(i, N){
        cin >> v[i];
    }
    sort(all(v));
    int res=0;
    rep(i, 100001){
        if(N/2 == distance(v.begin(), lower_bound(all(v), i))) res++;
    }

    cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4736
#include<iostream>

using namespace std;

long long GCD(long long b,long long a){
    long long r;
    r = a%b;

    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }

    return b;

}

int main(){
    long long A;
    long long B;
    long long C;
    long long D;
    long long count_c=0;
    long long count_d=0;
    long long count_w=0;

    long long p;

    cin >> A >> B >> C >> D;

    p = (C*D)/GCD(C,D);

    count_c=(B/C)-((A-1)/C);

    count_d=(B/D)-((A-1)/D);

    count_w=(B/p)-((A-1)/p);

    cout << (B-A)-(count_c+count_d-count_w)+1 <<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int i,j,N,sum=0;
  int d[101];
  cin >> N;
  for(i = 0; i < N; i++){
  	cin >> d[i];
  }
 
  for(i=0;i<N;i++){
    if(d[i] != 0){
      sum++;
      for(j = i+1;j < N;j++){
        if(d[j] == d[i]) {
          d[j] = 0;
        }
      }
      d[i] = 0;
    }
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize "trapv"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand rng
#define fios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define M_PI 3.14159265358979323846
typedef long long ll;



int main() {
	//fios;
	int n;
	cin >> n;
	if(n % 1000)
		cout << 1000 - n % 1000 << endl;
	else {
		cout << 0 <<endl;
	}

}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
using namespace std;
const int SIZE=1005;
const int INF=1<<30;
const LL p=1e9+7;
string s;
int N;
LL ans=1;
int main(){
	cin >> N;
	cin >> s;
	cin >> s;
	bool last=false;
	REP(i,s.size()){
		if(s.size()!=i+1 && s[i]==s[i+1]){
			if(i==0) ans*=6;
			else if(last) ans*=3;
			else ans*=2;
			i++;
			last=true;
		}
		else{
			if(i==0) ans*=3;
			else if(last) ans*=1;
			else ans*=2;
			last=false;
		}
		ans%=p;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

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

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

int main()
{
    string s;
    cin>>s;
    int ans=s.length()/2;
    for(int i=0;i<s.length();i++)
        if(s[i]=='p')
            ans--;
    cout<<ans;
    return 0;
}



Measured memory_bytes: 3720
#include <iostream>
using namespace std;
int main()
{
    int c[3][3];
    for(int i=0; i<3; i++)
    {
    	for(int j=0; j<3; j++)
    	{
             cin >> c[i][j];
    	}
    } 

    int a[3], b[3];

    for(a[0]=0; a[0]<=c[0][0]; a[0]++)
    {
    	for(a[1]=0; a[1]<=c[1][1]; a[1]++)
    	{
    		for(a[2]=0; a[2]<=c[2][2]; a[2]++)
    		{
                b[0] = c[0][0]-a[0];
                b[1] = c[1][1]-a[1];
                b[2] = c[2][2]-a[2];
                if(a[0]+b[1]==c[0][1] && a[0]+b[2]==c[0][2]
                	&& a[1]+b[0] == c[1][0] && a[1]+b[2] == c[1][2]
                	&& a[2]+b[0] == c[2][0] && a[2]+b[1]== c[2][1])
                {
                	cout << "Yes" << endl;
                	return 0;
                }
    		}
    	}
    }

    cout << "No" << endl;

	return 0;
}

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

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using namespace std;

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

    int a, b; cin >> a >> b;
    int ans = (a + b) % 24;

    cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#define EPS 1e-10
using namespace std;

class Point {
public:
  double x, y;

  Point(double x = 0, double y = 0): x(x), y(y) {}

  Point operator + (Point p) { return Point(x + p.x, y + p.y); }
  Point operator - (Point p) { return Point(x - p.x, y - p.y); }
  Point operator * (double a) { return Point(a * x, a * y); }
  Point operator / (double a) { return Point(x / a, y / a); }

  double abs() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }

  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }
};

struct Segment {
  Point p1, p2;
};

typedef Point Vector;
typedef Segment Line;

double norm(Vector a) {
  return a.x * a.x + a.y * a.y;
}

double abs(Vector a) {
  return sqrt(norm(a));
}

double dot(Vector a, Vector b) {
  return a.x * b.x + a.y * b.y;
}

Point project(Line l, Point p) {
  Vector a = l.p2 - l.p1;
  double r = dot(p - l.p1, a) / norm(a);
  return l.p1 + a * r;
}

int main() {
  Point p1, p2;
  cin >> p1.x >> p1.y >> p2.x >> p2.y;
  Line l;
  l.p1 = p1;
  l.p2 = p2;

  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    Point p;
    cin >> p.x >> p.y;
    Point r = project(l, p);
    printf("%.10f %.10f\n", r.x, r.y);
  }

  return 0;
}

Measured memory_bytes: 3264
a,b = map(int,input().split())
s = input()
for i in range(a):
    if s[i] == '-':
        print('No')
        exit(0)
 
if s[a] != '-':
    print('No')
    exit(0)
 
for i in range(a+1,a+b):
    if s[i] == '-':
        print('No')
        exit(0)
 
print('Yes')

Measured memory_bytes: 9180
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//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, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
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];
  }
};

int main(){
	int N, K;
	cin >> N >> K;
	combination comb(N);
	for(int i=1; i<=K; i++){
		mint tmp1 = comb(N-K+1, i);
		mint tmp2 = comb(K-1, i-1);
		cout << tmp1 * tmp2 << endl;
	}
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
 
  int n,m;
  cin>>n>>m;
  
  vi v(m,0);
  rep(i,n){
    int k;cin>>k;
    rep(j,k){
      int a;cin>>a;
      v[a-1]++;
    }
  }
  int ans=0;
  rep(i,m){
    if(v[i]==n)ans++;
  }
  
  cout<<ans<<endl;
 
  return 0;
}

Measured memory_bytes: 125568
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl


using ll = long long;
const ll mod = LLONG_MAX;
int n;
int a[100010];
int main(){
  cin>>n;
  rep(i,n)cin>>a[i];
  int cnt=0;
  for(int i=0;i<n;i++){
    if(a[i]==i+1 &&a[i+1]==i+2){
      cnt++;
      i++;
    }else if(a[i]==i+1){
      cnt++;
    }
  }
  cout<<cnt<<endl;

}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
from sys import stdin

class Dice:

    def __init__(self,dicelist):
        self.dice_list = dicelist

    def roll(self, direction):
        work = list(self.dice_list)
        if (direction == 'N'):
            self.dice_list[0] = work[1]
            self.dice_list[1] = work[5]
            self.dice_list[2] = work[2]
            self.dice_list[3] = work[3]
            self.dice_list[4] = work[0]
            self.dice_list[5] = work[4]
        elif (direction == 'E'):
            self.dice_list[0] = work[3]
            self.dice_list[1] = work[1]
            self.dice_list[2] = work[0]
            self.dice_list[3] = work[5]
            self.dice_list[4] = work[4]
            self.dice_list[5] = work[2]
        elif (direction == 'S'):
            self.dice_list[0] = work[4]
            self.dice_list[1] = work[0]
            self.dice_list[2] = work[2]
            self.dice_list[3] = work[3]
            self.dice_list[4] = work[5]
            self.dice_list[5] = work[1]
        elif (direction == 'W'):
            self.dice_list[0] = work[2]
            self.dice_list[1] = work[1]
            self.dice_list[2] = work[5]
            self.dice_list[3] = work[0]
            self.dice_list[4] = work[4]
            self.dice_list[5] = work[3]

    def roll_until_index0top(self,num0):
        if self.dice_list[0] == num0:
            return
        commands = ['E', 'E', 'E', 'N', 'N', 'N']
        for c in commands:
            self.roll(c)
            if self.dice_list[0] == num0:
                return
        else:
            print('error')

    def get_index_by_number(self, num):
        for i in range(len((self.dice_list))):
            if self.dice_list[i] == num:
                return i
        else:
            return -1

    def get_index2_number(self, num1):
        index1 = self.get_index_by_number(num1)
        if index1 == 1:
            return self.dice_list[2]
        elif (index1 == 2):
            return self.dice_list[4]
        elif (index1 == 3):
            return self.dice_list[1]
        elif (index1 == 4):
            return self.dice_list[3]
        else:
            print('error 2')

    def getTop(self):
        return self.dice_list[0]


dice_list = list(map(int, stdin.readline().rstrip().split()))
q = int(stdin.readline().rstrip())
dice = Dice(dice_list)

for i in range(q):
    num0_num1 = list(map(int, stdin.readline().rstrip().split()))
    dice.roll_until_index0top(num0_num1[0])
    print(dice.get_index2_number(num0_num1[1]))


Measured memory_bytes: 5632
#include <iostream>

using namespace std;

int main()
{
    int N, M, X;
    int a[101];

    cin >> N >> M >> X;

    for (int i = 0; i < M; i++)
        cin >> a[i];

    int toZero = 0;
    int i = 0;

    while (a[i] < X && i < M)
    {
        toZero++;
        i++;
    }

    if (toZero < M - toZero)
        cout << toZero << endl;
    else
        cout << M - toZero << endl;

    return 0;
}

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

int N;
vector<long long> a;

int main() {
    cin >> N;
    long long black = 0, white = 0;
    a.resize(N);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        if (i % 2 == 0) black += a[i];
        else white += a[i];
    }
    if (N % 2 == 0) cout << max(black, white) << " " << min(black, white) << endl;
    else {
        long long low = 0, high = 1<<30;
        while (high - low > 1) {
            long long mid = (low + high) / 2;
			vector<long long> dp; dp.assign(N + 1, -(1LL << 60));
			dp[1] = a[0];
			for (int i = 3; i <= N; i += 2) {
				// 直前をカットする場合
				if (dp[i - 2] >= mid) dp[i] = max(dp[i], a[i - 1]);
				
				// 直前をカットしない場合
				dp[i] = max(dp[i], dp[i - 2] - a[i - 2] + a[i - 1]);
			}
			if (dp[N] >= mid) low = mid;
			else high = mid;
        }
        cout << white + low << " " << black - low << endl;
    }
}


Measured memory_bytes: 4956
#include "iostream"
#include "math.h"
using namespace std;

int N;
int hard[300000];
bool flag[300000];
int f;

int main() {
	cin >> N;
	for (int i = 0; i < pow(2, N); i++) {
		cin >> hard[i];
		flag[i] = true;
	}
	f = -1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < pow(2, N); j++) {
			if (flag[j]) {
				if (f == -1) {
					f = j;
				}
				else {
					if (hard[f] == hard[j]) {
						flag[f] = false;
					}
					else if (hard[f] > hard[j]) {
						flag[j] = false;
						hard[f] -= hard[j];
					}
					else {
						flag[f] = false;
						hard[j] -= hard[f];
					}
					f = -1;
				}
			}
		}
	}
	for (int i = 0; i < pow(2, N); i++) {
		if (flag[i]) {
			cout << hard[i] << "\n";
		}
	}
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
//#include <mylib.h>
using namespace std;
//cin.sync_with_stdio(false);

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define FOR_EQ(i,a,b) for(int i = (a); i <= (b); ++i)
#define FOR_RE(i,a,b) for(int i = (a); i > (b); --i)
#define rep(i,n) FOR(i,0,n)
#define rep_eq(i,n) FOR_EQ(i,0,n)
#define rep_re(i,n) FOR_RE(i,n,0)

#define DEBUG_VARIABLE(variable) cout << #variable << ":" << variable << endl

#define WHITE 1//（未訪問）
#define GRAY 2//（訪問）未だに訪問していない頂点への辺を持っている。スタックに退避。
#define BLACK 3//（訪問完了）未訪問への頂点への辺を持たない
#define N 100
#define INFTY (1 << 21) //10^21
#define INF (1 << 9)
int M[N][N];//隣接行列
int color[N];

//1個上から時計周り
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//上右下左
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {-1, 0, 1, 0};
static const int NIL = -1;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> Vector;
typedef vector<Vector>	DVector;
//int n;

void printArray(int *array, int);
void printVector(Vector &v);
void printDimention(DVector &dv);

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, m;
    cin >> n >> m;
    ll back;
    
    if(n == 1 && m == 1){
        back = 1;
    }else if(n == 1){
        back = m - 2;
    }else if(m == 1){
        back = n - 2;
    }else{
        back = (n - 2) * (m - 2);
    }
    cout << back << endl;
}

//配列の表示
void printArray(int array[], int n){
    rep(i, n){
        if(i)   cout << " ";
        cout << array[i];
    }
    cout << endl;
}

//Vectorの表示
void printVector(Vector &v){
    rep(i, (int)v.size()){
        if(i)   cout << " ";
        cout << v[i];
    }
    cout << endl;
}

//二次元配列の表示
void printDimention(DVector &dv){
    rep(i, (int)dv.size()){
        rep(j, (int)dv[i].size()){
            if(j)   cout << " ";
            cout << dv[i][j];
        }
        cout << endl;
    }
}

//numの中に何個2がかかってるか
int factor2(int num){
    int cnt = 0;
    while(num % 2 == 0){
        num /= 2;
        cnt++;
    }
    return cnt;
}

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


int main() {
    int A, B; cin >> A >> B;
    int ans = -1;
    if ((A >= 1 && A <= 9) && (B >= 1 && B <= 9)) {
        ans = A * B;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main()
{
    int n,i,in,a=0,p=0,u;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&in);
        p+=in;
        if(in>a)
        a=in;
    }
    u=p-a+(a/2);
    printf("%d\n",u);
    return 0;
}

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

using namespace std;

int main() {
  int s = 1, x = 1, y = 1, a, b;
  vector<int> price;
  while(s > 0) {
    cin >> x >> y >> s;
    for(int i = 1; i < s; i++) {
      for(int j = 1; j < s; j++) {
	a = (int) i*(100+x)/100;
	b = (int) j*(100+x)/100;
	if(a+b == s){
	  a = (int) i*(100+y)/100;
	  b = (int) j*(100+y)/100;
	  price.push_back(a+b);
	}
      }
      if(i == s-1){
	sort(price.begin(), price.end());
	cout << price.back() << endl;
	price.clear();
      }
    }
  }
  return 0;
}
      

Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


void solve(){
    int X;
    cin >> X;
    cout << lcm(X, 360) / X << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> P3;
typedef pair<P ,P> PP;

struct UnionFindTree {
    vector<int> par;
    vector<int> rank;
    vector<int> siz;

    void init(int n) {
        par.resize(n);
        rank.resize(n);
        siz.resize(n);
        for (int i = 0; i < n; i++) {
            par[i] = i;
            rank[i] = 0;
            siz[i] = 1;
        }
    }
    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 (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) rank[x]++;
        par[y] = x;
        siz[x] += siz[y];
    }
    bool is_same(int x, int y) {
        return find(x) == find(y);
    }
    int size(int x) {
        x = find(x);
        return siz[x];
    }
};

int n, m;
vector<P3> es;
UnionFindTree uf;
vector<vector<P> > g;
bool noAlt[50005];

// pre->nowの辺が閉路に含まれるか
bool dfs(int now, int pre, int t, int sc){
    if(now == t) return true;
    for(auto e : g[now]){
        int to = e.first, c = es[e.second].first;
        if(to == pre)continue;
        if(dfs(to, now, t, sc)){
            if(c == sc) noAlt[e.second] = false;  // 同じコストは除く
            return true;
        }
    }
    return false;
}

int main() {
    cin >> n >> m;
    for(int i=0;i<m;i++){
        int s, d, c;
        cin >> s >> d >> c;
        s--; d--;
        es.push_back({c,{s,d}});
    }
    // Kruskal法
    sort(es.begin(), es.end());
    uf.init(n);
    g.resize(n);
    for(int i=0;i<m;i++){
        auto e = es[i];
        int c = e.first, u = e.second.first, v = e.second.second;
        if(!uf.is_same(u,v)){  // 候補に加える
            uf.unite(u,v);
            noAlt[i] = true;
            g[u].push_back({v, i});  // 行先と辺番号のペア
            g[v].push_back({u, i});
        }
        else{
            // 閉路内でコストがcと同じ辺を候補から除く
            dfs(u, -1, v, c);
        }
    }
    int ecnt = 0, csum = 0;
    for(int i=0;i<m;i++){
        if(noAlt[i]){
            ecnt++;
            csum += es[i].first;
        }
    }
    cout << ecnt << " " << csum << endl;
    return 0;
}


Measured memory_bytes: 3820
#include <bits/stdc++.h>	
#define pb push_back
typedef long long ll;
const int inf = 2e9;
using namespace std;


class SameColorPairs {
public:
    vector<string> removePairs(vector<string> board) {
        vector<string> ret;
        int H = board.size(), W = board[0].size();
        for (int i = 0; i < H; ++i)
        for (int j = 1; j < W; ++j)
            if (board[i][j] == board[i][j-1]) {
                ret.push_back(to_string(i) + " " + to_string(j) + " " + to_string(i) + " " + to_string(j-1));
            }
        return ret;
    }
};



template<class T> void getVector(vector<T>& v) {
    for (int i = 0; i < v.size(); ++i)
        cin >> v[i];
}

int main(){
  string s;
  cin>>s;
  int ans=700;
  for (int i = 0; i < s.length(); ++i)
  {
  	ans += s[i]=='o' ? 100 : 0; 
  }
  return !printf("%d\n",ans);

}


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

int main() {
    int N;
    cin >> N;
    int a[N];  // 最大 100 個ですが余裕をもたせます
    for (int i = 0; i < N; ++i) cin >> a[i];

    sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート
    int Alice = 0;
    int Bob = 0;
    for (int i = 0; i < N; ++i) {
        if (i % 2 == 0) { // Alice のターン
            Alice += a[i];
        }
        else { // Bob のターン
            Bob += a[i];
        }
    }
    cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
import sys
import  math
from heapq import *
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N=int(input())
A=nl()
now=1
for i in range(N):
    if(A[i]==now):
        now+=1

if(now==1):
    print(-1)
    sys.exit()

print(N-now+1)

Measured memory_bytes: 26912
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int binarySearch(vector<int> s, int key){
    int left = 0;
    int right = s.size();
    int mid;
    while (left < right){
        mid = (left + right) / 2;
        if (key == s[mid])
            return 1;
        else if (key > s[mid])
            left = mid + 1;
        else
            right = mid;
    }
    return 0;
}
int main()
{
    vector<int> s;
    vector<int> t;
    int n, q, temp;
    int num = 0;
    cin >> n;
    for (int i = 0; i < n; ++i){
        cin >> temp;
        s.push_back(temp);
    }
    cin >> q;
    for (int i = 0; i < q; ++i){
        cin >> temp;
        t.push_back(temp);
    }
    int res = 0;
    for (int i = 0; i < q; ++i){
        if(binarySearch(s, t[i])==1)
            num++;
    }
    cout << num << endl;
    return 0;
}




Measured memory_bytes: 4112
#!/usr/bin/env python3
def main():
    N = int(input())
    MOD = 10 ** 9 + 7

    if N < 3:
        print(0)
        return
    dp = [0] * N
    dp[2] = 1
    for n in range(3, N):
        dp[n] = (dp[n - 1] + dp[n - 3]) % MOD
    print(dp[-1] % MOD)


if __name__ == '__main__':
    main()


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

using namespace std;

typedef long long ll;

const int N_MAX = 100002;

int n;

ll a[N_MAX], b[N_MAX];

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i] >> b[i];
    ll ans = 0;
    for(int i = n; i >= 1; i--)
    {
        a[i] += ans;
        ans += (a[i] + b[i] - 1) / b[i] * b[i] - a[i];
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string& s) {
    return '"' + s + '"';
}
string to_string(const char* s) {
    return to_string((string) s);
}
string to_string(bool b) {
    return (b ? "true" : "false");
}
string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}
template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
//Auther: Arin Roday
#define vec vector
#define i64 long long
#define endl '\n'
#define sz(x) (x).size()
#define times(n) for(int i = 0; i < (n); ++i)
#define bits(x) __builtin_popcount(x)
 
int test_case_number = 1;

void print_case(){
    #ifdef LOCAL
    cout << "Case #" << test_case_number++ << ": ";
    #endif
}

void solve(){
    int n;
    cin >> n;
    if(n >= 30){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
 
int main(){
    solve();
}

Measured memory_bytes: 3600
#include <iostream>
#include <cmath>
using namespace std;
using ll = long long;

double pi = 3.14159265359;

int main()
{
    double a, b, c;
    cin >> a >> b >> c;
    c = pi * c / 180.0;
    printf("%lf\n%lf\n%lf\n", a / 2 * b * sin(c), a + b + sqrt(a * a + b * b - 2 * a * b * cos(c)), b * sin(c));
}


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

using ll = long long;

bool check(vector<ll> const& a, ll m) {
    const int N = a.size() / 2;
    bool ok = false;
    for(int i=0; i<N; ++i) {
        int j = lower_bound(a.begin()+i, a.begin()+i+N+1, a[i]+m) - a.begin();
        int k = lower_bound(a.begin()+j, a.begin()+i+N+1, a[j]+m) - a.begin();
        if(a[j] - a[i] >= m && a[k] - a[j] >= m && a[i+N] - a[k] >= m) {
            ok = true;
            break;
        }
    }
    return ok;
}

int main() {
    int N;
    cin >> N;
    vector<ll> a(2*N+1);
    for(int i=1; i<=N; ++i) {
        cin >> a[i];
        a[i+N] = a[i];
    }
    for(int i=1; i<2*N+1; ++i) {
        a[i] += a[i-1];
    }

    ll lb = 0, ub = (a[N] + 2) / 3;
    while(ub - lb > 1) {
        ll m = (ub + lb) / 2;
        if(check(a, m)) {
            lb = m;
        } else {
            ub = m;
        }
    }
    cout << lb << endl;
}


Measured memory_bytes: 4424
from sys import stdin
def main(mx=max):
    s = stdin.readline().strip()
    ans = [{'': -1001001001}, {'': 0}]
    for i, c in enumerate(s):
        d = {}
        if i:
            t = s[i-1] + c
            x = mx(-1001001001 if k == t else v for k, v in ans[0].viewitems())
            d[t] = x + 1
        x = mx(-1001001001 if k == c else v for k, v in ans[1].viewitems())
        d[c] = x + 1
        ans = [ans[1], d]
    print mx(ans[1].values())
main()


Measured memory_bytes: 3176
#include <stdio.h>
#include <string.h>

int main()
{
    char ring[200], p[100], s[100];
    
    scanf("%s", s);
    scanf("%s", p);
    
    strcpy(ring, s);
    strcat(ring, s);
    
    if (strstr(ring, p)) printf("Yes\n");
    else                 printf("No\n");
    
    return 0;
}

Measured memory_bytes: 540
from math import log, ceil

n, k = map(int, input().split())
a = tuple(map(int, input().split()))

# A_MAX = 10 ** 9
# MAX_BIT_LENGTH = ceil(log(A_MAX * n, 2))

cs = [0]
t = 0
for aa in a:
    t += aa
    cs.append(t)

ps = []
for r in range(1, n + 1):
    for l in range(r):
        ps.append(cs[r] - cs[l])

MAX_BIT_LENGTH = ceil(log(max(ps), 2))

ans = 0
for b in range(MAX_BIT_LENGTH)[::-1]:
    cnt = 0
    t = ans + (1 << b)
    for p in ps:
        if p & t == t:
            cnt += 1
            if cnt == k:
                ans = t
                break

print(ans)

Measured memory_bytes: 22964
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let n = read int
    let xs = List.init n (fun _ -> read int)
    let bs = List.scan max 0 xs
    let cs = List.rev xs |> List.scan max 0 |> List.rev |> List.tail
    for i in Seq.map2 max bs cs do
        printfn "%i" i
    0

Measured memory_bytes: 58240
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int x[100001],y[100001];
int main(){
    int n,xi,yi;
    cin>>n;
    rep(i,n){
        cin>>xi>>yi;
        x[i]=xi+yi;
        y[i]=xi-yi;
    }
    int xmx=*max_element(x,x+n);
    int xmn=*min_element(x,x+n);
    int ymx=*max_element(y,y+n);
    int ymn=*min_element(y,y+n);
    int mx=0,mx2=0;
    rep(i,n){
        mx=max(mx,min(max(xmx-x[i],y[i]-ymn),max(ymx-y[i],x[i]-xmn)));
        mx2=max(mx2,min(max(xmx-x[i],ymx-y[i]),max(y[i]-ymn,x[i]-xmn)));
    }
    cout<<min(mx,mx2)<<endl;
    return 0;
}


Measured memory_bytes: 3892
n = int(input())
a = list(map(int, input().split()))

dp = [[None] * len(a) for _ in a]

for i in range(len(a)-1, -1, -1):
    for j in range(i, len(a)):
        if i == j:
            dp[i][j] = a[i]
            continue

        dp[i][j] = max(a[j] - dp[i][j-1], a[i] - dp[i+1][j])

print(dp[0][len(a) - 1])

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

using namespace std;
#define int long long

signed main(){
    string S,ans;
    char s;
    for(int i=0;i<3;i++){
        cin >> S;
        s =  S[0];
        s = s-32;
        ans += s;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int W,H,x,y,r;

bool judge(int W,int H,int x,int y, int r){
	return 0<=x-r && r+x<=W && 0<=y-r && y+r<=H;
}

int main(){
	while(std::cin >> W >> H >> x >> y >> r){
		if(judge(W,H,x,y,r)) std::cout << "Yes" << std::endl;
		else std::cout << "No" << std::endl;
	}
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << endl;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
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;}

// 0 false, 1 true 
// stringの数字をint型にしてアスキーコードになったら -48する
// 切り上げ　ceil(a)

ll n, k;

vector<ll> vec;
vector<ll> dp;

ll rec(ll i){
    if(dp.at(i) < INF) return dp.at(i);

    if(i == 0) return 0;

    ll tmp = INF;
    for(ll j = 1; j <= k; j++){
        if(i - j >= 0) chmin(tmp, rec(i - j) + abs( vec.at(i) - vec.at(i - j)));
    }

    return dp.at(i) = tmp;

}



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

    n = x;
    k = y;

    vec.resize(n);
    dp.assign(n,INF);
    
    rep(i,n){
        cin >> vec.at(i);
    }

    cout << rec(n-1) << endl;

}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main(){
    string s,t;
    cin>>s>>t;
    int n=s.size(),m=t.size();

    int ans=INF;
    for(int i=0;i<=n-m;i++){
        int tmp=m;
        for(int j=0;j<m;j++){
            if(s[i+j]==t[j]) tmp--;
        }
        ans=min(ans,tmp);
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 3556