akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

long long modpow(long long a, int p){
    if(p == 0) return 1;
    if(p % 2 == 0){
        int halfP = p / 2;
        long long half = modpow(a, halfP);
        return half * half % MOD;
    }else{
        return a * modpow(a, p-1) % MOD;
    }
}

ll arr[1100000];
ll kaijou(ll x){
    if(x == 0) return 1;
    if(x == 1) return 1;
    if(arr[x] != 0) return arr[x];
    arr[x] = x*kaijou(x-1) % MOD;
    return arr[x];
}

long long calcComb(int a, int b){
    if(b > a - b) return calcComb(a, a - b);

    long long ansMul = 1;
    long long ansDiv = 1;
    /*
    for(int i = 0; i < b; i++){
        ansMul *= (a - i);
        ansDiv *= (i + 1);
        ansMul %= MOD;
        ansDiv %= MOD;
    }
    */

    //long long ans = ansMul * modpow(ansDiv, MOD - 2) % MOD;
    //cout << a-b << endl;
    long long ans = kaijou(a) * modpow(kaijou(a-b), MOD-2);
    ans %= MOD;
    ans *= modpow(kaijou(b), MOD - 2 );
    ans %= MOD;
    //cout << ans << endl;
    return ans;
}

ll c1[110000], c2[110000];

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

    ll h, w, a, b; cin >> h >> w >> a >> b;



    ll ans = 0;
    FOR(i, b, w){
        c1[i] = calcComb(h-a-1+i, i);
        c2[i] = calcComb(a-1+w-i-1, w-i-1);
    }

    
    rep(i, w-b){
        ans += c1[b+i]*c2[b+i];
        ans %= MOD;
    }
    

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N;
  cin>>N;
vector<ll> A(N);
  for(ll i=0;i<N;i++) {
cin>>A[i];
  }
  pair<ll,ll>  mas;
  pair<ll,ll> ma;
  for(ll i=0;i<N;i++) {
if(A[i]>mas.first) {
mas.first=A[i];
  mas.second=i;
}
    else if(ma.first<A[i]) {
ma.first=A[i];
      ma.second=i;
    }
  }
  
  for(ll i=0;i<N;i++) {
if(A[i]==mas.first&&i==mas.second) {
cout<<ma.first<<endl;
}
    else {
cout<<mas.first<<endl;
    }
  }
}
  
  

  
  


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

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

  int dp[100010][3];

  for(int i=0;i<N;i++){
    int a,b,c;
    cin >> a >> b >> c;
    if(i==0){
      dp[i][0] = a;
      dp[i][1] = b;
      dp[i][2] = c;
    }else{
      dp[i][0] = a + max({dp[i-1][1],dp[i-1][2]});
      dp[i][1] = b + max({dp[i-1][0],dp[i-1][2]});
      dp[i][2] = c + max({dp[i-1][0],dp[i-1][1]});
    }
  }
  cout << max({dp[N-1][0],dp[N-1][1],dp[N-1][2]});
}


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

using namespace std;

int n, m;

void solve()
{
    int grid[n][n];
    int pic[m][m][4]; // 0, 90, 180, 270.

    // Input 窓
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            cin >> grid[i][j];

    // Input 写真
    pair<int, int> top[4]; // (x, y) = (first, second)
    for (int i = 0; i < m; ++i)
        for (int j = 0; j < m; ++j) {
            cin >> pic[i][j][0];
            pic[j][m - i - 1][1] = pic[i][j][0];
            pic[m - i - 1][m - j - 1][2] = pic[i][j][0];
            pic[m - j - 1][i][3] = pic[i][j][0];
        }

    // Set most position (top, left) of 写真
    for (int k = 0; k < 4; ++k) {
        bool change = false;
        for (int i = 0; i < m; ++i) {
            if (change)
                break;
            for (int j = 0; j < m; ++j)
                if (pic[i][j][k] != -1) {
                    top[k].first = j;
                    top[k].second = i;
                    change = true;
                    break;
                }
        }
    }

    int ax = n, ay = n;
    for (int i = 0; i + m <= n; ++i) {
        for (int j = 0; j + m <= n; ++j) {

            for (int k = 0; k < 4; ++k) {
                bool change = true;
                for (int dy = 0; dy < m; ++dy) {
                    if (!change)
                        break;
                    for (int dx = 0; dx < m; ++dx)
                        if (pic[dy][dx][k] != -1 &&
                            grid[i + dy][j + dx] != pic[dy][dx][k]) {
                            change = false;
                            break;
                        }
                }
                if (change) {
                    if ((top[k].second + i < ay) ||
                        (top[k].second + i == ay && top[k].first + j < ax)) {
                        ax = top[k].first + j;
                        ay = top[k].second + i;
                    }
                }
            }

        }
    }

    if (ax < n && ay < n)
        cout << ax + 1 << " " << ay + 1 << endl;
    else
        cout << "NA\n";
}

int main()
{
    while (cin >> n >> m, n || m) {
        solve();
    }

    return 0;
}

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

int n,pos;
vector<int> pre,in,post;


void rec(int l,int r){
	if(l>=r) return;
	int root = pre[pos++];
	int m=distance(in.begin(),find(in.begin(),in.end(),root));
	rec(l,m);
	rec(m+1,r);
	post.push_back(root);
}

void solve(){
	pos=0;
	rec(0,pre.size());
	for(int i=0;i<n;i++){
		if(i) cout<<" ";
		cout<<post[i];
	}
	cout<<endl;
}

int main() {
	
	int k;
	cin>>n;
	
	for(int i=0;i<n;i++){
		cin>>k;
		pre.push_back(k);
	}
	
	for(int i=0;i<n;i++){
		cin>>k;
		in.push_back(k);
	}
	
	solve();
	
	return 0;
}

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

int main(void) {
  int N, K;
  cin >> N >> K;
  int dist = 0;
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    dist += min(abs(x - K), abs(x - 0)) * 2;
  }
  cout << dist << endl;
  return 0;
}

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

int main(){
    string S;
    cin >> S;
    size_t N = S.length();
    bool ans = true;
    int i;
    
    for(i = 0; i< N; i++){
        if(i % 2 ==0){
            if(S[i] != 'R' && S[i] != 'U' && S[i] != 'D'){
                ans = false;
            }
        }else{
            if(S[i] != 'L' && S[i] != 'U' && S[i] != 'D'){
                ans = false;
            }
        }
    }
    if(ans == true){
        cout << "Yes" << endl;
    }else if(ans == false){
        cout << "No" << endl;
    }
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <cmath>
#include <queue>
#include <ctime>
#include <utility> // std::pair
#include <functional> // std::greater <int> ()
#define int long long
#define inf 1000000000000000001
#define BASE 29 // hashings mod, can be rand'd
#define mod 998244353 // can be 1000000007
#define pi 3.1415926535897
#define pii pair <int, int>
#define fii first
#define see second

typedef long long ll;
typedef long double ld;
using namespace std;

int a, b, c;

// functions
void input(){
	cin >> a >> b >> c;
	return;
}

void solve(){
	cout << max(c-(a-b), ll(0));
	return;
}

void output(){
	return;
}

signed main(){
/*
//  REMEMBER TO TURN OFF IFDEF IN PROBLEMS WITH FILE I/O
*/
#ifdef sheeep
	freopen("forces.inp", "r", stdin);
	freopen("forces.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
//	int t;
//	cin >> t;
//	for(int i=1; i<=t; i++){
		input();
		solve();
		output();
//	}
	return 0;
}
// Author: NamSPro


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

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi std::vector<int>
#define vvi std::vector<std::vector<int> >
#define vpi std::vector<pi >
#define pi std::pair<int,int>
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (int var = (from); var <= ((int)(to)); var++)
#define DOWNTO(var, from, to) for (int var = (from); var >= ((int)(to)); var--)
#define FOR(var, to)		  UPTO(var, 0, (to)-1)
#define DOWN(var, from)	   DOWNTO(var, (from)-1, 0)

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) std::cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) std::cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

static const int MOD = 1000000007;
static const int INF = ((1<<30)-1);
static const s64 LINF = ((1LL << 62)-1);

struct Comb {
	std::vector<std::vector<s64> > a;
	Comb(int n) { // O(n^2)
		a.resize(n+1);
		FOR(i,n+1) {
			a[i].resize(i+1, 1);
			UPTO(j,1,i-1) a[i][j] = a[i-1][j] + a[i-1][j];
		}
	}
	s64 ncr(int n, int r) {
		assert(n >= 0);
		assert(n <= (int)a.size());
		assert(r >= 0);
		assert(r <= n);
		return a[n][r];
	}
};

#define gc(c) (c)=getchar()
int ri() {
	int c,s=0,r=0;
	for(;;){gc(c);if(c=='-'){s=1;break;}if(c>='0'&&c<='9'){r=c-'0';break;}}
	for(;;){gc(c);if(c<'0'||c>'9')break;r*=10;r+=c-'0';}
	if(s)r=-r;
	return r;
}
s64 rs64() {
	s64 r = 0;
	int c,s = 0;
	for(;;){gc(c);if(c=='-'){s=1;break;}if(c>='0'&&c<='9'){r=c-'0';break;}}
	for(;;){gc(c);if(c<'0'||c>'9')break;r*=10;r+=c-'0';}
	if(s)r=-r;
	return r;
}

int int_less(const void *a, const void *b) {
	return (*(const int*)a - *(const int*)b);
}
int int_greater(const void *a, const void *b) {
	return (*(const int*)b - *(const int*)a);
}
std::string operator*(const std::string &s, int n){ std::string res; FOR(i,n) res += s; return res; }

template<class T> std::ostream& operator<<(std::ostream& os, std::vector<T> a) { for (auto i : a) os << i << " "; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, std::set<T> a) { for (auto i : a) os << i << " "; return os; }
template<class A, class B> std::ostream& operator<<(std::ostream&os, std::pair<A,B> a) { os << a.fi << "," << a.se; return os; }


int main() {
	s64 n = rs64();
	int sqt = sqrt(n);
	std::vector<s64> sho;
	for (int i = 1; i <= sqt; i++) {
		sho.push_back(i);
		if (i != n / i) sho.push_back(n / i);
	}
	s64 res = 0;
	for (auto i : sho) {
		if ((n - i) % i) continue;
		if (i >= (n - i) / i)continue;
		res += (n - i) / i;
	}
	std::cout << res << std::endl;
	
	
	return 0;
}


Measured memory_bytes: 18792
/*
Sharif Hasan - CSE, PUST
Apr 24, 2020 02: 14 PM
*/
#include<bits/stdc++.h>
#define br cout<<"\n"
#define what(x) cout<<"in here var= "<<x<<"\n";

/*STL definations*/
#define pb push_back

#define FOR(i,n) for(int i=0;i<n;i++)
#define FROM(a,i,n) for(int i=a;i<n;i++)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;
bool pr(long long n){
    for(long long i=2;i*i<=n;i++){
        if(n%i==0){
            return true;
        }
    }
    return false;
}
/*Main function*/
int main()
{
    long long n;bool k=0;
    cin>>n;
    k=pr(n);
    
    int di=0;
    if(k){
        
        map <long long,int> p;
        for(long long i=2;i<=sqrt(n+9);i++){
            while(n%i==0){
                n/=i;
                p[i]++;
            }
        }
        if(n>1) p[n]++;
        
        for(auto a:p){
            long long pn=a.first;
            long long np=a.second;
            //cout<<pn<<" "<<np;br;
            for(int i=1;i<=np;++i){
                di++;
                np-=i;
            }
        }
        cout<<di;br;
        
    }else if(n==1){
        cout<<0;br;
    }else{
        cout<<1;br;
    }
    
    
    return 0;
}


Measured memory_bytes: 3688
#include <stdio.h>
  
int main () {
  
    int x, y, r, i, b;
  
    scanf("%d", &x); scanf("%d", &y);
  
    if (x < y) {
        b = x;
        x = y;
        y = b;
    }
  
    for (; y > 0; ) {
        r = x % y;
        x = y;
        y = r;
    }
  
    printf("%d\n", x);
  
    return 0;
  
}


Measured memory_bytes: 2136
package main

import "fmt"

func main() {
	var n string
	fmt.Scan(&n)
	if int(n[0])-48 == 7 || int(n[1])-48 == 7 || int(n[2])-48 == 7 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 1752
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
using namespace std;

using ll=long long;
ll MOD = 1e9+7;

ll dp[401][401];
ll rui[401];
ll a[400];
int main()
{
	int n;
	ll ans=0;
	cin>>n;
	fill(rui,rui+401,0LL);
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		rui[i+1]=rui[i]+a[i];
	}
	//fill(dp[0],dp[401],1e16-1);
	for(int i=1;i<n+1;i++)
		dp[i-1][i]=0;
	//cerr<<rui[n]<<endl;
	for(int i=2;i<n+1;i++)
	{
		for(int j=i;j<n+1;j++)
		{
			//dp[j-i][j]を求める
			dp[j-i][j]=dp[j-i][j-i+1]+dp[j-i+1][j]+(rui[j]-rui[j-i]);
			for(int k=j-i+2;k<j;k++)
			{
				dp[j-i][j]=min(dp[j-i][j],dp[j-i][k]+dp[k][j]+(rui[j]-rui[j-i]));
				if(dp[j-i][j]<0)
				{
					cerr<<i<<endl;
					return 0;
				}
			}
		}
	}
	cout<<dp[0][n]<<endl;
	return 0;
}

Measured memory_bytes: 1536
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int m, f, r;
		while(true) {
			m = in.nextInt();
			f = in.nextInt();
			r = in.nextInt();
			if(m == -1 && f == -1 && r == -1) break;

			char ch = 'F';
			int mf = m+f;
			if(m == -1 || f == -1) {
				ch = 'F';
			}
			else if(mf >= 80) {
				ch = 'A';
			}
			else if(65 <= mf) {
				ch = 'B';
			}
			else if(50 <= mf) {
				ch = 'C';
			}
			else if(30 <= mf) {
				ch = 'D';
				if(50 <= r) {
					ch = 'C';
				}
			}
			System.out.println(ch);
		}
	}
}

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

using namespace std;

int main()
{
  int64_t N;
  cin >> N;
  int64_t max1 = -1;
  int64_t max2 = -1;
  int64_t max1_pos = 0;

  for(int64_t i = 0;
      i < N;
      ++i)
    {
      int64_t a;
      cin >> a;
      if(a >= max1)
        {
          max2 = max1;
          max1 = a;
          max1_pos = i;
        }
      else if(a > max2)
        {
          max2 = a;
        }
    }

  for(int64_t i = 0;
      i < N;
      ++i)
    {
      if(i != max1_pos)
        {
          cout << max1 << endl;
        }
      else
        {
          cout << max2 << endl;
        }
    }
  return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using namespace boost::multiprecision;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define ALL(x) (x).begin(),(x).end()
inline cpp_int between(cpp_int n, cpp_int x) {
  if(n >= 0)
    return (n/x)+1;
  else
    return 0;
}

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

  cout << ((n*(n-1))/(2)) + ((m*(m-1))/(2)) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include <random>
#include<iostream>
#include<iomanip>
using namespace std;
map<long long, long long> mp[10];
long long N, A, B, C, D;

long long min(long long a, long long b) {
	if (a < b) { return a; }
	else return b;
}

long long cost(long long p, int i) {
	if (mp[i].find(p) == mp[i].end()) {
		/*ないとき*/
		long long ret = 2000000000000000000;
		if (p % 2 == 0) { ret = min(ret, cost(p / 2, i) + A); }
		else {
			ret = min(ret, cost((p + 1) / 2, i) + A + D);
			ret = min(ret, cost((p - 1) / 2, i) + A + D);
		}
		if (p % 3 == 0) {
			ret = min(ret, cost(p / 3, i) + B);
		}
		else {
			ret = min(ret, cost(p / 3, i) + B + (p % 3)* D);
			ret = min(ret, cost(p / 3 + 1, i) + B + (3 - p % 3)*D);
		}

		if (p % 5 == 0) {
			ret = min(ret, cost(p / 5, i) + C);

		}
		else {
			ret = min(ret, cost(p / 5, i) + C + (p % 5)* D);
			ret = min(ret, cost(p / 5 + 1, i) + C + (5 - p % 5)*D);
		}

		if (p > 0) {
			if (ret / p >= D) {
				ret = min(ret, p*D);
			}
		}
		mp[i][p] = ret;
		return ret;
	}
	else {
		return mp[i][p];
	}
}


int main() {
	int T;

	cin >> T;
	for (int i = 0; i < T; i++) {
		cin >> N >> A >> B >> C >> D;

		mp[i][0] = 0;
		mp[i][1] = D;

		cout << cost(N, i) << "\n";
		
	}
}

Measured memory_bytes: 10432
///*****************************************************///
///*.......................Faiyaj Bin Amin............................*///
///*...................................................................*///
///*.........................KUET CSE 2K17......................*///
///*...................................................*///
///*****************************************************///

#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define fastio      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define ret return
#define rep(q, i, n) for(int q=i; q<n; q++)
#define forn(i, n) for(int i=0; i<n; i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define ll long long
#define pb push_back
#define em emplace_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define ff first
#define ss second
#define pii pair<int,int>
#define pdd pair<double, double>

#define see(x)        cerr<< __LINE__ << ": " << (#x) << " is "<< (x) <<'\n';
#define seecontent(v) for(auto x : v) { cout << x << " ";} cout << "\n\n";

#define PI 2*acos(0.0)
#define lcm(a, b)  ((a / __gcd(a, b) ) * b)

#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)

#define mx 100005
#define INF 1e18
#define MOD 1000000007
#define MIN 0

//template <typename T>  using orderedSet =
//    tree<T, null_type, less_equal<T>,
//    rb_tree_tag, tree_order_statistics_node_update>; //find_by_order, order_of_key


/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0}; // Directional
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

/**------------------------------------BITMASK------------------------------------------**/
//int Change(int N, int pos){return N= N^(1<<pos);}
//bool Check(int N, int pos){return (bool)(N &(1<<pos));}  /// check bit 0 or 1
/**-----------------------------------------------------------------------------------------------**/

//using namespace __gnu_pbds;
using namespace std;

int main()
{
    fastio;
    int n, cnt=0;
    cin>>n;

    string s;
    map<string, int> m;
    set<string> st;
    forn(i, n)
    {
        cin >>s;
        if(m[s]==0)
        {
            m[s]++;
            st.insert(s);
        }
        else
            m[s]++;

        cnt = max(m[s], cnt);
    }

    for(auto it=st.begin(); it!=st.end(); it++)
    {
        if(m[*it]==cnt)
        {
            cout << *it << "\n";
        }
    }

    return 0;
}






Measured memory_bytes: 34832
N = int(input())
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]

ans = 0
x = 0
for i in range(N):
    a1, a2, b = A[i]-x, A[i+1], B[i]
    ans += min(b, a1 + a2)
    x = max(min(b - a1, a2), 0)
print(ans)


Measured memory_bytes: 18476
// Problem : A - Serval vs Monster
// Contest : AtCoder Beginner Contest 153
// URL : https://atcoder.jp/contests/abc153/tasks/abc153_a
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcount(x)
#define f first
#define se second
using namespace std;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1000000007;
int abst(int a)
{return a<0?-a:a;}
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

 vi fact,inv;
void inverse(int n)
{inv.resize(n+1);inv[0]=1;
for(int i=1;i<=n;i++)inv[i]=Pow(fact[i],md-2);}
void factorial(int n)
{fact.resize(n+1);fact[0]=1;
for(int i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%md;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}

void solve()
{
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int a,b;
cin>>a>>b;
int ans=a/b+(a%b?1:0);
cout<<ans;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t;
//cin>>t;
t=1;
while(t--)
{
    solve();
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define inf 1e18
#define eps 1e-8
#define PI 3.14159265359
#define sp printf(" ")
#define vi vector<int>
#define vl vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pcc pair<char, char>
#define mp make_pair
#define FF first
#define SS second
#define pb(x) push_back(x)
#define sd(x) scanf("%d", &(x))
#define pd(x) printf("%d", (x))
#define pdn(x) printf("%d\n", (x))
#define sld(x) scanf("%ld", &(x))
#define pld(x) printf("%ld", (x))
#define pldn(x) printf("%ld\n", (x))
#define slf(x) scanf("%lf", &(x))
#define plf(x) printf("%.9lf", (x))
#define plfn(x) printf("%.2lf\n", (x))
#define sch(x) scanf("%c", &(x))
#define pch(x) printf("%c", (x))
#define pchn(x) printf("%c\n", (x))
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define ios ios::sync_with_stdio(false); cin.tie(0) ; cout.tie(0)
#define endl '\n'
using namespace std;
ll x[100004],v[100004],dp[100005],dp1[100006];
int main()
{
    ios;
   ll n,c;
   cin>>n>>c;
   for(int i=1;i<=n;i++)cin>>x[i]>>v[i];
    ll sum=0;
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        sum+=v[i];
        dp[i]=max(dp[i-1],sum-x[i]);
        ans=max(ans,dp[i]);
    }
    sum=0;
    for(int i=n;i>=1;i--)
    {
        sum+=v[i];
        dp1[i]=max(dp1[i+1],sum-(c-x[i]));
        ans=max(ans,dp1[i]);
    }
    for(int i=1;i<n;i++)
    {
        ans=max(ans,dp[i]+dp1[i+1]-x[i]);
        ans=max(ans,dp[i]+dp1[i+1]-(c-x[i+1]));
    }

    cout<<ans<<endl;


       
}

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

long p = 1000000007;
vector<long> f(100001, -1);

int main() {
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int a;
        cin >> a;
        f[a] = 0;
    }
    rep(i, n+1) {
        // if (i == 0) continue;
        // if (i == 1 && f[i] == -1) {
        //     f[1] = 1;
        //     continue;
        // }
        // if (i == 2 && f[i] == -1) {
        //     f[2] = f[1] + 1;
        //     continue;
        // }
        // if (f[i] == -1) f[i] = (f[i-1] + f[i-2]) % p;
        if (i == 0) continue;
        else if (i == 1 && f[i] == -1) f[1] = 1;
        else if (i == 2 && f[i] == -1) f[2] = f[1] + 1;
        else if (f[i] == -1) f[i] = (f[i-1] + f[i-2]) % p;
    }
    cout << f[n] << endl;
}

Measured memory_bytes: 3856
#include <algorithm>
#include <iostream>
#include <unordered_set>

using namespace std;

constexpr size_t kMod = 2019;

int main() {
  size_t L, R;
  cin >> L >> R;

  if ((L % kMod == 0) || (R - L) >= kMod) {
    cout << 0 << endl;
    return 0;
  }

  if (R - L == 1) {
    cout << (L * R) % kMod << endl;
    return 0;
  }

  size_t result = kMod - 1;
  for (size_t i = L; i <= R - 1; i++) {
    if (i % kMod == 0) {
      cout << 0 << endl;
      return 0;
    }
    for (size_t j = L + 1; j <= R; j++) {
      if (i >= j) continue;
      if (j % kMod == 0) {
        cout << 0 << endl;
        return 0;
      }

      size_t r = (i * j) % kMod;
      if (r <= result) result = r;

      if (result == 0) {
        cout << 0 << endl;
        return 0;
      }
    }
  }

  cout << result << endl;

  return 0;
}

Measured memory_bytes: 256
using System;
using static System.Console;

class Program
{
    public static void Main()
    {
	string s = ReadLine();
	int n = s.Length;
	s += " ";

	for (int i = 0; i < n-1; i++)
	{
	    if (s[i] == s[i+1])
	    {
		WriteLine($"{i+1} {i+2}");
		return;
	    }
	    else if (s[i] == s[i+2])
	    {
		WriteLine($"{i+1} {i+3}");
		return;
	    }
	}
	WriteLine("-1 -1");
    }
}


Measured memory_bytes: 13536
#include<iostream>
using namespace std;
typedef long long int ll;
int main(void){
	ll v[4];
	for(int i=0;i<4;i++){
		cin>>v[i];
	}
	ll n;
	cin>>n;
	v[0]*=4;
	v[1]*=2;
	ll m=min(v[0],min(v[1],v[2]));
	if(m*2<v[3]){
		cout<<n*m<<endl;
	}else{
		cout<<(n/2)*v[3]+(n%2)*m;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int A,B,C,D;
  int S1,S2;

  scanf("%d%d%d%d",&A,&B,&C,&D);

  S1=A*B;
  S2=C*D;

  if(S1>=S2){
    printf("%d\n",S1);
  }

  else{
    printf("%d\n",S2);
  }

  return 0;
}

Measured memory_bytes: 128
s = list(str(input()))
cnt = 0
ans = 0
for i in range(len(s)) :
  if(s[i] == "A" or s[i] == "G" or s[i] == "C" or s[i] == "T") :
    cnt += 1
    ans = max(ans, cnt)
  else :
    cnt = 0
print(ans)

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

int main(void)
{
    int N,M;
    scanf("%d %d", &N,&M);
    int x=1,y=N;
    for(int i=0;i<M;i++){
        int a,b;
        scanf("%d %d", &a,&b);
        x = max(x, a);
        y = min(y, b);
    }
    printf("%d", max(y-x+1,0));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
typedef long long ll;
typedef long double ld;
const int MAX = 100000;
int above[MAX + 2];
ll dp[MAX + 1];
const int MAXN = 205;
ll fac[MAXN], invfac[MAXN];
ll inv[MAXN];
const ll MOD = 1e9 + 7;
int binom[MAXN][MAXN];
ll modex(ll a, ll p, ll m = MOD) {
	if (!p) return 1;
	if (p & 1) return a * modex(a, p - 1, m) % m;
	ll v = modex(a, p >> 1, m);
	return v * v % m;
}
int main() {
	fac[0] = 1;
	for (int i = 1; i < MAXN; ++i)
		fac[i] = fac[i - 1] * i % MOD;
	invfac[MAXN - 1] = modex(fac[MAXN - 1], MOD - 2);
	for (int i = MAXN - 2; i >= 0; --i)
		invfac[i] = invfac[i + 1] * (i + 1) % MOD;
	for (int i = 1; i < MAXN; ++i)
		inv[i] = invfac[i] * fac[i - 1] % MOD;
	for (int i = 0; i < MAXN; ++i)
		for (int j = 0; j <= i; ++j)
			if (!j || j == i) binom[i][j] = 1;
			else binom[i][j] = (binom[i - 1][j - 1] + binom[i - 1][j]) % MOD;
	int n, X;
	scanf("%d%d", &n, &X);
	vector<int> s(n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &s[i]);
		above[s[i] - 1] = 1;
	}
	sort(s.begin(), s.end());
	for (int i = MAX; i >= 0; --i) above[i] += above[i + 1];
	for (int i = 0; i <= X; ++i) {
		for (int k = 0; k < n; ++k) {
			if (s[k] > i) break;
			int v = i % s[k];
			dp[i] += dp[v] * binom[n - above[i] - 1][n - above[v]] % MOD * fac[above[v] - above[i] - 1] % MOD;
			dp[i] %= MOD;
		}
		if (s[0] > i) dp[i] = i;
	}
	printf("%lld\n", dp[X] * binom[n][above[X]] % MOD * fac[above[X]] % MOD);
}


Measured memory_bytes: 1536
#!/usr/bin/env ruby

number = gets.chomp.to_i
office = Array.new(120,0)

number.times do |index|
    temp = gets.split.map(&:to_i)
    office[(temp[0] - 1)  * 30 + (temp[1] - 1) * 10 + (temp[2] - 1) ] += temp[3]
end

4.times do |tou|
    3.times do |floor|
        10.times do |no|
            print " #{office[tou * 30 + floor * 10 + no]}"
        end
        puts ""
    end
    unless tou == 3
        puts "#" * 20
    end
end


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

using namespace std;

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


const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()


int main(){
    int N;
    cin>>N;
    vector<string> S(N);
    vector<int> T(N);
    string X;

    rep(i,N)cin>>S[i]>>T[i];
    cin>>X;

    rep(i,N){
        if(S[i]==X){
            int A=0;
            REP(j,i+1,N){
                A+=T[j];
            }
            cout<<A<<endl;
            return 0;
        }
    }

    return 0;
}

//a=97,z=122

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.txt"



int main() {
	int N; cin >> N;
	vector<int>nums(N,int(1e9));
	for (int i = 0; i < N; ++i) {
		int a; cin >> a;
		auto it = lower_bound(nums.begin(), nums.end(), a);
		*it = a;
	}
	int ans = find_if_not(nums.begin(), nums.end(), [](const int a) {return a !=1e9; }) - nums.begin();
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3120
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if (500 * i) + (100 * j) + (50 * k) == X:
                count += 1
print(count)

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define VIZ {printf("digraph G{\n"); for(int i=1;i<=n;i++) for es(i,e) printf("%d->%d;\n",i,vb[e]); puts("}");}
#define VIZ2 {printf("graph G{\n"); for(int i=1;i<=n;i++) for es(i,e) if(vb[e]>=i)printf("%d--%d;\n",i,vb[e]); puts("}");}
#define SZ 666666
int n,m; pii ps[SZ];
int M=262144,M2=M+M,ls[SZ],rs[SZ];
int mi[SZ],tag[SZ];
void build()
{
    for(int i=M+1;i<=M+M;i++) ls[i]=rs[i]=i-M;
    for(int i=M-1;i;i--) ls[i]=ls[i+i], rs[i]=rs[i+i+1],
	mi[i]=min(mi[i+i],mi[i+i+1]);
}
void pd(int x)
{
    if(tag[x])
    {
    	mi[x]+=tag[x];
        if(x+x<=M2) tag[x+x]+=tag[x], tag[x+x+1]+=tag[x];
        tag[x]=0;
    }
}
void upd(int x)
{
    pd(x+x); pd(x+x+1);
    mi[x]=min(mi[x+x],mi[x+x+1]);
}
void edit(int x,int ql,int qr,int v)
{
    if(x>M2||ql>qr) return;
    pd(x);
    if(ql==ls[x]&&qr==rs[x]) {tag[x]+=v; return;}
    int mid=ls[x]+rs[x]>>1;
    edit(x+x,ql,min(qr,mid),v);
    edit(x+x+1,max(mid+1,ql),qr,v);
    upd(x);
}
int qmin(int x,int ql,int qr)
{
    if(x>M2||ql>qr) return 1e9;
    pd(x);
    if(ql==ls[x]&&qr==rs[x]) return mi[x];
    int mid=ls[x]+rs[x]>>1;
    int ans=min(qmin(x+x,ql,min(qr,mid)),
	qmin(x+x+1,max(mid+1,ql),qr));
    upd(x); return ans;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		int l,r;
		scanf("%d%d",&l,&r);
		ps[i].fi=l; ps[i].se=r;
	}
	sort(ps+1,ps+1+n);
	memset(mi,127/3,sizeof mi);
	for(int i=1;i<=m+1;i++)
		mi[i+M]=m-i+1;
	build(); int ans=min(n,m);
	for(int i=1;i<=n;i++)
	{
		edit(1,ps[i].se+1,m+1,1);
		ans=min(ans,n-i+ps[i].fi+qmin(1,1,m+1));
	}
	printf("%d\n",n-ans);
}


Measured memory_bytes: 12032
import sys
from collections import deque

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


def resolve():
    n, m = map(int, input().split())
    edge = [[] for _ in range(n)]
    for _ in range(m):
        u, v = map(int, input().split())
        edge[u - 1].append(v - 1)
    s, t = map(int, input().split())

    dist = [[f_inf] * 3 for _ in range(n)]
    que = deque([])
    que.append([s - 1, 0])
    dist[s - 1][0] = 0
    while que:
        v, l = que.popleft()
        for u in edge[v]:
            nl = (l + 1) % 3
            if dist[u][nl] == f_inf:
                dist[u][nl] = dist[v][l] + 1
                que.append([u, nl])

    res = dist[t - 1][0]
    print(-1 if res == f_inf else res // 3)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 42596
#include <cstdio>
#include <algorithm>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;

int d[201];

const double EPS = 1e-10;

int main(){
  int n, k, t, u, v, l;

  scanf("%d%d%d%d%d%d", &n, &k, &t, &u, &v, &l);
  REP(i,n) scanf("%d", d + i);
  sort(d, d + n);
  d[n] = l;
  n = n + 1;

  int have = 0;
  int pos  = 0;
  double remain = 0.0;
  double ans = 0.0;

  REP(i,n){
    double dist = d[i] - pos;
    // printf("pos:%d remain:%.2f have:%d ans: %.4f\n", pos, remain, have, ans);

    pos = d[i];

    while(dist > 0.0 + EPS){
      if(remain == 0.0 && have > 0){
	have--;
	remain = t;
      }

      if(remain > 0.0){
	if(remain > 0.0){
	  if(dist > remain * v){
	    dist -= remain * v;
	    ans += remain;
	    remain = 0.0;
	  }else{
	    ans += dist / v;
	    remain -= dist / v;
	    dist = 0.0;
	  }
	}
      }

      if(have == 0 && dist > 0.0){
	ans += dist / u;
	dist = 0.0;
      }
    }

    if(have == k){
      remain = t;
    }else{
      have++;
    }
  }

  printf("%.7f\n", ans);

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int a,b;
  cin>>a>>b;
  string s;
  cin>>s;
  bool flag = true;
  rep(i,a) {
    if(s[i] - '0' < 0 || s[i] - '0' > 9) {
      flag = false;
    }
  }
  if(s[a] != '-') flag = false;
  FOR(i,a + 1, a+b+1) {
    if(s[i] - '0' < 0 || s[i] - '0' > 9) {
      flag = false;
    }
  }
  if(flag) {
    cout <<"Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    int k,x;cin>>k>>x;
    bool first = true;
    for(int i = x-k+1;i <= x+k-1;i++){
        if(i>=-1000000&&i<=1000000){
            if(!first){
                cout << ' ';
            }
            first = false;
            cout << i;
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
use std::io::Read;

struct CustomIn<'a> {
    sin: ::std::io::StdinLock<'a>,
}
impl<'a> CustomIn<'a> {
    pub fn new(sin: ::std::io::StdinLock<'a>) -> Self {
        CustomIn::<'a> { sin: sin }
    }

    pub fn _u32(&mut self) -> u32 {
        self.sin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .fold(0u32, |a, x| a * 10 + (x as u8 - b'0') as u32)
    }

    pub fn _u64(&mut self) -> u64 {
        self.sin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .fold(0u64, |a, x| a * 10 + (x as u8 - b'0') as u64)
    }

    pub fn _usize(&mut self) -> usize {
        self.sin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .fold(0usize, |a, x| a * 10 + (x as u8 - b'0') as usize)
    }
}

fn d(n: usize) -> usize {
    let mut cnt = 0usize;
    for i in 1..n + 1 {
        if n % i == 0usize {
            cnt += 1;
        }
    }
    cnt
}

fn main() {
    let mut sin = ::std::io::stdin();
    let mut cin = CustomIn::new(sin.lock());
    let n = cin._usize();
    let mut cnt = 0usize;
    for i in 1..n + 1 {
        if i % 2 == 1usize && d(i) == 8usize {
            cnt += 1;
        }
    }
    println!("{}", cnt);
}


Measured memory_bytes: 4352
/*
    Stay motivated and keep working hard
*/
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n;
ll dp[1000007][3];
ll a[100007][3];
ll rec(ll n, ll k){
    if(n == 1){
        ll ta = 0;
        for(ll i=0;i<3;i++){
            if(i == k){
                continue;
            }
            ta = max(ta, a[n][i]);
        }
        return ta;
    }
    if(dp[n][k]){
        return dp[n][k];
    }
    ll ans = 0;
    for(ll i=0;i<3;i++){
        if(i == k){
            continue;
        }
        ans = max(ans, a[n][i] + rec(n-1, i));
    }
    return dp[n][k] = max(dp[n][k], ans);
}
int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    cin >> n;
    for(ll i=1;i<=n;i++){
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }
    cout << max(rec(n, 0), max(rec(n, 1), rec(n, 2))) << "\n";


    return 0;
}

Measured memory_bytes: 14208
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    string A, B, C;
    cin >> A >> B >> C;
    if(B[0] == A[A.length() - 1] and B[B.length() - 1] == C[0]) {
        cout << "YES" << endl;
        return 0;
    }
    cout << "NO" << endl;
}

Measured memory_bytes: 256
A,B,C=map(int,input().split())
tmp=sorted([A,B,C])
sa=tmp[2]-tmp[1]
cnt=sa
tmp[1]=tmp[2]
tmp[0]+=sa
sa2=(tmp[1]-tmp[0])//2
cnt+=sa2
tmp[0]+=sa2*2
if tmp[0]!=tmp[1]:
    cnt+=2

print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{

    ll n;
    cin >> n;
    vector<ll> a(n);

    rep(i, n)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    vector<ll> hen;
    int cnt = 0;
    for (int i = n - 1; i > 0; i--)
    {
        if (a[i] == a[i - 1])
        {
            hen.push_back(a[i]);
            i--;
            cnt++;
        }
        if (cnt == 2)
        {
            cout << hen[0] * hen[1] << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <unordered_map>
#include <complex>
#include <algorithm>
#include <set>
#include <queue>
using namespace std;

#define FOR(i,n) for (int i = 0; i < n; i++)

int main() {
int a,b,c;
scanf("%i%i%i",&a,&b,&c);
int cnt=0;
cnt += a==b;
cnt += a==c;
cnt += b==c;
if (cnt % 3) printf("Yes\n"); else printf("No\n");
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a,b;
  cin >> a >> b;
  if(a.size() > b.size())
    cout << "GREATER" << endl;
  else if(a.size() < b.size())
    cout << "LESS" << endl;
  else if(a != b){
    vector<string> aaa = {a,b};
    sort(aaa.begin(),aaa.end());
    if(aaa.at(0) == a)
      cout << "LESS" << endl;
    else
      cout << "GREATER" << endl;
  }
  else
    cout << "EQUAL" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int x[3000][3000];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, d, e, f, g, h;
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    for (int i = a; i < a + c; i++) {
        for (int j = b; j < b + d; j++) {
            x[i][j]++;
        }
    }
    for (int i = e; i < e + g; i++) {
        for (int j = f; j < f + h; j++) {
            x[i][j]++;
        }
    }
    int res = 0;
    for (int i = 0; i < 3000; i++) {
        for (int j = 0; j < 3000; j++) {
            if (x[i][j] == 1) {
                res++;
            }
        }
    }
    cout << res << endl;
}



Measured memory_bytes: 18904
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
//setprecision(12)
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
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; }
typedef long long ll;
#define pint pair<int,int>
#define pll pair<ll,ll>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k; cin >> n >> k;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    sort(ALL(v));
    int ans = 0;
    rep(i,k) ans += v[i];
    cout << ans << endl;
    return 0;
}

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

int main()
{
  int n, count=0;
  cin >> n;
  string s;
  for(int i=0; i<n; ++i) cin >> s[i];
  for(int i=0; i<n-2; ++i)
  {
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include "bits/stdc++.h"
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

int main(){
    int h,w;
    cin>>h>>w;
    string s;
    for(int i=0;i<h;i++){
        cin>>s;
        cout<<s<<"\n";
        cout<<s<<"\n";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}

int main(){
    ll H,W;
    cin >> H >> W;
    vector<string> s(H);
    rep(i,H){
        cin >> s[i];
    }
    vector<vector<ll>> dp(H+1,vector<ll>(W+1, 1e18));
    /*rep(i,H+1){
        dp[i][0] = i-1;
    }
    rep(i,W+1){
        dp[0][i] = i-1;
    }*/
    
    dp[0][0] = 0;
    dp[0][1] = 0;
    dp[1][0] = 0;
    rep(i,H){
        rep(j,W){
            if(i>0){
                dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j+1] + ((s[i][j]=='#' && s[i-1][j] =='.')?1:0));
            }else{
                dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j+1] + ((s[i][j] == '#')?1:0));
            }
            if(j>0){
                dp[i+1][j+1] = min(dp[i+1][j+1], dp[i+1][j] + ((s[i][j]=='#' && s[i][j-1] == '.')?1:0));
            }else{
                dp[i+1][j+1] = min(dp[i+1][j+1], dp[i+1][j] + ((s[i][j] == '#')?1:0));
            }
            //dp[i+1][j+1] = min(dp[i+1][j], dp[i][j+1]) + ((s[i][j] == '#')?1:0);
        }
    }
    /*
    rep(i,H){
        rep(j,W){
            cout << dp[i+1][j+1] << " ";
        }
        cout << endl;
    }*/
    cout << dp[H][W] << endl;
}

Measured memory_bytes: 384