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

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

Int N;
Int X[100000+10];
Int Y[100000+10];
Int Dx[100000+10];
Int Dy[100000+10];

double calc(double t) {
    double xmin = TEN(18);
    double xmax = -TEN(18);
    double ymin = TEN(18);
    double ymax = -TEN(18);

    for(int i = 1;i <= N;i++) {
        xmin = min(xmin, 1.0*X[i]+Dx[i]*t);
        xmax = max(xmax, 1.0*X[i]+Dx[i]*t);
        ymin = min(ymin, 1.0*Y[i]+Dy[i]*t);
        ymax = max(ymax, 1.0*Y[i]+Dy[i]*t);
    }

    return (xmax - xmin)*(ymax - ymin);
}

double solve(void) {
    double l = 0;
    double r = 1e9;
    double ans = TEN(18);

    int num = 500;
    while(num--) {
        double left = l + (r-l)/3;
        double right = left + (r-l)/3;

        double f1 = calc(left);
        double f2 = calc(right);

        if (f1 < f2)
            r = right;
        else
            l = left;

        ans = min(ans,min(f1,f2));
    }

    return ans;
}

int main(void) {
    cin>>N;

    for(int i = 1;i <= N;i++) {
        Int x,y;
        char d;
        cin>>x>>y>>d;

        X[i] = x;
        Y[i] = y;
        if(d == 'R') {
            Dx[i] = 1;
        } else if(d == 'L') {
            Dx[i] = -1;
        } else if(d == 'U') {
            Dy[i] = 1;
        } else {
            Dy[i] = -1;
        }
    }

    cout<<fixed<<setprecision(10);
    cout<<solve()<<endl;


    return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>

int fibo(int);

int main()
{
  int n, fibonacci;

  scanf("%d", &n);

  fibonacci = fibo(n);

  printf("%d\n",fibonacci);

  return 0;
}

int fibo(int n)
{
  int i, s[45];

  //  return fibo(n-1) + fibo(n-2);                                                                          

  s[0] = 1;
  s[1] = 1;

  for(i=2;i<=n;i++){
    s[i] = s[i-1] + s[i-2];
  }

  return s[n];
}

Measured memory_bytes: 596
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

struct Node {
  int key;
  Node *right, *left, *parent;
};

Node *root, *NIL;

Node * treeMinimum(Node *x) {
  while( x->left != NIL ) x = x->left;
  return x;
}

Node * find(Node *u, int k) {
  while ( u != NIL && k != u->key ) {
    if ( k < u->key ) u = u->left;
    else u = u->right;
  }
  return u;
}

Node * treeSuccessor(Node *x) {
  if ( x->right != NIL ) return treeMinimum(x->right);
  Node *y = x->parent;
  while( y != NIL && x == y->right ) {
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node *z) {
  Node *y;
  Node *x;

  if ( z->left == NIL || z->right == NIL ) y = z;
  else y = treeSuccessor(z);

  if ( y->left != NIL ) {
    x = y->left;
  } else {
    x = y->right;
  }

  if ( x != NIL ) {
    x->parent = y->parent;
  }

  if ( y->parent == NIL ) {
    root = x;
  } else {
    if ( y == y->parent->left ) {
      y->parent->left = x;
    } else {
      y->parent->right = x;
    }
  }

  if ( y != z ) {
    z->key = y->key;
  }

  free(y);
}

void insert(int k) {
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z = (Node *)malloc(sizeof(Node));
  z -> key = k;
  z -> left = NIL;
  z -> right = NIL;

  while ( x != NIL ) {
    y = x;
    if ( z->key < x->key ) {
      x = x->left;
    } else {
      x = x->right;
    }
  }

  z->parent = y;
  if ( y == NIL ) {
    root = z;
  } else {
    if ( z->key < y->key ) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void inorder(Node *u) {
  if ( u == NIL ) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(Node *u) {
  if ( u == NIL ) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}

int main() {
  int n, i, x;
  string com;

  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    cin >> com;
    if ( com[0] == 'f' ) {
      scanf("%d", &x);
      Node *t = find(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com == "insert" ) {
      scanf("%d", &x);
      insert(x);
    } else if ( com == "print" ) {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com == "delete" ) {
      scanf("%d", &x);
      treeDelete(find(root, x));
    }
  }

  return 0;
}


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

#define pf printf
#define sc scanf
#define rep0(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repU(i,bottom,ceiling) for(int (i)=(bottom);(i)<=(ceiling);(i)++)
#define repD(i,ceiling,bottom) for(int (i)=(ceiling);(i)>=(bottom);(i)--)
#define V vector
#define vi V<int>
#define pub(v,el) v.push_back(el)
#define pob(v) v.pop_back
#define ci(a) cin>>a
#define lco(a) cout<<a<<endl
#define co(a) cout<<a
#define vco(v) rep0(i,v.size()){ co(v[i]<<' '); } co('\n')
#define P pair
#define pii P<int,int>
#define mp(a,b) make_P(a,b)
#define fir first
#define sec second

typedef long long ll;
typedef double db;

const string alphabet("abcdefghijklmnopqrstuvwxyz");
const int dir[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
const int Inf=2e9+1e8;

template <typename T,typename U>                                                   
pair<T,U> operator+(const pair<T,U> & l,const pair<T,U> & r) {   
    return {l.fir+r.fir,l.sec+r.sec};                                    
} 

template <typename T,typename U> 
pair<T,U> operator-(const pair<T,U> & l,const pair<T,U> & r) {   
    return {l.fir-r.fir,l.sec-r.sec};                                    
} 
             
/*The main code follows*/

int main(){
	int n,a,b;
    cin>>n>>a>>b;
	if((a-b)%2==0) lco("Alice");
	else lco("Borys");
  return 0;
}








Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
typedef long long ll;

int M[100][100];

int main()
{
	int n;cin >> n;
	rep(i,n)
		rep(j,n)M[i][j]=INT_MAX;
		
	rep(i,n)
	{
		int hoge, hogege;
		cin >> hoge >> hogege;
		rep(j,hogege)
		{
			int foo,fooo;
			cin >> foo >> fooo;
			M[i][foo]=fooo;
		}
	}

	vector<int> color(n);
	rep(i,n)color[i]=0;
	vector<int> d(n);
	rep(i,n)d[i]=INT_MAX;
	vector<int> p(n);
	d[0]=0;
	p[0]=-1;

	while (1)
	{
		int u;
		int mincost = INT_MAX;
		rep(i,n)
		{
			if((color[i]!=2)&&(d[i]<mincost))
			{
				mincost=d[i];
				u=i;
			}
		}

		if(mincost==INT_MAX)break;

		color[u] = 2;

		rep(v,n)
		{
			if(color[v] != 2&&M[u][v]!=INT_MAX)
			{
				if(d[u] + M[u][v] < d[v])
				{
					d[v] = d[u] + M[u][v];
					p[v] = u;
					color[v] = 1;
				}
			}
		}
	}
	rep(i,n)
	{
		cout<<i<<" "<<d[i]<<endl;
	}


	

	return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define fordebug int hoge;cin>>hoge;
int a[500000];
vector<int> sosu;
int main(){
  for(int i=2;i<=300000;i++){
    if(i%7!=1&&i%7!=6) continue;
    if(a[i]==0){
      sosu.push_back(i);
      for(int j=i;j<=300000;j+=i){
	a[j]=1;
      }
    }
  }
  while(1){
    int x;
    cin>>x;
    if(x==1) break;
    cout<<x<<":";
    int i=0,count=0;
    for(i=0;i<sosu.size();i++){
      if(x%sosu[i]==0){
	if(count==0){
	  cout<<" "<<sosu[i];
	}
      }
    }
    cout<<endl;
  }
  return 0;
}



Measured memory_bytes: 4396
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}


//cout<<""<<endl;
int main(){
 
  ll N;
  cin>>N;
  vl h(N);
  rep(i,N)cin>>h[i];
  vl dp(100001);
  rep(i,N)dp[i]=100000000;
  dp[0]=0; 
  dp[1]=abs(h[0]-h[1]);
  for(ll i=1; i<N-1 ;i++){
   dp[i+1] =min(dp[i]+abs(h[i+1]-h[i]),dp[i-1]+abs(h[i+1]-h[i-1]) );
 }
 cout<<dp[N-1]<<endl;;
}





Measured memory_bytes: 4756
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long long p[60];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%lld",p+i);
	std::sort(p,p+a);
	reverse(p,p+a);
	long long ret=0;
	for(int i=0;i<a-1;i++){
		long long dif=p[0]-p[i+1];
		long long ks=dif/(a+1);
		//printf("%d: %lld %lld\n",i,dif,ks);
		ret+=ks*(i+1);
		for(int j=0;j<a;j++){
			if(j<=i){
				p[j]-=ks*a-ks*i;
			}else{
				p[j]+=ks*(i+1);
			}
		}
		//printf("%lld ",ret);
		for(int j=0;j<=i;j++){
			if(p[j]<a||p[j]<=p[i+1])break;
			p[j]-=a+1;
			for(int k=0;k<a;k++)p[k]++;
			ret++;
		}
		//printf("%lld\n",ret);
		std::sort(p,p+a);
		reverse(p,p+a);
		//for(int j=0;j<a;j++)printf("%lld ",p[j]);printf("\n");
	}
	long long ks=p[a-1]-a+1;
	if(ks>0){
		ret+=ks*a;
		for(int j=0;j<a;j++){
			p[j]-=ks;
		}
	}
	while(1){
		std::sort(p,p+a);reverse(p,p+a);
		if(p[0]<a)break;
		p[0]-=a;for(int i=1;i<a;i++)p[i]++;ret++;
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int i,j,k,n,d=0;
  cin >> n;
  int v,l[n];
  for(i=0;i<n;i++){
    cin >> l[i];
  }
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      if(l[i]>l[j]){
        v=l[i];
        l[i]=l[j];
        l[j]=v;
      }
    }
  }
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      for(k=j+1;k<n;k++){
        if(l[k]<l[i]+l[j]){
          d++;
        }
      }
    }
  }
  cout << d << endl;
}


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;
	cin >> n;
	
	string check = "MARCH";
	vector<ll> cnt(5, 0LL);
	for(int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		
		for(int j = 0; j < (int)check.size(); ++j) {
			if( s[0] == check[j] ) { 
				cnt[j]++;
			}
		}
	}
	
	ll ans = 0LL;
	for(int i = 0; i < 5; ++i) {
		for(int j = i + 1; j < 5; ++j) {
			for(int k = j + 1; k < 5; ++k) {
				ans += cnt[i] * cnt[j] * cnt[k];
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


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

typedef long long ll;
const int N = 1e5 + 77;
const int mod = (int)1e9 + 7;

int main()
{
  int n, m, x, p[105] = {0}, ans, mn = 105;
  scanf("%d%d", &x, &n);
  for (int i = 0; i < n; i++)
  {
    scanf("%d", &m);
    p[m] = 1;
  }
  for (int j = 0; j <= 101; j++)
  {
    if (!p[j] and abs(j - x) < mn)
    {
      mn = abs(j - x);
      ans = j;
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 3828
#include <algorithm>
#include <bitset>
#include <climits>
#include <complex>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <vector>

#include <stdio.h>

using ll = long long;
using namespace std;

ll to5(ll a) { return a * a * a * a * a; }

int main() {
    ios::sync_with_stdio(false);
    string s;
    cin >> s;

    vector<int> v(4);
    for (int i = 0; i < 4; i++) {
        v[i] = s[i] - '0';
    }

    for (int i = 0b000; i <= 0b111; i++) {
        int sum = v[0];
        if (i & 0b100)
            sum += v[1];
        else
            sum -= v[1];
        if (i & 0b10)
            sum += v[2];
        else
            sum -= v[2];
        if (i & 0b1)
            sum += v[3];
        else
            sum -= v[3];

        if (sum == 7) {
            char f1 = (i & 0b100) ? '+' : '-';
            char f2 = (i & 0b10) ? '+' : '-';
            char f3 = (i & 0b1) ? '+' : '-';
            printf("%d%c%d%c%d%c%d=7\n", v[0], f1, v[1], f2, v[2], f3, v[3]);
            return 0;
        }
    }

    return 0;
}


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

#define DEBUG(X) if(X)
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)

int main()
{
  FASTIO;
  string str;
  cin >> str;
  int q;
  cin >> q;
  list<char> ls;
  bool reversed = false;
  for(int i = 0, end = str.size(); i < end; i++)
    ls.push_back(str[i]);
  while(q--)
  {
    int op;
    cin >> op;
    if(op == 1)
      reversed = !reversed;
    else
    {
      int x;
      char c;
      cin >> x >> c;
      if(x == 1)
      {
        if(!reversed) 
          ls.push_front(c);
        else  
          ls.push_back(c);
      }
      else
      {
        if(!reversed)
          ls.push_back(c);
        else  
          ls.push_front(c);
      }
    }
  }

  if(reversed)
    reverse(ls.begin(), ls.end());
  for(auto itr = ls.begin(); itr != ls.end(); itr++) 
      cout << *itr; 
  cout << endl;
  return 0;
}
// coloco a , n -= a, 
/*
  12 3 4
  bbbrrrrbbbrr
*/


Measured memory_bytes: 10064
N, K = map(int, input().split())
h = []
for i in range(N):
    h.append(int(input()))
h = sorted(h)

min_diff = 1000000000
for i in range(N - K + 1):
    diff = h[i + K - 1] - h[i]
    if min_diff > diff:
        min_diff = diff
print(min_diff)

Measured memory_bytes: 51160
use std::cmp::*;
use std::io::*;

fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        return a;
    }
    gcd(b, a % b)
}
fn gcd_array(a: &Vec<u64>) -> u64 {
    let mut res = a[0];
    for i in 1..a.len() {
        res = gcd(res, a[i]);
    }
    res
}

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let k: u64 = itr.next().unwrap().parse().unwrap();
    let mut a: Vec<u64> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    a.sort();
    a.reverse();
    let g = gcd_array(&a);
    if a[0] < k || k % g != 0 {
        println!("IMPOSSIBLE");
    } else {
        println!("POSSIBLE");
    }
}


Measured memory_bytes: 3956
N = int(input())
a = list(map(int,input().split()))
dp = [0,abs(a[0]-a[1])]
for i in range(2,N):
    dp.append(min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2])))
print(dp[N-1])

Measured memory_bytes: 13980
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define gcd __gcd
#define all(x) (x).begin(), (x).end()
template<class T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<class T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
int lcm(int a, int b) {return a / gcd(a, b) * b;}
const int INF = 1e18, MOD = 1e9 + 7;
signed main() {
    INCANT;
    int n, m, res = 0, l = 1, tmp, cnt2 = 0;
    cin>>n>>m;
    int a[111111];
    rep(i, n) {
        cin>>a[i];
        tmp = a[i];
        if(i == 0) {
            while(tmp % 2 == 0) {
                cnt2++;
                tmp /= 2;
            }
        } else {
            int cntt = 0;
            while(tmp % 2 == 0) {
                cntt++;
                tmp /= 2;
            }
            if(cntt != cnt2) {
                cout<<0<<endl;
                return 0;
            }
        }
        a[i] /= 2;
        l = lcm(l, a[i]);
    }
    cout<<(m / l + 1) / 2<<endl;
}


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

void solve(ll H, ll W, vector<string> &S){
    for(ll i=0; i< 2*H; i++){
        cout << S[i/2] << endl;
    }
}

int main(){
    ll H, W;
    cin >> H >> W;
    vector<string> S(H);
    for(ll i=0; i< H; i++){
        cin >> S[i] ;
    }
    solve(H,W, S);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 2e5 + 30, Mod = 1e9 + 7;
const ll SQ = 330 ;
const ll INF = 1e17;

ll a[N];
int main () {
    ios::sync_with_stdio(0), cin.tie(0);
    string s;
    cin >> s;
    s = '.' + s;
    if (s[3] == s[4] && s[5] == s[6]) cout << "Yes";
    else cout << "No";
	    
    return (0);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Main instance = new Main();

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int N = scan.nextInt();
		int[] a = new int[N];

		for (int i = 0; i < N; i++) {
			a[i] = scan.nextInt();
		}

		//WK変数
		int result =0;

		//演算
		for (int i = 0; i < N; i += 2) {
			result += a[i] % 2;
		}

		//結果出力
		System.out.println(result);
	}
}

Measured memory_bytes: 35880
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

signed main (){
    ll n;cin>>n;
    vector<int> v(101,0);
    rep(i,2,n+1){
        int k=i;
        rep(j,2,i+1){
            while(k%j==0){
                v[j]++;
                k/=j;
            }
        }
    }
    int ans=0;
    sort(all(v));
    rep(i,2,101){
        if(v[i]>=74)ans++;
        rep(j,2,101){
            if(i==j)continue;
            if(v[i]>=14&&v[j]>=4)ans++;
            if(v[i]>=24&&v[j]>=2)ans++;
            rep(k,j+1,101){
                if(i==k)continue;
                if(v[i]>=2&&v[j]>=4&&v[k]>=4)ans++;
            }
        }
    }
    cout<<ans<<endl;


    
}

/*
1-21-2
*/


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

int main(){
int a,b,day;
string Day;
int days[]={31,29,31,30,31,30,31,31,30,31,30,31};
string Days[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
while(cin>>a>>b){
	if(a==0)break;
day=4;
for(int i=0;i<11;i++){
if(a>i+1)b+=days[i];}
day+=b-1;
day%=7;
for(int i=0;i<7;i++){
if(day==i)Day=Days[i];}
cout<<Day<<endl;}}

Measured memory_bytes: 0
#!/usr/bin/env python3

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from fractions import gcd                    # for Python3.4.3


def main():
    mod = 10000007                  # 10^9+7
    inf = float('inf')
    input = sys.stdin.readline      # 改行文字が残ることに注意
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def ii():  return int(input())
    def mi():  return map(int, input().rstrip().split())
    def lmi(): return list(map(int, input().rstrip().split()))
    def li():  return list(input().rstrip())
    
    s = input().rstrip()
    day =  ['SUN','MON','TUE','WED','THU','FRI','SAT']
    print(7 - day.index(s))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cmath>
using  namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	if(m%n){
		int t=m/n+1;
		for(int i=t;i>=1;i--)
		{
			if(m%i==0)
			{
				cout<<i<<endl;
				break;
			}
		}
	}
	else
		cout<<m/n<<endl;
	return 0;
}


Measured memory_bytes: 256
while True:
    H,W=map(int, input().split())
    if H == 0 and W == 0 :
        break
    for h in range(H):
        for w in range(W):
            if (h+w) % 2 == 0:
                print("#",end='')
            else :
                print(".",end='')
        print()
    print()


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

int n, m, x;

int main() {
  cin >> n >> m >> x;
  
  int cost_to_0 = 0;
  int cost_to_n = 0;
  for (int i = 0; i < m; ++i) {
    int a; cin >> a;
    if (a < x) cost_to_0++;
    else cost_to_n++;
  }
  
  cout << min(cost_to_0, cost_to_n) << endl;
  
  return 0;
}

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

int main() {

  string S;
  cin >> S;

  string s_1 = S.substr(0, 2);
  string s_2 = S.substr(2, 2);

  ll i_1 = atoi(s_1.c_str());
  ll i_2 = atoi(s_2.c_str());

  string ans;

  if ( (1 <= i_1) and (i_1 <= 12) ) {
    // MMYY or AMB
    if ( (1 <= i_2) and (i_2 <= 12) ) {
      // AMB
      ans = "AMBIGUOUS";
    }
    else {
      // MMYY
      ans = "MMYY";
    }
  }
  else {
    // YYMM or NA
    if ( (1 <= i_2) and (i_2 <= 12) ) {
      // YYMM
      ans = "YYMM";
    }
    else {
      // NA
      ans = "NA";
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[6];
int main()
{
  scanf("%s",a);
  for(int i=1;i<=strlen(a);i++)
  {
    if(a[2]==a[3]&&a[4]==a[5])
    {
      	printf("Yes\n");
      	return 0;
    }
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define M 200005
int n,A[M],K[M],ans;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>A[i];
	for(int i=n;i>=1;i--){
		int p=1,k=0;
		while(p*i<=n)k+=K[p*i],p++;
		k%=2;
		K[i]=(A[i]-k+2)%2;
		K[i]?ans++:ans=ans;
	}
	cout<<ans<<endl;
	for(int i=1;i<=n;i++)
		if(K[i])cout<<i<<" ";
	return 0;
}

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

int n;

int getMax(vector< vector<int> > f){
  int ma = 0;
  for(int i=0; i < n; i++){
    for(int j=0; j < n; j++){
      ma = max(ma, f[i][j]);
    }
  }
  return ma;
}

int main(void){
  while(cin >> n, n){
    vector< vector <int> > table(n, vector<int>(n));
    for(int i=0; i < n; i++){
      string tmp;
      cin >> tmp;
      for(int j=0; j < n; j++){
        table[i][j] = tmp[j] - '0';
      }
    }

    vector< vector <int> > h  = table;
    vector< vector <int> > v  = table;
    vector< vector <int> > l1 = table;
    vector< vector <int> > l2 = table;


    for(int p = 0; p < n; p++){
      for(int q = 1; q < n; q++){
        if(table[p][q] == 1){
          h[p][q] = h[p][q-1] + 1;
        }
      }
    }
    for(int p = 1; p < n; p++){
      for(int q = 0; q < n; q++){
        if(table[p][q] == 1){
          v[p][q] = v[p-1][q] + 1;
        }
      }
    }
    for(int p = 1; p < n; p++){
      for(int q = 1; q < n; q++){
        if(table[p][q] == 1){
          l1[p][q] = l1[p-1][q-1] + 1;
        }
      }
    }
    for(int p = 1; p < n; p++){
      for(int q = 0; q < n-1; q++){
        if(table[p][q] == 1){
          l2[p][q] = l2[p-1][q+1] + 1;
        }
      }
    }

    vector<int> kouho(4, 0);
    kouho[0] = getMax(h); 
    kouho[1] = getMax(v); 
    kouho[2] = getMax(l1); 
    kouho[3] = getMax(l2); 

    cout << *max_element(kouho.begin(), kouho.end()) << endl;

  }
  return 0;
}

Measured memory_bytes: 2684
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
const long long md=1000000007;
string s1,s2;
int n,p;
bool ok;
long long ans;
int main()
{
	cin>>n>>s1>>s2;
	if(s1[0]==s2[0])
	{
		ans=3;
		p++;
		ok=true;
	}
	else
	{
		ans=6;
		p+=2;
		ok=false;
	}
	while(p<n)
	{
		if(s1[p]==s2[p])
		{
			if(ok)
			{
				ans*=2;
			}
			p++;
			ok=true;
		}
		else
		{
			if(ok)
			{
				ans*=2;
			}
			else
			{
				ans*=3;
			}
			p+=2;
			ok=false;
		}
		ans%=md;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <ios>
#include <iomanip>

using namespace std;
typedef long long ll;

int main()
{
    int A[3][2];
    int count[4];
    for (int i=0;i<4;i++){
        count[i]=0;
    }
    for (int i=0;i<3;i++){
        cin >> A[i][0] >> A[i][1];
        count[A[i][0]-1]++;
        count[A[i][1]-1]++;
    }
    int cnt=0;
    for (int i=0;i<4;i++){
        if(count[i] == 1){
            cnt++;
        }
    }
    if (cnt == 2){
        cout << "YES";
    }
    else{
        cout << "NO";
    }
    // system("pause");
}

Measured memory_bytes: 256
package main

import "fmt"

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	var a, b, c, x, y int
	fmt.Scan(&a, &b, &c, &x, &y)

	mx := max(x, y)
	ans := 2147483647

	for i := 0; i <= mx; i++ {
		if x := a*max(x-i, 0) + b*max(y-i, 0) + c*(i*2); x < ans {
			ans = x
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<iostream>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<bits/stdc++.h>
#include<limits>

#define lp2(i,n) for(int i=0;i<n;i++)
#define lp3(i,a,b) for(int i=a;i<b;i++)

using namespace std;
int main(){
  int a,b,c,n;
  cin>>a>>b>>c>>n;
  int mx=max(a,b);
	mx=max(mx,c);
	//cout<<mx<<endl;
  int cmx=mx;
  lp2(i,n){
    mx*=2;
  }
  int ans=mx+a+b+c-cmx;
  cout<<ans<<endl;
  //cout<<mx;
  return 0;
  
}


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

#define F first
#define S second
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),a.end()
#define pw(x) (1LL<<(x))

#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define dbv(a) cerr << #a << " = "; for (auto xxxx: a) cerr << xxxx << " "; cerr << endl

using namespace std;

typedef long long ll;
typedef double dbl;
const int INF = 1.01e9;
const int MOD = 1e9 + 7;




int main() {
#define TASK "A"
#ifdef HOME
    assert(freopen(TASK".in", "r", stdin));
#endif
    int n, m;
    scanf("%d%d", &n,  &m);
    int s, t;
    scanf("%d%d", &s, &t); s--; t--;
    vector<vector<pair<int,ll>>> e(n);
    for (int i = 0; i < m; i++) {
        int v, u, d;
        scanf("%d%d%d", &v, &u, &d); v--; u--;
        d *= 2;
        e[v].pb({u, d});
        e[u].pb({v, d});
    }

    auto dijkstra = [&](int st, vector<ll>& dist, vector<ll>& comb) {
        //db(st);
        dist.resize(n, 1e18);
        comb.resize(n);
        dist[st] = 0;
        comb[st] = 1;
        set<pair<ll,int>> q;
        q.insert({0, st});
        while (!q.empty()) {
            int v = q.begin()->S;
            q.erase(q.begin());
            for (auto x: e[v]) {
                int u = x.F;
                if (dist[u] > dist[v] + x.S) {
                    q.erase({dist[u], u});
                    dist[u] = dist[v] + x.S;
                    comb[u] = 0;
                    q.insert({dist[u], u});
                }
                if (dist[u] == dist[v] + x.S) {
                    comb[u] = (comb[u] + comb[v]) % MOD;
                }
            }
        }
    };

    vector<ll> distS, distT, combS, combT;
    dijkstra(s, distS, combS);
    dijkstra(t, distT, combT);

    ll len = distS[t];
//    db(len);
//    dbv(distS);
//    dbv(distT);
//    db2(distS[t], distT[s]);
    assert(len == distT[s]);
    assert(len % 2 == 0);

    vector<ll> meet;

    ll answer = 0;
    answer = combS[t] * combS[t] % MOD;
    auto sqr = [&](ll x) {
        return x * x % MOD;
    };

    for (int i = 0; i < n; i++) {
        if (distS[i] == distT[i] && distS[i] == len / 2)  {
            answer = (answer - sqr(combS[i] * combT[i] % MOD) + MOD) % MOD;
        }
        for (auto x: e[i]) {
            int u = x.F;
            if (distT[u] + x.S + distS[i] == len && distT[u] < len / 2 && distS[i] < len / 2) {
                //meet.pb(combS[i] * combT[u] % MOD);
                answer = (answer - sqr(combS[i] * combT[u] % MOD) + MOD) %  MOD;
            }
        }
    }
    ll sum = 0;
    for (auto x: meet) {
        sum = (sum + x) % MOD;
    }

    for (auto x: meet) {
        answer = (answer + x * (sum - x + MOD)) % MOD;
    }
    cout << answer << endl;
    return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
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; }
//template end

template<typename M,typename N=M>
struct LazySegmentTree{
    using F=function<M(M,M)>; using G=function<M(M,N)>; using H=function<N(N,N)>;
    int sz,height; vector<M> data; vector<N> lazy;
    const F f;const G g; const H h; const M m1; const N n1;
    LazySegmentTree(int n,const F f,const G g,const H h,const M &m1,const N n1):f(f),g(g),h(h),m1(m1),n1(n1){
        sz=1,height=0; while(sz<n)sz<<=1,height++;
        data.assign(2*sz,m1); lazy.assign(2*sz,n1);
    }
    void build(vector<M> v){
        rep(i,0,v.size())data[i+sz]=v[i];
        rrep(k,sz-1,0)data[k]=f(data[2*k],data[2*k+1]);
    }
    M ref(int k){return lazy[k]==n1?data[k]:g(data[k],lazy[k]);}
    void recalc(int k){while(k>>=1)data[k]=f(ref(2*k),ref(2*k+1));}
    void thrust(int k){rrep(i,height,0)eval(k>>i);}
    void eval(int k){
        if(lazy[k]!=n1){
            lazy[2*k]=h(lazy[2*k],lazy[k]); lazy[2*k+1]=h(lazy[2*k+1],lazy[k]);
            data[k]=ref(k); lazy[k]=n1;
        }
    }
    void update(int a,int b,N x){
        thrust(a+=sz); thrust(b+=sz-1);
        for(int l=a,r=b+1;l<r;l>>=1,r>>=1){
            if(l&1)lazy[l]=h(lazy[l],x),++l;
            if(r&1)--r,lazy[r]=h(lazy[r],x);
        }
        recalc(a); recalc(b);
    }
    M query(int a,int b){
        thrust(a+=sz); thrust(b+=sz-1);
        M L=m1,R=m1;
        for(int l=a,r=b+1;l<r;l>>=1,r>>=1){
            if(l&1)L=f(L,ref(l++)); if(r&1)R=f(ref(--r),R);
        } return f(L,R);
    }
};

typedef pair<int,int> P;

int main(){
    int n,m; scanf("%d%d",&n,&m);
    vector<int> l(m),r(m),c(m);
    rep(i,0,m)scanf("%d%d%d",&l[i],&r[i],&c[i]),l[i]--;
    vector<P> rs[100010];
    rep(i,0,m)rs[l[i]].push_back({r[i],c[i]});
    LazySegmentTree<ll> dp(n,
    [](ll a,ll b){return min(a,b);},
    [](ll a,ll b){return min(a,b);},
    [](ll a,ll b){return min(a,b);},INF,INF);
    dp.update(0,1,0);
    rep(i,0,n-1){
        ll d=dp.query(i,i+1);
        if(d==INF){
            printf("-1\n"); return 0;
        }
        for(P r:rs[i]){
            dp.update(i,r.first,d+r.second);
        }
    }
    ll ans=dp.query(n-1,n);
    if(ans==INF)printf("-1\n");
    else printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 10880
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class24
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            var W = new Dictionary<string, bool>();
            bool frag = true;
            char c = ' ';
            for(int i = 0; i < N; i++)
            {
                string r = Console.ReadLine();
                if(r[0]==c|c==' ')
                {
                    c = r.Last();
                    if (W.ContainsKey(r))
                    {
                        frag = false;
                        break;
                    }
                    else
                        W[r] = true;
                }
                else
                {
                    frag = false;
                    break;
                }
            }
            Console.WriteLine(frag ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 13152
n = int(input())
a = list(map(int, input().split()))
state = None
cnt = 1
for i in range(1, n):
    if state == None:
        if a[i] > a[i-1]:
            state = 'up'
        elif a[i] < a[i-1]:
            state = 'down'
        else:
            continue
    elif state == 'up' and a[i] < a[i-1]:
        cnt += 1
        state = None
    elif state == 'down' and a[i] > a[i-1]:
        cnt += 1
        state = None
print(cnt)


Measured memory_bytes: 20436
#include <bits/stdc++.h>
#define double long double
using namespace std;
const double INF = 3e3;
const double EPS = 1e-11;

// ????¬????
struct P3{
  double x,y,z;
  double vx,vy,vz;
  double r,vr;
  P3(double x=0, double y=0, double z=0):x(x),y(y),z(z){}
  P3 operator + (const P3 &a) const{ return P3(x+a.x, y+a.y, z+a.z); }
  P3 operator - (const P3 &a) const{ return P3(x-a.x, y-a.y, z-a.z); }
  P3 operator * (const double &c) const{ return P3(x*c, y*c, z*c); }
  void input(){scanf("%Lf%Lf%Lf%Lf%Lf%Lf%Lf%Lf",&x,&y,&z,&vx,&vy,&vz,&r,&vr);};
  P3 v ()const{return P3(vx,vy,vz);}
};
P3 operator * (double c, const P3 &a){ return P3(c * a.x, c * a.y, c * a.z); }


double norm(const P3 &a){ return a.x*a.x + a.y*a.y + a.z*a.z; }
double abs(const P3 &a){ return sqrt(norm(a)); }

typedef pair<int,int> P;
typedef pair<double,P> PP;

double calc(const P3 &A,const P3 &B,double t){
  if((A.r-t*A.vr)<0|| (B.r-t*B.vr)<0) return -1;
  return abs((A+t*A.v())-(B+t*B.v())) - ((A.r-t*A.vr) + (B.r-t*B.vr));
}

double calc(const P3 &A,const P3 &B){
  double L=0,R=INF,cnt = 65;
  while(cnt--){
    double M = (L+R)/2;
    double y1 = calc(A,B,M);
    double y2 = calc(A,B,M+EPS);
    if(y1<0||y1-y2<0) R = M;
    else L = M+EPS;
  }
  return L-EPS;
}

int main(){
  int n;
  while(cin>>n,n){
    vector<P3>A(n);
    for(int i=0;i<n;i++) A[i].input();

    priority_queue<PP,vector<PP>,greater<PP> >Q;
    for(int i=0;i<n;i++)
      for(int j=i+1;j<n;j++){
	double t = calc(A[i],A[j]);
	if(abs(calc(A[i],A[j],t))<2e-8)Q.push(PP(t,P(i,j)));
      }

    vector<double> ans(n,-1);
    while(!Q.empty()){
      PP t = Q.top();Q.pop();
      double c = t.first;
      int a = t.second.first;
      int b = t.second.second;
      if(ans[a]>=0||ans[b]>=0)continue;
      ans[a] = ans[b] = c;
    }

    for(int i=0;i<n;i++){
      if(ans[i]<0) ans[i] = A[i].r / A[i].vr;
      ans[i] = min(ans[i],A[i].r / A[i].vr);
      printf("%.10Lf\n",ans[i]);
    }    
    
  }
  return 0;    
}

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

signed main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);

  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  int i = 0, j = 0;
  string ret = "";
  while (i < n){
    ret += s[i];
    ret += t[i];
    i++;
  }
  cout << ret << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;


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

  ll N;
  cin >> N;

  ll ans = 0;

  ans += N / 500 * 1000;
  ll nokori = 0;
  nokori = N % 500;
  ans += nokori / 5 * 5;

  cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	int n, k;
	string s, t;
	cin >> s >> t;
	if(s == t){
		cout << "No" << endl;
		return 0;
	}
	n = s.size();
	k = t.size();

	int z = Min(n,k);

	vector<char> a(n);
	vector<char> b(k);
	rep(i,n) a[i] = s[i];
	rep(i,k) b[i] = t[i];

	sort(all(a));
	sort(all(b), greater<int>());

	rep(i,n) s[i] = a[i];
	rep(i,k) t[i] = b[i];

	set<string> m;
	m.insert(s);
	m.insert(t);

	auto itr = m.begin();

	if(*itr == s) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <limits>
#include <iomanip>
#include <queue>
#include <cmath>
#include <math.h>
#include <string>
#include <cmath>
#include <bitset>
using namespace std;
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; }
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;
typedef long long ll;
#define min(a, b) ((a) < (b) ? (a) : (b))
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)



int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	// cout << std::fixed << std::setprecision(15);
	int N; cin >> N;
	vector<vector<int>> data(2, vector<int>(N));
	vector<long> res;
	for (int i = 0; i < 2; ++i) {
		for (int j = 0; j < N; ++j) {
			cin >> data.at(i).at(j);
		}
	}
	int count = 0;
	while (count < N) {
		long tmp = 0;
		for (int i = 0; i < N; i++) {
			if (i < count) {
				tmp += data.at(0).at(i);
			}
			else if(i == count){
				tmp += data.at(0).at(i);
				tmp += data.at(1).at(i);
			}
			else
			{
				tmp += data.at(1).at(i);
			}
		}
		res.push_back(tmp);
		++count;
	}
	sort(res.begin(), res.end(), greater<long>());
	cout << res.at(0) << endl;
}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n, m = input_to_int_map()
    ps = [input().split() for i in range(m)]

    success_cnts = [0] * (n + 1)
    wrong_cnts = [0] * (n + 1)

    for p, s in ps:
        if success_cnts[int(p)] > 0:
            continue

        if s == "AC":
            success_cnts[int(p)] += 1
        elif s == "WA":
            wrong_cnts[int(p)] += 1

    success_cnt = 0
    wrong_cnt = 0
    for i, success in enumerate(success_cnts):
        if success > 0:
            success_cnt += 1
            wrong_cnt += wrong_cnts[i]

    print(" ".join([str(success_cnt), str(wrong_cnt)]))


if __name__ == "__main__":
    main()


Measured memory_bytes: 33680
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    a, b = map(int, input().split())

    def f(n):
        if n % 4 == 0:
            return n
        elif n % 4 == 1:
            return 1
        elif n % 4 == 2:
            return ((n // 4) + 1) * 4 - 1
        else:
            return 0

    print(f(b) ^ f(a - 1))


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9048
k, x = gets.split.map(&:to_i)

MIN = -1_000_000
MAX = 1_000_000

head = x - (k - 1)
tail = x + (k - 1)

if head <= MIN
  puts (MIN..tail).to_a.join(' ')
elsif tail >= MAX
  puts (head..MAX).to_a.join(' ')
else
  puts (head..tail).to_a.join(' ')
end


Measured memory_bytes: 1788
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int length = s.length();
        int result = 0;
        int a1=0;//奇数番目の1の数
        int b1=0;//偶数番目の1の数
        int a0=0;//奇数番目の0の数
        int b0=0;//偶数番目の0の数
      
        for(int i=0;i<s.length();i++){
          if(i%2==0){
            if(s.charAt(i)=='0'){
              a0++;
            }else{
              a1++;
            }
          }else{
            if(s.charAt(i)=='0'){
              b0++;
            }else{
              b1++;
            }
          }
        }
      //奇数番目を0にする場合
      result = a1+b0;
      //偶数番目を0にする場合
      if(b1+a0 < result)result = b1+a0;
      System.out.println(result);
	}
}

Measured memory_bytes: 26344
s=input()
l=len(s)
a=[]
b=[]
i=0
for _ in range(l//2):
  a.append(s[i])
  b.append(s[i+1])
  i+=2
if l%2==1:
  a.append(s[l-1])
a0=a.count('0')
a1=a.count('1')
b0=b.count('0')
b1=b.count('1')
x=max(a0+b1,a1+b0)
print(l-x)

Measured memory_bytes: 4084
N, K = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N)]

def solve(k):
  res = 0
  for a, b in AB:
    if a | k <= k:
      res += b
  return res

ans = solve(K)
while K:
  bottom1 = K & -K
  k = (K ^ bottom1) + (bottom1 - 1)
  ans = max(ans, solve(k))
  K ^= bottom1

print(ans)

Measured memory_bytes: 27472
import math
import sys
import itertools
from math import gcd
from math import sqrt
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)

N = ii()
A = [i for i in mips()]
ans = 0
for i in range(N-1):
    if A[i] > A[i+1]:
        ans += abs(A[i]-A[i+1])
        A[i+1] = A[i]
print(ans)

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

using namespace std;

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

const ll INFLL = (1ll<<60);

int h,w;
ll u[35][35],s;
bool done[35][35][35][35];
P memo[35][35][35][35];

P solve(int xl, int xr, int yl, int yr){
	int i;
	ll t;
	P p,vl,vr;
	t = u[xr][yr] - u[xl][yr] - u[xr][yl] + u[xl][yl];
	if(done[xl][xr][yl][yr]){
		return memo[xl][xr][yl][yr];
	}
	done[xl][xr][yl][yr] = true;
	if(u[h][w] - t > s){
		memo[xl][xr][yl][yr].first = -INFLL;
		memo[xl][xr][yl][yr].second = -INFLL;
		return memo[xl][xr][yl][yr];
	}
	memo[xl][xr][yl][yr].first = 1ll;
	memo[xl][xr][yl][yr].second = s + t - u[h][w];
	for(i=xl+1; i<xr; ++i){
		vl = solve(xl,i,yl,yr);
		vr = solve(i,xr,yl,yr);
		p.first = vl.first + vr.first;
		p.second = min(vl.second,vr.second);
		if(p.first > memo[xl][xr][yl][yr].first){
			memo[xl][xr][yl][yr].first = p.first;
			memo[xl][xr][yl][yr].second = p.second;
		}else if(p.first == memo[xl][xr][yl][yr].first && p.second > memo[xl][xr][yl][yr].second){
			memo[xl][xr][yl][yr].second = p.second;
		}
	}
	for(i=yl+1; i<yr; ++i){
		vl = solve(xl,xr,yl,i);
		vr = solve(xl,xr,i,yr);
		p.first = vl.first + vr.first;
		p.second = min(vl.second,vr.second);
		if(p.first > memo[xl][xr][yl][yr].first){
			memo[xl][xr][yl][yr].first = p.first;
			memo[xl][xr][yl][yr].second = p.second;
		}else if(p.first == memo[xl][xr][yl][yr].first && p.second > memo[xl][xr][yl][yr].second){
			memo[xl][xr][yl][yr].second = p.second;
		}
	}
	return memo[xl][xr][yl][yr];
}

ostream& operator <<(ostream& o, const P &rhs){
	o << rhs.first << " " << rhs.second;
	return o;
}

int main(void){
	int i,j;
	while(cin >> h >> w >> s){
		if(!(h||w||s)){
			break;
		}
		fill(done[0][0][0],done[35][0][0],false);
		fill(u[0],u[35],0ll);
		for(i=0; i<h; ++i){
			for(j=0; j<w; ++j){
				cin >> u[i+1][j+1];
			}
		}
		for(i=0; i<=h; ++i){
			for(j=0; j<=w; ++j){
				u[i+1][j] += u[i][j];
			}
		}
		for(i=0; i<=h; ++i){
			for(j=0; j<=w; ++j){
				u[i][j+1] += u[i][j];
			}
		}
		cout << solve(0,h,0,w) << endl;
	}
	return 0;
}


Measured memory_bytes: 28012
from collections import deque
N=int(input())
A=list(map(int,input().split()))
l=[]
r=[]
for i in range(N):
  if i%2==0:
    r.append(A[i])
  else:
    l.append(A[i])
if N%2==0:
  print(*(list(reversed(l))+r))
else:
  print(*(list(reversed(r))+l))

Measured memory_bytes: 25412