#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#define oo 987654321
using namespace std;

int main()
{
    char f[100];
    int st, n[10], mode, cnt = 1, md;
    cout<<"input MODE1 ( 0 = not subtask, 1 = subtask ) : ";
    cin>>md;
    if( md == 0 )
    {
        cout<<"input mode( 0 = in, 1 = out ) : ";
        cin>>mode;
        cout<<"num of data : ";
        cin>>st;
        for(int i = 1 ; i <= st ; i++ )
        {
            if( mode == 0 ) sprintf(f, "ren %02d.txt .%d.in", i, cnt++);
            else sprintf(f, "ren %02d.txt .%d.out", i, cnt++);
            cout<<f<<endl;
            system(f);
        }
        return 0;
    }
    cout<<"input mode( 0 = in, 1 = out ) : ";
    cin>>mode;
    cout<<"input no of sub tasks : ";
    cin>>st;
    for(int i = 1 ; i <= st ; i++ )
    {
        cout<<i<<"th task's data no : ";
        cin>>n[i];
    }
    for(int i = 1 ; i <= st ; i++ )
        for(int j = 1 ; j <= n[i] ; j++)
        {

            if( mode == 0 ) sprintf(f, "ren subtask%d_%02d.txt .%d.in", i, j, cnt++);
            else sprintf(f, "ren subtask%d_%02d.txt .%d.out", i, j, cnt++);
            cout<<f<<endl;
            system(f);
        }
}
