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 |
|---|---|---|---|---|
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.1415926535897... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.1415926535897... | [["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59]] | 1 | 1,061 |
n, k = map(int, input().split())
mod = 10 * 9 + 7
ans = 0
for i in range(k, n+2):
ans += int(n*(n+1)/2 - (n-i)*(n - i + 1)/2 - (i-1)*i/2 + 1)
print(ans%mod) | n, k = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
for i in range(k, n+2):
ans += int(n*(n+1)/2 - (n-i)*(n - i + 1)/2 - (i-1)*i/2 + 1)
print(ans%mod) | [["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 48], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 17, 578]] | 5 | 86 |
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
N, K = map(int, readline().split())
N = N + 1
lower = None
upper = None
answer = 0
for k in range(K, N+1):
if lower is None:
lower = sum(ran... | import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
N, K = map(int, readline().split())
N = N + 1
lower = None
upper = None
answer = 0
for k in range(K, N+1):
if lower is None:
lower = sum(ran... | [["-", 8, 196, 0, 1, 0, 677, 12, 657, 17, 109], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]] | 5 | 140 |
#include <bits/stdc++.h>
#define fastcin() \
cin.tie(0); \
ios::sync_with_stdio(false)
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rep1(i, n) for (int i = 1; i <= int(n); i++)... | #include <bits/stdc++.h>
#define fastcin() \
cin.tie(0); \
ios::sync_with_stdio(false)
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rep1(i, n) for (int i = 1; i <= int(n); i++)... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 467 |
#include <bits/stdc++.h>
using namespace std;
#define IOS \
cin.tie(0); \
ios_base::sync_with_stdio(false)
#define ll long long
#define Fi first
#define Se second
#define Pb push_bac... | #include <bits/stdc++.h>
using namespace std;
#define IOS \
cin.tie(0); \
ios_base::sync_with_stdio(false)
#define ll long long
#define Fi first
#define Se second
#define Pb push_bac... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22]] | 1 | 654 |
#include <iostream>
using namespace std;
int main() {
long n, k;
cin >> n >> k;
long long compteur = 0;
;
long long gauche = ((k - 1) * (k)) / 2;
long long droite = (k * n) - ((k - 1) * (k)) / 2;
for (long l = k; l <= n + 1; l++) {
compteur += (droite - gauche + 1);
gauche += l;
droite += n - ... | #include <iostream>
#define MOD 1000000007
using namespace std;
int main() {
long n, k;
cin >> n >> k;
long long compteur = 0;
;
long long gauche = ((k - 1) * (k)) / 2;
long long droite = (k * n) - ((k - 1) * (k)) / 2;
for (long l = k; l <= n + 1; l++) {
compteur += (droite - gauche + 1);
gauche +... | [["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]] | 1 | 119 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
int i;
cin >> N >> K;
int count = 0;
for (i = K; i <= N + 1; i++) {
count += ((N + 1 - i) * i + 1);
}
cout << count % 1000000007 << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, K;
long long i;
cin >> N >> K;
long long count = 0;
for (i = K; i <= N + 1; i++) {
count += ((N + 1 - i) * i + 1);
}
cout << count % 1000000007 << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 72 |
#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)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;... | #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)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;... | [["-", 31, 16, 12, 69, 341, 342, 0, 16, 12, 22], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 12, 22], ["-", 0, 11, 12, 16, 12, 69, 341, 342, 0, 22], ["+", 12, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]] | 1 | 348 |
// !Start && !End
// 0 se divide
// https: //www.youtube.com/watch?v=6Nb-prB-4P0&list=RD6Nb-prB-4P0&start_radio=1
// https: //www.youtube.com/watch?v=eYDI8b5Nn5s
// Electrify my OOOoooooOOOoooOOOOOoooooOOOooo!
// #pragma optimise GCC(-O2)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii ... | // !Start && !End
// 0 se divide
// https: //www.youtube.com/watch?v=6Nb-prB-4P0&list=RD6Nb-prB-4P0&start_radio=1
// https: //www.youtube.com/watch?v=eYDI8b5Nn5s
// Electrify my OOOoooooOOOoooOOOOOoooooOOOooo!
// #pragma optimise GCC(-O2)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii ... | [["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]] | 1 | 399 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#if !ONLINE_JUDGE
#define debug
#endif
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
ty... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#if !ONLINE_JUDGE
#define debug
#endif
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
ty... | [["+", 49, 50, 51, 16, 31, 16, 31, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 17, 48], ["+", 51, 16, 12, 16, 31, 16, 31, 16, 17, 48], ["+", 51, 16, 12, 16, 31, 16, 31, 16, 12, 13]] | 1 | 1,116 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
long long ans = 0;
for (int i = k; i <= n + 1; i++) {
long long x = (2 * n - i + 1) * i;
long long y = (i - 1) * i;
y /= 2;
x /= 2;
x -= y - 1;
x %= 1000000007;
ans += x;
ans %= 1000000007;... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
long long ans = 0;
for (long long i = k; i <= n + 1; i++) {
long long x = (2 * n - i + 1) * i;
long long y = (i - 1) * i;
y /= 2;
x /= 2;
x -= y - 1;
x %= 1000000007;
ans += x;
ans %= 10000... | [["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 39, 86, 0, 96]] | 1 | 108 |
//
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define f first
#define s second
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
const ll MOD = 1000000007;
const int INF = 1000000007;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n, k;
cin >> n ... | //
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define f first
#define s second
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
const ll MOD = 1000000007;
const int INF = 1000000007;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n, k;
cin >> n ... | [["-", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["-", 31, 23, 0, 16, 31, 16, 31, 16, 31, 22], ["-", 31, 23, 0, 16, 31, 16, 31, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 16, 31, 23, 0, 25], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]] | 1 | 155 |
N,K = map(int,input().split())
M = 10**9 + 7
T = pow(10,100,M)
ans = 0
for k in range(K, N+2):
ans += (2*N-k+1)*k//2 - k*(k-1)//2 + 1
print(ans) | N,K = map(int,input().split())
M = 10**9 + 7
T = pow(10,100,M)
ans = 0
for k in range(K, N+2):
ans += (2*N-k+1)*k//2 - k*(k-1)//2 + 1
ans %= M
print(ans) | [["+", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 132], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22]] | 5 | 79 |
n, k = map(int, input().split())
cnt = 0
mod = 10**9+7
for i in range(k,n+2):
sum_min = i*(i-1) // 2
sum_max = i*(2*n-i+1) // 2
#print((sum_max - sum_min + 1))
cnt = cnt + (sum_max - sum_min + 1)%mod
print(cnt) | n, k = map(int, input().split())
cnt = 0
mod = 10**9+7
for i in range(k,n+2):
sum_min = i*(i-1) // 2
sum_max = i*(2*n-i+1) // 2
#print((sum_max - sum_min + 1))
cnt = (cnt + sum_max - sum_min + 1)%mod
print(cnt) | [["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["-", 0, 662, 12, 657, 12, 657, 31, 23, 0, 24]] | 5 | 82 |
N, K = map(int, input("").split(" "))
cnt = 0
for i in range(K, N+2):
start_idx = 0
end_idx = 0
#for j in range(i):
# start_idx += j
start_idx = (i-1) * (i)//2
#for j in range(i):
# end_idx += (N-j)
end_idx = (i)*N - start_idx
#print( end_idx - start_idx+1)
cnt += (end_idx - start_idx+1)... | N, K = map(int, input("").split(" "))
cnt = 0
for i in range(K, N+2):
start_idx = 0
end_idx = 0
#for j in range(i):
# start_idx += j
start_idx = (i-1) * (i)//2
#for j in range(i):
# end_idx += (N-j)
end_idx = (i)*N - start_idx
#print( end_idx - start_idx+1)
cnt += (end_idx - start_idx+1... | [["-", 0, 1, 0, 677, 12, 23, 0, 657, 17, 140], ["+", 0, 677, 12, 23, 0, 657, 31, 657, 17, 578], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 17, 140], ["+", 0, 657, 12, 23, 0, 657, 31, 657, 17, 578]] | 5 | 99 |
#include <cmath>
#include <iostream>
using namespace std;
int main() {
long long max = pow(10, 9) + 7;
int n, k;
cin >> n >> k;
long long sum = 0;
for (int t = k; t <= n + 1; t++) {
sum += t * (n - t + 1) + 1 % max;
}
cout << sum % max << endl;
return 0;
}
| #include <cmath>
#include <iostream>
using namespace std;
int main() {
long long max = pow(10, 9) + 7;
long long n, k;
cin >> n >> k;
long long sum = 0;
for (int t = k; t <= n + 1; t++) {
sum += t * (n - t + 1) + 1 % max;
}
cout << sum % max << endl;
return 0;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 89 |
#include <iostream>
long n, k, a, m = 1e9 + 7;
main() {
std::cin >> n >> k;
for (int i = k; i < n + 2; i++)
a += (i * (n - i + 1) + 1) % m;
std::cout << a;
} | #include <iostream>
long n, k, a, i, m = 1e9 + 7;
main() {
std::cin >> n >> k;
for (i = k; i < n + 2; i++)
a = (a + i * (n - i + 1) + 1) % m;
std::cout << a;
} | [["+", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 8, 9, 0, 7, 8, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 7, 8, 1, 0, 11, 17, 32], ["+", 12, 16, 31, 23, 0, 16, 31, 16, 31, 22], ["+", 12, 16, 31, 23, 0, 16, 31, 16, 17, 72]] | 1 | 68 |
#include <bits/stdc++.h>
#define int long long
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define vi vector<int>
#define vvi vector<vector<int>>
#define mii map<int, int>
#define pb push_back
#define pii pair<int, int>
#define mkp make_pair
#define scan(a, n) ... | #include <bits/stdc++.h>
#define int long long
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define vi vector<int>
#define vvi vector<vector<int>>
#define mii map<int, int>
#define pb push_back
#define pii pair<int, int>
#define mkp make_pair
#define scan(a, n) ... | [["-", 12, 16, 31, 16, 12, 23, 0, 16, 17, 33], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 17, 72]] | 1 | 467 |
import numpy
N, K = map(int, input().split(' '))
right = 0
s = 0
for i in range(K, N+2):
mi = (i-1)*i/2
ma = (2*N-i+1)*i/2
s += (ma - mi) + 1
print(int(s%(1e7+7)))
| import numpy
N, K = map(int, input().split(' '))
right = 0
s = 0
for i in range(K, N+2):
mi = (i-1)*i/2
ma = (2*N-i+1)*i/2
s += (ma - mi) + 1
print(int(s%(1e9+7)))
| [["-", 3, 4, 0, 657, 12, 23, 0, 657, 31, 531], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 31, 531]] | 5 | 87 |
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
ll MOD = 10e9 + 7;
int main() {
ll n, k;
cin >> n >> k;
ll sum = 0;
for (int i = k; i <= n + 1; i++) {
sum += (n - i + 1) * i + 1;
sum %= MOD;
}
cout ... | #include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
ll MOD = 1e9 + 7;
int main() {
ll n, k;
cin >> n >> k;
ll sum = 0;
for (int i = k; i <= n + 1; i++) {
sum += (n - i + 1) * i + 1;
sum %= MOD;
}
cout <... | [["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13]] | 1 | 96 |
n,k=list(map(int,input().split()))
s=0
for i in range(k,n+2):
s+=i*(2*n-i+1)+1
print(s%(1000000007)) | n,k=list(map(int,input().split()))
s=0
for i in range(k,n+2):
s+=i*(n-i+1)+1
print(s%(1000000007)) | [["-", 12, 23, 0, 657, 31, 657, 31, 657, 31, 612], ["-", 12, 23, 0, 657, 31, 657, 31, 657, 17, 48]] | 5 | 57 |
n, k = map(int, input().split())
def sum2(nums):
res = 0
for num in nums:
res += num
res %= 1000000007
return res
sum2(1 + l * (n + 1 - l) for l in range(k, n + 2)) | n, k = map(int, input().split())
def sum2(nums):
res = 0
for num in nums:
res += num
res %= 1000000007
return res
print(sum2(1 + l * (n + 1 - l) for l in range(k, n + 2))) | [["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 3, 668, 0, 659, 12, 652, 3, 4, 0, 25]] | 5 | 63 |
n, k = gets.split.map(&:to_i)
count = 0
mod = 10**9+7
k.upto(n+1) do |i|
min = i * (i-1) / 2
max = i * (2*(n+1-i) + (i-1)) / 2
count += (max - (min-1)) % mod
end
puts count
| n, k = gets.split.map(&:to_i)
count = 0
mod = 10**9+7
k.upto(n+1) do |i|
min = i * (i-1) / 2
max = i * (2*(n+1-i) + (i-1)) / 2
count += (max - (min-1))
end
puts count % mod
| [["-", 196, 737, 8, 736, 0, 755, 12, 738, 17, 109], ["-", 196, 737, 8, 736, 0, 755, 12, 738, 12, 22], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 17, 109], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 12, 22]] | 4 | 85 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ALL(s) (s).begin(), (s).end()
#define ALLn(s, n) s, s + n
#define F first
#define S second
#define pb push_back
#define tc(t) \
int t; ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ALL(s) (s).begin(), (s).end()
#define ALLn(s, n) s, s + n
#define F first
#define S second
#define pb push_back
#define tc(t) \
int t; ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]] | 1 | 227 |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ll mod = 1e9;
ll n, k;
cin >> n >> k;
ll ans = 0;
for (ll i = k; i <= n + 1; i++) {
ans += ((2 * n - i + 1) * i) / 2;
ans %= mod;
ans -= (i * (i - 1)) / 2;
ans %= mod;
ans++;
ans %= mod;
}
if (ans < 0)... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ll mod = 1e9 + 7;
ll n, k;
cin >> n >> k;
ll ans = 0;
for (ll i = k; i <= n + 1; i++) {
ans += ((2 * n - i + 1) * i) / 2;
ans %= mod;
ans -= (i * (i - 1)) / 2;
ans %= mod;
ans++;
ans %= mod;
}
if (ans ... | [["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]] | 1 | 119 |
n,k=map(int,input().split())
s=0
for i in range(k,n+2):
s+=(n-i+1)*i+1
print(s) | n,k=map(int,input().split())
s=0
for i in range(k,n+2):
s+=i*(n-i+1)+1
print(s%1000000007)
| [["+", 0, 1, 0, 677, 12, 657, 31, 657, 31, 22], ["+", 0, 1, 0, 677, 12, 657, 31, 657, 17, 48], ["-", 0, 1, 0, 677, 12, 657, 31, 657, 17, 48], ["-", 0, 1, 0, 677, 12, 657, 31, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]] | 5 | 48 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int K = scan.nextInt();
long answer = 0;
for (int i = K; i <= N + 1; i++) {
long temp = 0;
temp += i * (2 * (N - i + 1) + (i - 1)) /... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
long N = scan.nextLong();
int K = scan.nextInt();
long answer = 0;
for (long i = K; i <= N + 1; i++) {
long temp = 0;
temp += i * (2 * (N - i + 1) + (i - 1)... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["-", 8, 196, 0, 7, 502, 503, 39, 506, 0, 507], ["+", 8, 196, 0, 7, 502, 503, 39, 506, 0, 96]] | 3 | 138 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for (ll(i) = (0); (i) < (n); ++i)
#define REV(i, n) for (ll(i)... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for (ll(i) = (0); (i) < (n); ++i)
#define REV(i, n) for (ll(i)... | [["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]] | 1 | 226 |
#include <algorithm>
#include <iostream>
#include <numeric>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
long long sum1 = 0;
long long sum2 = 0;
long long total = 0;
for (long long i = 0; i < K - 1; i++) {
sum1 += N - i;
sum2... | #include <algorithm>
#include <iostream>
#include <numeric>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
long long sum1 = 0;
long long sum2 = 0;
long long total = 0;
for (long long i = 0; i < K - 1; i++) {
sum1 += N - i;
sum2... | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 24], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 31, 13], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 25]] | 1 | 133 |
N,K = map(int,input().split())
a =0
for i in range(K,N+2):
a = a + ((N+N-i+1)*i/2-(i-1)*(i)/2+1)
print(int(a%10**9+7)) | N,K = map(int,input().split())
a =0
for i in range(K,N+2):
a = a + ((N+N-i+1)*i/2-(i-1)*(i)/2+1)
print(int(a % (10**9+7))) | [["+", 0, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 657, 12, 23, 0, 25]] | 5 | 77 |
N,K = map(int,input().split())
ans = 0
mod = 10**9+7
for k in range(K,N+2):
ans += (k*(N-k+1)+1) % mod
print(ans)
| N,K = map(int,input().split())
ans = 0
mod = 10**9+7
for k in range(K,N+2):
ans += (k*(N-k+1)+1)
print(ans % mod)
| [["-", 8, 196, 0, 1, 0, 677, 12, 657, 17, 109], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]] | 5 | 59 |
MOD = 10**9+7
N,K = map(int,input().split())
cnt = 0
for k in range(K,N+2):
t = (N-k+1)*k
cnt += t
cnt %= MOD
print(cnt) | MOD = 10**9+7
N,K = map(int,input().split())
cnt = 0
for k in range(K,N+2):
t = (N-k+1)*k+1
cnt += t
cnt %= MOD
print(cnt) | [["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]] | 5 | 59 |
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
const int mod = 998244353;
const int64 infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
cerr << fixed << setp... | #include <bits/stdc++.h>
using namespace std;
using int64 = long long;
const int mod = 1e9 + 7; //
const int64 infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
cerr << fixed << set... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13]] | 1 | 1,198 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
long int N, K;
cin >> N >> K;
long int total = 0;
for (long int i = K; i <= N + 1; i++) {
total += (((N + N - i + 1) * i / 2) - ((i - 1) * i / 2) + 1) % 1000000007;
}
cout << total << endl... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
long int N, K;
cin >> N >> K;
long int total = 0;
for (long int i = K; i <= N + 1; i++) {
total += (((N + N - i + 1) * i / 2) - ((i - 1) * i / 2) + 1);
}
cout << total % 1000000007 << endl... | [["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 99 |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 2e5 + 7;
const int Inf = 1 << 30;
const LL INF = 1LL << 60;
const int Mod = 1e9 + 7;
int n, k, ans;
int main() {
cin >> n >> k;
for (int i = k; i <= n + 1; i++) {
ans += (2 * n - i + 1) * i / 2;
ans -= (i - 1) * i / 2 - 1;... | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 2e5 + 7;
const int Inf = 1 << 30;
const LL INF = 1LL << 60;
const int Mod = 1e9 + 7;
LL n, k, ans;
int main() {
cin >> n >> k;
for (LL i = k; i <= n + 1; i++) {
ans += (2 * n - i + 1) * i / 2;
ans -= (i - 1) * i / 2 - 1;
... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["+", 0, 16, 31, 16, 12, 16, 12, 74, 0, 24], ["+", 31, 16, 12, 16, 12, 74, 39, 77, 39, 78], ["+", 0, 16, 31, 16, 12, 16, 12, 74, 0, 25]] | 1 | 121 |
// xenowi`tz -- Jai Shree Ram
#include <bits/stdc++.h>
using namespace std;
#define fori(i, a, b) for (long long int i = a; i <= b; ++i)
#define ford(i, a, b) for (long long int i = a; i >= b; --i)
#define mk make_pair
#define mod 1000000007
#define MAXN 200005
#define pb push_back
#define vec vector<long long int>
#d... | // xenowi`tz -- Jai Shree Ram
#include <bits/stdc++.h>
using namespace std;
#define fori(i, a, b) for (long long int i = a; i <= b; ++i)
#define ford(i, a, b) for (long long int i = a; i >= b; --i)
#define mk make_pair
#define mod 1000000007
#define MAXN 200005
#define pb push_back
#define vec vector<long long int>
#d... | [["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 31, 23, 0, 16, 31, 16, 31, 16, 31, 22], ["+", 31, 23, 0, 16, 31, 16, 31, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]] | 1 | 164 |
MOD = 10 ** 9 + 7
def calc(a):
smallest = a * (a-1) // 2
largest = smallest + a * (n-a+1)
return largest - smallest + 1
n, k = map(int, input().split())
ans = 0
for a in range(k, n+2):
ans += calc(a)
ans % MOD
print(ans)
| MOD = 10 ** 9 + 7
def calc(a):
smallest = a * (a-1) // 2
largest = smallest + a * (n-a+1)
return largest - smallest + 1
n, k = map(int, input().split())
ans = 0
for a in range(k, n+2):
ans += calc(a)
ans %= MOD
print(ans)
| [["-", 0, 7, 8, 196, 0, 1, 0, 657, 17, 109], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 132]] | 5 | 87 |
N, K = map(int, input().split())
MOD = 1000000007
small = 0
large = 0
res = 0
for i in range(K-1):
small += i
large += N-i
for i in range(K, N+2):
small += i-1
large += N - i +1
gap = large - small +1
res += gap
print(res)
| N, K = map(int, input().split())
MOD = 1000000007
small = 0
large = 0
res = 0
for i in range(K-1):
small += i
large += N-i
for i in range(K, N+2):
small += i-1
large += N - i +1
gap = large - small +1
res += gap
print(res%MOD)
| [["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]] | 5 | 84 |
N, K = map(int, input().split())
MOD = 10**9 + 7
ans = 0
for k in range(K, N+2):
l = (k*(2*N-k+1)//2)%MOD
a = (k*(k-1)//2)%MOD
ans += (l-a+1)%MOD
print(ans) | N, K = map(int, input().split())
MOD = 10**9 + 7
ans = 0
for k in range(K, N+2):
l = (k*(2*N-k+1)//2)%MOD
a = (k*(k-1)//2)%MOD
ans += (l-a+1)%MOD
print(ans%MOD) | [["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]] | 5 | 87 |
n,k=map(int,input().split())
ans=0
mod=10**9+7
for i in range(k,n+2):
ans+=(2*n-i)*i//2-i*(i+1)//2+1
ans%=mod
print(ans)
| n,k=map(int,input().split())
ans=0
mod=10**9+7
for i in range(k,n+2):
ans+=(2*n-i+1)*i//2-i*(i-1)//2+1
ans%=mod
print(ans) | [["+", 31, 657, 31, 657, 31, 23, 0, 657, 17, 72], ["+", 31, 657, 31, 657, 31, 23, 0, 657, 12, 612], ["-", 12, 657, 31, 657, 12, 23, 0, 657, 17, 72], ["+", 12, 657, 31, 657, 12, 23, 0, 657, 17, 33]] | 5 | 70 |
n,k=map(int,input().split())
mod=10**9+7
ans=0
for i in range(k,n+2):
ans+=((2*n-i+1)*i//2-i*(i-1)//2+1)%mod
print(ans) | n,k=map(int,input().split())
mod=10**9+7
ans=0
for i in range(k,n+2):
ans+=(2*n-i+1)*i//2-i*(i-1)//2+1
ans%=mod
print(ans) | [["-", 31, 657, 31, 657, 31, 657, 31, 23, 0, 24], ["-", 0, 1, 0, 677, 12, 657, 31, 23, 0, 25], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 17, 109], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 132]] | 5 | 73 |
/*<----------------------------------------------------------------------->
<-------------------------------------------------------------------------->
_ __ _ _____ _____ _____
___ _ _| |__ ___ / _|_ __ ___ __ _| | __ |___ |___ |___ |
/ __| | | | '_ \ / _ \ |_| '__... | /*<----------------------------------------------------------------------->
<-------------------------------------------------------------------------->
_ __ _ _____ _____ _____
___ _ _| |__ ___ / _|_ __ ___ __ _| | __ |___ |___ |___ |
/ __| | | | '_ \ / _ \ |_| '__... | [["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13]] | 1 | 289 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll N, K, a, b, ans = 0;
cin >> N >> K;
for (ll i = K; i <= N + 1; i++) {
a = (2 * N - i + 1) * i / 2;
if (i == 1) {
b = 0;
}
if (i == 2) {
b = 1;
} else {
b = (i - 1) * i / 2;
}
ans += a -... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll N, K, a, b, ans = 0;
cin >> N >> K;
for (ll i = K; i <= N + 1; i++) {
a = (2 * N - i + 1) * i / 2;
if (i == 1) {
b = 0;
}
if (i == 2) {
b = 1;
} else {
b = (i - 1) * i / 2;
}
ans += a -... | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 121 |
#include <bits/stdc++.h>
#define int long long
#define fast \
ios::sync_with_stdio(false); \
cin.tie(NULL);
#define loop(i, n) for (int i = 0; i < n; i++)
#define double long double
#define mod 10000000... | #include <bits/stdc++.h>
#define int long long
#define fast \
ios::sync_with_stdio(false); \
cin.tie(NULL);
#define loop(i, n) for (int i = 0; i < n; i++)
#define double long double
#define mod 10000000... | [["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 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, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]] | 1 | 254 |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
LL res = 0;
for (int i = k; i <= n + 1; i++) {
res += (i * (n + 1 - i)) % mod + 1;
// if(res>mod) res-=mod;
// res++;
}
// if(res>mod) res-=mod;
cout << res % mo... | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod = 1e9 + 7;
int main() {
LL n, k;
cin >> n >> k;
LL res = 0;
for (int i = k; i <= n + 1; i++) {
res += (i * (n + 1 - i)) % mod + 1;
// if(res>mod) res-=mod;
// res++;
}
// if(res>mod) res-=mod;
cout << res % mod... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 91 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long N;
long long K;
cin >> N >> K;
if (K == N + 1) {
cout << 1 << endl;
} else {
long long sum = 0;
for (int i = K; i < N + 2; i++) {
sum = sum + i * (N - i + 1) + 1;
}
cout << sum << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N;
long long K;
cin >> N >> K;
if (K == N + 1) {
cout << 1 << endl;
} else {
long long sum = 0;
for (int i = K; i < N + 2; i++) {
sum = sum + i * (N - i + 1) + 1;
}
cout << sum % 1000000007 << endl;
}
} | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 91 |
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque
from collections import Counter
import math
import pprint
from functools import reduce
# stdin = open("sample.txt")
def keta(kazu):
kazu_str = str(kazu)
kazu_list = [int(kazu_str[i]) for i in range(0, le... | # -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque
from collections import Counter
import math
import pprint
from functools import reduce
# stdin = open("sample.txt")
def keta(kazu):
kazu_str = str(kazu)
kazu_list = [int(kazu_str[i]) for i in range(0, le... | [["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21]] | 5 | 196 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
#define forn(i, n) for (int(i) = 0; (i) != (n); (i)++)
#define all(v) (v)... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
#define forn(i, n) for (int(i) = 0; (i) != (n); (i)++)
#define all(v) (v)... | [["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]] | 1 | 248 |
def sep():
return map(int,input().strip().split(" "))
def lis():
return list(sep())
n=int(input())
ar=lis()
data=[]
for i in range(n):
data.append((ar[i],i))
data.sort(reverse=True)
dp = [[0] * (n+1) for _ in range(n+1)]
for i in range(n):
a, p = data[i]
for j in range(i+1):
dp[i+1][j+1] =... | def sep():
return map(int,input().strip().split(" "))
def lis():
return list(sep())
n=int(input())
ar=lis()
data=[]
for i in range(n):
data.append((ar[i],i))
data.sort(reverse=True)
dp = [[0] * (n+1) for _ in range(n+1)]
for i in range(n):
a, p = data[i]
for j in range(i+1):
dp[i+1][j+1] =... | [["-", 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 | 234 |
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
b.append([a[i],i])
b.sort()
b = b[::-1]
print(b)
dp = [[0]* (n+1) for i in range(n+1)]
cnt = 0
for i,j in b:
for k in range(cnt+1):
dp[cnt-k][k+1] = max(dp[cnt-k][k] + abs(n-1-j-k)*i,dp[cnt-k][k+1])
dp[cnt-k+1][k] = ma... | n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
b.append([a[i],i])
b.sort()
b = b[::-1]
#print(b)
dp = [[0]* (n+1) for i in range(n+1)]
cnt = 0
for i,j in b:
for k in range(cnt+1):
dp[cnt-k][k+1] = max(dp[cnt-k][k] + abs(n-1-j-k)*i,dp[cnt-k][k+1])
dp[cnt-k+1][k] = m... | [["-", 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 | 246 |
#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
typedef long long ll;
ll ans, f[N][N], res;
int n;
struct node {
ll val;
int pos;
} a[N];
bool cmp(node a, node b) { return a.val > b.val; }
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i].val;
a[i].pos = i;
}
so... | #include <bits/stdc++.h>
using namespace std;
const int N = 4005;
typedef long long ll;
ll ans, f[N][N], res;
int n;
struct node {
ll val;
int pos;
} a[N];
bool cmp(node a, node b) { return a.val > b.val; }
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i].val;
a[i].pos = i;
}
so... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 7, 8, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 7, 10, 43, 49, 50, 51, 13]] | 1 | 340 |
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
class CommonIO {
public:
CommonIO() {
std::cin.tie(0);
std::io... | #include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
class CommonIO {
public:
CommonIO() {
std::cin.tie(0);
std::io... | [["-", 31, 11, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 31, 11, 12, 16, 12, 23, 0, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22]] | 1 | 863 |
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX... | [["+", 3, 4, 0, 16, 12, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 377 |
// IOI 2021
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cer... | // IOI 2021
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cer... | [["-", 0, 16, 31, 69, 341, 342, 0, 69, 28, 22], ["-", 31, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["-", 31, 69, 341, 342, 0, 69, 341, 342, 0, 73], ["-", 0, 37, 0, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 16, 12, 69, 341, 342, 0, 69, 28, 22], ["-", 12, 69, 341, 342, 0, 69, 341, 342, 0, 73]] | 1 | 450 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
#define pb push_back
using ll = long long;
using P = pair<ll, ll>;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
re... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
#define pb push_back
using ll = long long;
using P = pair<ll, ll>;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
re... | [["+", 12, 23, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 12, 13]] | 1 | 461 |
n = int(input())
a = list(map(int, input().split()))
babies = [(a, i) for i, a in enumerate(a)]
babies.sort(reverse=True)
dp = [[0 for _ in range(n)] for _ in range(n)]
ans = 0
for l in range(n):
for r in range(n):
if l+r == n:
ans = max(ans, dp[l][r])
break
activeness, ind = babies[l+r]
dp[... | n = int(input())
a = list(map(int, input().split()))
babies = [(a, i) for i, a in enumerate(a)]
babies.sort(reverse=True)
dp = [[0 for _ in range(n+1)] for _ in range(n+1)]
ans = 0
for l in range(n):
for r in range(n):
if l+r == n:
ans = max(ans, dp[l][r])
break
activeness, ind = babies[l+r]
... | [["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 211 |
import sys
sys.setrecursionlimit(2 ** 2000)
n = int(input())
a = list(map(int, input().split()))
a = [(i, v) for i, v in enumerate(a)]
a.sort(key=lambda x: x[1], reverse=True)
dp = [[-1] * (m + 1) for m in range(n + 1)]
# m: 何人選んだか, l: 左を選んだ人数
def f(m, l):
if m == n: return 0
if dp[m][l] != -1: return dp[m][l]... | import sys
sys.setrecursionlimit(2000 * 2)
n = int(input())
a = list(map(int, input().split()))
a = [(i, v) for i, v in enumerate(a)]
a.sort(key=lambda x: x[1], reverse=True)
dp = [[-1] * (m + 1) for m in range(n + 1)]
# m: 何人選んだか, l: 左を選んだ人数
def f(m, l):
if m == n: return 0
if dp[m][l] != -1: return dp[m][l]
... | [["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 578], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 48], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]] | 5 | 247 |
N = int(input())
def solve(a, i, prev):
r = N - len(prev) - i + 1
p = -i*a
for j, s in enumerate(prev):
yield max(p+abs(j-i)*a, s+abs(j+r)*a)
p = s
yield s+abs(len(prev)-i)*a
pd = [0]
A = map(int, input().split())
for a,i in sorted(((a, i) for i, a in enumerate(A, 1)), reverse=True):
pd = [*solve(a,... | N = int(input())
def solve(a, i, prev):
r = N - len(prev) - i + 1
p = -i*a
for j, s in enumerate(prev):
yield max(p+abs(j-i)*a, s+abs(j+r)*a)
p = s
yield s+abs(len(prev)-i)*a
pd = [0]
A = map(int, input().split())
for a,i in sorted(((a, i) for i, a in enumerate(A, 1)), reverse=True):
pd = [*solve(a,... | [["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22]] | 5 | 158 |
from collections import *
from itertools import *
N = int(input())
A = map(int, input().split())
SA = SB = 0
ABI = sorted(((b:=max(N-i, i-1)*a, SA:=SA+a, SB:=SB+b) and (a, b, i) for i, a in enumerate(A, 1)), reverse=True)
prev = {0:0}
prev_max = 0
for k, (a, b, i) in enumerate(ABI, 1):
curr = defaultdict(int)
cu... | from collections import *
from itertools import *
N = int(input())
A = map(int, input().split())
SA = SB = 0
ABI = sorted(((b:=max(N-i, i-1)*a, SA:=SA+a, SB:=SB+b) and (a, b, i) for i, a in enumerate(A, 1)), reverse=True)
prev = {0:0}
prev_max = 0
for k, (a, b, i) in enumerate(ABI):
curr = defaultdict(int)
curr_... | [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]] | 5 | 241 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define orep(i, n) for (int i = 1; i <= (n); ++i) // one rep
#define drep(i, n) for (int i = (n)-1; i >= 0; --i) // down rep
#define srep(i, s, t) for (int i = (s); i < (t); ++i) // set rep
#define rng(x) (x).begin(), (x).end() ... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define orep(i, n) for (int i = 1; i <= (n); ++i) // one rep
#define drep(i, n) for (int i = (n)-1; i >= 0; --i) // down rep
#define srep(i, s, t) for (int i = (s); i < (t); ++i) // set rep
#define rng(x) (x).begin(), (x).end() ... | [["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]] | 1 | 515 |
#include <bits/stdc++.h>
using namespace std;
long long dp[2005][2005];
int main() {
int n;
pair<int, int> a[2005];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i].first;
a[i].second = i;
}
sort(a, a + n,
[&](pair<int, int> x, pair<int, int> y) { return x.first > y.first; });
int p;... | #include <bits/stdc++.h>
using namespace std;
long long dp[2005][2005];
int main() {
int n;
pair<int, int> a[2005];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i].first;
a[i].second = i;
}
sort(a, a + n,
[&](pair<int, int> x, pair<int, int> y) { return x.first > y.first; });
int p;... | [["-", 12, 2, 3, 4, 0, 16, 12, 23, 0, 24], ["-", 3, 4, 0, 16, 12, 23, 0, 16, 17, 72], ["-", 3, 4, 0, 16, 12, 23, 0, 16, 12, 13], ["-", 12, 2, 3, 4, 0, 16, 12, 23, 0, 25], ["-", 3, 4, 0, 16, 12, 23, 0, 16, 31, 13], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 31, 22]] | 1 | 324 |
#include <bits/stdc++.h>
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) ... | #include <bits/stdc++.h>
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) ... | [["-", 0, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["-", 0, 16, 31, 69, 28, 69, 341, 342, 0, 73], ["-", 3, 4, 0, 16, 31, 69, 341, 342, 0, 70], ["+", 0, 16, 31, 69, 28, 69, 341, 342, 0, 73], ["+", 3, 4, 0, 16, 31, 69, 341, 342, 0, 70], ["+", 3, 4, 0, 16, 31, 69, 341, 342, 0, 22]] | 1 | 999 |
N = int(input())*400
A = list(map(int,input().split()))*400
A = [[a,i] for a,i in zip(A,range(1,N+1))]
A = sorted(A,reverse=True)
INF = float('inf')
dp = [[-INF] * (N+1) for _ in range(N+1)]
dp[0][0] = 0
ans = 0
for x_y in range(1,N+1):
a = A[x_y-1]
for x in range(x_y+1):
y = x_y-x
if x==0:
dp[x][y] =... | N = int(input())
A = list(map(int,input().split()))
A = [[a,i] for a,i in zip(A,range(1,N+1))]
A = sorted(A,reverse=True)
INF = float('inf')
dp = [[-INF] * (N+1) for _ in range(N+1)]
dp[0][0] = 0
ans = 0
for x_y in range(1,N+1):
a = A[x_y-1]
for x in range(x_y+1):
y = x_y-x
if x==0:
dp[x][y] = dp[x][y... | [["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 48], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]] | 5 | 302 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (i = 0; i < n; ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
int main() {
ll i, j;
ll n;
cin >> n;
vector<ll> a(n);
for (i = 0; i < n; ++i) {
cin >> a.at(i);
}
vector<pair<ll, ll>> b;
for (i = 0; i < n; ++i) {
b... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (i = 0; i < n; ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
int main() {
ll i, j;
ll n;
cin >> n;
vector<ll> a(n);
for (i = 0; i < n; ++i) {
cin >> a.at(i);
}
vector<pair<ll, ll>> b;
for (i = 0; i < n; ++i) {
b... | [["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 432 |
#include <bits/stdc++.h>
#define long long long int
using namespace std;
// @author: pashka
int main() {
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<pair<int, int>> q(n);
for (int i = 0; i < n; i++) {
q[i] = {a[i], i};
... | #include <bits/stdc++.h>
#define long long long int
using namespace std;
// @author: pashka
int main() {
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<pair<int, int>> q(n);
for (int i = 0; i < n; i++) {
q[i] = {a[i], i};
... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 368 |
n = gets.to_s.to_i
a = gets.to_s.split.map{|t| t.to_i }
a = a.map.with_index{|t,i| [t,i] }
dp = Array.new(n+1){ [0] * (n+1) }
a.each_with_index do |tmp,i|
a = tmp[0]
k = tmp[1]
(i+1).times do |j|
dp[i+1][j+1] = [ dp[i+1][j+1], dp[i][j] + (k-j) * a ].max
dp[i+1][j] = [ dp[i+1][j], dp[i]... | n = gets.to_s.to_i
a = gets.to_s.split.map{|t| t.to_i }
a = a.map.with_index{|t,i| [t,i] }.sort.reverse
dp = Array.new(n+1){ [0] * (n+1) }
a.each_with_index do |tmp,i|
a = tmp[0]
k = tmp[1]
(i+1).times do |j|
dp[i+1][j+1] = [ dp[i+1][j+1], dp[i][j] + (k-j) * a ].max
dp[i+1][j] = [ dp[i+1]... | [["+", 0, 493, 0, 662, 12, 652, 486, 652, 17, 131], ["+", 0, 493, 0, 662, 12, 652, 486, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]] | 4 | 194 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1001001001;
static const int MAX = 2000;
ll dp[MAX][MAX];
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1001001001;
static const int MAX = 2005;
ll dp[MAX][MAX];
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["-", 12, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["+", 12, 16, 31, 2, 3, 4, 0, 16, 12, 22]] | 1 | 338 |
n = int(input())
A = list(map(int, input().split()))
a = []
for i in range(len(A)):
a.append([A[i], i])
a.sort(key = lambda x: x[0], reverse = True)
dp = [[0 for i in range(n+1)] for j in range(n+1)]
for i in range(n):
for l in range(i+1):
dp[i+1][l] = max(dp[i+1][l], dp[i][l] + a[i][0]*(n-1-(i-l)-a[i][... | n = int(input())
A = list(map(int, input().split()))
a = []
for i in range(len(A)):
a.append([A[i], i])
a.sort(key = lambda x: x[0], reverse = True)
dp = [[0 for i in range(n+1)] for j in range(n+1)]
for i in range(n):
for l in range(i+1):
dp[i+1][l] = max(dp[i+1][l], dp[i][l] + a[i][0]*(n-1-(i-l)-a[i][... | [["-", 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 | 253 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
// 子どもを表す構造体
struct infant {
int position; // 位置
int64_t lively; // 活発度
// 活発度が同じ場合、位置で判断する
bool operator<(const infant &right) const {
return lively == right.lively ? position < right.position
... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
// 子どもを表す構造体
struct infant {
int position; // 位置
int64_t lively; // 活発度
// 活発度が同じ場合、位置で判断する
bool operator<(const infant &right) const {
return lively == right.lively ? position < right.position
... | [["+", 63, 118, 28, 2, 3, 4, 0, 16, 17, 72], ["+", 63, 118, 28, 2, 3, 4, 0, 16, 12, 13], ["+", 51, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["+", 51, 16, 31, 2, 3, 4, 0, 16, 12, 13]] | 1 | 507 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf
import pysnooper # @pysnooper.snoop() # debug
import math
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect
class Solver:... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf
import math
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect
class Solver:
def __init__(self, n, students):
... | [["-", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487]] | 5 | 404 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
con... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
con... | [["-", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22]] | 1 | 382 |
#define __mode_debug__
/* ξ
ll
_ll_
/ ∞ \
│* A *│
│* C *│
│* 祈 *│
│* 願 *│
│* *│
 ̄ ̄ ̄ ̄ ̄ */
// C++14 (GCC 5.4.1)
#include <bits/stdc++.h>
using namespace std;
#ifdef __mode_debug__
#define DBG
#else
#define DBG if (false)
#endif
#define LLINF (1LL << 60)
using ll = long long;
#define mod 100... | #define __mode_debug__
/* ξ
ll
_ll_
/ ∞ \
│* A *│
│* C *│
│* 祈 *│
│* 願 *│
│* *│
 ̄ ̄ ̄ ̄ ̄ */
// C++14 (GCC 5.4.1)
#include <bits/stdc++.h>
using namespace std;
#ifdef __mode_debug__
#define DBG
#else
#define DBG if (false)
#endif
#define LLINF (1LL << 60)
using ll = long long;
#define mod 100... | [["-", 0, 16, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 12, 13]] | 1 | 1,389 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int a[2005];
int v[2005];
ll dp[2005][2005];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
iota(v, v + 1 + n, 0);
sort(v + 1, v + 1 + n,
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int a[2005];
int v[2005];
ll dp[2005][2005];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
iota(v, v + 1 + n, 0);
sort(v + 1, v + 1 + n,
... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22]] | 1 | 343 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
template <typename T> struct BIT {
int n;
vector<T> d;
BIT(int n = 0) : n(n), d(n + 1) {}
void add(int i, T x = 1) {
for (i++; i <= n... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
template <typename T> struct BIT {
int n;
vector<T> d;
BIT(int n = 0) : n(n), d(n + 1) {}
void add(int i, T x = 1) {
for (i++; i <= n... | [["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21]] | 1 | 647 |
#include <stdio.h>
void main() {
int i, n, flag = 0;
scanf("%d", &n);
for (i = 0; i < 3; i++) {
if ((n / 10) % 7 == 0)
flag = 1;
else
n = n / 10;
if (flag == 1)
break;
}
if (flag == 1)
printf("Yes\n");
else
printf("No\n");
} | #include <stdio.h>
void main() {
int i, n, flag = 0;
scanf("%d", &n);
for (i = 0; i < 3; i++) {
if ((n % 10) == 7)
flag = 1;
else
n = n / 10;
if (flag == 1)
break;
}
if (flag == 1)
printf("Yes\n");
else
printf("No\n");
} | [["-", 0, 16, 31, 16, 31, 23, 0, 16, 17, 85], ["+", 15, 23, 0, 16, 31, 23, 0, 16, 17, 109], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 109], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]] | 0 | 96 |
#include <stdio.h>
void main() {
int k, i, j = 0;
scanf("%d", &k);
for (i = 0; i < 3; i++) {
if (k % 7 == 0)
j = 1;
k /= 10;
}
if (j == 1)
printf("Yes");
else
printf("No");
} | #include <stdio.h>
void main() {
int k, i, j = 0;
scanf("%d", &k);
for (i = 0; i < 3; i++) {
if (k % 10 == 7)
j = 1;
k /= 10;
}
if (j == 1)
printf("Yes");
else
printf("No");
} | [["-", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]] | 0 | 79 |
nums = list(str(input()))
if "7" in nums:
print("YES")
else:
print("NO") | nums = list(str(input()))
if "7" in nums:
print("Yes")
else:
print("No") | [["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]] | 5 | 32 |
# A Lucky 7
N = input()
for n in N:
if n == "7":
print("Yes")
else:
print("No") | # A Lucky 7
N = input()
for n in N:
if n == "7":
print("Yes")
exit()
else:
print("No") | [["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 32 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
for (int i = 0; i < s.length(); i++) {
if (s[i] == '7') {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
for (int i = 0; i < s.length(); i++) {
if (s[i] == '7') {
cout << "Yes" << endl;
return 0;
}
}
cout << "No" << endl;
return 0;
} | [["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 74 |
n = gets().chomp
found = false
n.split("\s").each do |x|
found = true if x.to_i == 7
end
puts found == true ? 'Yes' : 'No' | n = gets().chomp
found = false
n.split('').each do |x|
found = true if x.to_i == 7
end
puts found == true ? 'Yes' : 'No' | [["-", 0, 652, 486, 652, 3, 4, 0, 557, 0, 62], ["-", 0, 652, 486, 652, 3, 4, 0, 557, 0, 44], ["+", 0, 652, 486, 652, 3, 4, 0, 557, 0, 62]] | 4 | 46 |
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector... | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 0, 70], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 0, 73], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0... | 1 | 118 |
#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
int n, res = -1;
cin >> n;
if (n / 100 == 7) {
res = 1;
} else if (n / 10 == 7) {
res = 1;
} else if (n % 10 == 7) {
res = 1;
}
if (res == 1)
cout << "Yes" << endl;
else
cout << "No" ... |
#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
int n, res = -1;
cin >> n;
if (n / 100 % 10 == 7) {
res = 1;
} else if (n / 10 % 10 == 7) {
res = 1;
} else if (n % 10 == 7) {
res = 1;
}
if (res == 1)
cout << "Yes" << endl;
else
cou... | [["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 12, 13]] | 1 | 94 |
N=input()
if N.find('7') > 0:
print('Yes')
else:
print('No') | N=input()
#print (N.find('7'))
if N.find('7') !=-1:
print('Yes')
else:
print('No') | [["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 79], ["+", 0, 656, 0, 57, 15, 666, 0, 664, 17, 33], ["+", 0, 656, 0, 57, 15, 666, 0, 664, 28, 612]] | 5 | 31 |
<?php
$a=str_split(trim(fgets(SDTIN)));
if(in_array(7,$a)){
echo "Yes";
}else{
echo "No";
} | <?php
$a=str_split(trim(fgets(STDIN)));
if(in_array(7,$a)){
echo "Yes";
}else{
echo "No";
} | [["-", 0, 28, 0, 613, 3, 3, 0, 28, 0, 141], ["+", 0, 28, 0, 613, 3, 3, 0, 28, 0, 141]] | 6 | 40 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double PI = 3.1415926535897932;
/* a と b の最大公約数を返す関数 */
long long GCD(long long a,... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double PI = 3.1415926535897932;
/* a と b の最大公約数を返す関数 */
long long GCD(long long a,... | [["-", 0, 1, 0, 16, 31, 16, 12, 103, 0, 104], ["-", 0, 1, 0, 16, 31, 16, 12, 103, 0, 125], ["-", 0, 16, 31, 16, 12, 103, 0, 42, 0, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 166 |
def index(n):
result = "OK" if '7' in n else "NO"
return result
print(index(str(input()))) | def index(n):
result = "Yes" if '7' in n else "No"
return result
print(index(str(input()))) | [["-", 0, 1, 0, 662, 12, 41, 0, 557, 0, 6], ["+", 0, 1, 0, 662, 12, 41, 0, 557, 0, 6]] | 5 | 35 |
n = input()
if n.count(7) == 0:
print("No")
else:
print("Yes") | n = input()
if n.count("7") == 0:
print("No")
else:
print("Yes") | [["+", 15, 666, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 15, 666, 0, 652, 3, 4, 0, 557, 0, 655]] | 5 | 29 |
flag = False
for i in input():
if i == '7':
print('Yes')
flag = True
if not flag:
print('No') | flag = False
for i in input():
if i == '7':
print('Yes')
flag = True
break
if not flag:
print('No') | [["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]] | 5 | 36 |
n = list(input())
print("Yes") if all([i == "7" for i in n]) else print("No")
| n = list(input())
print("Yes") if any([i == "7" for i in n]) else print("No")
| [["-", 0, 656, 0, 1, 0, 41, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 41, 0, 652, 63, 22]] | 5 | 36 |
<?php
$line = fgets(STDUIN);
if(preg_match("/7/", $line)) {
echo "Yes";
} else {
echo "No";
}
?>
| <?php
$line = fgets(STDIN);
if(preg_match("/7/", $line)) {
echo "Yes";
} else {
echo "No";
}
?>
| [["-", 0, 11, 12, 613, 3, 3, 0, 28, 0, 141], ["+", 0, 11, 12, 613, 3, 3, 0, 28, 0, 141]] | 6 | 37 |
from collections import defaultdict
#dpa[(0,0)] = 0
n = int(input())
a = list(map(int, input().split()))
d = {}
for i in range(n):
d[i] = a[i]
dp = defaultdict(lambda: 0)
i = 0
x = 0
y = 0
maxr = 0
for k,v in sorted(d.items(), key=lambda x: -x[1]):
i+=1
# print(k,": ",v)
for j in range(i+1):
if j == 0:
mi... | from collections import defaultdict
#dpa[(0,0)] = 0
n = int(input())
a = list(map(int, input().split()))
d = {}
for i in range(n):
d[i] = a[i]
dp = defaultdict(lambda: 0)
i = 0
x = 0
y = 0
maxr = 0
for k,v in sorted(d.items(), key=lambda x: -x[1]):
i+=1
# print(k,": ",v)
for j in range(i+1):
if j == 0:
mi... | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 33], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]] | 5 | 232 |
n = int(input())
a = list(map(int, input().split()))
dp = [[-1] * (n+1) for i in range(n+1)]
A = []
for i in range(n):
A.append([a[i], i])
A.sort(reverse=True)
for i in range(1, n+1):
for j in range(i+1):
if j == 0:
dp[j][i-j] = dp[j][i-j-1] + A[i-1][0] * abs(n-i-A[i-1][1])
elif j ==... | n = int(input())
a = list(map(int, input().split()))
dp = [[0] * (n+1) for i in range(n+1)]
A = []
for i in range(n):
A.append([a[i], i])
A.sort(reverse=True)
for i in range(1, n+1):
for j in range(i+1):
if j == 0:
dp[j][i-j] = dp[j][i-j-1] + A[i-1][0] * abs(n-i-A[i-1][1])
elif j == ... | [["-", 12, 658, 8, 657, 31, 634, 0, 664, 17, 33], ["-", 12, 658, 8, 657, 31, 634, 0, 664, 28, 612], ["+", 0, 662, 12, 658, 8, 657, 31, 634, 0, 612]] | 5 | 336 |
def main():
N = int(input())
A = list(map(int, input().split()))
AA = [(v, i) for i, v in enumerate(A)]
AA.sort(reverse=True)
dp = [[0] * (N+1) for _ in range(N+1)]
for i, (a, b) in enumerate(AA, start=1):
for x in range(i+1):
y = i - x
if y == 0:
... | def main():
N = int(input())
A = list(map(int, input().split()))
AA = [(v, i) for i, v in enumerate(A)]
AA.sort(reverse=True)
dp = [[0] * (N+1) for _ in range(N+1)]
for i, (a, b) in enumerate(AA, start=1):
for x in range(i+1):
y = i - x
if y == 0:
... | [["+", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]] | 5 | 265 |
n = int(input())
a = list(map(int,input().split()))
ans = 0
place = [0]*n
active = sorted(a,reverse=True)
for i in range(n):
place[i] = a.index(active[i])
a[a.index(active[i])] = -1
#dp[x][y] x,y:0~n+1 (x[-1]=x[n+1]=0にすることで端の処理を楽にする)
dp = [[0 for i in range(n+2)]for j in range(n+2)]
for i in range(n):
dp[... | n = int(input())
a = list(map(int,input().split()))
ans = 0
place = [0]*n
active = sorted(a,reverse=True)
for i in range(n):
place[i] = a.index(active[i])
a[a.index(active[i])] = -1
#dp[x][y] x,y:0~n+1 (x[-1]=x[n+1]=0にすることで端の処理を楽にする)
dp = [[0 for i in range(n+2)]for j in range(n+2)]
for i in range(n):
dp[... | [["-", 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 | 341 |
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define endl '\n'
#define ll long long
const int N = 2e3 + 5;
pair<ll, ll> a[N];
ll dp[N][N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
// freopen("VLJUM.INP", "r", stdin);
// freopen("VLJUM.OUT", "w", ... | #include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define endl '\n'
#define ll long long
const int N = 2e3 + 5;
pair<ll, ll> a[N];
ll dp[N][N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
// freopen("VLJUM.INP", "r", stdin);
// freopen("VLJUM.OUT", "w", ... | [["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25]] | 1 | 315 |
#include <bits/stdc++.h>
using namespace std;
long long DP[2020][2020];
pair<long long, int> C[2020];
int main() {
int N;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> C[i].first;
C[i].second = i;
}
sort(C, C + N);
reverse(C, C + N);
for (int i = 0; i < N; i++)
for (int j = 0; j <= i; j++) {
... | #include <bits/stdc++.h>
using namespace std;
long long DP[2020][2020];
pair<long long, int> C[2020];
int main() {
int N;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> C[i].first;
C[i].second = i;
}
sort(C, C + N);
reverse(C, C + N);
for (int i = 0; i < N; i++)
for (int j = 0; j <= i; j++) {
... | [["+", 3, 4, 0, 16, 12, 16, 12, 23, 0, 24], ["+", 3, 4, 0, 16, 12, 16, 12, 23, 0, 25]] | 1 | 276 |
if "7" in input():
print("yes")
else:
print("no") | if "7" in input():
print("Yes")
else:
print("No")
| [["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]] | 5 | 23 |
N = int(input())
if 7 in N:
print("Yes")
else:
print('No') | N = (input())
if '7' in N:
print("Yes")
else:
print('No') | [["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 0, 656, 0, 57, 15, 666, 0, 557, 0, 655]] | 5 | 27 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int flag = 0;
for (int i = 0; i < 3; i++) {
int temp = n % 10;
if (temp == 7)
flag = 1;
n = n / 10;
}
if (flag)
cout << "YES";
else
cout << "NO";
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int flag = 0;
for (int i = 0; i < 3; i++) {
int temp = n % 10;
if (temp == 7)
flag = 1;
n = n / 10;
}
if (flag)
cout << "Yes";
else
cout << "No";
} | [["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]] | 1 | 80 |
////////////////////////////////////////////////
// ******** * * ******* * * // :
// * * * * * * * // 64 BITS C 64 BITS
// ***** * * * * * * // +
// * * * *********** * * //: 13 - 6 ... | ////////////////////////////////////////////////
// ******** * * ******* * * // :
// * * * * * * * // 64 BITS C 64 BITS
// ***** * * * * * * // +
// * * * *********** * * //: 13 - 6 ... | [["+", 51, 16, 31, 16, 31, 16, 12, 103, 0, 104], ["+", 51, 16, 31, 16, 12, 16, 12, 103, 0, 104], ["+", 15, 339, 51, 16, 12, 16, 12, 103, 0, 104], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 122 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.