#include <bits/stdc++.h> using namespace std; int main() { char s[140],charcter,l; int i,j; while(gets(s)) { for(i=0; s[i] != '\0'; ) { int freq = 0; while( (s[i] >='0' && s[i] <='9') ) { charcter = ( s[i++]-'0' ); freq += charcter;...
#include <bits/stdc++.h> using namespace std; int main() { char s[140],charcter,l; int i,j; while(gets(s)) { for(i=0; s[i] != '\0'; ) { int freq = 0; while( (s[i] >='0' && s[i] <='9') ) { charcter = ( s[i++]-'0' ); freq += charcter;...
#include <bits/stdc++.h> using namespace std; int main() { int a,f,tc,i,j,k,l,m,n; scanf("%d",&tc); while(tc--) { cin>>a; cin>>f; for(l=1;l<=f;l++) { for(i=1;i<=a;i++) { for(j=0;j<i;j++) { cout<<i; } cout<<"\n"; }...
#include <bits/stdc++.h> #include <string.h> using namespace std; int main() { int tc,i,j; char s[100],l; cin>>tc; getchar(); for(i=1;i<=tc;i++) { while(gets(s)!='\0') { l=strlen(s); if(l==0) { break; } for(j=0;j<l;j++) { if(s[j]=='3')...
#include <bits/stdc++.h> using namespace std; int main() { int N,i,j,insum,line; while(cin>>N) { insum=0; for(i=0;;i++) { insum+=i; if(insum >= N) { line = i; break; } } printf("TERM %d IS ", N); if(line&1)//insum-line...
#include <bits/stdc++.h> using namespace std; int main () { int n,m; int count=0; while(1) { cin>> m >> n; if (n ==0 && m ==0) break; count++; if (count > 1) cout << '\n'; int board[102][102] = {0}; for (int i=1; i<m+1;...
#include <stdio.h> #include <bits/stdc++.h> using namespace std; int main() { int a,miles,juice,n,T,tc=1,b,c,i,arr,m,j,cells; cin>>T; for(int i=0;i<T;i++){ cin>>n; miles=0,juice=0; while(n--) { cin>>cells; miles...
#include <bits/stdc++.h> using namespace std; int main() { double n,p,ans; while(cin>>n>>p) { printf("%.0lf\n",pow(p,1/n)); } return 0; }
#include <bits/stdc++.h> using namespace std; long long int reverse(long long int n) { long long int sum=0,r; while(n > 0) { r=n%10; sum=sum*10+r; n=n/10; } return sum; } int main() { long long int t, sum, count; int cse; cin >> cse; for...
#include<bits/stdc++.h> bool flag[100]; int List[100],primes[100]; int cnt; using namespace std; void sieve(int n) { cnt=0; primes[cnt++] = 2; for(int i=3; i<=n; i+=2) { if(flag[i] == 0) { primes[cnt++] = i; if(i <= n/i) { for(int j=i*i;...
#include <bits/stdc++.h> using namespace std; char s[200000]; int main() { int c=0,i; while(gets(s)) { for(i=0;i<strlen(s);i++) { if(s[i]=='"') { c++; if(c/2==0) printf("``"); else printf("''"); } else printf("%c",s[i]);; } printf("\n"); } return 0; }...
#include <bits/stdc++.h> using namespace std; int main() { int n, array[5000],k, c,count,d,T, t; while(cin>>T) { for(k=0;k<T;k++) { cin>>n; count=0; for (c = 0; c < n; c++) { cin>>array[c]; } for (c = 1 ; c <= n - 1; c++) { d =...
#include<bits/stdc++.h> using namespace std; int main() { int n,a[15]={0,2,7,5,30,169,441,1872,7632,1740,93313,459901,1358657,2504881}; while(cin>>n && n) { printf("%d\n",a[n]); } return 0; }...
#include<bits/stdc++.h> using namespace std; int tc=1,position=0; int bfs(int src, int TTL,map <int, vector<int> > edges) { map<int,int> visited,level; int unreach=0; queue<int>Q; Q.push(src); position=1; visited[src]=1;...
#include <bits/stdc++.h> using namespace std; int main() { int a,b,c,d,n,i,j,k; for(n=6;n<=200;n++) { int a=n*n*n; for(i=2;i<=200;i++) { int b=i*i*i; for( j=i;j<n;j++) { int c = j*j*j; for( k=j;k<n;k++) { int d = k*k*k; if(a==(b+c+d)) {...
#include <stdio.h> #include<iostream> using namespace std; bool flag[1005]; int primes[1005]; int cnt; void seive(int n) { cnt=0; primes[cnt++] = 1; primes[cnt++]=2; for(int i=3; i<=n; i+=2) { if(flag[i] == 0) { primes[cnt++] = i; if(i...
#include<bits/stdc++.h> #include<math.h> #define pi 3.141592653589793 int main() { double x1,x2,y1,y2,x3,y3,a,b,c,s,radius,d,circle; while(scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3) != EOF) {...
#include <stdio.h> #include <string.h> int main() { char s[1000],l,i; while(gets(s)) { l=strlen(s); for(i=0;i<l;i++) printf("%c",s[i]-7); printf("\n"); } return 0; }
#include<stdio.h> #include<string.h> int main() { int l,i,j,b,k; char n[1000]; while(gets(n)) { l=strlen(n); b=-1; for(i=0;i<l;i++) { if(n[i]==' ') { for(j=i-1;j>b;j--) printf("%c",n[j]); printf(" "); b=i; } } for(i=l-1;i>b;i--)...
#include<bits/stdc++.h> using namespace std; bool vowel(char ch) { if (ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'i' || ch == 'I' || ch =='o' || ch=='O' || ch == 'u' || ch == 'U') return true; else return false; } int main() { char...
#include <bits/stdc++.h> using namespace std; int main() { char s[2000]; int t,f,a,c; while(gets(s)) { c=0; for(t=0;s[t]!='\0';t++) { if( ((s[t]>='A' && s[t]<='Z') || (s[t]>='a' && s[t]<='z'))&&(s[t+1]<'a'||s[t+1]>'z')...
Discover why Python is the undisputed leader in data science, exploring its key advantages, essential libraries, and profound impact on AI, machine learning, and data-driven innovations.
Create Laravel Project Through Docker — No Need to Install PHP, MySQL, or Apache on Your Local Machine In this tutorial, I’ll show you how to create and run a full Laravel project using Docker containers. That means you won’t have to install PHP, MySQL, or Apache...
The world of AI is evolving at lightning speed. Discover why keeping up with the latest Artificial Intelligence news and trends is essential for everyone.
Explore PHP’s incredible journey to its 30th year and what hypothetical future versions like PHP 8.5 could mean for performance, developer experience, and web innovation.