problem_id stringlengths 6 6 | buggy_code stringlengths 8 526k ⌀ | fixed_code stringlengths 12 526k ⌀ | labels listlengths 0 15 ⌀ | buggy_submission_id int64 1 1.54M ⌀ | fixed_submission_id int64 2 1.54M ⌀ | user_id stringlengths 10 10 ⌀ | language stringclasses 9 values |
|---|---|---|---|---|---|---|---|
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
long sum;
cin >> N >> L;
for (int i = 0; i < N; i++) {
}
if (L - 1 > 0) {
sum = L * (N - 1) + (N + 2) * (N - 1) / 2 - (N - 1);
} else {
if (L + N - 1 < 0) {
sum = L * N + (N + 1) * N / 2 - N - (L + N - 1);
// cout << L+N-1 << endl;
// sum = L * N + (N+1)*N/2 - N;
} else {
sum = L * N + (N + 1) * N / 2 - N;
}
}
cout << sum << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
long sum;
cin >> N >> L;
for (int i = 0; i < N; i++) {
}
if (L - 1 >= 0) {
sum = L * (N - 1) + (N + 2) * (N - 1) / 2 - (N - 1);
} else {
if (L + N - 1 < 0) {
sum = L * N + (N + 1) * N / 2 - N - (L + N - 1);
// cout << L+N-1 << endl;
// sum = L * N + (N+1)*N/2 - N;
} else {
sum = L * N + (N + 1) * N / 2 - N;
}
}
cout << sum << endl;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,741 | 803,742 | u771365068 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
int sum;
cin >> N >> L;
for (int i = 0; i < N; i++) {
}
if (L - 1 > 0) {
sum = L * (N - 1) + (N + 2) * (N - 1) / 2 - (N - 1);
} else {
if (L + N - 1 < 0) {
sum = L * N + (N + 1) * N / 2 - N - (L + N - 1);
// cout << L+N-1 << endl;
// sum = L * N + (N+1)*N/2 - N;
} else {
sum = L * N + (N + 1) * N / 2 - N;
}
}
cout << sum << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
long sum;
cin >> N >> L;
for (int i = 0; i < N; i++) {
}
if (L - 1 >= 0) {
sum = L * (N - 1) + (N + 2) * (N - 1) / 2 - (N - 1);
} else {
if (L + N - 1 < 0) {
sum = L * N + (N + 1) * N / 2 - N - (L + N - 1);
// cout << L+N-1 << endl;
// sum = L * N + (N+1)*N/2 - N;
} else {
sum = L * N + (N + 1) * N / 2 - N;
}
}
cout << sum << endl;
}
| [
"variable_declaration.type.primitive.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,743 | 803,742 | u771365068 | cpp |
p02994 | #include <bits/stdc++.h>
#include <sstream>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int ans = 0;
int start = l;
int last = n + l - 1;
if (start < 0 && last > 0) {
ans = (n + 2 * l - 1) * (n) / 2;
} else if (start < 0 && last < 0) {
ans = (n + 2 * l - 2) * (n - 1) / 2; // lastを食べる
} else if (start > 0) {
ans = (n + 2 * l) * (n - 1) / 2; // startをたべる
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
#include <sstream>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int ans = 0;
int start = l;
int last = n + l - 1;
if (start < 0 && last > 0) {
ans = (n + 2 * l - 1) * (n) / 2;
} else if (start < 0 && last <= 0) {
ans = (n + 2 * l - 2) * (n - 1) / 2; // lastを食べる
} else if (start >= 0) {
ans = (n + 2 * l) * (n - 1) / 2; // startをたべる
}
cout << ans << endl;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,748 | 803,749 | u448354193 | cpp |
p02994 | //------------------------------------------
// include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
//------------------------------------------
// typedef
//------------------------------------------
typedef long long LL;
typedef vector<int> VI;
typedef vector<bool> VB;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef vector<VI> VVI;
typedef vector<VB> VVB;
typedef vector<VS> VVS;
typedef vector<VLL> VVLL;
typedef vector<VVI> VVVI;
typedef vector<VVLL> VVVLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<int, string> PIS;
typedef pair<string, int> PSI;
typedef pair<string, string> PSS;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<VPII> VVPII;
typedef vector<VPLL> VVPLL;
typedef vector<VS> VVS;
//------------------------------------------
// comparison
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define CHMIN(a, b) a = min((a), (b))
#define CHMAX(a, b) a = max((a), (b))
#define C_ABS(a, b) ((a) < (b) ? (b) - (a) : (a) - (b))
//------------------------------------------
// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define EACH(i, arr) \
for (typeof((arr).begin()) i = (arr).begin(); i != (arr).end(); ++i)
#define EXIST(str, e) ((str).find(e) != (str).end())
#define COUNT(arr, v) count((arr).begin(), (arr).end(), v)
#define SEARCH(v, w) search((v).begin(), (v).end(), (w).begin(), (w).end())
#define B_SEARCH(arr, v) binary_search((arr).begin(), (arr).end(), v)
#define SORT(c) sort((c).begin(), (c).end())
#define RSORT(c) sort((c).rbegin(), (c).rend())
#define REVERSE(c) reverse((c).begin(), (c).end())
#define ROTATE_LEFT(arr, c) \
rotate((arr).begin(), (arr).begin() + (c), (arr).end())
#define ROTATE_RIGHT(arr, c) \
rotate((arr).rbegin(), (arr).rbegin() + (c), (arr).rend())
#define SUMI(arr) accumulate((arr).begin(), (arr).end(), 0)
#define SUMD(arr) accumulate((arr).begin(), (arr).end(), 0.)
#define SUMLL(arr) accumulate((arr).begin(), (arr).end(), 0LL)
#define SUMS(arr) accumulate((arr).begin(), (arr).end(), string())
#define UB(arr, n) upper_bound((arr).begin(), (arr).end(), n)
#define LB(arr, n) lower_bound((arr).begin(), (arr).end(), n)
#define OF_ALL(arr, func) all_of((arr).begin(), (arr).end(), (func))
#define OF_NONE(arr, func) none_of((arr).begin(), (arr).end(), (func))
#define OF_ANY(arr, func) any_of((arr).begin(), (arr).end(), (func))
#define PB push_back
#define MP make_pair
//------------------------------------------
// input output
//------------------------------------------
#define GL(s) getline(cin, (s))
#define INIT() \
std::ios::sync_with_stdio(false); \
std::cin.tie(0);
#define OUT(d) std::cout << (d)
#define OUT_L(d) std::cout << (d) << endl
#define FOUT(n, data) std::cout << std::fixed << std::setprecision(n) << (data)
#define FOUT_L(n, data) \
std::cout << std::fixed << std::setprecision(n) << (data) << "\n"
#define EL() printf("\n")
#define SHOW_VECTOR(v) \
{ \
std::cerr << #v << "\t:"; \
for (const auto &xxx : v) { \
std::cerr << xxx << " "; \
} \
std::cerr << "\n"; \
}
#define SHOW_MAP(v) \
{ \
std::cerr << #v << endl; \
for (const auto &xxx : v) { \
std::cerr << xxx.first << " " << xxx.second << "\n"; \
} \
}
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define YES() printf("YES\n")
#define NO() printf("NO\n")
//------------------------------------------
// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FORLL(i, a, b) for (LL i = LL(a); i < LL(b); ++i)
#define RFORLL(i, a, b) for (LL i = LL(b) - 1; i >= LL(a); --i)
#define REPLL(i, n) for (LL i = 0; i < LL(n); ++i)
#define RREPLL(i, n) for (LL i = LL(n) - 1; i >= 0; --i)
#define FOREACH(x, arr) for (auto &(x) : (arr))
#define FORITER(x, arr) for (auto(x) = (arr).begin(); (x) != (arr).end(); ++(x))
//**************************************
//最大公約数
//**************************************
template <class T> inline T GCD(const T x, const T y) {
if (x < 0)
return GCD(-x, y);
if (y < 0)
return GCD(x, -y);
return (!y) ? x : GCD(y, x % y);
}
//**************************************
// nの約数
//**************************************
template <typename T> vector<T> DIVISOR(T n) {
vector<T> v;
for (LL i = 1; i * i <= n; ++i) {
if (n % i == 0) {
v.push_back(i);
if (i != n / i) {
v.push_back(n / i);
}
}
}
sort(v.begin(), v.end());
return v;
}
//------------------------------------------
// global
//------------------------------------------
// int A = 0;
VLL A;
// int B = 0;
LL B = 0;
LL C = 0;
LL D = 0;
LL E = 0;
LL G = 0;
LL N = 0;
LL M = 0;
LL K = 0;
LL T = 0;
LL R = 0;
LL L = 0;
VLL V;
LL W = 0;
LL Q = 0;
string S = "";
VPLL Pair;
LL i, j, k = 0;
VLL x, y;
VC t;
/*
std::string str[3];
int h[100] = {0};
int h_size = 0;
int MinCount = 0;
LL i,j,k = 0;
LL ans1,ans2 = 0;
VLL A;
LL K;
LL K_pow = 0;
LL K_num = 1;
LL tmp = 0;
*/
//------------------------------------------
// read
//------------------------------------------
void read(void) {
cin >> N >> L;
/*
x.resize(N);
y.resize(N);
REP(i, N) {
cin >> x[i] >> y[i];
}
*/
}
int main() {
LL ans = 0;
LL flag = 0;
LL tmp = 0;
LL min = 0;
LL sum = 0;
LL min_value = 0;
// 初期化
INIT();
// 読込み
read();
min = abs(L);
for (i = 0; i < N; i++) {
if ((L + i) == 0) {
flag = 1;
}
sum += L + i;
tmp = abs(L + i);
if (min > tmp) {
min = tmp;
min_value = L + i;
}
}
if (flag == 0) {
sum -= min_value;
}
printf("%d\n", sum);
return 0;
} | //------------------------------------------
// include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
//------------------------------------------
// typedef
//------------------------------------------
typedef long long LL;
typedef vector<int> VI;
typedef vector<bool> VB;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef vector<VI> VVI;
typedef vector<VB> VVB;
typedef vector<VS> VVS;
typedef vector<VLL> VVLL;
typedef vector<VVI> VVVI;
typedef vector<VVLL> VVVLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<int, string> PIS;
typedef pair<string, int> PSI;
typedef pair<string, string> PSS;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<VPII> VVPII;
typedef vector<VPLL> VVPLL;
typedef vector<VS> VVS;
//------------------------------------------
// comparison
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define CHMIN(a, b) a = min((a), (b))
#define CHMAX(a, b) a = max((a), (b))
#define C_ABS(a, b) ((a) < (b) ? (b) - (a) : (a) - (b))
//------------------------------------------
// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define EACH(i, arr) \
for (typeof((arr).begin()) i = (arr).begin(); i != (arr).end(); ++i)
#define EXIST(str, e) ((str).find(e) != (str).end())
#define COUNT(arr, v) count((arr).begin(), (arr).end(), v)
#define SEARCH(v, w) search((v).begin(), (v).end(), (w).begin(), (w).end())
#define B_SEARCH(arr, v) binary_search((arr).begin(), (arr).end(), v)
#define SORT(c) sort((c).begin(), (c).end())
#define RSORT(c) sort((c).rbegin(), (c).rend())
#define REVERSE(c) reverse((c).begin(), (c).end())
#define ROTATE_LEFT(arr, c) \
rotate((arr).begin(), (arr).begin() + (c), (arr).end())
#define ROTATE_RIGHT(arr, c) \
rotate((arr).rbegin(), (arr).rbegin() + (c), (arr).rend())
#define SUMI(arr) accumulate((arr).begin(), (arr).end(), 0)
#define SUMD(arr) accumulate((arr).begin(), (arr).end(), 0.)
#define SUMLL(arr) accumulate((arr).begin(), (arr).end(), 0LL)
#define SUMS(arr) accumulate((arr).begin(), (arr).end(), string())
#define UB(arr, n) upper_bound((arr).begin(), (arr).end(), n)
#define LB(arr, n) lower_bound((arr).begin(), (arr).end(), n)
#define OF_ALL(arr, func) all_of((arr).begin(), (arr).end(), (func))
#define OF_NONE(arr, func) none_of((arr).begin(), (arr).end(), (func))
#define OF_ANY(arr, func) any_of((arr).begin(), (arr).end(), (func))
#define PB push_back
#define MP make_pair
//------------------------------------------
// input output
//------------------------------------------
#define GL(s) getline(cin, (s))
#define INIT() \
std::ios::sync_with_stdio(false); \
std::cin.tie(0);
#define OUT(d) std::cout << (d)
#define OUT_L(d) std::cout << (d) << endl
#define FOUT(n, data) std::cout << std::fixed << std::setprecision(n) << (data)
#define FOUT_L(n, data) \
std::cout << std::fixed << std::setprecision(n) << (data) << "\n"
#define EL() printf("\n")
#define SHOW_VECTOR(v) \
{ \
std::cerr << #v << "\t:"; \
for (const auto &xxx : v) { \
std::cerr << xxx << " "; \
} \
std::cerr << "\n"; \
}
#define SHOW_MAP(v) \
{ \
std::cerr << #v << endl; \
for (const auto &xxx : v) { \
std::cerr << xxx.first << " " << xxx.second << "\n"; \
} \
}
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define YES() printf("YES\n")
#define NO() printf("NO\n")
//------------------------------------------
// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FORLL(i, a, b) for (LL i = LL(a); i < LL(b); ++i)
#define RFORLL(i, a, b) for (LL i = LL(b) - 1; i >= LL(a); --i)
#define REPLL(i, n) for (LL i = 0; i < LL(n); ++i)
#define RREPLL(i, n) for (LL i = LL(n) - 1; i >= 0; --i)
#define FOREACH(x, arr) for (auto &(x) : (arr))
#define FORITER(x, arr) for (auto(x) = (arr).begin(); (x) != (arr).end(); ++(x))
//**************************************
//最大公約数
//**************************************
template <class T> inline T GCD(const T x, const T y) {
if (x < 0)
return GCD(-x, y);
if (y < 0)
return GCD(x, -y);
return (!y) ? x : GCD(y, x % y);
}
//**************************************
// nの約数
//**************************************
template <typename T> vector<T> DIVISOR(T n) {
vector<T> v;
for (LL i = 1; i * i <= n; ++i) {
if (n % i == 0) {
v.push_back(i);
if (i != n / i) {
v.push_back(n / i);
}
}
}
sort(v.begin(), v.end());
return v;
}
//------------------------------------------
// global
//------------------------------------------
// int A = 0;
VLL A;
// int B = 0;
LL B = 0;
LL C = 0;
LL D = 0;
LL E = 0;
LL G = 0;
LL N = 0;
LL M = 0;
LL K = 0;
LL T = 0;
LL R = 0;
LL L = 0;
VLL V;
LL W = 0;
LL Q = 0;
string S = "";
VPLL Pair;
LL i, j, k = 0;
VLL x, y;
VC t;
/*
std::string str[3];
int h[100] = {0};
int h_size = 0;
int MinCount = 0;
LL i,j,k = 0;
LL ans1,ans2 = 0;
VLL A;
LL K;
LL K_pow = 0;
LL K_num = 1;
LL tmp = 0;
*/
//------------------------------------------
// read
//------------------------------------------
void read(void) {
cin >> N >> L;
/*
x.resize(N);
y.resize(N);
REP(i, N) {
cin >> x[i] >> y[i];
}
*/
}
int main() {
LL ans = 0;
LL flag = 0;
LL tmp = 0;
LL min = 0;
LL sum = 0;
LL min_value = 0;
// 初期化
INIT();
// 読込み
read();
min = abs(L);
min_value = L;
for (i = 0; i < N; i++) {
if ((L + i) == 0) {
flag = 1;
}
sum += L + i;
tmp = abs(L + i);
if (min > tmp) {
min = tmp;
min_value = L + i;
}
}
if (flag == 0) {
sum -= min_value;
}
printf("%d\n", sum);
return 0;
} | [
"assignment.add"
] | 803,752 | 803,753 | u226861390 | cpp |
p02994 | #include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int MOD = 1000000007;
LL N, M, S, L;
LL a, b, c, d;
string s;
int main() {
cin >> N >> L;
LL sum = 0;
LL minA = N + L;
for (int i = 1; i <= N; i++) {
if (minA > abs(L + i - 1)) {
minA = abs(L + i - 1);
a = L + i - 1;
}
sum += L + i - 1;
}
cout << sum - a;
return 0;
}
| #include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int MOD = 1000000007;
LL N, M, S, L;
LL a, b, c, d;
string s;
int main() {
cin >> N >> L;
LL sum = 0;
LL minA = N + 30000;
for (int i = 1; i <= N; i++) {
if (minA > abs(L + i - 1)) {
minA = abs(L + i - 1);
a = L + i - 1;
}
sum += L + i - 1;
}
cout << sum - a;
return 0;
}
| [
"identifier.replace.remove",
"literal.replace.add",
"expression.operation.binary.change"
] | 803,754 | 803,755 | u114234520 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
int sum = 0;
cin >> N >> L;
if (L > 0) {
for (int i = 1; i < N; i++) {
sum += L + i;
}
}
if (L < 0 && L + N - 1 >= 0) {
for (int i = 0; i < N; i++) {
sum += L + i;
}
}
if (L < 0 && L + N - 1 < 0) {
for (int i = 0; i < N - 1; i++) {
sum += L + i;
}
}
cout << sum << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
int sum = 0;
cin >> N >> L;
if (L >= 0) {
for (int i = 1; i < N; i++) {
sum += L + i;
}
}
if (L < 0 && L + N - 1 >= 0) {
for (int i = 0; i < N; i++) {
sum += L + i;
}
}
if (L < 0 && L + N - 1 < 0) {
for (int i = 0; i < N - 1; i++) {
sum += L + i;
}
}
cout << sum << endl;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,762 | 803,763 | u333438260 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 100000000;
int in() {
int a;
cin >> a;
return a;
} // int型関数の受け取り
void forin(int *x, int y) {
for (int i = 0; i < y; i++) {
cin >> x[i];
}
} //(x,y) int型配列x[y]の受け取り
int intpow(int x, int y) {
double a = x, b = y;
return pow(a, b);
} //(x,y) xをy乗
int intfabs(int x) {
double a = x;
return fabs(a);
} //(x) xの絶対値
int fact(int x) {
if (x == 1)
return 1;
return x * fact(x - 1);
} //(x) x!
int fib(int x) {
if (x <= 2)
return x;
int a[x];
a[0] = 1;
a[1] = 2;
for (int i = 2; i < x; i++) {
a[i] = a[i - 1] + a[i - 2];
}
return a[x - 1];
} //(x) フィボナッチ数列のx番目
int div1(ll x) { return x % 1000000007; }
main() {
int n = in(), l = in(), ans = 0;
for (int i = 0; i < n; i++) {
ans += l + i;
}
if (0 < l)
cout << ans - l << endl;
else if (l + n + 1 < 0)
cout << ans - l - n + 1 << endl;
else
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 100000000;
int in() {
int a;
cin >> a;
return a;
} // int型関数の受け取り
void forin(int *x, int y) {
for (int i = 0; i < y; i++) {
cin >> x[i];
}
} //(x,y) int型配列x[y]の受け取り
int intpow(int x, int y) {
double a = x, b = y;
return pow(a, b);
} //(x,y) xをy乗
int intfabs(int x) {
double a = x;
return fabs(a);
} //(x) xの絶対値
int fact(int x) {
if (x == 1)
return 1;
return x * fact(x - 1);
} //(x) x!
int fib(int x) {
if (x <= 2)
return x;
int a[x];
a[0] = 1;
a[1] = 2;
for (int i = 2; i < x; i++) {
a[i] = a[i - 1] + a[i - 2];
}
return a[x - 1];
} //(x) フィボナッチ数列のx番目
int div1(ll x) { return x % 1000000007; }
main() {
int n = in(), l = in(), ans = 0;
for (int i = 0; i < n; i++) {
ans += l + i;
}
if (0 < l)
cout << ans - l << endl;
else if (l + n - 1 < 0)
cout << ans - l - n + 1 << endl;
else
cout << ans << endl;
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 803,764 | 803,765 | u160321725 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 100000000;
int in() {
int a;
cin >> a;
return a;
} // int型関数の受け取り
void forin(int *x, int y) {
for (int i = 0; i < y; i++) {
cin >> x[i];
}
} //(x,y) int型配列x[y]の受け取り
int intpow(int x, int y) {
double a = x, b = y;
return pow(a, b);
} //(x,y) xをy乗
int intfabs(int x) {
double a = x;
return fabs(a);
} //(x) xの絶対値
int fact(int x) {
if (x == 1)
return 1;
return x * fact(x - 1);
} //(x) x!
int fib(int x) {
if (x <= 2)
return x;
int a[x];
a[0] = 1;
a[1] = 2;
for (int i = 2; i < x; i++) {
a[i] = a[i - 1] + a[i - 2];
}
return a[x - 1];
} //(x) フィボナッチ数列のx番目
int div1(ll x) { return x % 1000000007; }
main() {
int n = in(), l = in(), ans = 0;
for (int i = 0; i < n; i++) {
ans += l + i;
}
if (0 < l)
cout << ans - l << endl;
else if (l + n < 0)
cout << ans - l - n + 1 << endl;
else
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 100000000;
int in() {
int a;
cin >> a;
return a;
} // int型関数の受け取り
void forin(int *x, int y) {
for (int i = 0; i < y; i++) {
cin >> x[i];
}
} //(x,y) int型配列x[y]の受け取り
int intpow(int x, int y) {
double a = x, b = y;
return pow(a, b);
} //(x,y) xをy乗
int intfabs(int x) {
double a = x;
return fabs(a);
} //(x) xの絶対値
int fact(int x) {
if (x == 1)
return 1;
return x * fact(x - 1);
} //(x) x!
int fib(int x) {
if (x <= 2)
return x;
int a[x];
a[0] = 1;
a[1] = 2;
for (int i = 2; i < x; i++) {
a[i] = a[i - 1] + a[i - 2];
}
return a[x - 1];
} //(x) フィボナッチ数列のx番目
int div1(ll x) { return x % 1000000007; }
main() {
int n = in(), l = in(), ans = 0;
for (int i = 0; i < n; i++) {
ans += l + i;
}
if (0 < l)
cout << ans - l << endl;
else if (l + n - 1 < 0)
cout << ans - l - n + 1 << endl;
else
cout << ans << endl;
} | [
"control_flow.branch.if.condition.change"
] | 803,766 | 803,765 | u160321725 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 100000000;
int in() {
int a;
cin >> a;
return a;
} // int型関数の受け取り
void forin(int *x, int y) {
for (int i = 0; i < y; i++) {
cin >> x[i];
}
} //(x,y) int型配列x[y]の受け取り
int intpow(int x, int y) {
double a = x, b = y;
return pow(a, b);
} //(x,y) xをy乗
int intfabs(int x) {
double a = x;
return fabs(a);
} //(x) xの絶対値
int fact(int x) {
if (x == 1)
return 1;
return x * fact(x - 1);
} //(x) x!
int fib(int x) {
if (x <= 2)
return x;
int a[x];
a[0] = 1;
a[1] = 2;
for (int i = 2; i < x; i++) {
a[i] = a[i - 1] + a[i - 2];
}
return a[x - 1];
} //(x) フィボナッチ数列のx番目
int div1(ll x) { return x % 1000000007; }
main() {
int n = in(), l = in(), ans = 0;
for (int i = 0; i < n; i++) {
ans += l + i;
}
if (0 < l)
cout << ans - l << endl;
else if (l + n < 0)
cout << ans - l - n << endl;
else
cout << ans + 1 << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 100000000;
int in() {
int a;
cin >> a;
return a;
} // int型関数の受け取り
void forin(int *x, int y) {
for (int i = 0; i < y; i++) {
cin >> x[i];
}
} //(x,y) int型配列x[y]の受け取り
int intpow(int x, int y) {
double a = x, b = y;
return pow(a, b);
} //(x,y) xをy乗
int intfabs(int x) {
double a = x;
return fabs(a);
} //(x) xの絶対値
int fact(int x) {
if (x == 1)
return 1;
return x * fact(x - 1);
} //(x) x!
int fib(int x) {
if (x <= 2)
return x;
int a[x];
a[0] = 1;
a[1] = 2;
for (int i = 2; i < x; i++) {
a[i] = a[i - 1] + a[i - 2];
}
return a[x - 1];
} //(x) フィボナッチ数列のx番目
int div1(ll x) { return x % 1000000007; }
main() {
int n = in(), l = in(), ans = 0;
for (int i = 0; i < n; i++) {
ans += l + i;
}
if (0 < l)
cout << ans - l << endl;
else if (l + n - 1 < 0)
cout << ans - l - n + 1 << endl;
else
cout << ans << endl;
} | [
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 803,767 | 803,765 | u160321725 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int answer;
if (L >= 0) {
answer = (2 * L + N) * (N - 1) / 2;
} else if (L < 0 && L >= 0) {
answer = (2 * L + N - 1) * N / 2;
} else {
answer = (2 * L + N - 2) * (N - 1) / 2;
}
cout << answer << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int answer;
if (L >= 0) {
answer = (2 * L + N) * (N - 1) / 2;
} else if (L < 0 && L + N - 1 >= 0) {
answer = (2 * L + N - 1) * N / 2;
} else {
answer = (2 * L + N - 2) * (N - 1) / 2;
}
cout << answer << endl;
} | [
"control_flow.branch.if.condition.change"
] | 803,768 | 803,769 | u797900551 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int sum = (2 * L + N - 1) * N / 2;
if (L < 0 && L + N - 1 > 0) {
cout << sum << endl;
} else if (L > 0) {
cout << sum - L << endl;
} else {
cout << sum - (L + N - 1) << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int sum = (2 * L + N - 1) * N / 2;
if (L <= 0 && L + N - 1 >= 0) {
cout << sum << endl;
} else if (L > 0) {
cout << sum - L << endl;
} else {
cout << sum - (L + N - 1) << endl;
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,770 | 803,771 | u761335395 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
long L[1000], i;
long n, l, S = 0, dem;
cin >> n >> l;
long minf = 99999999;
for (i = 1; i <= n; i++) {
L[i] = l + i - 1;
S += L[i];
minf = min(minf, abs(L[i]));
if (minf = abs(L[i]))
dem = i;
}
cout << S - L[dem];
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long L[1000], i;
long n, l, S = 0, dem;
cin >> n >> l;
long minf = 99999999;
for (i = 1; i <= n; i++) {
L[i] = l + i - 1;
S += L[i];
minf = min(minf, abs(L[i]));
if (minf == abs(L[i]))
dem = i;
}
cout << S - L[dem];
} | [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 803,784 | 803,785 | u659333601 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
if (N + L < 0) {
cout << (L + N + L - 2) * (N - 1) / 2 << endl;
} else if (L > 0) {
cout << (L + 1 + N + L - 1) * (N - 1) / 2 << endl;
} else {
cout << (L + N + L - 1) * N / 2 << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
if (N + L - 1 < 0) {
cout << (L + N + L - 2) * (N - 1) / 2 << endl;
} else if (L > 0) {
cout << (L + 1 + N + L - 1) * (N - 1) / 2 << endl;
} else {
cout << (L + N + L - 1) * N / 2 << endl;
}
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 803,788 | 803,789 | u269804060 | cpp |
p02994 | #define FORI(x) for (int i = 0; i < x; ++i)
#define FORJ(x) for (int j = 0; j < x; ++j)
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int ans = 0;
FORI(n) { ans += i + l; }
if (l > 0) {
ans -= l;
} else if (n + l < 0) {
ans -= n + l - 1;
}
cout << ans;
return 0;
} | #define FORI(x) for (int i = 0; i < x; ++i)
#define FORJ(x) for (int j = 0; j < x; ++j)
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int ans = 0;
FORI(n) { ans += i + l; }
if (l > 0) {
ans -= l;
} else if (n + l - 1 < 0) {
ans -= n + l - 1;
}
cout << ans;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 803,790 | 803,791 | u344810256 | cpp |
p02994 | #include <iostream>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int ans = 0;
if (L >= 0) {
for (int i = 1; i < N; i++) {
ans += L + i;
}
cout << ans;
} else if (L + N < 0) {
for (int i = 0; i < N - 1; i++) {
ans += L + i;
}
cout << ans;
} else {
for (int i = 0; i < N; i++) {
ans += L + i;
}
cout << ans;
}
} | #include <iostream>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int ans = 0;
if (L >= 0) {
for (int i = 1; i < N; i++) {
ans += L + i;
}
cout << ans;
} else if (L + N <= 0) {
for (int i = 0; i < N - 1; i++) {
ans += L + i;
}
cout << ans;
} else {
for (int i = 0; i < N; i++) {
ans += L + i;
}
cout << ans;
}
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,794 | 803,795 | u923676814 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
if (L > 0) {
cout << (2 * L + N - 1) * N / 2 - L << endl;
} else if (N + L < 0) {
cout << (2 * L + N - 1) * N / 2 - (N + L - 1) << endl;
} else {
cout << (2 * L + N - 1) * N / 2 << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
if (L > 0) {
cout << (2 * L + N - 1) * N / 2 - L << endl;
} else if (N + L - 1 < 0) {
cout << (2 * L + N - 1) * N / 2 - (N + L - 1) << endl;
} else {
cout << (2 * L + N - 1) * N / 2 << endl;
}
} | [
"control_flow.branch.if.condition.change"
] | 803,798 | 803,799 | u415916075 | cpp |
p02994 | #include <iostream>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int ap[n];
for (int i = 1; i <= n; i++)
ap[i] = l + i - 1;
int left = -100, right = 100, sum = 0;
for (int i = 1; i <= n; i++) {
if (ap[i] < 0 && left < ap[i])
left = ap[i];
else if (right > ap[i])
right = ap[i];
sum += ap[i];
}
if (0 - left < right)
cout << sum - left;
else
cout << sum - right;
}
| #include <iostream>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int ap[n];
for (int i = 1; i <= n; i++)
ap[i] = l + i - 1;
int left = -1000, right = 1000, sum = 0;
for (int i = 1; i <= n; i++) {
if (ap[i] < 0 && left < ap[i])
left = ap[i];
else if (right > ap[i])
right = ap[i];
sum += ap[i];
}
if (0 - left < right)
cout << sum - left;
else
cout << sum - right;
}
| [
"literal.number.change",
"variable_declaration.value.change"
] | 803,800 | 803,801 | u927804708 | cpp |
p02994 | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int Sum, sum;
sum = 0;
if (L >= 0) {
for (int i = 1; i < N; ++i) {
sum = sum + L + i;
}
} else if (L >= N - 1) {
for (int i = 0; i < N; ++i) {
sum = sum + L + i;
}
} else {
for (int i = 0; i < N - 1; ++i) {
sum = sum + L + i;
}
}
cout << sum << "\n";
return 0;
}
| #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int Sum, sum;
sum = 0;
if (L >= 0) {
for (int i = 1; i < N; ++i) {
sum = sum + L + i;
}
} else if (L >= 1 - N) {
for (int i = 0; i < N; ++i) {
sum = sum + L + i;
}
} else {
for (int i = 0; i < N - 1; ++i) {
sum = sum + L + i;
}
}
cout << sum << "\n";
return 0;
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 803,802 | 803,803 | u377547585 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N = 0, L = 0;
cin >> N >> L;
int ans = 0;
if (L < 0) {
if (L + N < 0) {
for (int i = 1; i < N; i++) {
ans += L + i - 1;
}
} else {
for (int i = 1; i < N + 1; i++) {
ans += L + i - 1;
}
}
} else {
for (int i = 2; i < N + 1; i++) {
ans += L + i - 1;
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N = 0, L = 0;
cin >> N >> L;
int ans = 0;
if (L < 0) {
if (L + N > 0) {
for (int i = 1; i < N + 1; i++) {
ans += L + i - 1;
}
} else {
for (int i = 1; i < N; i++) {
ans += L + i - 1;
}
}
} else {
for (int i = 2; i < N + 1; i++) {
ans += L + i - 1;
}
}
cout << ans << endl;
return 0;
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one",
"expression.operation.binary.remove"
] | 803,810 | 803,811 | u883817875 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int total = 0;
for (int i = 0; i < N; i++) {
total += L + i;
}
if (L >= 0) {
total -= L;
} else if (L + N < 0) {
total -= L + N - 1;
}
cout << total << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int total = 0;
for (int i = 0; i < N; i++) {
total += L + i;
}
if (L >= 0) {
total -= L;
} else if (L + N <= 0) {
total -= L + N - 1;
}
cout << total << endl;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,825 | 803,826 | u199347185 | cpp |
p02994 | #include <algorithm>
#include <iostream>
#include <set>
#include <vector>
typedef long long ll;
using namespace std;
int main(int argc, char *argv[]) {
int n, l;
cin >> n >> l;
int res = 0;
if (l > 0) {
for (int i = 2; i <= n; i++) {
res += (l + i) - 1;
}
} else {
if (n < abs(l)) {
for (int i = 1; i < n; i++) {
res += (l + i) - 1;
}
} else {
for (int i = 1; i <= n; i++) {
res += (l + i) - 1;
}
}
}
cout << res << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <set>
#include <vector>
typedef long long ll;
using namespace std;
int main(int argc, char *argv[]) {
int n, l;
cin >> n >> l;
int res = 0;
if (l > 0) {
for (int i = 2; i <= n; i++) {
res += (l + i) - 1;
}
} else {
if (n <= abs(l)) {
for (int i = 1; i < n; i++) {
res += (l + i) - 1;
}
} else {
for (int i = 1; i <= n; i++) {
res += (l + i) - 1;
}
}
}
cout << res << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,833 | 803,834 | u938635447 | cpp |
p02994 | #include <algorithm>
#include <iostream>
#include <set>
#include <vector>
typedef long long ll;
using namespace std;
int main(int argc, char *argv[]) {
int n, l;
cin >> n >> l;
int res = 0;
if (l >= 0) {
for (int i = 2; i <= n; i++) {
res += (l + i) - 1;
}
} else {
if (n < abs(l)) {
for (int i = 1; i < n; i++) {
res += (l + i) - 1;
}
} else {
for (int i = 1; i <= n; i++) {
res += (l + i) - 1;
}
}
}
cout << res << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <set>
#include <vector>
typedef long long ll;
using namespace std;
int main(int argc, char *argv[]) {
int n, l;
cin >> n >> l;
int res = 0;
if (l > 0) {
for (int i = 2; i <= n; i++) {
res += (l + i) - 1;
}
} else {
if (n <= abs(l)) {
for (int i = 1; i < n; i++) {
res += (l + i) - 1;
}
} else {
for (int i = 1; i <= n; i++) {
res += (l + i) - 1;
}
}
}
cout << res << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,835 | 803,834 | u938635447 | cpp |
p02994 | #include <iostream>
using namespace std;
int N;
int L;
int main() {
cin >> N;
cin >> L;
int sum = 0;
int k = abs(L);
int t = 0;
for (int i = 0; i < N; i++) {
sum += L + i;
if (k > abs(L + i)) {
k = abs(L + i);
t = L + i;
}
}
sum = sum - t;
cout << sum << endl;
}
| #include <iostream>
using namespace std;
int N;
int L;
int main() {
cin >> N;
cin >> L;
int sum = 0;
int k = abs(L);
int t = L;
for (int i = 0; i < N; i++) {
sum += L + i;
if (k > abs(L + i)) {
k = abs(L + i);
t = L + i;
}
}
sum = sum - t;
cout << sum << endl;
}
| [
"variable_declaration.value.change",
"identifier.replace.add",
"literal.replace.remove"
] | 803,836 | 803,837 | u345981182 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, l;
int x = 0;
int y;
cin >> n >> l;
vector<int> d(n);
for (int i = 0; i < n; i++) {
d[i] = l + i - 1;
x += d[i];
}
int a = 500;
for (int i = 0; i < n; i++) {
if (abs(d[i]) <= a) {
a = abs(d[i]);
y = d[i];
}
}
cout << x - y << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, l;
int x = 0;
int y;
cin >> n >> l;
vector<int> d(n);
for (int i = 0; i < n; i++) {
d[i] = l + i;
x += d[i];
}
int a = 500;
for (int i = 0; i < n; i++) {
if (abs(d[i]) <= a) {
a = abs(d[i]);
y = d[i];
}
}
cout << x - y << endl;
}
| [
"expression.operation.binary.remove"
] | 803,840 | 803,841 | u552201227 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
int sum = 0;
for (int i = y; i < x + y; i++) {
sum += i;
}
if (y > 0) {
cout << sum - y << endl;
} else if (y <= 0 && y + x >= 0) {
cout << sum << endl;
} else {
cout << sum - (y + x - 1) << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
int sum = 0;
for (int i = y; i < x + y; i++) {
sum += i;
}
if (y >= 0) {
cout << sum - y << endl;
} else if (y < 0 && y + x - 1 >= 0) {
cout << sum << endl;
} else {
cout << sum - (y + x - 1) << endl;
}
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,842 | 803,843 | u827250617 | cpp |
p02994 | #include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int N, L;
cin >> N >> L;
int tot = (L + (L + N - 1)) * N / 2;
int max = L + N - 1;
int min = L;
if ((min < 0) && (0 < max))
cout << tot << endl;
else if (min > 0)
cout << (tot - min) << endl;
else if (max < 0)
cout << (tot - max) << endl;
return 0;
} | #include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int N, L;
cin >> N >> L;
int tot = (L + (L + N - 1)) * N / 2;
int max = L + N - 1;
int min = L;
if ((min <= 0) && (0 <= max))
cout << tot << endl;
else if (min > 0)
cout << (tot - min) << endl;
else if (max < 0)
cout << (tot - max) << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,848 | 803,849 | u363251947 | cpp |
p02994 | #include <iostream>
#include <vector>
using namespace std;
int main() {
long N, L;
cin >> N >> L;
long res = 0;
if (0 <= L) {
for (long n = L + 1, i = 0; i < N - 1; ++i, ++n)
res += n;
} else if (L < 0 && L + N >= 0) {
for (long n = L, i = 0; i < N; ++i, ++n)
res += n;
} else {
for (long n = L, i = 0; i < N - 1; ++i, ++n)
res += n;
}
cout << res << endl;
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
long N, L;
cin >> N >> L;
long res = 0;
if (0 <= L) {
for (long n = L + 1, i = 0; i < N - 1; ++i, ++n)
res += n;
} else if (L < 0 && L + N > 0) {
for (long n = L, i = 0; i < N; ++i, ++n)
res += n;
} else {
for (long n = L, i = 0; i < N - 1; ++i, ++n)
res += n;
}
cout << res << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,852 | 803,853 | u762603420 | cpp |
p02994 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int ans = 0;
for (int i = 0; i < N; i++) {
ans += L + i;
}
if (L >= 0)
ans -= L;
else if (L < 0 && L + N < 0)
ans -= N + L - 1;
cout << ans;
}
| #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int ans = 0;
for (int i = 0; i < N; i++) {
ans += L + i;
}
if (L >= 0)
ans -= L;
else if (L < 0 && L + N <= 0)
ans -= N + L - 1;
cout << ans;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,866 | 803,867 | u743574271 | cpp |
p02994 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <time.h>
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, a, b) for (int i = a; i > b; i--)
#define vint vector<int>
#define vvint vector<vint>
#define ct(a) cout << a << endl
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9 + 7;
const ll mod = 998244353;
ll N, L, ans;
string S;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N >> L;
ans = (N * (N - 1)) / 2 + N * L;
if (L > 0)
ans -= L;
if (L < 0) {
if (L + N > 0)
ans -= 0;
if (L + N < 0)
ans -= L + N - 1;
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <time.h>
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, a, b) for (int i = a; i > b; i--)
#define vint vector<int>
#define vvint vector<vint>
#define ct(a) cout << a << endl
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9 + 7;
const ll mod = 998244353;
ll N, L, ans;
string S;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N >> L;
ans = (N * (N - 1)) / 2 + N * L;
if (L > 0)
ans -= L;
if (L < 0) {
if (L + N - 1 >= 0)
ans -= 0;
if (L + N - 1 < 0)
ans -= L + N - 1;
}
cout << ans << endl;
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 803,870 | 803,871 | u243196226 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int orgPieTaste = 0;
for (int i = 0; i < N; i++) {
orgPieTaste += (L + i - 1);
}
int maxPieTaste = 0;
int minAppleDiff = 99999999;
for (int i = 0; i < N; i++) {
int diff = abs(L + i - 1);
if (diff < minAppleDiff) {
maxPieTaste = orgPieTaste - (L + i - 1);
minAppleDiff = diff;
}
}
cout << maxPieTaste << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int orgPieTaste = 0;
for (int i = 0; i < N; i++) {
orgPieTaste += (L + i);
}
int maxPieTaste = 0;
int minAppleDiff = 99999999;
for (int i = 0; i < N; i++) {
int diff = abs(L + i);
if (diff < minAppleDiff) {
maxPieTaste = orgPieTaste - (L + i);
minAppleDiff = diff;
}
}
cout << maxPieTaste << endl;
}
| [
"expression.operation.binary.remove"
] | 803,874 | 803,875 | u236540805 | cpp |
p02994 | #include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unrolled-loops")
using namespace std;
#define inp "TestCode.inp"
#define out "TestCode.out"
#define FAST \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define FileInOut \
freopen(inp, "r", stdin); \
freopen(out, "w", stdout);
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define pi acos(-1)
#define pii pair<int, int>
#define ppiii pair<pair<int, int>, int>
#define INF 1000000
#define endl '\n'
#define ll long long
#define pq priority_queue
const int mod = 1e9 + 7;
int test = 1;
/*-----------------------------------------------*/
void nathan_on_osu() {
FAST
#ifndef ONLINE_JUDGE
// FileInOut
#endif // ONLINE_JUDGE
}
/*-----------------------------------------------*/
int n, l;
int a[110];
int sum = 0;
int minDif = 100000;
int ans;
int main() {
nathan_on_osu();
cin >> n >> l;
for (int i = 1; i <= n; i++) {
a[i] = l + i - 1;
sum += a[i];
}
for (int i = 1; i <= n; i++) {
if (abs(a[i]) < minDif) {
minDif = a[i];
ans = sum - a[i];
}
}
cout << ans;
}
| #include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unrolled-loops")
using namespace std;
#define inp "TestCode.inp"
#define out "TestCode.out"
#define FAST \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define FileInOut \
freopen(inp, "r", stdin); \
freopen(out, "w", stdout);
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define pi acos(-1)
#define pii pair<int, int>
#define ppiii pair<pair<int, int>, int>
#define INF 1000000
#define endl '\n'
#define ll long long
#define pq priority_queue
const int mod = 1e9 + 7;
int test = 1;
/*-----------------------------------------------*/
void nathan_on_osu() {
FAST
#ifndef ONLINE_JUDGE
// FileInOut
#endif // ONLINE_JUDGE
}
/*-----------------------------------------------*/
int n, l;
int a[110];
int sum = 0;
int minDif = 100000;
int ans;
int main() {
nathan_on_osu();
cin >> n >> l;
for (int i = 1; i <= n; i++) {
a[i] = l + i - 1;
sum += a[i];
}
// cout<<sum<<endl;
for (int i = 1; i <= n; i++) {
if (abs(a[i]) < minDif) {
minDif = abs(a[i]);
ans = sum - a[i];
}
// cout<<a[i]<<" "<<minDif<<endl;
}
cout << ans;
}
| [
"call.add",
"call.arguments.change"
] | 803,878 | 803,879 | u421588660 | cpp |
p02994 | #include <iostream>
using namespace std;
int main() {
int n, l, sum;
cin >> n >> l;
sum = 0;
if (l >= 0) {
for (int i = 1; i < n; i++) {
sum += l + i;
}
} else {
if (n < -l) {
for (int i = 0; i < n - 1; i++) {
sum += l + i;
}
} else {
for (int i = 0; i < n; i++) {
sum += l + i;
}
}
}
cout << sum << endl;
return 0;
} | #include <iostream>
using namespace std;
int main() {
int n, l, sum;
cin >> n >> l;
sum = 0;
if (l >= 0) {
for (int i = 1; i < n; i++) {
sum += l + i;
}
} else {
if (n <= -l) {
for (int i = 0; i < n - 1; i++) {
sum += l + i;
}
} else {
for (int i = 0; i < n; i++) {
sum += l + i;
}
}
}
cout << sum << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,880 | 803,881 | u448406471 | cpp |
p02994 |
#include <bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9 + 7)
#define P pair<int, int>
#define PLL pair<ll, ll>
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define RFOR(i, m, n) for (int i = (int)m; i >= (int)n; i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define all(a) a.begin(), a.end()
#define IN(a, n) \
rep(i, n) { cin >> a[i]; }
const int vx[4] = {0, 1, 0, -1};
const int vy[4] = {1, 0, -1, 0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init() {
cin.tie(0);
ios::sync_with_stdio(false);
}
int n, l;
main() {
cin >> n >> l;
if (l >= 0) {
int sum = 0;
rep(i, n - 1) { sum += l + i + 1; }
cout << sum << endl;
} else if (n + l >= 0) {
int sum = 0;
rep(i, n) { sum += l + i; }
cout << sum << endl;
} else {
int sum = 0;
rep(i, n - 1) { sum += l + i; }
cout << sum << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9 + 7)
#define P pair<int, int>
#define PLL pair<ll, ll>
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define RFOR(i, m, n) for (int i = (int)m; i >= (int)n; i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define all(a) a.begin(), a.end()
#define IN(a, n) \
rep(i, n) { cin >> a[i]; }
const int vx[4] = {0, 1, 0, -1};
const int vy[4] = {1, 0, -1, 0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init() {
cin.tie(0);
ios::sync_with_stdio(false);
}
int n, l;
main() {
cin >> n >> l;
if (l >= 0) {
int sum = 0;
rep(i, n - 1) { sum += l + i + 1; }
cout << sum << endl;
} else if (n + l > 0) {
int sum = 0;
rep(i, n) { sum += l + i; }
cout << sum << endl;
} else {
int sum = 0;
rep(i, n - 1) { sum += l + i; }
cout << sum << endl;
}
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,882 | 803,883 | u229842440 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// ios_base& scientific (ios_base& str);
ll n, l;
cin >> n >> l;
ll min = l + 1 - 1;
ll minimum;
ll sum = min;
for (int i = 2; i <= n; i++) {
minimum = l + i - 1;
if (minimum < min)
min = minimum;
sum += minimum;
}
cout << sum - min;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// ios_base& scientific (ios_base& str);
ll n, l;
cin >> n >> l;
ll min = l + 1 - 1;
ll minimum;
ll sum = min;
for (int i = 2; i <= n; i++) {
minimum = l + i - 1;
if (abs(minimum) < abs(min))
min = minimum;
sum += minimum;
}
cout << sum - min;
return 0;
}
| [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"call.add"
] | 803,886 | 803,887 | u056663436 | cpp |
p02994 | #include <iostream>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int sum = 0;
if (L >= 0) {
for (int i = 2; i < N + 1; i++) {
sum += L + i - 1;
}
} else if ((L + N) < 0) {
for (int i = 1; i < N; i++) {
sum += L + i - 1;
}
} else {
for (int i = 1; i < N + 1; i++) {
sum += L + i - 1;
}
}
cout << sum << endl;
}
| #include <iostream>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int sum = 0;
if (L >= 0) {
for (int i = 2; i < N + 1; i++) {
sum += L + i - 1;
}
} else if ((L + N - 1) < 0) {
for (int i = 1; i < N; i++) {
sum += L + i - 1;
}
} else {
for (int i = 1; i < N + 1; i++) {
sum += L + i - 1;
}
}
cout << sum << endl;
}
| [
"control_flow.branch.if.condition.change"
] | 803,896 | 803,897 | u127364468 | cpp |
p02994 | #include <iostream>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int sum = 0;
if (L > 1) {
for (int i = 2; i < N + 1; i++) {
sum += L + i - 1;
}
} else if ((L + N - 1) < 0) {
for (int i = 1; i < N; i++) {
sum += L + i - 1;
}
} else {
for (int i = 1; i < N + 1; i++) {
sum += L + i - 1;
}
}
cout << sum << endl;
}
| #include <iostream>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int sum = 0;
if (L >= 0) {
for (int i = 2; i < N + 1; i++) {
sum += L + i - 1;
}
} else if ((L + N - 1) < 0) {
for (int i = 1; i < N; i++) {
sum += L + i - 1;
}
} else {
for (int i = 1; i < N + 1; i++) {
sum += L + i - 1;
}
}
cout << sum << endl;
}
| [] | 803,898 | 803,897 | u127364468 | cpp |
p02994 | #include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <math.h>
#include <stack>
#include <string>
#include <vector>
//#include<stdlib.h>
using namespace std;
int main() {
int n, l, a;
cin >> n >> l;
if (l >= 0) {
a = l * (n - 1) + n * (n - 1) / 2;
} else if (l + n - 1 <= 0) {
a = l * (n - 1) + n * (n - 1) / 2 - n;
} else {
a = l * n + n * (n - 1) / 2;
}
cout << a;
return 0;
} | #include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <math.h>
#include <stack>
#include <string>
#include <vector>
//#include<stdlib.h>
using namespace std;
int main() {
int n, l, a;
cin >> n >> l;
if (l >= 0) {
a = l * (n - 1) + n * (n - 1) / 2;
} else if (l + n - 1 <= 0) {
a = l * (n - 1) + n * (n - 1) / 2 - n + 1;
} else {
a = l * n + n * (n - 1) / 2;
}
cout << a;
return 0;
} | [
"assignment.change"
] | 803,907 | 803,908 | u468506413 | cpp |
p02994 | #include <bits/stdc++.h>
#define ll long long
#define fornum(A, B, C) for (A = B; A < C; A++)
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
/////////////////////////////////////////////////////
ll N, L;
ll i, ans;
int main() {
scanf("%lld%lld", &N, &L);
ans = N * L;
fornum(i, 1, N) { ans += i; }
if (L < 0) {
if (-L > N) {
ans -= (L + N - 1);
}
} else {
ans -= L;
}
printf("%lld", ans);
return 0;
} | #include <bits/stdc++.h>
#define ll long long
#define fornum(A, B, C) for (A = B; A < C; A++)
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
/////////////////////////////////////////////////////
ll N, L;
ll i, ans;
int main() {
scanf("%lld%lld", &N, &L);
ans = N * L;
fornum(i, 1, N) { ans += i; }
if (L < 0) {
if (-L >= N) {
ans -= (L + N - 1);
}
} else {
ans -= L;
}
printf("%lld", ans);
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,909 | 803,910 | u259396003 | cpp |
p02994 | #include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
typedef long long ll;
#define rep0(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define fill(x, y) memset(x, y, sizeof(x))
#define debug1(i) cout << i << '\n'
#define debug2(i, j) cout << i << j << '\n'
using namespace std;
int main() {
int n, m;
cin >> n >> m;
if (m >= 0) {
cout << (m + 1 + n + m - 1) * (n - 1) / 2;
} else {
if (m + n >= 0)
cout << (m + n + m - 1) * n / 2;
else
cout << (m + m + n - 2) * (n - 1) / 2;
}
} | #include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
typedef long long ll;
#define rep0(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define fill(x, y) memset(x, y, sizeof(x))
#define debug1(i) cout << i << '\n'
#define debug2(i, j) cout << i << j << '\n'
using namespace std;
int main() {
int n, m;
cin >> n >> m;
if (m >= 0) {
cout << (m + 1 + n + m - 1) * (n - 1) / 2;
} else {
if (m + n > 0)
cout << (m + n + m - 1) * n / 2;
else
cout << (m + m + n - 2) * (n - 1) / 2;
}
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,911 | 803,912 | u950603962 | cpp |
p02994 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define echo(A) cout << A << endl;
typedef long long llong;
int main() {
int N, L;
cin >> N >> L;
int dont_eat = 0;
int min = INT32_MAX;
int all_eat = 0;
for (int i = 0; i < N; ++i) {
all_eat += (L + i);
}
for (int i = 0; i < N; ++i) {
int sum = 0;
for (int j = 0; j < N; ++j) {
if (i == j)
continue;
sum += (L + j);
}
if (abs(sum - all_eat) < min) {
min = abs(sum - all_eat);
dont_eat = i;
}
}
echo(dont_eat + 1);
return 0;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define echo(A) cout << A << endl;
typedef long long llong;
int main() {
int N, L;
cin >> N >> L;
int dont_eat = 0;
int min = INT32_MAX;
int all_eat = 0;
for (int i = 0; i < N; ++i) {
all_eat += (L + i);
}
for (int i = 0; i < N; ++i) {
int sum = 0;
for (int j = 0; j < N; ++j) {
if (i == j)
continue;
sum += (L + j);
}
if (abs(sum - all_eat) < min) {
min = abs(sum - all_eat);
dont_eat = sum;
}
}
echo(dont_eat);
return 0;
}
| [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.remove"
] | 803,913 | 803,914 | u571053945 | cpp |
p02994 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) // for文マクロ
using namespace std;
typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア タイプでふ
int main() {
int N, L;
cin >> N >> L;
if (L > 0) {
cout << ((2 * L + N - 1) * N) / 2 - L;
} else if (L <= 0 && N + L + 1 >= 0) {
cout << ((2 * L + N - 1) * N) / 2;
} else {
cout << ((2 * L + N - 1) * N) / 2 - (L + N - 1);
}
}
| #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) // for文マクロ
using namespace std;
typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア タイプでふ
int main() {
int N, L;
cin >> N >> L;
if (L >= 0) {
cout << ((2 * L + N - 1) * N) / 2 - L;
} else if (L < 0 && N + L - 1 >= 0) {
cout << ((2 * L + N - 1) * N) / 2;
} else {
cout << ((2 * L + N - 1) * N) / 2 - (L + N - 1);
}
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"misc.opposites",
"expression.operator.arithmetic.change"
] | 803,915 | 803,916 | u369980487 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int A[201];
int main() {
int a, b, i, w = 0, m = 1e9, p;
cin >> a >> b;
for (i = 1; i <= a; i++) {
A[i] = b + i - 1, w += A[i];
if (abs(A[i]) < m)
p = i, m = A[i];
}
cout << w - A[p];
} | #include <bits/stdc++.h>
using namespace std;
int A[201];
int main() {
int a, b, i, w = 0, m = 1e9, p;
cin >> a >> b;
for (i = 1; i <= a; i++) {
A[i] = b + i - 1, w += A[i];
if (abs(A[i]) < m)
p = i, m = abs(A[i]);
}
cout << w - A[p];
} | [
"call.add",
"call.arguments.change"
] | 803,919 | 803,920 | u680068823 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
signed main() {
int n, l;
cin >> n >> l;
int ans = 0;
int kai;
for (int i = 1; i <= n; i++) {
if (i + l - 1 == 0) {
kai = 0;
break;
} else if (i == n) {
kai = 1;
}
}
if (kai == 0) {
for (int i = 1; i <= n; i++) {
ans += i + l - 1;
}
cout << ans << endl;
} else {
for (int i = 1; i <= n; i++) {
if (i == 1 && i + l - 1 >= 1) {
continue;
kai = 0;
}
if (kai == 1 && i == n) {
break;
}
ans += i + l - 1;
}
cout << ans << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
signed main() {
int n, l;
cin >> n >> l;
int ans = 0;
int kai;
for (int i = 1; i <= n; i++) {
if (i + l - 1 == 0) {
kai = 0;
break;
} else if (i == n) {
kai = 1;
}
}
if (kai == 0) {
for (int i = 1; i <= n; i++) {
ans += i + l - 1;
}
cout << ans << endl;
} else {
for (int i = 1; i <= n; i++) {
if (i == 1 && i + l - 1 >= 1) {
kai = 0;
continue;
}
if (kai == 1 && i == n) {
break;
}
ans += i + l - 1;
}
cout << ans << endl;
}
} | [] | 803,921 | 803,922 | u686352452 | cpp |
p02994 | /*
ID: thanhvq1
LANG: C++14
PROB: namenum
*/
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
//#define int long long
#define double long double
#define vec vector
#define vi vector<int>
#define vvi vector<vector<int>>
#define FZ(n) memset((n), 0, sizeof())
#define FMO(n) memset((n), -1, sizeof(n))
#define unset unordered_set
#define ii pair<int, int>
#define vii vector<ii>
#define F first
#define S second
#define PB push_back
#define ALL(x) begin(x), end(x)
#define SZ(x) ((int)(x).size())
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORE(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T, typename U>
std::pair<T, U> operator+(const std::pair<T, U> &l, const std::pair<T, U> &r) {
return {l.first + r.first, l.second + r.second};
}
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;
void FILEIO() {
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
}
// void FILEIO() { freopen("namenum.in", "r", stdin); freopen("namenum.out",
// "w", stdout); }
void input() {}
// global parameters here:
void solve() {
int n, l;
cin >> n >> l;
vi a(n + 1);
FORE(i, 1, n) a[i] = l + i - 1;
int sum = 0;
FORE(i, 1, n) sum += a[i];
int minV = INT_MAX, ans;
FORE(i, 1, n) {
int k = (int)abs(a[i]);
if (k < minV) {
minV = k;
ans = (int)abs(sum - a[i]);
}
}
cout << ans << endl;
}
//#undef int
signed main() {
//#define int long long
ios_base::sync_with_stdio(false);
cin.tie();
// FILEIO();
// auto beginProgram = chrono::steady_clock::now();
// int t; cin >> t;
// while(t--)
// {
// cout << aa << ", " << bb << endl;
solve();
// }
// auto endProgram = chrono::steady_clock::now();
return 0;
}
| /*
ID: thanhvq1
LANG: C++14
PROB: namenum
*/
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
//#define int long long
#define double long double
#define vec vector
#define vi vector<int>
#define vvi vector<vector<int>>
#define FZ(n) memset((n), 0, sizeof())
#define FMO(n) memset((n), -1, sizeof(n))
#define unset unordered_set
#define ii pair<int, int>
#define vii vector<ii>
#define F first
#define S second
#define PB push_back
#define ALL(x) begin(x), end(x)
#define SZ(x) ((int)(x).size())
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORE(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T, typename U>
std::pair<T, U> operator+(const std::pair<T, U> &l, const std::pair<T, U> &r) {
return {l.first + r.first, l.second + r.second};
}
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;
void FILEIO() {
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
}
// void FILEIO() { freopen("namenum.in", "r", stdin); freopen("namenum.out",
// "w", stdout); }
void input() {}
// global parameters here:
void solve() {
int n, l;
cin >> n >> l;
vi a(n + 1);
FORE(i, 1, n) a[i] = l + i - 1;
int sum = 0;
FORE(i, 1, n) sum += a[i];
int minV = INT_MAX, ans;
FORE(i, 1, n) {
int k = (int)abs(a[i]);
if (k < minV) {
minV = k;
ans = sum - a[i];
}
}
cout << ans << endl;
}
//#undef int
signed main() {
//#define int long long
ios_base::sync_with_stdio(false);
cin.tie();
// FILEIO();
// auto beginProgram = chrono::steady_clock::now();
// int t; cin >> t;
// while(t--)
// {
// cout << aa << ", " << bb << endl;
solve();
// }
// auto endProgram = chrono::steady_clock::now();
return 0;
}
| [
"call.arguments.change"
] | 803,940 | 803,941 | u210484769 | cpp |
p02994 | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
ll N, L;
cin >> N >> L;
int sum(0);
if (L >= 0) {
for (int i(L + 1); i < L + N; i++)
sum += i;
cout << sum << endl;
return 0;
} else if (L + N >= 0) {
for (int i(L); i < L + N; i++)
sum += i;
cout << sum << endl;
return 0;
} else {
for (int i(L); i < L + N - 1; i++)
sum += i;
cout << sum << endl;
return 0;
}
return 0;
}
| #include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
ll N, L;
cin >> N >> L;
int sum(0);
if (L >= 0) {
for (int i(L + 1); i < L + N; i++)
sum += i;
cout << sum << endl;
return 0;
} else if (L + N > 0) {
for (int i(L); i < L + N; i++)
sum += i;
cout << sum << endl;
return 0;
} else {
for (int i(L); i < L + N - 1; i++)
sum += i;
cout << sum << endl;
return 0;
}
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,942 | 803,943 | u991846372 | cpp |
p02994 | #include "bits/stdc++.h"
using namespace std;
int main() {
int n, l;
cin >> n >> l;
vector<int> aji(n);
int i = 1;
for (auto &&x : aji) {
x = l + i - 1;
i++;
}
int ans = 1e9;
int sa = 1e9;
for (int i = 0; i < n; i++) {
int Nnum = accumulate(aji.begin(), aji.end(), 0);
int N_num = Nnum - aji[i];
if (sa > Nnum - N_num) {
sa = Nnum - N_num;
ans = N_num;
}
}
cout << ans << endl;
return 0;
} | #include "bits/stdc++.h"
using namespace std;
int main() {
int n, l;
cin >> n >> l;
vector<int> aji(n);
int i = 1;
for (auto &&x : aji) {
x = l + i - 1;
i++;
}
int ans = 1e9;
int sa = 1e9;
for (int i = 0; i < n; i++) {
int Nnum = accumulate(aji.begin(), aji.end(), 0);
int N_num = Nnum - aji[i];
if (sa > abs(Nnum - N_num)) {
sa = abs(Nnum - N_num);
ans = N_num;
}
}
cout << ans << endl;
return 0;
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"call.add",
"call.arguments.change"
] | 803,944 | 803,945 | u395846213 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, l, sum = 0;
cin >> n >> l;
for (int i = 0; i < n; ++i) {
sum += i + l;
}
if (l >= 0) {
cout << sum - l << endl;
} else if (n >= l * -1) {
cout << sum << endl;
} else {
cout << sum - (l + n - 1) << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, l, sum = 0;
cin >> n >> l;
for (int i = 0; i < n; ++i) {
sum += i + l;
}
if (l >= 0) {
cout << sum - l << endl;
} else if (n > l * -1) {
cout << sum << endl;
} else {
cout << sum - (l + n - 1) << endl;
}
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,948 | 803,949 | u952865396 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, l, sum = 0;
cin >> n >> l;
for (int i = 0; i < n; ++i) {
sum += i + l;
}
if (l >= 0) {
cout << sum - l << endl;
} else if (n >= l) {
cout << sum << endl;
} else {
cout << sum - (l + n - 1) << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, l, sum = 0;
cin >> n >> l;
for (int i = 0; i < n; ++i) {
sum += i + l;
}
if (l >= 0) {
cout << sum - l << endl;
} else if (n > l * -1) {
cout << sum << endl;
} else {
cout << sum - (l + n - 1) << endl;
}
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,950 | 803,949 | u952865396 | cpp |
p02994 | #include <algorithm>
#include <cmath>
#include <complex>
#include <functional>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
// 英語は 26 文字
// common
namespace {
#define CAST(T, val) ((T)(val))
#define CASE(lb) \
break; \
case lb:
#define CASE_CONT(lb) case lb:
#define CASE_DEF \
break; \
default:
#define For(i, s) for (int i = 0, forEnd##i = CAST(int, s); i < forEnd##i; ++i)
#define ForA(i, a, s) \
for (int i = CAST(int, a), forEnd##i = CAST(int, s); i < forEnd##i; ++i)
#define ForR(i, s) for (int i = s; i >= 0; i--)
#define ForRA(i, s, e) for (int i = s; i >= e; i--)
#define ForItr(itr, con) \
for (auto itr = con.begin(), forEnd##itr = con.end(); itr != forEnd##itr; \
++itr)
#define ForRItr(itr, con) \
for (auto itr = con.rbegin(), forEnd##itr = con.rend(); itr != forEnd##itr; \
++itr)
#define ForStr(i, str) for (int i = 0; str[i]; ++i)
#define GOTO(lb) goto lb
#define LABEL(lb) \
lb:
#define ALL(con) (con).begin(), (con).end()
template <typename T, typename K> struct Pair {
T fst;
K snd;
bool operator<(const Pair &p) const {
if (fst != p.fst)
return fst < p.fst;
return snd < p.snd;
}
};
template <typename T, typename K>
std::istream &operator>>(std::istream &in, Pair<T, K> &p) {
return in >> p.fst >> p.snd;
}
template <typename T, typename K, typename H> struct Trir {
T fst;
K snd;
H trd;
bool operator<(const Trir &t) const {
if (fst != t.fst)
return fst < t.fst;
if (snd != t.snd)
return snd < t.snd;
return trd < t.trd;
}
};
template <typename T, typename K, typename H>
std::istream &operator>>(std::istream &in, Trir<T, K, H> &p) {
return in >> p.fst >> p.snd >> p.trd;
}
typedef long long xint;
typedef unsigned long long uxint;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef vector<int> Vi;
typedef vector<xint> Vx;
typedef vector<double> Vd;
typedef Pair<int, int> Pii;
typedef vector<Pii> VPii;
typedef Trir<int, int, int> Tiii;
typedef vector<Pii> VTiii;
const int Ten5 = 100000; // 10^5
const int Ten6 = 1000000; // 10^6
const double EPS = 0.00000000023283064365386962890625; // 2^-32
} // namespace
// min-max-mod
namespace {
// 合同式
class Mod {
public:
typedef xint T; // 型
static T N; // 法
Mod operator+(Mod m) const { return Mod(x + m.x); }
Mod operator+=(Mod m) { return *this = Mod(x + m.x); }
Mod operator-(Mod m) const { return Mod(x - m.x + N); }
Mod operator-=(Mod m) { return *this = Mod(x - m.x + N); }
Mod operator*(Mod m) const { return Mod(x * m.x); }
Mod operator*=(Mod m) { return *this = Mod(x * m.x); }
Mod operator/(
Mod m) const { // フェルマーの小定理より, m.x の逆元は m.x^( HOU-2 )
const T n = N - 2;
T v = m.x, r = x;
for (T b = 1; b < n; b <<= 1) {
if (n & b)
r = r * v % N;
v = v * v % N;
}
return r;
}
Mod operator/=(Mod m) { return *this = *this / m; }
operator T() const { return x; }
Mod() {}
Mod(T v) : x(v % N) {}
private:
T x;
};
Mod::T Mod::N = 1000 * 1000 * 1000 + 7;
// 最大値
template <typename T> class Max {
public:
// 何回更新したか
int cnt() const { return c; }
// 更新したときに true を返す
bool operator=(T v) {
if (!c) {
c = 1;
x = v;
return true;
}
if (x < v) {
c++;
x = v;
return true;
}
return false;
}
operator T() const { return x; }
Max() : x(0), c(0) {}
Max(T v) : x(v), c(1) {}
Max(const T *f, const T *l) : x(*f++), c(1) {
while (f < l) {
*this = *f++;
}
}
Max(const T *a, int n) : x(0), c(0) { For(i, n) *this = *a++; }
private:
T x;
int c;
};
// 最小値
template <typename T> class Min {
public:
// 何回更新したか
int cnt() const { return c; }
// 更新したときに true を返す
bool operator=(T v) {
if (!c) {
c = 1;
x = v;
return true;
}
if (v < x) {
c++;
x = v;
return true;
}
return false;
}
operator T() const { return x; }
Min() : x(0), c(0) {}
Min(T v) : x(v), c(1) {}
Min(const T *f, const T *l) : x(*f++), c(1) {
while (f < l) {
*this = *f++;
}
}
Min(const T *a, int n) : x(0), c(0) { For(i, n) *this = *a++; }
private:
T x;
int c;
};
template <typename T> Mod operator+(Mod m, T x) { return m + Mod(x); }
template <typename T> Mod operator+=(Mod &m, T x) { return m += Mod(x); }
template <typename T> Mod operator+(T x, Mod m) { return Mod(x) + m; }
template <typename T> Mod operator-(Mod m, T x) { return m - Mod(x); }
template <typename T> Mod operator-=(Mod &m, T x) { return m -= Mod(x); }
template <typename T> Mod operator-(T x, Mod m) { return Mod(x) - m; }
template <typename T> Mod operator*(Mod m, T x) { return m * Mod(x); }
template <typename T> Mod operator*=(Mod &m, T x) { return m *= Mod(x); }
template <typename T> Mod operator*(T x, Mod m) { return Mod(x) * m; }
template <typename T> Mod operator/(Mod m, T x) { return m / Mod(x); }
template <typename T> Mod operator/=(Mod &m, T x) { return m /= Mod(x); }
istream &operator>>(istream &in, Mod &m) {
Mod::T t;
in >> t;
m = Mod(t);
return in;
}
ostream &operator<<(ostream &ot, Mod m) { return ot << CAST(Mod::T, m); }
template <typename T> istream &operator>>(istream &in, Max<T> &m) {
T t;
in >> t;
m = Max<T>(t);
return in;
}
template <typename T> ostream &operator<<(ostream &ot, Max<T> m) {
return ot << CAST(T, m);
}
template <typename T> istream &operator>>(istream &in, Min<T> &m) {
T t;
in >> t;
m = Min<T>(t);
return in;
}
template <typename T> ostream &operator<<(ostream &ot, Min<T> m) {
return ot << CAST(T, m);
}
} // namespace
// vec
namespace {
// 2D int Vector
class Pint {
public:
int x, y;
static const Pint dir[8];
// util
static void setup(int width, int height, int offset = -1, bool swap = false) {
Width = width;
Height = height;
Offset = offset;
Swap = swap;
}
inline bool isInFld() const {
return 0 <= x && x < Width && 0 <= y && y < Height;
}
// vector
inline double len() const { return sqrt(sq()); }
inline double len(const Pint &p) const { return sqrt(sq(p)); }
inline int sq() const { return x * x + y * y; }
inline int sq(const Pint &p) const {
return (x - p.x) * (x - p.x) + (y - p.y) * (y - p.y);
}
inline int manhattan() const { return abs(x) + abs(y); }
inline int manhattan(const Pint &p) const {
return abs(x - p.x) + abs(y - p.y);
}
inline int dot(const Pint &p) const { return x * p.x + y * p.y; }
inline int crs(const Pint &p) const { return x * p.y - y * p.x; }
// opr, cst
inline Pint operator+() { return Pint(x, y); }
inline Pint operator-() { return Pint(-x, -y); }
inline Pint operator+(const Pint &p) const { return Pint(x + p.x, y + p.y); }
inline const Pint &operator+=(const Pint &p) {
x += p.x;
y += p.y;
return *this;
}
inline Pint operator-(const Pint &p) const { return Pint(x - p.x, y - p.y); }
inline const Pint &operator-=(const Pint &p) {
x -= p.x;
y -= p.y;
return *this;
}
inline Pint operator*(const Pint &p) const { return Pint(x * p.x, y * p.y); }
inline const Pint &operator*=(const Pint &p) {
x *= p.x;
y *= p.y;
return *this;
}
inline Pint operator/(const Pint &p) const { return Pint(x / p.x, y / p.y); }
inline const Pint &operator/=(const Pint &p) {
x /= p.x;
y /= p.y;
return *this;
}
inline Pint operator*(const int k) const { return Pint(x * k, y * k); }
inline const Pint &operator*=(const int k) {
x *= k;
y *= k;
return *this;
}
inline Pint operator/(const int k) const { return Pint(x / k, y / k); }
inline const Pint &operator/=(const int k) {
x /= k;
y /= k;
return *this;
}
inline bool operator<(const Pint &p) const {
return x == p.x ? y < p.y : x < p.x;
}
inline bool operator>(const Pint &p) const {
return x == p.x ? y > p.y : x > p.x;
}
inline bool operator==(const Pint &p) const { return x == p.x && y == p.y; }
inline bool operator!=(const Pint &p) const { return x != p.x || y != p.y; }
Pint() {}
Pint(const int x, const int y) : x(x), y(y) {}
private:
friend istream &operator>>(istream &in, Pint &p);
friend ostream &operator<<(ostream &out, const Pint &p);
static int Width, Height, Offset;
static bool Swap;
};
istream &operator>>(istream &in, Pint &p) {
int x, y;
in >> x >> y;
x += Pint::Offset;
y += Pint::Offset;
if (Pint::Swap)
p = Pint(y, x);
else
p = Pint(x, y);
return in;
}
ostream &operator<<(ostream &out, const Pint &p) {
return out << "( " << p.x << ", " << p.y << " )";
}
int Pint::Width, Pint::Height, Pint::Offset;
bool Pint::Swap;
const Pint Pint::dir[8] = {Pint(0, 1), Pint(1, 0), Pint(0, -1), Pint(-1, 0),
Pint(1, 1), Pint(1, -1), Pint(-1, 1), Pint(-1, -1)};
// 2D double Vector
class Pdouble {
public:
double x, y;
// vector
inline double len() const { return sqrt(sq()); }
inline double len(const Pdouble &p) const { return sqrt(sq(p)); }
inline double sq() const { return x * x + y * y; }
inline double sq(const Pdouble &p) const {
return (x - p.x) * (x - p.x) + (y - p.y) * (y - p.y);
}
inline Pdouble norm(const double l = 1.0) { return *this * l / len(); }
inline double dot(const Pdouble &p) const { return x * p.x + y * p.y; }
inline double crs(const Pdouble &p) const { return x * p.y - y * p.x; }
inline Pdouble proj(const Pdouble &v) const {
const double s = v.sq();
if (s < EPS * EPS)
return Pdouble(0, 0);
return v * dot(v) / s;
}
inline Pdouble rot(const double rad) const {
const double c = cos(rad), s = sin(rad);
return Pdouble(c * x - s * y, s * x + c * y);
}
// opr, cst
inline Pdouble operator+() { return Pdouble(x, y); }
inline Pdouble operator-() { return Pdouble(-x, -y); }
inline Pdouble operator+(const Pdouble &p) const {
return Pdouble(x + p.x, y + p.y);
}
inline const Pdouble &operator+=(const Pdouble &p) {
x += p.x;
y += p.y;
return *this;
}
inline Pdouble operator-(const Pdouble &p) const {
return Pdouble(x - p.x, y - p.y);
}
inline const Pdouble &operator-=(const Pdouble &p) {
x -= p.x;
y -= p.y;
return *this;
}
inline Pdouble operator*(const Pdouble &p) const {
return Pdouble(x * p.x, y * p.y);
}
inline const Pdouble &operator*=(const Pdouble &p) {
x *= p.x;
y *= p.y;
return *this;
}
inline Pdouble operator/(const Pdouble &p) const {
return Pdouble(x / p.x, y / p.y);
}
inline const Pdouble &operator/=(const Pdouble &p) {
x /= p.x;
y /= p.y;
return *this;
}
inline Pdouble operator*(const double k) const {
return Pdouble(x * k, y * k);
}
inline const Pdouble &operator*=(const double k) {
x *= k;
y *= k;
return *this;
}
inline Pdouble operator/(const double k) const {
return Pdouble(x / k, y / k);
}
inline const Pdouble &operator/=(const double k) {
x /= k;
y /= k;
return *this;
}
inline bool operator<(const Pdouble &p) const {
return x == p.x ? y < p.y : x < p.x;
}
inline bool operator>(const Pdouble &p) const {
return x == p.x ? y > p.y : x > p.x;
}
inline bool operator==(const Pdouble &p) const {
return x == p.x && y == p.y;
}
inline bool operator!=(const Pdouble &p) const {
return x != p.x || y != p.y;
}
Pdouble() {}
Pdouble(const double x, const double y) : x(x), y(y) {}
Pdouble(const Pint &p) : x(p.x), y(p.y) {}
};
istream &operator>>(istream &in, Pdouble &p) { return in >> p.x >> p.y; }
ostream &operator<<(ostream &out, const Pdouble &p) {
return out << "( " << p.x << ", " << p.y << " )";
}
// ( lP, lQ ) と ( nP, nQ ) の線分の交差判定
bool CollisionLine(const Pdouble lP, const Pdouble lQ, const Pdouble nP,
const Pdouble nQ) {
auto sign = [](double d) { return d < 0 ? -1 : d > 0 ? 1 : 0; };
Pdouble v = lQ - lP;
if (sign(v.crs(nP - lP)) == sign(v.crs(nQ - lQ)))
return false;
v = nQ - nP;
return sign(v.crs(lP - nP)) * sign(v.crs(lQ - nP)) <= 0;
}
} // namespace
// util
namespace {
// 座圧 O( N log N ). x に座圧後の座標が入る
void Zaatu(int *x, int N) {
map<int, int> map;
For(i, N) map.insert(
std::pair<int, int>(x[i], 0)); // sort すると順番が維持できない
int idx = 0;
ForItr(itr, map) itr->second = idx++;
For(i, N) x[i] = map[x[i]];
}
// double 出力
void DoubleOut(double d, char c = '\n') { printf("%.12f%c", d, c); }
} // namespace
int main() {
int N, L;
cin >> N >> L;
int sum = 0;
For(i, N) { sum += L + i; }
if (L >= 0) {
cout << sum - L << endl;
} else if (N + L >= 0) {
cout << sum << endl;
} else {
cout << sum - N - L + 1 << endl;
}
return 0;
}
| #include <algorithm>
#include <cmath>
#include <complex>
#include <functional>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
// 英語は 26 文字
// common
namespace {
#define CAST(T, val) ((T)(val))
#define CASE(lb) \
break; \
case lb:
#define CASE_CONT(lb) case lb:
#define CASE_DEF \
break; \
default:
#define For(i, s) for (int i = 0, forEnd##i = CAST(int, s); i < forEnd##i; ++i)
#define ForA(i, a, s) \
for (int i = CAST(int, a), forEnd##i = CAST(int, s); i < forEnd##i; ++i)
#define ForR(i, s) for (int i = s; i >= 0; i--)
#define ForRA(i, s, e) for (int i = s; i >= e; i--)
#define ForItr(itr, con) \
for (auto itr = con.begin(), forEnd##itr = con.end(); itr != forEnd##itr; \
++itr)
#define ForRItr(itr, con) \
for (auto itr = con.rbegin(), forEnd##itr = con.rend(); itr != forEnd##itr; \
++itr)
#define ForStr(i, str) for (int i = 0; str[i]; ++i)
#define GOTO(lb) goto lb
#define LABEL(lb) \
lb:
#define ALL(con) (con).begin(), (con).end()
template <typename T, typename K> struct Pair {
T fst;
K snd;
bool operator<(const Pair &p) const {
if (fst != p.fst)
return fst < p.fst;
return snd < p.snd;
}
};
template <typename T, typename K>
std::istream &operator>>(std::istream &in, Pair<T, K> &p) {
return in >> p.fst >> p.snd;
}
template <typename T, typename K, typename H> struct Trir {
T fst;
K snd;
H trd;
bool operator<(const Trir &t) const {
if (fst != t.fst)
return fst < t.fst;
if (snd != t.snd)
return snd < t.snd;
return trd < t.trd;
}
};
template <typename T, typename K, typename H>
std::istream &operator>>(std::istream &in, Trir<T, K, H> &p) {
return in >> p.fst >> p.snd >> p.trd;
}
typedef long long xint;
typedef unsigned long long uxint;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef vector<int> Vi;
typedef vector<xint> Vx;
typedef vector<double> Vd;
typedef Pair<int, int> Pii;
typedef vector<Pii> VPii;
typedef Trir<int, int, int> Tiii;
typedef vector<Pii> VTiii;
const int Ten5 = 100000; // 10^5
const int Ten6 = 1000000; // 10^6
const double EPS = 0.00000000023283064365386962890625; // 2^-32
} // namespace
// min-max-mod
namespace {
// 合同式
class Mod {
public:
typedef xint T; // 型
static T N; // 法
Mod operator+(Mod m) const { return Mod(x + m.x); }
Mod operator+=(Mod m) { return *this = Mod(x + m.x); }
Mod operator-(Mod m) const { return Mod(x - m.x + N); }
Mod operator-=(Mod m) { return *this = Mod(x - m.x + N); }
Mod operator*(Mod m) const { return Mod(x * m.x); }
Mod operator*=(Mod m) { return *this = Mod(x * m.x); }
Mod operator/(
Mod m) const { // フェルマーの小定理より, m.x の逆元は m.x^( HOU-2 )
const T n = N - 2;
T v = m.x, r = x;
for (T b = 1; b < n; b <<= 1) {
if (n & b)
r = r * v % N;
v = v * v % N;
}
return r;
}
Mod operator/=(Mod m) { return *this = *this / m; }
operator T() const { return x; }
Mod() {}
Mod(T v) : x(v % N) {}
private:
T x;
};
Mod::T Mod::N = 1000 * 1000 * 1000 + 7;
// 最大値
template <typename T> class Max {
public:
// 何回更新したか
int cnt() const { return c; }
// 更新したときに true を返す
bool operator=(T v) {
if (!c) {
c = 1;
x = v;
return true;
}
if (x < v) {
c++;
x = v;
return true;
}
return false;
}
operator T() const { return x; }
Max() : x(0), c(0) {}
Max(T v) : x(v), c(1) {}
Max(const T *f, const T *l) : x(*f++), c(1) {
while (f < l) {
*this = *f++;
}
}
Max(const T *a, int n) : x(0), c(0) { For(i, n) *this = *a++; }
private:
T x;
int c;
};
// 最小値
template <typename T> class Min {
public:
// 何回更新したか
int cnt() const { return c; }
// 更新したときに true を返す
bool operator=(T v) {
if (!c) {
c = 1;
x = v;
return true;
}
if (v < x) {
c++;
x = v;
return true;
}
return false;
}
operator T() const { return x; }
Min() : x(0), c(0) {}
Min(T v) : x(v), c(1) {}
Min(const T *f, const T *l) : x(*f++), c(1) {
while (f < l) {
*this = *f++;
}
}
Min(const T *a, int n) : x(0), c(0) { For(i, n) *this = *a++; }
private:
T x;
int c;
};
template <typename T> Mod operator+(Mod m, T x) { return m + Mod(x); }
template <typename T> Mod operator+=(Mod &m, T x) { return m += Mod(x); }
template <typename T> Mod operator+(T x, Mod m) { return Mod(x) + m; }
template <typename T> Mod operator-(Mod m, T x) { return m - Mod(x); }
template <typename T> Mod operator-=(Mod &m, T x) { return m -= Mod(x); }
template <typename T> Mod operator-(T x, Mod m) { return Mod(x) - m; }
template <typename T> Mod operator*(Mod m, T x) { return m * Mod(x); }
template <typename T> Mod operator*=(Mod &m, T x) { return m *= Mod(x); }
template <typename T> Mod operator*(T x, Mod m) { return Mod(x) * m; }
template <typename T> Mod operator/(Mod m, T x) { return m / Mod(x); }
template <typename T> Mod operator/=(Mod &m, T x) { return m /= Mod(x); }
istream &operator>>(istream &in, Mod &m) {
Mod::T t;
in >> t;
m = Mod(t);
return in;
}
ostream &operator<<(ostream &ot, Mod m) { return ot << CAST(Mod::T, m); }
template <typename T> istream &operator>>(istream &in, Max<T> &m) {
T t;
in >> t;
m = Max<T>(t);
return in;
}
template <typename T> ostream &operator<<(ostream &ot, Max<T> m) {
return ot << CAST(T, m);
}
template <typename T> istream &operator>>(istream &in, Min<T> &m) {
T t;
in >> t;
m = Min<T>(t);
return in;
}
template <typename T> ostream &operator<<(ostream &ot, Min<T> m) {
return ot << CAST(T, m);
}
} // namespace
// vec
namespace {
// 2D int Vector
class Pint {
public:
int x, y;
static const Pint dir[8];
// util
static void setup(int width, int height, int offset = -1, bool swap = false) {
Width = width;
Height = height;
Offset = offset;
Swap = swap;
}
inline bool isInFld() const {
return 0 <= x && x < Width && 0 <= y && y < Height;
}
// vector
inline double len() const { return sqrt(sq()); }
inline double len(const Pint &p) const { return sqrt(sq(p)); }
inline int sq() const { return x * x + y * y; }
inline int sq(const Pint &p) const {
return (x - p.x) * (x - p.x) + (y - p.y) * (y - p.y);
}
inline int manhattan() const { return abs(x) + abs(y); }
inline int manhattan(const Pint &p) const {
return abs(x - p.x) + abs(y - p.y);
}
inline int dot(const Pint &p) const { return x * p.x + y * p.y; }
inline int crs(const Pint &p) const { return x * p.y - y * p.x; }
// opr, cst
inline Pint operator+() { return Pint(x, y); }
inline Pint operator-() { return Pint(-x, -y); }
inline Pint operator+(const Pint &p) const { return Pint(x + p.x, y + p.y); }
inline const Pint &operator+=(const Pint &p) {
x += p.x;
y += p.y;
return *this;
}
inline Pint operator-(const Pint &p) const { return Pint(x - p.x, y - p.y); }
inline const Pint &operator-=(const Pint &p) {
x -= p.x;
y -= p.y;
return *this;
}
inline Pint operator*(const Pint &p) const { return Pint(x * p.x, y * p.y); }
inline const Pint &operator*=(const Pint &p) {
x *= p.x;
y *= p.y;
return *this;
}
inline Pint operator/(const Pint &p) const { return Pint(x / p.x, y / p.y); }
inline const Pint &operator/=(const Pint &p) {
x /= p.x;
y /= p.y;
return *this;
}
inline Pint operator*(const int k) const { return Pint(x * k, y * k); }
inline const Pint &operator*=(const int k) {
x *= k;
y *= k;
return *this;
}
inline Pint operator/(const int k) const { return Pint(x / k, y / k); }
inline const Pint &operator/=(const int k) {
x /= k;
y /= k;
return *this;
}
inline bool operator<(const Pint &p) const {
return x == p.x ? y < p.y : x < p.x;
}
inline bool operator>(const Pint &p) const {
return x == p.x ? y > p.y : x > p.x;
}
inline bool operator==(const Pint &p) const { return x == p.x && y == p.y; }
inline bool operator!=(const Pint &p) const { return x != p.x || y != p.y; }
Pint() {}
Pint(const int x, const int y) : x(x), y(y) {}
private:
friend istream &operator>>(istream &in, Pint &p);
friend ostream &operator<<(ostream &out, const Pint &p);
static int Width, Height, Offset;
static bool Swap;
};
istream &operator>>(istream &in, Pint &p) {
int x, y;
in >> x >> y;
x += Pint::Offset;
y += Pint::Offset;
if (Pint::Swap)
p = Pint(y, x);
else
p = Pint(x, y);
return in;
}
ostream &operator<<(ostream &out, const Pint &p) {
return out << "( " << p.x << ", " << p.y << " )";
}
int Pint::Width, Pint::Height, Pint::Offset;
bool Pint::Swap;
const Pint Pint::dir[8] = {Pint(0, 1), Pint(1, 0), Pint(0, -1), Pint(-1, 0),
Pint(1, 1), Pint(1, -1), Pint(-1, 1), Pint(-1, -1)};
// 2D double Vector
class Pdouble {
public:
double x, y;
// vector
inline double len() const { return sqrt(sq()); }
inline double len(const Pdouble &p) const { return sqrt(sq(p)); }
inline double sq() const { return x * x + y * y; }
inline double sq(const Pdouble &p) const {
return (x - p.x) * (x - p.x) + (y - p.y) * (y - p.y);
}
inline Pdouble norm(const double l = 1.0) { return *this * l / len(); }
inline double dot(const Pdouble &p) const { return x * p.x + y * p.y; }
inline double crs(const Pdouble &p) const { return x * p.y - y * p.x; }
inline Pdouble proj(const Pdouble &v) const {
const double s = v.sq();
if (s < EPS * EPS)
return Pdouble(0, 0);
return v * dot(v) / s;
}
inline Pdouble rot(const double rad) const {
const double c = cos(rad), s = sin(rad);
return Pdouble(c * x - s * y, s * x + c * y);
}
// opr, cst
inline Pdouble operator+() { return Pdouble(x, y); }
inline Pdouble operator-() { return Pdouble(-x, -y); }
inline Pdouble operator+(const Pdouble &p) const {
return Pdouble(x + p.x, y + p.y);
}
inline const Pdouble &operator+=(const Pdouble &p) {
x += p.x;
y += p.y;
return *this;
}
inline Pdouble operator-(const Pdouble &p) const {
return Pdouble(x - p.x, y - p.y);
}
inline const Pdouble &operator-=(const Pdouble &p) {
x -= p.x;
y -= p.y;
return *this;
}
inline Pdouble operator*(const Pdouble &p) const {
return Pdouble(x * p.x, y * p.y);
}
inline const Pdouble &operator*=(const Pdouble &p) {
x *= p.x;
y *= p.y;
return *this;
}
inline Pdouble operator/(const Pdouble &p) const {
return Pdouble(x / p.x, y / p.y);
}
inline const Pdouble &operator/=(const Pdouble &p) {
x /= p.x;
y /= p.y;
return *this;
}
inline Pdouble operator*(const double k) const {
return Pdouble(x * k, y * k);
}
inline const Pdouble &operator*=(const double k) {
x *= k;
y *= k;
return *this;
}
inline Pdouble operator/(const double k) const {
return Pdouble(x / k, y / k);
}
inline const Pdouble &operator/=(const double k) {
x /= k;
y /= k;
return *this;
}
inline bool operator<(const Pdouble &p) const {
return x == p.x ? y < p.y : x < p.x;
}
inline bool operator>(const Pdouble &p) const {
return x == p.x ? y > p.y : x > p.x;
}
inline bool operator==(const Pdouble &p) const {
return x == p.x && y == p.y;
}
inline bool operator!=(const Pdouble &p) const {
return x != p.x || y != p.y;
}
Pdouble() {}
Pdouble(const double x, const double y) : x(x), y(y) {}
Pdouble(const Pint &p) : x(p.x), y(p.y) {}
};
istream &operator>>(istream &in, Pdouble &p) { return in >> p.x >> p.y; }
ostream &operator<<(ostream &out, const Pdouble &p) {
return out << "( " << p.x << ", " << p.y << " )";
}
// ( lP, lQ ) と ( nP, nQ ) の線分の交差判定
bool CollisionLine(const Pdouble lP, const Pdouble lQ, const Pdouble nP,
const Pdouble nQ) {
auto sign = [](double d) { return d < 0 ? -1 : d > 0 ? 1 : 0; };
Pdouble v = lQ - lP;
if (sign(v.crs(nP - lP)) == sign(v.crs(nQ - lQ)))
return false;
v = nQ - nP;
return sign(v.crs(lP - nP)) * sign(v.crs(lQ - nP)) <= 0;
}
} // namespace
// util
namespace {
// 座圧 O( N log N ). x に座圧後の座標が入る
void Zaatu(int *x, int N) {
map<int, int> map;
For(i, N) map.insert(
std::pair<int, int>(x[i], 0)); // sort すると順番が維持できない
int idx = 0;
ForItr(itr, map) itr->second = idx++;
For(i, N) x[i] = map[x[i]];
}
// double 出力
void DoubleOut(double d, char c = '\n') { printf("%.12f%c", d, c); }
} // namespace
int main() {
int N, L;
cin >> N >> L;
int sum = 0;
For(i, N) { sum += L + i; }
if (L >= 0) {
cout << sum - L << endl;
} else if (N + L - 1 >= 0) {
cout << sum << endl;
} else {
cout << sum - N - L + 1 << endl;
}
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 803,959 | 803,960 | u453246394 | cpp |
p02994 | #include <algorithm>
#include <climits>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define MAX 1000000007
using namespace std;
#define ll long long
#define dbg if (0)
#define ISRANGE(val, lo, hi) ((lo <= val) && (val < hi))
int main() {
ll ans, n, l;
ll sum = 0;
ll ate = MAX;
cin >> n >> l;
for (int i = 0; i < n; i++) {
sum += l + i;
if (abs(l + i) < abs(ate))
ate = l - i;
}
sum -= ate;
cout << sum << endl;
return 0;
} | #include <algorithm>
#include <climits>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define MAX 1000000007
using namespace std;
#define ll long long
#define dbg if (0)
#define ISRANGE(val, lo, hi) ((lo <= val) && (val < hi))
int main() {
ll ans, n, l;
ll sum = 0;
ll ate = MAX;
cin >> n >> l;
for (int i = 0; i < n; i++) {
sum += l + i;
if (abs(l + i) < abs(ate))
ate = l + i;
}
sum -= ate;
cout << sum << endl;
return 0;
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 803,963 | 803,964 | u828752458 | cpp |
p02994 | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdlib.h>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;
int main() {
int n, l, num = 1e9, ans = 0;
cin >> n >> l;
for (int i = 1; i <= n; i++) {
int x = l + i - 1;
ans += x;
if (abs(x) < num)
num = x;
}
cout << ans - num;
} | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdlib.h>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;
int main() {
int n, l, num = 1e9, ans = 0;
cin >> n >> l;
for (int i = 1; i <= n; i++) {
int x = l + i - 1;
ans += x;
if (abs(x) < abs(num))
num = x;
}
cout << ans - num;
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"call.add"
] | 803,965 | 803,966 | u937608388 | cpp |
p02994 | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
int n, l, tmp = inf, total;
int main() {
cin >> n >> l;
rep(i, n) {
total += l + i;
if (abs(tmp) > abs(l + 1)) {
tmp = l + i;
}
}
cout << total - tmp << endl;
return 0;
} | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
int n, l, tmp = inf, total;
int main() {
cin >> n >> l;
rep(i, n) {
total += l + i;
if (abs(tmp) > abs(l + i)) {
tmp = l + i;
}
}
cout << total - tmp << endl;
return 0;
}
| [
"identifier.replace.add",
"literal.replace.remove",
"control_flow.branch.if.condition.change"
] | 803,969 | 803,970 | u519950235 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int N, L;
int main() {
scanf("%d%d", &N, &L);
int first = L, last = N + L - 1, ans;
ans = (first + last) / 2 * N;
if (first > 0) {
ans -= first;
}
if (last < 0) {
ans -= last;
}
printf("%d\n", ans);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int N, L;
int main() {
scanf("%d%d", &N, &L);
int first = L, last = N + L - 1, ans;
ans = (first + last) * N / 2;
if (first > 0) {
ans -= first;
}
if (last < 0) {
ans -= last;
}
printf("%d\n", ans);
return 0;
} | [
"expression.operation.binary.remove",
"assignment.change"
] | 803,971 | 803,972 | u067304758 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e9;
const int MOD = INF + 7;
#define rep(i, N) for (int(i) = 0; (i) < (N); ++(i))
#define rrep(i, N) for (int(i) = (N - 1); (i) > 0; --i)
#define FOR(i, j, N) for (int(i) = (j); (i) < (N); ++(i))
#define put(n) cout << (n) << endl;
#define all(v) v.rbegin(), v.rend()
#define MP make_pair
#define pb push_back
using P = pair<int, int>;
// b
signed main() {
int N, L;
cin >> N >> L;
int MIN = 1e9;
int ans = 0;
bool c = false;
for (int i = 1; i <= N; i++) {
ans += L + i - 1;
}
if (L > 0) {
ans -= L;
}
if (abs(L - 1) > N)
ans -= (L + N - 1);
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e9;
const int MOD = INF + 7;
#define rep(i, N) for (int(i) = 0; (i) < (N); ++(i))
#define rrep(i, N) for (int(i) = (N - 1); (i) > 0; --i)
#define FOR(i, j, N) for (int(i) = (j); (i) < (N); ++(i))
#define put(n) cout << (n) << endl;
#define all(v) v.rbegin(), v.rend()
#define MP make_pair
#define pb push_back
using P = pair<int, int>;
// b
signed main() {
int N, L;
cin >> N >> L;
int MIN = 1e9;
int ans = 0;
bool c = false;
for (int i = 1; i <= N; i++) {
ans += L + i - 1;
}
if (L > 0) {
ans -= L;
} else if (abs(L - 1) > N)
ans -= (L + N - 1);
cout << ans << endl;
}
| [
"control_flow.branch.else_if.replace.add",
"control_flow.branch.if.replace.remove"
] | 803,973 | 803,974 | u031178961 | cpp |
p02994 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/timeb.h>
#include <vector>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (ll NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (ll NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (ll NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll LINF = 1e18;
const int INF = 1e9;
const int mod = 1e9 + 7;
int main() {
int n, k, sum = 0, ans;
int mina = INF;
cin >> n >> k;
vector<int> a(n);
REP(i, n) {
a[i] = k + i;
sum += a[i];
if (abs(a[i]) < mina)
mina = abs(a[i]);
ans = a[i];
}
cout << sum - ans << endl;
}
| #include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/timeb.h>
#include <vector>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (ll NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (ll NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (ll NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll LINF = 1e18;
const int INF = 1e9;
const int mod = 1e9 + 7;
int main() {
int n, k, sum = 0, ans;
int mina = INF;
cin >> n >> k;
vector<int> a(n);
REP(i, n) {
a[i] = k + i;
sum += a[i];
if (abs(a[i]) < mina) {
mina = abs(a[i]);
ans = a[i];
}
}
cout << sum - ans << endl;
}
| [] | 803,977 | 803,978 | u916256067 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, i, j, k, mn = 10000, mx = -10000, sum = 0;
int l;
scanf("%d %d", &n, &l);
for (i = 1; i <= n; i++) {
k = l + i - 1;
sum += k;
if (k < 0)
k = -k;
if (k < mn)
mn = k;
}
if (sum > 0)
sum -= k;
if (sum < 0)
sum += k;
printf("%d\n", sum);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, i, j, k, mn = 10000, mx = -10000, sum = 0;
int l;
scanf("%d %d", &n, &l);
for (i = 1; i <= n; i++) {
k = l + i - 1;
sum += k;
if (k < 0)
k = -k;
if (k < mn)
mn = k;
}
if (sum >= 0)
sum -= mn;
if (sum < 0)
sum += mn;
printf("%d\n", sum);
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"assignment.value.change",
"identifier.change"
] | 803,979 | 803,980 | u284011817 | cpp |
p02994 | #include <cmath>
#include <iostream>
using namespace std;
int main() {
int N;
int L;
cin >> N >> L;
int sum = 0;
int diff = L;
for (int i = 1; i <= N; i++) {
sum += L + i - 1;
if (diff > abs(L + i - 1)) {
diff = L + i - 1;
}
}
cout << sum - diff << endl;
} | #include <cmath>
#include <iostream>
using namespace std;
int main() {
int N;
int L;
cin >> N >> L;
int sum = 0;
int diff = L;
for (int i = 1; i <= N; i++) {
sum += L + i - 1;
if (abs(diff) > abs(L + i - 1)) {
diff = L + i - 1;
}
}
cout << sum - diff << endl;
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"call.add"
] | 803,987 | 803,988 | u175224511 | cpp |
p02994 | #include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <stdlib.h>
#define ll long long
const int INF = 0x3f3f3f3f;
#define mod 1000000007
using namespace std;
// priority_queue
int s[300];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++)
s[i] = i;
int m;
cin >> m;
m--;
for (int i = 1; i <= n; i++)
s[i] += m;
sort(s + 1, s + 1 + n);
int sum = 0;
int ma = s[1];
for (int i = 1; i <= n; i++) {
sum += s[i];
if (s[i] < 0)
ma = max(ma, s[i]);
}
cout << sum - ma << endl;
}
| #include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <stdlib.h>
#define ll long long
const int INF = 0x3f3f3f3f;
#define mod 1000000007
using namespace std;
// priority_queue
int s[300];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++)
s[i] = i;
int m;
cin >> m;
m--;
for (int i = 1; i <= n; i++)
s[i] += m;
sort(s + 1, s + 1 + n);
int sum = 0;
int ma = s[1];
for (int i = 1; i <= n; i++) {
sum += s[i];
if (s[i] <= 0)
ma = max(ma, s[i]);
}
cout << sum - ma << endl;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 803,999 | 804,000 | u916695530 | cpp |
p02994 | #define _CRT_SECURE_NO_WARNINGS
/* include ***********************/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* define *************************/
// for
#define REP(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define REPS(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define RREP(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define RREPS(i, n) for (int i = (int)(n); i > 0; i--)
#define FOR(i, s, n) \
for (int i = (int)(s), i##_len = (int)(n); i < i##_len; i++)
#define RFOR(i, s, n) \
for (int i = (int)(n)-1, i##_len = (int)(s); i >= i##_len; i--)
// printf
#define PRINTD(d) printf("%d\n", (d))
#define PRINTL(d) printf("%lld\n", (d))
// memset
#define m0(s) memset(s, 0, sizeof(s))
#define ml(s) memset(s, 63, sizeof(s))
#define fill(s, c) memset(s, c, sizeof(s))
#define INF 1e9
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
int diff[4][2] = {
{0, -1},
{-1, 0},
{1, 0},
{0, 1},
};
//今回の変数
int Min(int a, int b) { return (a) < (b) ? (a) : (b); }
int Max(int a, int b) { return (a) > (b) ? (a) : (b); }
ll Minl(ll a, ll b) { return (a) < (b) ? (a) : (b); }
ll Maxl(ll a, ll b) { return (a) > (b) ? (a) : (b); }
int main() {
int n, l;
scanf("%d%d", &n, &l);
int ans = 0;
if (l >= 0) {
FOR(i, l, l + n) { ans += i; }
if (l != 0)
ans -= l;
} else {
FOR(i, l, l + n) { ans += i; }
if (l + n < 0)
ans -= l + n - 1;
}
PRINTD(ans);
}
| #define _CRT_SECURE_NO_WARNINGS
/* include ***********************/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* define *************************/
// for
#define REP(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define REPS(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define RREP(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define RREPS(i, n) for (int i = (int)(n); i > 0; i--)
#define FOR(i, s, n) \
for (int i = (int)(s), i##_len = (int)(n); i < i##_len; i++)
#define RFOR(i, s, n) \
for (int i = (int)(n)-1, i##_len = (int)(s); i >= i##_len; i--)
// printf
#define PRINTD(d) printf("%d\n", (d))
#define PRINTL(d) printf("%lld\n", (d))
// memset
#define m0(s) memset(s, 0, sizeof(s))
#define ml(s) memset(s, 63, sizeof(s))
#define fill(s, c) memset(s, c, sizeof(s))
#define INF 1e9
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
int diff[4][2] = {
{0, -1},
{-1, 0},
{1, 0},
{0, 1},
};
//今回の変数
int Min(int a, int b) { return (a) < (b) ? (a) : (b); }
int Max(int a, int b) { return (a) > (b) ? (a) : (b); }
ll Minl(ll a, ll b) { return (a) < (b) ? (a) : (b); }
ll Maxl(ll a, ll b) { return (a) > (b) ? (a) : (b); }
int main() {
int n, l;
scanf("%d%d", &n, &l);
int ans = 0;
if (l >= 0) {
FOR(i, l, l + n) { ans += i; }
if (l != 0)
ans -= l;
} else {
FOR(i, l, l + n) { ans += i; }
if (l + n - 1 < 0)
ans -= l + n - 1;
}
PRINTD(ans);
}
| [
"control_flow.branch.if.condition.change"
] | 804,005 | 804,006 | u539339654 | cpp |
p02994 | #include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n) \
for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX / 2;
const ll MOD = 1e9 + 7;
const double EPS = 1e-12;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll N, L;
cin >> N >> L;
ll ans = L * N + N * (N - 1) / 2;
if (L > 0)
ans -= L;
if (L < -N)
ans -= L + N - 1;
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n) \
for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX / 2;
const ll MOD = 1e9 + 7;
const double EPS = 1e-12;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll N, L;
cin >> N >> L;
ll ans = L * N + N * (N - 1) / 2;
if (L > 0)
ans -= L;
if (L < -N + 1)
ans -= L + N - 1;
cout << ans << endl;
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 804,009 | 804,010 | u120143737 | cpp |
p02994 | #include <iostream>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int answer = n * (n - 1) / 2 + n * l;
if (l > 0) {
answer -= l;
} else if (l + n < 0) {
answer -= l + n - 1;
}
cout << answer << endl;
}
| #include <iostream>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int answer = n * (n - 1) / 2 + n * l;
if (l > 0) {
answer -= l;
} else if (l + n <= 0) {
answer -= l + n - 1;
}
cout << answer << endl;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 804,014 | 804,015 | u532096498 | cpp |
p02994 | #include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
using namespace std;
using ll = long long int;
int main() {
ll N, L;
cin >> N >> L;
ll sum = 0;
for (ll i = 0; i < N; ++i) {
sum += L + i;
}
if (L >= 0) {
sum -= N;
} else if (L + N - 1 <= 0) {
sum -= (L + N - 1);
}
cout << sum << endl;
}
| #include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
using namespace std;
using ll = long long int;
int main() {
ll N, L;
cin >> N >> L;
ll sum = 0;
for (ll i = 0; i < N; ++i) {
sum += L + i;
}
if (L >= 0) {
sum -= L;
} else if (L + N - 1 <= 0) {
sum -= (L + N - 1);
}
cout << sum << endl;
}
| [
"assignment.value.change",
"identifier.change"
] | 804,016 | 804,017 | u898335619 | cpp |
p02994 | #include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
using namespace std;
using ll = long long int;
int main() {
ll N, L;
cin >> N >> L;
ll sum = 0;
for (ll i = 0; i < N; ++i) {
sum += L + i;
}
if (N >= 0) {
sum -= N;
} else if (L + N - 1 <= 0) {
sum -= (L + N - 1);
}
cout << sum << endl;
}
| #include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
using namespace std;
using ll = long long int;
int main() {
ll N, L;
cin >> N >> L;
ll sum = 0;
for (ll i = 0; i < N; ++i) {
sum += L + i;
}
if (L >= 0) {
sum -= L;
} else if (L + N - 1 <= 0) {
sum -= (L + N - 1);
}
cout << sum << endl;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change",
"assignment.value.change"
] | 804,018 | 804,017 | u898335619 | cpp |
p02994 | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
typedef long long ll;
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int my_sum = l * n + (n * (n - 1)) / 2;
bool cnd = true;
for (int i = 0; i < n; ++i) {
if (l + i >= 0) {
cnd = true;
my_sum -= (l + i);
cnd = false;
}
}
if (cnd)
my_sum -= l + n - 1;
cout << my_sum << endl;
return 0;
}
| #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
typedef long long ll;
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int my_sum = l * n + (n * (n - 1)) / 2;
bool cnd = true;
for (int i = 0; i < n; ++i) {
if (l + i >= 0) {
cnd = false;
my_sum -= (l + i);
break;
}
}
if (cnd)
my_sum -= l + n - 1;
cout << my_sum << endl;
return 0;
}
| [
"misc.opposites",
"assignment.value.change",
"assignment.change"
] | 804,019 | 804,020 | u299843956 | cpp |
p02994 | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define MOD 1000000007
#define rep(i, k, N) for (int i = k; i < N; i++)
#define MP make_pair
#define MT make_tuple // tie,make_tuple は別物
#define PB push_back
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
int N, L;
cin >> N >> L;
long long sum = 0;
rep(i, 1, N + 1) { sum += (L + i - 1); }
if (L > 0) {
cout << sum - L;
} else if (N + L + 1 >= 0) {
cout << sum;
} else {
cout << sum - (N + L - 1);
}
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define MOD 1000000007
#define rep(i, k, N) for (int i = k; i < N; i++)
#define MP make_pair
#define MT make_tuple // tie,make_tuple は別物
#define PB push_back
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
int N, L;
cin >> N >> L;
long long sum = 0;
rep(i, 1, N + 1) { sum += (L + i - 1); }
if (L > 0) {
cout << sum - L;
} else if (N + L - 1 >= 0) {
cout << sum;
} else {
cout << sum - (N + L - 1);
}
return 0;
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 804,026 | 804,027 | u859125915 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int N, L;
cin >> N >> L;
int ans;
if (L > 0) {
ans = (2 * L + N) * (N - 1) / 2;
} else if (L + N - 1 < 0) {
ans = (2 * L + N - 2) * (N - 1) / 2;
} else {
ans = (2 * L + N - 1) * (N - 1) / 2;
}
printf("%d\n", ans);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main(void) {
int N, L;
cin >> N >> L;
int ans;
if (L > 0) {
ans = (2 * L + N) * (N - 1) / 2;
} else if (L + N - 1 < 0) {
ans = (2 * L + N - 2) * (N - 1) / 2;
} else {
ans = (2 * L + N - 1) * N / 2;
}
printf("%d\n", ans);
return 0;
}
| [] | 804,028 | 804,029 | u464540027 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int ans = (N * L) + (N * (N + 1) / 2) - N;
ans -= L - 1;
if (L <= -N)
ans -= N;
else if (L <= 0)
ans -= N + L;
else
ans -= L - 1;
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int ans = (N * L) + (N * (N + 1) / 2) - N;
ans -= L - 1;
if (L <= -N)
ans -= N;
else if (L <= 0)
ans -= 1 - L;
else
ans -= 1;
cout << ans << endl;
}
| [
"expression.operation.binary.remove"
] | 804,030 | 804,031 | u792217717 | cpp |
p02994 | #include <bits/stdc++.h>
#define rt "\n"
#define sp " "
#define test1 cout << "test1" << endl;
#define test2 cout << "test2" << endl;
#define fixprecision(n) \
fixed; \
cout << setprecision(n)
#define kyopro \
ios::sync_with_stdio(false); \
cin.tie(NULL);
#define MOD 1000000007
#define rep(i, s, N) for (ll i{s}; i < N; i++)
#define iikae auto &
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
int main() {
kyopro;
ll N, L;
cin >> N >> L;
ll sum{};
if (L <= 0 && N + L > 0)
;
else if (N + L < 0)
sum -= N + L - 1;
else if (L > 0)
sum -= L;
rep(i, L, N + L) sum += i;
cout << sum << rt;
} | #include <bits/stdc++.h>
#define rt "\n"
#define sp " "
#define test1 cout << "test1" << endl;
#define test2 cout << "test2" << endl;
#define fixprecision(n) \
fixed; \
cout << setprecision(n)
#define kyopro \
ios::sync_with_stdio(false); \
cin.tie(NULL);
#define MOD 1000000007
#define rep(i, s, N) for (ll i{s}; i < N; i++)
#define iikae auto &
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
int main() {
kyopro;
ll N, L;
cin >> N >> L;
ll sum{};
if (L <= 0 && N + L - 1 >= 0)
;
else if (N + L - 1 < 0)
sum -= N + L - 1;
else if (L > 0)
sum -= L;
rep(i, L, N + L) sum += i;
cout << sum << rt;
} | [
"control_flow.branch.if.condition.change"
] | 804,032 | 804,033 | u936790121 | cpp |
p02994 | /*Lucky_Glass*/
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
int main() {
int n, m;
scanf("%d%d", &n, &m);
if (m <= 0 && m + n >= 0)
printf("%d\n", (m + n - 1 + m) * n / 2);
else {
if (m + n < 0)
printf("%d\n", (m + n - 2 + m) * (n - 1) / 2);
else
printf("%d\n", (m + 1 + m + n - 1) * (n - 1) / 2);
}
return 0;
} | /*Lucky_Glass*/
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
int main() {
int n, m;
scanf("%d%d", &n, &m);
if (m <= 0 && m + n - 1 >= 0)
printf("%d\n", (m + n - 1 + m) * n / 2);
else {
if (m + n - 1 < 0)
printf("%d\n", (m + n - 2 + m) * (n - 1) / 2);
else
printf("%d\n", (m + 1 + m + n - 1) * (n - 1) / 2);
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 804,036 | 804,037 | u414712570 | cpp |
p02994 | #include <bits/stdc++.h>
#define inf 0x6fffffff
using namespace std;
const int N = 5e6 + 10;
typedef long long ll;
int read() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + ch - '0';
ch = getchar();
}
return x * f;
}
int main() {
int n = read(), l = read();
int mn = inf, now;
ll sum = 0;
for (int i = 1; i <= n; i++) {
int x = i + l - 1;
mn = min(abs(x), mn);
if (abs(mn) == x)
now = x;
sum += x;
}
sum -= now;
cout << sum << endl;
} | #include <bits/stdc++.h>
#define inf 0x6fffffff
using namespace std;
const int N = 5e6 + 10;
typedef long long ll;
int read() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + ch - '0';
ch = getchar();
}
return x * f;
}
int main() {
int n = read(), l = read();
int mn = inf, now;
ll sum = 0;
for (int i = 1; i <= n; i++) {
int x = i + l - 1;
mn = min(abs(x), mn);
if (abs(mn) == abs(x))
now = x;
sum += x;
}
sum -= now;
cout << sum << endl;
return 0;
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"call.add",
"control_flow.return.add",
"control_flow.return.0.add"
] | 804,038 | 804,039 | u550756195 | cpp |
p02994 | #include <iostream>
using namespace std;
int n, l;
int main() {
cin >> n >> l;
if (0 < l)
cout << (n - 1) * (2 * l + n) / 2;
else if (l + n - 1 < 0)
cout << (n - 1) * (2 * l + n - 2) / 2;
else
cout << (n - 1) * (2 * l + n - 1) / 2;
} | #include <iostream>
using namespace std;
int n, l;
int main() {
cin >> n >> l;
if (0 < l)
cout << (n - 1) * (2 * l + n) / 2;
else if (l + n - 1 < 0)
cout << (n - 1) * (2 * l + n - 2) / 2;
else
cout << n * (2 * l + n - 1) / 2;
} | [] | 804,040 | 804,041 | u486908386 | cpp |
p02994 | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define INF (1 << 29)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define uniq(v) v.erase(unique(all(v)), v.end())
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int N, L;
cin >> N >> L;
int ans = 0;
rep(i, N) { ans += L + i; }
if (0 <= L) {
ans -= L;
} else if (0 <= N + L + 1) {
} else {
ans -= N + L - 1;
}
cout << ans << endl;
return 0;
} | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define INF (1 << 29)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define uniq(v) v.erase(unique(all(v)), v.end())
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int N, L;
cin >> N >> L;
int ans = 0;
rep(i, N) { ans += L + i; }
if (0 <= L) {
ans -= L;
} else if (0 <= N + L - 1) {
} else {
ans -= N + L - 1;
}
cout << ans << endl;
return 0;
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 804,042 | 804,043 | u085110627 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int mini = 30000;
int minus;
int sum = 0;
for (int i = 1; i <= n; i++) {
sum += l + i - 1;
if (abs(l + i - 1) < mini) {
mini = abs(l + i - 1);
minus = l + i - 1;
}
}
cout << sum - mini;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int mini = 30000;
int minus;
int sum = 0;
for (int i = 1; i <= n; i++) {
sum += l + i - 1;
if (abs(l + i - 1) < mini) {
mini = abs(l + i - 1);
minus = l + i - 1;
}
}
cout << sum - minus;
}
| [
"identifier.change",
"io.output.change"
] | 804,049 | 804,050 | u885523920 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int total = N * (L - 1);
for (int i = 1; i < N + 1; i++) {
total = total + i;
}
if (L < 0 && L + N - 1 > 0) {
cout << total << endl;
} else if (L > 0 && L + N - 1 > 0) {
cout << total - L << endl;
} else if (L < 0 && L + N - 1 < 0) {
cout << total - (L + N - 1) << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int total = N * (L - 1);
for (int i = 1; i < N + 1; i++) {
total = total + i;
}
if (L <= 0 && L + N - 1 >= 0) {
cout << total << endl;
} else if (L > 0 && L + N - 1 > 0) {
cout << total - L << endl;
} else if (L < 0 && L + N - 1 < 0) {
cout << total - (L + N - 1) << endl;
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 804,051 | 804,052 | u453634104 | cpp |
p02994 | #include <iostream>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int a[n] = {};
for (int i = 1; i <= n; i++) {
a[i - 1] = l + i - 1;
}
int sum = 0;
for (int j = 1; j <= n; j++) {
sum = sum + a[j - 1];
}
if (a[0] > 0) {
cout << sum - a[0] << endl;
} else if (a[n - 1] < 0) {
cout << sum - a[n - 1] << endl;
} else {
cout << sum - sum / n << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int a[n] = {};
for (int i = 1; i <= n; i++) {
a[i - 1] = l + i - 1;
}
int sum = 0;
for (int j = 1; j <= n; j++) {
sum = sum + a[j - 1];
}
if (a[0] > 0) {
cout << sum - a[0] << endl;
} else if (a[n - 1] < 0) {
cout << sum - a[n - 1] << endl;
} else {
cout << sum << endl;
}
return 0;
} | [
"expression.operation.binary.remove"
] | 804,056 | 804,057 | u584787460 | cpp |
p02994 | #include <cstdio>
int main() {
int N;
int L;
scanf("%d %d", &N, &L);
int tmp = ((N + 1) * N / 2) + ((L - 1) * N);
int ans;
if (L * (L + N - 1) < 0) {
ans = tmp;
} else if (L > 0) {
ans = tmp - L;
} else {
ans = tmp - (L + N - 1);
}
printf("%d\n", ans);
return 0;
}
| #include <cstdio>
int main() {
int N;
int L;
scanf("%d %d", &N, &L);
int tmp = ((N + 1) * N / 2) + ((L - 1) * N);
int ans;
if (L * (L + N - 1) <= 0) {
ans = tmp;
} else if (L > 0) {
ans = tmp - L;
} else {
ans = tmp - (L + N - 1);
}
printf("%d\n", ans);
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 804,061 | 804,062 | u290584325 | cpp |
p02994 | #include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define MOD (long long int)(1e9 + 7)
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = n - 1; i >= 0; i--)
#define REPS(i, n) for (int i = n; i > 0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a) < (b)) ? (b) : (a))
#define chmin(a, b) a = (((a) > (b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
int main(void) {
int N, L;
cin >> N >> L;
int a;
if (N == 2) {
if (L < 0) {
a = L;
} else {
a = L + 1;
}
} else {
if (L < 1) {
if (N + L < 0) {
a = N * (N + 1) / 2 + (L - 1) * N - (N + L - 1);
} else {
a = N * (N + 1) / 2 + (L - 1) * N;
}
} else {
a = N * (N + 1) / 2 + (N - 1) * (L - 1) - 1;
}
}
cout << a << endl;
return 0;
}
| #include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define MOD (long long int)(1e9 + 7)
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = n - 1; i >= 0; i--)
#define REPS(i, n) for (int i = n; i > 0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a) < (b)) ? (b) : (a))
#define chmin(a, b) a = (((a) > (b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
int main(void) {
int N, L;
cin >> N >> L;
int a;
if (N == 2) {
if (L < 0) {
a = L;
} else {
a = L + 1;
}
} else {
if (L < 1) {
if (N + L <= 0) {
a = N * (N + 1) / 2 + (L - 1) * N - (N + L - 1);
} else {
a = N * (N + 1) / 2 + (L - 1) * N;
}
} else {
a = N * (N + 1) / 2 + (N - 1) * (L - 1) - 1;
}
}
cout << a << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 804,067 | 804,068 | u127344197 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int ans = n;
for (int i = 0; i < n; i++) {
if (abs(l + i) < abs(ans)) {
ans = l + i;
}
}
cout << l * n + (n - 1) * n / 2 - ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int ans = l;
for (int i = 0; i < n; i++) {
if (abs(l + i) < abs(ans)) {
ans = l + i;
}
}
cout << l * n + (n - 1) * n / 2 - ans << endl;
return 0;
} | [
"variable_declaration.value.change",
"identifier.change"
] | 804,069 | 804,070 | u891482208 | cpp |
p02994 | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
int L;
int sum;
cin >> N >> L;
if (L <= 0 && L + N - 1 >= 0) {
sum = (2 * L + N - 1) * (N - 1) / 2;
} else if (L < 0 && L + N - 1 < 0) {
sum = (2 * L + N - 2) * (N - 1) / 2;
} else {
sum = (2 * L + 1 + N) * (N - 1) / 2;
}
cout << sum << endl;
} | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
int L;
int sum;
cin >> N >> L;
if (L <= 0 && L + N - 1 >= 0) {
sum = (2 * L + N - 1) * N / 2;
} else if (L < 0 && L + N - 1 < 0) {
sum = (2 * L + N - 2) * (N - 1) / 2;
} else {
sum = (2 * L + N) * (N - 1) / 2;
}
cout << sum << endl;
}
| [
"expression.operation.binary.remove"
] | 804,091 | 804,092 | u767969335 | cpp |
p02994 | // おまじない
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int sum = n * (2 * l + n - 1) / 2;
if (l <= 0 && l + n - 1 >= 0) {
cout << sum << endl;
} else if (l > 0) {
cout << sum << endl;
} else {
cout << sum - (l + n - 1) << endl;
}
} | // おまじない
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, l;
cin >> n >> l;
int sum = n * (2 * l + n - 1) / 2;
if (l <= 0 && l + n - 1 >= 0) {
cout << sum << endl;
} else if (l > 0) {
cout << sum - l << endl;
} else {
cout << sum - (l + n - 1) << endl;
}
}
| [
"expression.operation.binary.add"
] | 804,096 | 804,097 | u277253335 | cpp |
p02994 | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
/*
int main() {
long long a,b,c,d;
cin >> a >> b >> c >> d;
int ans = 0;
for (long long i = a; i <= b; i++)
{
if (i % c != 0 && i % d != 0)
{
ans++;
}
}
cout << ans << endl;
return 0;
}
*/
int main() {
int N, L;
cin >> N >> L;
vector<int> taste(N);
vector<int> tasteAbs(N);
for (int i = 0; i < N; i++) {
taste[i] = L + i - 1;
tasteAbs[i] = abs(taste[i]);
}
int min = 99999999;
int minNum = 0;
for (int i = 0; i < N; i++) {
if (tasteAbs[i] <= min) {
min = tasteAbs[i];
minNum = i;
}
}
int ans = 0;
for (int i = 0; i < N; i++) {
if (i != minNum) {
ans += taste[i];
}
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
vector<int> taste(N);
vector<int> tasteAbs(N);
for (int i = 0; i < N; i++) {
taste[i] = L + i;
tasteAbs[i] = abs(taste[i]);
}
int min = 99999999;
int minNum = 0;
for (int i = 0; i < N; i++) {
if (tasteAbs[i] <= min) {
min = tasteAbs[i];
minNum = i;
}
}
int ans = 0;
for (int i = 0; i < N; i++) {
if (i != minNum) {
ans += taste[i];
}
}
cout << ans << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 804,112 | 804,113 | u654115954 | cpp |
p02994 | #include <bits/stdc++.h>
#include <iomanip>
#define mins(a, b) a = min(a, b)
#define maxs(a, b) a = max(a, b)
template <typename T> std::string to_string(const T &n) {
std::ostringstream stm;
stm << n;
return stm.str();
}
using namespace std;
const long long INF = 9000000000000000;
typedef long long ll;
int main() {
int n, m, ans = 0, nn = 0;
cin >> n >> m;
int x[n];
for (int i = m; i < m + n; i++) {
ans += i;
x[nn] = abs(i);
nn++;
}
sort(x, x + n);
if (n + m >= 0)
cout << ans - x[0] << endl;
else
cout << ans + x[0] << endl;
}
| #include <bits/stdc++.h>
#include <iomanip>
#define mins(a, b) a = min(a, b)
#define maxs(a, b) a = max(a, b)
template <typename T> std::string to_string(const T &n) {
std::ostringstream stm;
stm << n;
return stm.str();
}
using namespace std;
const long long INF = 9000000000000000;
typedef long long ll;
int main() {
int n, m, ans = 0, nn = 0;
cin >> n >> m;
int x[n] = {10000000};
for (int i = m; i < m + n; i++) {
ans += i;
x[nn] = abs(i);
nn++;
}
sort(x, x + n);
if (n + m > 0)
cout << ans - x[0] << endl;
else
cout << ans + x[0] << endl;
}
| [
"variable_declaration.value.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 804,121 | 804,122 | u127856129 | cpp |
p02994 | #include <iostream>
#include <string>
using namespace std;
int main() {
int n, l, count = 0;
cin >> n >> l;
if (l >= 0) {
for (int i = 1; i <= n; i++) {
count += l + i - 1;
}
} else {
for (int i = 1; i <= n; i++) {
if (i == n && l + i - 1 < 0)
break;
count += l + i - 1;
}
}
cout << count << endl;
return 0;
} | #include <iostream>
#include <string>
using namespace std;
int main() {
int n, l, count = 0;
cin >> n >> l;
if (l >= 0) {
for (int i = 2; i <= n; i++) {
count += l + i - 1;
}
} else {
for (int i = 1; i <= n; i++) {
if (i == n && l + i - 1 < 0)
break;
count += l + i - 1;
}
}
cout << count << endl;
return 0;
} | [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one"
] | 804,135 | 804,136 | u754489932 | cpp |
p02994 | #include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int N, L;
cin >> N >> L;
int flavor[N + 1];
for (int i = 1; i <= N; i++) {
flavor[i] = L + i - 1;
}
// int total = 0;
// for(int i = 1; i <= N; i++){
// total += flavor[i];
// }
int smallest = 1000000;
int smallestIndex = 0;
for (int i = 1; i <= N; i++) {
if (abs(flavor[i]) < smallest) {
smallest = flavor[i];
smallestIndex = i;
}
}
int ans = 0;
for (int i = 1; i <= N; i++) {
if (i == smallestIndex) {
continue;
} else {
ans += flavor[i];
}
}
cout << ans << endl;
}
| #include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int N, L;
cin >> N >> L;
int flavor[N + 1];
for (int i = 1; i <= N; i++) {
flavor[i] = L + i - 1;
}
// int total = 0;
// for(int i = 1; i <= N; i++){
// total += flavor[i];
// }
int smallest = 1000000;
int smallestIndex = 0;
for (int i = 1; i <= N; i++) {
if (abs(flavor[i]) < abs(smallest)) {
smallest = abs(flavor[i]);
smallestIndex = i;
}
}
int ans = 0;
for (int i = 1; i <= N; i++) {
if (i == smallestIndex) {
continue;
} else {
ans += flavor[i];
}
}
cout << ans << endl;
}
| [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"call.add",
"call.arguments.change"
] | 804,143 | 804,144 | u845000384 | cpp |
p02994 | #include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
int n, l, min, sum = 0;
cin >> n >> l;
min = n;
for (int i = 1; i <= n; i++) {
int a = l + i - 1;
// cout << " a " <<a <<endl;
if (abs(a) < abs(min)) {
min = a;
// cout << i << endl;
}
sum += a;
}
// cout << sum << endl;
// cout << min << endl;
sum = sum - min;
cout << sum << endl;
}
| #include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
int n, l, min, sum = 0;
cin >> n >> l;
min = 2 * l;
for (int i = 1; i <= n; i++) {
int a = l + i - 1;
// cout << " a " <<a <<endl;
if (abs(a) < abs(min)) {
min = a;
// cout << min << endl;
}
sum += a;
}
// cout << sum << endl;
// cout << min << endl;
sum = sum - min;
cout << sum << endl;
}
| [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"assignment.change"
] | 804,145 | 804,146 | u662852612 | cpp |
p02994 | #include <iostream>
#include <string>
#include <vector>
int main(void) {
long n, l;
std::cin >> n >> l;
long sum = 0;
for (int i = 1; i <= n; i++) {
sum += l + i - 1;
}
if (l < -n)
sum -= l + n - 1;
else if (l < 0)
sum -= 0;
else
sum -= l;
std::cout << sum << std::endl;
return 0;
} | #include <iostream>
#include <string>
#include <vector>
int main(void) {
long n, l;
std::cin >> n >> l;
long sum = 0;
for (int i = 1; i <= n; i++) {
sum += l + i - 1;
}
if (l + n - 1 < 0)
sum -= l + n - 1;
else if (l < 0)
sum -= 0;
else
sum -= l;
std::cout << sum << std::endl;
return 0;
}
| [
"control_flow.branch.if.condition.change",
"expression.operation.unary.arithmetic.remove"
] | 804,149 | 804,150 | u679906187 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int ans = 0;
for (int i = 1; i <= N; ++i) {
ans += L + i - 1;
;
}
if (L < 0) {
if (N < abs(L + 1)) {
ans -= L + (N - 1);
}
} else if (0 < L) {
ans -= L;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int ans = 0;
for (int i = 1; i <= N; ++i) {
ans += L + i - 1;
}
if (L < 0) {
if (N < abs(L - 1)) {
ans -= L + (N - 1);
}
} else if (0 < L) {
ans -= L;
}
cout << ans << endl;
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 804,151 | 804,152 | u159619403 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int futaberu = 500;
for (int i = 1; i <= N; i++) {
if (L + i - 1 < 0) {
futaberu = max(futaberu, L + i - 1);
}
}
int seitaberu;
for (int i = 1; i <= N; i++) {
if (L + i - 1 >= 0) {
seitaberu = min(seitaberu, L + i - 1);
}
}
if (seitaberu <= -1 * futaberu) {
cout << N * (L - 1) + N * (N + 1) / 2 - seitaberu << endl;
}
if (seitaberu > -1 * futaberu) {
cout << N * (L - 1) + N * (N + 1) / 2 - futaberu << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int futaberu = -500;
for (int i = 1; i <= N; i++) {
if (L + i - 1 < 0) {
futaberu = max(futaberu, L + i - 1);
}
}
int seitaberu = 500;
for (int i = 1; i <= N; i++) {
if (L + i - 1 >= 0) {
seitaberu = min(seitaberu, L + i - 1);
}
}
if (seitaberu <= -1 * futaberu) {
cout << N * (L - 1) + N * (N + 1) / 2 - seitaberu << endl;
}
if (seitaberu > -1 * futaberu) {
cout << N * (L - 1) + N * (N + 1) / 2 - futaberu << endl;
}
}
| [
"expression.operation.unary.arithmetic.add",
"variable_declaration.value.change"
] | 804,153 | 804,154 | u003761219 | cpp |
p02994 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
int n, l;
cin >> n >> l;
vector<int> taste(201);
REP(i, n) { taste[i] = l + i; }
if (l < 0 && l + n >= 0) {
int sum = 0;
REP(i, n) { sum += taste[i]; }
cout << sum << endl;
}
else if (l < 0) {
int sum = 0;
REP(i, n - 1) { sum += taste[i]; }
cout << sum << endl;
}
else {
int sum = 0;
REP(i, n - 1) { sum += taste[i + 1]; }
cout << sum << endl;
}
}
| #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
int n, l;
cin >> n >> l;
vector<int> taste(201);
REP(i, n) { taste[i] = l + i; }
if (l < 0 && l + n - 1 >= 0) {
int sum = 0;
REP(i, n) { sum += taste[i]; }
cout << sum << endl;
}
else if (l < 0) {
int sum = 0;
REP(i, n - 1) { sum += taste[i]; }
cout << sum << endl;
}
else {
int sum = 0;
REP(i, n - 1) { sum += taste[i + 1]; }
cout << sum << endl;
}
}
| [
"control_flow.branch.if.condition.change"
] | 804,157 | 804,158 | u342042786 | cpp |
p02994 | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int a[201];
int ans = 0;
for (int i = 1; i < N + 1; i++) {
a[i] = L + i - 1;
ans += a[i];
}
if (L > 1)
ans -= a[1];
else if (L < 1 - N)
ans -= a[N];
cout << ans << endl;
}
| #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
int a[201];
int ans = 0;
for (int i = 1; i <= N; i++) {
a[i] = L + i - 1;
ans += a[i];
}
if (L > 0)
ans -= a[1];
else if (L < 1 - N)
ans -= a[N];
cout << ans << endl;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"expression.operation.binary.remove",
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 804,159 | 804,160 | u068896454 | cpp |
p02994 | #include <cstdlib>
#include <iostream>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <string>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
if (L <= 0 && abs(L) <= N + 1)
cout << L * N + (N * (N - 1)) / 2 << endl;
if (L <= 0 && abs(L) > N + 1)
cout << (L - 1) * (N - 1) + (N * (N - 1)) / 2 << endl;
if (L > 0)
cout << L * (N - 1) + (N * (N - 1)) / 2 << endl;
return 0;
} | #include <cstdlib>
#include <iostream>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <string>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
if (L <= 0 && abs(L) <= N - 1)
cout << L * N + (N * (N - 1)) / 2 << endl;
if (L <= 0 && abs(L) > N - 1)
cout << (L - 1) * (N - 1) + (N * (N - 1)) / 2 << endl;
if (L > 0)
cout << L * (N - 1) + (N * (N - 1)) / 2 << endl;
return 0;
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 804,180 | 804,181 | u531752502 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
if (L > 0)
cout << ((N - 1) * (2 * (L + 1) + (N - 2))) / 2 << endl;
else if (L <= 0 && L + N >= 0)
cout << ((N) * (2 * (L) + (N - 1))) / 2 << endl;
else if (L < 0 && L + N < 1)
cout << ((N - 1) * (2 * (L) + (N - 2))) / 2 << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
if (L > 0)
cout << ((N - 1) * (2 * (L + 1) + (N - 2))) / 2 << endl;
else if (L <= 0 && L + N >= 1)
cout << ((N) * (2 * (L) + (N - 1))) / 2 << endl;
else if (L < 0 && L + N < 1)
cout << ((N - 1) * (2 * (L) + (N - 2))) / 2 << endl;
} | [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 804,182 | 804,183 | u622879241 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int i, n, l, s = 0, minn, pos;
scanf("%d%d", &n, &l);
for (i = 1; i <= n; i++) {
s += l + i - 1;
if (abs(l + i - 1) < minn) {
minn = abs(l + i - 1);
pos = i;
}
}
printf("%d", s - l - pos + 1);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int i, n, l, s = 0, minn = INT_MAX, pos;
scanf("%d%d", &n, &l);
for (i = 1; i <= n; i++) {
s += l + i - 1;
if (abs(l + i - 1) < minn) {
minn = abs(l + i - 1);
pos = i;
}
}
printf("%d", s - l - pos + 1);
return 0;
} | [
"variable_declaration.value.change"
] | 804,188 | 804,189 | u314499126 | cpp |
p02994 | #include <stdio.h>
int main() {
int N;
int L;
scanf("%d %d", &N, &L);
int sum_taste = 0;
sum_taste = (L + (L + N - 1)) * N / 2;
if (L >= 0) {
sum_taste -= L;
} else {
if (L + N < 0) {
sum_taste -= (L + N - 1);
}
}
printf("%d", sum_taste);
return 0;
} | #include <stdio.h>
int main() {
int N;
int L;
scanf("%d %d", &N, &L);
int sum_taste = 0;
sum_taste = (L + (L + N - 1)) * N / 2;
if (L >= 0) {
sum_taste -= L;
} else {
if (L + N <= 0) {
sum_taste -= (L + N - 1);
}
}
printf("%d", sum_taste);
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 804,196 | 804,197 | u911883740 | cpp |
p02994 | #include "bits/stdc++.h"
using namespace std;
int main() {
int N, L, eat, ans, sum = 0;
cin >> N >> L;
for (int i = 0; i < N; i++) {
sum += L + i;
}
if (L >= 0) {
eat = L;
} else if (L + N < 0) {
eat = L + N - 1;
} else {
eat = 0;
}
cout << sum - eat << endl;
return 0;
}
| #include "bits/stdc++.h"
using namespace std;
int main() {
int N, L, eat, ans, sum = 0;
cin >> N >> L;
for (int i = 0; i < N; i++) {
sum += L + i;
}
if (L > 0) {
eat = L;
} else if (L + N - 1 < 0) {
eat = L + N - 1;
} else {
eat = 0;
}
cout << sum - eat << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 804,198 | 804,199 | u021111120 | cpp |
p02994 | #include "bits/stdc++.h"
using namespace std;
int main() {
int N, L, eat, ans, sum = 0;
cin >> N >> L;
for (int i = 0; i < N; i++) {
sum += L + i;
}
if (L >= 0) {
eat = L;
} else if (L + N < 0) {
eat = L + N;
} else {
eat = 0;
}
cout << sum - eat << endl;
return 0;
}
| #include "bits/stdc++.h"
using namespace std;
int main() {
int N, L, eat, ans, sum = 0;
cin >> N >> L;
for (int i = 0; i < N; i++) {
sum += L + i;
}
if (L > 0) {
eat = L;
} else if (L + N - 1 < 0) {
eat = L + N - 1;
} else {
eat = 0;
}
cout << sum - eat << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"assignment.change"
] | 804,200 | 804,199 | u021111120 | cpp |
p02994 | #include <cmath>
#include <stdio.h>
#include <stdlib.h>
int main() {
int a, b;
int realtest = 0;
int minus = 100;
int realminus;
int first;
int i;
scanf("%d %d", &a, &b);
first = b;
for (i = 0; i < a; i++) {
if (minus > abs(first + i)) {
minus = abs(first + i);
realminus = first + i;
}
}
for (i = 0; i < a; i++) {
realtest += (first + i);
}
realtest = realtest - realminus;
printf("%d\n", realtest);
return 0;
}
| #include <cmath>
#include <stdio.h>
#include <stdlib.h>
int main() {
int a, b;
int realtest = 0;
int minus = 300;
int realminus;
int first;
int i;
scanf("%d %d", &a, &b);
first = b;
for (i = 0; i < a; i++) {
if (minus > abs(first + i)) {
minus = abs(first + i);
realminus = first + i;
}
}
for (i = 0; i < a; i++) {
realtest += (first + i);
}
realtest = realtest - realminus;
printf("%d\n", realtest);
return 0;
} | [
"literal.number.change",
"variable_declaration.value.change"
] | 804,206 | 804,207 | u251610528 | cpp |
p02994 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
vector<int> a(0);
for (int i = 1; i < N + 1; i++)
a.push_back(i + L - 1);
int tsum = 0;
for (int i = 0; i < N; i++)
tsum += a.at(i);
int ko = 0;
for (int i = 0; i < N; i++) {
for (int j = 1; j < N + 1; j++) {
if (j + L - 1 == i || j + L - 1 == -i) {
cout << tsum - (j + L - 1);
ko++;
break;
}
}
if (ko == 1)
break;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, L;
cin >> N >> L;
vector<int> a(0);
for (int i = 1; i < N + 1; i++)
a.push_back(i + L - 1);
int tsum = 0;
for (int i = 0; i < N; i++)
tsum += a.at(i);
int ko = 0;
for (int i = 0;; i++) {
for (int j = 1; j < N + 1; j++) {
if (j + L - 1 == i || j + L - 1 == -i) {
cout << tsum - (j + L - 1);
ko++;
break;
}
}
if (ko == 1)
break;
}
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 804,213 | 804,214 | u424602097 | cpp |
p02994 | #include <iostream>
using namespace std;
int main() {
int L, N;
cin >> N >> L;
int p = (N * (L - 1)) + (N * (N + 1)) / 2;
int k;
if (L >= 1) {
k = p - (L);
}
if ((L < 1) && (abs(L) < N)) {
k = p;
}
if ((L < 1) && (abs(L) > N)) {
k = p - (L + N - 1);
}
cout << k;
} | #include <iostream>
using namespace std;
int main() {
int L, N;
cin >> N >> L;
int p = (N * (L - 1)) + (N * (N + 1)) / 2;
int k;
if (L >= 1) {
k = p - (L);
}
if ((L < 1) && (abs(L) < N)) {
k = p;
}
if ((L < 1) && (abs(L) >= N)) {
k = p - (L + N - 1);
}
cout << k;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 804,215 | 804,216 | u258062175 | cpp |
p02994 | #include <algorithm>
#include <forward_list>
#include <iostream>
#include <math.h>
#include <queue>
#include <stdlib.h>
#include <string>
#include <vector>
#define mod 1000000007
using namespace std;
int main() {
int N, L;
cin >> N >> L;
if (L <= 0 && N + L - 1 <= 0) { // 0をまたがずに負からはじまる
cout << (N - 1) * (L + N + L - 1 - 1) / 2 << endl;
} else if (L < 0) { // 0を跨いで負から始まる
cout << (N - 1) * (L + N + L - 1) / 2 << endl;
} else if (L >= 0) { //正からはじまる
cout << (N - 1) * (L + 1 + N + L - 1) / 2 << endl;
}
}
| #include <algorithm>
#include <forward_list>
#include <iostream>
#include <math.h>
#include <queue>
#include <stdlib.h>
#include <string>
#include <vector>
#define mod 1000000007
using namespace std;
int main() {
int N, L;
cin >> N >> L;
if (L <= 0 && N + L - 1 <= 0) { // 0をまたがずに負からはじまる
cout << (N - 1) * (L + N + L - 1 - 1) / 2 << endl;
} else if (L < 0) { // 0を跨いで負から始まる
cout << (N) * (L + N + L - 1) / 2 << endl;
} else if (L >= 0) { //正からはじまる
cout << (N - 1) * (L + 1 + N + L - 1) / 2 << endl;
}
}
| [
"expression.operation.binary.remove"
] | 804,219 | 804,220 | u998203751 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.