Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e52d85d

Browse files
fixes existing script and adds a setup script
1 parent 725a5cb commit e52d85d

File tree

2 files changed

+120
-2
lines changed

2 files changed

+120
-2
lines changed

‎scripts/makeCpp.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ int main(){
9292
9393
9494
#ifndef ONLINE_JUDGE
95-
freopen("../input.txt", "r", stdin);
96-
freopen("../output.txt", "w", stdout);
95+
freopen("./outputs/input.txt", "r", stdin);
96+
freopen("./outputs/output.txt", "w", stdout);
9797
#endif
9898
9999
// int t; cin>>t;while(t--)

‎scripts/setupCpp.sh

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#!/bin/bash
2+
3+
echo "Please enter the name of the Cpp file (without extension):"
4+
5+
name="a.cpp"
6+
7+
# Create the outputs directory if it doesn't exist
8+
mkdir -p outputs
9+
10+
# Create the C++ file if it doesn't exist
11+
if [ -f "$name" ]; then
12+
echo "File already exists!"
13+
else
14+
cat <<EOL > "$name"
15+
#include<bits/stdc++.h>
16+
17+
using namespace std;
18+
19+
// Type definitions
20+
typedef long long ll;
21+
typedef long double ld;
22+
typedef pair<int, int> pii;
23+
typedef pair<ll, ll> pll;
24+
typedef vector<int> vi;
25+
typedef vector<ll> vl;
26+
typedef vector<pii> vpii;
27+
typedef vector<pll> vpll;
28+
typedef vector<vi> vvi;
29+
typedef vector<vl> vvl;
30+
31+
//Macros
32+
#define nline "\\n"
33+
#define all(x) (x).begin(), (x).end()
34+
#define rall(x) (x).rbegin(), (x).rend()
35+
#define sz(x) (int)(x).size()
36+
#define pb push_back
37+
#define mp make_pair
38+
#define F first
39+
#define S second
40+
#define forn(i, n) for(int i = 0; i < int(n); i++)
41+
#define forr(i, a, b) for(int i = a; i <= b; i++)
42+
#define ford(i, a, b) for(int i = a; i >= b; i--)
43+
#define elasped_time 1.0 * clock() / CLOCKS_PER_SEC
44+
45+
// Constants
46+
const int MOD = 1e9 + 7;
47+
const ll INF = 1e18;
48+
const double EPS = 1e-9;
49+
const double PI = acos(-1);
50+
51+
ll mod_add(ll a, ll b, ll m = MOD) { return ((a % m) + (b % m)) % m; }
52+
ll mod_sub(ll a, ll b, ll m = MOD) { return ((a % m) - (b % m) + m) % m; }
53+
ll mod_mul(ll a, ll b, ll m = MOD) { return ((a % m) * (b % m)) % m; }
54+
55+
ll mod_pow(ll base, ll exp, ll m = MOD) {
56+
ll res = 1;
57+
base %= m;
58+
while (exp > 0) {
59+
if (exp & 1) res = mod_mul(res, base, m);
60+
base = mod_mul(base, base, m);
61+
exp >>= 1;
62+
}
63+
return res;
64+
}
65+
66+
ll mod_inv(ll a, ll m = MOD) {
67+
return mod_pow(a, m - 2, m); // Only works if m is prime
68+
}
69+
70+
ll mod_div(ll a, ll b, ll m = MOD) {
71+
return mod_mul(a, mod_inv(b, m), m);
72+
}
73+
74+
// Binary exponentiation (for non-modular calculations)
75+
ll binpow(ll base, ll exp) {
76+
ll res = 1;
77+
while (exp > 0) {
78+
if (exp & 1) res *= base;
79+
base *= base;
80+
exp >>= 1;
81+
}
82+
return res;
83+
}
84+
85+
void solve(){
86+
87+
}
88+
89+
int main(){
90+
91+
ios_base::sync_with_stdio(0);
92+
cin.tie(0);
93+
cout.tie(0);
94+
95+
#ifndef ONLINE_JUDGE
96+
freopen("./outputs/input.txt", "r", stdin);
97+
freopen("./outputs/output.txt", "w", stdout);
98+
#endif
99+
100+
// int t; cin>>t;while(t--)
101+
// solve();
102+
103+
return 0;
104+
}
105+
106+
// Explanation
107+
/*
108+
109+
*/
110+
EOL
111+
fi
112+
113+
# Create input and output text files
114+
touch outputs/input.txt
115+
touch outputs/output.txt
116+
117+
# Open the C++ file in VS Code
118+
code ./"$name"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /