#include<bits/stdc++.h>usingnamespace std;int n, x;char c;voidprint(int i){for(int j =0; j < x - i;++j)putchar(' ');for(int j =2* i -1; j >=1;--j)putchar(c);putchar('\n');}intmain(){
cin >> n >> c;while(++x){if(2*(x * x)-1> n){--x;break;}}for(int i = x; i >=1;--i)print(i);for(int i =2; i <= x;++i)print(i);
cout << n -2*(x * x)+1;return0;}
#include<bits/stdc++.h>usingnamespace std;int n, a, b;
string s;
map<int, pair<string,int>>mp;intmain(){
cin >> n;for(int i =0; i < n;++i){
cin >> s >> a >> b;
mp.insert({a,{s, b}});}
cin >> n;while(n--){
cin >> a;
cout << mp[a].first <<" "<< mp[a].second << endl;}return0;}
#include<bits/stdc++.h>usingnamespace std;longlong n, maxx, flag;intmain(){
cin >> n;for(int i =2; i <=sqrt(n);++i){if(n % i)continue;longlong now = n, check =0, j = i;while(!(now % j)){
now /= j,++check,++j;}if(check > maxx) maxx = check, flag = i;}if(maxx){
cout << maxx << endl ;for(int i =0; i < maxx;++i){
cout <<(i ?"*":"")<< flag + i;}}else{
cout <<1<< endl << n;}return0;}
#include<bits/stdc++.h>usingnamespace std;
unordered_map<char, string>mp{{'-',"fu"},{'0',"ling"},{'1',"yi"},{'2',"er"},{'3',"san"},{'4',"si"},{'5',"wu"},{'6',"liu"},{'7',"qi"},{'8',"ba"},{'9',"jiu"}};
string s;intmain(){
cin >> s;for(int i =0; i < s.length();++i){
cout << mp[s[i]]<<" \n"[i == s.length()-1];}return0;}
#include<bits/stdc++.h>usingnamespace std;int a, b, sum, cnt =1;intmain(){
cin >> a >> b;for(int i = a; i <= b;++i,++cnt){
sum += i;
cout <<setw(5)<< i;if(!(cnt %5)) cout << endl;}if(--cnt %5) cout << endl;
cout <<"Sum = "<< sum;return0;}
#include<bits/stdc++.h>usingnamespace std;int n, m, s, d, u, v, w;structnode{int to, value;booloperator<(const node A)const{return value > A.value;}};int person[505], res[505], pre[505], dis[505], vis[505], sum[505];
vector<node> road[505];
priority_queue<node> Q;voidprint(int x){if(x == s){
cout << s;return;}print(pre[x]), cout <<" "<< x;}intmain(){
cin >> n >> m >> s >> d;for(int i =0; i < n;++i){
cin >> person[i];}while(m--){
cin >> u >> v >> w;
road[u].push_back({v, w}), road[v].push_back({u, w});}memset(dis,0x3f3f3f,sizeof(dis));
dis[s]=0, res[s]=1, pre[s]=-1, sum[s]= person[s], Q.push({s,0});while(!Q.empty()){auto[nx, nv]= Q.top();
Q.pop();if(vis[nx])continue;
vis[nx]=true;for(auto&[to, value]: road[nx]){if(dis[nx]+ value < dis[to]){
dis[to]= dis[nx]+ value, pre[to]= nx, res[to]= res[nx], sum[to]= sum[nx]+ person[to], Q.push({to, dis[to]});}elseif(dis[nx]+ value == dis[to]){if(sum[nx]+ person[to]> sum[to]){
sum[to]= sum[nx]+ person[to], pre[to]= nx;}
res[to]+= res[nx];}}}
cout << res[d]<<" "<< sum[d]<< endl,print(d);return0;}
#include<bits/stdc++.h>usingnamespace std;
string now;int n, cnt, check_cnt;constint N =1e5+5;structNode{
string address, next;int value;}p[N], node, q[N];bool a[N];
map<string, pair<int, string>> mp;
unordered_map<int,int> check;intmain(){
cin >> now >> n;for(int i =0; i < n ;++i){
cin >> node.address >> node.value >> node.next;
mp.insert({node.address,{node.value, node.next}});}while(now !="-1"){
p[cnt].address = now, p[cnt].value = mp[now].first,++check[fabs(p[cnt].value)];if(check[fabs(p[cnt].value)]>1){
a[cnt]=true, q[check_cnt++]= p[cnt];}
p[cnt].next = mp[now].second, now = p[cnt++].next;}for(int i =0; i < cnt;++i){
cout << p[i].address <<" "<< p[i].value <<" ";if(i +1< cnt && a[i +1]){while(++i && i < cnt)if(!a[i +1])break;
cout << p[i].next << endl;}else{
cout << p[i].next << endl;}}if(check_cnt){for(int i =0; i < check_cnt -1;++i){
cout << q[i].address <<" "<< q[i].value <<" "<< q[i +1].address << endl;}
cout << q[check_cnt -1].address <<" "<< q[check_cnt -1].value <<" -1";}return0;}
#include<bits/stdc++.h>usingnamespace std;structNode{double a, b;} p[1005];int n;double ans, d;intmain(){
cin >> n >> d;for(int i =0; i < n;++i){
cin >> p[i].a;}for(int i =0; i < n;++i){
cin >> p[i].b;}sort(p, p + n,[](Node x, Node y){return x.b / x.a > y.b / y.a;});for(int i =0; i < n;++i){if(p[i].a < d){
d -= p[i].a, ans += p[i].b;}else{
ans +=(p[i].b / p[i].a)* d;break;}}printf("%.2f", ans);return0;}