/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 412.0 KiB
#2 Time Exceeded ≥1098ms ≥556.0 KiB
#3 Time Exceeded ≥1100ms ≥556.0 KiB

Code

///******* In the name of ALLAH, Who is Most Gracious, Most Merciful *******///
///******* There is no God but ALLAH, MUHAMMAD(S.A.W) is the Messenger of ALLAH. *******///
///******* Every soul shall taste death.*******///

//  AL-HAMDULILLAH    //  AL-HAMDULILLAH     //  AL-HAMDULILLAH    //  AL-HAMDULILLAH
//  AL-HAMDULILLAH    //  AL-HAMDULILLAH     //  AL-HAMDULILLAH    //  AL-HAMDULILLAH
//  AL-HAMDULILLAH    //  AL-HAMDULILLAH     //  AL-HAMDULILLAH    //  AL-HAMDULILLAH
//  AL-HAMDULILLAH    //  AL-HAMDULILLAH     //  AL-HAMDULILLAH    //  AL-HAMDULILLAH
//  AL-HAMDULILLAH    //  AL-HAMDULILLAH     //  AL-HAMDULILLAH    //  AL-HAMDULILLAH

/**************************************************************************************
    ___  _          _   _  ___ ___  ________ _   _ _    _____ _     _      ___  _   _
   / _ \| |        | | | |/ _ \|  \/  |  _  | | | | |  |_   _| |   | |    / _ \| | | |
  / /_\ | |  ____  | |_| / /_\ | .  . | | | | | | | |    | | | |   | |   / /_\ | |_| |
  |  _  | | |____| |  _  |  _  | |\/| | | | | | | | |    | | | |   | |   |  _  |  _  |
  | | | | |____    | | | | | | | |  | | |/ /| |_| | |____| |_| |___| |___| | | | | | |
  \_| |_\_____/    \_| |_\_| |_\_|  |_|___/  \___/\_____\___/\_____\_____\_| |_\_| |_/

***************************************************************************************/

//  AL-HAMDULILLAH    //  AL-HAMDULILLAH     //  AL-HAMDULILLAH    //  AL-HAMDULILLAH
//  AL-HAMDULILLAH    //  AL-HAMDULILLAH     //  AL-HAMDULILLAH    //  AL-HAMDULILLAH
//  AL-HAMDULILLAH    //  AL-HAMDULILLAH     //  AL-HAMDULILLAH    //  AL-HAMDULILLAH


// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdlib.h>
#include<string.h>
#include<math.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>

#define 	ll              long long
#define 	size1           1000001
#define 	bm              1000000007   //bigmod
#define		reset(arr,n,i)  fill(arr,arr+n,i)  //cbrt(n) means cube root
#define		rset(arr,x)  	memset(arr,x,sizeof(arr))
#define		_ceil(x,y)      ((x)/(y))+(((x)%(y))>0)
#define		INF             (ll)1e18 + 10
#define		mod             1e9 + 7//998244353;
#define 	endl            "\n"

#define		_cpy(c,a,n)     for(int i=0;i<n;i++) c[i]=a[i];
#define 	_iin(a,n)       int a[n]; for(int i=0;i<n;i++) cin>>a[i]
#define 	_lin(a,n)       ll a[n]; for(int i=0;i<n;i++) cin>>a[i]
#define 	_in(a,n)        for(int i=1;i<=n;i++) cin>>a[i]
#define 	_out(a,n)       for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl
#define		_celi(x,y)      (ll)((x+y-1)/(y))  //use this version of _ceil [note: ceil is risky]
#define		eps             0.0000000001

#define 	fopr()          freopen("input.txt", "r", stdin)
#define 	fopw()          freopen("output.txt", "w", stdout)
#define 	FastIO          ios_base::sync_with_stdio(false), cin.tie(0)

// Math :
void		mns(int *x, int *y)		{
	if(*x>=*y) *x-=*y, *y=0;
	else *y-=*x, *x=0;
}
int			log_x(ll n)				{
	int cnt=0;
	while(n/10) cnt++, n/=10;
	return cnt;
}
int			log2_(ll i)				{
	return i ? __builtin_clzll(1) - __builtin_clzll(i) : -1;
}
// Debuging :
#define		_dbg(_x,_y,_z)  cout<<_x<<" "<<_y<<" "<<_z<<endl
#define		_dbl			cout<<"_________________ "<<endl
#define		_db(_x,_y)      cout<<_x<<" "<<_y<<endl
#define     OK              cout<<"Ok"<<endl;

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

/*
void pbdserase(pbds &t, int v)
{
    //normal erase function doesnt work in ordered multiset but this works
    int rank = t.order_of_key(v);
    auto it = t.find_by_order(rank);
    t.erase(it);
}
*/

//Sparse Table
/*const int MAXN=200007;
const int LOG=18;
int min_st[MAXN][LOG];
int max_st[MAXN][LOG];
int log_table[MAXN + 7];

void buildSparseTables(int n,int arr[]) {
    log_table[1]=0;
    for (int i=2; i<=n;i++)
        log_table[i]=log_table[i / 2]+1;

    for (int i = 0;i<n;i++) {
        min_st[i][0]=arr[i];
        max_st[i][0]=arr[i];
    }

    for (int j = 1;(1 << j)<= n;j++)
        for (int i=0; i+(1 << j)<= n; i++) {
            min_st[i][j]=min(min_st[i][j - 1], min_st[i + (1 << (j - 1))][j - 1]);
            max_st[i][j]=max(max_st[i][j - 1], max_st[i + (1 << (j - 1))][j - 1]);
        }
}

int queryMin(int L, int R) {
    int j = log_table[R - L + 1];
    return min(min_st[L][j], min_st[R - (1 << j) + 1][j]);
}

int queryMax(int L, int R) {
    int j = log_table[R - L + 1];
    return max(max_st[L][j], max_st[R - (1 << j) + 1][j]);
}*/


/*const int N=200001;
map<int,int>id_col,mxber;
int n,m,k,col[N],mx=0,total=0;
vector<int>grp[N];
bool vis[N]= {0};

void dfs(int node) {
	vis[node]=1;
	total++;
	mxber[col[node]]++;
	mx=max(mx,mxber[col[node]]);

	for(auto child:grp[node]) {
		if(vis[child]) continue;
		dfs(child);
	}
	return;
}

const int N=1001;
ll fact[N];

void facto(){
	fact[1]=1;
	for(int i=2;i<=N;i++){
		fact[i]=fact[i-1]*i;
	}
}

ll binexp(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%mod;
        a = (a * a)%mod;
        b >>= 1;
    }
    return res;
}

ll MMI(ll den){
	return binexp(den,mod-2);
}

ll nCr(ll n, ll r){
	ll den=MMI((fact[n-r]%mod*fact[r]%mod)%mod);
	return (fact[n]%mod*den)%mod;
}

*/

void solve() {
    int n;
    cin>>n;

    ll sol=0;
    for(int i=1;i<=n;i++){
        ll x=n/i;
        sol+=x-1;
    }

    cout<<sol<<endl;
}

int main() {
	FastIO;
	int n=1;
    cin>>n;
	while(n--) {
		solve();
	}
	return 0;
}
//written by MAMUN

/*  Cautions:
	1.array out of bound!!! [check array size and last accessed index]
	2.signed integer overflow!!! [int*int!=ll @typecast(ll) one of them or, multiply with 1LL]
	3.floating point numbers numbers are equal if the difference between them is less than 1e-9 [better way to compare floating point numbers]
	4.any square number when divided by 4 must have a remainder of either 0 or 1.
*/


/********************************************************************************************************************************************************
 _   _            _   _       _____          _     _   _       _                    _ _          ______                   _           _           _
| \ | |          | | | |     |  ___|        | |   | | | |     (_)                  (_) |         | ___ \                 | |         | |         | |
|  \| | ___  _ __| |_| |__   | |__  __ _ ___| |_  | | | |_ __  ___   _____ _ __ ___ _| |_ _   _  | |_/ / __ _ _ __   __ _| | __ _  __| | ___  ___| |__
| . ` |/ _ \| '__| __| '_ \  |  __|/ _` / __| __| | | | | '_ \| \ \ / / _ \ '__/ __| | __| | | | | ___ \/ _` | '_ \ / _` | |/ _` |/ _` |/ _ \/ __| '_ \
| |\  | (_) | |  | |_| | | | | |__| (_| \__ \ |_  | |_| | | | | |\ V /  __/ |  \__ \ | |_| |_| | | |_/ / (_| | | | | (_| | | (_| | (_| |  __/\__ \ | | |
\_| \_/\___/|_|   \__|_| |_| \____/\__,_|___/\__|  \___/|_| |_|_| \_/ \___|_|  |___/_|\__|\__, | \____/ \__,_|_| |_|\__, |_|\__,_|\__,_|\___||___/_| |_|
                                                                                           __/ |                     __/ |
                                                                                          |___/                     |___/
*********************************************************************************************************************************************************/

// Don't Start typing till you complete the idea.
 
// Check these things for WA and before submitting
// 1. Did you clear all the global arrays
// 2. Did you checked your <= >= < > 
// 3. Did you take the input properly. Did you use break or return while taking input?
// 4. Did you divide by 0.
// 5. Check array , vector , etc size
// 6. in the while loop did you miss something that would cause infinite loop?
// 7. Did you save your dp?
// 8. Are you trying to use something after deleting it?
// 9. Did you read the problem statement wrong?
// 10. Did you check the constrains of the problem properly
// 11. Did you checked for smaller cases like 1 , 0 , etc
// 12. Is it something to with overflow?
// 13. Did you initialized all the variables properly?
// 14. Did you use the formulas correctly?
 
// STRESS TESTING !!!!!! STRESS TESTING !!!!!
// STRESS Testing Not working?
// Stress test for multiple cases? 
// Stress test for big inputs?
// Stress test for really small inputs?
// Even then if it doesn't work -> Did you wrote the wrong Brute force code
 
// Check these things if you are not generating ideas
// 1. Did you try thinking it in reverse?
// 2. Read the problem statement again
// 3. Check the constraints again
// 4. Try smaller cases in notebook and try to expand
// 5. Think about invariants
// 6. Think simpler ideas maybe?
// 7. Think brute force and try to get something out of it.

// - from sakib.safwan codeforces submission #320087959:

Information

Submit By
Type
Submission
Problem
P1206 D1. GCD equal Absolute Value (Easy Version)
Contest
Educational Round 1
Language
C++17 (G++ 13.2.0)
Submit At
2025-07-14 17:48:57
Judged At
2025-07-14 17:48:57
Judged By
Score
0
Total Time
≥1100ms
Peak Memory
≥556.0 KiB