akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int main(){
    double a,b,x;
    cin >>a >>b >>x;
    double rad;
    double S = x/a;

    if (S>=a*b/2){
    //int c = a*a*a*tan(ang)/2
    //c=a*a*b-x;
    rad= atan(2*(a*b-S)/(a*a));
    }else{
        rad = atan(b*b/(2*S));
    }
    double ang = rad *360 / (2* M_PI);
    printf("%.10f\n",ang);
}

Measured memory_bytes: 384
import java.util.*;
public class Main {
 	public static void main(String[] args) {
     	Scanner s = new Scanner(System.in);
      	int n = s.nextInt();
      	int x = s.nextInt();
      	int t = s.nextInt();
      
      	int count = n/x;
      	if(n%x != 0) 
          count += 1;
      	System.out.println(count*t);
    }
}

Measured memory_bytes: 35664
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>

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

constexpr ll mod = 1e9 + 7;

std::vector<P> vec;
std::unordered_map<int, int> ind;

ll dp[100][70000];

int main()
{

    int n, k;
    std::cin >> n >> k;

    for (int i = 1; i * i <= n; ++i)
    {
        vec.emplace_back(i, 0);
        vec.emplace_back(n / i, 0);
    }

    std::sort(std::begin(vec), std::end(vec));

    vec.erase(std::unique(std::begin(vec), std::end(vec)), std::end(vec));

    for (int i = 0; i < vec.size() - 1; ++i)
        vec[i].second = n / vec[i].first - n / vec[i + 1].first;

    vec.rbegin()->second = 1;

    /*std::cerr << "DEBUG" << std::endl;
    for (auto p : vec)
        std::cerr << p.first << ' ' << p.second << std::endl;
    */

    for (int i = 0; i < vec.size(); ++i)
        ind[vec[i].first] = i;

    dp[0][vec.size() - 1] = vec.rbegin()->second;
    for (int i = vec.size() - 2; i >= 0; --i)
        dp[0][i] = vec[i].second + dp[0][i + 1];

    for (int i = 1; i < k; ++i)
    {
        for (int j = vec.size() - 1; j >= 0; --j)
        {
            dp[i][j] = dp[i - 1][ind[n / vec[j].first]];
            if (j != vec.size() - 1)
                dp[i][j] = (dp[i][j + 1] + dp[i][j] * vec[j].second) % mod;
        }
    }

    /*std::cerr << "DEBUG" << std::endl;

    for (int i = 0; i < k; ++i)
    {
        for (int j = 0; j < vec.size(); ++j)
            std::cerr << dp[i][j] << ' ';
        std::cerr << std::endl;
    }*/

    std::cout << dp[k - 1][0] << std::endl;

    return 0;
}

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


ll num[30];
int main(){
    int n;
    string s;
    cin>>n>>s;

    rep(i,n) num[s[i]-'a']++;
    ll res=1;
    rep(i,26){
        res*=num[i]+1;
        res%=MOD;
    }

    cout<<res-1<<endl;
}
    




Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  int W, a, b; cin >> W >> a >> b;
  cout << (abs(a-b)<=W ? 0 : abs(a-b)-W) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[5010],inn[5010],n;bool vis[5010];
vector <int> des[5010];
void dfs(int s)
{
	vis[s]=true;
	for (int i=1;i<=n;i++) if ((__gcd(a[i],a[s])!=1)&&(!vis[i]))
	{
		des[s].push_back(i);
		inn[i]++;dfs(i);
	}
}
		
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for (int i=1;i<=n;i++) if (!vis[i]) dfs(i);
	priority_queue<int> que;
	for (int i=1;i<=n;i++) if (!inn[i]) que.push(i);
	for (int i=1;i<=n;i++)
	{
		int s=que.top();que.pop();
		printf("%d ",a[s]);
		for (int k=0;k<des[s].size();k++)
		{
			inn[des[s][k]]--;
			if (!inn[des[s][k]]) que.push(des[s][k]);
		}
	}
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return ('0' <= c && c <= '9')?(c - '0'):-1;}

// TODO: write
int main() {
  int n;cin>>n;
  vector<int> a(n),b(n),c(n);
  rep(i,n)cin>>a[i];
  rep(i,n)cin>>b[i];
  rep(i,n-1)cin>>c[i];
  int ans = 0;
  rep(i,n){
    ans += b[a[i]-1];
    if(i < n-1 && a[i]+1 == a[i+1]){
      ans += c[a[i]-1];
    }
  }
  print(ans);
  return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>


int main(void) {

	double x1 = 0;
	double y1 = 0;

	double x2 = 0;
	double y2 = 0;

	scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);

	double result = sqrt(pow(fabs(x1 - x2),2) + pow(fabs(y1 - y2),2));

	printf("%lf", result);


	return 0;
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll X; cin>>X;
  for(ll i=-118; i<=119; i++){
    for(ll j=-119; j<=118; j++){
      ll A=i*i*i*i*i;
      ll B=j*j*j*j*j;
      if(A-B==X){
        cout<<i<<" "<<j<<endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
  long n,wm;
  cin >> n >> wm;
  vl w(n),v(n);
  rep(i,n) cin >> w[i] >> v[i];
  vvl dp(n+1, vl(wm+1,0));
  rep(i,n){
    rep(j,wm+1){
      if(j - w[i] < 0) dp[i+1][j] = dp[i][j];
      else dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
    }
  }
  cout << dp[n][wm] << endl;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define IREP(i, v) for (auto i = v.begin(); i != v.end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, 0, -1, 0, 1, -1, 1, -1};
const int dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes()
{
    cout << "Yes" << endl;
}
void no()
{
    cout << "No" << endl;
}
//-----------------------------------------

ll pow(ll x,ll y,ll m){
    ll res = 1 ;
    if(y>0){
        res = pow(x,y/2,m) ;
        if(y%2==0){
            res = (res*res)%m ;
        }
        else{
            res = (((res*res)%m)*x)%m ;
        }
    }
    return res ;
}
//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s ;
    cin >> s ;
    int n = SZ(s) ;
    vll cnt(2019,0) ;
    vll sum(n) ;
    cnt[0]++ ;
    sum[n-1] = s[n-1] - '0' ;

    REP(i,n-1){
        sum[n-2-i] = sum[n-1-i] + (s[n-2-i]-'0')*pow(10,i+1,2019) ;
        sum[n-2-i] %= 2019 ;
    }

    REP(i,n){
        cnt[sum[i]]++ ;
    }

    ll ans = 0 ;

    REP(i,2019){
        ans += (cnt[i]-1)*cnt[i]/2 ;
    }

    cout << ans <<endl ;


    

    return 0;
}


Measured memory_bytes: 5044
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <ctime>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long double LD;
typedef long long LL;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#ifdef LOCAL
#define DEBUG(x) { cerr << "# " << #x << ": " << x << endl;}
#else
#define DEBUG(x)
#endif
mt19937_64 mt(time(0));
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/






int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cout.precision(10); cout << fixed;
#ifdef LOCAL
  freopen("../test.txt", "r", stdin);
    // freopen("../output.txt", "w", stdout);
#endif
  int n; cin >> n;
  vi nums;
  for (int i = 0; i < n; i++) {
    int val; cin >> val;
    nums.push_back(val);
  }
  sort(nums.begin(), nums.end());
  int ret = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i+1; j < n; j++) {
      if (nums[i] == nums[j]) continue;
      for (int k = j+1; k < n; k++) {
        if (nums[k] == nums[j]) continue;
        if (nums[i]+nums[j] <= nums[k]) continue;
        ret++;
      }
    }
  }
  cout << ret << '\n';





/*---------------------------------------Coding Space End------------------------------------------*/
#ifdef LOCAL
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#endif
  return 0;
}
/* author:  txingml */
/* picture is from hamayanhamayan(CF handle) */


Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw	 "\n"

int main(void)
{
	CIN;
  string S;
  cin >> S;
  regex R ("A[a-z][a-z]*C[a-z]*[a-z]");
  cout << ((regex_match(S, R)) ? "AC" : "WA") << "\n";
	

}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
using pp=pair<int, int>;

int main() {
  long long mod=pow(10, 9)+7, N, P=1;
  cin >> N;
  for (int i=1; i<=N; i++) {
    P=P*i%mod;
  }
  cout << P << endl;
}


Measured memory_bytes: 3604
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
	static void Main()
	{
        var n = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var y = n[0];
        var x = n[1];
        if (x == 1 || y == 1)
        {
            Console.WriteLine(1);
        }
        else
        {
            var a = (long)Math.Floor(x * y / 2.0);
            if ((x * y) % 2 == 1) a += 1;
            Console.WriteLine(a);
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
string s,t;
int sl,tl;
int main(){
	cin>>s>>t;
	sl = s.length();
	tl = t.length();
	int ans = 1946081700;
	for(int i=0;i+tl<=sl;i++){
		int tm = 0;
		for(int j = 0;j<tl;j++){
			if(s[i+j]!=t[j]) tm++;
		}
		ans = min(tm,ans);
	}
	cout<<ans;
} 

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout<<v<<endl
#define first(v) get<0>(v)
#define second(v) get<1>(v)
#define third(v) get<2>(v)
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;



int main(){
    ll N;
    cin >> N;
    ll C;
    cin >> C;
    vector<ll> X(N,0);
    vector<ll> V(N,0);
    for(ll i=0;i<N;i++){
        cin>>X[i]>>V[i];
    ;}
    vector<ll> t(N,0);
    vector<ll> h(N,0);
    vector<ll> t2(N,0);
    vector<ll> h2(N,0);
    ll sum=0;
    for(ll i=0;i<N;i++){
        if(i==0)sum+=V[i]-2*X[i];
        else sum+=V[i]-2*X[i]+2*X[i-1];
        if(i==0)t[i]=max(sum,0LL);
        else t[i]=max(t[i-1],sum);
    ;}
    sum=0;
    for(ll i=N-1;i>=0;i--){
        if(i==N-1)sum+=V[i]-2*(C-X[i]);
        else sum+=V[i]+2*X[i]-2*X[i+1];
        if(i==N-1)h[i]=max(sum,0LL);
        else h[i]=max(h[i+1],sum);
    ;}
    sum=0;
    for(ll i=0;i<N;i++){
        if(i==0)sum+=V[i]-X[i];
        else sum+=V[i]-X[i]+X[i-1];
        if(i==0)t2[i]=max(sum,0LL);
        else t2[i]=max(t2[i-1],sum);
    ;}
    sum=0;
    for(ll i=N-1;i>=0;i--){
        if(i==N-1)sum+=V[i]-(C-X[i]);
        else sum+=V[i]+X[i]-X[i+1];
        if(i==N-1)h2[i]=max(sum,0LL);
        else h2[i]=max(h2[i+1],sum);
    ;}
    ll ans=0;
    chmax(ans,t2[N-1]);
    chmax(ans,h2[0]);
    for(ll i=1;i<=N-2;i++){
        chmax(ans,t[i]+h2[i+1]);
        chmax(ans,h[i]+t2[i-1]);
    ;}
    if(N>=2){
    chmax(ans,t[0]+h2[1]);
    chmax(ans,h[N-1]+t2[N-2]);
    }
    print(ans);
    return 0;
}


Measured memory_bytes: 4992
#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 fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d,x;
  long long la,lb;
  double da,db;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> s >> ss;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------

  if(s[0] == ss[0]) ans++;
  if(s[1] == ss[1]) ans++;
  if(s[2] == ss[2]) ans++;
//  else anss = "red";

  cout << ans << endl;

}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
const int MAX = 100 + 10;
int arr[MAX];
int main(){
  int n;
  scanf("%d", &n);
  for(int i = 0 ; i < n ; i++)
    scanf("%d", &arr[i]);
  int ans = 2147483647;
  for(int i = -100 ; i <= 100 ; i++){
    int value = 0;
    for(int j = 0 ; j < n ; j++){
      value += (arr[j] - i) * (arr[j] - i);
    }
    if(value < ans){
      ans = value;
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
#define long long long

int main(){
long n;
cin>>n;
long a[n][3];
long dp[n][3]={0};
for(int i=0;i<n;i++){
cin>>a[i][0]>>a[i][1]>>a[i][2];
}
dp[0][0]=a[0][0];
dp[0][1]=a[0][1];
dp[0][2]=a[0][2];

for(int i=1;i<n;i++){
for(int j=0;j<3;j++){
dp[i][(j+1)%3]=max(dp[i][(j+1)%3],dp[i-1][j]+a[i][(j+1)%3]);
dp[i][(j+2)%3]=max(dp[i][(j+2)%3],dp[i-1][j]+a[i][(j+2)%3]);

}
}

cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});

}





Measured memory_bytes: 4992
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define MOD 1000000007
typedef long long ll;

#include <stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(){
	int n;
	scanf("%d", &n);
	int a[n];
	rep(i, n) scanf("%d", &a[i]);
	qsort(a, n, sizeof(int), compare_int);
    rep(i, n - 1){
    	if(a[i] == a[i + 1]){
    		printf("NO");
    		return 0;
    	}
    }
	printf("YES");
	return 0;
}

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

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

  string S;
  cin >> S;

  for (int i = 'a'; i < 'z' + 1; ++i) {
    bool judge = false;
    for (int j = 0; j < S.size(); ++j) {
      if ((char)i == S.at(j)) {
        judge = true;
      }
    }
    if (!judge) {
      cout << (char)i << endl;
      return 0;
    }
  }

  cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll zero=0;
using PP=pair<pair<ll,ll>,pair<ll,ll>>;
using P=pair<ll,ll>;
ll X,K,Q;
int main(){
  cin>>X>>K;
  vector<ll>r(K+1);
  for(int i=1;i<=K;i++)
    cin>>r[i];
  cin>>Q;
  vector<P>A(Q);
  for(int i=0;i<Q;i++){
  ll t,a;cin>>t>>a;
    P p(t,a);
    A[i]=p;
  }vector<PP>C(K+1);
  P q1(X,X);
  P q2(0,0);
  PP q3(q1,q2);C[0]=q3;
  for(int i=1;i<=K;i++){
    ll l=r[i]-r[i-1];
    ll a1=C[i-1].first.first;ll b1=C[i-1].first.second;
    ll a2=C[i-1].second.first;ll b2=C[i-1].second.second;
  if(i%2==1){
 b1-=l;b2-=l;
    if(0<=b2){
    P p1(a1,b1);P p2(a2,b2);PP p3(p1,p2);C[i]=p3;
    }else if(b1<0){
    P p1(a1,0);P p2(a1,0);PP p3(p1,p2);C[i]=p3;
    }else{
    P p1(a1,b1);P p2(a1-b1,0);PP p3(p1,p2);C[i]=p3;
    }
  }else{
  b1+=l;b2+=l;
    if(b1<=X){
    P p1(a1,b1);P p2(a2,b2);PP p3(p1,p2);C[i]=p3;
    }else if(X<b2){
    P p1(a2,X);P p2(a2,X);PP p3(p1,p2);C[i]=p3;
    }else{
        P p1(a2+X-b2,X);P p2(a2,b2);PP p3(p1,p2);C[i]=p3;
    }
  }
 }for(int i=0;i<Q;i++){
  ll t=A[i].first;ll a=A[i].second;
    auto itr=upper_bound(r.begin(),r.end(),t);
    ll k=distance(r.begin(),itr);k-=1;
    ll a1=C[k].first.first;ll b1=C[k].first.second;
    ll a2=C[k].second.first;ll b2=C[k].second.second;
     ll b;if(a1<a)b=b1;else if(a<a2)b=b2;else b=b2+(a-a2);
    if(k%2==0){
      cout<<max(zero,b-(t-r[k]))<<endl;
    }else{
      cout<<min(X,b+(t-r[k]))<<endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 8816
#include <iostream>
#include <vector>

int main()
{
	while (true) {
		int m, nmin, nmax;
		std::cin >> m >> nmin >> nmax;

		if (m == 0) {
			break;
		}

		std::vector<int>ps;
		ps.resize(m);

		for (int i = 0; i < m; i++) {
			std::cin >> ps.at(i);
		}

		int maxgap = -1;
		int ans = -1;
		for (int i = nmin; i <= nmax; i++) {
			int gap = ps.at(i - 1) - ps.at(i);

			if (gap >= maxgap) {
				maxgap = gap;
				ans = i;

			}

		}

		std::cout << ans << std::endl;
	}

	return 0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  for(int N, M; ~scanf("%d%d", &N, &M) && N;) {
    int sum[N + 1]; sum[0] = 0;

    int res = 0;
    rep(i, N) {
      int A; scanf("%d", &A); A %= M;
      sum[i + 1] = sum[i] + A;
      sum[i + 1] %= M;
      maximize(res, sum[i + 1]);
    }

    set<int> st = {M};

    REP(i, 1, N + 1) {      maximize(res, sum[i] + M - *st.upper_bound(sum[i]));      st.insert(sum[i]); }

    cout << res << endl;

  }
  
  return 0;
}

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

using ll = long long;
using ull = unsigned long long;

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

    int n;
    cin >> n;

    map<int, int> cnt;

    for (int x = 1; x <= 100; ++x) {
        for (int y = 1; y <= 100; ++y) {
            for (int z = 1; z <= 100; ++z) {
                int p = (x * x) + (y * y) + (z * z) + (x * y) + (y*z) + (z*x);
                ++cnt[p];
            }
        }
    }

    for (int i = 1; i <= n; ++i) {
        cout << cnt[i] << "\n";
    }

    return 0;
}


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

int main() {
    string O, E;
    cin >> O >> E;
    int n = O.size();
    int m = E.size();

    for(int i = 0; i < n; i++) {
        cout << O[i];
        if(i < m) {
            cout << E[i];
        }
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
int b, c,a, sum, num;
long n, d;
scanf("%ld", &n);
num = (int)(log10(n+1));
if(num != 0){
d = pow (10, num-1);
a = (n+1)/d;
b = a+1;
c = (int)(a/10)-1;
printf("%d", 9*num+c);
}
else printf("%d", n);
return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
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; }
ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a*b/gcd(a,b);}
ll MOD=1000000007;

int main(){
  char a;cin>>a;
  cout<<(char)(a+1)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
 int a,b,c,d,mi; cin>>a>>b; mi=100000;
 for(int i=1;i<=10000;i++){
    c=(i*8)/100; d=(i)/10; if(c==a && mi>i && d==b){mi=i;}
 }
 if(mi<100000)cout<<mi;
 else cout<<-1;
}




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

using namespace std;

int main(){
    string S;
    cin >> S;

    if(S.size()%2 != 0){
        cout << "No" << endl;
    }else{
        for(int i = 1; i < S.size();){
            if(i >= S.size()) break;
            if(S[i-1] == 'h' && S[i] == 'i'){
                i += 2;
            }else{
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
let input = Scanf.scanf "%d %d\n" (fun x y -> int_of_string (string_of_int x ^ (string_of_int y))) in

let rec check x c=
  if x/2<c then false
  else if c *c =x then true
  else check x (c+1) in

let ans = if check input 1 then "Yes" else "No" in

print_string ans
;;

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

using namespace std;

int main() {

  int a, b, c, a1, a2, a3, a4, a5, b1, b2, b3, b4, b5;

  cin >> a >> b;

  a1 = a / 10000 % 10;
  a2 = a / 1000 % 10;
  a3 = a / 100 % 10;
  a4 = a / 10 % 10;
  a5 = a / 1 % 10;

  b1 = b / 10000 % 10;
  b2 = b / 1000 % 10;
  b3 = b / 100 % 10;
  b4 = b / 10 % 10;
  b5 = b / 1 % 10;

  c = (b1 - a1 + 1) * 100 - (a2 * 10) - (a3) - (9 - b2) * 10 - (9 - b3);
  if (a2 * 10 + a1 < a4 * 10 + a5)
    c -= 1;
  if (b2 * 10 + b1 > b4 * 10 + b5)
    c -= 1;

  cout << c << endl;

  return 0;
}

Measured memory_bytes: 256
lst = input().split()

A = int(lst[0])
B = int(lst[1])
C = int(lst[2])
D = int(lst[3])

if (B <= C) or (D <= A):
   print(0)
elif (A <= C <= B) and (C <= B <= D):
   print(B - C)
elif (C <= A <= D) and (A <= D <= B):
   print(D - A)
else:
   print(min([B - A, D - C]))

Measured memory_bytes: 9188
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#define all(x) (x).begin(),(x).end()
#define ALL(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int N;
    cin >> N;
    vector<int> A(N),B(N),C(N);
    for (int i = 0; i < N; i++){
        cin >> A[i];
    }
    for (int i = 0; i < N; i++){
        cin >> B[i];
    }
    for (int i = 0; i < N; i++){
        cin >> C[i];
    }

    sort(all(A));
    sort(all(B));
    sort(all(C));

    ll sum = 0;
    for (int i = 0; i < N; i++){
        ll num1 = lower_bound(all(A),B[i]) - A.begin();
        ll num2 = C.end() - upper_bound(all(C),B[i]);

        sum += num1 * num2;
    }
    cout << sum << endl;


    return 0;
}


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

const int MOD = (int)1e9+7;

int main(){
  int N,K;
  cin >> N >> K;
  vector<pair<int,int>> a_n(N);
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    a_n.at(i)=make_pair(a,i+1);
  }
  sort(a_n.begin(),a_n.end(),greater<pair<int,int>>());

  vector<int> ans;
  int mi=0;
  for(int k=0;k<=K;k++){
    for(int i=0;i<N;i++){
      if(mi==a_n.at(i).second)  continue;
      ans.push_back(a_n.at(i).second);
      a_n.at(i).first--;
    }

    sort(a_n.begin(),a_n.end(),greater<pair<int,int>>());
    int x_n=1e9,x_mi;
    for(int i=0;i<N;i++){
      if(mi==a_n.at(i).second)  continue;
      if(x_n>=a_n.at(i).first){
        x_n=a_n.at(i).first;
        x_mi=a_n.at(i).second;
      }
    }
    mi=x_mi;

    for(int i=0;i<N;i++){
      if(a_n.at(i).first==-1){
        cout << -1 << endl;
        return 0;
      }
    }
  }

  cout << ans.size() << endl;
  for(int i=0;i<ans.size()-1;i++){
    cout << ans.at(i) << " ";
  }
  cout << ans.at(ans.size()-1) << endl;

  return 0;
}


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

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

    if (N >= 10) {
        cout << R << endl;
    } else {
        cout << R + 100 * (10 - N) << endl;
    }

    return 0;
}


Measured memory_bytes: 3568
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0)
#define ll long long int
#define ld long double
#define ull unsigned long long int
#define reptArIn(i,a,b,ar) for( i=a; i<b; ++i) cin>>ar[i];
#define fo(i,a,b) for(i=a; i<b; ++i)
#define foe(i,a,b) for(i=a; i<=b; ++i)
#define rep(i,n) for(i=1;i<=n;i++)
#define all(a) a.begin(), a.end()
#define pb push_back
#define ins insert
#define mk make_pair
#define f first
#define s second
#define mod 1000000007
#define vi vector<int>
#define vll	vector<ll>
#define vvi	vector<vi>
#define pii	pair<int,int> //typedef pair<int,int> pii;
#define pll	pair<ll , ll>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>  new_data_set;
//mp.reserve(4096);
//mp.max_load_factor(0.25);

int main()
{
	int n,i;
	cin>>n;
	int dp[n][3];
	vector<vector<int> > v(n);
	int a,x;
	fo(i,0,n)
	{
	    for(int j=0;j<3;j++)
	    {
	        cin>>a;
	        v[i].pb(a);
	    }
	}
	dp[0][0]=v[0][0];
	dp[0][1]=v[0][1];
	dp[0][2]=v[0][2];
	for(i=1;i<n;i++)
	{
		dp[i][0]=v[i][0]+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1]=v[i][1]+max(dp[i-1][0],dp[i-1][2]);
		dp[i][2]=v[i][2]+max(dp[i-1][0],dp[i-1][1]);
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
	return 0;
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

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() {
  ll N, K;
  cin >> N >> K;
  ll ans = 0;
  for (ll b = 1; b < N+1; b++) {
    ll p = N / b;
    ll r = N % b;
    ll tmp = p * max(0ll, b - K) + max(0ll, r - K + 1);
    if (K == 0) {
      ans += max(tmp - 1, 0ll);
    } else {
      ans += tmp;
    }
  }

  cout << ans << endl;

  return 0;
};


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int A[100010], B[100010];
pair<int, int> diff[100010];


signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int sumA = 0, sumB = 0;
    rep(i, N) cin >> A[i] >> B[i];
    rep(i, N) {
        diff[i] = {-A[i] - B[i], i};
    }
    sort(diff, diff + N);
    rep(i, N) {
        if (i % 2 == 0)
            sumA += A[diff[i].second];
        else 
            sumB += B[diff[i].second];
    }
    cout << sumA - sumB << endl;

    return 0;
}


Measured memory_bytes: 3328
package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() uint64 {
	sc.Scan()
	i, e := strconv.ParseUint(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func intArray(n []string) []int {
	var m []int
	for i, _ := range n {
		v, _ := strconv.Atoi(n[i])
		m = append(m, v)
	}
	return m
}

func uint64Array(arr []string) (newArr []uint64) {
	for i, _ := range arr {
		n, _ := strconv.ParseUint(arr[i], 10, 64)
		newArr = append(newArr, n)
	}
	return
}

func intExistIn(v int, arr []int) bool {
	for _, a := range arr {
		if a == v {
			return true
		}
	}

	return false
}

func stringExistIn(v string, arr []string) bool {
	for _, a := range arr {
		if a == v {
			return true
		}
	}

	return false
}

func gcd(m, n uint64) uint64 {
	x := new(big.Int)
	y := new(big.Int)
	z := new(big.Int)
	a := new(big.Int).SetUint64(m)
	b := new(big.Int).SetUint64(n)
	return z.GCD(x, y, a, b).Uint64()
}

func uintArrayToStr(a []uint64) string {
	var S string

	for _, v := range a {
		S += strconv.Itoa(int(v))
	}
	return S
}

func remove(x []uint64, y int) []uint64 {
	var newArray []uint64
	for i, _ := range x {
		if i != y {
			newArray = append(newArray, x[i])
		}
	}
	return newArray
}

func ascendSort(a []uint64) []uint64 {
	for i := 0; i < len(a); i++ {
		for i := 0; i < len(a)-1; i++ {
			if a[i] > a[i+1] {
				tmp := a[i+1]
				a[i+1] = a[i]
				a[i] = tmp
			}
		}
	}
	return a
}

func descendSort(a []uint64) []uint64 {
	for i := 0; i < len(a); i++ {
		for i := 0; i < len(a)-1; i++ {
			if a[i] < a[i+1] {
				tmp := a[i+1]
				a[i+1] = a[i]
				a[i] = tmp
			}
		}
	}
	return a
}

func maxAndIndex(a []uint64) (uint64, int) {
	max := uint64(0)
	index := 0
	for i, v := range a {
		if v > max {
			max = v
			index = i
		}
	}
	return max, index
}

func sum(a []uint64) uint64 {
	sum := uint64(0)
	for _, v := range a {
		sum += v
	}
	return sum
}

func main() {
	N, _:= strconv.ParseInt(readLine(), 10, 32)
	S := readLine()
	var ans string
	for _, v := range S {
		if v += rune(N); v > 90 {
			v -= rune(26)
		}
		ans += string(v)
	}

	fmt.Println(ans)
}


Measured memory_bytes: 6656
#include<bits/stdc++.h>
using namespace std;
#define maxn 200005
#define LL long long
int a[maxn];
LL sum,ma[maxn],mi[maxn],ma1[maxn],mi1[maxn],ans=0x7fffffffffffffffll;
multiset<LL>S;
multiset<LL>::iterator x;
int main(){
	int n;scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	S.insert(sum=a[0]);
	for(int i=1;i<n;i++){
		sum+=a[i];
		x=S.lower_bound((sum+1)>>1);
		if(x!=S.end())mi[i]=sum-*x,ma[i]=*x;
		if(x!=S.begin()){x--;if(*x>mi[i])mi[i]=*x,ma[i]=sum-*x;}
		S.insert(sum);
	}
	S.clear();
	S.insert(sum=a[n-1]);
	for(int i=n-2;i;i--){
		sum+=a[i];
		x=S.lower_bound((sum+1)>>1);
		if(x!=S.end())mi1[i]=sum-*x,ma1[i]=*x;
		if(x!=S.begin()){x--;if(*x>mi1[i])mi1[i]=*x,ma1[i]=sum-*x;}
		S.insert(sum);
	}
	for(int i=1;i<n-2;i++){
		ans=min(ans,max(ma1[i+1],ma[i])-min(mi1[i+1],mi[i]));
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 16640
import Data.List

main = do
  n <- readLn :: IO Int
  print $ if n == 1 then 1 else (cnt $ concat $ [factorize x | x<-[1..n]])

factorize :: Int -> [Int]
factorize 1 = []
factorize n = 
  let 
    [m] = take 1 [i | i <-[2..], n `mod` i == 0]
  in 
    m : (factorize $ n `div` m)
  
cnt :: [Int] -> Int
cnt [] = 0
cnt xs = foldl1' (\a b -> a*b `mod` (10^9+7)) . map ((+1) . length) . group $ sort xs

Measured memory_bytes: 1276
n = int(input())

def solve(x, y):
    dp = [0] * (len(x)+1)
    for i in range(len(y)):
        yi = y[i]
        bdp = dp[:]
        for j in range(len(x)):
            xj = x[j]
            if yi == xj:
                dp[j+1] = bdp[j] + 1
            elif dp[j+1] < dp[j]:
                dp[j+1] = dp[j]

    return dp[-1]

for _ in range(n):
    x = input()
    y = input()
    print(solve(x, y))



Measured memory_bytes: 5632
#include<iostream>
#include <map>

using namespace std;

int main(){
  int n;
  map<int,int>mp;
  cin >> n;
  while(n--){
    int i;
    cin >> i;
    mp[i]++;
  }
  cin >> n;
  while(n--){
    int i;
    cin >> i;
    if(mp[i]==0){
      cout << "NO" << endl;
      return 0;
    }
    mp[i]--;
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    int N;
    cin >> N;
    int A[100001] = {0}; // 0
    int B[100001] = {0}; // 1
    int C[100001] = {0}; // 2

    int maxhappy[3][100001] = {0};

    rep(i, N) {
        int ai, bi, ci;
        cin >> ai >> bi >> ci;
        A[i] = ai;
        B[i] = bi;
        C[i] = ci;
    }

    maxhappy[0][0] = A[0];
    maxhappy[1][0] = B[0];
    maxhappy[2][0] = C[0];

    for (int i = 1; i < N ; i++) {
        maxhappy[0][i] = max (
            maxhappy[1][i-1] + A[i],
            maxhappy[2][i-1] + A[i]
        );
        maxhappy[1][i] = max (
            maxhappy[0][i-1] + B[i],
            maxhappy[2][i-1] + B[i]
        );
        maxhappy[2][i] = max (
            maxhappy[0][i-1] + C[i],
            maxhappy[1][i-1] + C[i]
        );
    }

    cout << max(maxhappy[0][N-1], max(maxhappy[1][N-1], maxhappy[2][N-1])) << endl;
}


Measured memory_bytes: 2560
use std::collections::BTreeSet;
fn main() {
    proconio::input! {
        n: usize,
        a: [usize;n],
    }
    let mut s: BTreeSet<usize>=BTreeSet::new();
    for (i,a) in a.into_iter().enumerate() {
        if let Some(&v)=s.range(..a*n).rev().next() {
            s.remove(&v);
        }
        s.insert(a*n+i);
    }
    println!("{}",s.len());
}

Measured memory_bytes: 6808
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
  #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl "\n"
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
const int MAXN=200+11;
bool isprime[MAXN];
vector<int> cnt(MAXN);
void pre(){
	for(int i=2;i<MAXN;i++){
	  for(int j=i;j<MAXN;j+=i){
		    cnt[j]++;
		  }	
	}
}
void solve(){
  	pre();
  	int n,val=0;
  	cin>>n;
  	for(int i=1;i<=n;i++)val+=(cnt[i]==7 and (i&1));
  	cout<<val<<endl;
}
int32_t main(){
   IOS;
   solve();
   //debug();
  #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
  #endif	
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int W = scanner.nextInt(), H = scanner.nextInt(), x = scanner.nextInt(), y = scanner.nextInt(), r = scanner.nextInt();
		String answer;

		if (x + r <= W && x - r >= 0 && y + r <= H && y - r >= 0)
			answer = "Yes";
		else
			answer = "No";

		System.out.println(answer);
	}
}

Measured memory_bytes: 26292
#include <stdio.h>

int main(void)
{
  int a,b,c,k;

  scanf("%d %d %d %d",&a, &b, &c ,&k );

  if (k<=a) {

    printf("%d",k);
  }
  else if(k<=a+b){
    printf("%d\n",a );
  }
  else {
    printf("%d\n",2*a+b-k);
  }
       return 0;
}


Measured memory_bytes: 1732
#include <iostream>
#include <string>
#include <cmath>
#include <climits>

using namespace std;

int main() {
  int N, T, A;
  // int H[1001];
  cin >> N >> T >> A;
  // for (int i = 0; i < N; i++) { cin >> H[i]; }

  int h;
  int ans = 0;
  int difmin = INT_MAX;
  for (int i = 1; i <= N; i++) {
    cin >> h;
    int d = abs((T * 1000 - h * 6) - A * 1000);
    if (difmin > d) {
      difmin = d;
      ans = i;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <numeric>
#include <bitset>
#include <stack>
#include <cstring>
using namespace std;

const int INF = 1 << 30;
const double EPS = 1e-10;

int main()
{
  int N;
  while (cin >> N) {
    set<string> U;
    for (int i = 0; i < N; ++i) {
      string s;
      cin >> s;
      U.insert(s);
    }

    int M;
    cin >> M;
    bool open = false;
    for (int i = 0; i < M; ++i) {
      string T;
      cin >> T;
      
      if (U.find(T) == U.end()) {
        cout << "Unknown " << T << endl;
      } else {
        if (open) {
          cout << "Closed by ";
          open = false;
        } else {
          cout << "Opened by ";
          open = true;
        }
        cout << T << endl;
      }
    }


  }
  return 0;
}

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

int main() {
  ll h;
  cin >> h;

  int cnt = 0;
  while (h > 0) {
    cnt++;
    if (h == 1) {
      h = 0;
    }
    h /= 2;
  }

  ll ans = 0;
  rep(i, cnt) { ans += pow(2, i); }

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

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

using ll = long long;
using namespace std;

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

int main(void) {
	int n, q;
	string s;
	cin >> n >> q >> s;
	
	vector<int> l(q), r(q);
	for(int i = 0; i < q; ++i) {
		cin >> l[i] >> r[i];
		l[i]--;
		r[i]--;
	}
	
	vector<int> sum(n + 1, 0);
	for(int i = 0; i < n - 1; ++i) {
		sum[i + 1] = sum[i] + (s.substr(i, 2) == "AC");
	}
	
	for(int i = 0; i < q; ++i) {
		cout << sum[r[i]] - sum[l[i]] << endl;
	}

	return 0;
}


Measured memory_bytes: 2176
#include<stdio.h>

int main()
{
    int x1, x2,x3,x4,x5;
    scanf("%d %d %d %d %d",&x1,&x2,&x3,&x4,&x5);
    if(x1==0){ printf("1\n");}
    else if(x2==0){ printf("2\n");}
    else if(x3==0){ printf("3\n");}
    else if(x4==0){ printf("4\n");}
    else if(x5==0){ printf("5\n");}
    
    return 0;
}  

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

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

const int MAX_N = 1e5 + 7;


void solve()
{
        string a, b; cin >> a >> b;
        if (a == b) cout << "EQUAL";
        else 
        {
                cout << ((a > b && len(a) >= len(b)) ? "GREATER" : "LESS");
        }
        
}

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


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
const ll Mod=1000000007;
const ll INF=999999999999999999;
const ll NN=(ll)(1e6+5);
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {
       ll i,j,n,x,m;
       cin>>n>>x>>m;
       vector <ll> v;
       v.pb(x);
       ll l=x,y;
       map <ll,ll> mp;
       mp[x]++;
       while(1)
       {
           y=(l*l)%m;
           mp[y]++;
           if(mp[y]>1)
            break;
           v.pb(y);
           if(v.size()==n)
            break;
           l=y;  
       }
       ll ans=0;
       for(auto u:v)
        ans+=u;
       ll ind=-1;
       for(i=0;i<v.size();i++)
        if(v[i]==y)
         {
             ind=i;
             break;
         } 
       ll z=v.size()-ind,sum=0;
       n-=v.size();
       for(i=ind;i<v.size();i++)
        sum+=v[i];
       ans+=(n/z)*sum;
       for(i=ind;i<ind+(n%z);i++)
        ans+=v[i];
       cout<<ans;  
   }
}

Measured memory_bytes: 6732
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <numeric>
#include <string>
#include <bitset>
#include <functional>

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}

/*------------------------------------------------------------------------*/

void solve();

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15);

    solve();
}

void solve() {
    str s;
    std::cin >> s;

    ll n = s.length();

    vll ans(n, 0);
    for (ll i = 0, j; i < n; i++)
        s[i] == 'R' ? j = i : ans[j + (i - j) % 2]++;
    for (ll i = n - 1, j; i >= 0; i--)
        s[i] == 'L' ? j = i : ans[j - (j - i) % 2]++;

    for (ll i = 0; i < n; i++)
        std::cout << ans[i] << (i < n - 1 ? ' ' : '\n');
}


Measured memory_bytes: 4200
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
    input! {
        mut x: usize,
    }

    let mut ans = 0;

    ans += x / 500 * 1000;
    x = x % 500;
    ans += x / 5 * 5;

    println!("{}", ans);
}


Measured memory_bytes: 2160
n = int(input())

a = list(map(int,input().split()))

su = 0
su += abs(a[0])
for i in range(n-1):
    su += abs(a[i+1] - a[i])
su += abs(a[-1])
for i in range(n):
    if i == 0:
        print(su - abs(a[0]) - abs(a[0] - a[1])+ abs(a[1]))
    elif i == n-1:
        print(su - abs(a[-1]) - abs(a[-1] - a[-2]) + abs(a[-2]))
    else:
        print(su - abs(a[i] - a[i-1]) - abs(a[i] - a[i+1]) + abs(a[i+1] - a[i-1]))

Measured memory_bytes: 14172
N = int(input())

ans = 0
tail_A = 0
head_B = 0
head_B_and_tail_A = 0

for i in range(N):
    s = str(input())
    ans += s.count("AB")

    if s[0]=="B":
        if s[-1]=="A":
            head_B_and_tail_A += 1
        else:
            head_B += 1
    elif s[-1]=="A":
        tail_A += 1

if head_B_and_tail_A >= 2:
    ans += head_B_and_tail_A - 1
    head_B_and_tail_A = 1

use_head_B_and_tail_A = min(head_B_and_tail_A,tail_A,head_B)
head_B_and_tail_A -= use_head_B_and_tail_A
tail_A -= use_head_B_and_tail_A
head_B -= use_head_B_and_tail_A
ans += 2*use_head_B_and_tail_A
#この段階でどれかは使い果たしている

use_num = min(head_B_and_tail_A,tail_A)
head_B_and_tail_A -= use_num
tail_A -= use_num
ans += use_num

use_num = min(head_B_and_tail_A,head_B)
head_B_and_tail_A -= use_num
head_B -= use_num
ans += use_num

use_num = min(tail_A,head_B)
#もう残りパターンは無いので算出の必要ないので省略
ans += use_num

print(ans)

Measured memory_bytes: 3064