/*1Byte＝8bit 1KByte=1024Byte 1M=1024KByte 1MB/s=8Mbps 200Mbps=25MB/s*/
<>B topic Pure prime number

/**1903*/ #include <bits/stdc++.h> using namespace std; const int maxn =
20210610; int f[maxn];// 0 Is a prime number 1 Non prime number void init(){ f[1]=1,f[0]=1; for(int i=2;i<
maxn;i++){ if(f[i]==0){ for(int j=2;j*i<maxn;j++){ f[i*j]=1; } } } } bool check(
int x){ while(x>0){ if(f[x%10]){ return false; } x/=10; } return true; } int
main(){ int ans=0; init();// for(int i=2;i<=20210605;i++){ if(f[i]==0){// If it's a prime number
if(check(i)){ cout<<i<<endl; ans++; } } } cout<<ans<<endl; return 0; }
<>C topic Full date

/**977**/ #include <bits/stdc++.h> using namespace std; const int maxn=1e5*2+5;
int f[maxn]; bool Run(int year){ if( (year%4==0 && year%100!=0) || (year%400==0
) ){ return true; } return false; } bool check(int y,int m,int d){ int sum=0;
while(y>0){ sum+=y%10; y/=10; } while(m>0){ sum+=m%10; m/=10; } while(d>0){ sum
+=d%10; d/=10; } if(f[sum]==1){ return true; } return false; } void init(){ f[1]
=1; for(int i=2;i*i<maxn;i++){ f[i*i]=1; } } int main(){ // from 2001.1.1 reach 2021.12.31
// Ordinary year 2 month 28 day leap year 29 day init(); int ans=0; for(int i=2001;i<=2021;i++){//year int m[13
]={0,//m 31,//1 28,//2 31,//3 30,//4 31,//5 30,//6 31,//7 31,//8 30,//9 31,//10
30,//11 31//12 }; if(Run(i)){// If it's a leap year m[2]++; } for(int j=1;j<=12;j++){//month
for(int k=1;k<=m[j];k++){ if(check(i,j,k)){ cout<<" year "<<i<<" month "<<j<<" day "<<k<<endl;
ans++; } } } } cout<<ans<<endl; return 0; }
<>D topic Minimum weight
/**2597854139*/ #include <bits/stdc++.h> using namespace std; const int maxn=
2022; #define ll long long ll f[maxn],w[maxn]; void get(int c,int x,int l,int r)
{ if(x>2021)return ; if(l<=2021){ f[c]++; get(c,l,l*2,l*2+1); } if(r<=2021){ f[c
]++; get(c,r,r*2,r*2+1); } } int main(){ for(int i=1;i<=2021;i++){ f[i]=0,w[i]=0
; } for(int i=1;i<=2021;i++){ get(i,i,i*2,i*2+1);// current node Left node Right node } for(int i=2021
;i>=1;i--){ if(2*i>2021 && 2*i+1>2021){ w[i]=0; continue; } w[i]=1; int mark=0;
if(i*2<=2021){// Left node w[i]+=2*w[i*2]; mark++; } if(i*2+1<=2021){// Right node w[i]+=3*w[i*
2+1]; mark++; } if(mark==2){ w[i]+=(f[i*2]*f[i*2])*f[i*2+1]; } } cout<<w[1]<<
endl; return 0; }
<>E topic Capitalize

#include <bits/stdc++.h> using namespace std; int main(){ string s; while(cin>>
s){ for(int i=0;i<s.length();i++){ if(s[i]>='a'&&s[i]<='z'){ s[i]-=32; } cout<<s
[i]; }cout<<endl; } return 0; }
<>F topic 123

// Prefix and array water data #include <bits/stdc++.h> using namespace std; #define ll long long
const int maxn=1e8+5; int a[maxn],w[maxn]; int main(){ int k=1,d=1; for(int i=1;
i<maxn;i++){ if(d<k){a[i]=d;d++; }else{i--;d=1;k++; } } w[1]=a[1]; for(int i=2;i
<maxn;i++){ w[i]=w[i-1]+a[i]; } int t; scanf("%d",&t); int x,y; while(t--){
scanf("%d %d",&x,&y); if(x==y){ printf("%d\n",a[x]); }else{ printf("%d\n",w[y]-w
[x]+a[x]); } } return 0; }
<>G topic XOR transformation

// Simulated water data #include <bits/stdc++.h> using namespace std; int main(){ int n,t; int
x,y; while(scanf("%d %d",&n,&t)!=EOF){ string s,b; cin>>s; b=s; while(t--){ for(
int i=1;i<s.length();i++){ x=s[i-1]-'0'; y=s[i]-'0'; x=x^y; b[i]=x+'0'; } s=b; }
cout<<s<<endl; } return 0; }
<>H topic Binary problem

// Bit operation water data #include <bits/stdc++.h> using namespace std; int main(){ int n,k;
while(scanf("%d %d",&n,&k)!=EOF){ int sum=0,ans,j; for(int i=1;i<=n;i++){ ans=0,
j=i; while(1){ if( j&1 ){ ans++; } j= j >> 1; if(j==0)break; } if(ans==k){ sum++
; } } printf("%d\n",sum); } return 0; }
<>I topic Flip bracket sequence

// Simulated water data #include <bits/stdc++.h> using namespace std; string s; void rev(int l,
int r){ for(int i=l;i<=r;i++){ if(s[i]=='('){ s[i]=')'; }else{ s[i]='('; } } }
intcheck(int l){ if(s[l]==')')return 0; int left = 1,right = 0,mark=0; for(int i
=l+1;i<s.length();i++){ if(left<right)return i-1; if(s[i]=='('){ left++; } if(s[
i]==')'){ right++; } if(left==right){ mark=i+1; } } return mark; } int main(){
int n,m; while(scanf("%d %d",&n,&m)!=EOF){ cin>>s; while(m--){ int op,l,r; scanf
("%d",&op); switch(op){ case 1: scanf("%d %d",&l,&r); rev(l-1,r-1); break; case
2: scanf("%d",&l); printf("%d\n",check(l-1)); break; } } } return 0; }
<>J topic XOR triangle

// three layers for Forced blasting #include <bits/stdc++.h> using namespace std; #define ll long long
boolcheck(int i,int j,int k){ if(i+j<=k || i+k<=j || j+k<=i ){ return false; }
int temp= i^j; temp = temp^k; if(!temp)return true; return false; } int main(){
intT; scanf("%d",&T); ll n; while(T--){ cin>>n; ll ans=0; for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){ for(int k=1;k<=n;k++){ if(check(i,j,k)){ ans++; } } } }
cout<<ans<<endl; } return 0; }

Technology
Daily Recommendation