#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')...
Dive into the world of Java build tools like Maven and Gradle. Discover how to optimize your build process for speed, safety, and a superior developer experience.
Dive into the world of AI tools with our comprehensive guide. Explore categories, benefits, and top applications transforming industries and daily life in 2024.
Unlock a higher IELTS Speaking score with a consistent daily English practice routine. Discover expert tips and actionable strategies to boost your fluency, vocabulary, and confidence for test day.
Get an early look at Python 3.14, slated for 2025! Explore expected features, performance boosts, and how it will shape Python development and data science.