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 = int(input())
a = list(map(int, input().split()))
cost = 100 ** 100
temp = 0
for x in range(1, 100+1):
for y in range(N):
temp += (x - abs(a[y])) ** 2
cost = min(temp, cost)
temp = 0
print(cost)
| N = int(input())
a = list(map(int, input().split()))
cost = 100 ** 100
temp = 0
for x in range(-100, 101):
for y in range(N):
temp += (x - a[y]) ** 2
cost = min(temp, cost)
temp = 0
print(cost)
| [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 12, 65... | 5 | 83 |
# input
n = int(input())
A = list(map(int, input().split()))
ans1 = sum(A) // n + (sum(A) % n != 0)
ans2 = ans1 - 1
cost1 = 0
cost2 = 0
for i in range(n):
cost1 += (A[i] - ans1) ** 2
cost2 += (A[i] - ans2) ** 2
if cost1 <= cost2:
print(ans1)
else:
print(ans2)
| # input
n = int(input())
A = list(map(int, input().split()))
ans1 = sum(A) // n + (sum(A) % n != 0)
ans2 = ans1 - 1
cost1 = 0
cost2 = 0
for i in range(n):
cost1 += (A[i] - ans1) ** 2
cost2 += (A[i] - ans2) ** 2
print(min(cost1, cost2)) | [["-", 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, 19], ["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["... | 5 | 103 |
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> A(n);
int total = 0;
for (int i = 0; i < n; i++) {
cin >> A[i];
total += A[i];
}
int ans = 1e9;
for (int i = 0; i <= total % n; i++) {
int cost = 0, tmp;
... | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> A(n);
for (int i = 0; i < n; i++) {
cin >> A[i];
}
int ans = 1e9;
for (int i = -100; i <= 100; i++) {
int cost = 0;
for (int j = 0; j < n; j++) {
int tm... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["-", 8, 9, 0, 1, 0, 11, 12... | 1 | 162 |
/**
* @author torith
* @date 2018-11-06
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> a;
for (int i = 0; i < N; ++i) {
int t;
cin >> t;
a.push_back(t);
}
sort(a.begin(), a.en... | /**
* @author torith
* @date 2018-11-06
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> a;
for (int i = 0; i < N; ++i) {
int t;
cin >> t;
a.push_back(t);
}
sort(a.begin(), a.en... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 51, 16, 31, 16, 31, 2, 63, 118, 28, 22], ["-", 51, 16, 31, 16, 31, 2, 63, 118, 17, 131], ["-", 51, 16, 31, 16, 31, 2, 63, 118, 119, 120], ["-", 51, 16, 31, 16, 31, 2, 3, 4, 0, 24], ["-",... | 1 | 181 |
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char const *argv[]) {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
std::vector<int> v;
cin >> n;
int sum = 0;
for (int i = 0; i < n; ++i) {
int t;
cin >> t;
v.push_back(t);
sum += t;
}
int target = (sum / ... | #include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char const *argv[]) {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
std::vector<int> v;
cin >> n;
int sum = 0;
for (int i = 0; i < n; ++i) {
int t;
cin >> t;
v.push_back(t);
sum += t;
}
in... | [["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 8, 9, 0, 43, 49, 50, 51, 74, 0, 24], ["+", 0, 43, 49, 50, 51, 74, 39, 77, 39, 40], ["+", 8, 9, 0, 43, 49, 50, 51, 74, 0, 25], ["+", 0, 43, 49, 50, 51, 74, 51, 23, 0, 24], ["+", 49, 50, 51, 74, 51, 23, 0, 2, 63, 22], ["-... | 1 | 158 |
//おまじない
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define INF 1e9 + 7
#define roop(i, m, n) for (int i = m; i < n; i++)
#define mroop(i, m, n) for (int i = m; i < n; i--)
#define NO cout << "NO" << endl;
#define YES cout << "YES" << endl;
#define No cout << "No" << endl;
#define Yes c... | //おまじない
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define INF 1e9 + 7
#define roop(i, m, n) for (int i = m; i < n; i++)
#define mroop(i, m, n) for (int i = m; i < n; i--)
#define NO cout << "NO" << endl;
#define YES cout << "YES" << endl;
#define No cout << "No" << endl;
#define Yes c... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 9, 0, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 9, 0, 1, 0, ... | 1 | 208 |
def main():
N = int(input())
A = list(map(int, input().split()))
m = min(A)
M = max(A)
for a in A:
Result = (a-m) * (a-m)
for i in range(m+1, M+1):
Result_tmp = 0
for a in A:
Result_tmp += (a - i) * (a - i)
if Result > Result_tmp:
Result... | def main():
N = int(input())
A = list(map(int, input().split()))
m = min(A)
M = max(A)
Result = 0
for a in A:
Result += (a-m) * (a-m)
for i in range(m+1, M+1):
Result_tmp = 0
for a in A:
Result_tmp += (a - i) * (a - i)
Result = min(Result_tmp, R... | [["+", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["-", 0, 7,... | 5 | 117 |
#include <algorithm>
#include <array>
#include <cmath>
#include <complex>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
#define INF 1 << 21
using pii = std::pair<int, int>;
#... | #include <algorithm>
#include <array>
#include <cmath>
#include <complex>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1 << 21;
using pii = std::pair<int, in... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 0, 30, 0, 43, 0, 153, 0, 154], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 17, 151], ["+"... | 1 | 222 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (size_t i = a; i < b; i++)
#define REP(i, b) FOR(i, 0, b)
#define RFOR(i, a, b) for (size_t i = a - 1; i >= b; i--)
#define RREP(i, a) RFOR(i, a, 0)
#define INF 1e7
int main() {
vector<int> v;
set<int> cost;
int n;
cin >> n;
REP(i, n) {
... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, b) FOR(i, 0, b)
#define RFOR(i, a, b) for (int i = a - 1; i >= b; i--)
#define RREP(i, a) RFOR(i, a, 0)
#define INF 1e7
int main() {
vector<int> v;
set<int> cost;
int n;
cin >> n;
REP(i, n) {
int... | [["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["-", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 2, 3, 4, 0,... | 1 | 188 |
iN = int(input())
aA = [int(x) for x in input().split()]
#i2M = (min(aA) + max(aA)) // 2
iMM = sum(aA) // len(aA)
#if i2M < iMM :
# iLM = i2M
# iUM = iMM + 1
#else:
# iLM = iMM
# iUM = i2M + 1
if iMM < 0 :
iUM = iMM
iLM = iMM - 1
else:
iLM = iMM
iUM = iMM + 1
aR = []
for iM in range(iLM,iU... |
iN = int(input())
aA = [int(x) for x in input().split()]
#i2M = (min(aA) + max(aA)) // 2
iMM = sum(aA) // len(aA)
#if i2M < iMM :
# iLM = i2M
# iUM = iMM + 1
#else:
# iLM = iMM
# iUM = i2M + 1
iLM = iMM
iUM = iMM + 1
aR = []
for iM in range(iLM,iUM+1):
aR.append(0)
for iA in aA:
aR[-1] += (... | [["-", 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, 18], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32... | 5 | 114 |
n = int(input())
a = list(map(int, input().split()))
a.sort()
#print(a)
l = len(a)
s = sum(a)
#print(s)
target = 0
ans = 0
if s % 2 == 1:
target = int(s / n) + 1
else:
target = int(s / n)
#print(target)
for i in range(l):
ans = ans + (target - a[i]) * (target - a[i])
print(ans)
| n = int(input())
a = list(map(int, input().split()))
a.sort()
#print(a)
l = len(a)
s = sum(a)
#print(s)
target = 0
ans = 0
#if s % 2 == 1:
# target = int(s / n) + 1
#else:
# target = int(s / n)
#print(target)
target = round(s / n)
for i in range(l):
ans = ans + (target - a[i]) * (target - ... | [["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 109], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612], ["-", 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... | 5 | 111 |
#include <bits/stdc++.h>
using namespace std;
void solution(int n, int a[]) {
int s = 0;
for (int i = 0; i < n; i++) {
s += a[i];
}
int p = (s / n);
if (p % 2 != 0) {
p++;
}
int cost = 0;
for (int i = 0; i < n; i++) {
cost += pow(abs(p - a[i]), 2);
}
cout << cost << endl;
}
int main() {... | #include <bits/stdc++.h>
using namespace std;
void solution(int n, int a[]) {
float s = 0;
for (int i = 0; i < n; i++) {
s += a[i];
}
float prom = (s / n);
prom = roundf(prom);
int p = static_cast<int>(prom);
int cost = 0;
for (int i = 0; i < n; i++) {
cost += pow(abs(p - a[i]), 2);
}
cout <... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, ... | 1 | 162 |
import math
n=int(input())
a=list(map(int,input().split()))
ave=math.ceil(sum(a)/n)
ans=0
for i in a:
ans+=(i-ave)**2
print(ans)
| import math
n=int(input())
a=list(map(int,input().split()))
ave=round(sum(a)/n,0)
ans=0
for i in a:
ans+=(i-ave)**2
print(int(ans))
| [["-", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], [... | 5 | 61 |
//#include <bits/stdc++.h>
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#inc... | //#include <bits/stdc++.h>
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#inc... | [["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 30, 0, 14,... | 1 | 358 |
#include <algorithm>
#include <iostream>
#include <math.h>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define MY_BIG_INT long long
class MYCP {
public:
//数値を必要な個数だけ読み取る
static vector<long long> ReadInts(long long number) {
vector<long long> a(number);
for (int i = 0; i < ... | #include <algorithm>
#include <iostream>
#include <math.h>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define MY_BIG_INT long long
class MYCP {
public:
//数値を必要な個数だけ読み取る
static vector<long long> ReadInts(long long number) {
vector<long long> a(number);
for (int i = 0; i < ... | [["+", 0, 30, 0, 14, 49, 53, 54, 55, 0, 21], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 49, 22], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 28, 22], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 17, 131], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 119, 120], ["-", 0, 7, 15, 16, 12, 2, 3, 4, 0, 24], ["-", ... | 1 | 367 |
#include <bits/stdc++.h>
using namespace std;
int a[1010];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int ans = 1000000;
for (int i = 0; i < n; i++) {
int temp = 0;
for (int j = 0; j < n; j++)
temp += (a[j] - a[i]) * (a[j] - a[i]);
if (temp < ans)
... | #include <bits/stdc++.h>
using namespace std;
int a[1010];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int ans = 1000000;
for (int i = -100; i < 101; i++) {
int temp = 0;
for (int j = 0; j < n; j++)
temp += (a[j] - i) * (a[j] - i);
if (temp < ans)
... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 12, 16, 31, 23, 0, 16, 12, 69, 28, 22], ["-", 31, 23, 0, 16, 12, 69, 341, 342, 0, 70], ["-", 31, 23, 0, 16, 12, 69, 341, 342, 0, 73], ["-", 12,... | 1 | 128 |
n = input()
n_list = list(map(int, input().split()))
min_sum = float('inf')
for i in range(-100, 101):
sum = 0
for a in n_list:
sum += abs((i - a) ^ 2)
min_sum = min(min_sum, sum)
print(min_sum)
| n = input()
n_list = list(map(int, input().split()))
min_sum = float('inf')
for i in range(-100, 101):
total = 0
for a in n_list:
total += pow((a - i), 2)
min_sum = min(min_sum, total)
print(min_sum)
| [["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22], ["-", 8, 196, 0, 1, 0, 677, 12, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 652, 63, 22], ["-", 3, 4, 0, 657, 31, 23, 0, 657, 31, 22], ["-", 3, 4... | 5 | 73 |
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define INF 99999999
typedef long long ll;
int main() {
int n = 0;
int f = 0;
int sa = 0, ans = INF;
int ar[100] = {};
std::cin >> n;
for (int i = 0; i < n; i+... | #include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define INF 999999999
typedef long long ll;
int main() {
ll n = 0;
ll f = 0;
ll sa = 0, ans = INF;
ll ar[100] = {};
std::cin >> n;
for (int i = 0; i < n; i++) ... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 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], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["-", 0, 7, 10, ... | 1 | 241 |
#include <stdio.h>
#include <stdlib.h>
#define MAX 100
int compare_int(const void *a, const void *b) { return *(int *)a - *(int *)b; }
int main(void) {
int n, i, j, min = 1000000, sum = 0, left, right;
int a[MAX];
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
qsort(a, n, sizeof(int... | #include <stdio.h>
#include <stdlib.h>
#define MAX 100
int compare_int(const void *a, const void *b) { return *(int *)a - *(int *)b; }
int main(void) {
int n, i, j, min = 1000000, sum = 0, left, right;
int a[MAX];
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
qsort(a, n, sizeof(int... | [["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]] | 0 | 210 |
n = int(input())
nlist= list(map(int,input().split()))
nmax = max(nlist)
nmin = min(nlist)
costs = []
for i in range(len(nlist)):
p = 0
for j in range(len(nlist)):
p = p + (nlist[i]-nlist[j]) ** 2
costs.append(p)
print(min(costs))
| n = int(input())
nlist= list(map(int,input().split()))
nmax = max(nlist)
nmin = min(nlist)
costs = []
for i in range(nmin,nmax + 1):
p = 0
for j in range(len(nlist)):
p = p + (i-nlist[j]) ** 2
costs.append(p)
print(min(costs))
| [["-", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, ... | 5 | 96 |
import math
N = int(input())
a = list(map(int,input().split()))
ave = math.ceil(sum(a)/len(a))
ans = 0
for i in a:
ans += (i-ave)**2
print(ans)
| N = int(input())
a = list(map(int,input().split()))
ave = round(sum(a)/N)
ans = 0
for i in a:
ans += (i-ave)**2
print(ans)
| [["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["-", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 12, 652, 3, 4, 0, 657, 12, 65... | 5 | 64 |
// glory be to the sky
#include <bits/stdc++.h>
#include <cstdio>
#define pb push_back
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, arr[105];
ll ans = (ll)1e9;
cin >> N;
for (int i = 0; i < N; i++)
cin >> arr[i];
for (int i = 0; i < N; i+... | // glory be to the sky
#include <bits/stdc++.h>
#include <cstdio>
#define pb push_back
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, arr[105];
ll ans = (ll)1e9;
cin >> N;
for (int i = 0; i < N; i++)
cin >> arr[i];
for (int target = -100; t... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0,... | 1 | 172 |
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
int a[110];
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int res = 100;
for (int i = -100; i <= 100; i++) {
int sum = 0;
for (int j = 0; j < n; j++) {
int sq = a[j] - i;
sum +... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n;
int a[110];
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int res = 1000000;
for (int i = -100; i <= 100; i++) {
int sum = 0;
for (int j = 0; j < n; j++) {
int sq = a[j] - i;
sum += (sq * sq);
... | [["-", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11,... | 1 | 128 |
#include <stdio.h>
int main() {
int a[110], sum = 0, sum2 = 0, n, m;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
sum += a[i];
sum2 += a[i] * a[i];
}
m = (n + 2 * sum) / (2 * n);
printf("%d", sum2 - 2 * sum * m + m * m * n);
return 0;
} | #include <stdio.h>
int main() {
int a[110], sum = 0, sum2 = 0, n, m;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
sum += a[i] + 100;
sum2 += (a[i] + 100) * (a[i] + 100);
}
m = (n + 2 * sum) / (2 * n);
printf("%d", sum2 - 2 * sum * m + m * m * n);
return 0;
} | [["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 11, 12,... | 0 | 124 |
#include <algorithm>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main() {
int n, sum = 0, tmp = 0, result = 10000;
cin >> n;
vector<int> a(n, 0);
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
sort(a.begin(), a.end())... | #include <algorithm>
#include <climits>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main() {
int n, sum = 0, tmp = 0, result = INT_MAX;
cin >> n;
vector<int> a(n, 0);
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
sor... | [["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14... | 1 | 232 |
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int, int>
#define vp vector<P>
#define PP pair<int, P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,... | #include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int, int>
#define vp vector<P>
#define PP pair<int, P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,... | [["-", 0, 30, 0, 14, 8, 9, 0, 338, 0, 88], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 0, 14, 8, 9, 0, 338, 39, 361, 0, 190], ["-", 0, 30, 0, 14, 8, 9, 0, 338, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 338, 0, 102], ["-", 0, 30, 0, 14, 8, 9, 0, 338, 12, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3... | 1 | 188 |
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
double a[100];
int inputmin;
int inputmax;
for (int i = 0; i < N; i++) {
cin >> a[i];
}
int cost;
int mini;
for (int z = -100; z <= 100; z++) {
cost = 0;
for (int i = 0; i <... | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
double a[100];
for (int i = 0; i < N; i++) {
cin >> a[i];
}
int cost;
int mini = 10000000;
for (int z = -100; z <= 100; z++) {
cost = 0;
for (int i = 0; i <= N - 1; i++) {
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["-", 8, 9, 0, 1, 0, 11, 12,... | 1 | 133 |
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i, m) for (long long i = 0; i < m; i++)
#def... | #include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i, m) for (long long i = 0; i < m; i++)
#def... | [["-", 0, 14, 8, 9, 0, 14, 49, 53, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 8, 9, 0, 14, 49, 53, 54, 55, 0, 21], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0,... | 1 | 207 |
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <set>
using namespace std;
int a[105];
int main() {
int n;
while (scanf("%d", &n) != EOF) {
int s = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
s += a[i];
}
if (s % n == 0)
s /= n;
... | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <set>
using namespace std;
int a[105];
int main() {
int n;
while (scanf("%d", &n) != EOF) {
int s = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
s += a[i];
}
float sum = (float)s;
if (s >... | [["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 74, 0, 24], ["+", 0, 43, 49, 50, 51, 74, 39, 77, 39, 40], ["+", 8, 9, 0, 43, 49, 50, 51, 74, 0, 25], ["+", 8, 9, 0, 43, 49, 50, 51, 74, 51, 22], ["+", 8, 9, 0, 52... | 1 | 171 |
#include <stdio.h>
int fun(int x) { return x * x; }
int main() {
int n, s[102];
while (~scanf("%d", &n)) {
int i, minn = 101, maxx = -101;
for (i = 1; i <= n; i++) {
scanf("%d", &s[i]);
if (s[i] > maxx)
maxx = s[i];
if (s[i] < minn)
minn = s[i];
}
int zz, minnn = 99... | #include <stdio.h>
int fun(int x) { return x * x; }
int main() {
int n, s[102];
while (~scanf("%d", &n)) {
int i, minn = 101, maxx = -101;
for (i = 1; i <= n; i++) {
scanf("%d", &s[i]);
if (s[i] > maxx)
maxx = s[i];
if (s[i] < minn)
minn = s[i];
}
int zz, minnn = 99... | [["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22], ["-", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["-", 8, 9, 0, 1... | 1 | 205 |
#include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(), (a).end()
using namespace std;
int main(int argc, char const *argv[]) {
int N;
scanf("%d", &N);
std::vector<int> A(N);
int sum = 0;
for (size_t i = 0; i < N; i++) {
std::cin >> A[i];
sum += A[i];
}
double ave = (double)sum... | #include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(), (a).end()
using namespace std;
int main(int argc, char const *argv[]) {
int N;
scanf("%d", &N);
std::vector<int> A(N);
int sum = 0;
for (size_t i = 0; i < N; i++) {
std::cin >> A[i];
sum += A[i];
}
double ave = (double)sum... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0... | 1 | 169 |
require 'prime'
include Math
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a end
def gif; gets.to_i ... | require 'prime'
include Math
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a end
def gif; gets.to_i ... | [["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["+", 0, 662, 12, 652, 486, 652, 486, 739, 0, 24], ["+", 12, 652, 486, 652, 486, 739, 0, 738, 17, 85], ["+", 12, 652, 486, 652, 486, 739, 0, 738, 12, 22], ["+", 0, 662, 12, 652, 486, 652, 486, 739, 0, 25], ["+", 0, 493, 0, 662... | 4 | 303 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[114];
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);
int sum = 1e9;
int ans = 0;
for (int i = a[0]; i <= a[n - 1]; i++) {
int res = 0;
for (int j = 0; j < n; j++) {
res += (i -... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[114];
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);
int ans = 1e9;
for (int i = a[0]; i <= a[n - 1]; i++) {
int res = 0;
for (int j = 0; j < n; j++) {
res += (i - a[j]) * (i - a... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 8, 9, 0, 57, ... | 1 | 157 |
#include <cmath>
#include <iostream>
using namespace std;
template <typename T> T SQ(T val) { return val * val; }
int main() {
int N = 0;
cin >> N;
int a[N];
cin >> a[0];
double mean = a[0];
for (int i = 1; i < N; i++) {
cin >> a[i];
mean = (double)(i) / (i + 1) * mean + 1.0 / (i + 1) * a[i];
}
... | #include <cmath>
#include <iostream>
using namespace std;
template <typename T> T square(T val) { return val * val; }
int main() {
int N = 0;
cin >> N;
int a[N];
double mean = 0;
for (int i = 0; i < N; i++) {
cin >> a[i];
mean = (double)(i) / (i + 1) * mean + 1.0 / (i + 1) * a[i];
}
int target =... | [["-", 0, 30, 0, 359, 0, 14, 49, 53, 49, 22], ["+", 0, 30, 0, 359, 0, 14, 49, 53, 49, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 8, 9, 0, 1, 0, 16, 12, 69, 28, 22], ["-", 0, 1, 0, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 16, 12, 69, 341, 342, 0, 13], ["-", 0, 1, 0,... | 1 | 166 |
from functools import reduce
n = int(input())
arr = list(map(int, input().split()))
s = reduce(lambda sum,x: sum+x, arr)
h = s//n + int(s%n>0)
m = 0
for a in arr:
m += (a-h)**2
print(int(m))
| from functools import reduce
n = int(input())
arr = list(map(int, input().split()))
s = reduce(lambda sum,x: sum+x, arr)
h = round(s/n)
m = 0
for a in arr:
m += (a-h)**2
print(int(m))
| [["-", 0, 1, 0, 662, 12, 657, 31, 657, 31, 22], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 676], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 12, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 0, 1, 0, 662, 12, 657, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 12, 652, 3, 4, 0, 666, 0, 657, 1... | 5 | 82 |
#include <iostream>
using namespace std;
#include <algorithm>
#include <stdio.h>
#include <vector>
#define _USE_MATH_DEFINES
#include <cstdlib>
#include <math.h>
#include <string>
int dx[8] = {1, 2, 1, 2, -1, -2, -1, -2}, dy[8] = {2, 1, -2, -1, -2, -1, 2, 1};
int main() {
int n;
cin >> n;
int a[n], ave = 0, an... | #include <iostream>
using namespace std;
#include <algorithm>
#include <stdio.h>
#include <vector>
#define _USE_MATH_DEFINES
#include <cstdlib>
#include <math.h>
#include <string>
int dx[8] = {1, 2, 1, 2, -1, -2, -1, -2}, dy[8] = {2, 1, -2, -1, -2, -1, 2, 1};
int main() {
int n;
cin >> n;
int a[n];
double av... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 57, 64, 1, 0, 11, 12, 2, 63, 22], ["-", 12, 16, 31, 23, 0, 16, 31, 16, 17, 72], ["-", 12, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["-", 0, 11, 12... | 1 | 195 |
#include <stdio.h>
int main(void) {
int i, j, n, a[100], cst[300], max, min, min2, sum, cnt;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
// for(i=0;i<n;i++) printf("%d\n",a[i]);
max = -101;
for (i = 0; i < n; i++) {
if (max < a[i])
max = a[i];
}
min = 101;
for (i = 0; i ... | #include <stdio.h>
int main(void) {
int i, j, n, a[100], cst[300], max, min, min2, sum, cnt;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
// for(i=0;i<n;i++) printf("%d\n",a[i]);
max = -101;
for (i = 0; i < n; i++) {
if (max < a[i])
max = a[i];
}
min = 101;
for (i = 0; i ... | [["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["-", 0, 14, 8, 9, 0, 7, 10, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 10, 11, 17, 32], ["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16... | 0 | 285 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include... | [["-", 0, 14, 8, 9, 0, 14, 49, 53, 49, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 12, 2, 3, 4, 0, 16, 31, 69, 28, 22], ["-", 3, 4, 0, 16, 31, 69, 341, 3... | 1 | 462 |
#include <stdio.h>
int main(void) {
int n;
scanf("%d", &n);
int i, j;
int min = 1000000, sum;
int a[105];
for (i = 0; i <= n; i++) {
scanf("%d", &a[i]);
}
for (i = -100; i <= 100; i++) {
sum = 0;
for (j = 1; j <= n; j++) {
sum += (i - a[j]) * (i - a[j]);
}
if (sum < min) {
... | #include <stdio.h>
int main() {
int N;
scanf("%d", &N);
int i, j;
int ans = 1000000, sum;
int a[105];
for (i = 0; i < N; i++) {
scanf("%d", &a[i]);
}
for (i = -100; i <= 100; i++) {
sum = 0;
for (j = 0; j < N; j++) {
sum += (i - a[j]) * (i - a[j]);
}
if (sum < ans) {
a... | [["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 7,... | 0 | 146 |
from functools import reduce
n = int(input())
a = list(map(int,input().split()))
end = max(a)
ansAry = []
b = min(a)
while(True):
suma = []
for i in range(0,len(a)):
if b == a[i]:
pass
else:
suma.append((a[i] - b)*(a[i] - b))
ansAry.append(reduce(lambda x,y:x+y,sum... | from functools import reduce
n = int(input())
a = list(map(int,input().split()))
end = max(a)
ansAry = []
b = min(a)
while(True):
suma = []
for i in range(0,len(a)):
if b == a[i]:
pass
else:
suma.append((a[i] - b)*(a[i] - b))
try:
ansAry.append(reduce(lamb... | [["+", 0, 656, 0, 52, 8, 196, 0, 246, 0, 247], ["+", 0, 656, 0, 52, 8, 196, 0, 246, 0, 102], ["-", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["-", 0, 52, 8, 196, 0, 1, 0, 677, 17, 107], ["-", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 52, 8, 196, 0, 246, 0, 671, 0, 672], ["+", 0, 52, 8, 196, 0, 246, 0, 671, 0, 102], [... | 5 | 134 |
#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int N, a[100], min = 200, max = -100, ans = 10000, sum = 0;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> a[i];
if (min > a[i])
min = a[i];
if (max < a[i])
max = a[i];
}
for (int i = min... | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int N, a[100], min = 200, max = -100, sum = 0;
long long int ans = 1000000000000000000;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> a[i];
if (min > a[i])
min = a[i];
if (max < a[i])
max =... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40], ["+", 0, 14, 8, 9, 0, 43... | 1 | 174 |
def change_num(x, y)
(x-y)**2
end
length = gets.to_i
n = gets.chomp.split(" ").map(&:to_i)
puts 0; exit if n.uniq.length == 1
arr = {}
(-100).upto(100) do |i|
x = 0
n.each do |z|
x += change_num(z, i)
end
arr[i.to_s] = x
end
puts arr.min { |a, b| a[1] <=> b[1] }[0]
| def change_num(x, y)
(x-y)**2
end
l = gets.to_i
n = gets.chomp.split(" ").map(&:to_i)
if n.uniq.length == 1
puts 0
exit
end
arr = {}
(-100).upto(100) do |i|
x = 0
n.each do |z|
x += change_num(z, i)
end
arr[i.to_s] = x
end
puts arr.min { |a, b| a[1] <=> b[1] }[1] | [["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 612], ["-", 36, 36, 36, 36, 36, 36, 0, 493, 0, 35], ["-", 36, 36, 36, 36, 0, 493, 0, 751, 8, 22], ["+", 0, 493, 0, 121, 64, 749, 0, 652, 7... | 4 | 118 |
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char const *argv[]) {
std::vector<int> v(100);
int n, i, k, temp_cost, min;
temp_cost = 0;
i = 100 * 100 * 200;
cin >> n;
for (i = 0; i < n; i++) {
cin >> v[i];
}
for (i = -100; i <= 100; i++) {
for (k = 0; k < n; k... | #include <iostream>
#include <vector>
using namespace std;
int main(int argc, char const *argv[]) {
std::vector<int> v(100);
int n, i, k, temp_cost, min;
min = 100 * 100 * 200;
cin >> n;
for (i = 0; i < n; i++) {
cin >> v[i];
}
for (i = -100; i <= 100; i++) {
temp_cost = 0;
for (k = 0; k < ... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, ... | 1 | 152 |
#include <algorithm>
#include <climits>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int cost(int x, int y) { return (x - y) * (x - y); }
bool q(vector<int> r) {
for (int i = 0... | #include <algorithm>
#include <climits>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int cost(int x, int y) { return (x - y) * (x - y); }
bool q(vector<int> r) {
for (int i = 0... | [["-", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["-", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 43, 49, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0,... | 1 | 234 |
#include <iostream>
#include <vector>
using namespace std;
const int INF = 1e9 + 10;
int main() {
int N;
cin >> N;
vector<int> an(N);
int l = INF, r = -INF, c;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
an[i] = a;
l = min(l, an[i]);
r = max(r, an[i]);
}
int s = INF;
int idx... | #include <iostream>
#include <vector>
using namespace std;
const int INF = 1e9 + 10;
int main() {
int N;
cin >> N;
vector<int> an(N);
int l = INF, r = -INF, c;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
an[i] = a;
l = min(l, an[i]);
r = max(r, an[i]);
}
int s = INF;
for (in... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 8, 9, 0, 57, 15, 339... | 1 | 196 |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
int loop;
int N;
int *a;
int x, y;
int sum = 0;
int best = 0;
scanf("%d", &N);
a = malloc(sizeof(int) * N);
for (loop = 0; loop < N; loop++) {
scanf("%d", &a[loop]);
}
for (x = 1; x <= 100; x++) {
for (y = 0; y < N; y... | #include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
int loop;
int N;
int *a;
int x, y;
int sum;
int best;
scanf("%d", &N);
a = malloc(sizeof(int) * N);
best = INT_MAX;
for (loop = 0; loop < N; loop++) {
scanf("%d", &a[loop]);
}
for (x = -100; x <= 100;... | [["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9,... | 0 | 153 |
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
int ave = 0;
for (int i = 0; i < n; i++) {
ave += a[i];
}
ave /= a.si... | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
int ave = 0;
for (int i = 0; i < n; i++) {
ave += a[i];
}
ave /= n;
... | [["-", 0, 1, 0, 11, 12, 2, 63, 118, 28, 22], ["-", 0, 1, 0, 11, 12, 2, 63, 118, 17, 131], ["-", 0, 1, 0, 11, 12, 2, 63, 118, 119, 120], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 7, 8, 9, 0, ... | 1 | 182 |
io = STDIN
n=io.gets.chomp.to_i
a=io.gets.chomp.split.map(&:to_i)
ans=a.max**2
(a.min..a.max).each do |i|
tmp=a.map{|j|(i-j)**2}.inject(:+)
ans=[tmp,ans].min
end
puts ans | io = STDIN
n=io.gets.chomp.to_i
a=io.gets.chomp.split.map(&:to_i)
ans=(100*100)**2*100
(a.min..a.max).each do |i|
tmp=a.map{|j|(i-j)**2}.inject(:+)
ans=[tmp,ans].min
end
puts ans | [["-", 0, 493, 0, 662, 12, 738, 31, 652, 486, 22], ["-", 0, 493, 0, 662, 12, 738, 31, 652, 17, 131], ["-", 0, 493, 0, 662, 12, 738, 31, 652, 735, 22], ["+", 0, 662, 12, 738, 31, 738, 31, 739, 0, 24], ["+", 12, 738, 31, 738, 31, 739, 0, 738, 31, 612], ["+", 12, 738, 31, 738, 31, 739, 0, 738, 17, 48], ["+", 12, 738, 31, ... | 4 | 83 |
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
int main(void) {
int N;
double average = 0;
vector<int> a;
cin >> N;
a.reserve(N);
for (int i = 0; i < N; i++) {
cin >> a[i];
average += (double)a[i];
}
average /= (double)N;
if (average - (int... | #include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
int main(void) {
int N;
double average = 0;
vector<int> a;
cin >> N;
a.reserve(N);
for (int i = 0; i < N; i++) {
cin >> a[i];
average += (double)a[i];
}
average /= (double)N;
if (average - (int... | [["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 220 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#include <stack>
#include <string.h>
#include <utility>
#include <vector>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i, n) for (i = 0; i < n; i++)
using namespace... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#include <stack>
#include <string.h>
#include <utility>
#include <vector>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i, n) for (i = 0; i < n; i++)
using namespace... | [["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 90], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339... | 1 | 179 |
def check(l, r):
th = 1 + (r - l + 1) // 2
for i in range(26):
if cnt[i] >= th:
return True
return False
s = input()
n = len(s)
si = [0] * n
for i in range(n):
si[i] = ord(s[i]) - 97
l, r = 0, 1
cnt = [0]*26
for i in range(2):
cnt[si[i]] += 1
while l < n-1 and r < n:
print... | def check(l, r):
th = 1 + (r - l + 1) // 2
for i in range(26):
if cnt[i] >= th:
return True
return False
s = input()
n = len(s)
si = [0] * n
for i in range(n):
si[i] = ord(s[i]) - 97
l, r = 0, 1
cnt = [0]*26
for i in range(2):
cnt[si[i]] += 1
while l < n-1 and r < n:
if ch... | [["-", 0, 52, 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, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 215 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
// We are Looking for a Contiguos String ( or SubString) where more than Half
// the Characters are Same If no such thing exists print -1 -1 If such Sub
// String do exists then print its starting and end positions {If more than... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
// We are Looking for a Contiguos String ( or SubString) where more than Half
// the Characters are Same If no such thing exists print -1 -1 If such Sub
// String do exists then print its starting and end positions {If more than... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 31, 16, 12, 16, 31, 2, 63, 118, 28, 22], ["+", 31, 16, 12, 16, 31, 2, 63, 118, 17, 131],... | 1 | 139 |
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0), ios::sync_with_stdio(false);
string s;
cin >> s;
int i = 1;
while (i < s.size() && s.at(i - 1) != s.at(i))
++i;
if (i == s.size()) {
i = 2;
while (i < s.size() && s.at(i - 2) != s.at(i))
++i;
if (i < s.size())
... | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0), ios::sync_with_stdio(false);
string s;
cin >> s;
int i = 1;
while (i < s.size() && s.at(i - 1) != s.at(i))
++i;
if (i == s.size()) {
i = 2;
while (i < s.size() && s.at(i - 2) != s.at(i))
++i;
if (i < s.size())
... | [["+", 0, 57, 64, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 1, 0, 16, 31, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 16, 17, 151], ["+", 0, 1, 0, 16, 12, 383, 0, 5, 0, 62], ["+", 0, 1, 0, 16, 12, 383, 0, 5, 0, 6], ["+", 0, 1, 0, 16, 12, 383, 0, 5, 0, 44], ["+", 75, 76, 0, 1, 0, 16, 12, 383, 0, 384], ["+", 64, 9, 0, 57,... | 1 | 183 |
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
// Don't have to see. start------------------------------------------
static class InputIterator {
ArrayList<String> inputLine = new ArrayList<String>(1024);
int index = 0;
int max;
String read;
InputIterator() {
... | import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
// Don't have to see. start------------------------------------------
static class InputIterator {
ArrayList<String> inputLine = new ArrayList<String>(1024);
int index = 0;
int max;
String read;
InputIterator() {
... | [["+", 8, 196, 0, 57, 15, 15, 0, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 15, 15, 0, 16, 12, 16, 31, 492, 141, 22], ["+", 0, 16, 12, 16, 31, 492, 3, 4, 0, 24], ["+", 0, 16, 12, 16, 31, 492, 3, 4, 0, 25], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 12, 499], ["... | 3 | 859 |
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
const int MAX_N = 10000;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s;
cin >> s;
cout << s << "\n";
int l ... | #pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
const int MAX_N = 10000;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s;
cin >> s;
int l = -1;
int r = -1;
... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 44], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 1, 0, 16, 31, 16, 12,... | 1 | 175 |
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
#define Max(_A, _B) (_A > _B ? _A : _B)
int n, f[5005][5005], len;
int clz = 1E9 + 7;
char ch[5005];
long long pw(long long a, int b) {
long long nw = 1;
while (b) {
if (b & 1) {
nw = nw * a % clz;
}
a = a * a % clz;
... | #include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
#define Max(_A, _B) (_A > _B ? _A : _B)
int n, f[5005][5005], len;
int clz = 1E9 + 7;
char ch[5005];
long long pw(long long a, int b) {
long long nw = 1;
while (b) {
if (b & 1) {
nw = nw * a % clz;
}
a = a * a % clz;
... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 354 |
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int L = sc.next().length();
int mod = 1_000_000_007;
long[][] dp = new long[N + 1][N + 1];
dp[0][0] = 1;
for (int i = 0; i < N; i++) {
for (int j = 0;... | import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = Integer.parseInt(sc.next());
int L = sc.next().length();
int mod = 1_000_000_007;
long[][] dp = new long[N + 1][N + 1];
dp[0][0] = 1;
for (int i = 0; i < N; i++) {
... | [["+", 8, 196, 0, 503, 49, 200, 51, 492, 500, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 0, 131], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 0, 503, 49, 200, 51, 492, 3, 4, 0, 24], ["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 49, 200, 51, 492, 3, 4, 0, 492, 141, 22], ["+", 51, 492, 3, 4, 0, 49... | 3 | 262 |
#include <cstdio>
#include <cstring>
#define clz 1000000007
#define ll long long
char s[5010];
int f[5010][5010];
int n;
long long ans;
int Max(int p, int q) { return p > q ? p : q; }
ll qsm(ll x, int k) {
ll ans = 1ll;
while (k) {
if (k & 1)
ans = ans * x % clz;
x = x * x % clz;
k >>= 1;
}
re... | #include <cstdio>
#include <cstring>
#define clz 1000000007
#define ll long long
char s[5010];
int f[5010][5010];
int n;
long long ans;
int Max(int p, int q) { return p > q ? p : q; }
ll qsm(ll x, int k) {
ll ans = 1ll;
while (k) {
if (k & 1)
ans = ans * x % clz;
x = x * x % clz;
k >>= 1;
}
re... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 321 |
#include "bits/stdc++.h"
#define ll long long
#define rep2(i, a, b) for (int i = (a); i <= (b); ++i)
#define rep(i, n) for (int i = 0; i < n; i++)
#define pii pair<int, int>
#define ti3 tuple<int, int, int>
ll int MOD = 1e9 + 7;
#define N 6000
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");
ll int... | #include "bits/stdc++.h"
#define ll long long
#define rep2(i, a, b) for (int i = (a); i <= (b); ++i)
#define rep(i, n) for (int i = 0; i < n; i++)
#define pii pair<int, int>
#define ti3 tuple<int, int, int>
ll int MOD = 1e9 + 7;
#define N 6000
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");
ll int... | [["-", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 70], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 73], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 0, 43, 49, 50, 49, 80, 49, 80, 0, 70], ["-", 0, 43, 49, 50, 49, 80, 49, 80, 81, 22], ["-", ... | 1 | 359 |
#include "bits/stdc++.h"
#include <unordered_set>
using namespace std;
#define DEBUG(x) cout << #x << ": " << x << endl;
#define DEBUG_VEC(v) \
cout << #v << ":"; \
for (int i = 0; i < v.size(); i++)... | #include "bits/stdc++.h"
#include <unordered_set>
using namespace std;
#define DEBUG(x) cout << #x << ": " << x << endl;
#define DEBUG_VEC(v) \
cout << #v << ":"; \
for (int i = 0; i < v.size(); i++)... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 8, 9, 0, 7, 8, 9, 0, 7, 0, 25], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24... | 1 | 506 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#define cmax(a, b) (a < (b) ? a = (b), 1 : 0)
#define cmin(a, b) (a > (b) ? a = (b), 1 : 0)
#define dmin(a, b) ((a) < (b) ? (a) : (b))
#define dmax(a, b) ((a) > (b) ? (a) : (b))
#define CL fclose(stdin), fclos... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#define cmax(a, b) (a < (b) ? a = (b), 1 : 0)
#define cmin(a, b) (a > (b) ? a = (b), 1 : 0)
#define dmin(a, b) ((a) < (b) ? (a) : (b))
#define dmax(a, b) ((a) > (b) ? (a) : (b))
#define CL fclose(stdin), fclos... | [["+", 0, 34, 31, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 34, 31, 11, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 1, 0, 34, 31, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 34, 31, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 34, 0, 21], ["+", 0, 34, 12, 11, 31, 69, 28, 69, 28, 22], ["+", 12, 11, 31, 69, 28, 69, 341, 342, 0, 70], ["+", 1... | 1 | 683 |
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;
t... | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;
t... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, ... | 1 | 750 |
#include <bits/stdc++.h>
using namespace std;
void solve(std::string s) {
for (int i = 0; i < s.size() - 3; i++) {
if (s[i] == s[i + 1]) {
cout << i + 1 << " " << i + 2 << endl;
return;
}
if (s[i] == s[i + 2]) {
cout << i + 1 << " " << i + 3 << endl;
return;
}
}
cout << -1... | #include <bits/stdc++.h>
using namespace std;
void solve(std::string s) {
for (int i = 0; i < s.size() - 1; i++) {
if (s[i] == s[i + 1]) {
cout << i + 1 << " " << i + 2 << endl;
return;
}
}
for (int i = 0; i < s.size() - 2; i++) {
if (s[i] == s[i + 2]) {
cout << i + 1 << " " << i + ... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49... | 1 | 146 |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
#include "LOCAL_DEBUG.hpp"
#endif
#define int long long
signed main() {
string s;
cin >> s;
for (int i = 0; i < s.size() - 2; i++) {
string t = s.substr(i, 3);
if (t[0] == t[1]) {
cout << i + 1 << " " << i + 2 << endl;
return ... | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
#include "LOCAL_DEBUG.hpp"
#endif
#define int long long
signed main() {
string s;
cin >> s;
for (int i = 0; i < s.size() - 1; i++) {
string t = s.substr(i, 3);
if (t[0] == t[1]) {
cout << i + 1 << " " << i + 2 << endl;
return ... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 51, 16, 31, 16, 31, 2, 63, 118, 28, 22], ["+", 51, 16, 31, 16, 31, 2, 63, 118, 17, 131], ["+", 51, 16, 31, 16, 31, 2, 63, 118, 119, 120], ["+", 51, 16, 31, 16, 31, 2, 3, 4, 0, 25], ["+"... | 1 | 140 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string S;
int main() {
cin >> S;
bool f = false;
for (int i = 0; i < S.length() - 2; i++) {
if (S[i] == S[i + 1]) {
f = true;
cout << i + 1 << " " << i + 2 << endl;
break;
} else if (S[i] == S[i + 2]) {
f = true... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string S;
int main() {
cin >> S;
bool f = false;
for (int i = 0; i < S.length() - 1; i++) {
if (S[i] == S[i + 1]) {
f = true;
cout << i + 1 << " " << i + 2 << endl;
break;
} else if (i < S.length() - 2 && S[i] == S[i ... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 31, 16, 12, 16, 31, 2, 63, 118, 28, 22], ["+", 31, 16, 12, 16, 31, 2, 63, 118, 17, 131],... | 1 | 148 |
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
int l = -1, r = -1;
for (int i = 0; i < s.length() - 1; i++) {
if (s.at(i) == s.at(i + 1)) {
l = i + 1;
r = i + 2;
break;
} else if (s.at(i) == s.at(i + 2)) {
l = i + 1;
r = i + 3;... | #include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
int l = -1, r = -1;
for (int i = 0; i < s.length() - 1; i++) {
if (s.at(i) == s.at(i + 1)) {
l = i + 1;
r = i + 2;
break;
}
}
for (int i = 0; i < s.length() - 2; i++) {
if (s.at(i) ==... | [["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 7, 10, 43, 49, 50... | 1 | 133 |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char const *argv[]) {
int i, j, length, cnt;
char lead;
char str[100001];
scanf("%s", str);
// printf("%s %lu", str, strlen(str));
for (i = 0; i < strlen(str) - 2; i++) {
if (str[i] == str[i + 1]) {
pr... | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char const *argv[]) {
int i, j, length, cnt;
char lead;
char str[100001];
scanf("%s", str);
// printf("%s %lu", str, strlen(str));
for (i = 0; i < strlen(str) - 2; i++) {
if (str[i] == str[i + 1]) {
pr... | [["+", 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, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33]] | 0 | 198 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
// 코틀린 ,문자열 알고리즘 보기, 앳코더, (시간되면 코드포스까지)
ios_base::sync_with_stdio(false);
cin.tie(NULL); // 9 90 900
string s;
cin >> s;
for (int i = 0; i < s.size() - 1; i++) {
if (s[i] == s[i + 1]) {
cout << i + 1 << ' ' << i + 2 ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
// 코틀린 ,문자열 알고리즘 보기, 앳코더, (시간되면 코드포스까지)
ios_base::sync_with_stdio(false);
cin.tie(NULL); // 9 90 900
string s;
cin >> s;
for (int i = 0; i < s.size() - 1; i++) {
if (s[i] == s[i + 1]) {
cout << i + 1 << ' ' << i + 2 ... | [["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13], ["-", 75, 76, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 75, 76, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 75, 76, 0, 57, 64, 9, 0, 37, 0, 13], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["+", 0, 16, 31, 16, ... | 1 | 145 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define f first
#define s second
#define all(container) container.begin(), container.end()
#define fast \
ios::sync_with_stdio(0); ... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define f first
#define s second
#define all(container) container.begin(), container.end()
#define fast \
ios::sync_with_stdio(0); ... | [["+", 0, 1, 0, 16, 31, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 31, 16, 17, 151], ["+", 0, 1, 0, 16, 31, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9,... | 1 | 156 |
#include <bits/stdc++.h>
using namespace std;
#define OnlineJudge1
#define loop(x, a, n) for (int x = a; x < n; x++)
#define NumofDigits(n) ((int)log10(n) + 1)
#define CountofNumber(array, n, x) \
(upper_bound(array, array + n, x) - lower_bound(array, array + n, x))
#defi... | #include <bits/stdc++.h>
using namespace std;
#define OnlineJudge1
#define loop(x, a, n) for (int x = a; x < n; x++)
#define NumofDigits(n) ((int)log10(n) + 1)
#define CountofNumber(array, n, x) \
(upper_bound(array, array + n, x) - lower_bound(array, array + n, x))
#defi... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 17, 72], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18... | 1 | 285 |
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main(int argc, const char *argv[]) {
string s;
cin >> s;
for (int i = 0; i < s.size... | #include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main(int argc, const char *argv[]) {
string s;
cin >> s;
if (s.size() < 2) {
co... | [["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25],... | 1 | 173 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 1; i <= (n); i++)
#define rep0(i, n) for (int i = 0; i < (n); i++)
const ll INF = 1e9 + 7;
int main() {
/*freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);*/
string s;
cin >> s;
rep0(i, s.size... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 1; i <= (n); i++)
#define rep0(i, n) for (int i = 0; i < (n); i++)
const ll INF = 1e9 + 7;
int main() {
/*freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);*/
string s;
cin >> s;
int l = s.size... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35... | 1 | 141 |
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
typedef char SINT8;
typedef unsigned char UINT8;
typedef short SINT16;
typedef unsigned short UINT16;
typedef int SINT32;
typedef unsigned int ... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
typedef char SINT8;
typedef unsigned char UINT8;
typedef short SINT16;
typedef unsigned short UINT16;
typedef int SINT32;
typedef unsigned int ... | [["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 57, 64, ... | 1 | 456 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
for (int i = 0; i < s.size() - 1; i++) {
if (s[i] == s[i + 1]) {
cout << i + 1 << " " << i + 2 << "\n";
return 0;
}
// Yes,it is Shi Ze Xu's R.I.P
}
for (int i = 0; i < s.size() - 2; i++) {
if (s[i] == s... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
for (int i = 0; i < (int)s.size() - 1; i++) {
if (s[i] == s[i + 1]) {
cout << i + 1 << " " << i + 2 << "\n";
return 0;
}
}
for (int i = 0; i < (int)s.size() - 2; i++) {
if (s[i] == s[i + 2]) {
cout << ... | [["+", 0, 7, 15, 16, 12, 16, 31, 74, 0, 24], ["+", 15, 16, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 7, 15, 16, 12, 16, 31, 74, 0, 25], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13]] | 1 | 147 |
#アンバランスな文字列からアンバランスでない文字列を取り除くと、
#アンバランスな文字列が残るはず。ということは、両側から文字を削り取ることで「どの部分列をとってもアンバランスな文字列」が存在するはず
#すなわちそれは、両側に「ax」が存在しない文字列で、「axa」または「aa...aa」
#aaがある時点でアンバランス確定なので「axa」「aa」のどちらかを探せばよし
import re
s=input()
alphabet="abcdefghijklmnopqrstuvwxyz"
for i in alphabet:
ba=s.find(i+i)
if ba!=-1:
print(str(ba+1... | #アンバランスな文字列からアンバランスでない文字列を取り除くと、
#アンバランスな文字列が残るはず。ということは、両側から文字を削り取ることで「どの部分列をとってもアンバランスな文字列」が存在するはず
#すなわちそれは、両側に「ax」が存在しない文字列で、「axa」または「aa...aa」
#aaがある時点でアンバランス確定なので「axa」「aa」のどちらかを探せばよし
import re
s=input()
alphabet="abcdefghijklmnopqrstuvwxyz"
for i in alphabet:
ba=s.find(i+i)
if ba!=-1:
print(str(ba+1... | [["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 6], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 655], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["... | 5 | 113 |
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <stack>
using namespace std;
int n;
int main() {
string s;
cin >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] == s[i + 2]) {
cout << i + 1 << " " << i + 3 << endl;
return 0;
}
if (s[i] == s[i + 1]) {
cout << i ... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <stack>
using namespace std;
int n;
int main() {
string s;
cin >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] == s[i + 2]) {
cout << i + 1 << " " << i + 3 << endl;
return 0;
}
if (s[i] == s[i + 1]) {
cout << i ... | [["+", 0, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 17, 151], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 31, 16, 17, 151], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+",... | 1 | 121 |
#include <algorithm>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;
pai... | #include <algorithm>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;
pai... | [["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 1, 0, 11, 12, 2, 63, 22], ["-", 64, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 64, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["-", 64, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["-", 0, 11, 12, 2, 3, 4, 0... | 1 | 298 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <vector>
//#include<bits/stdc++.h>
using namespace std;
#define ok1 printf("ok1\n");
#define ... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <vector>
//#include<bits/stdc++.h>
using namespace std;
#define ok1 printf("ok1\n");
#define ... | [["+", 31, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 31, 2, 63, 22], ["-", 0, 16, 31, 16, 31, 2, 3, 4, 0, 24], ["-", 0, 16, 31, 16, 31, 2, 3, 4, 0, 22], ["-", 0, 1... | 1 | 722 |
// file_name:ABC43_D.cpp
#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()
#... | // file_name:ABC43_D.cpp
#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()
#... | [["-", 31, 16, 31, 16, 31, 16, 12, 69, 28, 22], ["-", 31, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["-", 31, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["-", 0, 16, 31, 16, 12, 69, 341, 342,... | 1 | 669 |
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#define ll long long int
#define pb push_back
#define mk make... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#define ll long long int
#define pb push_back
#define mk make... | [["+", 63, 118, 28, 69, 341, 342, 0, 2, 63, 40], ["+", 28, 69, 341, 342, 0, 2, 3, 4, 0, 24], ["+", 28, 69, 341, 342, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["-", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 8, ... | 1 | 403 |
#include <iostream>
using namespace std;
int main() {
string s;
cin >> s;
for (int i = 0; i <= s.length() - 3; i++) {
if (s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2]) {
cout << i + 1 << " " << i + 3 << endl;
return 0;
}
}
if (s[s.length() - 1] == s[s.length() - 2]) {
... | #include <iostream>
using namespace std;
int main() {
string s;
cin >> s;
for (int i = 0; i <= (signed)s.length() - 3; i++) {
if (s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2]) {
cout << i + 1 << " " << i + 3 << endl;
return 0;
}
}
if (s.length() >= 2) {
if (s[s.length... | [["+", 0, 7, 15, 16, 12, 16, 31, 74, 0, 24], ["+", 12, 16, 31, 74, 39, 77, 39, 86, 0, 156], ["+", 0, 7, 15, 16, 12, 16, 31, 74, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["... | 1 | 159 |
#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, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151]] | 1 | 274 |
#include <stdio.h>
char ch[100001];
int a, b;
int main(void) {
int i;
scanf("%s", ch);
if (ch[2])
a = b = -1;
else
a = -1 + (b = 2);
for (i = 2; ch[i]; ++i) {
if (ch[i - 2] != ch[i - 1] && ch[i - 1] != ch[i] && ch[i - 2] != ch[i])
continue;
a = i - 1;
b = i + 1;
break;
}
p... | #include <stdio.h>
char ch[100001];
int a, b;
int main(void) {
int i;
scanf("%s", ch);
if (ch[2] || ch[0] != ch[1])
a = b = -1;
else
a = -1 + (b = 2);
for (i = 2; ch[i]; ++i) {
if (ch[i - 2] != ch[i - 1] && ch[i - 1] != ch[i] && ch[i - 2] != ch[i])
continue;
a = i - 1;
b = i + 1;
... | [["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 106], ["+", 15, 23, 0, 16, 12, 16, 31, 69, 28, 22], ["+", 15, 23, 0, 16, 12, 16, 31, 69, 0, 70], ["+", 15, 23, 0, 16, 12, 16, 31, 69, 71, 13], ["+", 15, 23, 0, 16, 12, 16, 31, 69, 0, 73], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 79], ["+", 15, 23, 0, 16, 12, 16, 12, 69, 28, 22], ["... | 0 | 143 |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
string s;
cin >> s;
for (int i = 0; i < s.size() - 2; i++) {
if (s[i] == s[i + 1]) {
cout << i + 1 << " " << i + 2;
return 0;
} else if (s[i] == s[i + 2]) {
cout << i + 1 << " " << i + 3;
return 0;
... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
string s;
cin >> s;
for (int i = 0; i < s.size() - 1; i++) {
if (s[i] == s[i + 1]) {
cout << i + 1 << " " << i + 2;
return 0;
}
if (s[i] == s[i + 2] && i < s.size() - 2) {
cout << i + 1 << " " << i + 3;
... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 12, 16, 12, 16, 31, 2, 63, 118, 28, 22], ["+", ... | 1 | 120 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
int main() {
string s;
cin >> s;
for (int i = 0; i < s.size() - 1; i++)... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
int main() {
string s;
cin >> s;
for (int i = 0; i < s.size() - 1; i++)... | [["+", 31, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 72], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 180 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
string s;
cin >> s;
if (s.length() == 2) {
if (s[0] == s[1])
cout << "1 2" << endl... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
string s;
cin >> s;
if (s.length() == 2) {
if (s[0] == s[1])
cout << "1 2" << endl... | [["+", 0, 57, 64, 9, 0, 57, 75, 76, 0, 95], ["+", 75, 76, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 75, 76, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 57, 75, 76, 0, 1, 0, 16, 17, 151], ["+", 0, 57, 75, 76, 0, 1, 0, 16, 12, 22], ["+", 64, 9, 0, 5... | 1 | 201 |
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
int x = -1, y = -1;
for (int i = 1; s[i] != '\0'; i++) {
if (s[i] == s[i - 1]) {
x = i - 1;
y = i;
cout << x + 1 << y + 1 << endl;
return 0;
}
}
for (int i = 0; i < s.length() - 2; i... | #include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
int x = -1, y = -1;
for (int i = 1; s[i] != '\0'; i++) {
if (s[i] == s[i - 1]) {
x = i - 1;
y = i;
cout << x + 1 << " " << y + 1 << endl;
return 0;
}
}
for (int i = 0; i < s.length()... | [["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 1, 0, 16, 31, 16, 31, 16, 17, 151]] | 1 | 170 |
s=input()
n=len(s)
# アルファベット(a〜z)→数値(1〜26)小文字限定
a2n = lambda c: ord(c) - ord('a') + 1
# 数値(1〜26)→アルファベット(a〜z)
n2a = lambda c: chr(c+64).lower()
d={}
d_={}
for i in range(1,27):
d[n2a(i)]=[0]
d_[n2a(i)]=0
for i in range(n):
d_[s[i]]+=1
for j in range(1,27):
d[n2a(j)].append(2*d_[n2a(j)]-(i+1))
def func(l):
... | s=input()
n=len(s)
n2a = lambda c: chr(c+64).lower()
d={}
d_={}
for i in range(1,27):
d[n2a(i)]=[0]
d_[n2a(i)]=0
for i in range(n):
d_[s[i]]+=1
for j in range(1,27):
d[n2a(j)].append(2*d_[n2a(j)]-(i+1))
def func(l):
mina=[0,0]
for k in range(2,n+1):
if mina[0]<l[k]:
return [mina[1]+1,k]
el... | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 0, 656, 0, 1, 0, 662, 12, 670, 0, 670], ["-", 0, 1, 0, 662, 12, 670, 54, 711, 0, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 670, 0, 102], ["-", 12, 670, 8, 657, 31, 657, 31, 652, 63, 22], ["-", 8, 657, 31, 657, 31, 652, 3, 4, 0, 2... | 5 | 272 |
#include "bits/stdc++.h"
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<VVLL> VVVLL;
typedef pair<LL, L... | #include "bits/stdc++.h"
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<VVLL> VVVLL;
typedef pair<LL, L... | [["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 1,269 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string str;
cin >> str;
for (int i = 0; i < str.length() - 1; i++) {
if (str[i] == str[i + 1]) {
cout << i + 1 << " " << i + 2;
return 0;
}
if (i + 2 >= str.length())
continue;
if (str[i] == str[i + 2]) {
c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string str;
cin >> str;
for (int i = 0; i < str.length() - 1; i++) {
if (str[i] == str[i + 1]) {
cout << i + 1 << " " << i + 2 << "\n";
return 0;
}
if (i + 2 >= str.length())
continue;
if (str[i] == str[i + 2]) {
... | [["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 44], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 12, 5, ... | 1 | 124 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
temp... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
temp... | [["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], [... | 1 | 363 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
while (cin >> s) {
int n = s.size();
int flag = 0;
for (int i = 0; i < n - 2; i++) {
if (s[i] == s[i + 1]) {
cout << i + 1 << " " << i + 2 << "\n";
flag = 1;
break;
}
if (s[i] == s[i + 2]) {
... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
while (cin >> s) {
int n = s.size();
int flag = 0;
for (int i = 0; i < n; i++) {
if (s[i] == s[i + 1] && i + 1 < n) {
cout << i + 1 << " " << i + 2 << "\n";
flag = 1;
break;
}
if (s[i] == s[i ... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 31, 22], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 17, 72], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18... | 1 | 157 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
for (long unsigned int i = 0; i < s.length() - 2; i++) {
if (s[i] == s[i + 1]) {
cout << "\(" << i + 1 << "\) \(" << i + 2 << "\)";
return 0;
}
if (s[i] == s[i + 2]) {
cout << "\(" << i + 1 << "\) \(" <... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
for (long unsigned int i = 0; i < s.length() - 2; i++) {
if (s[i] == s[i + 1]) {
cout << i + 1 << " " << i + 2;
return 0;
}
if (s[i] == s[i + 2]) {
cout << i + 1 << " " << i + 3;
return 0;
}
... | [["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 44], ["-", 0, 16, 31, 16, 31, 16, 31, 16, 17, 151], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 44], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 44], ["-", 31, 16,... | 1 | 197 |
#include <bits/stdc++.h>
using namespace std;
#define fio \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#define pb push_b... | #include <bits/stdc++.h>
using namespace std;
#define fio \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#define pb push_b... | [["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["-", 8, 9, 0, 43, 39, 344, 3, 347, 0, 18], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 8, 9, 0, 43, 39, 344, 3, 347, 0, 47], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 15, 339, 51, 16, 12, 16, 31, 69, 28, 22], ["+", 15,... | 1 | 262 |
<?php
while ($stdin = fgets(STDIN)) {
$line[] = trim($stdin);
}
foreach ($line as $key => $value) {
$data[] = explode(' ', $value);
}
//foreach ($data as &$line) {
// $line = array_map(function($val) { return (int)$val; }, $line);
//}
$s = $data[0][0];
$length = strlen($s);
$unbalance = false;
$unbalanc... | <?php
while ($stdin = fgets(STDIN)) {
$line[] = trim($stdin);
}
foreach ($line as $key => $value) {
$data[] = explode(' ', $value);
}
//foreach ($data as &$line) {
// $line = array_map(function($val) { return (int)$val; }, $line);
//}
$s = $data[0][0];
$length = strlen($s);
$unbalance = false;
$unbalanc... | [["+", 0, 11, 12, 227, 0, 618, 0, 16, 17, 72], ["+", 0, 11, 12, 227, 0, 618, 0, 16, 12, 612], ["-", 0, 11, 12, 227, 0, 618, 0, 16, 12, 612], ["-", 0, 9, 0, 57, 15, 23, 0, 16, 17, 106], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 565]] | 6 | 311 |
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
const long MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;
int main() {
string s;
cin >> s;
int a, b;
a = b = -2;
for (int i = 0; i < s.length() - 2; i++) {
if (s[i] == s[i + 1]) {
a ... | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
const long MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;
int main() {
string s;
cin >> s;
int a, b;
a = b = -2;
for (int i = 0; i < s.length() - 1; i++) {
if (s[i] == s[i + 1]) {
a ... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 31, 22], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 17, 72], ["+", ... | 1 | 149 |
s = input()
for i in range(len(s) - 1):
if s[i] == s[i + 1]:
print(i + 1, i + 2)
break
if i < len(s) - 2 and s[i] == s[i + 2]:
print(i + 1, i + 3)
break
| s = input()
for i in range(len(s) - 1):
if s[i] == s[i + 1]:
print(i + 1, i + 2)
break
if i < len(s) - 2 and s[i] == s[i + 2]:
print(i + 1, i + 3)
break
else:
print(-1, -1)
| [["+", 36, 36, 0, 656, 0, 7, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 7, 75, 76, 0, 102], ["+", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 8, 196, ... | 5 | 75 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
map<char, vector<int>> dist;
for (int i = 0; i < s.size(); i++) {
dist[s.at(i)].push_back(i);
}
/*ここからアンバランス探しmapにはアルファベットと出現箇所が紐づけ
各アルファベットについて、隣り合ってたらok
*/
for (auto &a : dist) {
if (a.second.size() > 1) {
fo... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
map<char, vector<int>> dist;
for (int i = 0; i < s.size(); i++) {
dist[s.at(i)].push_back(i);
}
/*ここからアンバランス探しmapにはアルファベットと出現箇所が紐づけ
各アルファベットについて、隣り合ってたらok
*/
bool seikai = false;
for (auto &a : dist) {
if (a.second... | [["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 147], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 16, 31, 16, 31, 16, 12, 16, 12, 13], ["+", 64, 9, 0,... | 1 | 189 |
a=input()
t=-1
flag="False"
for i in range(n-1):
if a[i]==a[i+1]:
flag="True1"
t=i
break
if i!=n-2:
if a[i]==a[i+2]:
flag="True2"
t=i
break
if flag=="False":
print("{} {}".format(-1,-1))
elif flag=="True1":
print("{} {}".format(t+1,t+2))
else flag=="True2":
print("{} {}".form... | a=input()
t=-1
flag="False"
for i in range(len(a)-1):
if a[i]==a[i+1]:
flag="True1"
t=i
break
if i!=len(a)-2:
if a[i]==a[i+2]:
flag="True2"
t=i
break
if flag=="False":
print("{} {}".format(-1,-1))
elif flag=="True1":
print("{} {}".format(t+1,t+2))
else:
print("{} {}".format(t... | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 0, 57, 15, 666, 0, 657, 31, 652, 63, 22], ["+"... | 5 | 145 |
#include <bits/stdc++.h>
#define long long long
//#include <ext/numeric>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including
//tree_order_statistics_node_update
#define oo 0x3f3f3f3f
//#define OO 0x3f3f3f3f3f3f3f3f
//#define popcount(n) __builtin_popcount(n)
//#... | #include <bits/stdc++.h>
#define long long long
//#include <ext/numeric>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including
//tree_order_statistics_node_update
#define oo 0x3f3f3f3f
//#define OO 0x3f3f3f3f3f3f3f3f
//#define popcount(n) __builtin_popcount(n)
//#... | [["+", 0, 16, 31, 16, 31, 16, 12, 103, 0, 125], ["+", 0, 16, 31, 16, 31, 16, 12, 103, 0, 104], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 12, 103, 0, 104]] | 1 | 219 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.