trackjobs用のc++入力プログラム

初見の際に< bits/stdc++.h >が使えなかったり、入力の終わりが分からないため受け取りを作るのに時間を持ってかれたatcoderとかの競プロ勢に捧ぐ

trackjobs用のc++入力プログラム
```
#include <iostream>
#include <fstream>
#include <sstream>

#include <string>
#include <vector>

using namespace std;


#define rep(i,a,x) for(int i=(a);i<(int)(x);i++)
#define all(x) (x).begin(),(x).end()
#define ll long long

int main(int argc, char *argv[]) {
  string line;
  vector<int> vv;
  while (!cin.eof()) {
    string s;
    getline(cin, s);
    stringstream ss(s);
    while (getline(ss, s, ' ')){
      int xx=atoi(s.c_str());
      vv.push_back(xx);
    }
  }
  rep(i,0,vv.size())cout<<vv[i]<<" ";
  return 0;
}
```
for抜き、関数化
```
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

void input_data(vector<int> &inputed_data){
  while (!cin.eof()) {
    string s;
    getline(cin, s);
    stringstream ss(s);
    while (getline(ss, s, ' ')){
      int xx=atoi(s.c_str());
      inputed_data.push_back(xx);
    }
  }
}

int main(int argc, char *argv[]) {
  vector<int> inputed_data;
  input_data(inputed_data);
  for(int i=0;i<inputed_data.size();i++)cout<<inputed_data[i]<<" ";
  
  
  
  return 0;
}
```

こっちは間に「:」とか「,」とか「　」があったり、stringに対応する時用

```
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <vector>
using namespace std;


#define rep(i,a,x) for(int i=(a);i<(int)(x);i++)
#define all(x) (x).begin(),(x).end()
#define ll long long

vector<string> split(string& input, char delimiter){
    istringstream stream(input);
    string field;
    vector<string> result;
    while (getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}


int main(int argc, char *argv[]) {
  vector<string> vv;
  while (!cin.eof()) {
    string s;
    getline(cin, s);
    stringstream ss(s);
    while (getline(ss, s, ' ')){
      //int xx=atoi(s.c_str());
      vv.push_back(s);
    }
  }
  //rep(i,0,vv.size())cout<<vv[i]<<endl;

  //------------------------
  //------------------------

  ll n=stol(vv[vv.size()-1]);
  ll m=vv.size()-1;

  vector<ll> a;
  vector<string> s;
  rep(i,0,vv.size()-1){
    vector<string> strvec = split(vv[i], ':');
    for (int j=0; j<2;j++){
        //cout<<strvec[j]<<" ";
        if(j==0)a.push_back(stol(strvec[j]));
        if(j==1)s.push_back(strvec[j]);
    }
  }
  cout<<n<<" "<<m<<endl;
  rep(i,0,m)cout<<a[i]<<" "<<s[i]<<endl;

  //--------------------
  //--------------------
  return 0;
}

```


任意のfizzbuzz
```
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <vector>
#include <utility>
using namespace std;


#define rep(i,a,x) for(int i=(a);i<(int)(x);i++)
#define all(x) (x).begin(),(x).end()
#define ll long long

vector<string> split(string& input, char delimiter){
    istringstream stream(input);
    string field;
    vector<string> result;
    while (getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}


int main(int argc, char *argv[]) {
  //--------------
  //--------------入力受け取り
  vector<string> vv;
  while (!cin.eof()) {
    string s;
    getline(cin, s);
    stringstream ss(s);
    while (getline(ss, s, ' ')){
      //int xx=atoi(s.c_str());
      vv.push_back(s);
    }
  }
  //rep(i,0,vv.size())cout<<vv[i]<<" ";cout<<endl;

  //------------------------
  //------------------------入力ルールへの成型
  ll m=stol(vv[vv.size()-1]);

  vector<ll> a;
  vector<string> s;
  rep(i,0,vv.size()-1){
    vector<string> strvec = split(vv[i], ':');
    for (int j=0; j<2;j++){
        //cout<<strvec[j]<<" ";
        if(j==0)a.push_back(stol(strvec[j]));
        if(j==1)s.push_back(strvec[j]);
    }
  }
  //cout<<m<<endl;
  //rep(i,0,a.size())cout<<a[i]<<" "<<s[i]<<endl;

  //--------------------
  //--------------------解く
  vector<pair<int,string>> as;
  rep(i,0,a.size())as.push_back({a[i],s[i]});
  sort(all(as));

  auto FizzBuzz = [&](auto FizzBuzz, int v) -> string {
    string tmp="";
    rep(i,0,as.size()){
      if(v%as[i].first==0)tmp+=as[i].second;
    }
    if(tmp=="")tmp+=to_string(v);
    return tmp;
  };
  
  cout<< FizzBuzz(FizzBuzz,m) <<endl;

  return 0;
}

```