A

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

int main(){
    int a, b;
    cin >> a >> b;
    printf("%d", int(pow(a, b)));
    
    return 0;
}

B

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

int main(){
    int a, b;
    while(cin >> a >> b){
        if (a <= 0 || b <= 0){
            break;
        }
        if (a > b) swap(a, b);
        int sum = 0;
        for(int i = a; i <= b; i++){
            cout << i << ' ';
            sum += i;
        }
        cout << "Sum=" << sum << endl;
    }
    
    return 0;
}

C

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

int q[300];

int main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i ++) cin >> q[i];
    sort(q, q + n);
    for (int i = 0; i < n; i ++ )cout << q[i] << ' ';
    
    return 0;
}

D

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

int m, q[2000];

int main(){
    cin >> m;
    for(int i = 0; i < m; i ++)cin >> q[i];
    int qmin = 0x3f3f3f3f, idx = 0;
    
    for (int i = 0; i < m; i ++){
        if(q[i] < q[idx]){
            idx = i;
        }
    }
    cout << "Minimum value: " << q[idx] << '\n' << "Position: " << idx << endl;
    
    
    return 0;
}

E

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

int n;

int main()
{
    cin >> n;
    int n_raw = n;
    
    n = max(n, -n);
    
    while(n % 10 == 0 && n != 0) n /= 10;
    
    int s = 0;
    while(n) {
        int x = n % 10;
        s = s * 10 + x;
        n /= 10;
    }
    
    if(n_raw < 0) cout << '-' << s;
    else cout << s;
    
	return 0;
}

F

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

int m, n, q[2000];

int main(){
    cin >> n >> m;
    
    int s = 1;
    for(int i = 1; i <= n * m; i ++, s ++) {
        if(s % m == 0) {
            cout << "PUM\n";
            continue;
        }
        cout << i << ' ';
    }
    
    
    return 0;
}

G

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

int n;

int main(){
    cin >> n;
    
    while(n --){
        int x;
        cin >> x;
        
        int sum = 0;
        for(int i = 1; i * i <= x; i ++) {
            if (x % i == 0) {
                sum += i;
                if(i != x / i && x / i != x) {
                    sum += x / i;
                }
            }
        }
        if(sum == x){
            cout << x << " is perfect\n";
        } else {
            cout << x << " is not perfect\n";
        }
    }
    
    
    return 0;
}

H

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

int n, p;

int main(){
    cin >> n >> p;
    
    int s = 0;
    for(int i = 1; i <= n; i ++){
        int x;
        cin >> x;
        s += x;
        if(s >= p){
            cout << i;
            break;
        }
    }
    if(s < p) cout << "-1";
    
    return 0;
}

I

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

int n, m;
int a[10000 + 10];

int main() {
    cin >> n >> m;
    for (int i = 1; i <= m; i ++) {
        cin >> a[i];
    }
    sort(a + 1, a + m + 1);
    int i = 1;
    for (; i <= m; i ++) {
        if (n < a[i]) {
            break;
        }
        n -= a[i];
    }
    cout << i - 1 << ' ' << n << '\n';

    return 0;
}

J

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

int k;

int main() {
    cin >> k;
    double s = 0;
    for(int i = 1; ; i ++){
        s += 1.0 / i;
        if(s > k){
            cout << i;
            break;
        }
    }

    return 0;
}