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 <iostream>
#include <vector>
#define int long long
using namespace std;
signed main() {
int n, a;
cin >> n;
int A[n] = {0};
// nums.resize(n);
for (int i = 0; i < n - 1; i++) {
cin >> a;
A[a]++;
}
for (int i = 0; i < n; i++) {
cout << A[i] << endl;
}
retur... | #include <algorithm>
#include <iostream>
#include <vector>
#define int long long
using namespace std;
signed main() {
int n, a;
cin >> n;
int A[n] = {0};
// nums.resize(n);
for (int i = 0; i < n - 1; i++) {
cin >> a;
A[a - 1]++;
}
for (int i = 0; i < n; i++) {
cout << A[i] << endl;
}
r... | [["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]] | 1 | 95 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++)
cin >> A[i];
map<int, int> p;
for (int i = 0; i < N; i++) {
p[A[i]] += 1;
}
for (int i = 0; i < N; i++) {
cout << p[i] << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++)
cin >> A[i];
map<int, int> p;
for (int i = 0; i < N; i++) {
p[A[i] - 1] += 1;
}
for (int i = 0; i < N; i++) {
cout << p[i] << endl;
}
return 0... | [["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]] | 1 | 116 |
n = int(input())
A = list(map(int, input().split()))
N = [0]*n
for a in A:
N[a] += 1
for i in range(1, n):
print(N[i]) | n = int(input())
A = list(map(int, input().split()))
N = [0]*(n+1)
for a in A:
N[a] += 1
for i in range(1, n+1):
print(N[i]) | [["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 60 |
import collections
N=int(input())
A=list(map(int,input().split()))
a=collections.Counter(A)
for i in range(1,N+1):
print(a["i"]) | import collections
N=int(input())
A=list(map(int,input().split()))
a=collections.Counter(A)
for i in range(1,N+1):
print(a[i]) | [["-", 0, 652, 3, 4, 0, 206, 206, 557, 0, 654], ["-", 0, 652, 3, 4, 0, 206, 206, 557, 0, 655]] | 5 | 56 |
#include <bits/stdc++.h>
#define pb push_back
#define pf push_front
#define in insert
#define ff first
#define ss second
#define mp make_pair
#define int long long
#define uint unsigned long long
#define rep(i, x, m) for (int i = x; i < m; i++)
#define repr(i, x, m) for (int i = x; i >= m; i--)
#define MOD 1000000007
#... | #include <bits/stdc++.h>
#define pb push_back
#define pf push_front
#define in insert
#define ff first
#define ss second
#define mp make_pair
#define int long long
#define uint unsigned long long
#define rep(i, x, m) for (int i = x; i < m; i++)
#define repr(i, x, m) for (int i = x; i >= m; i--)
#define MOD 1000000007
#... | [["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 410 |
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, a... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, a... | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 247 |
N = int(input())
A = [int(i) for i in input().split(' ')]
B = [0] * N
for i in A:
B[i] += 1
for i in B:
print(i)
| N = int(input())
A = [int(i) for i in input().split(' ')]
B = [0] * N
for i in A:
B[i-1] += 1
for i in B:
print(i) | [["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]] | 5 | 56 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl /*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
#define rep(i, n)... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl /*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
#define rep(i, n)... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 272 |
n = int(input())
a = list(map(int,input().split()))
l = [0] * n
for i in range(len(a)):
l[a[i]-1] += 1
print(l)
for i in l:
print(i) | n = int(input())
a = list(map(int,input().split()))
l = [0] * n
for i in range(len(a)):
l[a[i]-1] += 1
for i in l:
print(i) | [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 67 |
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[n - 1] = {0};
int x;
for (int i = 0; i < n - 1; i++) {
cin >> x;
a[x - 1] += 1;
}
for (int j = 0; j < n - 1; j++) {
cout << a[j] << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[n] = {0};
int x;
for (int i = 0; i < n - 1; i++) {
cin >> x;
a[x - 1] += 1;
}
for (int j = 0; j < n; j++) {
cout << a[j] << endl;
}
return 0;
} | [["-", 0, 43, 49, 50, 49, 80, 81, 16, 17, 33], ["-", 0, 43, 49, 50, 49, 80, 81, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 95 |
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
arr[i] = 0;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
a--;
arr[a]++;
}
for (int i = 0; i < n; i++)
cout << arr[i] << "\n";
}
| #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
arr[i] = 0;
for (int i = 0; i < n - 1; i++) {
int a;
cin >> a;
a--;
arr[a]++;
}
for (int i = 0; i < n; i++)
cout << arr[i] << "\n";
}
| [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 103 |
#include <bits/stdc++.h>
#define hell 1000000007
#define Maxi 10000000000000000
#define lcm(a, b) (a * b) / __gcd(a, b)
#define ll long long
#define vll vector<ll>
#define vi vector<long long>
#define pll vector<pair<ll, ll>>
#define pb push_back
//#define mp make_pair
#define all(v) v.begin... | #include <bits/stdc++.h>
#define hell 1000000007
#define Maxi 10000000000000000
#define lcm(a, b) (a * b) / __gcd(a, b)
#define ll long long
#define vll vector<ll>
#define vi vector<long long>
#define pll vector<pair<ll, ll>>
#define pb push_back
//#define mp make_pair
#define all(v) v.begin... | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 297 |
#include <stdio.h>
int main() {
int N;
int A[200001];
int B[200001] = {0};
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%d", &A[i]);
B[A[i]]++;
}
for (int i = 1; i < N; i++)
printf("%d", B[i]);
} | #include <stdio.h>
int main() {
int N;
int A[200001];
int B[200001] = {0};
scanf("%d", &N);
for (int i = 1; i < N; i++) {
scanf("%d", &A[i]);
B[A[i]]++;
}
for (int i = 1; i < N + 1; i++)
printf("%d\n", B[i]);
} | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 0 | 101 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, t;
cin >> n;
vector<int> cnt(n + 1, 0);
for (int i = 0; i < n; i++) {
cin >> t;
cnt[t]++;
}
for (int i = 1; i <= n; i++)
cout << cnt[i] << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, t;
cin >> n;
vector<int> cnt(n + 1, 0);
for (int i = 1; i < n; i++) {
cin >> t;
cnt[t]++;
}
for (int i = 1; i <= n; i++)
cout << cnt[i] << endl;
}
| [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 83 |
N = int(input())
A = list(map(int,input().split()))
ans = [0]*N
for i in range(N-1):
ans[A[i]] += 1
for i in range(1,N):
print(ans[i]) | N = int(input())
A = list(map(int,input().split()))
ans = [0]*N
for i in range(N-1):
ans[A[i]-1] += 1
for i in range(0,N):
print(ans[i]) | [["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]] | 5 | 68 |
n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)
ans = Array.new(n,0)
(n-1).times do |k|
ans[(arr[k]-1)] += 1
end
p ans
n.times do |l|
puts ans[l]
end | n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)
ans = Array.new(n,0)
(n-1).times do |k|
ans[(arr[k]-1)] += 1
end
n.times do |l|
puts ans[l]
end
| [["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]] | 4 | 75 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long N;
long A[200000], B[200000];
for (long i = 0; i < 200000; i++)
B[i] = 0;
for (long i = 1; i < N; i++) {
cin >> A[i];
B[A[i] - 1]++;
}
for (long i = 0; i < N; i++)
cout << B[i] << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long N;
cin >> N;
long A[200000], B[200000];
for (long i = 0; i < 200000; i++)
B[i] = 0;
for (long i = 1; i < N; i++) {
cin >> A[i];
B[A[i] - 1]++;
}
for (long i = 0; i < N; i++)
cout << B[i] << endl;
return 0;
} | [["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 107 |
#include <bits/stdc++.h>
#define rep(i, n) for (long long int i = 0; i < n; i++)
#define _rep(i, m, n) for (long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll ... | #include <bits/stdc++.h>
#define rep(i, n) for (long long int i = 0; i < n; i++)
#define _rep(i, m, n) for (long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll ... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 198 |
n = gets.to_i
a = gets.split.map(&:to_i)
ans = Array.new(n, 0)
a.each do |x|
ans[x] += 1
end
1.upto(n) do |x|
puts ans[x]
end | n = gets.to_i
a = gets.split.map(&:to_i)
ans = Array.new(n+1, 0)
a.each do |x|
ans[x] += 1
end
1.upto(n+1) do |x|
puts ans[x]
end | [["+", 0, 662, 12, 652, 3, 4, 0, 738, 17, 72], ["+", 0, 662, 12, 652, 3, 4, 0, 738, 12, 612], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 17, 72], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 12, 612]] | 4 | 56 |
import sys
from collections import Counter
from typing import Callable, NoReturn, Tuple
def main() -> NoReturn:
scan: Callable[[], str] = sys.stdin.readline
n: int = int(scan().rstrip())
a: Tuple[int] = tuple(int(a_i) for a_i in scan().rstrip().split())
count: Counter = Counter(a)
for i in rang... | import sys
from collections import Counter
from typing import Callable, NoReturn, Tuple
def main() -> NoReturn:
scan: Callable[[], str] = sys.stdin.readline
n: int = int(scan().rstrip())
a: Tuple[int] = tuple(int(a_i) for a_i in scan().rstrip().split())
count: Counter = Counter(a)
for i in rang... | [["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 111 |
N=int(input())
A=list(map(int, input().split()))
B=[0]*len(A)
for i in A:
B[i-1]+=1
for i in B:
print(i) | N=int(input())
A=list(map(int, input().split()))
B=[0]*(len(A)+1)
for i in A:
B[i-1]+=1
for i in B:
print(i) | [["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 12, 23, 0, 657, 31, 652, 3, 4, 0, 25], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612]] | 5 | 57 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
#define ttttyyyy \
ios_base::sync_with_stdio(0); \
cin... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
#define ttttyyyy \
ios_base::sync_with_stdio(0); \
cin... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 155 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define yes "Yes"
#define yse "Yes"
#define no "No"
#define pb push_back
#define mp make_pair
#define NIL -1
#define list_itr list<ll>::iterator
#define rep(i, l, n... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define yes "Yes"
#define yse "Yes"
#define no "No"
#define pb push_back
#define mp make_pair
#define NIL -1
#define list_itr list<ll>::iterator
#define rep(i, l, n... | [["-", 0, 27, 28, 69, 28, 2, 3, 4, 0, 13], ["+", 0, 27, 28, 69, 28, 2, 3, 4, 0, 13], ["+", 28, 69, 28, 2, 3, 4, 0, 16, 17, 33], ["+", 28, 69, 28, 2, 3, 4, 0, 16, 12, 13]] | 1 | 420 |
#include <iostream>
using namespace std;
typedef unsigned long long int ll;
int main() {
ll n;
cin >> n;
ll v[n] = {0};
for (ll i = 0; i < n; i++) {
ll j;
cin >> j;
v[j - 1]++;
}
for (ll i = 0; i < n; i++) {
cout << v[i] << "\n";
}
return 0;
} | #include <iostream>
using namespace std;
typedef unsigned long long int ll;
int main() {
ll n;
cin >> n;
ll v[n] = {0};
for (ll i = 1; i < n; i++) {
ll j;
cin >> j;
v[j - 1]++;
}
for (ll i = 0; i < n; i++) {
cout << v[i] << "\n";
}
return 0;
} | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 97 |
#include <bits/stdc++.h>
using namespace std;
int t[200005];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
t[x]++;
}
for (int i = 1; i <= n; i++)
cout << t[i] << endl;
} | #include <bits/stdc++.h>
using namespace std;
int t[200005];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n - 1; i++) {
int x;
cin >> x;
t[x]++;
}
for (int i = 1; i <= n; i++)
cout << t[i] << endl;
} | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 77 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#defi... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#defi... | [["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]] | 1 | 337 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
A.at(0) = 0;
vector<int> B(N);
for (int i = 1; i < N; i++) {
cin >> A.at(i);
B.at(A.at(i) - 1)++;
}
for (int i = 1; i < N; i++) {
cout << B.at(i) << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
A.at(0) = 0;
vector<int> B(N);
for (int i = 1; i < N; i++) {
cin >> A.at(i);
B.at(A.at(i) - 1)++;
}
for (int i = 0; i < N; i++) {
cout << B.at(i) << endl;
}
}
| [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 113 |
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
l = Counter(A)
for i in range(N):
if i in l:
print(l[i])
else:
print(0) | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
l = Counter(A)
for i in range(N):
if i+1 in l:
print(l[i+1])
else:
print(0) | [["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 72], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612]] | 5 | 61 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef RUBICK
#include "dbg.h"
#endif
using namespace std;
using namespace __gnu_pbds;
template <class T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typede... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef RUBICK
#include "dbg.h"
#endif
using namespace std;
using namespace __gnu_pbds;
template <class T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typede... | [["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]] | 1 | 131 |
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
int n;
cin >> n;
vector<int> v(n);
rep(i, n) {
int c;
cin >> c;
c--;
v.at... | #include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
int n;
cin >> n;
vector<int> v(n);
rep(i, n - 1) {
int c;
cin >> c;
c--;
... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 0, 1, 0, 27, 28, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 27, 28, 2, 3, 4, 0, 22]] | 1 | 104 |
#include <bits/stdc++.h>
#define ll long long
const double PI = 3.141592653589793238;
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> h(n);
int x;
for (int i = 0; i < n - 1; i++) {
cin >> x;
h[x]++;
}
for (int i = 1; i <= n; i++)
cout << h[i] << "\n";
}
int main() {
// int t... | #include <bits/stdc++.h>
#define ll long long
const double PI = 3.141592653589793238;
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> h(n + 1);
int x;
for (int i = 0; i < n - 1; i++) {
cin >> x;
h[x]++;
}
for (int i = 1; i <= n; i++)
cout << h[i] << "\n";
}
int main() {
// i... | [["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]] | 1 | 105 |
# from fractions import gcd
# mod = 10 ** 9 + 7
# N = int(input())
# a = list(map(int,input().split()))
# a,b,c = map(int,input().split())
# ans = [0] * N
# math.ceilで切り上げ
# dp = [[0] * 4 for i in range(3)] #2次元配列初期化
# dp = [[[0] * 2 for i in range(3)] for j in range(5)]
# (ord('A'))でASCII出力 Aは65
import math
import num... | # from fractions import gcd
# mod = 10 ** 9 + 7
# N = int(input())
# a = list(map(int,input().split()))
# a,b,c = map(int,input().split())
# ans = [0] * N
# math.ceilで切り上げ
# dp = [[0] * 4 for i in range(3)] #2次元配列初期化
# dp = [[[0] * 2 for i in range(3)] for j in range(5)]
# (ord('A'))でASCII出力 Aは65
import math
import num... | [["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]] | 5 | 254 |
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int(i) = 0; i < (n); i++)
#define REP(i, m, n) for (int(i) = (m); (i) < (n); (i)++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define ... | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int(i) = 0; i < (n); i++)
#define REP(i, m, n) for (int(i) = (m); (i) < (n); (i)++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define ... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 383 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, i, x;
cin >> n;
vector<int> a(n);
for (i = 0; i < n; i++) {
cin >> x;
x--;
a[x]++;
}
for (i = 0; i < n; i++)
cout << a[i] << "\n";
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, i, x;
cin >> n;
vector<int> a(n);
for (i = 0; i < n - 1; i++) {
cin >> x;
x--;
a[x]++;
}
for (i = 0; i < n; i++)
cout << a[i] << "\n";
}
| [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 85 |
#include <bits/stdc++.h>
#define N 200050
#define ll long long
#define pb push_back
#define x first
#define y second
using namespace std;
int ar[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
for (int i = 0; i < n - 1; i++) {
int b;
cin >> b;
a... | #include <bits/stdc++.h>
#define N 200050
#define ll long long
#define pb push_back
#define x first
#define y second
using namespace std;
int ar[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
for (int i = 0; i < n - 1; i++) {
int b;
cin >> b;
a... | [["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["-", 0, 7, 8, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 7, 8, 1, 0, 16, 12, 5, 0, 44]] | 1 | 120 |
#include <bits/stdc++.h>
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for (ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr int Mod = 99824... | #include <bits/stdc++.h>
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for (ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr int Mod = 99824... | [["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 31, 13], ["-", 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, 22], ["-", 0, 11, 12, 16, 12, 69, 341, 342, 0, 73], ["+", 0, ... | 1 | 268 |
N=int(input())
X=[0]*N
for a in map(int,input().split()):
X[a-1]+=1
for i in range(N-1):
print(X[i]) | N=int(input())
X=[0]*N
for a in map(int,input().split()):
X[a-1]+=1
for i in range(N):
print(X[i])
| [["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 56 |
import sys
input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
A=LI()
ans=[0]*N
for i in range(N):
ans[A[i]-1]+=1
for i in range(N):
... | import sys
input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
A=LI()
ans=[0]*N
for i in range(N-1):
ans[A[i]-1]+=1
for i in range(N):
... | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 126 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
a[i] = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
a[x - 1]++;
}
for (int i = 0; i < n; i++)
cout << a[i] << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
a[i] = 0;
for (int i = 0; i < n - 1; i++) {
int x;
cin >> x;
a[x - 1]++;
}
for (int i = 0; i < n; i++)
cout << a[i] << endl;
} | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 103 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const double PI = 3.14159265358979;
const ll INF = pow(10, 18);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
string abc ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const double PI = 3.14159265358979;
const ll INF = pow(10, 18);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
string abc ... | [["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 169 |
#include <bits/stdc++.h>
#ifdef __LOCAL
#define DBG(X) cout << #X << " = " << (X) << endl;
#define SAY(X) cout << (X) << endl;
#include <filesystem>
namespace fs = std::filesystem;
#else
#define DBG(X)
#define SAY(X)
#endif
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using ld = ... | #include <bits/stdc++.h>
#ifdef __LOCAL
#define DBG(X) cout << #X << " = " << (X) << endl;
#define SAY(X) cout << (X) << endl;
#include <filesystem>
namespace fs = std::filesystem;
#else
#define DBG(X)
#define SAY(X)
#endif
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using ld = ... | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 648 |
#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define RREP(i, n) for (int(i) = ((int)(n)-1); (i) >= 0; i--)
#define RFOR(i, a, b) for (int(i) = ((int)(b)-1); (i) >= (int)a; i--)
#define ALL(v) (v).begin(), (v).end()
#define MOD ... | #include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define RREP(i, n) for (int(i) = ((int)(n)-1); (i) >= 0; i--)
#define RFOR(i, a, b) for (int(i) = ((int)(b)-1); (i) >= (int)a; i--)
#define ALL(v) (v).begin(), (v).end()
#define MOD ... | [["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 33], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 371 |
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pii;
inline bool valid(int x, int n) { return 0 <= x && x < n; }... | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pii;
inline bool valid(int x, int n) { return 0 <= x && x < n; }... | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 365 |
n = int(input())
a = list(map(int,input().split()))
ki = [[] for i in range(n)]
for i in range(n-1):
ki[a[i]-1].append(i+1)
ki[i+1].append(a[i]-1)
for i in range(n):
if i == 0:
print(len(ki[i]))
continue
print(len(ki[i])-1)
print(ki) | n = int(input())
a = list(map(int,input().split()))
ki = [[] for i in range(n)]
for i in range(n-1):
ki[a[i]-1].append(i+1)
ki[i+1].append(a[i]-1)
for i in range(n):
if i == 0:
print(len(ki[i]))
continue
print(len(ki[i])-1)
| [["-", 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 | 120 |
N=int(input())
alist=list(map(int,input().split()))
answer_dic={}
for a in alist:
if a in answer_dic:
answer_dic[a]+=1
else:
answer_dic[a]=1
print(answer_dic)
for i in range(1,N+1):
if i in answer_dic:
print(answer_dic[i])
else:
print(0) | N=int(input())
alist=list(map(int,input().split()))
answer_dic={}
for a in alist:
if a in answer_dic:
answer_dic[a]+=1
else:
answer_dic[a]=1
#print(answer_dic)
for i in range(1,N+1):
if i in answer_dic:
print(answer_dic[i])
else:
print(0) | [["-", 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 | 87 |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int[] in = new int[a - 1];
for (int i = 0; i < a - 1; i++) {
int b = sc.nextInt();
in[b - 1]++;
}
for (int i = 0; i < a; i++) {
System.... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int[] in = new int[a];
for (int i = 0; i < a - 1; i++) {
int b = sc.nextInt();
in[b - 1]++;
}
for (int i = 0; i < a; i++) {
System.out.... | [["-", 49, 200, 51, 227, 497, 505, 0, 16, 17, 33], ["-", 49, 200, 51, 227, 497, 505, 0, 16, 12, 499]] | 3 | 120 |
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int N;
cin >> N;
vector<int> num(N, 0);
int temp;
for (int i = 0; i < N; i++) {
cin >> temp;
num[temp - 1]++;
}
for (int i = 0; i < N; i++) {
cout << num[i] << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int N;
cin >> N;
vector<int> num(N, 0);
int temp;
for (int i = 0; i < N - 1; i++) {
cin >> temp;
num[temp - 1]++;
}
for (int i = 0; i < N; i++) {
cout << num[i] << endl;
}
return 0;
} | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 90 |
#include <bits/stdc++.h>
using namespace std;
#define SPEED \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#define read() f... | #include <bits/stdc++.h>
using namespace std;
#define SPEED \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#define read() f... | [["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]] | 1 | 218 |
#include <algorithm>
#include <cmath>
#include <ctime>
#include <fstream>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using... | #include <algorithm>
#include <cmath>
#include <ctime>
#include <fstream>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using... | [["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 147 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#inc... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#inc... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 379 |
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
int main() {
int i, n;
int *C;
cin >> n;
C = (int *)malloc(sizeof(int));
for (i = 0; i < n; i++) {
C[i] = 0;
}
for (i = 0; i < n - 1; i++) {
int k;
cin >> k;
C[k - 1]++;
... | #include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
int main() {
int i, n;
int *C;
cin >> n;
C = (int *)malloc(sizeof(int) * n);
for (i = 0; i < n; i++) {
C[i] = 0;
}
for (i = 0; i < n - 1; i++) {
int k;
cin >> k;
C[k - 1]+... | [["+", 3, 4, 0, 105, 51, 74, 51, 66, 17, 48], ["+", 3, 4, 0, 105, 51, 74, 51, 66, 28, 22]] | 1 | 130 |
#include <cstring>
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
int N;
cin >> N;
int A[N + 1];
memset(A, 0, sizeof(A));
for (int i = 1; i <= N; ++i) {
int x;
cin >> x;
A[x]++;
}
for (int i = 1; i <= N; ++i)
cout << A[i] << '\n';
} | #include <cstring>
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
int N;
cin >> N;
int A[N + 1];
memset(A, 0, sizeof(A));
for (int i = 2; i <= N; ++i) {
int x;
cin >> x;
A[x]++;
}
for (int i = 1; i <= N; ++i)
cout << A[i] << '\n';
} | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 99 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<int, int> mp;
int x;
for (int i = 0; i < n - 1; i++) {
cin >> x;
mp[x]++;
}
for (int i = 1; i < n - 1; i++)
cout << mp[i] << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<int, int> mp;
int x;
for (int i = 0; i < n - 1; i++) {
cin >> x;
mp[x]++;
}
for (int i = 1; i <= n; i++)
cout << mp[i] << endl;
return 0;
}
| [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 86 |
import sys
n, *a = map(int, sys.stdin.read().split())
print(a)
graph = [[] for _ in range(n)]
for i in range(n - 1):
graph[a[i]-1].append(i)
def main():
for i in range(n):
print(len(graph[i]))
if __name__ == '__main__':
main() | import sys
n, *a = map(int, sys.stdin.read().split())
graph = [[] for _ in range(n)]
for i in range(n - 1):
graph[a[i]-1].append(i)
def main():
for i in range(n):
print(len(graph[i]))
if __name__ == '__main__':
main() | [["-", 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 | 97 |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> ret(n);
for (int i = 0; i < n; i++) {
int a;
cin >> a;
ret[a--]++;
}
for (auto x : ret)
cout << x << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> ret(n);
for (int i = 1; i < n; i++) {
int a;
cin >> a;
ret[--a]++;
}
for (auto x : ret)
cout << x << endl;
return 0;
} | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 27, 28, 69, 341, 342, 0, 27, 28, 22], ["+", 0, 27, 28, 69, 341, 342, 0, 27, 28, 22]] | 1 | 78 |
n,k=map(int,input().split())
s=0
for i in range(k,n+1):
#0+...+i-1
l=i*(i-1)//2
#n+(n-1)+...+(n-i+1)
h=(2*n-i+1)*i//2
s+=h-l+1
print(s%(10**9+7)) | n,k=map(int,input().split())
s=0
for i in range(k,n+2):
#0+...+i-1
l=i*(i-1)//2
#n+(n-1)+...+(n-i+1)
h=(2*n-i+1)*i//2
s+=h-l+1
print(s%(10**9+7)) | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 78 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
int main() {
ll n, K;
cin >> n >> K;
ll res = 0;
for (ll k = K; k <= n + 1; ++k) {
ll a = (k - 1) * k / 2,
b = (2 * n - k + 1) * k / 2; // cout << a << "," << b << endl;
res += (b - a + 1) % mod;
}
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
int main() {
ll n, K;
cin >> n >> K;
ll res = 0;
for (ll k = K; k <= n + 1; ++k) {
ll a = (k - 1) * k / 2,
b = (2 * n - k + 1) * k / 2; // cout << a << "," << b << endl;
res += (b - a + 1) % mod;
}
... | [["+", 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, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 108 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()
#define pb push_back
#define eb emplace_back
using namespace std;
const long long INF = 1LL << 60; // 仮想的な無限大の値;
using ll = long long;
using P = pair<int, in... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()
#define pb push_back
#define eb emplace_back
using namespace std;
const long long INF = 1LL << 60; // 仮想的な無限大の値;
using ll = long long;
using P = pair<int, in... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 580 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
int N, K;
cin >> N >> K;
long long ans = 0;
for (int i = K; i <= N + 1; i++) {
ans += (i * (N - i + 1) + 1);
ans %= 1000000007;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
long long ans = 0;
for (int i = K; i <= N + 1; i++) {
ans += (i * (N - i + 1) + 1);
ans %= 1000000007;
}
cout << ans << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 81 |
#include <bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < n; i++)
#define Rep(i, n) for (long long i = 1; i < n; i++)
#define ll long long
#include <cmath>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#defi... | #include <bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < n; i++)
#define Rep(i, n) for (long long i = 1; i < n; i++)
#define ll long long
#include <cmath>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#defi... | [["-", 0, 7, 8, 9, 0, 1, 0, 16, 17, 109], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132]] | 1 | 1,092 |
N, K = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
for i in range(K, N+2):
ans += ((N + 1) * i - i ** 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 += ((N + 1) * i - i ** 2 + 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 | 61 |
#include <bits/stdc++.h>
//#include "bits/stdc++.h"
#include <algorithm>
#include <array>
#ifdef _MSC_VER
#include <intrin.h>
#endif
namespace atcoder {
namespace internal {
// @param n `0 <= n`
// @return minimum non-negative `x` s.t. `n <= 2**x`
int ceil_pow2(int n) {
int x = 0;
while ((1U << x) < (unsigne... |
#include <bits/stdc++.h>
//#include "bits/stdc++.h"
#include <algorithm>
#include <array>
#ifdef _MSC_VER
#include <intrin.h>
#endif
namespace atcoder {
namespace internal {
// @param n `0 <= n`
// @return minimum non-negative `x` s.t. `n <= 2**x`
int ceil_pow2(int n) {
int x = 0;
while ((1U << x) < (unsigne... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 15,294 |
N, K = map(int,input().split())
ans = 0
MOD = 10**9+7
for i in range(K,N+1):
num = ((2*N-i+1)*i)//2 - ((i-1)*i)//2
ans+=num%MOD
ans%=MOD
print(ans) |
N, K = map(int,input().split())
ans = 0
MOD = 10**9+7
for i in range(K,N+2):
num = ((2*N-i+1)*i)//2 - ((i-1)*i)//2 +1
ans+=num%MOD
ans%=MOD
print(ans) | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]] | 5 | 79 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;
#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()
template <class T1, class T2> inline bool chmax(T1 &a, const T2 &b) {
if (a < b) {
... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;
#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()
template <class T1, class T2> inline bool chmax(T1 &a, const T2 &b) {
if (a < b) {
... | [["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]] | 1 | 234 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int)x.size())
#define pb push_back
#define mp make_pai... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int)x.size())
#define pb push_back
#define mp make_pai... | [["+", 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 | 310 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(v) v.begin(), v.end()
int main() {
ll N, K;
cin >> N >> K;
ll ans = 0;
for (ll i = K; i < N + 1; i++) {
ans += i * (2 * N - i + 1) / 2 - i * (i - 1) / 2 + 1;
ans %= 1000000007;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(v) v.begin(), v.end()
int main() {
ll N, K;
cin >> N >> K;
ll ans = 0;
for (ll i = K; i <= N + 1; i++) {
ans += i * (2 * N - i + 1) / 2 - i * (i - 1) / 2 + 1;
ans %= 1000000007;
}
cout << ans << endl;
}
| [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 96 |
#amari = (10**100)%(10**9+7)
def sm(i):
tmpp = 0
for j in range(i):
tmpp += j
return tmpp,j
def bi(i,N):
tmpp = 0
for j in range(i):
tmpp += N-j
return tmpp,N-j
def main():
N,K = map(int,input().split())
ans = 0
#loopnum = (N+1) - K + 1
for i in range(K,N+2,1):... | #amari = (10**100)%(10**9+7)
def sm(i):
tmpp = 0
for j in range(i):
tmpp += j
return tmpp,j
def bi(i,N):
tmpp = 0
for j in range(i):
tmpp += N-j
return tmpp,N-j
def main():
N,K = map(int,input().split())
ans = 0
#loopnum = (N+1) - K + 1
for i in range(K,N+2,1):... | [["-", 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, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 166 |
//
// main.cpp
// D
//
// Created by 曾憲揚 on 2020/8/19.
// Copyright © 2020 曾憲揚. All rights reserved.
//
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
typedef long long ll;
int main(int argc, const char *argv[]) {
ll n, k;
cin >> n >> k;
ll ans = 0;
for (ll i = k; i <= n + 1; i++) ... | //
// main.cpp
// D
//
// Created by 曾憲揚 on 2020/8/19.
// Copyright © 2020 曾憲揚. All rights reserved.
//
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
typedef long long ll;
int main(int argc, const char *argv[]) {
ll n, k;
cin >> n >> k;
ll ans = 0;
for (ll i = k; i <= n + 1; i++) ... | [["+", 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 | 124 |
#include <bits/stdc++.h>
using namespace std;
/*
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
//************** StrAnge.R *********************
#define ll long long int
#define ull unsigned long l... | #include <bits/stdc++.h>
using namespace std;
/*
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
//************** StrAnge.R *********************
#define ll long long int
#define ull unsigned long l... | [["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 110], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 109]] | 1 | 797 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
//ライブラリ始まり
//定数
//円周率
const double pi = 3.1415926535897932384;
//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 1000000000000000; // = 10^15
// ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijkl... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
//ライブラリ始まり
//定数
//円周率
const double pi = 3.1415926535897932384;
//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 1000000000000000; // = 10^15
// ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijkl... | [["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22]] | 1 | 780 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const int mod = 1000000007;
struct mint {
ll x; // typedef long long ll;
mint(ll x = 0) : x((x % mod + mod) % mod) {}
mint operator-() const { return mint(-x); }
mint &operator+=(const mint a... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const int mod = 1000000007;
struct mint {
ll x; // typedef long long ll;
mint(ll x = 0) : x((x % mod + mod) % mod) {}
mint operator-() const { return mint(-x); }
mint &operator+=(const mint a... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 328 |
n=int(input())
a=list(map(int,input().split()))
a1=[0]*(n+1)
for i in range(n-1):
a1[a[i]]+=1
print(a1)
for j in range(1,n+1):
print(a1[j])
| n=int(input())
a=list(map(int,input().split()))
a1=[0]*(n+1)
for i in range(n-1):
a1[a[i]]+=1
for j in range(1,n+1):
print(a1[j])
| [["-", 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 | 78 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pl;
const ll N = 2e5 + 50;
const ll MOD = 1000000000;
int a[N];
int n;
int main() {
cin >> n;
int x;
for (int i = 0; i < n; i++) {
cin >> x;
a[x]++;
}
for (int i = 1; i <= n; i++) {
cout << a[i] << endl;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pl;
const ll N = 2e5 + 50;
const ll MOD = 1000000000;
int a[N];
int n;
int main() {
cin >> n;
int x;
for (int i = 0; i < n - 1; i++) {
cin >> x;
a[x]++;
}
for (int i = 1; i <= n; i++) {
cout << a[i] << end... | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 110 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define puts(i) cout << i << endl
#define div 1e9 + 7
#define pi 3.14159265358979
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
int a[n];
int se[n] = {};
for (int i = 1; i < n; i++) {
... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define puts(i) cout << i << endl
#define div 1e9 + 7
#define pi 3.14159265358979
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
int a[n];
int se[n] = {};
for (int i = 1; i < n; i++) {
... | [["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]] | 1 | 118 |
#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
#define NUM 1000000007
using namespace std;
typedef long long ll;
typedef long ... | #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
#define NUM 1000000007
using namespace std;
typedef long long ll;
typedef long ... | [["-", 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, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 157 |
#include <stdio.h>
int main() {
int n, k, i;
long long min, max;
long long num = 0;
scanf("%d%d", &n, &k);
for (i = k; i <= n + 1; i++) {
min = (long long)(i * (i - 1) / 2);
max = (long long)((2 * n - i + 1) * i / 2);
num += max - min + 1;
}
printf("%lld\n", num % 1000000007);
return 0;
... | #include <stdio.h>
int main() {
long long n, k, i;
long long min, max;
long long num = 0;
scanf("%lld%lld", &n, &k);
for (i = k; i <= n + 1; i++) {
min = (long long)(i * (i - 1) / 2);
max = (long long)((2 * n - i + 1) * i / 2);
num += max - min + 1;
}
printf("%lld\n", num % 1000000007);
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 120 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
inline void normal(ll &a) {
a %= MOD;
(a < 0) && (a += MOD);
}
inline ll modMul(ll a, ll b) {
a %= MOD, b %= MOD;
normal(a), normal(b);
return (a * b) % MOD;
}
inline ll modAdd(ll a, ll b) {
a %= MOD, b %= MOD;
norma... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
inline void normal(ll &a) {
a %= MOD;
(a < 0) && (a += MOD);
}
inline ll modMul(ll a, ll b) {
a %= MOD, b %= MOD;
normal(a), normal(b);
return (a * b) % MOD;
}
inline ll modAdd(ll a, ll b) {
a %= MOD, b %= MOD;
norma... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 202 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <vector>
#define ll long long
#define IO \
ios::sync_with_std... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <vector>
#define ll long long
#define IO \
ios::sync_with_std... | [["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]] | 1 | 148 |
#include <bits/stdc++.h>
#define ll long long
#define P pair<ll, ll>
using namespace std;
ll mod = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
ll ans = 0;
for (int i = k; i <= (n + 1); i++) {
ans += (i * (n - i + 1) + 1);
ans %= mod;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
#define ll long long
#define P pair<ll, ll>
using namespace std;
ll mod = 1e9 + 7;
int main() {
ll n, k;
cin >> n >> k;
ll ans = 0;
for (ll i = k; i <= n + 1; i++) {
ans += i * (n - i + 1) + 1;
ans %= mod;
}
cout << ans << endl;
} | [["-", 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], ["-", 8, 9, 0, 7, 15, 16, 12, 23, 0, 24], ["-", 8, 9, 0, 7, 15, 16, 12, 23, 0, 25], ["-", 8, 9, 0, 1, 0, 11, 12, 23, 0, 24], ["-", 8, 9, 0, 1, 0, 11, 1... | 1 | 87 |
#include <stdio.h>
using namespace std;
typedef long long llong;
#define MAX 200005
const llong mod = 1000000000 + 7;
int N, K;
int memo[MAX];
int main() {
int sum = 0;
scanf("%d%d", &N, &K);
int low = 0, high = 0;
for (int i = 0; i < N + 1; i++) {
low += i;
high += N - i;
if (i + 1 >= K) {
... | #include <stdio.h>
using namespace std;
typedef long long llong;
#define MAX 200005
const llong mod = 1000000000 + 7;
int N, K;
int memo[MAX];
int main() {
llong sum = 0;
scanf("%d%d", &N, &K);
llong low = 0, high = 0;
for (int i = 0; i < N + 1; i++) {
low += i;
high += N - i;
if (i + 1 >= K) {... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 128 |
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
t... | #include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
t... | [["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]] | 1 | 756 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
// Optimisations
#pragma GCC target("avx2")
#pragma GCC optimization("unroll-loops")
#pragma GCC optimize("O2")
// shortcuts for functions
#define pb emplace_back
#define mp make_pair
#define ff first
#def... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
// Optimisations
#pragma GCC target("avx2")
#pragma GCC optimization("unroll-loops")
#pragma GCC optimize("O2")
// shortcuts for functions
#define pb emplace_back
#define mp make_pair
#define ff first
#def... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 23, 0, 24], ["+", 8, 9, 0, 7, 15, 16, 12, 23, 0, 25], ["-", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["-", 31, 23, 0, 16, 12, 23, 0, 16, 17, 72], ["+", 31, 23, 0, 16, 1... | 1 | 1,186 |
#include <bits/stdc++.h>
using namespace std;
// Optimisations
#pragma GCC target("avx2")
#pragma GCC optimization("unroll-loops")
#pragma GCC optimize("O2")
// shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define prec(n) fixed <<... | #include <bits/stdc++.h>
using namespace std;
// Optimisations
#pragma GCC target("avx2")
#pragma GCC optimization("unroll-loops")
#pragma GCC optimize("O2")
// shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define prec(n) fixed <<... | [["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 17, 72]] | 1 | 681 |
#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>;
const ll m = 1000000007;
int main() {
int n, k;
cin >> n >> k;
ll cnt = 0;
for (int i = k; i <= n + 1; i++) {
// int min = 0, max = 0;
// rep(j, k) {
// ... | #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>;
const ll m = 1000000007;
int main() {
ll n, k;
cin >> n >> k;
ll cnt = 0;
for (ll i = k; i <= n + 1; i++) {
cnt += i * (n - i + 1) + 1;
cnt %= m;
}
cout <<... | [["-", 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 | 106 |
// include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include... | // include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include... | [["+", 8, 9, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 132], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 9, 0, 1, 0, 35]] | 1 | 4,045 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 5e5 + 10;
const ll mod = 1e9 + 7;
int main() {
ll n, k;
cin >> n >> k;
vector<ll> pre(n + 2);
vector<ll> suf(n + 2);
ll sum = 0;
for (ll i = 0; i <= n + 1; i++) {
sum += i;
pre[i] = sum;
}
sum = 0;
for (ll i = n ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 5e5 + 10;
const ll mod = 1e9 + 7;
int main() {
ll n, k;
cin >> n >> k;
vector<ll> pre(n + 10);
vector<ll> suf(n + 10);
ll sum = 0;
for (ll i = 0; i <= n + 1; i++) {
sum += i;
pre[i] = sum;
}
sum = 0;
for (ll i = ... | [["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13]] | 1 | 189 |
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
template <class T, class U>
ostream &operator<<(os... | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
template <class T, class U>
ostream &operator<<(os... | [["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 109], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72]] | 1 | 653 |
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
#define IOS \
ios::sync_with_... | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
#define IOS \
ios::sync_with_... | [["+", 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, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]] | 1 | 153 |
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i ... | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 356 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
// modint: mod 計算を int を扱うように扱える構造体
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
val += MOD;
... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
// modint: mod 計算を int を扱うように扱える構造体
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
val += MOD;
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 628 |
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)
#define digit(a) to_string(a).size()
#define INF 10e12
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) min_element(all(x))
using namespace std;
int main(void)
{
... | #include <bits/stdc++.h>
typedef long long ll;
#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)
#define digit(a) to_string(a).size()
#define INF 10e12
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) min_element(all(x))
using namespace std;
int main(void)
{
... | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 199 |
/* Simplicity and Goodness */
#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;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
void my... | /* Simplicity and Goodness */
#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;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
void my... | [["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]] | 1 | 268 |
n, k = map(int, input().split())
a = 0
for i in range(k, n+2):
a += n*k + k - k**2 + 1
ans = a % (10**9+7)
print(ans) | n, k = map(int, input().split())
a = 0
for i in range(k, n+2):
a += (n*i + i - i**2 + 1)
ans = a % (10**9+7)
print(ans) | [["+", 8, 196, 0, 1, 0, 677, 12, 23, 0, 24], ["-", 12, 657, 31, 657, 31, 657, 31, 657, 12, 22], ["+", 0, 657, 31, 657, 31, 657, 31, 657, 12, 22], ["-", 0, 677, 12, 657, 31, 657, 31, 657, 12, 22], ["+", 12, 23, 0, 657, 31, 657, 31, 657, 12, 22], ["-", 0, 677, 12, 657, 31, 657, 12, 657, 31, 22], ["+", 12, 23, 0, 657, 31,... | 5 | 59 |
#include <iomanip>
#include <iostream>
using namespace std;
void Main() {
// input
u_int32_t N, K;
cin >> N >> K;
// translate
u_int64_t ans = 0;
for (u_int32_t i = K; i <= N + 1; i++) {
// max - min + 1 で値の個数
// O(n^2) は怖いので, 和の公式を使う
// 初項 a から i 個足すとき
// a + … + a + (i - 1) = i/2 * (a +... |
#include <iomanip>
#include <iostream>
using namespace std;
void Main() {
// input
u_int64_t N, K;
cin >> N >> K;
// translate
u_int64_t ans = 0;
for (u_int64_t i = K; i <= N + 1; i++) {
// max - min + 1 で値の個数
// O(n^2) は怖いので, 和の公式を使う
// 初項 a から i 個足すとき
// a + … + a + (i - 1) = i/2 * (a +... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]] | 1 | 161 |
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x, y) make_pair(x, y)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin = vector<int>;
using vll = vector<ll>;
using P = pair<int, ... | #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (ll i = from; i < (to); ++i)
#define mp(x, y) make_pair(x, y)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin = vector<int>;
using vll = vector<ll>;
using P = pair<int, i... | [["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59]] | 1 | 214 |
#include <iostream>
using namespace std;
#define NUM 1000000007
int main() {
int n, k;
cin >> n >> k;
long long int cnt = 0;
long long int sum = 0;
for (int i = k; i <= n + 1; i++) {
long long int n1 = i * (i - 1) / 2, n2 = i * (2 * n - (i - 1)) / 2;
cnt += (n2 - n1) + 1;
if (cnt > NUM) {
... | #include <iostream>
using namespace std;
#define NUM 1000000007
int main() {
int n, k;
cin >> n >> k;
long long int cnt = 0;
long long int sum = 0;
for (long long int i = k; i <= n + 1; i++) {
long long int n1 = i * (i - 1) / 2, n2 = i * (2 * n - (i - 1)) / 2;
cnt += (n2 - n1) + 1;
if (cnt > NUM... | [["+", 8, 9, 0, 7, 10, 43, 39, 86, 0, 96]] | 1 | 134 |
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
int N, K;
cin >> N >> K;
long ans = 0;
for (int i = K; i < N + 2; i++) {
ans += (N - i + 1) * i + 1;
ans %= mod;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
long long N, K;
cin >> N >> K;
long long ans = 0;
for (long long i = K; i < N + 2; i++) {
ans += (N - i + 1) * i + 1;
ans %= mod;
}
cout << ans << endl;
return 0;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 39, 86, 0, 96]] | 1 | 79 |
#include "bits/stdc++.h"
#define rep(i, N) for (int i = 0; i < N; i++)
typedef long long ll;
const int mod = 1e9 + 7;
using namespace std;
class mint {
public:
ll value;
mint(ll n) : value((n % mod + mod) % mod) {}
mint() : value(0) {}
mint pow(ll n) {
if (n == 1)
return *this;
mint res = m... | #include "bits/stdc++.h"
#define rep(i, N) for (int i = 0; i < N; i++)
typedef long long ll;
const int mod = 1e9 + 7;
using namespace std;
class mint {
public:
ll value;
mint(ll n) : value((n % mod + mod) % mod) {}
mint() : value(0) {}
mint pow(ll n) {
if (n == 1)
return *this;
mint res = m... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 1, 0, 16, 31, 16, 12, 118, 17, 131], ["+", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120]] | 1 | 418 |
N, K = map(int, input().split())
ans = 0
for i in range(K, N+2):
ans += i * (N-i+1) + 1
print(ans%(10**7+7)) | N, K = map(int, input().split())
ans = 0
for i in range(K, N+2):
ans += i * (N-i+1) + 1
print(ans%(10**9+7)) | [["-", 0, 657, 12, 23, 0, 657, 31, 657, 12, 612], ["+", 0, 657, 12, 23, 0, 657, 31, 657, 12, 612]] | 5 | 56 |
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define int long long
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
vector<pair<int, int>> soinsuu(int n) {
vector<pair<int, i... | #include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define int long long
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
vector<pair<int, int>> soinsuu(int n) {
vector<pair<int, i... | [["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["+", 49, 50, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 49, 50, 51, 16, 31, 2, 3, 4, 0, 13], ["+", 49, 50, 51, 16, 31, 2, 3, 4, 0, 21], ["+", 49, 50, 51, 16, 31, 2, 3, 4, 0, 25], ["-", 12, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 1... | 1 | 278 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.