akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = 0;

int main(void){
	int n; cin >> n;
	rep(i, n+1){
		if(i % 3 != 0 && i % 5 != 0) ans += i;
	}


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

Measured memory_bytes: 3640
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
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 T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

int main(){
  ll N,ans=1,K=-1;
  string S,T;
  cin >> N;
  cin >> S >> T;
  rep(i,N){
    if(S[i]==T[i]){
      if(K==-1){
        ans*=3;
      }
      else if(K==1){
        ans*=2;
      }
      else{
        ans*=1;
      }
      K=1;
    }
    else{
      i++;
      if(K==-1){
        ans*=6;
      }
      else if(K==1){
        ans*=2;
      }
      else{
        ans*=3;
      }
      K=2;
    }
    ans%=MOD;
  }
  cout << ans << endl;
}

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

int64_t exec(const vector<vector<int>>& children, const vector<int64_t>& x, int root) {
  if (children[root].empty()) {
    return 0L;
  }

  constexpr auto kMax = 1000 * 5000;
  unordered_set<int64_t> nums;
  nums.insert(0);
  int64_t total = 0;
  for (auto c : children[root]) {
    auto p = exec(children, x, c);
    if (p < 0) {
      return p;
    }
    unordered_set<int64_t> next;
    for (auto n : nums) {
      if (n + x[c] <= x[root]) {
        next.insert(n + x[c]);
      }
      if (n + p <= x[root]) {
        next.insert(n + p);
      }
    }
    if (next.empty()) {
      return -1;
    }
    nums.swap(next);
    total += x[c] + p;
  }
  
  for (int64_t i = x[root]; i >= 0; --i) {
    if (nums.count(i) > 0) {
      return total - i;
    }
  }
  
  return -1;
}

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

  vector<vector<int>> children(n);
  for (auto i : irange(1, n)) {
    int parent;
    cin >> parent;
    children[parent - 1].push_back(i);
  }
  
  vector<int64_t> x(n);
  for (auto&& xx : x) {
    cin >> xx;
  }
  
  if (exec(children, x, 0) >= 0) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}


Measured memory_bytes: 512
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	min := N - 1
	for i := 1; i*i <= N; i++ {
		if N%i > 0 {
			continue
		}
		j := N / i
		min = Min(min, i-1+j-1)
	}
	fmt.Println(min)
}

func Min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 1788
import java.util.*;
public class Main {
    public static void main(String[] args) {	
	Main main = new Main();
    	main.solveB();
    }
    
    private void solveA() {
	Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
	int b = sc.nextInt();
	int c = sc.nextInt();

	int max = Math.max(a,Math.max(b,c));
	int min = Math.min(a,Math.max(b,c));
	
    	System.out.println(max-min);
    }
 private void solveB() {
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	String t = sc.next();
	int l = s.length();
	String ans = "No";

	for(int i=0; i < l; i++){
	    t = t.charAt(l-1) + t;
	    t = t.substring(0,l);
	    if (s.equals(t))  ans = "Yes";
	}
	System.out.println(ans);
	
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
#define MAX_V 1000
#define INF 1e16
typedef pair<ll,int> edge;
#define cost first
#define to second
vector<edge> g[MAX_V];
ll dp[MAX_V];
bool usedV[MAX_V];
map<pair<int,int>,bool> usedE;

void dijkstra(int start){
    priority_queue<edge,vector<edge>> pq;
    pq.push({dp[start]=0,start});
    while(pq.size()){
        edge pr=pq.top(); pq.pop();
        int v=pr.second;
        if(usedV[v] && pr.first < dp[v]) continue;
        for(edge e : g[v]){
            if(dp[e.to] >= INF) continue;
            if(!usedV[e.to] || dp[e.to] < dp[v]+e.cost){
                dp[e.to] = (usedE[{v,e.to}] ? INF : dp[v]+e.cost);
                pq.push({dp[e.to],e.to});
                usedV[e.to] = true;
                usedE[{v,e.to}] = true;
            }
        }
    }
}

int main(void){
    int N,M;
    cin>>N>>M;
    rep(i,M){
        int a,b,c;
        cin>>a>>b>>c;
        --a,--b;
        g[a].push_back({c,b});
    }

    dijkstra(0);
    if(dp[N-1] >= INF) {
        cout<<"inf"<<endl;
    }else{
        cout<<dp[N-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 512
A, B, C, D, E, F = map(int, input().split())
x_list = []
y_list = []
noudo = []
for i in range(F):
    for j in range(F):
        if C*i + D*j <= F:
            y_list.append(C*i + D*j)

for i in range(F//100):
    for j in range(F//100):
        if A*i + B*j <= F//100:
            x_list.append(100 * (A*i + B*j))
x_list.remove(0)
for x in x_list:
    for y in y_list:
        if x+y <= F and y / (x+y) <= E / (100+E):
            noudo.append([y / (x+y), x+y, y])

ans = max(noudo)
print(ans[1], ans[2])

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

vector<int> node[100000];
ll dp[100000], ans[100000];
ll mod;

void dfs(int p, int par = -1) {
  dp[p] = 1;
  ll prod = 1;
  for (int i : node[p]) {
    if (i == par) continue;
    dfs(i,p);
    (prod *= dp[i]) %= mod;
  }
  (dp[p] += prod) %= mod;
}

void dfs2(int p, ll top = 1, int par = -1) {
  ans[p] = ((dp[p]-1+mod)*top+mod)%mod;
  vector<ll> pref = {top};
  for (int i : node[p]) {
    if (i == par) continue;
    pref.push_back(pref.back()*dp[i]%mod);
  }
  reverse(node[p].begin(), node[p].end());
  ll post = 1;
  for (int i : node[p]) {
    if (i == par) continue;
    pref.pop_back();
    dfs2(i,(pref.back()*post+1)%mod,p);
    (post *= dp[i]) %= mod;
  }
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n >> mod;
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    node[a].push_back(b);
    node[b].push_back(a);
  }
  dfs(0);
  dfs2(0);
  for (int i = 0; i < n; i++)
    cout << ans[i] << '\n';
}


Measured memory_bytes: 18560
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 5e5 + 10;
char s[N];
int n,f[N];

int main(){
    scanf("%d%s",&n,s+1);
    rep(i,0,n+1) {
        if(i) f[i] = max(f[i-1] , f[i]);
        if(i >= 3 && s[i] == '1' && s[i-1] == '0'){
            for(int j=i-2;j>=1&&s[j]=='1';--j)
                f[i] = max(f[i] , f[j-1] + i - j - 1);
        }
        if(i+3<=n && s[i+1] == '1' && s[i+2] == '0'){
            for(int j=i+3;j<=n&&s[j]=='1';++j)
                f[j] = max(f[j] , f[i] + j - i - 2);
        }
    }
    printf("%d\n",f[n]);
    return 0;
}


Measured memory_bytes: 2688
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

#define rep(i, b, e) for(int (i) = (b); (i) < (e); (i)++)
#define repm(i, b, e) for(int (i) = (b); (i) < (e); (i)--)

int main() {
  
  int S;

  cin >> S;

  bool mmxx = false;
  bool xxmm = false;

  int upper = S/100;
  int lower = S%100;

  if (upper < 13 && upper != 0) mmxx = true;
  if (lower < 13 && lower != 0) xxmm = true;
  
  string ans = "NA";

  if (mmxx && xxmm) ans = "AMBIGUOUS";
  else if (mmxx)    ans = "MMYY";
  else if (xxmm)    ans = "YYMM";
  
  cout << ans << endl;
  

  

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;

int main(){
  string S, T;
  cin >> S >> T;
  //入力終わり

  //辞書順最小を入れる
  string min = S;
  rep(i, S.size() )
    min[i] = 'z';

  //minを更新したかどうか
  bool update = false;
  
  string tmp = min;
  
  rep(i, S.size() ){
    //部分文字列が見つかるか
    bool flag = true;
    rep(j, T.size() ){
      if(S[i+j] != T[j] && S[i+j] != '?')
	flag = false;
    }

    //部分文字列が見つかったとき
    if(flag){
      //tmpに文字列を入れていく
      rep(k, S.size() ){
	//Tと一致した区間外は?をaに置換
	if(k<i || i+T.size()<=k){
	  if(S[k] == '?')
	    tmp[k] = 'a';
	  else
	    tmp[k] = S[k];
	}
	//区間内はTで置換
	else
	  tmp[k] = T[k-i];
      }// k roop
      
      //最小値の更新
      if(tmp < min){
	rep(k, S.size() )
	  min[k] = tmp[k];
	update = true;
      }
    } //if
  }

  //updateしてたらOK
  if(update){
    rep(i, S.size() )
      cout << min[i] ;
  }
  //してなければNG
  else
    cout << "UNRESTORABLE" ;
  cout << endl;
  
  return 0;
}


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

using namespace std;

using ll = long long;

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

    int n;
    string s;
    cin >> n >> s;

    deque<char> deq;
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == '(') {
            ++cnt;
            deq.push_back(s[i]);
        }
        else {
            if (cnt <= 0) {
                deq.push_front('(');
                deq.push_back(')');
            }
            else {
                --cnt;
                deq.push_back(')');
            }
        }
    }

    while (cnt--) deq.push_back(')');

    for (char c : deq) cout << c;
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using itn = int;
using ld = long double;
template<class T>
using vec = vector<T>;

#define FOR(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define all(x) (x).begin(),(x).end()


int main(){
  int n,c,k;
  cin >>n >>c >>k;
  vec<int> t(n);
  REP(i,n) cin >>t[i];

  sort(all(t));
  int ans=0;
  for(int i=0;i<n;){
    int tot=t[i]+k,ii=i,count=0;
    while(count < c){
      if(t[ii] <= tot){
        ++count;
      }else{
        break;
      }
      ++ii;
    }
    ++ans;
    i += count;
  }

  cout <<ans <<endl;
}


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

bool prime(int p){
for(int i=2;i*i<=p;i++)
if(!(p%i))return false;
return true;
}

int main(){
int n,p,ans=0;
cin >> n;
for(int i=0;i<n;i++){
cin >> p;
if(prime(p))ans++;
}
cout << ans << endl;
}

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

int main() 
{
    int n;
    int pointT = 0, pointH = 0;
    string taro, hanako;


    cin >> n;

    for( int i = 0; i < n; i++ )
    {
        cin >> taro >> hanako;

        if( taro > hanako )
            pointT += 3;

        else if ( taro < hanako )
            pointH += 3;

        else
        {
            pointT += 1;
            pointH += 1;
        }
    }

    cout << pointT << " " << pointH << endl; 

    return 0;
}


Measured memory_bytes: 3208
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#define all(x) (x).begin(),(x).end()
typedef long long ll;

using namespace std;

int main(){
    int N;  cin >> N;
    ll ans = 0;
    vector<int> v(N);
    for(int i=0; i<N; i++)  cin >> v[i];
    sort(all(v),greater<int>());
    for(int i=0; i<N-1; i++){
        ans += v[(i+1)/2];
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 4040
#include <bits/stdc++.h>
#define rep(i, f, n) for (ll i = (f); i < (ll)(n); i++)
#define repe(i, f, n) for (ll i = (f); i <= (ll)(n); i++)
using namespace std;
using ll = long long;
using GraphI = vector<vector<int>>;
using GraphC = vector<vector<char>>;
using pint = pair<int, int>;

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

  return 0;
}


Measured memory_bytes: 3668
import java.util.*;
class Main{
    Scanner sc=new Scanner(System.in);
    void main(){
	while(true){
	    int n=sc.nextInt();
	    if(n==0)break;
	    int[] prt=new int[n+1];
	    int[] x=new int[n];
	    for(int i=0;i<n+1;i++){
		prt[i]=sc.nextInt();
		
	    }
	    for(int i=0;i<n+1;i++){
		boolean ts=true;
		int size=0;
		for(int j=0;j<n+1;j++){
		    if(j!=i){
			x[size]=prt[j];
			size++;
		    }
		}
		for(int j=1;j<n-1;j++){
		    if(x[0]-x[1]!=x[j]-x[j+1])ts=false;
		}


		if(ts){
		     System.out.println(prt[i]);
		     break;
		}
	    }
	}
    }
    public static void main(String[]ag){
	new Main().main();
    }
}

Measured memory_bytes: 43964
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	long long int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin >> a.at(i);
	}
	long long int num = 1, ans = 0;
	for(int i=0;i<n;i++){
		if(a.at(i) == num){
			num++;
		}else{
			ans++;
		}
	}
	if(num == 1){
		cout << -1 << endl;
	}else{
		cout << ans << endl;
	}
}

Measured memory_bytes: 1024
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

def gcd( a, b ):
  while b > 0:
    a, b = b, a%b
  return a

def lcm( a, b ):
  return a*b/gcd( a, b )

for s in sys.stdin:
  d = map(int, s.split())
  a,b = d[0],d[1]
  print gcd(a,b),lcm(a,b)

Measured memory_bytes: 4208
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
const int N = 200003, M = N << 2;
template<typename T>
inline void read(T &x){
    int ch = getchar(); x = 0;
    for(;ch < '0' || ch > '9';ch = getchar());
    for(;ch >= '0' && ch <= '9';ch = getchar()) x = x * 10 + ch - '0';
}
int n, S, T, p[N], q[N], head[N], to[M], nxt[M], cap[M], cp[N], cq[N], cc, ans;
inline void add(int a, int b, int c){
	static int cnt = 1;
	to[++ cnt] = b; nxt[cnt] = head[a]; head[a] = cnt; cap[cnt] = c;
	to[++ cnt] = a; nxt[cnt] = head[b]; head[b] = cnt; cap[cnt] = 0;
}
int dep[N], cur[N], qu[N], f, r;
inline bool bfs(){
	memset(dep, -1, sizeof dep);
	memcpy(cur, head, sizeof cur);
	f = r = 0; qu[r ++] = S; dep[S] = 0;
	while(f < r){
		int x = qu[f ++];
		for(Rint i = head[x];i;i = nxt[i])
			if(cap[i] && dep[to[i]] == -1){
				dep[to[i]] = dep[x] + 1;
				qu[r ++] = to[i];
			}
	}
	return ~dep[T];
}
inline int dfs(int x, int lim){
	if(x == T || !lim) return lim;
	int flow = 0, f;
	for(Rint i = cur[x];i;i = nxt[i]){
		cur[x] = i;
		if(dep[to[i]] == dep[x] + 1 && (f = dfs(to[i], min(lim, cap[i])))){
			flow += f; lim -= f; cap[i] -= f; cap[i ^ 1] += f;
			if(!lim) break;
		}
	}
	return flow;
}
int main(){
	read(n); ans = n;
	for(Rint i = 1;i <= n;++ i) read(p[i]), ++ p[i];
	for(Rint i = 1;i <= n;++ i) read(q[i]), ++ q[i];
	for(Rint i = 1;i <= n;++ i) if(!cp[i]){
		cp[i] = ++ cc;
		for(Rint x = p[i];x != i;x = p[x]) cp[x] = cc;
	}
	for(Rint i = 1;i <= n;++ i) if(!cq[i]){
		cq[i] = ++ cc;
		for(Rint x = q[i];x != i;x = q[x]) cq[x] = cc;
	}
	S = ++ cc; T = ++ cc;
	for(Rint i = 1;i <= n;++ i)
		if(p[i] == i && q[i] == i) -- ans;
		else if(p[i] == i) add(cq[i], T, 1);
		else if(q[i] == i) add(S, cp[i], 1);
		else {
			add(cq[i], cp[i], 1);
			if(p[i] == q[i]) add(cp[i], cq[i], 1);
		}
	while(bfs()) ans -= dfs(S, 1e9);
	printf("%d\n", ans);
}

Measured memory_bytes: 16640
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <list>
#include <deque>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#define ll long long
#define INF 0x3f3f3f3f
#define SIS std::ios::sync_with_stdio(false)
using namespace std;
ll fast_pow(ll a,ll b,ll mod)
{
    ll c=1;
    while(b>=2)
    {
        if(b%2==0)
            a*=a,b/=2;
        else
            c*=a,a*=a,b--,b/=2;
        a%=mod,c%=mod;
    }
    return (a*c)%mod;
}

int main()
{
    ll a,b,c;
    while(cin>>a>>b>>c)
    {
        swap(a,b);
        swap(a,c);
        cout<<a<<" "<<b<<" "<<c<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
  static int count = 0;

  static void trace(int[] a){
    int i;
    for(i = 0; i < a.length - 1; i++)
      System.out.print(a[i] + " ");
    System.out.println(a[i]);
  }

  static void merge(int[] a, int left, int mid, int right){
    int n1 = mid - left;
    int n2 = right - mid;
    int[] L = new int[n1+1];
    int[] R = new int[n2+1];

    for(int i = 0; i < n1; i++)
      L[i] = a[left + i];

    for(int i = 0; i < n2; i++)
      R[i] = a[mid + i];

    L[n1] = 1000000001;
    R[n2] = 1000000001;

    int i = 0;
    int j = 0;

    for(int k = left; k < right; k++){
      if(L[i] <= R[j])
        a[k] = L[i++];
      else
        a[k] = R[j++];
      count++;
    }
  }

  static void mergeSort(int[] a, int left, int right){
    if(left + 1 < right){
      int mid = (left + right) / 2;
      mergeSort(a, left, mid);
      mergeSort(a, mid, right);
      merge(a, left, mid, right);
    }
  }

  public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] A = new int[n];

    for(int i = 0; i < n; i++)
      A[i] = stdIn.nextInt();

    mergeSort(A, 0, n);
    trace(A);
    System.out.println(count);
  }
}

Measured memory_bytes: 169648
n,x=map(int,input().split())
d=list(map(int,input().split()))
D=0
s=[0]
count=0

for i in range(n):
  D+=d[i]
  s.append(D)
for j in range(n+1):
  if x >= s[j]:
    count+=1
print(count)

Measured memory_bytes: 3064
def resolve():
	w, h, n = map(int, input().split())
	r = [[True]*w for _ in range(h)]
	for _ in range(n):
		ix, iy, a = map(int, input().split())
		if a == 1:
			for i in range(h):
				for j in range(ix):
					r[i][j] = False
		elif a == 2:
			for i in range(h):
				for j in range(ix, w):
					r[i][j] = False
		elif a == 3:
			for i in range(iy):
				for j in range(w):
					r[i][j] = False
		else:
			for i in range(iy, h):
				for j in range(w):
					r[i][j] = False
	ans = 0

	for row in r:
		for i in row:
			if i:
				ans += 1
	print(ans)
resolve()

Measured memory_bytes: 41712
#include<bits/stdc++.h>
#define fi first
#define er erase
#define in insert
#define se second
#define pp pop_back
#define pb push_back
#define mp make_pair
#define ll long long
#define vec vector<int>
#define pii pair<int,int>
#define smin(a,b) (a=min(a,b))
#define smax(a,b) (a=max(a,b))
#define fl(a,x) memset(a,x,sizeof a)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define cs ios_base::sync_with_stdio(0),cin.tie(0)
using namespace std;
const int mx=2e5+10;
int main(){
    cs;
    int x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
    rep(i,y2-y1) cout<<'U';
    rep(i,x2-x1) cout<<'R';
    rep(i,y2-y1) cout<<'D';
    rep(i,x2-x1) cout<<'L';
    cout<<'L';
    rep(i,y2-y1+1) cout<<'U';
    rep(i,x2-x1+1) cout<<'R';
    cout<<"DR";
    rep(i,y2-y1+1) cout<<'D';
    rep(i,x2-x1+1) cout<<'L';
    cout<<'U';
}


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

Measured memory_bytes: 256
#include <iostream>
#include <string>

int main()
{
	std::string s;
	int head;
	int tail;
	std::cin >> s;
	head = std::stoi(s.substr(0, 2));
	tail = std::stoi(s.substr(2, 2));
	
	if (head < 1 || head > 12)
	{
		if (tail >= 1 && tail <= 12)
			std::cout << "YYMM\n";
		else
			std::cout << "NA\n";
	}
	else if (tail < 1 || tail > 12)
		std::cout << "MMYY\n";
	else
		std::cout << "AMBIGUOUS\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
#define f first
#define s second
using namespace std;
const int INF=(int)0x3f3f3f3f;
const int MOD=(int)1e9+7;
const double eps=1e-9;
int dist(vector<int> a,vector<int> b);
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,d,d2,tmp,ans=0;
    cin>>n>>d;
    vector<vector<int>> p(n);
    for(int i=0;i<n;i++)
        for(int j=0;j<d&&cin>>tmp;j++)
            p[i].push_back(tmp);
    for(int i=0;i<n;i++)
        for(int j=i+1;j<n;j++)
            d2=dist(p[i],p[j]),
            ans+=((int)sqrt(d2)*(int)sqrt(d2))==d2;
    cout<<ans;
    return 0;
}

int dist(vector<int> a,vector<int> b)
{
    int ret=0;
    for(int i=0;i<a.size();i++)
        ret+=(a[i]-b[i])*(a[i]-b[i]);
    return ret;
}


Measured memory_bytes: 3588
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main {
 
	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
 
		long N = Long.parseLong(W);
 
		long ans =0;
		if(N%2 == 1){
			//奇数の場合は0
			ans =0;
		}else{
//			ans=N/10;
			for(long i=5;i<=N;i*=5){
				ans+=((N/2)/i);
			}
		}
 
		System.out.println(ans);
 
	}
}


Measured memory_bytes: 23380
#include <stdio.h>
//#include <string.h>

int main(void){

  //char s[11];
  //char *a,*b;
  int a,b= 0;
  scanf("%d %d", &a, &b);
	/*
  if(a<b){
    int temp;
    temp = *a;
    *a = *b;
    *b = temp;
  }
  */


	if((a+b)%2==0) printf("%d", (a+b)/2);
  	else printf("IMPOSSIBLE\n");

  
  return 0;
}

  

Measured memory_bytes: 1692
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;

int cnt = 0;
vector<int> A(10010);
vector<vector<int>> ans(110, vector<int>(110));
void update(int i, int j){
  int color = cnt+1;
  A[cnt]--;
  if(A[cnt] == 0) cnt++;
  ans[i][j] = color;
}

signed main() {
  int H, W, N; 
  cin >> H >> W >> N;

  REP(i, N) cin >> A[i];

  REP(i, H){
    if(i%2 == 0) REP(j, W) update(i, j);
    else RREP(j, W) update(i, j);
  }

  REP(i, H){
    REP(j, W){
      cout << ans[i][j]; SPBR(j, W);
    }
  }

  return 0;
}

Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define pii pair<int, int>
#define pll pair<long long, long long>
const double PI = acos(-1);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll X,Y; cin >> X >> Y;
    cout << ((abs(X-Y)>1) ? "Alice" : "Brown") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n,i,j;string w;cin >> n;bool ok = true,c = true;
  vector<string> f;
  for(i=0;i<n;i++){
    cin >> w;
    for(j=0;j<i;j++){
      if(w==f[j]) c = false;
    }
    if(i==0 || (i!=0 && c && f[i-1][f[i-1].size()-1]==w[0])) f.push_back(w);
    else{
      ok = false;break;
    }
  }
  cout << ((ok) ? "Yes":"No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
//template<class T>void max(T a,T b){if(a<b)return b;else return a;}
//template<class T>void min(T a,T b){if(a>b)return b;else return a;}
//template<class T>bool Max(T&a, T b){if(a < b){a = b;return 1;}return 0;}
//template<class T>bool Min(T&a, T b){if(a > b){a = b;return 1;}return 0;}

//////////////////////////


int main(){fastio
    ll n;cin>>n;
    ll a[n][3];rep(i,0,n-1)rep(j,0,2)cin>>a[i][j];
    ll dp[n+1][3];memset(dp,0,sizeof(dp));
    rep(i,0,n-1){
        rep(j,0,2){
            rep(pre,0,2){
                if(j==pre)continue;
                Max(dp[i+1][j],dp[i][pre]+a[i][j]);
            }
        }
    }
    ll ans=0;rep(j,0,2)Max(ans,dp[n][j]);
    cout<<ans<<endl;
    return 0;
}



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

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)
#define repj(i,j,n) for(i=j;i<n;i++)

#define PB(a,i) (a).push_back(i)
#define ALL(a) (a).begin(),(a).end()
#define SIZE(a,n) (a).resize(n)
#define SORT(a) sort(ALL(a))
#define RSORT(a, type) sort(ALL(a),greater<type>())
#define MAPIN(a,i,j) (a).insert(make_pair(i,j))
#define PREC(n) setprecision(n)

#define OK(i) cout<<"OK "<<i<<endl
#define Yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl

#define M (pow(10,9)+7)

using namespace std;

typedef unsigned long long lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > Matrix;

ll comb(ll n,ll r){
    vi nume,deno;
    ll i,j,k;
    if(n-r<r)r=n-r;
    if(r==0)return 0;
    if(r==1)return n;
    SIZE(nume,r);
    SIZE(deno,r);
    rep(k,r){
        nume[k]=n-r+k+1;
        deno[k]=k+1;
    }
    repj(i,2,r+1){
        int pivot=deno[i-1];
        if(pivot>1){
            int offset=(n-r)%i;
            for(k=i-1;k<r;k+=i){
                nume[k-offset]/=pivot;
                deno[k]/=pivot;
            }
        }
    }
    j=1;
    rep(k,r){
        if(nume[k]>1)j*=nume[k];
        j%=(ll)M;
    }
    return j;
}

int main() {
	ll x,y,i,j,a,b;
    Matrix z;
    cin>>x>>y;

    a=0;
    b=0;
    for(i=x;i>=0;i--){
        if((x-i)%2!=0)continue;
        j=(x-i)/2;
        if(y==i*2+j){
            a=i;
            b=j;
        }
    }
    if(a==0 && b==0){
        cout<<0;
    }
    else if(a==0 || b==0){
        cout<<1;
    }
    else{
        cout<<comb(a+b,min(a,b));
    }

	return 0;
}


Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    int a,b;
    cin >> a >> b;
    int sum=1;
    int co=0;
    while(1){
        if(b<=sum){
            cout << co << endl;
            return 0;
        }
        sum-=1;
        sum+=a;
        co++;
    }
}

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

main()
{
    int N;
    cin >> N;
    string n = to_string(N);
    if (n.find("9") != std::string::npos) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define repp(i, n) rep(i, n)
#define reppp(i, n) repp(i, n)
#define rrepp(i, n) rrep(i, n)
#define repss(i, n) reps(i, n)
#define repcc(i, n) repc(i, n)
#define repii(i, a, b) repi(i, a, b)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  i64 L, R; cin >> L >> R;
  if (R - L >= 2019) {
    cout << 0 << '\n';
    return;
  }
  i64 ans = 1e18;
  for (i64 i = L; i <= R; i++)
  for (i64 j = i + 1; j <= R; j++) {
    amin(ans, (i * j) % 2019);
  }
  cout << ans << '\n';
}


Measured memory_bytes: 256
a = [0] * 3
for i in range(3):
    a[i] = list(map(int, input().split()))
n = int(input())
b = set()
for _ in range(n):
    b.add(int(input()))

if (
    set(a[0]) <= b
    or set(a[1]) <= b
    or set(a[2]) <= b
    or set(x[0] for x in a) <= b
    or set(x[1] for x in a) <= b
    or set(x[2] for x in a) <= b
    or {a[0][0], a[1][1], a[2][2]} <= b
    or {a[0][2], a[1][1], a[2][0]} <= b
):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 62100
#include <bits/stdc++.h>
    using namespace std;
     
    int main()
    {
    long long n,a,i,x;
      float sum=0.0;
      
      priority_queue<float,vector<float>,greater<float>>val;
      
      cin>>n;
      
      for(i=0;i<n;i++)
      {
        cin>>x;
        val.push(x);
      }
      
      while(val.size()>1)
      {
       
        float v1=val.top();
        val.pop();
        float v2=val.top();
        val.pop();
        
        float v3=(float) (v1+v2)/2;
        val.push(v3);
        
      }
      
      printf("%lf\n",val.top());
      
     return 0; 
    }

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

using namespace std;

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

#define ll long long

int main()
{
	int n;
	cin >> n;
	int a, ans = 0;
	rep (i, n) {
		cin >> a;
		ans += a - 1;
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9+ 7;
const int INF = 1e9;

int main() {
    int N;
    double M;
    cin >> N >> M;
    vector<double> A(N);
    double sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        sum += A[i];
    }
    sort(A.rbegin(), A.rend());
    int count = 0;
    for (int i = 0; i < N; i++) {
        if (A[i] < sum / (4 * M)) count++;
    }
    cout << (N - count >= M ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define rg register
#define ll long long
#define CL(a,b) memset(a,b,sizeof a)
const int N=2e5+7,inf=0x3f3f3f3f;
char s[N];
int a[N];
int black[N],white[N];
int main()
{
    int n;
    cin>>n>>s;
    for(int i=0;i<n;i++)
        if(s[i]=='.')
        a[i+1]=0;
        else a[i+1]=1;
        int ans=inf;
    for(int i=1;i<=n;i++)
        if(a[i]==0)
        {
            white[i]=white[i-1]+1;
            black[i]=black[i-1];
        }
        else
        {
            black[i]=black[i-1]+1;
            white[i]=white[i-1];
        }
    for(int i=0;i<=n;i++)
        ans=min(black[i]+white[n]-white[i+1],ans);
        cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 2816
#include <stdio.h>

int main (void) {
    int m, d;
    scanf("%d%d", &m, &d);

    int day_1, day_10;
    int product_day_n = 0;
    for (int month = 1; month <= m; month++) {
        for (int day = 1; day <= d; day++) {
            day_1 = day % 10;
            day_10 = day / 10;
                if ( day_1 >= 2 && day_10 >= 2
                     && month == day_1 * day_10 ) {
                         product_day_n++;
                     }
        }
    }

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

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

int main(){
  int H, A;
  cin >> H >> A;
  cout << (H + A - 1) / A << endl;
}

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

int main(){
    string S;
    cin >> S;
    string out = "AC";
    if(S.at(0) != 'A')  out = "WA";

    int length = S.size();
    int cnt = 0;
    for(int i = 1; i < length; i++)
    {
        if (isupper(S.at(i))) {
            if(i == 1 || i == length - 1 || S.at(i) != 'C') out = "WA";
            cnt++;
        }
        
    }
    if(cnt != 1) out = "WA";
    cout << out << endl;
    
}

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

int main(void)
{
    int N, M;
    cin >> N >> M;
    vector<int> v[2];

    for (int i = 0; i < M; i++)
    {
        int s, c;
        cin >> s >> c;
        v[0].push_back(--s);
        v[1].push_back(c);
    }

    for (int i = 0; i <= 999; i++)
    {
        bool false_flag = 0;
        string i_str = to_string(i);
        if (i_str.size() != N)
            continue;

        for (int j = 0; j < M; j++)
        {
            if (i_str[v[0][j]] != v[1][j] + '0')
            {
                false_flag = 1;
                break;
            }
        }

        if (false_flag == 1)
        {
            continue;
        }
        else
        {
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;
    return 0;
}

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

int main()
{
    int a[3][3];
    int x[3],y[3];
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            cin >> a[i][j];
        }
    }

    x[0] = 0;
    for(int i=0; i<3; i++){
        y[i] = a[0][i] - x[0];
    }
    for(int i=0; i<3; i++){
        x[i] = a[i][0] - y[0];
    }
    bool good = true;
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            if(a[i][j]  != x[i]+y[j]){
                good = false;
            }
        }
    }
    if(good){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;
  
void f(int n) {
  	vector<int> prime{3, 5,	7,	11,	13,	17,	19,	23,	29,	31,	37};
  	int ans = 0;
	forn(i,9){
      for(int j = i+1; j < 10; j++){
        if(prime.at(i)*prime.at(j)*prime.at(j)*prime.at(j) <= n){
          ans++;
          //cout << prime.at(i) << "*" << prime.at(j)<< "^3 ="<< prime.at(i)*prime.at(j)*prime.at(j)*prime.at(j)  << endl;
        }
       if(prime.at(j)*prime.at(i)*prime.at(i)*prime.at(i) <= n){
          ans++;
          //cout << prime.at(j) << "*" << prime.at(i)<< "^3 ="<< prime.at(j)*prime.at(i)*prime.at(i)*prime.at(i)  << endl;
        }
      	for(int k = j+1; k < 11; k++){
        		if(prime.at(i)*prime.at(j)*prime.at(k) <= n){
		          //cout << prime.at(i) << "*" << prime.at(j)<< "*" << prime.at(k) << "="<<  prime.at(i)*prime.at(j)*prime.at(k) << endl;
                  ans++;
                }
        }
      }
    }
  	cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  f(n);
  return 0;
}

Measured memory_bytes: 3652
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int X, Y, Z;
  cin >> X >> Y >> Z;

  swap(X, Y);
  swap(X, Z);
  cout << X << " " << Y << " " << Z << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio (false) ;cin.tie(NULL);
#define tc  int t;cin>>t;for(int i=0;i<t;i++)
#define ll long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define um(a,b) unordered_map<a,b>
#define vv(a) vector<a>
#define pp(a,b) pair<a,b>
ll power(ll a,ll b,ll mod){  ll ans=1;  while(b>0){
  if(b&1){ ans=(ans*a)%mod;} a=(a*a)%mod;  b=b/2; } return ans;}

int main(){
FIO
ll n;
cin>>n;
ll arr[n+1];
forn1(i,1,n){
 cin>>arr[i];
}
ll amount=1000,miny=arr[1];
for(ll i=2;i<=n;i++){
    if(arr[i]>miny){
        ll c=amount/miny;

        ll add=(arr[i]-miny)*c;
        amount+=add;
        miny=arr[i];
    }else{
      miny=min(arr[i],miny);
    }
}
cout<<amount<<endl;

}


Measured memory_bytes: 3644
(let ((h (read))
      (w (read))
      (d (read))
      (co (make-array '(100000 2) :element-type 'integer
                                 :initial-element 0
                                 :adjustable t))
      (dif (make-array '(190000) :element-type 'integer
                                :initial-element 0
                                :adjustable t))
      (temp 0)
      q
      l
      r)
  (dotimes (i h)
    (dotimes (j w)
      (setf temp (read))
      (setf (aref co temp 0) i)
      (setf (aref co temp 1) j)))
  (loop for x from 1 upto d
        do (loop for y from 1
              do (setf temp (+ x (* y d)))
                 while (<= temp (* h w)) do (setf (aref dif temp) (+ (aref dif (- temp d)) (abs (- (aref co temp 0) (aref co (- temp d) 0))) (abs (- (aref co temp 1) (aref co (- temp d) 1)))))))
  (setf q (read))
  (dotimes (x q)
    (setf l (read))
    (setf r (read))
    (format t "~A~%" (- (aref dif r) (aref dif l)))))

Measured memory_bytes: 72004
# coding: utf-8
# Your code here!
n=input().split(" ")
n=sorted(n)
n[0]=int(n[0])
n[1]=int(n[1])
if (n[0]+n[1])%2==0:
    print(int((n[0]+n[1])/2))
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 2940
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

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

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}
int main()
{
    ll X, t;
    cin >> X >> t;

    if (X >= t) { cout << X - t << endl; }
    else { cout << 0 << endl; }

}

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

def f(toggle):
	global a, n
	s = 0
	res = 0
	for i in range(n):
		s += a[i]
		if toggle == 1 and s < 1:
			res += -s + 1
			s = 1
		elif toggle == 0 and s > -1:
			res += s + 1
			s = -1

		toggle = not toggle

	return res

print(min(f(1), f(0)))

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const ll inf = 1e9;


void solve()
{
  char X;
  cin >> X;
  char Y;
  cin >> Y;
  if (X>Y) cout << ">" << endl;
  else if (X<Y) cout << "<" << endl;
  else cout << "=" << endl;
}

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


Measured memory_bytes: 256
#include <iostream>

void swap(int &X, int &Y)
{
    int tmp = X;
    X = Y;
    Y = tmp;
}

int main(int argc, char **argv)
{
    int X, Y, Z;
    std::cin >> X >> Y >> Z;

    swap(X, Y);
    swap(X, Z);

    std::cout << X << " " << Y << " " << Z << std::endl;
    
}


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

#define ll long long
#define ull unsigned long long
#define mii make_pair<int, int>
#define mll make_pair<ll, ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define all(v) (v).begin(), (v).end()

//ofstream out("debug.txt");

const int MxN = 1e5, md = 1e9 + 7;

ll fast(ll b, ll n)
{
    if (n == 0)
        return 1LL;
    if (n == 1)
        return b;
    ll t = fast(b, n / 2);
    if (n & 1)
        return t * t % md * b % md;
    else
        return t * t % md;
}

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

    ll n;
    cin >> n;
    cout << ((fast(10, n) - 2 * fast(9, n) % md + md) % md + fast(8, n)) % md;

}

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

int main(){
    int n,r=0;
    bool c[10];
    memset(c, false, sizeof(c));
    cin >> n;
    for(int i=0;i<n;i++){
        int a;cin >> a;
        if(a<3200){
            c[a/400]=true;
        }
        else{
            r++;
        }
    }
    int cnt = 0;
    for(int i=0;i<=7;i++){
        if(c[i])cnt++;
    }
    cout << (cnt==0?1:cnt) << ' ' << cnt+r << endl;
}

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

signed main() {
    int n, k;
    cin >> n >> k;
    int ans=0;
    rep(i,n) {
        int h; cin >> h;
        if(h>=k) ans++;
    }
    cout << ans << endl;
}

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

int main(void) {
    ll N,M;
    cin >> N;
    ll D[N];
    for (int i=0; i<N; i++) cin >> D[i];

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

    sort(D,D+N);
    sort(T,T+M);
    ll di=0;
    ll ti=0;
    bool ans = true;

    while (ti!=M) {
        while (1) {
            if (D[di] == T[ti]) {
                ti++;
                di++;
                break;
            }
            if (D[di] > T[ti]) {
                ans = false;
                break;
            }
            di++;
        }
        if (!ans) break;
    }
    if (ans) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 3328