buggy_code stringlengths 11 625k | fixed_code stringlengths 17 625k | bug_type stringlengths 2 4.45k | language int64 0 8 | token_count int64 5 200k |
|---|---|---|---|---|
X = int(input())
pleasure += (X // 500) * 1000
X //= 500
pleasure += (X // 5) * 5
print(pleasure) | X = int(input())
pleasure = (X // 500) * 1000
X %= 500
pleasure += (X // 5) * 5
print(pleasure)
| [["-", 36, 36, 0, 656, 0, 1, 0, 677, 17, 107], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 677, 17, 691], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 17, 132]] | 5 | 33 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#define fastio \
cin.tie(0); \
i... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#define fastio \
cin.tie(0); \
i... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 11, 12, 16, 12, 16, 31, 16, 17, 85], ["+", 0, 11, 12, 16, 12, 16, 31, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 17, 48], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 12, 13]] | 1 | 288 |
X = int(input())
t = X % 500
T = X // 500 * 1000
T += t // 5 * 5 | X = int(input())
t = X % 500
T = X // 500 * 1000
T += t // 5 * 5
print(T) | [["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 27 |
data = int(input())
result = (data // 1000) * 2000
data %= 1000
result += (data // 5) * 5
print(result) | data = int(input())
result = (data // 500) * 1000
data %= 500
result += (data // 5) * 5
print(result) | [["-", 0, 662, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 12, 612], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 36, 36, 0, 656, 0, 1, 0, 677, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 12, 612]] | 5 | 33 |
// sky kaafi neeche aa gaya hai, sab choo rahe hain
// let's raise the bar now :P
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) ... | // sky kaafi neeche aa gaya hai, sab choo rahe hain
// let's raise the bar now :P
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) ... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 90], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132]] | 1 | 485 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define fix(... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define fix(... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]] | 1 | 324 |
X = int(input())
ans = 0
ans += X//500 * 1000
X = X % 500
ans += X // 500 * 5
print(ans) | X = int(input())
ans = 0
ans += X//500 * 1000
X = X % 500
ans += X // 5 * 5
print(ans) | [["-", 0, 1, 0, 677, 12, 657, 31, 657, 12, 612], ["+", 0, 1, 0, 677, 12, 657, 31, 657, 12, 612]] | 5 | 34 |
x = int(input())
ans = x // 500 * 1000 + x % 1000 // 5 * 5
print(ans) | x = int(input())
ans = x // 500 * 1000 + x % 500 // 5 * 5
print(ans) | [["-", 12, 657, 12, 657, 31, 657, 31, 657, 12, 612], ["+", 12, 657, 12, 657, 31, 657, 31, 657, 12, 612]] | 5 | 27 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x;
cin >> x;
cout << x / 500 * 1000 + x % 1000 / 5 * 5 << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long x;
cin >> x;
cout << x / 500 * 1000 + x % 500 / 5 * 5 << endl;
}
| [["-", 12, 16, 12, 16, 31, 16, 31, 16, 12, 13], ["+", 12, 16, 12, 16, 31, 16, 31, 16, 12, 13]] | 1 | 38 |
import math
n=int(input())
t=(n//500)*1000
s=(n-t*500//5)*5
print(t+s)
| import math
n=int(input())
t=(n//500)
s=((n-t*500)//5)*5
print(t*1000+s) | [["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 48], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["+", 12, 657, 31, 23, 0, 657, 31, 23, 0, 25], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 48], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 12, 612]] | 5 | 38 |
#include <bits/stdc++.h>
#define rep(i, n) for (i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
int main() {
ll X, i, ans = 0;
cin >> X;
ans += X / 500;
X = X % 500;
ans += X / 5;
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
int main() {
ll X, i, ans = 0;
cin >> X;
ans += X / 500 * 1000;
X = X % 500;
ans += X / 5 * 5;
cout << ans << endl;
return 0;
} | [["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 13]] | 1 | 77 |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ll mo;
cin >> mo;
cout << (mo / 500) * 1000 + ((mo % 500) / 5) << endl;
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ll mo;
cin >> mo;
cout << (mo / 500) * 1000 + ((mo % 500) / 5) * 5 << endl;
return 0;
}
| [["+", 0, 16, 31, 16, 12, 16, 12, 16, 17, 48], ["+", 0, 16, 31, 16, 12, 16, 12, 16, 12, 13]] | 1 | 47 |
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
const int N = 2e5 + 99, M = 2e5 + 9, INF = 1.1e18, mod = 1000000007;
const double PI = acos(... | #include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
const int N = 2e5 + 99, M = 2e5 + 9, INF = 1.1e18, mod = 1000000007;
const double PI = acos(... | [["-", 12, 16, 12, 16, 31, 16, 31, 16, 12, 13], ["+", 12, 16, 12, 16, 31, 16, 31, 16, 12, 13]] | 1 | 124 |
x = int(input())
c1 = 0
c2 = 0
c1 = x // 500
x %= 500
c2 = x % 5
print(c1 * 1000 + c2 * 5)
| x = int(input())
c1 = 0
c2 = 0
c1 = x // 500
x %= 500
c2 = x // 5
print(c1 * 1000 + c2 * 5)
| [["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 676]] | 5 | 37 |
#define _CRT_SECURE_NO_WARNINGS
#ifdef __GNUC__
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define unordered_map __fast_unordered_map
template <class Key, class Value, class Hash = std::hash<Key>>
using unordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;
#else
#include <algorithm>
#inclu... | #define _CRT_SECURE_NO_WARNINGS
#ifdef __GNUC__
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define unordered_map __fast_unordered_map
template <class Key, class Value, class Hash = std::hash<Key>>
using unordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;
#else
#include <algorithm>
#inclu... | [["+", 12, 16, 12, 23, 0, 16, 31, 23, 0, 24], ["-", 12, 16, 12, 23, 0, 16, 31, 16, 17, 85], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 17, 109], ["+", 12, 16, 12, 23, 0, 16, 31, 23, 0, 25]] | 1 | 1,183 |
#include <algorithm>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef int i... | #include <algorithm>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef int i... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]] | 1 | 273 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
int main() {
ll x;
cin >> x;
ll a = x / 500;
ll b = (x % 500) % 5;
cout << a * 100... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
int main() {
ll x;
cin >> x;
ll a = x / 500;
ll b = (x % 500) / 5;
cout << a * 100... | [["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 85]] | 1 | 93 |
s = int(input())
a = s // 500
b = s % 500
c = b // 5
print(a, c)
print(a * 1000 + c * 5)
| s = int(input())
a = s // 500
b = s % 500
c = b // 5
print(a * 1000 + c * 5)
| [["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 31, 22]] | 5 | 39 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef vector<LL> vl;
typedef pair<LL, LL> pl;
typedef vector<pair<LL, LL>> VP;
typedef tuple<LL, LL, LL> tl;
const LL N = pow(10, 9) + 7;
#define ull unsigned long long int
#define FAST ... | #include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef vector<LL> vl;
typedef pair<LL, LL> pl;
typedef vector<pair<LL, LL>> VP;
typedef tuple<LL, LL, LL> tl;
const LL N = pow(10, 9) + 7;
#define ull unsigned long long int
#define FAST ... | [["+", 12, 16, 12, 23, 0, 16, 31, 23, 0, 24], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 17, 109], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 12, 16, 12, 23, 0, 16, 31, 23, 0, 25]] | 1 | 852 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, j, n) for (int i = (int)(j); i < (int)(n); i++)
#define REP(i, j, n) for (int i = (int)(j); i <= (int)(n); i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(), (a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<i... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, j, n) for (int i = (int)(j); i < (int)(n); i++)
#define REP(i, j, n) for (int i = (int)(j); i <= (int)(n); i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(), (a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<i... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 108], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 107]] | 1 | 123 |
#include "bits/stdc++.h"
// Begin Header {{{
using namespace std;
#ifndef DEBUG
#define dump(...)
#endif
#define all(x) x.begin(), x.end()
#define rep(i, b, e) for (intmax_t i = (b), i##_limit = (e); i < i##_limit; ++i)
#define reps(i, b, e) \
for (intmax_t ... | #include "bits/stdc++.h"
// Begin Header {{{
using namespace std;
#ifndef DEBUG
#define dump(...)
#endif
#define all(x) x.begin(), x.end()
#define rep(i, b, e) for (intmax_t i = (b), i##_limit = (e); i < i##_limit; ++i)
#define reps(i, b, e) \
for (intmax_t ... | [["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 85], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 13]] | 1 | 859 |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
long long int n;
scanf("%lld", &n);
int uresisa = 0;
uresisa = uresisa + n / 500 * 1000;
n = n % 500;
uresisa = uresisa + n % 5 * 5;
printf("%d\n", uresisa);
} | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
long long int n;
scanf("%lld", &n);
long long int uresisa = 0;
uresisa = uresisa + n / 500 * 1000;
n = n % 500;
uresisa = uresisa + n / 5 * 5;
printf("%lld\n", uresisa);
} | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 11, 12, 16, 12, 16, 31, 16, 17, 109], ["+", 0, 11, 12, 16, 12, 16, 31, 16, 17, 85], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 71 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
ll i, j, k, m, n, t;
string s;
cin >> n;
ll ans = (n / 500) * 1000;
n %= 500;
ans += (n / 5) * 5;
cout << n;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
ll i, j, k, m, n, t;
string s;
cin >> n;
ll ans = (n / 500) * 1000;
n %= 500;
ans += (n / 5) * 5;
cout << ans;
} | [["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 64 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define pb push_back
#define pii pair<int, int>
#define ppii pair<pii, pii>
#define fr(i, n) for (int i = 0; i < n; i++)
#define F first
#defin... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define pb push_back
#define pii pair<int, int>
#define ppii pair<pii, pii>
#define fr(i, n) for (int i = 0; i < n; i++)
#define F first
#defin... | [["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 214 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a, b) for (int a = 0; a < b; a++)
#define Sort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())
#define fi first
#define se second
#define co(a) cout << a << endl
#define sz size()
#define bgn begin()
#define en end()
#... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a, b) for (int a = 0; a < b; a++)
#define Sort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())
#define fi first
#define se second
#define co(a) cout << a << endl
#define sz size()
#define bgn begin()
#define en end()
#... | [["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 43, 49, 50, 51, 16, 12, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 16, 12, 16, 12, 13]] | 1 | 736 |
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define inf 1e9
#define eps 1e-10
using namespace std;
inline int read() {
int x = 0, w = 1;
char c = getchar();
while (c ... | #pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define inf 1e9
#define eps 1e-10
using namespace std;
inline int read() {
int x = 0, w = 1;
char c = getchar();
while (c ... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]] | 1 | 200 |
/* #region Head */
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pll = pair<ll, ll>;
template <class T> using vc = vector<T>;
template <class T> using vvc = vc<vc<T>>;
using vll = vc<ll>;
using vvll = vvc<ll>;
using vld = vc<ld>;
usin... | /* #region Head */
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pll = pair<ll, ll>;
template <class T> using vc = vector<T>;
template <class T> using vvc = vc<vc<T>>;
using vll = vc<ll>;
using vvll = vvc<ll>;
using vld = vc<ld>;
usin... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]] | 1 | 1,080 |
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_... | from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_... | [["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 24], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 25], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 17, 48]] | 5 | 121 |
//~#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
////Optimization flags
//~#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//~#pragma GCC target("avx2") //Enable AVX
#include <bits/stdc++.h>
using namespace std;
#define int ll
#define all(a) begin(a), end(a)
#d... | //~#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
////Optimization flags
//~#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//~#pragma GCC target("avx2") //Enable AVX
#include <bits/stdc++.h>
using namespace std;
#define int ll
#define all(a) begin(a), end(a)
#d... | [["-", 0, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 12, 13]] | 1 | 593 |
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end
def copy(a) Marshal.load(Marshal.dump(a)) end
def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r}... | #exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end
def copy(a) Marshal.load(Marshal.dump(a)) end
def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r}... | [["-", 36, 36, 36, 36, 0, 493, 0, 755, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 755, 31, 22]] | 4 | 302 |
x=int(input())
ans=(x//500)*1000
rem=x%500
ans+=(rem//5)*5
| x=int(input())
ans=(x//500)*1000
rem=x%500
ans+=(rem//5)*5
print(ans) | [["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 31 |
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define debug(v) \
cout << #v << ":"; \
for (auto x : v) { ... | #include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define debug(v) \
cout << #v << ":"; \
for (auto x : v) { ... | [["-", 49, 50, 51, 16, 31, 23, 0, 16, 12, 13], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 12, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]] | 1 | 235 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#inclu... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#inclu... | [["+", 0, 16, 31, 16, 12, 16, 12, 16, 17, 48], ["+", 0, 16, 31, 16, 12, 16, 12, 16, 12, 13]] | 1 | 257 |
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define lfs cout << fixed << setprecision(10)
#define ALL(a) (a).begin(), (a).end()
#define ALLR(a) (a).rbegin(), (a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define E... | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define lfs cout << fixed << setprecision(10)
#define ALL(a) (a).begin(), (a).end()
#define ALLR(a) (a).rbegin(), (a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define E... | [["+", 12, 16, 12, 16, 31, 16, 31, 16, 12, 13], ["+", 31, 16, 12, 16, 12, 16, 31, 16, 17, 85]] | 1 | 871 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL << 62
#define inf 1000000007
ll a[1000010];
int main() {
ll k, n;
cin >> k >> n;
for (ll i = 0; i < n; i++) {
cin >> a[i];
}
ll ans = 0;
for (ll i = 1; i < n; i++) {
ans = max(ans, a[i] - a[i] - 1);
}
ans = max(... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL << 62
#define inf 1000000007
ll a[1000010];
int main() {
ll k, n;
cin >> k >> n;
for (ll i = 0; i < n; i++) {
cin >> a[i];
}
ll ans = 0;
for (ll i = 1; i < n; i++) {
ans = max(ans, a[i] - a[i - 1]);
}
ans = max(... | [["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["+", 3, 4, 0, 16, 12, 69, 341, 342, 0, 73]] | 1 | 134 |
K, N = map(int, input().split())
Alst = list(map(int, input().split()))
zero = Alst[0] + K
M = 0
now = Alst[0]
for i in Alst:
dis = i - now
if dis > M:
M = dis
now = i
last = zero - now
if last > M:
M = last
print(M) | K, N = map(int, input().split())
Alst = list(map(int, input().split()))
zero = Alst[0] + K
M = 0
now = Alst[0]
for i in Alst:
dis = i - now
if dis > M:
M = dis
now = i
last = zero - now
if last > M:
M = last
print(K - M) | [["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]] | 5 | 88 |
k, n = map(int, input().split())
a_list = list(map(int, input().split()))
longest = 0
for i in range(n-1):
distance = a_list[i+1] - a_list[i]
longest = max(longest, distance)
print(max(longest, k-a_list[n-1]+a_list[0])) | k, n = map(int, input().split())
a_list = list(map(int, input().split()))
longest = 0
for i in range(n-1):
distance = a_list[i+1] - a_list[i]
longest = max(longest, distance)
print(k-max(longest, k-a_list[n-1]+a_list[0])) | [["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]] | 5 | 88 |
K,N=map(int,input().split())
A=list(map(int,input().split()))
ans=A[0]+K-A[-1]
for i in range(N-1):
ans=max(ans,A[i+1]-A[i])
print(ans)
| K,N=map(int,input().split())
A=list(map(int,input().split()))
ans=A[0]+K-A[-1]
for i in range(N-1):
ans=max(ans,A[i+1]-A[i])
print(K-ans)
| [["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]] | 5 | 79 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
int k, n;
cin >> k >> n;
vector<int> a(n);
rep(i, n) cin >> a.at(i);
vector<int> b(n);
rep(i, n - 1) b.at(i) = a.at(i + 1) - a.at(i);
b.at(n) = k + a.at(0) - a.at(n);
sort(b.begin(), b.end());
cout... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
int k, n;
cin >> k >> n;
vector<int> a(n);
rep(i, n) cin >> a.at(i);
vector<int> b(n);
rep(i, n - 1) b.at(i) = a.at(i + 1) - a.at(i);
b.at(n - 1) = k + a.at(0) - a.at(n - 1);
sort(b.begin(), b.end())... | [["+", 0, 11, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 31, 2, 3, 4, 0, 16, 12, 13], ["+", 12, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 12, 16, 12, 2, 3, 4, 0, 16, 12, 13]] | 1 | 148 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n + 1); i++)
int main() {
int K, N;
cin >> K >> N;
vector<int> A(N);
int ans = K;
int m = 0;
rep(i, N) {
cin >> A[... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n + 1); i++)
int main() {
int K, N;
cin >> K >> N;
vector<int> A(N);
int ans = K;
int m = 0;
rep(i, N) {
cin >> A[... | [["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33]] | 1 | 177 |
K, N = map(int, input().split(' '))
A_ls = list(map(int, input().split(' ')))
rst = -1
for i in range(N):
l = A_ls[(i + 1) % N] - A_ls[i]
if i < 0:
l = K - A_ls[i] + A_ls[(i + 1) % N]
if rst == -1:
rst = l
else:
rst = max(rst, l)
print(K - rst) | K, N = map(int, input().split(' '))
A_ls = list(map(int, input().split(' ')))
rst = -1
for i in range(N):
l = A_ls[(i + 1) % N] - A_ls[i]
if l < 0:
l = K - A_ls[i] + A_ls[(i + 1) % N]
if rst == -1:
rst = l
else:
rst = max(rst, l)
print(K - rst) | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]] | 5 | 117 |
K,N = map(int,input().split())
dis = list(map(int,input().split()))
dif = []
for i in range(N-2):
dif.append(int(dis[i+1]-dis[i]))
dif.append(int(K-dis[N-1]+dis[0]))
print(K-max(dif))
| K,N = map(int,input().split())
dis = list(map(int,input().split()))
dif = []
for i in range(N-1):
dif.append(int(dis[i+1]-dis[i]))
dif.append(int(K-dis[N-1]+dis[0]))
print(K-max(dif))
| [["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 96 |
k, n = map(int, input().split())
a = list(map(int, input().split()))
print(a)
d = [a[i+1] - a[i] for i in range(n - 1)]
d.append(a[0] - a[n-1] + k)
print(k - max(d)) | k, n = map(int, input().split())
a = list(map(int, input().split()))
d = [a[i+1] - a[i] for i in range(n - 1)]
d.append(a[0] - a[n-1] + k)
print(k - max(d)) | [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 88 |
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <stdlib.h>
using namespace std;
#define INF 1e18
#define PI 3.141592653589793238
typedef long long ll;
#define N 200010
int main() {
ll k, n, a[N], b[N], ans = 0;
cin >> k >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i =... | #include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <stdlib.h>
using namespace std;
#define INF 1e18
#define PI 3.141592653589793238
typedef long long ll;
#define N 200010
int main() {
ll k, n, a[N], b[N], ans = 0;
cin >> k >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i =... | [["+", 0, 11, 12, 16, 31, 16, 31, 69, 28, 22], ["+", 12, 16, 31, 16, 31, 69, 341, 342, 0, 70], ["+", 12, 16, 31, 16, 31, 69, 341, 342, 0, 13], ["+", 12, 16, 31, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]] | 1 | 170 |
k,n = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n-1):
a.append(k+a[i])
ans = a[n-1]-a[0]
for i in range(n,n*2-1):
ans = min(ans,a[i]-a[i-n])
print(ans) | k,n = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n-1):
a.append(k+a[i])
ans = a[n-1]-a[0]
for i in range(n,n*2-1):
ans = min(ans,a[i]-a[i-n+1])
print(ans) | [["+", 3, 4, 0, 657, 12, 206, 206, 657, 17, 72], ["+", 3, 4, 0, 657, 12, 206, 206, 657, 12, 612]] | 5 | 103 |
k,n = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
c = a[0] + (k - a[n-1])
for i in range(1,n):
d = max(c, a[i] - a[i-1])
print(k - d)
| k,n = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
c = a[0] + (k - a[n-1])
for i in range(1,n):
c = max(c,a[i]-a[i-1])
print(k-c)
| [["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]] | 5 | 89 |
K,N=map(int,input().split())
A=list(map(int,input().split()))
l=[]
A+=A[0]+K
for i in range(N):
l.append(A[i+1]-A[i])
print(K-max(l)) | K,N=map(int,input().split())
A=list(map(int,input().split()))
l=[]
A.append(A[0]+K)
for i in range(N):
l.append(A[i+1]-A[i])
print(K-max(l))
| [["-", 36, 36, 0, 656, 0, 1, 0, 677, 17, 107], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 78 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
int n = sc.nextInt();
int[] a_n = new int[n];
for (int i = 0; i < n; i++) {
a_n[i] = sc.nextInt();
}
sc.close();
int maxDistance ... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
int n = sc.nextInt();
int[] a_n = new int[n];
for (int i = 0; i < n; i++) {
a_n[i] = sc.nextInt();
}
sc.close();
int maxDistance ... | [["+", 0, 1, 0, 492, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 17, 33]] | 3 | 184 |
k,n = map(int,input().split())
Ai = list(map(int,input().split()))
kyori = []
for x in range(n-1):
kyori.append(Ai[x+1]-Ai[x])
kyori.append(Ai[0]+k-Ai[n-1])
kyoto.remove(max(kyori))
print(sum(kyori))
| k,n = map(int,input().split())
Ai = list(map(int,input().split()))
kyori = []
for x in range(n-1):
kyori.append(Ai[x+1]-Ai[x])
kyori.append(Ai[0]+k-Ai[n-1])
kyori.remove(max(kyori))
print(sum(kyori))
| [["-", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22]] | 5 | 97 |
#include <bits/stdc++.h>
#define N_Max 200001
#define A_Max 1000001
using namespace std;
const long long INF = 1LL << 60;
int main(void) {
long long k, n;
long long res;
long long i, j;
cin >> k >> n;
long long a[n];
for (i = 0; i < n; i++) {
cin >> a[i];
}
res = a[0] + k - a[n - 1];
for (i = ... | #include <bits/stdc++.h>
#define N_Max 200001
#define A_Max 1000001
using namespace std;
const long long INF = 1LL << 60;
int main(void) {
long long k, n;
long long res;
long long i, j;
cin >> k >> n;
long long a[n];
for (i = 0; i < n; i++) {
cin >> a[i];
}
res = a[0] + k - a[n - 1];
for (i = ... | [["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 138 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <unordered_map>
#includ... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <unordered_map>
#includ... | [["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22], ["+", 49, 50, 51, 16, 12, 69, 341, 342, 0, 70], ["+", 49, 50, 51, 16, 12, 69, 341, 342, 0, 13], ["+", 49, 50, 51, 16, 12, 69, 341, 342, 0, 73]] | 1 | 206 |
K, N = map(int, input().split())
A = list(map(int, input().split()))
dist = [0] * N
for i in range(N - 1):
dist[i] = A[i + 1] - A[i]
dist[N - 1] = (K - A[N - 1]) + A[0]
max_dist = max(dist)
print(max_dist)
| K, N = map(int, input().split())
A = list(map(int, input().split()))
dist = [0] * N
for i in range(N - 1):
dist[i] = A[i + 1] - A[i]
dist[N - 1] = (K - A[N - 1]) + A[0]
max_dist = max(dist)
print(K - max_dist)
| [["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]] | 5 | 98 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
int main() {
//入力
int K, N;
cin >> K >> N;
vector<int> A(N);
REP(i, N... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
template <class T> bool chmax(T &a, const T &b) {
if (b > a) {
a = b;
return 1;
}
return 0;
}
int main() {
//入力
int K, N;
cin >> K >> N;
vector<int> A(N);
REP(i, N... | [["-", 0, 30, 0, 359, 0, 14, 49, 53, 49, 22], ["+", 0, 30, 0, 359, 0, 14, 49, 53, 49, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 0, 9, 0, 57, 15, 339, 51, 2, 63, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 2, 63, 22]] | 1 | 247 |
k,n,*a=map(int,open(0).read().split())
l=k-a[n-1]+a[0]
for i in range(n-1):
l=max(l,a[i+1]-a[i])
print(l) | k,n,*a=map(int,open(0).read().split())
l=k-a[n-1]+a[0]
for i in range(n-1):
l=max(l,a[i+1]-a[i])
print(k-l) | [["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]] | 5 | 71 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int K, N; // 円周と家の軒数
cin >> K >> N;
vector<int> A; // 家の位置の配列
for (int i = 0; i < N; i++) {
int tmp;
cin >> tmp;
A.push_back(tmp);
}
// 考え方メモ
// 1, 時計回り
// 2, 反時計回り
// 5 10 15
// 時計回り:
// 5を始点 -> 15 - 5 = 10
// 10を始点 -> (... | #include <bits/stdc++.h>
using namespace std;
int main() {
int K, N; // 円周と家の軒数
cin >> K >> N;
vector<int> A; // 家の位置の配列
for (int i = 0; i < N; i++) {
int tmp;
cin >> tmp;
A.push_back(tmp);
}
// 考え方メモ
// 1, 時計回り
// 2, 反時計回り
// 5 10 15
// 時計回り:
// 5を始点 -> 15 - 5 = 10
// 10を始点 -> (... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22]] | 1 | 213 |
n,k=map(int,input().split())
A=list(map(int,input().split()))
S=[0 for _ in range(k)]
for i in range(1,k+1):
if i!=k:
S[i-1]=A[i]-A[i-1]
else:
S[i-1]=S[0]+n-A[k-1]
print(n-max(S))
| n,k=map(int,input().split())
A=list(map(int,input().split()))
S=[0 for _ in range(k)]
for i in range(1,k+1):
if i!=k:
S[i-1]=A[i]-A[i-1]
else:
S[i-1]=A[0]+n-A[k-1]
print(n-max(S))
| [["-", 0, 662, 12, 657, 31, 657, 31, 206, 51, 22], ["+", 0, 662, 12, 657, 31, 657, 31, 206, 51, 22]] | 5 | 111 |
#include <iostream>
#include <vector>
int max(std::vector<int> &a) {
if (a.size() == 0)
return 0;
int m = a[0];
for (int i = 1; i < a.size(); i++)
if (a[i] > m)
m = a[i];
return m;
}
int main() {
int k, n;
std::cin >> k >> n;
std::vector<int> a(n);
for (int i = 0; i < n; i++)
std::ci... | #include <iostream>
#include <vector>
int max(std::vector<int> &a) {
if (a.size() == 0)
return 0;
int m = a[0];
for (int i = 1; i < a.size(); i++)
if (a[i] > m)
m = a[i];
return m;
}
int main() {
int k, n;
std::cin >> k >> n;
std::vector<int> a(n);
for (int i = 0; i < n; i++)
std::ci... | [["+", 8, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 33]] | 1 | 199 |
k,n=map(int,input().split())
l=list(map(int,input().split()))
diff=[]
l.append(l[0]+k)
for i in range(n-1):
diff.append(l[n+1]-l[n])
print(sum(diff)-max(diff)) | k,n=map(int,input().split())
l=list(map(int,input().split()))
diff=[]
l.append(l[0]+k)
for i in range(n):
diff.append(l[i+1]-l[i])
print(sum(diff)-max(diff))
| [["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 3, 4, 0, 657, 31, 206, 206, 657, 31, 22], ["+", 3, 4, 0, 657, 31, 206, 206, 657, 31, 22], ["-", 0, 652, 3, 4, 0, 657, 12, 206, 206, 22], ["+", 0, 652, 3, 4, 0, 657, 12, 206, 206, 22]] | 5 | 86 |
#include <bits/stdc++.h>
using namespace std;
#include <iomanip>
#include <math.h>
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const int mod = 1000... | #include <bits/stdc++.h>
using namespace std;
#include <iomanip>
#include <math.h>
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const int mod = 1000... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]] | 1 | 231 |
K, N = map(int, input().split())
Nlist = list(map(int, input().split()))
ans = min(Nlist[N-1]-Nlist[0], Nlist[0]+K-Nlist[N-1])
sa = Nlist[0]
for i in range(1, N):
if Nlist[i]-sa > ans:
ans = Nlist[i]-sa
sa = Nlist[i]
print(ans)
| K, N = map(int, input().split())
Nlist = list(map(int, input().split()))
ans = min(Nlist[N-1]-Nlist[0], Nlist[0]+K-Nlist[N-1])
sa = Nlist[0]
for i in range(1, N):
if Nlist[i]-sa > ans:
ans = Nlist[i]-sa
sa = Nlist[i]
print(K-ans)
| [["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]] | 5 | 107 |
K, N = [int(x) for x in input().split()]
A = list([int(x) for x in input().split()])
result = []
for i in range(N):
if i == N - 1:
result.append(K - A[i] + A[0])
else:
result.appnd(A[i + 1] - A[i])
result.sort()
print(sum(result[:-1]))
| K, N = [int(x) for x in input().split()]
A = list([int(x) for x in input().split()])
result = []
for i in range(N):
if i == N - 1:
result.append(K - A[i] + A[0])
else:
result.append(A[i + 1] - A[i])
result.sort()
print(sum(result[:-1]))
| [["-", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22]] | 5 | 111 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int k, n;
cin >> k >> n;
int a[n + 1], b[n + 1];
a[0] = 0, b[0] = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i];
b[i] = a[i] - a[i - 1];
}
b[1] += k - a[n];
int g = INT_MIN;
for (int i = 1; i <= n; i++) {
g = max(g, a[i]);
}
co... | #include <bits/stdc++.h>
using namespace std;
int main() {
int k, n;
cin >> k >> n;
int a[n + 1], b[n + 1];
a[0] = 0, b[0] = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i];
b[i] = a[i] - a[i - 1];
}
b[1] += k - a[n];
int g = INT_MIN;
for (int i = 1; i <= n; i++) {
g = max(g, b[i]);
}
co... | [["-", 0, 11, 12, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 69, 28, 22]] | 1 | 145 |
k,n = map(int, input().split())
a= list(map(int,input().split()))
sa=[0]*n
for i in range(n-1):
sa[i]=a[i+1]-a[i]
sa[n-1]=a[0]+(k-a[n-1])
print(sa)
ans=max(sa)
ans=k-ans
print(ans) | k,n = map(int, input().split())
a= list(map(int,input().split()))
sa=[0]*n
for i in range(n-1):
sa[i]=a[i+1]-a[i]
sa[n-1]=a[0]+(k-a[n-1])
#print(sa)
ans=max(sa)
ans=k-ans
print(ans) | [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 107 |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
int n = sc.nextInt();
int[] a = new int[n];
int[] diff = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
for (int j = 1; j... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
int n = sc.nextInt();
int[] a = new int[n];
int[] diff = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
for (int j = 1; j... | [["+", 0, 1, 0, 492, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 17, 33]] | 3 | 179 |
k,n = map(int,input().spliut())
a = list(map(int,input().split()))
ans = a[0]+(k-a[-1])
for i in range(n-1):
ans = max(ans,a[i+1]-a[i])
print(k-ans) | k,n = map(int,input().split())
a = list(map(int,input().split()))
ans = a[0]+(k-a[-1])
for i in range(n-1):
ans = max(ans,a[i+1]-a[i])
print(k-ans) | [["-", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22]] | 5 | 83 |
k,n = map(int,input().split())
a = list(map(int,input().split()))
aa = a + a
for j in range(n,2*n):
aa[j] = aa[j] + k
dis = k
for i in range((2*n)-1):
tonari = aa[i+1]-aa[i]
dis = min(dis,k-tonari)
print(dis)
print(aa) | k,n = map(int,input().split())
a = list(map(int,input().split()))
aa = a + a
for j in range(n,2*n):
aa[j] = aa[j] + k
dis = k
for i in range((2*n)-1):
tonari = aa[i+1]-aa[i]
dis = min(dis,k-tonari)
print(dis) | [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 109 |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
vector<int> n;
int main() {
int k, n, af, al, a1, ans = 0;
cin >> k >> n;
cin >> af;
a1 = af;
for (int i = 0; i < n - 1; i++) {
cin >> al;
ans = max(ans, al - af);
af = al;
}
ans = max(ans, k - al + a1);
cout <<... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
vector<int> n;
int main() {
int k, n, af, al, a1, ans = 0;
cin >> k >> n;
cin >> af;
a1 = af;
for (int i = 0; i < n - 1; i++) {
cin >> al;
ans = max(ans, al - af);
af = al;
}
ans = max(ans, k - al + a1);
cout <<... | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]] | 1 | 110 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> K >> N;
vector<int> A(N);
for (int i = 0; i < N; i++)
cin >> A.at(i);
A.push_back(K + A.at(0));
int l = 0;
for (int j = 0; j < N; j++)
l = max(l, A.at(j + 1) - A.at(j));
cout << l << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> K >> N;
vector<int> A(N);
for (int i = 0; i < N; i++)
cin >> A.at(i);
A.push_back(K + A.at(0));
int l = 0;
for (int j = 0; j < N; j++)
l = max(l, A.at(j + 1) - A.at(j));
cout << K - l << endl;
}
| [["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]] | 1 | 117 |
/*
author : nishi5451
created : 14.08.2020 21:40:50
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
int main() {
int k, n;
cin >> k >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
sort(a.begin(), a.end());
int len = 0;
for ... | /*
author : nishi5451
created : 14.08.2020 21:40:50
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
int main() {
int k, n;
cin >> k >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
sort(a.begin(), a.end());
int len = 0;
for ... | [["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 145 |
p,q= input().split()
a,b =(int(p), int(q))
f = map(int,input().split())
f_list = list(f)
out_dis =f_list[0] + a -f_list[b-1]
dis_list=[out_dis]
for i in range(b-1):
dis = f_list[i+1]-f_list[i]
dis_list.append(dis)
print(int((sum(dis_list)-max(dis_list))%20)) | p,q= input().split()
a,b =(int(p), int(q))
f = map(int,input().split())
f_list = list(f)
out_dis =f_list[0] + a -f_list[b-1]
dis_list=[out_dis]
for i in range(b-1):
dis = f_list[i+1]-f_list[i]
dis_list.append(dis)
print(int((sum(dis_list)-max(dis_list)))) | [["-", 3, 4, 0, 652, 3, 4, 0, 657, 17, 109], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]] | 5 | 114 |
K, N = map(int, input().split())
A = list(map(int, input().split()))
max_ = [0, 20+A[0]-A[-1]]
for i in range(1, N):
tmp = A[i] - A[i-1]
if tmp > max_[1]:
max_[0] = i
max_[1] = tmp
print(K-max_[1]) | K, N = map(int, input().split())
A = list(map(int, input().split()))
#0と最後
max_ = [0, K+A[0]-A[-1]]
#iとi+1
for i in range(1, N):
tmp = A[i] - A[i-1]
if tmp > max_[1]:
max_[0] = i
max_[1] = tmp
print(K-max_[1]) | [["-", 0, 662, 12, 634, 0, 657, 31, 657, 31, 612], ["+", 0, 662, 12, 634, 0, 657, 31, 657, 31, 22]] | 5 | 103 |
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <... | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]] | 1 | 211 |
k,n=map(int,input().split())
a=list(map(int,input().split()))
b=[]
for i in range(n-1):
b.append(a[i+1]-a[i])
b.append((k-a[n-1])+a[0])
print(b)
print(k-max(b)) | k,n=map(int,input().split())
a=list(map(int,input().split()))
b=[]
for i in range(n-1):
b.append(a[i+1]-a[i])
b.append((k-a[n-1])+a[0])
print(k-max(b)) | [["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]] | 5 | 96 |
K,N=map(int, input().split())
A=list(map(int, input().split()))
B=[0]*N
for i in range(N-1):
B[i]=A[i+1]-A[i]
B[-1]=A[0]+K-A[-1]
ans = sum(B[0:-1])
print(ans) | K,N=map(int, input().split())
A=list(map(int, input().split()))
B=[0]*N
for i in range(N-1):
B[i]=A[i+1]-A[i]
B[-1]=A[0]+K-A[-1]
B=sorted(B)
ans = sum(B[0:-1])
print(ans) | [["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 100 |
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
int main() {
int k, n;
cin >> k >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
vector<int> seg;
for (int i = 1; i < n; ++i) {
seg.push_back(a[i] - a[i - 1]);
}
seg.push_back(a[n... | #include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
int main() {
int k, n;
cin >> k >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
vector<int> seg;
for (int i = 1; i < n; ++i) {
seg.push_back(a[i] - a[i - 1]);
}
seg.push_back(k -... | [["+", 0, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72]] | 1 | 143 |
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
)
func main() {
sc := newScanner()
var k = sc.readInt()
var n = sc.readInt()
var a = make([]int, n)
for i := 0; i < n; i++ {
a[i] = sc.readInt()
}
// proc dist
var dist = make([]int, n)
for i := 0; i < n; i++ {
if i != n-1 {
dist[i] = a[i+... | package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
)
func main() {
sc := newScanner()
var k = sc.readInt()
var n = sc.readInt()
var a = make([]int, n)
for i := 0; i < n; i++ {
a[i] = sc.readInt()
}
// proc dist
var dist = make([]int, n)
for i := 0; i < n; i++ {
if i != n-1 {
dist[i] = a[i+... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33]] | 7 | 766 |
k,n = map(int,input().split())
A = list(map(int,input().split()))
B=[]
t=0
for a in A:
B.append(a-t)
t=a
B[0] +=k-t
print(B, k-max(B) ) | k,n = map(int,input().split())
A = list(map(int,input().split()))
B=[]
t=0
for a in A:
B.append(a-t)
t=a
B[0] +=k-t
print(k-max(B) ) | [["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21]] | 5 | 75 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int K, N;
cin >> K >> N;
int a[N];
for (int i = 0; i < N; i++)
cin >> a[i];
int m = 0;
for (int i = 0; i < N - 1; i++) {
m = max(m, a[i + 1] - a[i]);
}
m = max(m, 20 - a[N - 1] + a[0]);
cout << K - m;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int K, N;
cin >> K >> N;
int a[N];
for (int i = 0; i < N; i++)
cin >> a[i];
int m = 0;
for (int i = 0; i < N - 1; i++) {
m = max(m, a[i + 1] - a[i]);
}
m = max(m, K - a[N - 1] + a[0]);
cout << K - m;
}
| [["-", 12, 2, 3, 4, 0, 16, 31, 16, 31, 13], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 31, 22]] | 1 | 119 |
K,N=map(int,input().split())
A=list(map(int,input().split()))
l=[]
p = A[-1]-K
for a in A:
l.append(a-l)
p=a
print(sum(l)-max(l)) | K,N=map(int,input().split())
A=list(map(int,input().split()))
l=[]
p = A[-1]-K
for a in A:
l.append(a-p)
p=a
print(sum(l)-max(l))
| [["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]] | 5 | 74 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int K, N;
cin >> K >> N;
vector<int> Ai(N);
for (int i = 0; i < N; i++) {
cin >> Ai[i];
// cout<<Ai[i]<<endl;
}
int Asa;
int ma = K - Ai[N - 1] + Ai[0];
for (int i = 0; i < N - 1; i++) {
// cout<<ma<<endl;
Asa = Ai[i + 1] - Ai[i... | #include <bits/stdc++.h>
using namespace std;
int main() {
int K, N;
cin >> K >> N;
vector<int> Ai(N);
for (int i = 0; i < N; i++) {
cin >> Ai[i];
// cout<<Ai[i]<<endl;
}
int Asa;
int ma = K - Ai[N - 1] + Ai[0];
for (int i = 0; i < N - 1; i++) {
// cout<<ma<<endl;
Asa = Ai[i + 1] - Ai[i... | [["+", 8, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 33]] | 1 | 122 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll k, n;
cin >> k >> n;
ll arr[n + 5] = {0};
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
ll dis = arr[0] - arr[n - 1] + k;
for (int i = 0; i < n - 1; i++) {
ll x = abs(arr[i + 1] - arr[i]);
dis = max(dis, x);
... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll k, n;
cin >> k >> n;
ll arr[n + 5] = {0};
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
ll dis = arr[0] - arr[n - 1] + k;
for (int i = 0; i < n - 1; i++) {
ll x = abs(arr[i + 1] - arr[i]);
dis = max(dis, x);
... | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]] | 1 | 129 |
#include <bits/stdc++.h>
// 円環の問題は切り開くと楽2周文とか
int main() {
int k, n;
int l_max = -1; // 家と家の距離の最大値
std::cin >> k >> n;
std::vector<int> a(n);
for (int i = 0; i < n; i++)
std::cin >> a[i];
for (int i = 0; i < n; i++)
if (i == n - 1) // 最初の家と最後の家の距離
l_max = std::max(l_max, k + a[0] - a[i]);
... | #include <bits/stdc++.h>
// 円環の問題は切り開くと楽2周文とか
int main() {
int k, n;
int l_max = -1; // 家と家の距離の最大値
std::cin >> k >> n;
std::vector<int> a(n);
for (int i = 0; i < n; i++)
std::cin >> a[i];
for (int i = 0; i < n; i++)
if (i == n - 1) // 最初の家と最後の家の距離
l_max = std::max(l_max, k + a[0] - a[i]);
... | [["+", 8, 9, 0, 1, 0, 16, 12, 23, 0, 24], ["+", 0, 1, 0, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 1, 0, 16, 12, 23, 0, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 16, 12, 23, 0, 25]] | 1 | 137 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int k, n, ma = 0;
cin >> k >> n;
vi A(n);
for (int i = 0; i < n; i++) {
cin >> A[i];
}
for (int i = 1; i < n;... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int k, n, ma = 0;
cin >> k >> n;
vi A(n);
for (int i = 0; i < n; i++) {
cin >> A[i];
}
for (int i = 1; i < n;... | [["+", 8, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 33]] | 1 | 145 |
k, n = map(int,input().split())
a = list(map(int,input().split()))
ans = 10**6 + 1
for i in range(n):
ans = min(a[-1] - a[i])
a.append(a[i]+k)
print(ans) | k, n = map(int,input().split())
a = list(map(int,input().split()))
ans = 10**6 + 1
for i in range(n):
ans = min(ans, a[-1] - a[i])
a.append(a[i]+k)
print(ans)
| [["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21]] | 5 | 78 |
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <numeric>
#include <sstream>
#include <vector>
//... | //---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <numeric>
#include <sstream>
#include <vector>
//... | [["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 43, 49, 50, 51, 16, 12, 2, 63, 22], ["+", 49, 50, 51, 16, 12, 2, 3, 4, 0, 24], ["+", 49, 50, 51, 16, 12, 2, 3, 4, 0, 25]] | 1 | 369 |
k, n = map(int, input().split())
a = list(map(int, input().split())) + [k + a[0]]
print(k - max([a[i + 1] - a[i] for i in range(n)])) | k, n = map(int, input().split())
a = list(map(int, input().split()))
a += [k + a[0]]
print(k - max([a[i + 1] - a[i] for i in range(n)])) | [["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 17, 107]] | 5 | 70 |
n, k = map(int,input().split())
a = list(map(int,input().split()))
b = [a[i+1]-a[i] for i in range(k-1)]
b.append(n-a[-1]+a[0])
print(k-max(b)) | n, k = map(int,input().split())
a = list(map(int,input().split()))
b = [a[i+1]-a[i] for i in range(k-1)]
b.append(n-a[-1]+a[0])
print(n-max(b)) | [["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]] | 5 | 83 |
n, k = map(int,input().split())
a = list(map(int,input().split()))
b = [0] * (k-1)
for i in range(k-1):
b[i] = a[i+1]-a[i]
b.append(n-b[-1]+b[0])
print(sum(b)-max(b)) | n, k = map(int,input().split())
a = list(map(int,input().split()))
b = [0] * (k-1)
for i in range(k-1):
b[i] = a[i+1]-a[i]
b.append(n-a[-1]+a[0])
print(sum(b)-max(b)) | [["-", 3, 4, 0, 657, 31, 657, 12, 206, 51, 22], ["+", 3, 4, 0, 657, 31, 657, 12, 206, 51, 22], ["-", 0, 652, 3, 4, 0, 657, 12, 206, 51, 22], ["+", 0, 652, 3, 4, 0, 657, 12, 206, 51, 22]] | 5 | 99 |
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []
for i in range(1,n):
b.append(a[i]-a[i-1])
b.append(k-a[n-1]-a[0])
b.sorted(b)
print(sum(b[:-1])) | k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []
for i in range(1,n):
b.append(a[i]-a[i-1])
b.append(k-a[n-1]+a[0])
b = sorted(b)
print(sum(b[:-1]))
| [["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32]] | 5 | 99 |
K,N=map(int,input().split())
List = list(map(int, input().split()))
res = 0
mid = 0
for i in range(N):
if i == N-1:
res+= K-List[i]+List[0]
mid = max(mid,K-List[i]+List[0])
else:
res+= List[i+1]+List[i]
mid = max(mid,List[i+1]-List[i])
res = res - mid
print(res)
| K,N=map(int,input().split())
List = list(map(int, input().split()))
res = 0
mid = 0
for i in range(N):
if i == N-1:
res+= K-List[i]+List[0]
mid = max(mid,K-List[i]+List[0])
else:
res+= List[i+1]-List[i]
mid = max(mid,List[i+1]-List[i])
res = res - mid
print(res) | [["-", 8, 196, 0, 1, 0, 677, 12, 657, 17, 72], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 17, 33]] | 5 | 127 |
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int K, N, i, a, max;
scanf("%d %d", &K, &N);
int A[N];
for (i = 0; i < N; i++) {
scanf("%d", &A[i]);
}
max = abs(K - A[N - 1]);
if (A[0] == 0) {
max = K - A[N - 1];
} else {
max = A[N - 1] - A[0];
}
for (i = 1; i < N; i++) {
... | #include <stdio.h>
#include <stdlib.h>
int main(void) {
int K, N, i, a, max;
scanf("%d %d", &K, &N);
int A[N];
for (i = 0; i < N; i++) {
scanf("%d", &A[i]);
}
max = abs(K - A[N - 1]);
if (A[0] == 0) {
max = K - A[N - 1];
} else {
max = K - A[N - 1] + A[0];
}
for (i = 1; i < N; i++) {... | [["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 72]] | 0 | 189 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n, k;
cin >> k >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
vector<int> l(n);
rep(i, n - 1) { l[i] = a[i + 1] - a[i]; }
l[n - 1] = k - a[n - 1] ... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n, k;
cin >> k >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
vector<int> l(n);
rep(i, n - 1) { l[i] = a[i + 1] - a[i]; }
l[n - 1] = k - a[n - 1] ... | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]] | 1 | 184 |
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <cstdlib> // abs() for integer
#include <deque> // dequ... | #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <cstdlib> // abs() for integer
#include <deque> // dequ... | [["+", 12, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72]] | 1 | 209 |
import math
import sys
import collections
import bisect
readline = sys.stdin.readline
def main():
k, n = map(int, readline().rstrip().split())
A = sorted(list(map(int, readline().rstrip().split())))
maxA = k + A[0] - A[n-1]
for i in range(n-1):
a = abs(A[i+1] - A[i])
maxA = max(maxA,a)
p... | import math
import sys
import collections
import bisect
readline = sys.stdin.readline
def main():
k, n = map(int, readline().rstrip().split())
A = sorted(list(map(int, readline().rstrip().split())))
maxA = k + A[0] - A[n-1]
for i in range(n-1):
a = abs(A[i+1] - A[i])
maxA = max(maxA, a... | [["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]] | 5 | 127 |
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <forward_list>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#includ... | #include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <forward_list>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#includ... | [["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 12, 69, 28, 22], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 70], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 13], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 73]] | 1 | 341 |
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {... | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 160 |
k,n=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for x in range(n-1):
b=a[x+1]-a[x]
ans=max(ans,b)
c=k-a[n-1]+a[0]
print(max(ans,c))
| k,n=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for x in range(n-1):
b=a[x+1]-a[x]
ans=max(ans,b)
c=k-a[n-1]+a[0]
print(k-max(ans,c))
| [["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]] | 5 | 91 |
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
using namespace std;
int main() {
int k, n;
cin >> k >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int distance[n];
int ans = 0;
for (int i = 0; i < n - 1; i++) {
distance[i] = a[i + 1] - a[i]... | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
using namespace std;
int main() {
int k, n;
cin >> k >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int distance[n];
int ans = 0;
for (int i = 0; i < n - 1; i++) {
distance[i] = a[i + 1] - a[i]... | [["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 12, 69, 28, 22], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 70], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 13], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 73]] | 1 | 166 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef std::pair<int, int> pint;
using namespace std;
typedef long long ll;
int main() {
int K;
cin >> K;
int N;
cin >> N;
vector<int> list;
int max = 0;
rep(i, N) {
int tmp;
cin >> tmp;
list.push_back(tmp);
}
rep(... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef std::pair<int, int> pint;
using namespace std;
typedef long long ll;
int main() {
int K;
cin >> K;
int N;
cin >> N;
vector<int> list;
int max = 0;
rep(i, N) {
int tmp;
cin >> tmp;
list.push_back(tmp);
}
rep(... | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]] | 1 | 163 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
using namespace std;
using ll = long long;
using d = double;
int main() {
int k, n;
cin >> k >> n;
int a[n - 1] = {0};
rep(i, n) cin >> a[i];
int c = 0;
for (int i = 0; i < n - 1; ++i) {
c = max(c, a[i + 1] - a[... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
using namespace std;
using ll = long long;
using d = double;
int main() {
int k, n;
cin >> k >> n;
int a[n - 1] = {0};
rep(i, n) cin >> a[i];
int c = 0;
for (int i = 0; i < n - 1; ++i) {
c = max(c, a[i + 1] - a[... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33]] | 1 | 143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.