akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int N=10005,M=105,mod=1e9+7;
inline int add(int &a,int b){a+=b;if(a>=mod)a-=mod;}
int dp[N][M][2],d,n;
char s[N];
int main()
{
	scanf("%s%d",s+1,&d);
	n=strlen(s+1);
	dp[0][0][0]=1;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<d;j++)
			for(int x=0;x<=9;x++)
				add(dp[i+1][(j+x)%d][1],dp[i][j][1]);
		for(int j=0;j<d;j++)
			for(int x=0;x<=s[i+1]-'0';x++)
				add(dp[i+1][(j+x)%d][x!=s[i+1]-'0'],dp[i][j][0]);
	}
	printf("%d\n",(dp[n][0][0]+dp[n][0][1]-1+mod)%mod);
	return 0;
}

Measured memory_bytes: 8448
x1, y1, x2, y2 = gets.chomp.split.map(&:to_i)
dx = x2 - x1
dy = y2 - y1
x3 = x2 - dy
y3 = y2 + dx
x4 = x3 - dx
y4 = y3 - dy
puts [x3, y3, x4, y4].join(" ")

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;


int main(){
    int x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
    int vx=x2-x1,vy=y2-y1;
    cout<<x2-vy<<" "<<y2+vx<<" ";
    cout<<x2-vy-vx<<" "<<y2+vx-vy<<endl;
}

Measured memory_bytes: 3648
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int,input().split())) for _ in range(M)]
BC = sorted(BC,key= lambda x: x[1],reverse=True)
A.sort()
n = 0
i = 0
m = 0
while A[i]<BC[n][1]:
    A[i] = BC[n][1]
    m = m+1
    if m >=BC[n][0]:
        m = 0
        n = n+1
    i += 1
    if n==M:
      break
    if i == N:
      break
print(sum(A))


Measured memory_bytes: 82284
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main(){
  int N;
  cin >> N;

  if ( (N % 2) == 0)
    cout << setprecision(30) << (double)0.5 << endl;
  else
    cout << setprecision(30) << (double)((N/2)+1) / N << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int q;
  cin >> q;
  function<string(int, int, int, int)> query = [&](int a, int b, int c, int d) {
    int len = (a + b) / (min(a, b) + 1);

    function<bool(int)> pred = [&](int k) {
      int useA = k / (len + 1) * len;
      if (k % (len + 1)) useA += k % (len + 1);
      if (useA > a) return false;
      if (k % (len + 1))
        return (b - k / (len + 1) + a - useA) / (a - useA + 1) <= len;
      return (b - k / (len + 1) + a - useA + 1) / (a - useA + 1) <= len;
    };

    int l = 0, r = a + b;
    while (l < r) {
      int mid = ((r - l + 1) >> 1) + l;

      if (pred(mid))
        l = mid;
      else
        r = mid - 1;
    }
    
    function<char(int)> qc = [&](int k) {
      if (k <= l)
        return k % (len + 1) == 0 ? 'B' : 'A';
      k = a + b - k + 1;
      return k % (len + 1) == 0 ? 'A' : 'B';
    };

    string ret;
    for (int k = c; k <= d; ++k)
      ret.push_back(qc(k));
    return ret;
  };
  while (q--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << query(a, b, c, d) << '\n';
  }

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
using namespace std;
int n,ans=0,a[30],b[30],c[30];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=n;i++){
		cin>>b[i];ans+=b[i];
	}
	for(int i=1;i<=n-1;i++){
		cin>>c[i];
	}
	for(int i=2;i<=n;i++){
		if(a[i]==a[i-1]+1) ans+=c[a[i-1]];
	}
	cout<<ans<<endl;
}

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

int main()
{
    int n;cin>>n;
    int arr[n][3];

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

    vector<vector<int>> r(n,vector<int>(3));
    r[0] = {arr[0][0],arr[0][1],arr[0][2]};

    for(int i = 1; i < n; i++)
    {
        for(int j  = 0; j < 3; j++)
        {
            switch (j)
            {
            case 0:
                r[i][j] = arr[i][j]+max(r[i-1][1],r[i-1][2]);
                break;
            case 1: 
                r[i][j] = arr[i][j]+max(r[i-1][0],r[i-1][2]);   
                break;
            default:
                r[i][j] = arr[i][j]+max(r[i-1][1],r[i-1][0]);
            }
        }
    }

    cout<<*max_element(r[n-1].begin(),r[n-1].end())<<"\n";
}

Measured memory_bytes: 6912
#include<bits/stdc++.h>
#define ll long long 
#define ull unsigned long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vvll vector<vll>
#define all(v) v.begin(),v.end()
#define itr(r,v) for(auto r=v.begin();r!=v.end();r++)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffor(i,a,b) for(ll i=a;i<=b;i++)
#define rfor(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl "\n"
#define pqmx priority_queue<ll>
#define pqmn priority_queue<ll,vll,greater<ll>>
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define ctime auto start = high_resolution_clock::now()
#define etime auto stop = high_resolution_clock::now()
#define ptime auto z1z = duration_cast<microseconds>(stop-start); cout<<"Time elapsed : "<<z1z.count()<<" microseconds\n"
#define dbg1(x)             cout <<#x<<": "<<x<<'\n';
#define dbg2(x, y)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<'\n';
#define dbg3(x, y, z)       cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<'\n';
#define dbg4(a, b, c, d)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<'\n';
#define dbg5(a, b, c, d, e) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<'\n';

using namespace std;
using namespace std::chrono;

const ll MOD = 1e9+7;
const ll N = 1e6+6;
const ll maxN = 1e7+7;
const ll MAX_SIZE = 2e5 + 5;

ll powerM(ll x,ll y, ll M = MOD) // default argument
{ll v=1; x=x%M; while(y>0){if(y&1)v=(v*x)%M;y = y>>1;x=(x*x)%M;} return v;}

ll power(ll x,ll y)
{ll v=1; x=x; while(y>0){if(y&1)v=(v*x);y = y>>1;x=(x*x);} return v;}

int main()
{
	#ifndef ONLINE_JUDGE
    	freopen("input2.txt", "r", stdin);
    	freopen("output2.txt", "w", stdout);
	#endif
	FIO
	ll n; cin>>n;
	ll ar[n];
	FOR(i,n) cin>>ar[i];
	sort(ar,ar+n);
	ll ans=ar[n-1];
	ll m=n-1;
	ll i=n-2;
	if(m == 2){
		ans += ar[i];
	}
	else{
	while(m>2){
		ans += 2*(ar[i]);
		i--;
		m-=2;
		if(m == 1){
			break;
		}
		else if(m == 2){
			ans += ar[i]; break;
		}
	}
}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 5180
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr const ll MODULO = 1000000007;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N), B(N);
    set<ll> pos;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        pos.insert(A[i]);
    }
    for (int i = 0; i < N; i++) {
        cin >> B[i];
        pos.insert(B[i]);
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    for (int i = 0; i < N; i++) {
        if (A[i] > B[i]) swap(A[i], B[i]);
    }

    unordered_map<ll, int> compress;
    int i = 0;
    for (auto it = pos.begin(); it != pos.end(); ++it, ++i) {
        compress[*it] = i;
    }
    assert(i == 2 * N);

    vector<int> overwrap(2*N);
    for (int i = 0; i < N; i++) {
        overwrap[compress[A[i]]]++;
        overwrap[compress[B[i]]]--;
    }

    int cursum = 0;
    for (auto &ow: overwrap) {
        ow = (cursum += ow);
    }

    vector<ll> dp(N+1);
    dp[0] = 1;
    for (int i = 0; i < N; i++) {
        dp[i+1] = (overwrap[compress[A[i]]] * dp[i]) % MODULO;
    }

    cout << dp[N] << endl;

    return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 8
typedef pair<i64, i64> P;

i64 N;
P town[MAX_N];
i64 perm[MAX_N];

void solve() {
  f64 m = 0;

  i64 n = 0;
  do {
    REPS(i, N - 1) {
      m += sqrt(pow((town[perm[i]].F - town[perm[i-1]].F), 2) + pow((town[perm[i]].S - town[perm[i-1]].S), 2));
    }
    n++;
  } while (next_permutation(perm, perm + N));

  m /= n;
  cout << m << endl;
}

int main() {
  cin >> N;
  i64 x, y;

  REP(i, MAX_N) {
    perm[i] = 0;
  }

  REP(i, N) {
    cin >> x >> y;
    town[i] = mp(x, y);
    perm[i] = i;
  }

  solve();

  return 0;
}

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

int main()
{
  int N;cin>>N;
  vector<tuple<int,string,string>> front;
  vector<tuple<int,string,string>> back;
  string S;cin>>S;long long count=0;
  for(int i=0;i<(1<<N);i++)
  {
  	string red,blue;
    int countred=0;
    for(int j=0;j<N;j++)if(i&(1<<j)){red+=S[j];countred++;}
    else blue=S[j]+blue;
    front.push_back({countred,red,blue});
  }
  for(int i=0;i<(1<<N);i++)
  {
  	string red,blue;
    int countred=0;
    for(int j=0;j<N;j++)if(i&(1<<j)){red+=S[N+j];countred++;}
    else blue=S[N+j]+blue;
    back.push_back({N-countred,blue,red});
  }
  sort(front.begin(),front.end());
  sort(back.begin(),back.end());
  long long i=0,j=0;
  while(i<front.size()&&j<back.size())
  {
    if(front[i]>back[j])j++;
    else if(front[i]<back[j])i++;
    else 
    {
      long long counti=1,countj=1;
      while(i+1<front.size())if(front[i+1]==front[i]){i++;counti++;}else break;
      while(j+1<back.size())if(back[j+1]==back[j]){j++;countj++;}else break;
      count+=(counti*countj);
      i++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 49452
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define LL long long

int main(){
	int k, mySize=1, i;
	std::string x;
	std::cin >> x >> k;

	std::vector<std::string> subStrings;
	std::string subString;
	int x_size = x.size();
	int minValue = std::min(5,x_size);

	while(mySize<=minValue){
		for(i=0;i<=x_size-mySize;i++){
			subString = x.substr(i,mySize);

			if(
				std::find_if(subStrings.begin(), subStrings.end(), [&subString](const std::string& s)-> bool{return subString==s;})
				!= subStrings.end()
			){
				continue;
			}

			if(subStrings.size()<6){
				subStrings.push_back(subString);
			} else {
				std::sort(subStrings.begin(), subStrings.end());
				subStrings[5] = subString;
			}

		}
		mySize++;
	}

	std::sort(subStrings.begin(),subStrings.end());
	subStrings.resize(std::unique(subStrings.begin(), subStrings.end()) - subStrings.begin() );

	std::cout << subStrings[k-1] << std::endl;

	return 0;
}


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

int main() {
 int n;
 cin >> n;
 int c=1,ans=n;
 for (int i = 0; i < n; i++){
   int x;
   cin >> x;
   if(x==c){
     c++;
     ans--;
   }
 }
 if(ans==n){
   cout << -1 << endl;
 }else{
   cout << ans << endl;
 }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define REP(i, n) for (Int i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (Int i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<Int, Int>;
template <class T> inline bool chmax(T& a, const T& b) {
    if (a >= b) return false;
    a = b;
    return true;
}
template <class T> inline bool chmin(T& a, const T& b) {
    if (a <= b) return false;
    a = b;
    return true;
}
struct in {
    int n;
    in() {}
    in(int n_) : n(n_){};
    template <class T> operator T() {
        T ret;
        cin >> ret;
        return ret;
    }
    template <class T> operator vector<T>() {
        vector<T> ret(n);
        for (int i = 0; i < n; i++) cin >> ret[i];
        return ret;
    }
};
struct SetupIO {
    SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); }
} setup_io;

#ifdef _MY_DEBUG
#include "/Users/knshnb/.competitive_local.hpp"
#else
#define dump(...)
#endif

/**
 *    author:  knshnb
 *    created: Sun Dec  1 21:00:11 JST 2019
 **/

template <class T, class S> vector<T> make_vec(size_t n, S x) { return vector<T>(n, x); }
template <class T, class... Ts> auto make_vec(size_t n, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(n, make_vec<T>(ts...));
}

signed main() {
    Int n = in();
    string s = in();
    auto nxt = make_vec<int>(n, 10, -1);
    vector<int> cur(10, n);
    for (int i = n - 1; i >= 0; i--) {
        cur[s[i] - '0'] = i;
        REP (j, 10) nxt[i][j] = cur[j];
    }
    Int ans = 0;
    REP (x, 10) {
        Int cur1 = nxt[0][x] + 1;
        if (cur1 >= n) continue;
        REP (y, 10) {
            Int cur2 = nxt[cur1][y] + 1;
            if (cur2 >= n) continue;
            REP (z, 10) {
                Int cur3 = nxt[cur2][z] + 1;
                if (cur3 >= n + 1) continue;
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 2432
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

int n,q,s[100005],l,r,i,a[100005];

char c;

int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>n>>q;
	for(i=1;i<=n;i++)
		cin>>c,s[i]=c=='A'?1:(c=='C'?-1:0);
	for(i=2;i<=n;i++)
		if(s[i-1]==1&&s[i]==-1)
			a[i]=1;
	for(i=2;i<=n;i++)
		a[i]+=a[i-1];
	for(i=1;i<=q;i++)
	{
		cin>>l>>r;
		printf("%d\n",a[r]-a[l]);
	}
	return 0;
}

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

int main(){
  int N, M, d[8][3];
  for (int i = 0; i < 8; i++){
    for (int j = 0; j < 3; j++){
      if ((i >> j) & 1){
        d[i][j] = 1;
      }else{
        d[i][j] = -1;
      }
    }
  }
  
  cin >> N >> M;
  int64_t x[N], y[N], z[N], ans[16] = {}, a = 0;
  vector<vector<int64_t>> V(8, vector<int64_t>(N));
  
  for (int i = 0; i < N; i++){
    cin >> x[i] >> y[i] >> z[i];
    for (int j = 0; j < 8; j++){
      V[j][i] = x[i] * d[j][0] + y[i] * d[j][1] + z[i] * d[j][2];
    }
  }
  
  for (int i = 0; i < 8; i++){
    sort(V[i].begin(), V[i].end());
  }

  for (int i = 0; i < M; i++){
    for (int j = 0; j < 8; j++){
      ans[j] += V[j][N-i-1];
      ans[j+8] += V[j][i];
    }
  }
  
  for (int i = 0; i < 16; i++){
    a = max(a, ans[i]);
  }
  
  cout << a << endl;
}

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

int main() {
    int inputs[3];
    int tmp, count, x, y;
    scanf("%d %d %d", &inputs[0], &inputs[1], &inputs[2]);

    sort(inputs, inputs + 3);

    x = inputs[2] * 10 + inputs[1];
    y = inputs[0];

    printf("%d\n", x + y);

    return 0;
}

Measured memory_bytes: 256
io = STDIN
n=io.gets.to_i
$coin=[1]
$max=100001
$dp=Array.new($max)
$dp[0]=0
def setup(p)
  i=1
  while (x=p**i;x<$max)
    $coin << x
    i+=1
  end
end
setup(6)
setup(9)
$coin.sort!
(1..$max).each do |i|
  $dp[i]=$coin.select{|x|x<=i}
              .map{|x|$dp[i-x]+1}
              .min
end
puts $dp[n]


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll a,b,ar[100008],i,j,k,m,x,y,cnt,sum,d,e,f,cr[100000],c;
string s1[1000],s,s2;
ll p;
int main()
{
    ll test;
   cin>>a>>s;
   for(i=0;i<s.size()-2;i++)
   {
       if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
       {cnt++;

       }
   }

    cout<<cnt<<endl;



}










Measured memory_bytes: 256
-- List of Top 3 Hills
import Control.Monad  -- replicateM
import Data.Ord       -- sortBy (comparing Down)
import Data.List      -- intercalate

main =
  replicateM 10 getLine >>= putStrLn . intercalate "\n" . map show . solve

solve :: [String] -> [Int]
solve = take 3 . sortBy (comparing Down) . map read

-- import Control.Monad
-- replicateM :: Monad m => Int -> m a -> m [a]
-- perform the action n times, gathering the results

Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int a,b,c,d,e,f,g,h,j;
int main(){
	for(int i=0;i<3;i++){
		cin>>a>>b>>c>>d>>e>>f;
		g=a*3600+b*60+c;
		h=d*3600+e*60+f;
		j=h-g;
		int a1=j/3600;
		int a2=(j/60)%60;
		int a3=j%60;
		cout<<a1<<' '<<a2<<' '<<a3<<endl;
	}
	return 0;
}

Measured memory_bytes: 3000
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  string s,t;
  cin >> s >> t;

  string u = s+s;

  int n = s.size();
  mat nx(2*n,vec(26,INF));
  REP(i,2*n-1) nx[i][u[i+1]-'a'] = i+1;
  RREP(i,2*n-1) REP(j,26) nx[i][j] = min(nx[i][j],nx[i+1][j]);

  // REP(i,2*n){
  //   REP(j,26) cout <<nx[i][j] << " ";
  //   cout << endl;
  // }

  int ans = 0, now = n-1;
  REP(i,t.size()){
    int id = nx[now][t[i]-'a'];
    if(id == INF){
      cout << -1 << endl;
      return 0;
    }
    ans += id-now;
    now = id%n;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 49104
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


N = int(input())
s = [input() for i in range(N)]

for i, s_i in enumerate(s):
    s_l = list(s_i)
    s_l.sort()
    a = ""
    for c in s_l:
        a += c
    s[i] = a

cnt = 0
count_dict = {}
for j in range(N):
    count_dict[s[j]] = 0
for k in range(N):
    count_dict[s[k]] += 1

for v in count_dict.values():
    if v >= 2:
        # cnt += int(factorial(v)) / int(factorial(2)) / int(factorial(v - 2))
        cnt += cmb(v, 2)

print(cnt)

Measured memory_bytes: 19476
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

vector<int> to[100000];
int color[100000];
void dfs(int u, int c) {
   color[u] = c;
   for (int v : to[u]) {
      if (color[v] == INF) dfs(v, c);
   }
}

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

   int n, m;
   cin >> n >> m;
   rep(i, 0, m) {
      int s, t;
      cin >> s >> t;
      to[s].push_back(t);
      to[t].push_back(s);
   }
   rep(i, 0, n) color[i] = INF;
   int c = 0;
   rep(i, 0, n) {
      if (color[i] == INF) {
         dfs(i, c++);
      }
   }
   int q;
   cin >> q;
   rep(i, 0, q) {
      int s, t;
      cin >> s >> t;
      if (color[s] == color[t])
         cout << "yes" << endl;
      else
         cout << "no" << endl;
   }
   return 0;
}


Measured memory_bytes: 12008
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

int main()
{
	ll N, M;
	cin >> N >> M;
	if (N > M) swap(N, M);
	if (N == 1 && M == 1) cout << 1 << endl;
	else if (N == 1 && M != 1) cout << M - 2 << endl;
	else cout << (N - 2) * (M - 2) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

int main(){
	ll a,b,c,d,e,f; cin >>a>>b>>c;
	if(a%2==1||b%2==1||c%2==1){
		cout << 0 << endl;
		return 0;
	}
	if(a==b&&b==c){
		cout <<-1 << endl;
		return 0;
	}
	ll cnt=0;
	while(a%2==0&&b%2==0&&c%2==0){
		ll d=a/2,e=b/2,f=c/2;
		a=e+f; b=d+f; c=e+d;
		cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
a = []
3.times do |temp|
  ai = gets.rstrip.split(" ").map { |c| c.to_i }
  a.push(ai)
end

n = gets.rstrip.to_i
hole = Array.new(3){Array.new(3, false)}
n.times do |temp|
  bi = gets.rstrip.to_i
  3.times do |i|
    3.times do |j|
      if a[i][j] == bi
        hole[i][j] = true
      end
    end
  end
end

if hole[0].all? \
    or hole[1].all? \
    or hole[2].all? \
    or 3.times.map{|i| hole[i][0]}.all? \
    or 3.times.map{|i| hole[i][1]}.all? \
    or 3.times.map{|i| hole[i][2]}.all? \
 	or 3.times.map{|i| hole[i][i]}.all? \
    or 3.times.map{|i| hole[i][2-i]}.all?
  puts "Yes"
else
  puts "No"
end
       

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>



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

  int a,b;
  cin>>a>>b;

  int res=1,ans=0;
  while(res<b){
    res--;
    res+=a;
    ans++;
  }
  cout<<ans<<endl;

}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
cnt = 0
f = False

while sum(h) != 0:
    for i in range(n):
        if h[i] != 0:
            f = True
            h[i] -= 1
        else:
            if f:
                cnt += 1
            f = False
    if f:
        cnt += 1
    f = False
print(cnt)

Measured memory_bytes: 3060
#include<stdio.h>

int main(void){
	int d[11][11];
	//int s[11];
	int n,i,j,temp;
	
	while(scanf("%d",&n)){
		if(n==0)
		break;
		
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				scanf("%d ",&d[i][j]);
			}
		}
		int s[11] = {0};
		for(i=0;i<n;i++){
			temp = 0;
			for(j=0;j<n;j++){
				printf("%5d",d[i][j]);
				temp+=d[i][j];
				s[j]+=d[i][j];
			}
			printf("%5d\n",temp);
		}
		temp = 0;
		for(i=0;i<n;i++)
		{
			printf("%5d",s[i]);
			temp+=s[i];
		}
		printf("%5d\n",temp);
	}
	return 0;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
//#define DEBUG
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define deb(x) std::cout << #x << " " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}
template<typename... T>
void write(T... a){
    ((cout << a << "\n"),...);
}

template<typename... T>
void write_space(T... a){
    ((cout << a << " "),...);
}

void solve(){
    ll n, x, m;
    read(n,x,m);
    map<ll,int> mp; 
    ll cur_term = x;
    ll sum = x; 
    int count = 1;
    int i;
    for( i = 1 ; i < n ; i++){
       cur_term = cur_term * cur_term; 
       if(cur_term >= m){
           cur_term = cur_term % m;
       }
       if(mp.find(cur_term) != mp.end()){
           break;
       }else{
           mp[cur_term]++;
       }
       sum += cur_term;
       count++;
    }
    if( i == n){
        cout  << sum << endl;
        return;
    }
    // deb(sum);
    ll period_sum = 0;
    ll period_term = cur_term;
    int period = 0;
    do{
        period++;
        period_sum += cur_term;
        cur_term = cur_term * cur_term;
        if(cur_term >= m){
            cur_term = cur_term % m;
        }
    }while(cur_term != period_term);
    n -= count;
    // deb(period);
    // deb(n);
    ll period_num = n / period;
    ll remain = n % period;
    sum += period_num * period_sum;
    cur_term = period_term;
    for(i = 0 ; i < remain ; i++){
       sum += cur_term; 
       cur_term = cur_term * cur_term;
       if(cur_term >= m){
           cur_term = cur_term % m;
       }
    }
    cout << sum << endl;
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/
    solve();
    return 0;
}



Measured memory_bytes: 6640
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H;
	string s;
	while(cin>>N) {
		ll ans = 0;
		RANGE(i, 1, N+1) {
			if(i%2==0) continue;
			ll c = 0;
			RANGE(j, 1, N+1) if(i%j==0)c++;
			if(c==8) ans++;
		}
		
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int A,B,C,D;
	cin>>A>>B>>C>>D;
  
	int X=(A+D-1)/D;
	int Y=(C+B-1)/B;
  
	if(X>=Y){
      cout << "Yes"<<endl;
    }else{
      cout << "No" <<endl;
    }
}


Measured memory_bytes: 3588
#pragma GCC target ("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<lint, lint>;
using vec = vector<lint>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n, m;
    cin >> n >> m;
    vector<pint> a(n);
    rep(i, n) {
        lint x, y;
        cin >> x >> y;
        a[i] = make_pair(x, y);
    }

    sort(all(a));

    lint res = 0;
    int c = 0;

    rep(i, n) {
        if (m - c <= a[i].second) {
            res += a[i].first * (m - c);
            break;
        }
        else {
            res += a[i].first * a[i].second;
            c += a[i].second;
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(){
  int x,y,work;
  while(1){
    scanf("%d %d",&x,&y);
    if(x==0&&y==0)break;
    if(x>y){
      work=y,y=x,x=work;
    }
    printf("%d %d\n",x,y);
  }
  return 0;
}

Measured memory_bytes: 2728
#include<stdio.h>
int main(){
	int W,H,x,y,z;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&z);
	if(x<0||y<0){
		printf("No\n");
	}
	else if(W>=x+z&&H>=y+z){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}	

Measured memory_bytes: 584
n = int(input())
nums = list(map(int, input().split()))

temp = 0
ans = 0

for i in range(n-1):
    if nums[i+1] <= nums[i]:
        temp += 1
    else:
        ans = max(temp, ans)
        temp = 0
ans = max(temp, ans)
print(ans)


Measured memory_bytes: 14100
import java.util.Scanner;

public class Main {
    private static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int n=sc.nextInt();
        int[] a=new int[n];
        int notprime=0;
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
            for(int j=2;j<=Math.sqrt(a[i]);j++){
                if(a[i]%j==0){
                    notprime++;
                    break;
                }
            }
        }
        System.out.println(n-notprime);
    }
}

Measured memory_bytes: 42420
//
//  main.cpp
//  atCoder_C
//
//  Created by 박다원 on 24/03/2019.
//  Copyright © 2019 박다원. All rights reserved.
//

#include <iostream>
#include <string>

using namespace std;

int checkArr[100005];

int main(int argc, const char * argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int n, q;
    cin >> n >> q;
    
    string str;
    cin >> str;
    
    for(int i = 1; i < str.size(); i++)
    {
        if(str[i] == 'C' && str[i-1] == 'A')
        {
            checkArr[i+1]++;
        }
        checkArr[i+1] += checkArr[i];
    }
    
    for(int i = 0; i < q; i++)
    {
        int f, s;
        cin >> f >> s;
        
        int ans = checkArr[s] - checkArr[f];
        cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 1488
(defun solver (&aux rate colornum min max)
  (let ((n (read)) (color (list 0 0 0 0 0 0 0 0)) (colorful 0))
    (loop repeat n do
          (setf rate (read))
          (cond ((<=   1  rate  399) (setf (nth 0 color) 1))
                ((<=  400 rate  799) (setf (nth 1 color) 1))
                ((<=  800 rate 1199) (setf (nth 2 color) 1))
                ((<= 1200 rate 1599) (setf (nth 3 color) 1))
                ((<= 1600 rate 1999) (setf (nth 4 color) 1))
                ((<= 2000 rate 2399) (setf (nth 5 color) 1))
                ((<= 2400 rate 2799) (setf (nth 6 color) 1))
                ((<= 2800 rate 3199) (setf (nth 7 color) 1))
                ((<= 3200 rate)      (incf colorful))))
    (setf colornum (apply #'+ color))
    (cond
      ((zerop colornum) (setf min 1 max colorful))
      ((<  colorful colornum) (setf min colornum max (+ colornum colorful)))
      ((>= colorful colornum) (setf min colornum max (+ colornum colorful))))
    (format t "~A ~A~%" min max)))

(solver)

Measured memory_bytes: 6632
n = int(input())
v = list( map(int, input().split(" ")) )
v.sort()
answer = 0

multipilier = 2**(len(v)-1)

for i in range(len(v)):
    answer = (v[i]/multipilier) + answer
    if i!=0:
        multipilier = multipilier/2

print(answer)


Measured memory_bytes: 3060
module Main (main) where

import qualified Data.ByteString.Char8 as C8
import Data.List
import Data.Maybe

main :: IO ()
main = do
  [n] <- readInts
  readInts >>= print . solve n

solve :: Int -> [Int] -> Int
solve n = g . foldl f (0, [], 0)
  where
    f (m, n, c) x
      | m >= x = (x, n, c+1)
      | otherwise = (x, c:n, 0)
    g (_, n, c) = maximum (c:n)

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

Measured memory_bytes: 5500
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


int main()
{
    int t=1,te=0;
    //Int(t);
    while(t--){
        int x;
        Int(x);

        if(x>=30)printf("Yes\n");
        else{
            printf("No\n");
        }     

        //printf("Case %d: ",++te);
    }
    return 0;
}






Measured memory_bytes: 3644
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldb = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")
#define MINS(a,b) a = min(a,(decltype(a))(b))
#define MAXS(a,b) a = max(a,(decltype(a))(b))

struct node {
	int id;
	int depa, dept;
	vector<int> link;
};
int N,u,v;
vector<node> nod;
void initdepa(int ind, int dep) {
	nod[ind].depa = dep;
	for (int c : nod[ind].link) {
		if (nod[c].depa != -1)continue;
		initdepa(c, dep + 1);
	}
}
void initdept(int ind, int dep) {
	nod[ind].dept = dep;
	for (int c : nod[ind].link) {
		if (nod[c].dept != -1)continue;
		initdept(c, dep + 1);
	}
}
int main() {
	cin >> N >> u >> v;
	--u; --v;
	nod.resize(N);
	REP(i, 0, N) {
		nod[i].id = i;
		nod[i].depa = -1;
		nod[i].dept = -1;
	}
	REP(i, 0, N - 1) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		nod[a].link.push_back(b);
		nod[b].link.push_back(a);
	}
	initdept(u, 0);
	initdepa(v, 0);
	ll ans = 0;
	REP(i, 0, N) {
		if (nod[i].link.size() == 1 && nod[i].depa > nod[i].dept) MAXS(ans, nod[i].depa - 1);
	}
	PRI(ans);
	return 0;
}




Measured memory_bytes: 12700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
const ll MOD = 1000000007;

struct edge{
    int to,weight;
    edge(int to,int weight):to(to),weight(weight){}
};
using Graph = vector<vector<int>> ;
using GraphEdge = vector<vector<int>> ;

long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}
int main(){
    int N,M;cin >> N >> M;
    int C; cin >> C;
    const int MAXM = 21;
    int B[MAXM];rep(i,M)cin >> B[i];
    int A[MAXM][MAXM];rep(i,N)rep(j,M)cin >> A[i][j];
    int ans = 0;
    rep(i,N){
        int tmp = C;
        rep(j,M){   
            tmp += A[i][j]*B[j];
        }
        if(tmp>0)ans++;
    }

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

Measured memory_bytes: 3656
//
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

int main(){

    
    for(ll N, K;cin >> N >> K;){
        ll ans = abs(N - K);
        ll t = N / K;
        chmin(ans, abs(N - K * t));
        chmin(ans, abs(N - K * (t + 1)));
        cout << ans << endl;        
    }


    return 0;
}

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

using namespace std;

const int N = 1e5 + 5;

int p[N], a[N];

int find(int x) { return p[x] < 0 ? x : p[x] = find(p[x]); }
void merge(int u, int v) {
  if ((u = find(u)) == (v = find(v))) return; 
  if (-p[u] > -p[v]) swap(u, v);
  p[v] += p[u];
  p[u] = v;
}
vector<int> e[N];
bool used[N];

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i)
    scanf("%d", a+i), --a[i];
  memset(p, -1, sizeof p);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d %d", &u, &v); --u, --v;
    merge(u, v);
  }
  for (int i = 0; i < n; ++i)
    e[find(i)].push_back(i);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (e[i].empty()) continue;
    for (int x : e[i])
      used[x] = 1;
    for (int x : e[i])
      ans += used[a[x]];
    for (int x : e[i])
      used[x] = 0;
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int dp[100001],ans=0;
vector<int> g[100001],rg[100001],r(0);

int rec(int i){
    if(dp[i]>=0){
        return dp[i];
    }
    int res=0;
    for(int j = 0;j < g[i].size();j ++){
        res = max(res,rec(g[i][j])+1);
    }
    return dp[i] = res;
}
int main(){
    int n,m;
    cin >> n >> m;
    fill(dp,dp+100001,-1);
    for(int i = 0;i < m;i ++){
        int x,y;
        cin >> x >> y;
        g[y].push_back(x);
        rg[x].push_back(y);
    }
    for(int i = 1;i <= n;i ++){
        if(rg[i].size()==0) r.push_back(i);
    }
    for(int i = 0;i < r.size();i ++){
        ans = max(ans,rec(r[i]));
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 16256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;

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


int main() {
    string S; cin>>S;
    int ans=0;
    if(S=="SUN"){
        ans=7;
    }else if(S=="MON"){
        ans=6;
    }else if(S=="TUE"){
        ans=5;
    }else if(S=="WED"){
        ans=4;
    }else if(S=="THU"){
        ans=3;
    }else if(S=="FRI"){
        ans=2;
    }else if(S=="SAT"){
        ans=1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

void solve() {
  ll N;
  cin >> N;
  vector<pair<string, ll>> ST(N);
  rep (i, N) {
    string s;
    ll t;
    cin >> s >> t;
    ST[i] = make_pair(s, t);
  }
  string X;
  cin >> X;
  ll ans = 0;
  rep (i, N) {
    ans += ST[i].second;
  }
  rep (i, N) {
    ans -= ST[i].second;
    if (X == ST[i].first) break;
  }
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}


Measured memory_bytes: 256