A - Exact Price

#include<bits/stdc++.h>
using namespace std;

int main(){
   
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    if(n==0||n % 100)
        cout << "No";

    else
        cout << "Yes";
    return 0;
}

B - String Shifting

#include<bits/stdc++.h>
using namespace std;
int main()
{
   
   string s;
   cin>>s;
   int n=s.size();
   string min1=s,max1=s;
   s=s+s;
   for(int i=0;i<n;i++)
   {
   
     min1=min(min1,s.substr(i,n));
     max1=max(max1,s.substr(i,n));
   }
   cout<<min1<<"\n";
   cout<<max1<<"\n";
}

C - Doukasen

#include <bits/stdc++.h>
using namespace std;

int main() {
   
    int n;
    cin >> n;
    vector<double> a(n), b(n);
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    double t = 0, ans = 0;
    for(int i = 0; i < n; i++) t += a[i] / b[i];
    t /= 2;
    for(int i = 0; i < n; i++){
   
        ans += min(a[i], t * b[i]);
        t -= min(a[i]/b[i], t);
    }
    cout << ans << endl;
}


D - Restricted Permutation

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
 
int main() {
   
    int n, m;
    cin >> n >> m;
    vector<int> in(n);
    vector to(n, vector<int>());
    rep(i, m) {
   
        int a, b;
        cin >> a >> b;
        a--, b--;
        in[b]++;
        to[a].push_back(b);
    }
    priority_queue<int, vector<int>, greater<int>> pq;
    rep(i, n) if (in[i] == 0) pq.push(i);
    vector<int> ans;
    while (pq.size()) {
   
        int v = pq.top(); pq.pop();
        ans.push_back(v);
        for (auto u : to[v]) {
   
            in[u]--;
            if (in[u] == 0) pq.push(u);
        }
    }
    if (ans.size() != n) {
   
        cout << - 1 << endl;
        return 0;
    }
    rep(i, n) {
   
        if (i) cout << " ";
        cout << ans[i] + 1;
    }
    cout << endl;
}
#include <bits/stdc++.h>
using namespace std;
int n,m,now[200020],to,tot,tp,a,b;
int head[200020],nxt[200020],ver[200020],in[200020];
void add(int x,int y){
   
	ver[++tot]=y;
	nxt[tot]=head[x];
	head[x]=tot;
}
priority_queue<int,vector<int>,greater<int> > q;
int main(){
   
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;++i){
   
		scanf("%d%d",&a,&b);
		add(a,b);
		++in[b];
	}
	for(int i=1;i<=n;++i) if(!in[i]) q.push(i);
	if(!q.size()) return printf("-1\n")*0;
	while(q.size()){
   
		now[++tp]=q.top();q.pop();
		for(int i=head[now[tp]];i;i=nxt[i]){
   
			to=ver[i];
			--in[to];
			if(!in[to]) q.push(to);
		}
	}
	if(tp<n) return printf("-1")*0;
	else for(int i=1;i<=n;++i) printf("%d ",now[i]);
	return 0;
}