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 |
|---|---|---|---|---|
n,k=map(int,input().split())
a=list(map(int,input().split()))
x=[0]*(n)
before = 0
now = 0
while x[now] == 0:
x[now]=1+x[before]
before=now
now = a[now]-1
y=x[now]-x[0]
z=x[before]-y
if k>y:
l=(k-y)%z+1
else :
l=k
for i in range(n):
if x[i] == l+y:
print(1+i)
break
| n,k=map(int,input().split())
a=list(map(int,input().split()))
x=[0]*(n)
before = 0
now = 0
while x[now] == 0:
x[now]=1+x[before]
before=now
now = a[now]-1
y=x[now]-x[0]
z=x[before]-y
if k>y:
l=(k-y)%z+1
else :
l=k-y+1
for i in range(n):
if x[i] == l+y:
print(1+i)
break | [["+", 0, 1, 0, 662, 12, 657, 31, 657, 17, 33], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]] | 5 | 143 |
#include <bits/stdc++.h>
using namespace std;
map<int, int> m;
int ord = 0;
int loop_sta;
int loop_len = 0;
void loop(vector<int> &A, int tel) {
if (m.count(tel)) {
loop_sta = tel;
loop_len = ord - m[tel];
return;
} else {
m[tel] = ord;
ord++;
loop(A, A[tel]);
}
}
int main() {
int N;
... | #include <bits/stdc++.h>
using namespace std;
map<int, int> m;
int ord = 0;
int loop_sta;
int loop_len = 0;
void loop(vector<int> &A, int tel) {
if (m.count(tel)) {
loop_sta = tel;
loop_len = ord - m[tel];
return;
} else {
m[tel] = ord;
ord++;
loop(A, A[tel]);
}
}
int main() {
int N;
... | [["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]] | 1 | 266 |
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define ll long long
#define vi vector<int>
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
#define For(a, b, c) for (int i = a; i < b; i += c)
#define It(m) for (auto it = m.begin(); it != m.end(); it++... | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define ll long long
#define vi vector<int>
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
#define For(a, b, c) for (int i = a; i < b; i += c)
#define It(m) for (auto it = m.begin(); it != m.end(); it++... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 147], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]] | 1 | 227 |
#include <iostream>
using namespace std;
long long n, k, now = 1, cnt, a[210000], pre[210000];
int main() {
int i, j;
cin >> n >> k;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (i = 1, j = 1; !pre[i] && k; i = a[i], j++, k--)
pre[i] = j;
k = k % (j - pre[i]);
for (; k; i = a[i], k--)
cout << ... | #include <iostream>
using namespace std;
long long n, k, now = 1, cnt, a[210000], pre[210000];
int main() {
int i, j;
cin >> n >> k;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (i = 1, j = 1; !pre[i] && k; i = a[i], j++, k--)
pre[i] = j;
k = k % (j - pre[i]);
for (; k; i = a[i], k--)
;
cout... | [["+", 0, 14, 8, 9, 0, 7, 8, 1, 0, 35]] | 1 | 141 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast \
ios_base::sync_with_stdio(0); \
c... |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast \
ios_base::sync_with_stdio(0); \
c... | [["+", 0, 57, 75, 76, 0, 9, 0, 93, 0, 94], ["+", 0, 57, 75, 76, 0, 9, 0, 93, 0, 35], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["-", 0, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 75, 76, 0, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 57, 75, 76, 0, 9, 0, 93, 0, 94]] | 1 | 480 |
function main(input) {
const lines = input.trim().split("\n");
let [n, k] = lines[0].split(' ');
n = +n;
k = BigInt(k);
const towns = lines[1].split(' ').map(Number);
const visited = new Map();
let pos = 1;
while (k > 0) {
const i = visited.get(pos);
if (!i) {
visited.set(pos, visited.siz... | function main(input) {
const lines = input.trim().split("\n");
let [n, k] = lines[0].split(' ');
n = +n;
k = BigInt(k);
const towns = lines[1].split(' ').map(Number);
const visited = new Map();
let pos = 1;
while (k > 0) {
const i = visited.get(pos);
if (i === undefined) {
visited.set(pos... | [["-", 8, 556, 0, 57, 15, 23, 0, 91, 17, 111], ["+", 8, 556, 0, 57, 15, 23, 0, 16, 17, 565], ["+", 8, 556, 0, 57, 15, 23, 0, 16, 12, 580]] | 2 | 227 |
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
const ll INF = 1LL << 60;
int main() {
ll N, K;
cin >> N >> K;
vector<int> a(N);
rep(i, N) {
int ... | #include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
const ll INF = 1LL << 60;
int main() {
ll N, K;
cin >> N >> K;
vector<int> a(N);
rep(i, N) {
int ... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 362 |
/*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <... | /*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <... | [["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 659 |
#include <bits/stdc++.h>
using namespace std;
#define fastIO() \
; \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define fr(i, ... | #include <bits/stdc++.h>
using namespace std;
#define fastIO() \
; \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define fr(i, ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 343 |
import sys
N, K = map(int, input().split())
As = [0] + list(map(int, input().split()))
d = [-1]*(N+1)
i = 1
step = 1
while step <= K:
next_i = As[i]
if d[next_i] != -1:
freq = step - d[next_i] +1
step = step + ((K - step) // freq)*freq
d[next_i] = step
step += 1
i = next_i
print(i) | import sys
N, K = map(int, input().split())
As = [0] + list(map(int, input().split()))
# print(As)
d = [-1]*(N+1)
i = 1
step = 1
while step <= K:
# print("step: {}, idx: {}".format(step,i))
next_i = As[i]
if d[next_i] != -1:
freq = step - d[next_i]
step = step + ((K - step) // freq)*freq
d[next_i] = step
step ... | [["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612]] | 5 | 118 |
// Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast \
static int fastline = []() { \
std::ios::sync_with_stdio(false); \
cin.tie(NUL... | // Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast \
static int fastline = []() { \
std::ios::sync_with_stdio(false); \
cin.tie(NUL... | [["-", 8, 9, 0, 57, 64, 9, 0, 43, 39, 78], ["-", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]] | 1 | 294 |
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long k = scanner.nextLong();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = scanner.nextInt() - 1;
}
List<Integer> list = new Arr... | import java.util.*;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long k = scanner.nextLong();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = scanner.nextInt() - 1;
}
List<Integer> list = new Arr... | [["+", 0, 1, 0, 492, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 12, 499]] | 3 | 276 |
from collections import deque
def main():
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.insert(0, 0)
J = [-1] * (N + 1)
T = []
que = deque([1])
count = 0
l = 0
while que:
i = que.popleft()
if J[i] != -1:
l = J[i]
break
... | from collections import deque
def main():
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.insert(0, 0)
J = [-1] * (N + 1)
T = []
que = deque([1])
count = 0
l = 0
while que:
i = que.popleft()
if J[i] != -1:
l = J[i]
break
... | [["-", 206, 657, 31, 23, 0, 657, 12, 23, 0, 24], ["-", 31, 23, 0, 657, 12, 23, 0, 657, 17, 72], ["-", 31, 23, 0, 657, 12, 23, 0, 657, 12, 612], ["-", 206, 657, 31, 23, 0, 657, 12, 23, 0, 25], ["+", 8, 196, 0, 37, 0, 206, 206, 657, 17, 72], ["+", 8, 196, 0, 37, 0, 206, 206, 657, 12, 22]] | 5 | 170 |
N,K=map(int,input().split())
P=list(map(int,input().split()))
A={k+1:P[k] for k in range(N)}
U=list()
S=set()
x=1
k=0
while (x not in S) and (k<K):
U.append(x)
S.add(x)
x=A[x]
k+=1
if k==K:
print(U[-1])
else:
d=U.index(x)
V=U[d:]
print(V[(K-d)%len(V)])
| N,K=map(int,input().split())
P=list(map(int,input().split()))
A={k+1:P[k] for k in range(N)}
U=list()
S=set()
x=1
k=0
while (x not in S) and (k<=K):
U.append(x)
S.add(x)
x=A[x]
k+=1
if k>K:
print(U[-1])
else:
d=U.index(x)
V=U[d:]
print(V[(K-d)%len(V)])
| [["-", 0, 52, 15, 679, 12, 23, 0, 666, 667, 18], ["+", 0, 52, 15, 679, 12, 23, 0, 666, 667, 19], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]] | 5 | 149 |
#N,K入力
N,K= map(int,input().split())
#街のテレポート先入力
A = [int(i)-1 for i in input().split()]
judge = [-1] * N
judge[0] = 0
#初期位置
a = 0
#移動回数
step = 1
while step != K:
#移動する街を決める
a = A[a]
if judge[a] > -1:
break
#何回目の移動なのか加える
judge[a] = step
step = step + 1
if step == K:
print(a+1)
... | #N,K入力
N,K= map(int,input().split())
#街のテレポート先入力
A = [int(i)-1 for i in input().split()]
judge = [-1] * N
judge[0] = 0
#初期位置
a = 0
#移動回数
step = 1
while step != K +1:
#移動する街を決める
a = A[a]
if judge[a] > -1:
break
#何回目の移動なのか加える
judge[a] = step
step = step + 1
if step == K +1:
print(a+1... | [["+", 0, 656, 0, 52, 15, 666, 0, 657, 17, 72], ["+", 0, 656, 0, 52, 15, 666, 0, 657, 12, 612], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 72], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612]] | 5 | 144 |
#include <algorithm>
#include <bitset> //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip> //do setprecision
#include <ios... | #include <algorithm>
#include <bitset> //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip> //do setprecision
#include <ios... | [["-", 64, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 64, 9, 0, 52, 15, 339, 51, 16, 17, 19]] | 1 | 297 |
# -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
rem=k
nxt=1
visit=[]
visit_set={}
for i in range(k):
visit.append(nxt)
visit_set.add(nxt)
nxt=a[nxt-1]
# この判定をやめる
if nxt in visit_set:
break
rem-=1
if rem==0:
print(nxt)
else:
# pr... | # -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
rem=k
nxt=1
visit=[]
visit_set=set([])
for i in range(k):
visit.append(nxt)
visit_set.add(nxt)
nxt=a[nxt-1]
# この判定をやめる
if nxt in visit_set:
break
rem-=1
if rem==0:
print(nxt)
else:
# ... | [["-", 0, 656, 0, 1, 0, 662, 12, 680, 0, 45], ["-", 0, 656, 0, 1, 0, 662, 12, 680, 0, 46], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 634, 0, 70], ["+", 0, 662, 12, 652, 3, 4, 0, 634, 0, 73], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 134 |
N, K = map(int, input().split())
A = list(map(int, input().split()))
chk = [0]*(N+1)
town = 1
rt = []
roop = 0
while True:
if chk[town] == 1:
break
rt.append(town)
chk[town] = 1
town = A[town-1]
if K <= rt.index(town):
print(rt[K-1])
else:
roop = (K-rt.index(town)) % (len(rt)-rt.index... | N, K = map(int, input().split())
A = list(map(int, input().split()))
chk = [0]*(N+1)
town = 1
rt = []
roop = 0
while True:
if chk[town] == 1:
break
rt.append(town)
chk[town] = 1
town = A[town-1]
if K <= rt.index(town):
print(rt[K])
else:
roop = (K-rt.index(town)) % (len(rt)-rt.index(t... | [["-", 0, 652, 3, 4, 0, 206, 206, 657, 17, 33], ["-", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612]] | 5 | 147 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define VI vector<int>
#define MOD 1000000007
using ll = long long int;
using P = pair<int, int>;
template <class T> bool chmax(T &a, const T &b) {
... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define VI vector<int>
#define MOD 1000000007
using ll = long long int;
using P = pair<int, int>;
template <class T> bool chmax(T &a, const T &b) {
... | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 339 |
// D - Teleporter
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
ll n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a.at(i);
a.at(i)--;
}
set<int> set;
vector<int> path;
int p = ... | // D - Teleporter
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
ll n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a.at(i);
a.at(i)--;
}
set<int> set;
vector<int> path;
int p = ... | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 213 |
N, K = map(int, input().split())
A = [-1] + list(map(int, input().split()))
visited = set([1])
loop = [1]
now = 1
for _ in range(N):
now = A[now]
if now in visited:
break
else:
loop.append(now)
visited.add(now)
x = loop.index(now)
if K < x:
print(loop[x+1])
else:
K -= x
... | N, K = map(int, input().split())
A = [-1] + list(map(int, input().split()))
visited = set([1])
loop = [1]
now = 1
for _ in range(N):
now = A[now]
if now in visited:
break
else:
loop.append(now)
visited.add(now)
x = loop.index(now)
if K < x:
print(loop[K])
else:
K -= x
... | [["-", 0, 652, 3, 4, 0, 206, 206, 657, 31, 22], ["-", 0, 652, 3, 4, 0, 206, 206, 657, 17, 72], ["-", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 22]] | 5 | 135 |
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
warp_idx = [-1] * (len(A) + 1)
ans_list = []
c = 1
i = 0
while warp_idx[c] == -1:
warp_idx[c] = i
ans_list.append(c)
c = A[c - 1]
i += 1
start = warp_idx[c]
loop = ... | def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
warp_idx = [-1] * (len(A) + 1)
ans_list = []
c = 1
i = 0
while warp_idx[c] == -1:
warp_idx[c] = i
ans_list.append(c)
c = A[c - 1]
i += 1
start = warp_idx[c]
loop = ... | [["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 18], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22]] | 5 | 150 |
n, k = gets.to_s.split.map{|e|e.to_i}
a = [0] + gets.to_s.split.map{|e|e.to_i}
t = Array.new(n+1){ -1 }
cur = 1
t[1] = i = 0
loop do
cur = a[cur]
i +=1
if i == k
puts s
exit
end
t[cur] >= 0 ? break : (t[cur] = i)
end
dist = t[cur]
puts t.index((k - dist) % (i - dist) + dist)
# cycle = i - d... | n, k = gets.to_s.split.map{|e|e.to_i}
a = [0] + gets.to_s.split.map{|e|e.to_i}
t = Array.new(n+1){ -1 }
cur = 1
t[1] = i = 0
loop do
cur = a[cur]
i +=1
if i == k
puts cur
exit
end
t[cur] >= 0 ? break : (t[cur] = i)
end
dist = t[cur]
puts t.index((k - dist) % (i - dist) + dist)
# cycle = i... | [["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22], ["+", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22]] | 4 | 129 |
n, k = gets.to_s.split.map{|e|e.to_i}
a = [0] + gets.to_s.split.map{|e|e.to_i}
t = Array.new(n+1){ -1 }
cur = 1
t[1] = i = 0
loop do
cur = a[cur]
i +=1
if i == k
puts s
exit
end
t[cur] >= 0 ? break : (t[cur] = i)
end
dist = t[cur]
puts t.index((k - dist) % (i - dist) + dist)
# cycle = i - d... | n, k = gets.to_s.split.map{|e|e.to_i}
a = [0] + gets.to_s.split.map{|e|e.to_i}
t = Array.new(n+1){ -1 }
cur = 1
t[1] = i = 0
loop do
cur = a[cur]
i += 1
if i == k
puts cur
exit
end
t[cur] >= 0 ? break : t[cur] = i
end
dist = t[cur]
puts t.index((k - dist) % (i - dist) + dist)
# cycle = i ... | [["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22], ["+", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22], ["-", 196, 737, 8, 736, 0, 754, 75, 739, 0, 24], ["-", 196, 737, 8, 736, 0, 754, 75, 739, 0, 25]] | 4 | 129 |
n, k = gets.to_s.split.map{|e|e.to_i}
a = [0] + gets.to_s.split.map{|e|e.to_i}
t = Array.new(n+1){ -1 }
used = Array.new(n+1){ false }
t[1] = i = 0
s = 1
used[1] = true
loop do
s = a[s]
i +=1
used[s] ? break : used[s] = true
t[s] = i
end
dist = t[s]
cycle = i - dist
if dist >= k
puts s
else
idx = ... | n, k = gets.to_s.split.map{|e|e.to_i}
a = [0] + gets.to_s.split.map{|e|e.to_i}
t = Array.new(n+1){ -1 }
used = Array.new(n+1){ false }
t[1] = i = 0
s = 1
used[1] = true
loop do
s = a[s]
i +=1
# if i == k
# puts s
# exit
# end
used[s] ? break : used[s] = true
t[s] = i
end
dist = t[s]
cycle... | [["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22], ["+", 64, 749, 0, 652, 3, 4, 0, 652, 486, 22], ["+", 64, 749, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 64, 749, 0, 652, 3, 4, 0, 652, 735, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 4 | 152 |
import math
def solve():
N, K = map(int,input().split())
A = list(map(int, input().split()))
state = 1
chklist = [0] * (N + 1)
chklist_flag = [False] * (N + 1)
chkmod = 0
chklist_flag[0] = True
for i in range(1, K + 1):
state = A[state - 1]
if chklist_flag[state - 1]:... | import math
def solve():
N, K = map(int,input().split())
A = list(map(int, input().split()))
state = 1
chklist = [0] * (N + 1)
chklist_flag = [False] * (N + 1)
chkmod = 0
chkrem = K
chklist_flag[0] = True
for i in range(1, K + 1):
state = A[state - 1]
if chklist... | [["+", 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, 22]] | 5 | 185 |
#include <bits/stdc++.h>
using namespace std;
#define All(a) a.begin(), a.end()
typedef pair<long long, long long> P;
long long INF = 1e18;
int main() {
long long N, K;
cin >> N >> K;
vector<long long> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
A[i]--;
}
vector<long long> to;
to.push_back(0)... | #include <bits/stdc++.h>
using namespace std;
#define All(a) a.begin(), a.end()
typedef pair<long long, long long> P;
long long INF = 1e18;
int main() {
long long N, K;
cin >> N >> K;
vector<long long> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
A[i]--;
}
vector<long long> to;
to.push_back(0)... | [["+", 64, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 64, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 269 |
n,k = map(int,input().split())
a = input().split()
b = [0]*n
d = {}
ind = 1
num = 0
loop = 1
while num == k:
if b[ind-1] == 0:
b[ind-1] = -1
d[ind] = num
num += 1
ind = int(a[ind-1])
else:
loop = num-d[ind]
sup = d[ind]
break
if k-sup >=0:
for i in ra... | n,k = map(int,input().split())
a = input().split()
b = [0]*n
d = {}
ind = 1
num = 0
loop = 1
sup =0
while num != k:
if b[ind-1] == 0:
b[ind-1] = -1
d[ind] = num
num += 1
ind = int(a[ind-1])
else:
loop = num-d[ind]
sup = d[ind]
break
if k-sup >=0:
for i in range((k-sup)%loop):
ind... | [["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 79]] | 5 | 142 |
#include <stdio.h>
int main(void) {
int N, i, j, x, y, MOD, A[200000] = {0}, check[200000] = {},
move[200000] = {0};
long long K;
x = scanf("%d %lld", &N, &K);
for (i = 0; i < N; i++)
x = scanf("%d", &A[i]), check[i] = -1;
for (i = 0, j = 0;; i = A[i] - 1, j++)
if (check[i] <... | #include <stdio.h>
int main(void) {
int N, i, j, x, y, MOD, A[200000] = {0}, check[200000] = {},
move[200000] = {0};
long long K;
x = scanf("%d %lld", &N, &K);
for (i = 0; i < N; i++)
x = scanf("%d", &A[i]), check[i] = -1;
for (i = 0, j = 0;; i = A[i] - 1, j++)
if (check[i] <... | [["-", 0, 1, 0, 34, 31, 11, 12, 16, 17, 33], ["-", 0, 1, 0, 34, 31, 11, 12, 16, 12, 13], ["-", 0, 34, 12, 34, 12, 11, 12, 16, 17, 33], ["-", 0, 34, 12, 34, 12, 11, 12, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]] | 1 | 210 |
#include <stdio.h>
int main(void) {
int N, i, j, x, y, MOD, A[200000] = {0}, check[200000] = {},
move[200000] = {0};
long long K;
x = scanf("%d %lld", &N, &K);
for (i = 0; i < N; i++)
x = scanf("%d", &A[i]), check[i] = -1;
for (i = 0, j = 0;; i = A[i] - 1, j++)
if (check[i] <... | #include <stdio.h>
int main(void) {
int N, i, j, x, y, MOD, A[200000] = {0}, check[200000] = {},
move[200000] = {0};
long long K;
x = scanf("%d %lld", &N, &K);
for (i = 0; i < N; i++)
x = scanf("%d", &A[i]), check[i] = -1;
for (i = 0, j = 0;; i = A[i] - 1, j++)
if (check[i] <... | [["-", 0, 34, 12, 34, 12, 11, 12, 16, 17, 33], ["+", 0, 34, 12, 34, 12, 11, 12, 16, 17, 72]] | 1 | 210 |
def main():
N,K=map(int,input().split())
A=list(map(int,input().split()))
cal=0
time=[0]*N
town=[]
roop=[]
while time[cal]!=2:
if time[cal]==0:
town.append(cal)
else :
roop.append(cal)
time[cal]+=1
cal=A[cal]-1
if len(time)>K:
... | def main():
N,K=map(int,input().split())
A=list(map(int,input().split()))
cal=0
time=[0]*N
town=[]
roop=[]
while time[cal]!=2:
if time[cal]==0:
town.append(cal)
else :
roop.append(cal)
time[cal]+=1
cal=A[cal]-1
if len(town)>K:
... | [["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22]] | 5 | 152 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, k;
int main() {
cin >> n >> k;
ll a[n + 1];
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
bool stop = 0, b[n + 1];
memset(b, 0, sizeof(b));
b[1] = 1;
ll pos = 1, u[n + 1], ke = 2, start;
u[1] = 1;
while (!stop) {
pos... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, k;
int main() {
cin >> n >> k;
ll a[n + 1];
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
bool stop = 0, b[n + 1];
memset(b, 0, sizeof(b));
b[1] = 1;
ll pos = 1, u[n + 1], ke = 2, start;
u[1] = 1;
while (!stop) {
pos... | [["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 239 |
N, K = map(int, input().split())
S = list(num-1 for num in map(int, input().split()))
loc = 0
arrived = [0]*N
ar = set()
cnt = 0
while not loc in ar:
arrived[cnt] = loc
ar.add(loc)
loc = S[loc]
cnt += 1
if K < cnt:
print(arrived[K-1]+1)
else:
for i in range(cnt):
if arrived[i] == loc:... | N, K = map(int, input().split())
S = list(num-1 for num in map(int, input().split()))
loc = 0
arrived = [0]*N
ar = set()
cnt = 0
while not loc in ar:
arrived[cnt] = loc
ar.add(loc)
loc = S[loc]
cnt += 1
if K < cnt:
print(arrived[K]+1)
else:
for i in range(cnt):
if arrived[i] == loc:
... | [["-", 3, 4, 0, 657, 31, 206, 206, 657, 17, 33], ["-", 3, 4, 0, 657, 31, 206, 206, 657, 12, 612]] | 5 | 141 |
import java.util.*;
public class Main {
Scanner sc = new Scanner(System.in);
int MOD = (int)1e9 + 7;
public static void main(String[] args) { new Main().run(); }
void run() {
int n = sc.nextInt();
long m = sc.nextLong();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = ... | import java.util.*;
public class Main {
Scanner sc = new Scanner(System.in);
int MOD = (int)1e9 + 7;
public static void main(String[] args) { new Main().run(); }
void run() {
int n = sc.nextInt();
long m = sc.nextLong();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = ... | [["-", 49, 200, 51, 16, 31, 74, 39, 506, 0, 507], ["-", 0, 503, 49, 200, 51, 16, 31, 74, 0, 25], ["-", 49, 200, 51, 16, 31, 74, 51, 23, 0, 24]] | 3 | 303 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
ll k;
cin >> n >> k;
vector<int> a(n);
rep(i, n) cin >> a[i];
vector<int> s;
vector<int> ord(n + 1, -1);
int c = 1, l = 0;
{
int v = 1... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
ll k;
cin >> n >> k;
vector<int> a(n);
rep(i, n) cin >> a[i];
vector<int> s;
vector<int> ord(n + 1, -1);
int c = 1, l = 0;
{
int v = 1... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]] | 1 | 204 |
#include <algorithm>
#include <bits/stdc++.h>
#include <list>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define rep(a, b, c) for (a = b; a < c; a++)
#define repj(a, b, c) for (a = b; a < c; a++)
#define repr for (i = n - 1; i >= 0; i--)
#define pii pair<ll, ... | #include <algorithm>
#include <bits/stdc++.h>
#include <list>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define rep(a, b, c) for (a = b; a < c; a++)
#define repj(a, b, c) for (a = b; a < c; a++)
#define repr for (i = n - 1; i >= 0; i--)
#define pii pair<ll, ... | [["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 388 |
n,k = list(map(int, input().split()))
lst = list(map(int, input().split()))
checker = [None for i in range(n)]
checker[0] = 0
num = 0
count = 0
flag = 0
while flag==0 and count!=k:
if checker[lst[num]-1]==None:
checker[lst[num]-1]=count+1
count+=1
num = lst[num]-1
else:
flag = ... | n,k = list(map(int, input().split()))
lst = list(map(int, input().split()))
checker = [None for i in range(n)]
checker[0] = 0
num = 0
count = 0
flag = 0
# 同じ地点に2度目に到着する or k回移動するまで移動する
while flag==0 and count!=k:
if checker[lst[num]-1]==None:
checker[lst[num]-1]=count+1
count+=1
num = lst[... | [["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102]] | 5 | 181 |
n,k = list(map(int, input().split()))
lst = list(map(int, input().split()))
checker = [None for i in range(n)]
checker[0] = 0
num = 0
count = 0
flag = 0
while flag==0 and count!=k:
if checker[lst[num]-1]==None:
checker[lst[num]-1]=count+1
count+=1
num = lst[num]-1
else:
flag = ... | n,k = list(map(int, input().split()))
lst = list(map(int, input().split()))
checker = [None for i in range(n)]
checker[0] = 0
num = 0
count = 0
flag = 0
while flag==0 and count!=k:
if checker[lst[num]-1]==None:
checker[lst[num]-1]=count+1
count+=1
num = lst[num]-1
else:
flag = ... | [["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102]] | 5 | 181 |
N, K= (int(v) for v in input().split())
A = [0] + [int(v) for v in input().split()]
first_visit = [0 for i in range(N+1)]
visited = []
current = 1
step = 0
loop_length = 1
loop_start = 0
while True:
if step == K:
print(A[current])
exit()
if first_visit[current] != 0:
loop_length =... | N, K= (int(v) for v in input().split())
A = [0] + [int(v) for v in input().split()]
first_visit = [0 for i in range(N+1)]
visited = []
current = 1
step = 0
loop_length = 1
loop_start = 0
while True:
if step == K:
print(current)
exit()
if first_visit[current] != 0:
loop_length = st... | [["-", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73]] | 5 | 154 |
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#inc... | #include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#inc... | [["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 262 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair<int, int>
#define fi first
#define sc second
#define lwb lower_bound
#define upb upper_bound
#define all(x) (x).begin(), (x).end()
signed main() {
#ifdef _DEBUG
freopen("in", "r", stdin);
#endif
ios::sync_with_stdio(0);
cin.tie... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair<int, int>
#define fi first
#define sc second
#define lwb lower_bound
#define upb upper_bound
#define all(x) (x).begin(), (x).end()
signed main() {
#ifdef _DEBUG
freopen("in", "r", stdin);
#endif
ios::sync_with_stdio(0);
cin.tie... | [["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]] | 1 | 228 |
n, k = [int(i) for i in input().split()]
l = [int(i) - 1 for i in input().split()]
i = 0
m = [-1] * n
p = 0
while m[i] == -1:
if i == k:
break
m[i] = p
p += 1
i = l[i]
else:
z = (k - m[i]) % (p - m[i])
i = m.index(m[i] + z)
print(i + 1) | n, k = [int(i) for i in input().split()]
l = [int(i) - 1 for i in input().split()]
i = 0
m = [-1] * n
p = 0
while m[i] == -1:
if p == k:
break
m[i] = p
p += 1
i = l[i]
else:
z = (k - m[i]) % (p - m[i])
i = m.index(m[i] + z)
print(i + 1) | [["-", 0, 52, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 0, 22]] | 5 | 124 |
/*
AtCoderBeginnerContest167
Problem D - Teleporter /
Time Limit: 2 sec / Memory Limit: 1024 MB
Score:
400
points
*/
#include <iostream>
#include <vector>
int main() {
int N;
long K;
std::vector<int> A;
A.push_back(0);
std::cin >> N >> K;
for (int i = 0; i < N; i++) {
int currA;
std::cin >> currA;... | /*
AtCoderBeginnerContest167
Problem D - Teleporter /
Time Limit: 2 sec / Memory Limit: 1024 MB
Score:
400
points
*/
#include <iostream>
#include <vector>
int main() {
int N;
long K;
std::vector<int> A;
A.push_back(0);
std::cin >> N >> K;
for (int i = 0; i < N; i++) {
int currA;
std::cin >> currA;... | [["-", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["+", 0, 57, 64, 9, 0, 43, 39, 86, 0, 96]] | 1 | 193 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
ll K;
cin >> N >> K;
vector<int> A(N, 0);
for (int i = 0; i < N; ++i) {
cin >> A[i];
--A[i];
}
int p = A[0];
int q = A[A[0]];
int R = 1;
while (p != q) {
p = A[p];
q = A[A[q]];
++R;
}
in... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
ll K;
cin >> N >> K;
vector<int> A(N, 0);
for (int i = 0; i < N; ++i) {
cin >> A[i];
--A[i];
}
int p = A[0];
int q = A[A[0]];
int R = 1;
while (p != q) {
p = A[p];
q = A[A[q]];
++R;
}
in... | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 282 |
#0や1のケースに注意
#index out of range
def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import ... | #0や1のケースに注意
#index out of range
def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import ... | [["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]] | 5 | 263 |
#include <algorithm>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
#... | #include <algorithm>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
#... | [["+", 0, 57, 75, 76, 0, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 477 |
N,K=map(int,input().split())
A=list(map(int,input().split()))
num=[-1]*N
rep=[]
now=0
for i in range(N):
if i==K:
print(now)
exit()
aft=A[now]-1
rep.append(now)
if num[now]==-1:
num[now]=i
else:
break
now=aft
end=i
start=num[aft]
loop=end-start+1
print(rep[star... | N,K=map(int,input().split())
A=list(map(int,input().split()))
num=[-1]*N
rep=[]
now=0
for i in range(N):
if i==K:
print(now+1)
exit()
aft=A[now]-1
rep.append(now)
if num[now]==-1:
num[now]=i
else:
break
now=aft
end=i
start=num[aft]
loop=end-start+1
print(rep[st... | [["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]] | 5 | 136 |
N, K = map(int, input().split())
trans = list(map(int, input().split()))
townOrder = [-1 for _ in range(N+1)]
townOrder[1] = 1
nextTown = 1
cicleStart = 0
cicleEnd = 0
for order in range(1, N+1):
nextTown = trans[nextTown-1]
if townOrder[nextTown] == -1:
townOrder[nextTown] = order +1
else:
cicleStart =... | N, K = map(int, input().split())
trans = list(map(int, input().split()))
townOrder = [-1 for _ in range(N+1)]
townOrder[1] = 1
nextTown = 1
cicleStart = 0
cicleEnd = 0
for order in range(1, N+1):
nextTown = trans[nextTown-1]
if townOrder[nextTown] == -1:
townOrder[nextTown] = order +1
else:
cicleStart =... | [["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["-", 8, 196, 0, 1, 0, 662, 12, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 206, 51, 22]] | 5 | 182 |
/**********************************************************/
/** Bismillahir-rahmanir-rahim **/
/** In the name of Allah, the Beneficent, the Merciful. **/
/**********************************************************/
/****@author: Sayed Sohan, CSE 13th batch(2016), MBSTU*****/
/**************... | /**********************************************************/
/** Bismillahir-rahmanir-rahim **/
/** In the name of Allah, the Beneficent, the Merciful. **/
/**********************************************************/
/****@author: Sayed Sohan, CSE 13th batch(2016), MBSTU*****/
/**************... | [["-", 0, 11, 12, 16, 12, 69, 341, 342, 0, 13], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 22]] | 1 | 382 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
#define rep(i, n) for... | #include <bits/stdc++.h>
using namespace std;
#define int long long
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
#define rep(i, n) for... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]] | 1 | 427 |
#include <bits/stdc++.h>
using namespace std;
map<long long, long long> m;
map<long long, long long> c;
long long jump[200005];
bool visited[200005];
bool pass = false;
long long aux = -1;
long long ini = -1;
long long buck(long long pos, long long sal) {
m[sal] = pos;
if (visited[pos]) {
ini = pos;
aux ... | #include <bits/stdc++.h>
using namespace std;
map<long long, long long> m;
map<long long, long long> c;
long long jump[200005];
bool visited[200005];
bool pass = false;
long long aux = -1;
long long ini = -1;
long long buck(long long pos, long long sal) {
m[sal] = pos;
if (visited[pos]) {
ini = pos;
aux ... | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 283 |
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, int> pll;
int main() {
#ifndef LOCAL
fastIO;
#endif
int n, posicion;
ll k;
cin >> n >> ... | #include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, int> pll;
int main() {
#ifndef LOCAL
fastIO;
#endif
int n, posicion;
ll k;
cin >> n >> ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]] | 1 | 322 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int teleport[200005];
int step[200005];
int destination[20... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int teleport[200005];
int step[200005];
int destination[20... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 11, 12, 16, 31, 69, 28, 22], ["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 70], ["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 73]] | 1 | 249 |
package main
import "fmt"
func main() {
var n, k, i, next, count, check uint64
fmt.Scan(&n, &k)
var a []uint64 = make([]uint64, n)
var b []uint64 = make([]uint64, 0)
c := make(map[uint64]uint64)
for i = 0; i < n; i++ {
fmt.Scan(&a[i])
}
next = 1
c[1] = 1
b = append(b, 1)
for i = 0; i < k; i++ {
b = app... | package main
import "fmt"
func main() {
var n, k, i, next, count, check uint64
fmt.Scan(&n, &k)
var a []uint64 = make([]uint64, n)
var b []uint64 = make([]uint64, 0)
c := make(map[uint64]uint64)
for i = 0; i < n; i++ {
fmt.Scan(&a[i])
}
next = 1
c[1] = 1
b = append(b, 1)
for i = 0; i < k; i++ {
b = app... | [["-", 0, 2, 3, 4, 0, 437, 71, 16, 17, 33], ["-", 0, 2, 3, 4, 0, 437, 71, 16, 12, 433]] | 7 | 294 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 5e5 + 10;
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
ll n, k;
int a[N];
vector<int> vc;
int vis[N];
int main() {
scanf("%lld%lld", &n, &k);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 5e5 + 10;
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
ll n, k;
int a[N];
vector<int> vc;
int vis[N];
int main() {
scanf("%lld%lld", &n, &k);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 3, 4, 0, 69, 341, 342, 0, 16, 17, 33], ["-", 3, 4, 0, 69, 341, 342, 0, 16, 12, 13]] | 1 | 243 |
#include <bits/stdc++.h>
using namespace std;
#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)
int main() {
int n;
long long k;
int a[200000];
cin >> n >> k;
fori(n) {
cin >> a[i];
--a[i];
} //町とアクセス番号が違うため-1
bool c[200000] = {};
long long *l = new long ... | #include <bits/stdc++.h>
using namespace std;
#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)
int main() {
int n;
long long k;
int a[200000];
cin >> n >> k;
fori(n) {
cin >> a[i];
--a[i];
} //町とアクセス番号が違うため-1
bool c[200000] = {};
long long *l = new long ... | [["+", 64, 9, 0, 1, 0, 16, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 16, 12, 16, 12, 13]] | 1 | 255 |
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
s = 1
g = 0
i = 1
history = [s]
flag = [False] * n
flag[0] = True
while True:
g = a[s-1]
if flag[g-1] == True:
break
else:
flag[g-1] = True
history.append(g)
s = g
i += 1
x = history.index(... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
s = 1
g = 0
i = 1
history = [s]
flag = [False] * n
flag[0] = True
while True:
g = a[s-1]
if flag[g-1] == True:
break
else:
flag[g-1] = True
history.append(g)
s = g
i += 1
x = history.index(... | [["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]] | 5 | 153 |
import sys
input = sys.stdin.readline
class UnionFind():
def __init__(self, n):
self.par = [-1] * n
def root(self, x):
if self.par[x] < 0:
return x
else:
self.par[x] = self.root(self.par[x]) # contraction
return self.par[x]
def unite(self, x, ... | import sys
input = sys.stdin.readline
class UnionFind():
def __init__(self, n):
self.par = [-1] * n
def root(self, x):
if self.par[x] < 0:
return x
else:
self.par[x] = self.root(self.par[x]) # contraction
return self.par[x]
def unite(self, x, ... | [["-", 0, 1, 0, 662, 12, 657, 31, 657, 12, 22], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 12, 22]] | 5 | 833 |
I=lambda:map(int,input().split());F=1e21;r=range;n,m=I();f=[-F,F];X=[0]+f;Y=X[:];R=(f,F),(f,-F),;H=(F,f),(-F,f),
for i in r(n):*a,c=I();R+=(a,c),;Y+=c,;X+=a
for i in r(m):a,*b=I();H+=(a,b),;X+=a,;Y+=b
def g(X):s=sorted(set(X));l=len(s);return{s[i]:i for i in r(l)},s,l
h,s,K=g(X);w,t,L=g(Y);V,U,v=[[[0]*-~K for i in r(L+... | I=lambda:map(int,input().split());F=1e21;r=range;n,m=I();f=[-F,F];X=[0]+f;Y=X[:];R=(f,F),(f,-F),;H=(F,f),(-F,f),
for i in r(n):*a,c=I();R+=(a,c),;Y+=c,;X+=a
for i in r(m):a,*b=I();H+=(a,b),;X+=a,;Y+=b
def g(X):s=sorted(set(X));l=len(s);return{s[i]:i for i in r(l)},s,l
h,s,K=g(X);w,t,L=g(Y);V,U,v=[[[0]*-~K for i in r(L+... | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["-", 0, 652, 3, 4, 0, 206, 51, 634, 0, 22], ["+", 0, 652, 3, 4, 0, 206, 51, 634, 0, 22], ["-", 0, 652, 3, 4, 0, 206, 206, 666, 0, 22], ["+",... | 5 | 582 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.AbstractCollection;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arr... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.AbstractCollection;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arr... | [["-", 8, 196, 0, 37, 0, 510, 15, 16, 17, 79], ["+", 0, 37, 0, 510, 15, 16, 31, 492, 0, 131], ["+", 0, 37, 0, 510, 15, 16, 31, 492, 141, 22], ["+", 0, 510, 15, 16, 31, 492, 3, 4, 0, 24], ["+", 0, 510, 15, 16, 31, 492, 3, 4, 0, 25], ["+", 8, 196, 0, 37, 0, 510, 15, 16, 17, 79], ["+", 8, 196, 0, 37, 0, 510, 15, 16, 12, 4... | 3 | 2,168 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Set;
import java.... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Set;
import java.... | [["-", 12, 23, 0, 16, 31, 504, 71, 16, 31, 22], ["+", 12, 23, 0, 16, 31, 504, 71, 16, 31, 22], ["-", 75, 16, 12, 23, 0, 16, 12, 504, 71, 22], ["+", 75, 16, 12, 23, 0, 16, 12, 504, 71, 22]] | 3 | 1,807 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) begin(v), end(v)
#define fi first
#define se second
template <typename A, typename B> inline bool chmax(A &a, B b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) begin(v), end(v)
#define fi first
#define se second
template <typename A, typename B> inline bool chmax(A &a, B b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
... | [["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]] | 1 | 1,102 |
#include <bits/stdc++.h>
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#define file(s) \
freopen(s ".in", "r", stdin); ... | #include <bits/stdc++.h>
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#define file(s) \
freopen(s ".in", "r", stdin); ... | [["-", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["-", 49, 50, 51, 2, 3, 4, 0, 69, 28, 22], ["+", 49, 50, 51, 2, 3, 4, 0, 69, 28, 22], ["-", 28, 69, 28, 69, 341, 342, 0, 16, 17, 72], ["-", 28, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["+", 28, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 28,... | 1 | 1,067 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
vector<int> dy = {-1, 0, 1, 0};
vector<int> dx = {0, -1, 0, 1};
ll INF = 1000000000;
int mai... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
vector<int> dy = {-1, 0, 1, 0};
vector<int> dx = {0, -1, 0, 1};
ll INF = 1000000000;
int mai... | [["-", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22]] | 1 | 1,178 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template <class T> using vc = vector<T>;
template <class T> using vvc = vector<vector<T>>;
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#def... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template <class T> using vc = vector<T>;
template <class T> using vvc = vector<vector<T>>;
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#def... | [["-", 31, 27, 28, 69, 341, 342, 0, 16, 17, 72], ["-", 31, 27, 28, 69, 341, 342, 0, 16, 12, 13], ["-", 12, 27, 28, 69, 341, 342, 0, 16, 17, 72], ["-", 12, 27, 28, 69, 341, 342, 0, 16, 12, 13], ["-", 12, 69, 28, 69, 341, 342, 0, 2, 63, 22], ["+", 12, 69, 28, 69, 341, 342, 0, 2, 63, 22]] | 1 | 1,466 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using uint = unsigned int;
struct L {
int a, b, c;
L(int a = 0, int b = 0, int c = 0) : a(a), b(b), c(c) {}
};
int main() {
int n, m;
cin >> n >> m;
vector<L> lh(n), lv(m);
map<int, int> mpx... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using uint = unsigned int;
struct L {
int a, b, c;
L(int a = 0, int b = 0, int c = 0) : a(a), b(b), c(c) {}
};
int main() {
int n, m;
cin >> n >> m;
vector<L> lh(n), lv(m);
map<int, int> mpx... | [["-", 31, 69, 341, 342, 0, 16, 31, 69, 28, 22], ["+", 31, 69, 341, 342, 0, 16, 31, 69, 28, 22]] | 1 | 833 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct L {
int a, b, c;
L(int a = 0, int b = 0, int c = 0) : a(a), b(b), c(c) {}
};
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int main() {
int n, m;
cin >> n >> m;
map<int, int> mpx, mpy;
mpx[0] = 0;
mpy[0] = 0;
... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct L {
int a, b, c;
L(int a = 0, int b = 0, int c = 0) : a(a), b(b), c(c) {}
};
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int main() {
int n, m;
cin >> n >> m;
map<int, int> mpx, mpy;
mpx[0] = 0;
mpy[0] = 0;
... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]] | 1 | 886 |
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;
struct L {
int a, b, c;
L(int a = 0, int b = 0, int c = 0) : a(a), b(b), c(c) {}
};
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int main() {
int n, m; //縦横線の数
cin >> n >> m;
map<int, int> mp... | #include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;
struct L {
int a, b, c;
L(int a = 0, int b = 0, int c = 0) : a(a), b(b), c(c) {}
};
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int main() {
int n, m; //縦横線の数
cin >> n >> m;
map<int, int> mp... | [["-", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22]] | 1 | 900 |
#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
char ch = getchar();
int f = 0;
x = 0;
while (!isdigit(ch)) {
if (ch == '-')
f = 1;
ch = getchar();
}
while (isdigit(ch))
x = x * 10 + ch - 48, ch = getchar();
if (f)
x = -x;
}
const int N = 1024;
int n, m, sx, ... | #include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
char ch = getchar();
int f = 0;
x = 0;
while (!isdigit(ch)) {
if (ch == '-')
f = 1;
ch = getchar();
}
while (isdigit(ch))
x = x * 10 + ch - 48, ch = getchar();
if (f)
x = -x;
}
const int N = 1024;
int n, m, sx, ... | [["-", 51, 16, 31, 16, 12, 16, 12, 16, 31, 22], ["+", 51, 16, 31, 16, 12, 16, 12, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]] | 1 | 1,436 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<tuple<int, int, int>> abc(n);
for (int i = 0; i < n; ++i) {
int a, b, c;
cin >> a >> b >> c;
abc[i] = make_tuple(a, b, c);
}
vector<tuple<int, int, int>> def(n);
for (int i = 0; i < m; ++i) {
int ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<tuple<int, int, int>> abc(n);
for (int i = 0; i < n; ++i) {
int a, b, c;
cin >> a >> b >> c;
abc[i] = make_tuple(a, b, c);
}
vector<tuple<int, int, int>> def(m);
for (int i = 0; i < m; ++i) {
int ... | [["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]] | 1 | 1,220 |
#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;
typedef long long ll;
ll w[2002], h[2002], a[2002][2002] = {}, ans = 0;
int n, m, w1 = 0, h1 = 0;
struct seg {
int pos;
int fr;
int to;
bool operator<(const seg &s) const {
return (pos < s.pos || (pos == s.pos && fr < s.fr));
}... | #include <algorithm>
#include <iostream>
#include <queue>
using namespace std;
typedef long long ll;
ll w[2002], h[2002], a[2002][2002] = {}, ans = 0;
int n, m, w1 = 0, h1 = 0;
struct seg {
int pos;
int fr;
int to;
bool operator<(const seg &s) const {
return (pos < s.pos || (pos == s.pos && fr < s.fr));
}... | [["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]] | 1 | 895 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
#define all(x) (x).beg... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
#define all(x) (x).beg... | [["-", 28, 69, 341, 342, 0, 16, 31, 16, 12, 22], ["+", 28, 69, 341, 342, 0, 16, 31, 16, 12, 13]] | 1 | 1,507 |
// abc168_f
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define REPN(i, m, n) for (int(i) = m; (i) < (int)(n); +... | // abc168_f
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define REPN(i, m, n) for (int(i) = m; (i) < (int)(n); +... | [["-", 51, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["+", 51, 2, 3, 4, 0, 16, 31, 16, 12, 22]] | 1 | 1,395 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n), b(n), c(n), d(m), e(m), f(m);
rep(i, n) cin >> a[i] >> b[i] >> c[i];
rep(i, m) cin >> d[i] >> e[i] >> f[i];
... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n), b(n), c(n), d(m), e(m), f(m);
rep(i, n) cin >> a[i] >> b[i] >> c[i];
rep(i, m) cin >> d[i] >> e[i] >> f[i];
... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 51, 16, 31, 16, 31, 16, 31, 16, 17, 19], ["+", 51, 16, 31, 16, 31, 16, 31, 16, 17, 18], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 17, 19], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 18]] | 1 | 841 |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int M = 1005;
const int INF = 0x3f3f3f3f;
struct Node {
int a, b, c;
void read() { scanf("%d%d%d", &a, &b, &c); }
} r[M], c[M];
int x[M], y[M];
int nx, ny;
int findx(int v) { return lower_bound(x, x + nx, v) - x; }
int findy(int v) { retur... | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int M = 1005;
const int INF = 0x3f3f3f3f;
struct Node {
int a, b, c;
void read() { scanf("%d%d%d", &a, &b, &c); }
} r[M], c[M];
int x[M], y[M];
int nx, ny;
int findx(int v) { return lower_bound(x, x + nx, v) - x; }
int findy(int v) { retur... | [["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]] | 1 | 879 |
#include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) cerr << #x << ": " << x << endl;
#define DEBUG_VEC(v) \
cerr << #v << ":"; \
for (int i = 0; i < v.size(); i++) ... | #include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) cerr << #x << ": " << x << endl;
#define DEBUG_VEC(v) \
cerr << #v << ":"; \
for (int i = 0; i < v.size(); i++) ... | [["-", 31, 16, 31, 118, 28, 69, 341, 342, 0, 22], ["+", 31, 16, 31, 118, 28, 69, 341, 342, 0, 22], ["-", 12, 16, 31, 118, 28, 69, 341, 342, 0, 22], ["+", 12, 16, 31, 118, 28, 69, 341, 342, 0, 22]] | 1 | 1,994 |
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <random>
#... | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <random>
#... | [["-", 49, 50, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 49, 50, 51, 16, 31, 2, 63, 118, 28, 22]] | 1 | 2,600 |
//#include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using na... | //#include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using na... | [["-", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22]] | 1 | 4,433 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
const long long MOD = 1e9 + 7;
// const long long MOD=998244353;
const int INF = 1e9;
const long long IINF = 1e18;
const int dx[4]... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
const long long MOD = 1e9 + 7;
// const long long MOD=998244353;
const int INF = 1e9;
const long long IINF = 1e18;
const int dx[4]... | [["-", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22]] | 1 | 1,743 |
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i32 = int32_t;
using i64 = int64_t;
constexpr char newl = '\n';
constexpr double eps = 1e-10;
#define F... | #pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i32 = int32_t;
using i64 = int64_t;
constexpr char newl = '\n';
constexpr double eps = 1e-10;
#define F... | [["-", 31, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 31, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["-", 49, 50, 51, 16, 12, 2, 63, 118, 28, 22], ["+", 49, 50, 51, 16, 12, 2, 63, 118, 28, 22]] | 1 | 1,538 |
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;
// @@ !! LIM(board debug)
// --> board f:<< debug
// ---- inserted library file board.cc
struct BrdIdx {
int r;
int c;
BrdIdx(int r_, int c_) : r(r_), c(c_) {}
BrdIdx &operator+=(const BrdIdx &o) {
r += o.r;
c +... | #include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;
// @@ !! LIM(board debug)
// --> board f:<< debug
// ---- inserted library file board.cc
struct BrdIdx {
int r;
int c;
BrdIdx(int r_, int c_) : r(r_), c(c_) {}
BrdIdx &operator+=(const BrdIdx &o) {
r += o.r;
c +... | [["-", 0, 30, 0, 122, 8, 123, 0, 14, 39, 40], ["+", 0, 30, 0, 122, 8, 123, 0, 14, 39, 78], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 33]] | 1 | 3,214 |
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i, a, b) for (ll i = (a); i < (b); ++i)
#define rep(i, a) repi(i, 0, ... | #include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i, a, b) for (ll i = (a); i < (b); ++i)
#define rep(i, a) repi(i, 0, ... | [["-", 31, 69, 28, 69, 341, 342, 0, 16, 17, 72], ["-", 31, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13]] | 1 | 1,217 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
using VB = vector<bool>;
using VVI = vector<VI>;
using VVL = vector<VL>;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < ... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
using VB = vector<bool>;
using VVI = vector<VI>;
using VVL = vector<VL>;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < ... | [["-", 31, 16, 31, 16, 31, 16, 31, 69, 28, 22], ["+", 31, 16, 31, 16, 31, 16, 31, 69, 28, 22], ["-", 31, 16, 31, 16, 12, 16, 31, 69, 28, 22], ["+", 31, 16, 31, 16, 12, 16, 31, 69, 28, 22], ["-", 51, 16, 31, 16, 12, 16, 31, 69, 28, 22], ["+", 51, 16, 31, 16, 12, 16, 31, 69, 28, 22], ["-", 15, 339, 51, 16, 12, 16, 31, 69... | 1 | 2,449 |
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define lfs cout << fixed << setprecision(10)
#define ALL(a) (a).begin(), (a).end()
#define ALLR(a) (a).rbegin(), (a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#def... | //#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define lfs cout << fixed << setprecision(10)
#define ALL(a) (a).begin(), (a).end()
#define ALLR(a) (a).rbegin(), (a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#def... | [["-", 0, 30, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 1 | 1,818 |
#include <bits/stdc++.h>
using namespace std;
#define f0r(a, b) for (long long a = 0; a < (b); a++)
#define f1r(a, b, c) for (long long a = (b); a < (c); a++)
#define f0rd(a, b) for (long long a = (b); a >= 0; a--)
#define f1rd(a, b, c) for (long long a = (b); a >= (c); a--)
#define ms(arr, v) memset(arr, v, sizeof(a... | #include <bits/stdc++.h>
using namespace std;
#define f0r(a, b) for (long long a = 0; a < (b); a++)
#define f1r(a, b, c) for (long long a = (b); a < (c); a++)
#define f0rd(a, b) for (long long a = (b); a >= 0; a--)
#define f1rd(a, b, c) for (long long a = (b); a >= (c); a--)
#define ms(arr, v) memset(arr, v, sizeof(a... | [["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]] | 1 | 1,615 |
#include <algorithm>
#include <iostream>
#include <numeric>
#include <queue>
#include <utility>
#include <vector>
template <class T, class U> inline bool chmin(T &lhs, const U &rhs) {
if (lhs > rhs) {
lhs = rhs;
return true;
}
return false;
}
template <class T, class U> inline bool chmax(T &lhs, const ... |
#include <algorithm>
#include <iostream>
#include <numeric>
#include <queue>
#include <utility>
#include <vector>
template <class T, class U> inline bool chmin(T &lhs, const U &rhs) {
if (lhs > rhs) {
lhs = rhs;
return true;
}
return false;
}
template <class T, class U> inline bool chmax(T &lhs, const ... | [["-", 51, 23, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 51, 23, 0, 16, 12, 69, 341, 342, 0, 22]] | 1 | 1,523 |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = (int)3e3 + 9, INF = 0x3f3f3f3f;
int n, m, xtot, xque[maxn], ytot, yque[maxn];
struct Line {
int L, R, pos;
void read() { scanf("%d%d%d", &L, &R, &pos); }
} er[maxn], ec[maxn];
bool vis[maxn][maxn], banL[maxn][maxn], banR[maxn][maxn... | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = (int)3e3 + 9, INF = 0x3f3f3f3f;
int n, m, xtot, xque[maxn], ytot, yque[maxn];
struct Line {
int L, R, pos;
void read() { scanf("%d%d%d", &L, &R, &pos); }
} er[maxn], ec[maxn];
bool vis[maxn][maxn], banL[maxn][maxn], banR[maxn][maxn... | [["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]] | 1 | 1,072 |
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define re return
#define fi first
#define se second
#define sz(x) ((int)(... | //#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define re return
#define fi first
#define se second
#define sz(x) ((int)(... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]] | 1 | 994 |
#include <bits/stdc++.h>
using namespace std;
// one-based numbering
struct UnionFind {
vector<int> data;
// i: (data[i] < 0) -> group size, (data[i] > 0) -> parent;
UnionFind(int n) { data.resize(n + 1, -1); }
int find(int x) {
if (data[x] < 0)
return x;
else
return data[x] = find(data[x])... | #include <bits/stdc++.h>
using namespace std;
// one-based numbering
struct UnionFind {
vector<int> data;
// i: (data[i] < 0) -> group size, (data[i] > 0) -> parent;
UnionFind(int n) { data.resize(n + 1, -1); }
int find(int x) {
if (data[x] < 0)
return x;
else
return data[x] = find(data[x])... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18]] | 1 | 1,146 |
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
using P = pair<int, int>;
using ll = long long;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n), b(n), c(n), d(m), e(m), f(m);
for (in... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
using P = pair<int, int>;
using ll = long long;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n), b(n), c(n), d(m), e(m), f(m);
for (in... | [["-", 15, 339, 51, 69, 28, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 69, 28, 69, 341, 342, 0, 22], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["-", 0, 11, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 0, 11, 31, 69, 28, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 31, 69, 341,... | 1 | 1,306 |
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
const ll MOD = 1000000007;
int main() {
int N, M;
cin >> N >> M;
set<int> xs, ys;
vector<tuple<int, int, int>> hor, ver;
for (int i = 0; i < N; i++) {
int a, b, c;
cin >> a >> b >> c;
xs.insert(a);
xs.insert(b);
ys.insert(... | #include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
const ll MOD = 1000000007;
int main() {
int N, M;
cin >> N >> M;
set<int> xs, ys;
vector<tuple<int, int, int>> hor, ver;
for (int i = 0; i < N; i++) {
int a, b, c;
cin >> a >> b >> c;
xs.insert(a);
xs.insert(b);
ys.insert(... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]] | 1 | 1,091 |
import sys
sys.setrecursionlimit(10**8)
def main():
n, a, b, c, d = map(int, input().split())
memo = {}
def dfs(x):
if x == 0:
return 0
elif x == 1:
return d
elif x in memo:
return memo[x]
else:
ret = min(
d * x,... | import sys
sys.setrecursionlimit(10**8)
def main():
n, a, b, c, d = map(int, input().split())
memo = {}
def dfs(x):
if x == 0:
return 0
elif x == 1:
return d
elif x in memo:
return memo[x]
else:
ret = min(
d * x,... | [["-", 31, 657, 12, 23, 0, 657, 12, 657, 12, 612], ["+", 31, 657, 12, 23, 0, 657, 12, 657, 12, 612]] | 5 | 265 |
#include <iostream>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int64_t A, B, C, D;
unordered_map<int64_t, int64_t> memo;
int64_t solve(int64_t N) {
if (N == 0)
return 0;
else if (N == 1)
return D;
if (memo.count(N))
return memo[N];
... | #include <iostream>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int64_t A, B, C, D;
unordered_map<int64_t, int64_t> memo;
int64_t solve(int64_t N) {
if (N == 0)
return 0;
else if (N == 1)
return D;
if (memo.count(N))
return memo[N];
... | [["+", 51, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 17, 33]] | 1 | 312 |
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin()... | #include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin()... | [["-", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22]] | 1 | 607 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>... | [["-", 0, 41, 64, 69, 341, 342, 0, 16, 17, 72], ["-", 0, 41, 64, 69, 341, 342, 0, 16, 12, 13]] | 1 | 3,195 |
#include <bits/stdc++.h>
using namespace std;
//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop ... | #include <bits/stdc++.h>
using namespace std;
//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop ... | [["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 1,175 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, l, r) for (long long i = (l); i < (r); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FOR(i, 1, n + 1)
#define RFOR(i, l, r) for (long long i = (l); i >= (r); --i)
#define RREP(i, n) RFOR(i, n - 1, 0)
#define RREPS(i, n) RFOR(i, n, 1)
#define ll long ... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, l, r) for (long long i = (l); i < (r); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FOR(i, 1, n + 1)
#define RFOR(i, l, r) for (long long i = (l); i >= (r); --i)
#define RREP(i, n) RFOR(i, n - 1, 0)
#define RREPS(i, n) RFOR(i, n, 1)
#define ll long ... | [["-", 49, 50, 51, 23, 0, 41, 15, 2, 63, 22], ["+", 49, 50, 51, 23, 0, 41, 15, 2, 63, 22]] | 1 | 585 |
#include <bits/stdc++.h>
// using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i, j, n) for (ll i = (ll)(j); i < (ll)(n); i++)
#define REP(i, j, n) for (ll i = (ll)(j); i... | #include <bits/stdc++.h>
// using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i, j, n) for (ll i = (ll)(j); i < (ll)(n); i++)
#define REP(i, j, n) for (ll i = (ll)(j); i... | [["-", 12, 16, 12, 23, 0, 16, 12, 16, 12, 13], ["+", 12, 16, 12, 23, 0, 16, 12, 16, 12, 13]] | 1 | 1,618 |
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define rep(i, n) for (i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1ll << 60
usi... | #include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define rep(i, n) for (i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1ll << 60
usi... | [["+", 36, 36, 0, 30, 0, 134, 39, 86, 0, 87]] | 1 | 339 |
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define int long long
#define REP(i, m, n) for (int i = (m); i < (n); i++)
#define rep(i, n) REP(i, 0, n)
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(c) (c).rbegin(), (c).rend()
#define mp make_pair
#... | #include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define int long long
#define REP(i, m, n) for (int i = (m); i < (n); i++)
#define rep(i, n) REP(i, 0, n)
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(c) (c).rbegin(), (c).rend()
#define mp make_pair
#... | [["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]] | 1 | 666 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.