akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define long long long
typedef pair<int,int> ii;

int n, m;
int ans[303][303];
char pet[303][303];

int main()
{
	// freopen("input.in", "r", stdin);
	
	int num = 0;
	int x;
	scanf("%d %d %d\n", &n, &m, &x);
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= m; j++)
		{
			scanf("%c", &pet[i][j]);
			if(pet[i][j] == '#')
				ans[i][j] = ++num;
			else ans[i][j] = ans[i][j-1];
		}
		scanf("\n");
	}
	for(int i = 1; i <= n; i++)
		for(int j = m; j >= 1; j--)
			if(ans[i][j] == 0)
				ans[i][j] = ans[i][j+1];

	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			if(ans[i][j] == 0)
				ans[i][j] = ans[i-1][j];

	for(int i = n; i >= 1; i--)
		for(int j = 1; j <= m; j++)
			if(ans[i][j] == 0)
				ans[i][j] = ans[i+1][j];

	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			printf("%d%c", ans[i][j], (j == m)? '\n' : ' ');
}




Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <functional>
#include <set>
#include <tuple>
#include <map>
#include <numeric>

using namespace std;
#define PI 3.14159265359
#define ll long long int

int main(void)
{
    ll N;
    cin >> N;
    vector<ll> P(N);
    for(ll i = 0; i < N; i++) cin >> P[i];

    ll ans = 0;
    ll minv = P[0];
    for(ll i = 0; i < N; i++){
        if(minv >= P[i]){
            ans++;
            minv = P[i];
        }
    }


    cout << ans << endl;
}

Measured memory_bytes: 1792
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        new Magatro().Solve();
    }
}

public class Magatro
{
    int N, A;
    int[] X;

    private void Scan()
    {
        string[] line = Console.ReadLine().Split(' ');
        N = int.Parse(line[0]);
        A = int.Parse(line[1]);
        X = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    }

    public void Solve()
    {
        Scan();
        int sum = X.Sum();
        long[,,] dp = new long[100, 100, 3000];
        dp[0, 0, 0] = 1;
        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < N; j++)
            {
                for (int k = 0; k <= sum - X[i]; k++)
                {
                    dp[i + 1, j, k] += dp[i, j, k];
                    dp[i + 1, j + 1, k + X[i]] += dp[i, j, k];
                }
            }
        }
        long ans = 0;
        for (int i = 1; i <= N; i++)
        {
            ans += dp[N, i, i * A];
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 133984
def linear_search(arr, key)
  n = arr.length
  arr[n] = key
  i = 0
  while arr[i] != key do
    i += 1
  end
  if i == n
    return false
  end
  return true
end

n = gets.to_i
s = gets.split.map(&:to_i)
q = gets.to_i
t = gets.split.map(&:to_i)
cnt = 0
t.each do |key|
  cnt += 1 if linear_search(s, key)
end
puts cnt


Measured memory_bytes: 7136
N, M, C = map(int, input().split())
B = [int(i) for i in input().split()]

count = 0
for i in range(N):
  A = [int(i) for i in input().split()]
  f = C
  for a, b in zip(A, B):
    f += a * b
  if f > 0:
    count += 1
print(count)


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

int main() {
  int A[3][3];
  int N;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> A[i][j];
    }
  }
  cin >> N;
  int b[N];
  for (int i = 0; i < N; i++) cin >> b[i];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (A[j][k] == b[i]) A[j][k] = 0;
      }
    }
  }
  for (int j = 0; j < 3; j++) {
    int count = 0;
    for (int k = 0; k < 3; k++) {
      count += A[j][k];
    }
    if (count == 0) {
      cout << "Yes";
      return 0;
    }
  }
  for (int j = 0; j < 3; j++) {
    int count = 0;
    for (int k = 0; k < 3; k++) {
      count += A[k][j];
    }
    if (count == 0) {
      cout << "Yes";
      return 0;
    }
  }
  int count = 0;
  if ((A[0][0] + A[1][1] + A[2][2]) == 0) {
    cout << "Yes";
    return 0;
  }
  if ((A[0][2] + A[1][1] + A[2][0]) == 0) {
    cout << "Yes";
    return 0;
  }
  cout << "No";
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vec<vec<int>> combinations;
    range(i, 0, M) {
        int k;
        cin >> k;
        vec<int> pattern(k);
        range(j, 0, k) {
            cin >> pattern.at(j);
            pattern.at(j) -= 1;
        }
        combinations.emplace_back(pattern);
    }
    vec<int> p_list(M);
    range(i, 0, M) cin >> p_list.at(i);
    int num_combinations = 0;
    range(i, 0, 1 << N) {
        bool all_on = true;
        range(j, 0, M) {
            int num_switches_on = 0;
            for (const auto sw : combinations.at(j)) {
                num_switches_on += ((i >> sw) & 1);
            }
            if (num_switches_on % 2 != p_list.at(j)) {
                all_on = false;
                break;
            }
        }
        if (all_on) num_combinations += 1;
    }
    cout << num_combinations << "\n";
}

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

using namespace std;

typedef pair<int,int>P;

const int mod[2] = {1000000007,1000000009};
const int mul[2] = {10009,10007};

int main()
{
    string s,t;
    cin >> s >> t;
    int n = (int)s.size(), m = (int)t.size();
    int r = min(n,m);
    vector<vector<int> > pm(26,vector<int>(2));
    pm[0][0] = pm[0][1] = 1;
    rep(i,25){
        rep(j,2){
            pm[i+1][j] = (ll)pm[i][j]*mul[j]%mod[j];
        }
    }
    int ans = 0;
    for(int i=1;i<=r;i++){
        set<P> st;
        int val[2] = {};
        for(int j=0;j<i;j++){
            rep(k,2){
                val[k] = (val[k]+pm[s[j]-'a'][k])%mod[k];
            }
        }
        st.insert(P(val[0],val[1]));
        for(int j=0;j<n-i;j++){
            rep(k,2){
                val[k] = (val[k]+mod[k]-pm[s[j]-'a'][k])%mod[k];
                val[k] = (val[k]+pm[s[j+i]-'a'][k])%mod[k];
            }
            st.insert(P(val[0],val[1]));
        }
        val[0] = val[1] = 0;
        for(int j=0;j<i;j++){
            rep(k,2){
                val[k] = (val[k]+pm[t[j]-'a'][k])%mod[k];
            }
        }
        if(st.find(P(val[0],val[1])) != st.end()){
            ans = i;
            continue;
        }
        for(int j=0;j<m-i;j++){
            rep(k,2){
                val[k] = (val[k]+mod[k]-pm[t[j]-'a'][k])%mod[k];
                val[k] = (val[k]+pm[t[j+i]-'a'][k])%mod[k];
            }
            if(st.find(P(val[0],val[1])) != st.end()){
                ans = i;
                break;
            }
        }
    }
    cout << ans << "\n";
}



Measured memory_bytes: 3404
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>

#define lint long long
#define VI vector<int>
#define VL vector<lint>
#define VC vector<char>
#define VVI vector<vector<int>>
#define rep(i, n) for(int i = 0 ; i < n ; i++)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c.begin(), c.end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

int main(){
    int n, q;
    cin >> n >> q;
    queue< pair<string, int> > que;
    rep(i, n){
        string name;
        cin >> name;
        int t;
        cin >> t;
        que.push(make_pair(name, t));
    }
    int ti = 0;
    while(!que.empty()){
        auto tmp = que.front();
        que.pop();
        ti += min(tmp.second, q);
        if(tmp.second <= q){
            cout << tmp.first << " " << ti << endl;
        }else{
            tmp.second -= q;
            que.push(tmp);
        }
    }
    return 0;
}


Measured memory_bytes: 6188
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
	int M1, M2, D1, D2;

	scanf("%d%d%d%d", &M1, &D1, &M2, &D2);

	if (D2==1)
		printf("1\n");
	else
		printf("0\n");

	return 0;
}
	

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

const int MAX_N = 150;

int par[MAX_N];
int rank[MAX_N];

class edge{
public:
  int u, v, cost;
  bool operator < (const edge& s) const {
    return cost < s.cost;
  }
};

int s, d;

void init(int n){
  for(int i=0;i<n;i++){
    par[i] = i;
    rank[i] = 0;
  }
}

int find(int x){
  if(par[x] == x) return x;
  else return par[x] = find(par[x]);
}

void unite(int x, int y){
  x = find(x);
  y = find(y);
  if(x == y) return;

  if(rank[x] < rank[y]) par[x] = y;
  else{
    par[y] = x;
    if(rank[x] == rank[y]) rank[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}

bool check(int p){
  for(int i=0;i<s;i++) if(same(p, i)) return true;
  return false;
}

vector<edge> es;
int V;

int kruskal(){
  sort(es.begin(), es.end());
  init(V);
  int res = 0;
  for(int i=0;i<es.size();i++){
    edge e = es[i];
    if(!same(e.u, e.v) && (!check(e.u) || !check(e.v))){
      unite(e.u, e.v);
      res += e.cost;
    }
  }
  return res;
}

main(){
  while(cin >> s >> d && (s|d)){
    es.clear();
    V = s + d;
    int p = 0;
    for(int i=0;i<s;i++){
      for(int j=0;j<d;j++){
        edge in;
        cin >> in.cost;
        if(in.cost == 0) continue;
        in.u = i;
        in.v = j+s;
        es.push_back(in);
      }
    }
    for(int i=0;i<d-1;i++){
      for(int j=i+1;j<d;j++){
        edge in;
        cin >> in.cost;
        if(in.cost == 0) continue;
        in.u = i+s;
        in.v = j+s;
        es.push_back(in);
      }
    }
    cout << kruskal() << endl;
  }
}

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

bool check9(const string& s) {
  for (size_t i = 1; i < s.size(); ++i) {
    if (s[i] != '9') return false;
  }
  return true;
}

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

  string s;
  cin >> s;
  int ans = s[0] - '0';
  for (size_t i = 1; i < s.size(); ++i) {
    ans += 9;
  }
  if (check9(s)) {
    cout << ans << "\n";
  } else {
    cout << ans - 1<< "\n";
  }
}


Measured memory_bytes: 256
import sys

n = int(input())
s = [int(i)%4 for i in sys.stdin.read().split()]
s0 = s.count(0)
s2 = s.count(2)
if n - s0 - s2 <= s0 + (s2 == 0):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 11124
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int num=0;
    string str;
    cin >> str;

    string stro = "o";
    for(int i=0;i<str.length();i++){
        if(str.compare(i,1,stro)==0){
            num ++;
        }
    }
    if(num + (15-str.length())>= 8){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define show(x) cout<<x<<'\n'
#define showh(x) cout<<x<<' '
#define go(i,a,n) for(ll i=a;i<n;i++)
#define gor(i,a,n) for(ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define mod 1000000007
bool prime[100001];
void sieve(ll n)
{
    memset(prime,true,sizeof(prime));
    prime[0]=false;
    prime[1]=false;
    for(ll i=2;i*i<=n;i++)
    {
        if(prime[i]==true)
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                prime[j]=false;
            }
        }
    }
    for(ll i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            cout<<i<<" ";
        }
    }
}
bool isprime(ll n)
{
    if (n<=1) return false;
    if (n<=3) return true;
    
    if(n%2==0 or n%3==0) return false;
    
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0 or n%(i+2)==0) return false;
    }
    return true;
}

ll modinverse(ll a,ll m) 
{ 
    ll m0 = m; 
    ll y = 0, x = 1; 
  
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    { 
        ll q = a / m; 
        ll t = m; 
  
        m = a % m; a = t; 
        t = y; 
  
        y = x - q * y; 
        x = t; 
    } 
  
    if (x < 0) 
       x += m0; 
  
    return x; 
} 

ll gcd(ll a,ll b)
{
    if(a==0)
    {
        return b;
    }
    return gcd(b%a,a);
}

ll power(ll A, ll B) 
{ 
    if (A == 0) 
        return 0; 
    if (B == 0) 
        return 1; 
  
    ll y; 
    if (B % 2 == 0) { 
        y = power(A, B / 2); 
        y = (y * y) % mod; 
    } 
  
    else { 
        y = A % mod; 
        y = (y * power(A, B - 1) % mod) % mod; 
    } 
  
    return (ll)((y + mod) % mod); 
} 

int main() 
{
    ios_base::sync_with_stdio(false);
    map<char,char>m;
    m['C']='G';
    m['G']='C';
    m['A']='T';
    m['T']='A';
    string s;
    cin>>s;
    ll count=0,maxi=0;
    go(i,0,(ll)s.size())
    {
        if(s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T')
        {
            count++;
            maxi=max(maxi,count);
            continue;
        }
        count=0;
    }
    cout<<maxi;
    return 0;
}


Measured memory_bytes: 256
s = gets
 first = (s[0]+s[1]).to_i
 second = (s[2]+s[3]).to_i
 firstm = (first > 0 && first <= 12)
 firsty = (first >= 0)
 secondm = (second > 0 && second <= 12)
 secondy = (second >= 0)
if firstm && firsty && secondm && secondy
  puts "AMBIGUOUS"
elsif firstm && secondy
  puts "MMYY"
elsif firsty && secondm
  puts "YYMM"
else
  puts "NA"
end

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

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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main() {
  int n;
  cin >> n;
  vector<vector<int>>cost(n,vector<int>(3,0));
  vector<vector<int>>dp(n+1, vector<int>(3,0));
  rep(i, 0, n){
      cin >> cost[i][0] >> cost[i][1] >> cost[i][2];
  }
  rep(i, 0, n){
      rep(j, 0, 3){
          rep(k, 0, 3){
              if(j==k)continue;
              chmax(dp[i+1][k],dp[i][j]+cost[i][k]);
          }
      }
  }
  ll ans = max({dp[n][0],dp[n][1],dp[n][2]});
  cout << ans << endl;
}

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

int A[808][808];
int dr[4]={-1,1,0,0};
int dc[4]={0,0,1,-1};
const int INF=1e9;

int main(){
  rep(i,808) rep(j,808) A[i][j]=INF;
  int H,W,K; cin>>H>>W>>K;
  string S[H];
  int sr,sc;
  rep(i,H){
    cin>>S[i];
    rep(j,W) if(S[i][j]=='S'){
      sr=i;
      sc=j;
    }
  }
  A[sr][sc]=0;
  queue<pair<int,int> > que;
  que.push({sr,sc});
  while(que.size()){
    pair<int,int> P=que.front(); que.pop();
    int r=P.first, c=P.second;
    rep(i,4){
      int rr=r+dr[i], cc=c+dc[i];
      if(rr>=H||rr<0||cc>=W||cc<0) continue;
      if(S[rr][cc]!='.'||A[rr][cc]!=INF) continue;
      A[rr][cc]=A[r][c]+1;
      que.push({rr,cc});
    }
  }

  int ans=1e9;
  rep(i,H) rep(j,W) if(A[i][j]<=K){
    int x=i/K+(i%K==0?0:1);
    int y=(H-1-i)/K+((H-1-i)%K==0?0:1);
    int z=j/K+(j%K==0?0:1);
    int w=(W-1-j)/K+((W-1-j)%K==0?0:1);
    ans=min({ans,x,y,z,w});
  }
  cout<<ans+1<<endl;
  return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repA(i,a,b) for(int i=a;i<=b;i++)
#define repD(i,b,a) for(int i=b;i>=a;i--)
#define mset(a,val) memset(a,val,sizeof(a))
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main()
{
    int n;
    cin>>n;
    int cnt=1000;
    while(cnt<n)
        cnt+=1000;
    cout<<cnt-n<<endl;
}


Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,K;
    cin >> N >> K;
    ld ans;
    FOR(i,1,N+1){
        ll nowi=i;
        ll cnt=0;
        while(nowi<K){
            cnt++;
            nowi*=2;
        }
        //cout << cnt << "\n";
        ans+=pow(2,-cnt);
    }
    cout << fixed << setprecision(30) << ans/N << endl;
}

Measured memory_bytes: 4120
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
}

void Main()
{
	int L, R, d;
	std::cin >> L >> R >> d;
	int count = 0;
	for (auto i : boost::irange(L, R + 1))
	{
		if (i % d == 0)
		{
			++count;
		}
	}
	std::cout << count << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 3596
S = input()
T = input()
S_list = [i for i in S]
T_list = [i for i in T]
S_set = set(S_list)
T_set = set(T_list)
def judge():
  if len(S_set)==len(T_set)==len(S_list):
    return "Yes"
  for car in S_set:
    if [j for j, x in enumerate(T_list) if x == T_list[S_list.index(car)]]!=[j for j, x in enumerate(S_list) if x == car]:
      return "No"
  return "Yes"

print(judge()) 

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

int main()
{
	int N;
	long long A, B;
	cin >> N >> A >> B;

	long long pre, next;
	cin >> pre;
	
	long long res = 0;
	for (int i = 1; i < N; i++) {
		cin >> next;
		res += min((next - pre) * A, B);
		pre = next;
	}

	cout << res << endl;

	return 0;
}



Measured memory_bytes: 256
# dekinakatta!!
import math
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    a = int(math.log2(max(A))) + 1
    l = [0] * a
    for i in A:
        t = 0
        while i > 0:
            if i % 2 == 1:
                l[t] += 1
            i >>= 1
            t += 1
    la = [0 if i >= (N-i) else 1 for i in l]
    lla = sum(v * pow(2,i) for i, v in enumerate(la))
    lk = []
    K2 = K
    while K2 > 0:
        if K2 % 2 == 1:
            lk.append(1)
        else:
            lk.append(0)
        K2 >>= 1
    if len(lk) > len(la):
        la.extend([0] * (len(lk)-len(la)))
        l.extend([0] * (len(lk)-len(l)))
    else:
        lk.extend([0] * (len(la)-len(lk)))
    r = sum(pow(2, i) * l[i] for i in range(len(l)))
    for i in range(len(lk)):
        if lk[i] == 1:
            r = max(r, calc(lk, la, N, l, i))
    t = 0
    for i in range(len(lk)):
        if lk[i] == 1:
            t += pow(2, i) * max(l[i], N - l[i])
        else:
            t += pow(2, i) * l[i]
    r = max(r, t)
    return r

def calc(lk, la, N, l, j):
    r = 0
    for i in range(j):
        r += pow(2, i) * max(l[i], N - l[i])
    r += pow(2, j) * l[j]
    for i in range(j+1, len(lk)):
        if lk[i] == 1:
            r += pow(2, i) * max(l[i], N - l[i])
        else:
            r += pow(2, i) * l[i]
    return r
print(main())


Measured memory_bytes: 14748
N = int(input())
A = list(map(int, input().split()))

def gcd(n, m):
    if m == 0:
        return n
    return gcd(m, n % m)

L = [0] * (N + 1)
R = [0] * (N + 1)

for i, a in enumerate(A, start=1):
    L[i] = gcd(L[i - 1], a)
for i, a in enumerate(A[:: -1], start=1):
    R[i] = gcd(R[i - 1], a)

R = R[:: -1]
ans = 1
for mid in range(1, N + 1):
    ans = max(ans, gcd(L[mid - 1], R[mid]))
print(ans)


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

int main(){
    int a;
    int b;
    int c;
    int tmp;
    cin>>a>>b>>c;
    if(a>b){
        tmp=a; a=b; b=tmp;
    }
    if(b>c){
        tmp=b; b=c; c=tmp;
    }
    if(a>b){
        tmp=a; a=b; b=tmp;
    }
    cout<<a<<" "<<b<<" "<<c<<endl;
    return 0;
}


Measured memory_bytes: 3044
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}


int main(){
	#ifdef LOCAL
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
		#if __cplusplus >= 201103L
		auto start = steady_clock::now();
		#endif
	#endif
	int a = read(), b = read();
	if (a <= 5) {
		puts("0");
	}else if (a < 13) {
		cout << (b / 2) << endl;
	}else {
		cout << b << endl;
	}
 
	#ifdef LOCAL
		#if __cplusplus >= 201103L
		auto end = steady_clock::now();
		duration<double> time_span = duration_cast<duration<double>>(end - start);;
		printf("Total time: %.6fs\n", time_span.count());
		#endif
	#endif
	return 0;
}

Measured memory_bytes: 256
// while( !(succeed == try()) );

#include "bits/stdc++.h"
using namespace std;

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha


#define int long long int
#define loop(i,s,e) for(int i=s; i<e; i++)
#define endl '\n'
#define vii vector<int>
#define pii pair<int, int>
#define ff first
#define ss second
#define N 100001
#define pb push_back
#define INF LLONG_MAX
#define inf INT_MAX

void INP();

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn 
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha // Alpha


void alpha()
{	
	int n, k;
	cin>>n>>k;

	int t = n;
	t = t%k;

	t = min(t, abs(t-k));

	cout<<t;
}

int32_t main(){

	ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	//INP();
    int t=1;
	//cin>>t;

  	while(t--) alpha();

	return 0;

}






















inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}
 
 

Measured memory_bytes: 384
s = input()
n = len(s)


def is_kaibun(s):
    return s == s[::-1]


if not is_kaibun(s):
    print('No')
elif not is_kaibun(s[:n//2]):
    print('No')
elif not is_kaibun(s[(n+2)//2:]):
    print('No')
else:
    print('Yes')


Measured memory_bytes: 2940
import sys
import re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []


def main():
    X,K,D = i_map()
    if X<=0:
        X = -X
    tmp1 = X//D
    tmp2 = X-(tmp1 * D)
    if(tmp1 < K):
        if((K-tmp1)%2 == 0):
            print(tmp2)
        else:
            print(D-tmp2)
    else:
        print(X - K * D)

    return

if __name__ == '__main__':
    main()

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

typedef long long ll;
#define ALL(a) a, a+sizeof(a)/sizeof(a[0])
#define all(a) a.begin(),a.end()
#define MOD 1000000007
using namespace std;
ll gcd(ll n, ll m) {
	if (m == 0) return n;
	return gcd(m, n % m);
}
ll lcm(ll n, ll m) {return m / gcd(n, m) * n;}

int main(void) {
	ll n,ans;
	cin >> n;
	vector<ll> p(n);
	vector<ll> num(100);
	for (ll i = 0; i < n; i++) {
		cin >> p[i];
		num[p[i]-1]++;
	}
	for (ll i = 98; i >= 0; i--) {
		num[i] += num[i + 1];
	}
	for (ll i = 0; i < n; i++) {
		if (num[i] >= i + 1)
			ans = i + 1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3108
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long M = sc.nextLong();
        String S = sc.next();
        String T = sc.next();
        long k = N*M/(gcd(N,M));
        long NtoM = k/N;
        long MtoN = k/M;
        if (S.charAt(0) != T.charAt(0)) {
            System.out.println(-1);
            return;
        }
        for (int i = 1; MtoN*i < S.length() && NtoM*i < T.length(); i++) {
            if (S.charAt((int)MtoN*i) != T.charAt((int)NtoM*i)) {
                System.out.println(-1);
                return;
            }
        }
        
        System.out.println(k);
    }
    
    private static long gcd(long a, long b) {
        long tmp = a % b;
        long ans = 0;
        if (tmp == 0) {
            ans = b;
        } else {
            ans = gcd(b, tmp);
        }
        return ans;
    }
    
}


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

int main(){
    int n,a,c,x=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        c=i;
        a=0;
        for(int k=0;;k++){
            if(c==0){
                if(a%2!=0){
                    
                    x++;
                }
                break;
            }
        c/=10;
        a++;
        }
    }
    cout<<x<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <cstdio>
using namespace std;

char s[10],ans[10];
int a[10],tp=1;
bool bk=false;

void dfs(int sum,int k)
{
	if(bk) return;
	if(k==4) {
		if(sum==7) {
			bk=true;
			printf("%d",a[1]);
			for(int i=2;i<=4;i++) printf("%c%d",ans[i],a[i]);
			printf("=7\n");
		}
		return;
	}
	ans[++tp]='+';
	dfs(sum+a[k+1],k+1);
	--tp;
	ans[++tp]='-';
	dfs(sum-a[k+1],k+1);
	--tp;
}

int main()
{
	scanf("%s",s);
	a[1]=s[0]-'0',a[2]=s[1]-'0',a[3]=s[2]-'0',a[4]=s[3]-'0';
	dfs(a[1],1);
	return 0;
}

Measured memory_bytes: 128
#![allow(unused)]

use cmp::Ordering::{Equal, Greater, Less};
use collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use io::{Read, Write};
use std::{cmp, collections, fmt, io, iter, ops, str};

#[cfg(feature = "debug")]
macro_rules! debug {
    ($fmt: expr) => { eprintln!($fmt) };
    ($fmt: expr, $($args: tt)*) => { eprintln!($fmt, $($args)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! debug {
    ($fmt:expr) => {};
    ($fmt:expr, $($args:tt)*) => {};
}

macro_rules! vmax {
    ($x: expr, $y: expr) => { cmp::max($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::max($x, vmax!($($args),*)) };
}

macro_rules! vmin {
    ($x: expr, $y: expr) => { cmp::min($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::min($x, vmin!($($args),*)) };
}

fn main() {
    let s = read_line();
    let k = parse_line::<usize>();

    let mut substrings = HashSet::new();

    for l in 0..cmp::min(k, s.len()) {
        let substr_len = l + 1;
        for i in 0..(s.len() - substr_len + 1) {
            substrings.insert(s[i..(i + substr_len)].to_string());
        }
    }

    let mut substrings = substrings.iter().collect::<Vec<_>>();
    substrings.sort();

    println!("{}", substrings[k - 1]);
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        //
    }
}

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_owned()
}

fn read_word() -> String {
    const CAPACITY: usize = 16;

    let mut stdin = io::stdin();
    let mut byte: [u8; 1] = [0];

    loop {
        let mut buf = Vec::with_capacity(CAPACITY);

        loop {
            let res = stdin.read(&mut byte);

            if res.unwrap_or(0) == 0 || byte[0] <= b' ' {
                break;
            } else {
                buf.push(byte[0]);
            }
        }

        if buf.len() > 0 {
            return String::from_utf8(buf).unwrap();
        }
    }
}

fn parse_line<T: str::FromStr>() -> T {
    read_line().parse().ok().unwrap()
}

fn parse_word<T: str::FromStr>() -> T {
    read_word().parse().ok().unwrap()
}

fn parse_vec<T: str::FromStr>() -> Vec<T> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn flush() {
    io::stdout().flush();
}

fn next_prime(x: i32) -> i32 {
    for i in (x + 1).. {
        if is_prime(i) {
            return i;
        }
    }

    panic!("attempt to add with overflow");
}

fn is_prime(x: i32) -> bool {
    let ceil = (x as f64).sqrt().ceil() as i32;
    x == 2 || (2..(ceil + 1)).all(|i| x % i != 0)
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
char s[11000];
long long dp[60];
int a[11000];
const int MD=1000000007;
int main()
{
    int n;
    scanf("%d",&n);
    int t=0;
    scanf("%s",s+1);
    for(int i=1; i<=n; i++)
        if(s[i]==s[i-1])
            a[t]++;
        else
            a[++t]++;
    if(a[1]==1)dp[1]=3;
    else dp[1]=6;
    for(int i=2; i<=t; i++)
    {
        if(a[i-1]==2)
        {
            if(a[i]==2)
                dp[i]=dp[i-1]*3%MD;
            else if(a[i]==1)
                dp[i]=dp[i-1];
        }
        else if(a[i-1]==1)
        {
            if(a[i]==2||a[i]==1)
            dp[i]=dp[i-1]*2%MD;
        }
    }
    scanf("%s",s+1);
    cout<<dp[t];
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl


int main(){
	string s;
	cin>>s;
	rep(i,sz(s))cout<<s[sz(s)-1-i];
	
	puts("");
	return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
using namespace std;

int main(){
  int N;
  string S;
  cin >> N;
  cin >> S;
  string s1,s2;
  if(N % 2 == 1){
    cout << "No" << endl;
  }else{
    int x = N/2;
    for(int i = 0;i < x;i++){
      s1 += S.at(i);
    }
    for(int i = x;i < N;i++){
      s2 += S.at(i);
    }
    int judge = 1;
    for(int i = 0;i < x;i++){
      if(s1.at(i) != s2.at(i)){
        judge = 0;
        break;
      }
    }
    if(judge == 0){
      cout << "No" << endl;
    }else{
      cout << "Yes" << endl;
    }
  }
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt(), r=sc.nextInt();
        sc.close();
        int ans;
        if(n>=10) ans=r;
        else ans=r+100*(10-n);
        System.out.println(ans);
    }
}

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

class Program {
    static Scanner cin = new Scanner();
    static void Main() {
        string S = Console.ReadLine();
        long K = cin.Long();

        if (K > S.Length) {
            string not_one = "";
            foreach (var x in S) {
                if (x != '1') {
                    not_one = x.ToString();
                    break;
                }
            }
            Console.WriteLine(not_one == "" ? "1" : not_one);
        }
        else if (K == 1) Console.WriteLine(S[0].ToString());
        else {
            string not_one = S[(int)K - 1].ToString();
            for (int i = 0; i <= K - 2; i++) {
                if(S[i] != '1') {
                    not_one = S[i].ToString();
                    break;
                }
            }
            Console.WriteLine(not_one == "" ? "1" : not_one);
        }
        Console.ReadLine();
    }
}

class Scanner //標準入力
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Long() + add;
        }
        return Array;
    }

    public double Double()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Double() + add;
        }
        return Array;
    }
}


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

void prians(bool answer) {
  if(answer)
    cout << "War" << endl;
  else
    cout << "No War" << endl;
}

int n, m, x, y, dx = -1000, dy = 1000;
bool ans = 1;

int main() {
  cin >> n >> m >> x >> y;
  for(int i = 0; i < n; ++i) {
    int now;
    cin >> now;
    dx = max(now, dx);
  }
  for(int i = 0; i < m; ++i) {
    int now;
    cin >> now;
    dy = min(dy, now);
  }
  for(int i = x + 1; i <= y; ++i) {
    if(dx < i && dy >= i) ans = 0;
  }
  prians(ans);

  return 0;
}

Measured memory_bytes: 256
n,m=[int(i) for i in input().split()]
k,s=[],[]
ans=0
for i in range(m):
    kk,*tmp=[int(j) for j in input().split()]
    k.append(kk)
    s.append(tmp)
p=[int(i) for i in input().split()]

for bit in range(1<<n):
    pattarn = []
    for j in range(n):
        if (bit & (1<<j)):
            pattarn.append(j)
    flg=True
    for i in range(m):
        cnt=0
        for j in range(k[i]):
            if s[i][j]-1 in pattarn:
                cnt+=1
        if cnt%2!=p[i]:
            flg=False
    if flg:
        ans+=1
print(ans)

Measured memory_bytes: 42480
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

N = int(input())
S = defaultdict(int)
for _ in range(N):
    S[input()] += 1

S = sorted(S.items(), key=lambda x: x[0])
S = sorted(S, key=lambda x: x[1], reverse=True)

max = S[0][1]
for k, v in S:
    if max != v:
        sys.exit()
    print(k)


Measured memory_bytes: 46804
//BISMILLAHIR RAHMANIR RAHEEM
//ALLAH IS WATCHING ME
// Allah amader korona virus theke rokkha korun.Amin.

//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp> //order_of_key return number of elements less than x, find_by_order return index (pointer use kora lgbe)

using namespace std;
using namespace __gnu_pbds;

#define ull    unsigned long long
#define ll    long long
#define ios    ios::sync_with_stdio(0);cin.tie(0);
#define ses   "\n"
#define all(x) (x).begin(), (x).end()
//#define INF   ((int)2e18)
#define ii pair<ll, ll>

string digit="0123456789";
string small="abcdefghijklmnopqrstuvwxyz";
string capital="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; // 8-direction.......
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[]= {1,-1,0,0}; // 4-direction...........
int dy4[]= {0,0,1,-1};

const int N=1e6+5;
const ll M=1e18;

typedef tree< ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

struct Edge
{
    int u, vv;
    bool operator<(Edge const& other)
    {
        return vv > other.vv;
    }
}; // eta joss jinis.krsukal er jnno and sort 1 out of 3 or more er jnno better

/////////////////////////////////////////////////////////////////////////////
bool subsequence(string s, string t,ll i , ll point){
  for(ll k = i ; k<s.size();k++){
            if(s[k]==t[point])point++;
            if(point==t.size())return 1;
  }
  if(point<t.size())return 0;
}
////////////////////////////////////////////////////////////////////////////
//main function is here.........
int main()
{
       //ios
   ll n;
   cin>>n;
   long double nn = (long double)n;
   nn/=3;
   cout<<fixed<<setprecision(12);
   cout<<nn*nn*nn;
}


/*



*/



//Alhamdulillah


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char a,b,x=0; cin>>b;
  for(int i=0;i<3;i++){
    a=b;
    cin>>b;
    x+= a==b?1:0;
  }
  if(x==0)cout<<"Good"<<endl;
  else cout<<"Bad"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <algorithm>
#include <functional>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;
typedef pair<int, char> P;
static const int INF = 1e9;

void merge(vector<P>& A, int left, int mid, int right)
{
	int n1 = mid - left;
	int n2 = right - mid;
	vector<P> L(n1 + 1);
	vector<P> R(n2 + 1);
	for (int i = 0; i < n1; ++i)
	{
		L[i] = A[left + i];
	}
	for (int i = 0; i < n2; ++i)
	{
		R[i] = A[mid + i];
	}
	L[n1].first = INF;
	R[n2].first = INF;
	int i = 0;
	int j = 0;
	for (int k = left; k < right; ++k)
	{
		if (L[i].first <= R[j].first)
		{
			A[k] = L[i];
			++i;
		}
		else
		{
			A[k] = R[j];
			++j;
		}
	}
}

void mergeSort(vector<P>& A, int left, int right)
{
	if (left + 1 < right)
	{
		int mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}

int partition(vector<P>& A, const int p, const int r)
{
	int x = A[r].first;
	int i = p - 1;
	for (int j = p; j < r; ++j)
	{
		if (A[j].first <= x)
		{
			++i;
			P temp = A[i];
			A[i] = A[j];
			A[j] = temp;
		}
	}
	P temp = A[i + 1];
	A[i + 1] = A[r];
	A[r] = temp;
	return(i + 1);
}

void quickSort(vector<P>& A, const int p, const int r)
{
	if (p < r)
	{
		int q = partition(A, p, r);
		quickSort(A, p, q - 1);
		quickSort(A, q + 1, r);
	}
}

void solve()
{
	int n;
	cin >> n;
	vector<P> A(n);
	for (int i = 0; i < n; ++i)
	{
		P p;
		cin >> p.second >> p.first;
		A[i] = p;
	}
	vector<P> B(n);
	for (int i = 0; i < n; ++i)
	{
		B[i] = A[i];
	}
	quickSort(A, 0, n - 1);
	mergeSort(B, 0, n);
	bool isStable = true;
	for (int i = 0; i < n; ++i)
	{
		if (A[i] != B[i])
		{
			isStable = false;
			break;
		}
	}
	if (isStable)
	{
		cout << "Stable" << endl;
	}
	else
	{
		cout << "Not stable" << endl;
	}
	for (int i = 0; i < n; ++i)
	{
		cout << A[i].second << " " << A[i].first << endl;
	}
}

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

Measured memory_bytes: 3356
#ifndef Local
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/STACK:1024000000,1024000000")
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define popCnt(x) (__builtin_popcountll(x))
typedef long long Long;

const int N = 1e3 + 5;

bool solve(const vector<pair<int, int>>& v, int r, int s) {
  int safe_l = 1, safe_r = r;
  for (int i = v.size() - 1; i >= 0; --i) {
    safe_r = min(safe_r , r);
    safe_l = max(safe_l , 1);

    auto curr = v[i];
    if (curr.first == 0) {
      if (curr.second == -1) {
        safe_l += 1;
      } else {
        safe_r -= 1;
      }
    } else {
      if (curr.second == -1) {
        safe_r += 1;
      } else {
        safe_l -= 1;
      }
    }
    if (safe_l > r || safe_r < 1) {
      return false;
    }
  }

  return safe_l <= s && s <= safe_r;
}

int main() {
  srand(time(0));
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
  freopen("test.in", "r", stdin);
#else
#define endl '\n'
#endif

  int h, w, n;
  cin >> h >> w >> n;
  int sr, sc;
  cin >> sr >> sc;

  string s[2];
  cin >> s[0] >> s[1];

  vector<pair<int, int>> hor, ver;
  for (int i = 0; i < n; ++i) {
    for (int p = 0; p < 2; ++p) {
      if (s[p][i] == 'U') {
        ver.emplace_back(p, -1);
      }
      if (s[p][i] == 'D') {
        ver.emplace_back(p, +1);
      }
      if (s[p][i] == 'L') {
        hor.emplace_back(p, -1);
      }
      if (s[p][i] == 'R') {
        hor.emplace_back(p, +1);
      }
    }
  }

  cout << ((solve(hor, w, sc) && solve(ver, h, sr)) ? "YES\n" : "NO\n");
}


Measured memory_bytes: 4912
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int x,y,a,b,c;cin>>x>>y>>a>>b>>c;
    vector<lint> p(a);for(int i=0;i<a;i++)cin>>p[i];
    vector<lint> q(b);for(int i=0;i<b;i++)cin>>q[i];
    vector<lint> r(c);for(int i=0;i<c;i++)cin>>r[i];
    sort(all(p),greater<lint>());sort(all(q),greater<lint>());sort(all(r),greater<lint>());
    int pa=0,pb=0,pc=0,ba=x-1,bb=y-1;
    lint ans=0;bool aend=false,bend=false;
    for(int rep=0;rep<x+y;rep++){
        if(p[pa]>=q[pb]&&p[pa]>=r[pc]){
            ans+=p[pa];
            pa++;
            if(pa>ba){pa=0;p[0]=0;aend=true;}
        }
        else if(q[pb]>=r[pc]){
            ans+=q[pb];
            pb++;
            if(pb>bb){pb=0;q[0]=0;bend=true;}
        }
        else{
            ans+=r[pc];
            if(p[ba]<q[bb]||bend){
                ba--;
                if(pa>ba){pa=0;ba=0;p[0]=0;aend=true;}
            }
            else{
                bb--;
                if(pb>bb){pb=0;bb=0;q[0]=0;bend=true;}
            }
            pc++;
            if(pc>=c){pc=0;r[0]=0;}
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5636