# data[].attributes.body
#include <iostream>
#include <math.h>
using namespace std;
int n,k,x,ceva,da=1,m;
int main()
{
    cin>>n>>k;
    m=n;
    while(n>1)
    {
        n--;
        da=da*10;

    }
    ceva=1;
    while(ceva<9999999)
      {
          if((ceva*9+k)<da) ceva++;
          else break;
      } cout<<ceva*9+k;

    return 0;
}

# data[].attributes.body
Liviu # 1907 Numar Prim

# data[].attributes.body
gr 7

# data[].attributes.body
#include<iostream>
using namespace std;
int long long n,m,i;
int main()
{cin>>n>>m;
if(n%2==0)cout<<2<<" "<<n/2;
else{ for(i=3;i*i<=n;i=i+2) if(n%i==0)cout<<i<<" "<<n/i; }
return 0;
}

2608

# data[].attributes.body
```

#include <iostream>

using namespace std;
int n,i,d,x,nr;
int main()
{
    cin>>n;
    x=1;
    i=1;
    while(nr<=n)
    {
        nr=0;
        for(d=1;d*d<=x;d++)
        {
            if(x%d==0) nr+=2;
            if(d*d==x) nr--;
        }
        i++;
        x=x+i;
    }
    cout<<x-i;
    return 0;
}

```

# data[].attributes.body
#include <bits/stdc++.h>

using namespace std;

int nr;

bool verifprim(int x)

{

if(x==1||x==0) return 0;

if(x==2)

{

return 1;

}

if(x%2==0) return 0;

for(int i=3; i*i<=x; i+=2)

{

if(x%i==0)return 0;

}

return 1;

}

bool verifcif(int x)

{

int sum=0;

while(x)

{

sum+=x%10;

x/=10;

}

if(verifprim(sum)) return 1;

return 0;

}

int main()

{

int n,i,a;

cin>>n;

for(i=1; i<=n; i++)

{

cin>>a;

if(verifprim(a))

{

if(verifcif(a))nr++;

}

}

cout<<nr;

return 0;

}

1590

#include <fstream>

#define VMAX 50000

#define NMAX 10000

#define NRMAXPRIME 50000

using namespace std;

ifstream fin("arma1.in");

ofstream fout("arma1.out");

int n, nrprim, nrf, cerinta;

bool ciur[VMAX];

int prim[NRMAXPRIME];

int fp[NRMAXPRIME];

int mf[NRMAXPRIME];

int p[NMAX];

long long int cant;

void eratostene()

{

int d, j;

for (d=2; d*d<VMAX; d++)

if (ciur[d]==0)

for (j=d*d; j<VMAX; j+=d)

ciur[j]=1;

prim[0]=2;

nrprim=1;

for (d=3; d<VMAX; d+=2)

if (!ciur[d]) prim[nrprim++]=d;

}

void afisare()

{

int i;

if (cerinta==1)

fout<<cant<<'\n';

else

for (i=0; i<n; i++) fout<<p[i]<<'\n';

fout.close();

}

int euclid(int a, int b)

{

int r;

while (b)

{

r=a%b;

a=b;

b=r;

}

return a;

}

int cmmdc()

{

int d=mf[0], i;

for (i=1; i<nrf; i++)

d=euclid(d,mf[i]);

return d;

}

int putere(int x, int y)

{

int p=1;

while (y)

{

if (y%2)

{

p*=x;

y--;

}

else

{

x*=x;

y/=2;

}

}

return p;

}

void determina(int d, int &p, int &c)

{

int m, j;

nrf=0;

for (j=0; j<nrprim && prim[j]*prim[j]<=d; j++)

{

for (m=0; d%prim[j]==0; m++,d/=prim[j]);

if (m)

{

fp[nrf]=prim[j];

mf[nrf++]=m;

}

}

if (d>1)

{

fp[nrf]=d;

mf[nrf++]=1;

}

p=cmmdc();

c=1;

for (j=0; j<nrf; j++)

c*=putere(fp[j],mf[j]/p);

}

int main()

{

int i, d, c;

eratostene();

fin>>cerinta>>n;

for (i=0; i<n; i++)

{

fin>>d;

determina(d,p[i],c);

cant+=c;

}

afisare();

return 0;

}

# data[].attributes.body
#include

using namespace std;
long long a,b,a1,b1,r;
int main()
{
cin>>a>>b;
a1=a;
b1=b;
while(b1)
{
r=a1%b1;
a1=b1;
b1=r;
}

cout<<a/a1+b/a1-2;
    return 0;
}

# data[].attributes.body
#include #include using namespace std;int main(){    long long int n,cn,cm,m;    cin>>n>>m; if (n

# data[].attributes.body
#include
using namespace std;

int main(){
int n;
cin >> n;
n--;
int p = 0;
while(n % 2 == 0)
n/=2, p++;
int put = (1 << p);
if(put > n)
cout << "DA";
else
cout << "NU";
return 0;
}

#3360
#include <iostream>
using namespace std;

int desc(int n)
{
int nr=0,p,d=2;
while(n > 1)
{
p = 0;
while(n % d == 0)
{
++p;
n /= d;
}
if(p) nr++;

++ d;
if( d * d > n)
d=n;
}
return nr;
}

int main(){
int n, a, b, rez1 = 1000000000, rez2 = 1000000000;
cin >> n;
cin >> a;
for(int i = 2; i <= n; ++i){
cin >> b;
if(desc(a)==desc(b) && a + b < rez1 + rez2)
rez1 = a, rez2 = b;
a = b;
}
if(rez1 != 1000000000)
cout << rez1 << ' ' << rez2;
else
cout << "NU EXISTA";
return 0;
}

# data[].attributes.body
#include <iostream>

using namespace std;
long long n,nr,o,d,suma,da;
bool prim;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>nr;
        da=nr;
        o=0;
        while(da)

        {
            o=o*10+da%10;
            da=da/10;
        }
        prim=true;
        if(o==0 || o==1) prim=false;
        if(o==2) prim=true;
        if(o%2==0) prim=false;
        for(d=3;d*d<=o;d=d+2)
            if(o%d==0) prim=false;
        if(prim) suma=suma+nr;

    }
    cout<<suma;
    return 0;
}

# data[].attributes.body
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
{
while (n%2==0)
{
cout<<2<<" ";
n=n/2;
}
// va fi impartit la doi pana cand nu mai este divizibil cu 2.
// n a ajuns impar, deci mergem din 2 in 2.

for (int i=3;i*i<=n;i+=2)
{
while (n%i==0)
{
cout<<i<<" ";
n=n/i;
}
}
// Dupa asta, N va ramane numar prim si deci
// nu ii gasim divizori sub sqrt N,
//...deci va trebui sa apara pe ecran
if (n>2) cout<<n<<" ";
}
return 0;
}

# data[].attributes.body
#include <iostream>
using namespace std;
long long n,p,dmax,d=2;
int main()
{
    cin>>n;
    while(n>1)
    {
        int p = 0;
        while(n%d==0)
        {
            n/=d;
            p++;
        }
        if(p!=0)
        {
            dmax=d;
        }
        d++;
        if(d*d>n)
        d=n;
    }
    cout << dmax;
return 0;
}

# data[].attributes.body
#include <fstream>
using namespace std;
ifstream fin("placare1.in");
ofstream fout("placare1.out");
int l,a,b,c,r,ia,ib;
int main()
{
fin>>l>>a>>b;
c=l;
r=l%a;
ia=b;
while(r!=0)
{
ia=ia+b;
c=l-a+r;
r=c%a;
}
c=l;
r=l%b;
ib=a;
while(r!=0)
{
ib=ib+a;
c=l-b+r;
r=c%b;
}
if(ia>ib) fout<<ia;
else fout<<ib;
return 0;
}

# data[].attributes.body
#include <fstream>

using namespace std;
ifstream f ("clatite.in");
ofstream g ("clatite.out");
int n,m,i,cio,gem,ing,zah,sim,j,ci,d,p,sd,num;
bool clatite[300002];
int main()
{
f>>n>>m;
g<<m-n+1<<endl;
clatite[1]=false;
for (i=2; i<=m; i++)
clatite[i]=true;
for (i=2; i*i<=m; i++)
{
if (clatite[i])
for (j=i*2; j<=m; j+=i)
clatite[j]=false;
}
cio=gem=ing=zah=sim=0;
for (i=n; i<=m; i++)
{
if (clatite[i]) cio++;
else
{
j=1;
while (j*j<i) j++;
if (j*j==i) gem++;
else
{
j=1;
while (j*j*j<i) j++;
if (j*j*j==i) gem++;
else
{
ci=i;
d=2;
p=0;
sd=1;num=0;
while (d*d<=ci && ci!=1)
{
p=0;num=d;
while (ci%d==0)
{
ci/=d;
num*=d;
p++;
}
if (p!=0) sd=sd*((num-1)/(d-1));
d++;
}
if (ci!=1) sd=sd*((ci*ci-1)/(ci-1));
sd-=i;
if (sd==i) ing++;
else {
if (i%2==0) zah++;
else sim++;
}
}
}
}
}
g<<cio<<" "<<gem<<" "<<ing<<" "<<zah<<" "<<sim;
return 0;
}

# data[].attributes.body
# include <iostream>
using namespace std;
int n, s, c, sum = 0, nc = 0, c1 = 0, c3 = 0, c5 = 0, c7 = 0, c9 = 0, i, d;
int main()
{
    cin >> n >> c;
    for(i = 1; i <= n ; i ++)
    {
        cin >> s;
        if(s % 10 == 1)
            c1 ++;
        if(s % 10 == 3)
            c3 ++;
        if(s % 10 == 5)
            c5 ++;
        if(s % 10 == 7)
            c7 ++;
        if(s % 10 == 9)
            c9 ++;
        bool prim = true;
        if(s < 2)
            prim = false;
        for(d = 2 ; d * d <= s && prim ;d ++)
            if(s % d == 0)
                prim = false;
        if(prim)
            sum += s;
        while(s)
        {
            if(s % 10 == c)
                nc ++;
            s /= 10;
        }
    }
    cout << sum << endl << nc << endl;
    int d = 1,j;
    for(j = 1 ; j <= n ; j++)
        if(c1 % j == 0 && c3 % j == 0 && c5 % j == 0 && c7 % j == 0 && c9 % j == 0)
            d = j;
    cout << (c1 + c3 + c5 + c7 + c9)/d << endl;
    return 0;
}

# data[].attributes.body
#include <fstream>
using namespace std;
ifstream fin("divk.in");
ofstream fout("divk.out");
long long n,x,k,nr,aux,i,d;
int main()
{

    fin>>n>>k;
    for(i=1;i<=n;i++)
    {
        fin>>x;
        nr=0;
        aux=x;
        for(d=1;d*d<=x;d++)
        {
            if(x%d==0) nr+=2;
            if(d*d==x) nr--;
        }
        if(nr>=k) fout<<aux<<" ";
    }
    return 0;
}

# data[].attributes.body
GRUPA 6
#971 Max

#include <iostream>

using namespace std;
int n,d,x,nrdiv,i,nec,ok;
int main()
{
    cin>>n;
    for (i=1;i<=n;i++)
    {
        cin>>x;
        nrdiv=1;
        for (d=2;d*d<x;d++)
            if (x%d==0) nrdiv+=2;
        if (d*d==x) nrdiv++;
        if (x!=1) nrdiv++;
        if (nrdiv%2==0 && nrdiv!=2) nec=nec+x;
        else if (nrdiv%2==1 && nrdiv!=2) nec=nec+(x*3);
    }
    cout<<nec<<'\n';
    return 0;
}
#1426 Pozne
#include <bits/stdc++.h>
using namespace std;
int task, n, s, c, x;
void task_1()
{
    bool ok = false;
    for (int i=1;i<=n;i++){
        scanf("%d", &x);
        ok = false;
        int cx = x;
        while(cx){
            if (cx%10 == c){
                ok = true;
                break;
            }
            cx /= 10;
        }
        if (ok)
            printf("%d ", x);
    }
    printf("\n");
}
void task_2()
{
    bool ok = false, ok1 = true;
    int d, cred = 0;
    long long sum = 0;
    for (int i=1;i<=n;i++){
        scanf("%d", &x);
        int inv = 0, cx = x;
        ok = false;
        while(x){
            if (x%10 == c){
                ok = true;
            }
            inv = inv*10 + x%10;
            x /= 10;
        }
            ok1 = true;
            for (d = 2; d * d <= inv; d++) {
                if (inv % d == 0) {
                    ok1 = false;
                    break;
                }
            }
            if (d * d == inv)
                ok1 = false;
            if (ok1 && ok){
                sum += (cx-s);
                cred ++;
            }else if (ok1){
                sum += (cx+s);
                cred ++;
            }
    }
    printf("%d ", cred);
    if (sum > 0){
        printf("%d\n", 1);
    }else if (sum == 0){
        printf("%d\n", 0);
    }else{
        printf("%d\n", -1);
    }
}
int main() {
    freopen("pozne.in", "r", stdin);
    freopen("pozne.out", "w", stdout);

    scanf("%d", &task);
    scanf("%d%d%d", &n, &s, &c);

    if (task == 1){
        task_1();
    }else {
        task_2();
    }
    return 0;
}

# data[].attributes.body
#404
#include <iostream>
using namespace std;
int main()
{
int n,i,nr,sum=0,j;
bool prim=true;
cin>>n;
for(i=1;i<=n;++i)
{    cin>>nr;
prim=true;
for(j=2;j*j<=nr;j++)
if(nr%j==0)prim=false;
if(prim)
{        while(nr)
{            sum++;
nr/=10;        }    }
}cout<<sum;
return 0;}

#439
#include <bits/stdc++.h>

using namespace std;

long long n,nr5,nr2;

int main()

{

cin>>n;

for(int i=5;i<=n;i *=5) nr5 += n/i;

for(int i=2;i<=n;i *=2) nr2 += n/i;

if(nr5<=nr2) cout<<nr5;

else cout<<nr2;

return 0;

}

# data[].attributes.body
#258
#include <iostream>

#include <cmath>

using namespace std;

int n,i,d,MIN=9999999999,ok,cnt=0,x,d1,a,b;

int main()

{

cin>>a>>b;

int c=a+b;

for(i=a;i<=b;i++)

{

ok=1;

for(d=2;d*d<=i;d++)

{if(i%d==0) ok=0;}

if(ok)

{if(MIN>abs(c-2*i))

{d1=i;

MIN=abs(c-2*i);}

cnt++;

} }

if(cnt==0) cout<<"NU EXISTA";

else cout<<d1;

return 0;

}
#3354
#include <iostream>

using namespace std;

long long n,i,d,maxi=0,ok,x1,x,d1;

int main()

{

cin>>n;

for(i=1; i<=n; i++)

{

cin>>x;

x1=x;

if(x!=1)

{

for(d=2; d<=x; d++)

{

if(x%d==0)

{

while (x%d==0) x=x/d;

if(x==1)

{

if(maxi<x1)maxi=x1;

break;

}

else   break;

}

}

}

}

if(maxi==0) cout<<"NU EXISTA";

else cout<<maxi;

return 0;

}

# data[].attributes.body
#1422

#include <bits/stdc++.h>
using namespace std;
ifstream fin("ograda.in");
ofstream fout("ograda.out");
int par(int n)
{ int cnt=0;
for(unsigned long long i=1;i<=n;++i)
{ if(n%i==0 && i%2==0)
cnt++;
}
return cnt;
}
int impar(int n)
{ int cnt=0;
for( unsigned long long i=1;i<=n;++i)
{ if(n%i==0 && i%2==1)
cnt++;
} return cnt;
}
int main()
{ unsigned long long c,p,g,v,cntc=0,cntp=0,x; fin>>x>>c>>p;
g=(c4-p)/2; v=(p-c2)/2; if(x==1)fout<<g<<" "<<v;
else if(x==2)
{ fout<<impar(c)<<" "<<par(p); } return 0;
}

#63
#include <iostream>
using namespace std;
int n,d=2,p,maxim=0,dmax=0;
int main()
{cin >> n;
while(n>1)
{ p=0;
while(n%d==0)
{p++;
n/=d;
}
if(p>0)
{if(p>=maxim && d>dmax)
maxim=p , dmax=d;
}
d++;
if(d*d>n)
d=n;
}
cout << dmax;
return 0;
}
#18
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("nrdiv.in");
ofstream g("nrdiv.out");
int n,nrd,d;
int main()
{
f>>n;
for(d=1; d<=n/2;d++)
if(n%d==0)nrd++;
nrd=nrd+1;
g<<nrd;
return 0;
}

# data[].attributes.body
#2547
#include <iostream>
#include <cmath>
using namespace std;
bool prim(int n)
{
if(n == 1 || n == 0)
return 0;
if(n > 2 && n % 2 == 0)
return 0;
for(int i = 3 ; i * i <= n ; ++i)
if(n % i == 0)
return 0;
return 1;
}
int main()
{
int a , b;
cin >> a >> b;
int x = sqrt(a) , y = sqrt(b);
int  cnt=0;
if(x * x == a)
x--;
for(int i = x + 1 ; i <= y ; ++i)
{
if(prim(i))
cnt++;
}
cout << cnt;
return 0;
}
#2608

#include<iostream>
using namespace std;
int long long n,m,i;
    int main()
{cin>>n>>m;
 if(n%2==0)cout<<2<<" "<<n/2;
 else{ for(i=3;i*i<=n;i=i+2)
  if(n%i==0)cout<<i<<" "<<n/i;
     }
 return 0;
}

# data[].attributes.body
Stefania

# data[].attributes.body
#18
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("nrdiv.in");
ofstream g("nrdiv.out");
int n,nrd,d;
int main()
{
f>>n;
for(d=1; d<=n/2;d++)
if(n%d==0)nrd++;
nrd=nrd+1;
g<<nrd;
return 0;
}
#63
#include <iostream>
using namespace std;
int n,d=2,p,maxim=0,dmax=0;
int main()
{cin >> n;
while(n>1)
{ p=0;
while(n%d==0)
{p++;
n/=d;
}
if(p>0)
{if(p>=maxim && d>dmax)
maxim=p , dmax=d;
}
d++;
if(d*d>n)
d=n;
}
cout << dmax;
return 0;
}

# data[].attributes.body
#380
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int nr=0;
    for(int i=1;i<=n;i++){
        int x;
        cin>>x;
        int d=2;
        int c=1;
        while(x>1){
            int p=0;
            while(x%d==0)
                p++, x/=d;
            d++;
            c=c*(p+1);
            if(d*d>x)
                d=x;
        }
        if(c==4)
            nr++;
    }
    cout <<nr;
    return 0;
}
#2323
#include <iostream>

using namespace std;
long long n,nr=1;
int main()
{ cin>>n;
    long long cn=n;
    long long d=2;
while(n>1)
{
    int p=0;
    while(n%d==0) p++,n=n/d;
    nr*=(cn*p+1);
    d++;
    if(d*d>n) d=n;
    while(nr>=59999)
        nr=nr%59999;
}
    cout << nr;
    return 0;
}

# data[].attributes.body
#307 zerouri1

#include <iostream>

using namespace std;

int main()
{
    int n,x,nr2 = 0,nr5 = 0;
    cin >> n;
    long long produs = 1;
    for(; n; --n)
    {
        cin >> x;
        while(x % 2 == 0)
        {
            x /= 2;
            nr2++;
        }
        while(x % 5 == 0)
        {
            x /= 5;
            nr5++;
        }
        produs *= (x % 10);
        produs %= 10;
    }
    produs %= 10;
    if(nr2 > nr5)
    {
        nr2 -= nr5;
        switch(nr2 % 4)
        {
            case 1:
                produs <<= 1;
                break;
            case 2:
                produs <<= 2;
                break;
            case 3:
                produs <<= 3;
                break;
            case 0:
                produs <<= 4;
                break;
        }
    }
    else if(nr5 > nr2)
    {
        produs *= 5;
    }
    produs %= 10;
    cout << produs;
    return 0;
}
#440 factzero1
#include <iostream>

using namespace std;

int main()
{
    int n,cn;
    int nr2 = 0,nr5 = 0;
    long long produs = 1;
    cin >> n;
    for(; n; --n)
    {
        cn = n;
        while(!(cn % 2))
        {
            cn >>= 1;
            ++nr2;
        }
        while(!(cn % 5))
        {
            cn /= 5;
            ++nr5;
        }
        produs *= (cn % 10);
        produs %= 10;
    }
    if(nr2 > nr5)
    {
        nr2 -= nr5;
        switch(nr2 % 4)
        {
            case 1:
                produs <<= 1;
                break;
            case 2:
                produs <<= 2;
                break;
            case 3:
                produs <<= 3;
                break;
            case 0:
                produs <<= 4;
                break;
        }
    }
    else if(nr5 > nr2)
    {
        produs *= 5;
    }
    produs %= 10;
    cout << produs;
    return 0;
}

# data[].attributes.body
#1780

#include <iostream>

using namespace std;

int main()

{

int n, m, x=0, num;

cin >> n >> m;

num=m;

while (num<=n)

{   x=x+n/num;

num*=m;

}

cout << x;

}

#2769

#include <bits/stdc++.h>

using namespace std;

int main()

{

long long int x , y , n , m , p , q;

cin >> x >> y;

int d = 2;

while(x % d) d++;

n=x/d;

m=y/(d-1);

long long int delta = (n+1-m) * (n+1-m) - 4*n;

long long int r = sqrt(delta);

p = (n + 1 - m - r) / 2;

q = (n + 1 - m + r) / 2;

cout << d << ' ' << p << ' ' << q;

return 0;

}

# data[].attributes.body
#include <iostream>
using namespace std;

bool ok(int n){
int d = 2, cnt = 0;
while(n > 1){
int p = 0;
while(n % d == 0)
n/=d, p++;
if(p)
cnt++;
d++;
if(d * d > n)
d = n;
}
return cnt == 1;
}

int main(){
int n, x, mini = 1000000000;
cin >> n;
for(int i = 1; i <= n; ++i){
cin >> x;
if(ok(x) && x < mini)
mini = x;
}
if(mini < 1000000000)
cout << mini;
else
cout << "NU EXISTA";
return 0;
} 3355

# data[].attributes.body
#1409
#include <bits/stdc++.h>
using namespace std;
int cmmdp(int x)
{
int divizor = 0;
for (int d=2;d*d<=x;d++){
if (x%d == 0){
divizor = d;
while(x%d == 0){
x/=d;
}
}
}
if (x>1)
divizor = x;
return divizor;
}
int main()
{
int n,x,i;
long long S = 0;
cin>>n;
for(i=0;i<n;i++)
{
cin>>x;
S=S+cmmdp(x);
}
cout<<S<<endl;
return 0;
}
#3353

#include <iostream>
using namespace std;

long long desc(long long n)
{
long long prod=1;
long long d=2;
while(n>1){
int p=0;
while(n%d==0)
n/=d,p++;
if(p)
prod*= d;
d++;
if(d*d>n)
d=n;
}
return prod;
}
int main()
{
long long a,b;
cin>>a>>b;
long long prod1=desc(a);
long long prod2=desc(b);
if(prod1>prod2)
cout<<a;

else if(prod1 == prod2)

cout<<min(a, b);
else
cout<<b;
return 0;
}

# data[].attributes.body
Andrei Georgescu

# data[].attributes.body
#include <iostream>
using namespace std;

int main()
{
long long n,s=0,d=2;
cin>>n;
while(n>1)
{
int p=0;
while(n%d==0)
{
n/=d;
p++;
}
if(p>0)
{
s+=d;
}
d++;
if(d*d>n)
d=n;
}
cout<<s;
return 0;
}

#include <iostream>
using namespace std;

int nrdiv(int x)
{
int d=2, p=0;
int cnt=0;
while(x>1)
{
p=0;
while(x%d==0)
{
p++;
x/=d;
}
if(p>0)
cnt++;
d++;
if(d*d>x)
d=x;
}
return cnt;
}

int main()
{
int a, b;
cin>>a;
int max=nrdiv(a) , nmax=a;
while(1)
{
cin >> b;
if(a==b)
break;
if(nrdiv(b) > max)
max=nrdiv(b) , nmax=b;
else
if(nrdiv(b) == max)
if(b > nmax)
nmax = b;
a=b;
}
cout << nmax << ' ' << max;
return 0;
}

# data[].attributes.body
2821

#include <iostream>

using namespace std;

int main()

{

int n;

cin>>n;

int m=1,d=2;

while(n>1)

{

int p=0;

while(n%d==0)

{

n/=d;

p++;

}

if(p!=0)m=m*d;

d++;

if(d*d>n)d=n;

}

cout<<m;

return 0;

}

379

#include <iostream>

using namespace std;

int n,d,i,x,cn,ok,e,s;

int main()

{

cin>>n;

cn=n;

d=2;

ok=1;

while (ok&&cn>1)

{

e=0;

while (cn%d==0)

{

cn=cn/d;

e++;

}

if(e>1) ok=0;

else if(e==1)

{

s++;

}

if(s>2) ok=0;

d++;

}

if(ok) cout<<"DA";

else cout<<"NU";

return 0;

}

# data[].attributes.body
1437

#include <bits/stdc++.h>

using namespace std;
ifstream fin("fractii4.in");
ofstream fout("fractii4.out");
int P,N,x,y,schimb;
int cmmdc(int a,int b)
{
if(b==0)return a;
else return cmmdc(b,a%b);
}
int main()
{
fin>>P>>N;
if(P==1)
{{
for(int i=1;i<=N;++i)
{
fin>>x>>y;
int nr=0,div=cmmdc(x,y);
for(int j=1;j*j<=div;j++)
{
if(div%j==0)nr+=2;
if(j*j==div)nr--;
}nr--;
if(nr)fout<<nr<<'\n';
else fout<<"-1"<<'\n';
}
}
return 0;
}
for(int i=1;i<=N;++i)
{
fin>>x>>y;
int div=cmmdc(x,y);
fout<<x/div<<'/'<<y/div<<'\n';
}
return 0;
}
---------------------------------------------------------------
2697

#include <bits/stdc++.h>

using namespace std;
int n;
long long x;
int main()
{
cin>>n;
for(int i=1;i<=n;++i)
{
cin>>x;
while(x%2==0)
{
x/=2;
}
cout<<x<<' ';
}
return 0;
}

# data[].attributes.body
#306
#include <iostream>

using namespace std;
int n,i,a,exp2,exp5;
int main()
{   cin>>n;
for(i=1;i<=n;i++)
{
cin>>a;
while(a%2==0)
{
exp2++;
a=a/2;
}
while(a%5==0)
{
exp5++;
a=a/5;
}
}
cout<<min(exp2,exp5);
return 0;
}
#111

#include <iostream>

using namespace std;
int n,i,x,x1,nr,rez=0,Max=0,d=2,P=0;
int main()
{   cin>>n;
    rez=0;
    Max=0;
    for(i=1;i<=n;i++)
    {
        cin>>x;
        x1=x;
        nr=0;
        d=2;
        while(x>1)
        {
            P=0;
            while(x%d==0)
                {
                    P++;
                    x=x/d;
                }
            if(P) nr++;
            d++;
            if(d*d>x) d=x;
        }
        if(nr>Max)
            {
                Max=nr;
                rez=x1;
            }
        else if(nr==Max && x1<rez)
            rez=x1;
    }
    cout<<rez;
    return 0;
}

# data[].attributes.body
problema 3459-50 pct
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("countprime.in");
ofstream fout("countprime.out");
int main()
{
    int st,dr,cnt,i,ok,d;
    fin>>st>>dr;
    cnt=0;
    if(st<=dr)
    {for(i=st;i<=dr;i++)
    {
        ok=1;
        if(i<2) ok=0;
        for(d=2;d*d<=i;d++)
        {
            if(i%d==0)
            {
                ok=0;break;
            }
        }
        if(ok) cnt=cnt+1;
    }}
    else
        {for(i=dr;i<=st;i++)
    {
        ok=1;
        if(i<2) ok=0;
        for(d=2;d*d<=i;d++)
        {
            if(i%d==0)
            {
                ok=0;break;
            }
        }
        if(ok) cnt=cnt+1;
    }}
    fout<<cnt;
    return 0;
}

problema 62-100 pct
#include <iostream>

using namespace std;

int main()
{
    int n,f,p;
    cin>>n;
    f=2;
    while(n>1 && f*f<=n)
    {
        p=0;
        while(n%f==0)
        {
            n=n/f;
            p++;
        }
        if(p) cout<<f<<" "<<p<<endl;
        f++;
    }
    if(n>1) cout <<n<<" "<<1<< endl;
    return 0;
}