buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define mp make_pair #define fastio() \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define mp make_pair #define fastio() \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
80
t,d,s = map(int,input().split()) x = t//s if x<=d: print('Yes') else: print('No')
t,d,s = map(int,input().split()) x = t/s if x<=d: print('Yes') else: print('No')
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 676], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 85]]
5
42
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int d, t, s; cin >> d >> t >> s; if (d / s <= t) { cout << "Yes\n"; } else { cout << "No\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int d, t, s; cin >> d >> t >> s; if (d <= t * s) { cout << "Yes\n"; } else { cout << "No\n"; } return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 85], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 48], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
78
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, j, n) for (int i = j; i < (int)(n); i++) #define brep(i, n) for (int i = n; i > 0; i--) #define BREP(i, j, n) for (int i = n; i > j; i--) #define TEST cout << "PASS" << endl #define all(x) (x).begin(), (x)....
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, j, n) for (int i = j; i < (int)(n); i++) #define brep(i, n) for (int i = n; i > 0; i--) #define BREP(i, j, n) for (int i = n; i > j; i--) #define TEST cout << "PASS" << endl #define all(x) (x).begin(), (x)....
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
146
a,b,c = map(int, input().split()) if(b*c<=a): print("Yes") else: print("No")
a,b,c = map(int, input().split()) if(b*c>=a): print("Yes") else: print("No")
[["-", 0, 656, 0, 57, 15, 23, 0, 666, 667, 19], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 667, 20]]
5
41
D, T, S = map(int, input().split()) if S*T < T: print("Yes") else: print("No")
D, T, S = map(int, input().split()) if S*T >= D: print("Yes") else: print("No")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
39
#include <bits/stdc++.h> int main() { int D, T, S; std::cin >> D >> T >> S; if (T * S < D) { std::cout << "NO" << std::endl; } else { std::cout << "YES" << std::endl; } }
#include <bits/stdc++.h> int main() { int D, T, S; std::cin >> D >> T >> S; if (T * S < D) { std::cout << "No" << std::endl; } else { std::cout << "Yes" << std::endl; } }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
62
// _ // ___ _ __ ___ (_) __ ___ ___ _ _ __ ___ _ __ // / __| '_ ` _ \| |/ _` \ \ /\ / / | | | '_ ` _ \| '_ \ // \__ \ | | | | | | (_| |\ V V /| |_| | | | | | | |_) | // |___/_| |_| |_|_|\__, | \_/\_/ \__,_|_| |_| |_| .__/ // |___/ |_| // code by smigwu...
// _ // ___ _ __ ___ (_) __ ___ ___ _ _ __ ___ _ __ // / __| '_ ` _ \| |/ _` \ \ /\ / / | | | '_ ` _ \| '_ \ // \__ \ | | | | | | (_| |\ V V /| |_| | | | | | | |_) | // |___/_| |_| |_|_|\__, | \_/\_/ \__,_|_| |_| |_| .__/ // |___/ |_| // code by smigwu...
[["-", 64, 9, 0, 1, 0, 16, 12, 103, 0, 104], ["-", 64, 9, 0, 1, 0, 16, 12, 103, 0, 125], ["-", 0, 1, 0, 16, 12, 103, 0, 42, 0, 22], ["-", 0, 1, 0, 16, 12, 103, 0, 42, 0, 42], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 44]]
1
148
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long int ll; typedef long double ld; #define llset \ tree<ll, null_type, less<ll>, rb...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long int ll; typedef long double ld; #define llset \ tree<ll, null_type, less<ll>, rb...
[["-", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
367
import sys D,T,S = [int(i) for i in sys.stdin.readline()] if(S*T>=D): print("Yes") else: print("No")
import sys D,T,S = [int(i) for i in sys.stdin.readline().split()] if(S*T>=D): print("Yes") else: print("No")
[["+", 12, 658, 0, 659, 12, 652, 63, 319, 0, 131], ["+", 12, 658, 0, 659, 12, 652, 63, 319, 319, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 24], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 25]]
5
47
#include <bits/stdc++.h> #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) using namespace std; using ll = lo...
#include <bits/stdc++.h> #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) using namespace std; using ll = lo...
[["-", 12, 23, 0, 41, 15, 23, 0, 16, 17, 19], ["+", 12, 23, 0, 41, 15, 23, 0, 16, 17, 20]]
1
66
#include <bits/stdc++.h> using namespace std; //#pragma gcc optimize("O3,unroll-loop") //#pragma gcc //target("sse,sse2,sse3,ssse3,sse4,avx,avx2,fma,abm,mmx,popcnt,tune=native") //#define int long long //#define double long double signed main() { ios_base::sync_with_stdio(false); cin.tie(0); int d, t, s; cin...
#include <bits/stdc++.h> using namespace std; //#pragma gcc optimize("O3,unroll-loop") //#pragma gcc //target("sse,sse2,sse3,ssse3,sse4,avx,avx2,fma,abm,mmx,popcnt,tune=native") //#define int long long //#define double long double signed main() { ios_base::sync_with_stdio(false); cin.tie(0); int d, t, s; cin...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
82
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int d, t, s; cin >> d >> t >> s; if (s * t == d) cout << "Yes\n"; else cout << "No\n"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int d, t, s; cin >> d >> t >> s; if (s * t >= d) cout << "Yes\n"; else cout << "No\n"; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
67
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> #define rep(i, a, b) for (int i = (a); i < (b); i++) #define ill long long #define fcout cout << fixed << setprecision(10) using namespace std; int main() { int d, t, s; cin >> d >> t >> s; if (s * t ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> #define rep(i, a, b) for (int i = (a); i < (b); i++) #define ill long long #define fcout cout << fixed << setprecision(10) using namespace std; int main() { int d, t, s; cin >> d >> t >> s; if (s * t ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
76
A,B,C=map(int,input().split()) if A-B*C>=0: print("Yes") else: print("No")
A,B,C=map(int,input().split()) if B*C-A>=0: print("Yes") else: print("No")
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 22]]
5
41
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int d, t, s; cin >> d >> t >> d; if (d <= s * t) cout << "Yes"; else cout << "No"; }
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int d, t, s; cin >> d >> t >> s; if (d <= s * t) cout << "Yes"; else cout << "No"; }
[["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
51
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define pii pair<int, int> #define pll pair<ll int, ll int> #define ff first #define ss second #define debug(n) cout << "DEBUG1 " << n << "\n"; #define debug2(n, m) cout << "DEBUG2 " << n << ' ' << m << "\n"; #define debug3(n, m, x) cout << "D...
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define pii pair<int, int> #define pll pair<ll int, ll int> #define ff first #define ss second #define debug(n) cout << "DEBUG1 " << n << "\n"; #define debug2(n, m) cout << "DEBUG2 " << n << ' ' << m << "\n"; #define debug3(n, m, x) cout << "D...
[["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
211
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define pii pair<int, int> #define pp pair<pair<ll, ll>, pair<ll, ll>> #define pll pair<ll, ll> #define ppll pair<ll, pll> #define pdd pair<double, double> #define vii vector<int> #define vll vector<ll> #define mat vector<vector<ll>> #define l...
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define pii pair<int, int> #define pp pair<pair<ll, ll>, pair<ll, ll>> #define pll pair<ll, ll> #define ppll pair<ll, pll> #define pdd pair<double, double> #define vii vector<int> #define vll vector<ll> #define mat vector<vector<ll>> #define l...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
394
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int ans = t.length(); for (int i = 0; i < s.length() - t.length(); i++) { int diff = 0; for (int j = 0; j < t.length(); j++) { if (s[i + j] != t[j]) diff++; } ans = min(ans, diff); } cout <...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int ans = t.length(); for (int i = 0; i <= s.length() - t.length(); i++) { int diff = 0; for (int j = 0; j < t.length(); j++) { if (s[i + j] != t[j]) diff++; } ans = min(ans, diff); } cout ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
116
#!/usr/bin/env python3 # Generated by https://github.com/kyuridenamida/atcoder-tools from typing import * import collections import functools as fts import itertools as its import math import sys INF = float('inf') def solve(S: str, T: str): return len(T) - max(sum(s == t for s, t in zip(S[i:], T)) for i in rang...
#!/usr/bin/env python3 # Generated by https://github.com/kyuridenamida/atcoder-tools from typing import * import collections import functools as fts import itertools as its import math import sys INF = float('inf') def solve(S: str, T: str): return len(T) - max(sum(s == t for s, t in zip(S[i:], T)) for i in rang...
[["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]]
5
163
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; string a = "abcdefghijklmnopqrstuvwxyz"; int i, j, ans = 0, ii, ij, c = 0; for (i = 0; i <= s.length() - t.length(); i++) { for (j = 0; j < t.length(); j++) { ii = i; // ij=j; if (s[ii++] == t[j]) ...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; string a = "abcdefghijklmnopqrstuvwxyz"; int i, j, ans = 0, ii, ij, c = 0; for (i = 0; i <= s.length() - t.length(); i++) { for (j = 0; j < t.length(); j++) { ii = i; // ij=j; if (s[i + j] == t[j]) ...
[["-", 51, 16, 31, 69, 341, 342, 0, 27, 28, 22], ["-", 51, 16, 31, 69, 341, 342, 0, 27, 17, 29], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 31, 22], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 12, 22]]
1
140
s = input() t = input() max_count = 0 for i in range(len(s) - len(t)): count = 0 for j in range(len(t)): if t[j] == s[i + j]: count += 1 if max_count < count: max_count = count print(len(t) - max_count)
s = input() t = input() max_count = 0 for i in range(len(s) - len(t) + 1): count = 0 for j in range(len(t)): if t[j] == s[i + j]: count += 1 if max_count < count: max_count = count print(len(t) - max_count)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
76
import sys read = sys.stdin.read readlines = sys.stdin.readlines def main(): s = input() t = input() if t in s: print(0) sys.exit() if len(s) == 1 and len(t) == 1: if t != s: print(1) sys.exit() lens = len(s) lent = len(t) res = set() for i...
import sys read = sys.stdin.read readlines = sys.stdin.readlines def main(): s = input() t = input() if t in s: print(0) sys.exit() if len(s) == 1 and len(t) == 1: if t != s: print(1) sys.exit() lens = len(s) lent = len(t) res = set() for i...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
166
s = input("") t = input("") cnt = 0 ans = 10000 for i in range(len(s)-len(t)+1): S = s[i:i+len(t)] for j in range(len(t)): if S[j] != t[j]: cnt += 1 ans = min(ans,cnt) print(ans)
s = input("") t = input("") ans = 10000 for i in range(len(s)-len(t)+1): cnt = 0 S = s[i:i+len(t)] for j in range(len(t)): if S[j] != t[j]: cnt += 1 ans = min(ans,cnt) print(ans)
[["-", 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], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612]]
5
88
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int ans = s.size(); for (int i = 0; i < s.size() - t.size(); i++) { int cnt = 0; for (int j = 0; j < t.size(); j++) { if (s[i + j] != t[j]) cnt++; } ans = min(cnt, ans); } cout << ans << endl...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int ans = s.size(); for (int i = 0; i <= s.size() - t.size(); i++) { int cnt = 0; for (int j = 0; j < t.size(); j++) { if (s[i + j] != t[j]) cnt++; } ans = min(cnt, ans); } cout << ans << end...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
115
#include <iomanip> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <numeric> using namespace std; typedef long long ll; const long double PI = (acos(-1)); const long long MOD = 1000000007; static const int MAX_INT = std::numeric_limits<int>::max(); static const ...
#include <iomanip> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <numeric> using namespace std; typedef long long ll; const long double PI = (acos(-1)); const long long MOD = 1000000007; static const int MAX_INT = std::numeric_limits<int>::max(); static const ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
341
#define _USE_MATH_DEFINES #include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long LL; typedef vector<int> VI; typedef vector<double> VD; t...
#define _USE_MATH_DEFINES #include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long LL; typedef vector<int> VI; typedef vector<double> VD; t...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
583
#pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #define FAST_IO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #define FAST_IO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
176
#include <algorithm> #include <iostream> #include <math.h> #include <vector> #define rep(i, N) for (int i = 0; i < N; i++) using namespace std; int main() { string S, T; cin >> S >> T; int min = 2000; rep(i, S.size() - T.size()) { int cnt = 0; rep(j, T.size()) { if (S[i + j] == T[j]) { co...
#include <algorithm> #include <iostream> #include <math.h> #include <vector> #define rep(i, N) for (int i = 0; i < N; i++) using namespace std; int main() { string S, T; cin >> S >> T; int min = 2000; rep(i, S.size() - T.size() + 1) { int cnt = 0; rep(j, T.size()) { if (S[i + j] == T[j]) { ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
121
s=input() t=input() ans=int(len(s)) for i in range(len(s)-len(t)): now=int(0) for j in range(len(t)): if s[i+j]!=t[j]: now+=1 ans=min(now,ans) print(ans)
s=input() t=input() ans=int(len(s)) for i in range(len(s)-len(t)+1): now=int(0) for j in range(len(t)): if s[i+j]!=t[j]: now+=1 ans=min(now,ans) print(ans)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
80
#include "bits/stdc++.h" using namespace std; int dist(string a, string b) { int s = 0; for (int i = 0; i < a.length(); i++) s += (a[i] != b[i]); return s; } int main() { string a, b; cin >> a >> b; int m = 100000000; for (int i = 0; i + b.length() < a.length(); i++) { m = min(m, dist(b, a.subst...
#include "bits/stdc++.h" using namespace std; int dist(string a, string b) { int s = 0; for (int i = 0; i < a.length(); i++) s += (a[i] != b[i]); return s; } int main() { string a, b; cin >> a >> b; int m = 100000000; for (int i = 0; i <= a.length() - b.length(); i++) { m = min(m, dist(b, a.subs...
[["-", 8, 9, 0, 7, 15, 16, 31, 16, 17, 72], ["-", 15, 16, 31, 16, 12, 2, 63, 118, 28, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 15, 16, 12, 16, 31, 2, 63, 118, 28, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 15, ...
1
138
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author */ #include <fstream> #include <iostream> #include "bits/stdc++.h" #include <iostream> using namespace std; typedef unsigned long long ll; typedef int integer; #define int long long #define ii pair<int, int> #define...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author */ #include <fstream> #include <iostream> #include "bits/stdc++.h" #include <iostream> using namespace std; typedef unsigned long long ll; typedef int integer; #define int long long #define ii pair<int, int> #define...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
380
#include <iostream> using namespace std; int main() { string a, b; cin >> a >> b; int i, d = 0, c = 0, j; for (i = 0; i <= a.size() - b.size() - 1; i++) { c = 0; for (j = i; j <= i + b.size() - 1; j++) { if (a[j] == b[j - i]) { c++; } } if (c > d) { d = c; } } c...
#include <iostream> using namespace std; int main() { string a, b; cin >> a >> b; int i, d = 0, c = 0, j; for (i = 0; i <= a.size() - b.size(); i++) { c = 0; for (j = i; j <= i + b.size() - 1; j++) { if (a[j] == b[j - i]) { c++; } } if (c > d) { d = c; } } cout ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
134
match_cnt = 0 S = input() T = input() S_len = len(S) T_len = len(T) for S_idx in range(S_len - T_len): cnt = 0 for T_idx in range(T_len): if(S[S_idx + T_idx] == T[T_idx]): cnt += 1 if( cnt > match_cnt ): match_cnt = cnt print(T_len - match_cnt)
match_cnt = 0 S = input() T = input() S_len = len(S) T_len = len(T) for S_idx in range(S_len - T_len + 1): cnt = 0 for T_idx in range(T_len): if(S[S_idx + T_idx] == T[T_idx]): cnt += 1 if( cnt > match_cnt ): match_cnt = cnt print(T_len - match_cnt)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
80
#include <algorithm> #include <cstdio> #include <iostream> #include <locale.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> using namespace std; int main() { string s, t; cin >> s >> t; int ans = 20000, x = 0; for (int i = 0; i < s.size() - t.size(); i++) { for (int...
#include <algorithm> #include <cstdio> #include <iostream> #include <locale.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> using namespace std; int main() { string s, t; cin >> s >> t; int ans = 20000, x = 0; for (int i = 0; i <= s.size() - t.size(); i++) { for (in...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
138
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); i++) #define INF 1001001001 #define LLINF 1001001001001001001 #define MOD 1000000007 #define FOUT(n, dist) cout << fixed << setprecision(n) << (dist); #define BR cout << endl; #define LEN(s) s.length(); template <class T> bool c...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); i++) #define INF 1001001001 #define LLINF 1001001001001001001 #define MOD 1000000007 #define FOUT(n, dist) cout << fixed << setprecision(n) << (dist); #define BR cout << endl; #define LEN(s) s.length(); template <class T> bool c...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
340
#include <stdio.h> #include <string.h> int main() { char S[1001], T[1001]; scanf("%s", S); scanf("%s", T); int min = strlen(T); for (int i = 0; i < strlen(S) - strlen(T); i++) { int counter = 0; for (int j = 0; j < strlen(T); j++) { if (S[i + j] != T[j]) counter++; } if (min >...
#include <stdio.h> #include <string.h> int main() { char S[1001], T[1001]; scanf("%s", S); scanf("%s", T); int min = strlen(T); for (int i = 0; i <= strlen(S) - strlen(T); i++) { int counter = 0; for (int j = 0; j < strlen(T); j++) { if (S[i + j] != T[j]) counter++; } if (min ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
0
134
#include <iostream> using namespace std; int main() { string s, t; cin >> s >> t; int res = 1001, sl = s.size(), tl = t.size(); for (int offset = 0; offset < sl - tl; ++offset) { int cnt = 0; for (int i = 0; i < tl; ++i) if (s[offset + i] != t[i]) cnt++; res = min(cnt, res); } ...
#include <iostream> using namespace std; int main() { string s, t; cin >> s >> t; int res = 1001, sl = s.size(), tl = t.size(); for (int offset = 0; offset <= sl - tl; ++offset) { int cnt = 0; for (int i = 0; i < tl; ++i) if (s[offset + i] != t[i]) cnt++; res = min(cnt, res); } ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
113
S=list(input()) T=list(input()) ...
...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
92
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long int ll; typedef long double ld; #define rep(i, n) for (int i = 0; i < (n); ++i) #define Sort(Array) sort(Array.begin(), Ar...
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long int ll; typedef long double ld; #define rep(i, n) for (int i = 0; i < (n); ++i) #define Sort(Array) sort(Array.begin(), Ar...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
203
s = input() t = input() ans = len(t) for i in range(len(s) - len(t)): sub = s[i:i+len(t)] cnt = 0 for j in range(len(t)): if sub[j] != t[j]: cnt = cnt + 1 ans = min(ans, cnt) print(ans)
s = input() t = input() ans = len(t) for i in range(len(s) - len(t) + 1): sub = s[i:i+len(t)] cnt = 0 for j in range(len(t)): if sub[j] != t[j]: cnt = cnt + 1 ans = min(ans, cnt) print(ans)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
87
s=str(input()) t=str(input()) ans=0 for i in range(0,len(s)-len(t)): tmp=0 for j in range(len(t)): if s[i+j]==t[j]: tmp=tmp+1 ans=max(ans,tmp) print(len(t)-ans)
s=str(input()) t=str(input()) ans=0 for i in range(0,len(s)-len(t)+1): tmp=0 for j in range(len(t)): if s[i+j]==t[j]: tmp=tmp+1 ans=max(ans,tmp) print(len(t)-ans)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
86
#include <iostream> using namespace std; int main(void) { // Your code here! string S, T; cin >> S >> T; int answer = 1001; // 1000以上にしておく for (int i = 0; i < S.size() - T.size(); i++) { int x = 0; for (int j = 0; j < T.size(); j++) { if (S.at(i + j) != T.at(j)) { x++; //一致しなかった文字の数 ...
#include <iostream> using namespace std; int main(void) { // Your code here! string S, T; cin >> S >> T; int answer = 1001; // 1000以上にしておく for (int i = 0; i < S.size() - T.size() + 1; i++) { int x = 0; for (int j = 0; j < T.size(); j++) { if (S.at(i + j) != T.at(j)) { x++; //一致しなかった文字の...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
124
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { vector<int> same; string S, T; cin >> S >> T; int end = S.length() - T.length(); for (int i = 0; i <= end; ++i) { int counter = 0; for (int j = 0; j <= T.length(); ++j) { if (S[i + j] ...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { vector<int> same; string S, T; cin >> S >> T; int end = S.length() - T.length(); for (int i = 0; i <= end; ++i) { int counter = 0; for (int j = 0; j < T.length(); ++j) { if (S[i + j] =...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18]]
1
156
#include <bits/stdc++.h> #define ll long long int #define ld long double #define f first #define s second #define pb push_back #define eb emplace_back #define mk make_pair #define mt make_tuple #define MOD 1000000007 #define fo(i, a, b) for (i = a; i < b; i++) #define foe(i, a, b) for (i = a; i <= b; i++) #define all(x...
#include <bits/stdc++.h> #define ll long long int #define ld long double #define f first #define s second #define pb push_back #define eb emplace_back #define mk make_pair #define mt make_tuple #define MOD 1000000007 #define fo(i, a, b) for (i = a; i < b; i++) #define foe(i, a, b) for (i = a; i <= b; i++) #define all(x...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
202
#include <stdio.h> #include <string.h> int main() { char s[1020], t[1020]; int contador = 0, tams, tamt, minimo; scanf("%s ", s); scanf(" %s", t); tams = strlen(s); tamt = strlen(t); for (int i = 0; i < tams - tamt + 1; i++) { contador = 0; // printf("s[%d]: %c - t[%d]: %c\n", i+j, s[i+j], j, ...
#include <stdio.h> #include <string.h> int main() { char s[1020], t[1020]; int contador = 0, tams, tamt, minimo; scanf("%s ", s); scanf(" %s", t); tams = strlen(s); tamt = strlen(t); minimo = tamt; for (int i = 0; i < tams - tamt + 1; i++) { contador = 0; // printf("s[%d]: %c - t[%d]: %c\n",...
[["+", 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, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
0
154
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int e = s.size(); int b = t.size(); int c = 0; int m = 0; for (int i = 0; i <= e - b; i++) { for (int j = 0; j < b; i++) { if (t[j] == s[j + i]) { c++; } } m = max(m, c); c = 0; } ...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int e = s.size(); int b = t.size(); int c = 0; int m = 0; for (int i = 0; i <= e - b; i++) { for (int j = 0; j < b; j++) { if (t[j] == s[j + i]) { c++; } } m = max(m, c); c = 0; } ...
[["-", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22]]
1
123
#include <stdio.h> #include <string.h> int main(void) { char s[1001], t[1001]; scanf("%s", s); scanf("%s", t); int S = strlen(s); int T = strlen(t); int min = T; for (int i = 0; i <= S - T; i++) { int c = 0; for (int j = 0; j < T; j++) { if (t[i] != s[i + j]) { c++; } } ...
#include <stdio.h> #include <string.h> int main(void) { char s[1001], t[1001]; scanf("%s", s); scanf("%s", t); int S = strlen(s); int T = strlen(t); int min = T; for (int i = 0; i <= S - T; i++) { int c = 0; for (int j = 0; j < T; j++) { if (t[j] != s[i + j]) { c++; } } ...
[["-", 0, 57, 15, 23, 0, 16, 31, 69, 71, 22], ["+", 0, 57, 15, 23, 0, 16, 31, 69, 71, 22]]
0
144
S = input() T = input() max_match = 0 n = len(T) m = len(S) for i in range(m-n): tmp = 0 for j in range(i,i+n): if S[j] == T[j-i]: tmp += 1 if tmp > max_match: max_match = tmp ans = n - max_match print(ans)
S = input() T = input() max_match = 0 n = len(T) m = len(S) for i in range(m-n+1): tmp = 0 for j in range(i,i+n): if S[j] == T[j-i]: tmp += 1 if tmp > max_match: max_match = tmp ans = n - max_match print(ans)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
83
#include <bits/stdc++.h> using namespace std; string s, t; int sl, tl; int main() { cin >> s >> t; sl = s.length(); tl = t.length(); int ans = 1946081700; for (int i = 0; i + tl < sl; i++) { int tm = 0; for (int j = 0; j < tl; j++) { if (s[i + j] != t[j]) tm++; } ans = min(tm, an...
#include <bits/stdc++.h> using namespace std; string s, t; int sl, tl; int main() { //注意对于sl的长度特殊判断! cin >> s >> t; sl = s.length(); tl = t.length(); int ans = 1946081700; for (int i = 0; i + tl <= sl; i++) { int tm = 0; for (int j = 0; j < tl; j++) { if (s[i + j] != t[j]) tm++; } ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
118
string1 = input() string2 = input() n, m = len(string1), len(string2) best = float("inf") for i in range(n - m): current = string1[i:i+m] differences = 0 for i in range(m): if current[i] != string2[i]: differences += 1 best = min(differences, best) if best == float("inf"): print(0) else: print(b...
string1 = input() string2 = input() n, m = len(string1), len(string2) best = float("inf") for i in range(n - m + 1): current = string1[i:i+m] differences = 0 for i in range(m): if current[i] != string2[i]: differences += 1 best = min(differences, best) if best == float("inf"): print(0) else: pri...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
104
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define pb push_back const ll mod = 1e9 + 7; void solve() { string a, b; cin >> a >> b; int za = a.size(); int zb = b.size(); int ans = 1e9; for (int i = 0; i < za - zb; i++) { int cnt = 0; for (int j = 0; j ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define pb push_back const ll mod = 1e9 + 7; void solve() { string a, b; cin >> a >> b; int za = a.size(); int zb = b.size(); int ans = 1e9; for (int i = 0; i <= za - zb; i++) { int cnt = 0; for (int j = 0; j...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
183
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { string T, S; cin >> S >> T; int ans = 10000; rep(i, S.size() - T.size()) { int count = T.size(); rep(j, T.size()) if (S.at(i + j) == T.at(j)) count--; ans = min(ans, count); } cout << ans; }...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { string T, S; cin >> S >> T; int ans = 10000; rep(i, S.size() - T.size() + 1) { int count = T.size(); rep(j, T.size()) if (S.at(i + j) == T.at(j)) count--; ans = min(ans, count); } cout << an...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
109
/*Author : Krishna*/ #include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <stack> #include <unordered_map> #include <unordered_set> #include <vector> /* 97 to 122*/ using namespace std; void solve() { string S, T; cin >> S >> T; int ans = (int)T.size(); for (int start = 0; start...
/*Author : Krishna*/ #include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <stack> #include <unordered_map> #include <unordered_set> #include <vector> /* 97 to 122*/ using namespace std; void solve() { string S, T; cin >> S >> T; int ans = (int)T.size(); for (int start = 0; start...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
158
package main import ( "bufio" "fmt" "os" ) const ( initialBufSize = 100000 maxBufSize = 10000000 ) var ( sc = bufio.NewScanner(os.Stdin) wt = bufio.NewWriter(os.Stdout) ) func next() string { sc.Scan() return sc.Text() } func puts(a ...interface{}) { fmt.Fprintln(wt, a...) } func min(nums ...int) in...
package main import ( "bufio" "fmt" "os" ) const ( initialBufSize = 100000 maxBufSize = 10000000 ) var ( sc = bufio.NewScanner(os.Stdin) wt = bufio.NewWriter(os.Stdout) ) func next() string { sc.Scan() return sc.Text() } func puts(a ...interface{}) { fmt.Fprintln(wt, a...) } func min(nums ...int) in...
[["-", 8, 196, 0, 7, 0, 430, 15, 16, 17, 18], ["+", 8, 196, 0, 7, 0, 430, 15, 16, 17, 19]]
7
275
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> #define _crt_secure_no_war...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> #define _crt_secure_no_war...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
250
S = input() T = input() iteration = len(S) - len(T) + 1 if T in S: ans = 0 else: minimum = len(T) for i in range(iteration): s = S[i:len(T)+i] for j in range(len(T)): count = 0 if s[j] != T[j]: count += 1 minimum = min(minimum, count) ans...
S = input() T = input() iteration = len(S) - len(T) + 1 if T in S: ans = 0 else: minimum = len(T) for i in range(iteration): # print('---------------') s = S[i:len(T)+i] # print(s) # print(T) count = 0 for j in range(len(T)): if s[j] != T[j]: ...
[["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612]]
5
103
s = input() t = input() ls = len(s) lt = len(t) max_count = 0 for i in range(ls-lt+1): count = 0 for j in range(lt): if s[i:i+lt][j] != t[j]: count += 1 if max_count < count: max_count = count print(max_count)
s = input() t = input() ls = len(s) lt = len(t) min_count = 1000 for i in range(ls-lt+1): count = 0 for j in range(lt): if s[i:i+lt][j] != t[j]: count += 1 if min_count > count: min_count = count print(min_count)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+...
5
81
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int cnt = 0, c = 0; for (int i = 0; i <= s.size() - t.size(); i++) { for (int j = 0; j < t.size(); j++) if (s[i + j] == t[j]) cnt++; c = max(c, cnt); cnt = 0; } cout << c - t.size(); }
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int cnt = 0, c = 0; for (int i = 0; i <= s.size() - t.size(); i++) { for (int j = 0; j < t.size(); j++) if (s[i + j] == t[j]) cnt++; c = max(c, cnt); cnt = 0; } cout << t.size() - c; }
[["-", 8, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 12, 22]]
1
116
S = list(input()) T = list(input()) res = len(T) for i in range(len(S) - len(T) + 1): cnt = 0 smallS = S[i:len(T)+1] for s, t in zip(smallS, T): if s == t: cnt += 1 if (len(T) - cnt) < res: res = len(T) - cnt print(res)
S = list(input()) T = list(input()) res = len(T) for i in range(len(S) - len(T) + 1): cnt = 0 smallS = S[i:i+len(T)] for s, t in zip(smallS, T): if s == t: cnt += 1 if (len(T) - cnt) < res: res = len(T) - cnt print(res)
[["+", 0, 662, 12, 206, 206, 663, 0, 657, 31, 22], ["+", 0, 662, 12, 206, 206, 663, 0, 657, 17, 72], ["-", 0, 662, 12, 206, 206, 663, 0, 657, 17, 72], ["-", 0, 662, 12, 206, 206, 663, 0, 657, 12, 612]]
5
100
S = str(input()) T = str(input()) lens = len(S) lent = len(T) ans = [] for i in range(s-t + 1): count = 0 U = S[i: i+t] for i in range(t): if U[j] != T[j]: count += 1 ans.append(count) print(min(ans))
S = str(input()) T = str(input()) lens = len(S) lent = len(T) ans = [] for i in range(lens-lent + 1): count = 0 U = S[i: i+lent] for j in range(lent): if U[j] != T[j]: count += 1 ans.append(count) print(min(ans))
[["-", 12, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["+", 12, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["-", 12, 652, 3, 4, 0, 657, 31, 657, 12, 22], ["+", 12, 652, 3, 4, 0, 657, 31, 657, 12, 22], ["-", 0, 662, 12, 206, 206, 663, 0, 657, 12, 22], ["+", 0, 662, 12, 206, 206, 663, 0, 657, 12, 22], ["-", 0, 656, 0, 7, 8, 196, 0, ...
5
92
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def main(): S = input() T = input() #TがSの部分文字列になるようにSを書き換える N = len(S) M = len(T) L = N - M #Sを調べるループの回数 #二重ループが許される ans = M for i in range(L): #最大M個一致していな...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def main(): S = input() T = input() #TがSの部分文字列になるようにSを書き換える N = len(S) M = len(T) L = N - M #Sを調べるループの回数 #二重ループが許される ans = M for i in range(L+1): #最大M個一致して...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
126
#include <bits/stdc++.h> using namespace std; string S, T; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> S >> T; int ans = T.size(); for (int i = 0; i < S.size() - T.size(); i++) { int diff = 0; for (int j = 0; j < T.size(); j++) { if (T[j] != S[i + j])...
#include <bits/stdc++.h> using namespace std; string S, T; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> S >> T; int ans = T.size(); for (int i = 0; i <= S.size() - T.size(); i++) { int diff = 0; for (int j = 0; j < T.size(); j++) { if (T[j] != S[i + j]...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
138
#include <bits/stdc++.h> using namespace std; int n, m; string S, T; int main() { getline(cin, S); getline(cin, T); int ans = 1010; for (int i = 0; i < S.length() - T.length(); i++) { int now = 0; for (int j = 0; j < T.length(); j++) { if (S[i + j] != T[j]) now++; } ans = min(ans,...
#include <bits/stdc++.h> using namespace std; int n, m; string S, T; int main() { getline(cin, S); getline(cin, T); int ans = 1010; for (int i = 0; i <= S.length() - T.length(); i++) { int now = 0; for (int j = 0; j < T.length(); j++) { if (S[i + j] != T[j]) now++; } ans = min(ans...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
127
#include <algorithm> #include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string s, t; cin >> s >> t; int mka = 0; for (int i = 0; i < s.length() - t.length(); i++) { char tt[t.length()]; int kasanari = 0; for (int j = 0; j < t.length(); j++)...
#include <algorithm> #include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string s, t; cin >> s >> t; int mka = 0; for (int i = 0; i <= s.length() - t.length(); i++) { char tt[t.length()]; int kasanari = 0; for (int j = 0; j < t.length(); j++...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
147
#include <algorithm> #include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string s, t; cin >> s >> t; int mka = t.length(); if (s == t) { cout << "0"; return 0; } for (int i = 0; i < s.length() - t.length(); i++) { int kasanari = 0; f...
#include <algorithm> #include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string s, t; cin >> s >> t; int mka = t.length(); if (s == t) { cout << "0"; return 0; } for (int i = 0; i <= s.length() - t.length(); i++) { int kasanari = 0; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
142
/* // ABC141 D - Powerful Discount Tickets // 優先度キュー プライオリティーキュー int main() { ll n,m; cin >> n >> m; // プライオリティーキューに突っ込む priority_queue<ll> q; rep(i,n){ ll k; cin >> k; q.push(k); } // 値段の高いものから割引券を適応して戻す rep(i,m){ ll now = q.top(); q.pop(); now /= 2; q.push(now); } ...
/* // ABC141 D - Powerful Discount Tickets // 優先度キュー プライオリティーキュー int main() { ll n,m; cin >> n >> m; // プライオリティーキューに突っ込む priority_queue<ll> q; rep(i,n){ ll k; cin >> k; q.push(k); } // 値段の高いものから割引券を適応して戻す rep(i,m){ ll now = q.top(); q.pop(); now /= 2; q.push(now); } ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
223
// BISMILLAH #include <bits/stdc++.h> using namespace std; int main() { int minn = INT_MAX; string s, t; int i, j, len, len2, p, cnt = 0; cin >> s >> t; len = s.size(); len2 = t.size(); for (i = 0; i < (len - len2); i++) { p = i; for (j = 0; j < len2; j++) { if (t[j] != s[p++]) cnt++...
// BISMILLAH #include <bits/stdc++.h> using namespace std; int main() { int minn = INT_MAX; string s, t; int i, j, len, len2, p, cnt = 0; cin >> s >> t; len = s.size(); len2 = t.size(); for (i = 0; i <= (len - len2); i++) { p = i; for (j = 0; j < len2; j++) { if (t[j] != s[p++]) cnt+...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
136
#include <stdio.h> #include <string.h> int main() { char s[1000], t[1000]; int slen, tlen; int minmin = 1000; scanf("%s", s); scanf("%s", t); slen = strlen(s); tlen = strlen(t); for (int i = 0; i < slen - tlen; i++) { int cnt = 0; for (int j = 0; j < tlen; j++) { if (s[i + j] != t[j]) { ...
#include <stdio.h> #include <string.h> int main() { char s[1000], t[1000]; int slen, tlen; int minmin = 1000; scanf("%s", s); scanf("%s", t); slen = strlen(s); tlen = strlen(t); for (int i = 0; i <= slen - tlen; i++) { int cnt = 0; for (int j = 0; j < tlen; j++) { if (s[i + j] != t[j]) { ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
0
143
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string s, t; cin >> s >> t; int ans = 101010; for (int i = 0; i < s.length() - t.length(); ++i) { int cnt = 0; for (int j = 0; j < t.length(); ++j) { if (s[i + j] != t[j]) cnt++; } ans = ...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string s, t; cin >> s >> t; int ans = 101010; for (int i = 0; i <= s.length() - t.length(); ++i) { int cnt = 0; for (int j = 0; j < t.length(); ++j) { if (s[i + j] != t[j]) cnt++; } ans =...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
118
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <time.h> #include <vector> typed...
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <time.h> #include <vector> typed...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
153
#include <algorithm> #include <bitset> #include <iostream> #include <math.h> #include <vector>; using namespace std; int main() { string s, t; cin >> s >> t; int ans = 10000, tmp = 0; ; for (int i = 0; i < s.length() - t.length(); i++) { for (int j = 0; j < t.length(); j++) { if (s[i + j] != t[j]...
#include <algorithm> #include <bitset> #include <iostream> #include <math.h> #include <vector>; using namespace std; int main() { string s, t; cin >> s >> t; int ans = 10000, tmp = 0; ; for (int i = 0; i < s.length() - t.length() + 1; i++) { for (int j = 0; j < t.length(); j++) { if (s[i + j] != ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
127
#include <bits/stdc++.h> using namespace std; int main() { string S, T; cin >> S; cin >> T; int Ns = S.length(); int Nt = T.length(); int Smax = 0; int Smax_temp = 0; for (int i = 0; i < Ns - Nt; i++) { Smax_temp = 0; for (int j = 0; j < Nt; j++) { if (S[i + j] == T[j]) { Sm...
#include <bits/stdc++.h> using namespace std; int main() { string S, T; cin >> S; cin >> T; int Ns = S.length(); int Nt = T.length(); int Smax = 0; int Smax_temp = 0; for (int i = 0; i < Ns - Nt + 1; i++) { Smax_temp = 0; for (int j = 0; j < Nt; j++) { if (S[i + j] == T[j]) { ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
137
s=input() t=input() ans=100000 num=len(s)-len(t) for i in range(num): r=0 for j in range(len(t)): if s[i+j]!=t[j]: r+=1 if r<ans: ans=r print(ans)
s=input() t=input() ans=1000000 num=len(s)-len(t) for i in range(num+1): r=0 for j in range(len(t)): if s[i+j]!=t[j]: r+=1 if r<ans: ans=r print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
74
s=list(input()) t=list(input()) m=len(t) for i in range(len(s)-len(t)): ma=len(t) for j in range(len(t)): if s[i+j]==t[j]: ma-=1 if ma <m: m=ma print(m)
s=list(input()) t=list(input()) m=len(t) for i in range(len(s)-len(t)+1): ma=len(t) for j in range(len(t)): if s[i+j]==t[j]: ma-=1 if ma <m: m=ma print(m)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
83
#include <bits/stdc++.h> using namespace std; using ll = int64_t; #define deb(x) cout << #x << "=" << x << endl #define deb2(x, y) cout << #x << "=" << x << ", " << #y << "=" << y << endl void solve() { string s1, s2; cin >> s1 >> s2; ll n = s1.length(); ll m = s2.length(); ll ans = LLONG_MAX; for (int i ...
#include <bits/stdc++.h> using namespace std; using ll = int64_t; #define deb(x) cout << #x << "=" << x << endl #define deb2(x, y) cout << #x << "=" << x << ", " << #y << "=" << y << endl void solve() { string s1, s2; cin >> s1 >> s2; ll n = s1.length(); ll m = s2.length(); ll ans = LLONG_MAX; for (int i ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 22]]
1
184
S=input() T=input() N_max = len(T) for i in range(len(S)-len(T)+1): score=0 for j in range(len(T)): if(S[i+j] != T[j]): score += 1 k = min(score, N_max) print(k)
S=input() T=input() N_max = len(T) for i in range(len(S)-len(T)+1): score=0 for j in range(len(T)): if(S[i+j] != T[j]): score += 1 N_max = min(score, N_max) print(N_max)
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]]
5
78
#include <bits/stdc++.h> using namespace std; #define sz(x) (int)x.size() int main() { int ans = 1001; string s, t; cin >> s >> t; for (int i = 0; i < sz(s) - sz(t) - 1; i++) { int c = 0; for (int j = 0; j < sz(t); j++) { c += (s[i + j] != t[j]); } ans = min(ans, c); } cout << ans; }
#include <bits/stdc++.h> using namespace std; #define sz(x) (int)x.size() int main() { int ans = 1001; string s, t; cin >> s >> t; for (int i = 0; i < sz(s) - sz(t) + 1; i++) { int c = 0; for (int j = 0; j < sz(t); j++) { c += (s[i + j] != t[j]); } ans = min(ans, c); } cout << ans; }
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72]]
1
113
#include <bits/stdc++.h> using namespace std; int main() { string S, T; cin >> S >> T; int ans = T.length(); for (int i = 0; i < (int)(S.length() - T.length()); ++i) { int count = 0; for (int j = 0; j < (int)T.length(); ++j) { if (S[i + j] != T[j]) count++; } ans = min(ans, count...
#include <bits/stdc++.h> using namespace std; int main() { string S, T; cin >> S >> T; int ans = T.length(); for (int i = 0; i <= (int)(S.length() - T.length()); ++i) { int count = 0; for (int j = 0; j < (int)T.length(); ++j) { if (S[i + j] != T[j]) count++; } ans = min(ans, coun...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
126
#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() { string s, t; cin >> s >> t; int ans = t.size(); rep(i, s.size() - t.size()) { int cnt = 0; rep(j, t.size()) { if (t[j] != s[i + j]) { ...
#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() { string s, t; cin >> s >> t; int ans = t.size(); rep(i, s.size() - t.size() + 1) { int cnt = 0; rep(j, t.size()) { if (t[j] != s[i + j]) { ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
127
#include <bits/stdc++.h> #define PI 3.141592653589 using namespace std; using ll = long long; template <typename T_char> T_char ToUpper(T_char cX) { return toupper(cX); } int main() { string s, t; cin >> s >> t; int ans = t.size(); for (int i = 0; i < s.size() - t.size(); ++i) { int cnt = 0; for (in...
#include <bits/stdc++.h> #define PI 3.141592653589 using namespace std; using ll = long long; template <typename T_char> T_char ToUpper(T_char cX) { return toupper(cX); } int main() { string s, t; cin >> s >> t; int ans = t.size(); for (int i = 0; i <= s.size() - t.size(); ++i) { int cnt = 0; for (i...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
143
#include <bits/stdc++.h> #include <math.h> #include <string.h> using namespace std; #define loop(i, x, y) for (i = x; i < y; i++) #define loopr(i, x, y) for (i = x; i > y; i--) // use *it instead of it #define vloop(it, x) for (auto it = x.begin(); it != x.end(); it++) #define vloopr(it, x) for (auto it = x.end() - 1...
#include <bits/stdc++.h> #include <math.h> #include <string.h> using namespace std; #define loop(i, x, y) for (i = x; i < y; i++) #define loopr(i, x, y) for (i = x; i > y; i--) // use *it instead of it #define vloop(it, x) for (auto it = x.begin(); it != x.end(); it++) #define vloopr(it, x) for (auto it = x.end() - 1...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
432
///_________________________________ B I S M I L L A H I R R A H M A N I R R A ///H I M __________________________________________________ #include <bits/stdc++.h> using namespace std; typedef bool boo; typedef int li; typedef long il; typedef unsigned long ul; typedef long long int ll; typedef unsigned long long u...
///_________________________________ B I S M I L L A H I R R A H M A N I R R A ///H I M __________________________________________________ #include <bits/stdc++.h> using namespace std; typedef bool boo; typedef int li; typedef long il; typedef unsigned long ul; typedef long long int ll; typedef unsigned long long u...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
439
#include <bits/stdc++.h> #define ll long long using namespace std; ll max(ll a, ll b) { if (a > b) return a; else return b; } int main() { string s, t; cin >> s >> t; int sl = s.length(), tl = t.length(); int maxx = 0; for (int i = 0; i < sl - tl; i++) { int x = 0; for (int j = i; j < sl ...
#include <bits/stdc++.h> #define ll long long using namespace std; ll max(ll a, ll b) { if (a > b) return a; else return b; } int main() { string s, t; cin >> s >> t; int sl = s.length(), tl = t.length(); int maxx = 0; for (int i = 0; i <= sl - tl; i++) { int x = 0; for (int j = i; j < tl...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15...
1
149
#include <bits/stdc++.h> #include <string.h> #define ll long long #include <vector> #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> #include <string.h> #define ll long long #include <vector> #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
136
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef unsigned long long ull; template <typename T> void fin(T a) { cout << a << endl; exit(0); } template <typename S> void print(S a) { cout << a << endl; } template <typename U> void pprint(U ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef unsigned long long ull; template <typename T> void fin(T a) { cout << a << endl; exit(0); } template <typename S> void print(S a) { cout << a << endl; } template <typename U> void pprint(U ...
[["-", 51, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 17, 72]]
1
211
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int n = s.size(); int m = t.size(); int ans = n; for (int i = 0; i + m < n; ++i) { int count = 0; for (int j = 0; j < m; ++j) { if (s[j + i] != t[j]) count++; } ans = min(ans, count); } ...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int n = s.size(); int m = t.size(); int ans = n; for (int i = 0; i + m - 1 < n; ++i) { int count = 0; for (int j = 0; j < m; ++j) { if (s[j + i] != t[j]) count++; } ans = min(ans, count); ...
[["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 12, 13]]
1
119
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define fi first #define se second #define sz(a) (a).size() #define all(c) (c).begin(), (c).end() #define rep(i, n) for (int i = 0; i < n; i++) #define forn(i, n) for (int i = 1; i <= n; i++) #define ford(i, n) for (int i = n; i >= 0; i--) #define REP(i...
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define fi first #define se second #define sz(a) (a).size() #define all(c) (c).begin(), (c).end() #define rep(i, n) for (int i = 0; i < n; i++) #define forn(i, n) for (int i = 1; i <= n; i++) #define ford(i, n) for (int i = n; i >= 0; i--) #define REP(i...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
265
S = list(input()) T = list(input()) ls = len(S) lt = len(T) ans = lt for i in range(ls): temp = 0 if i+lt >= ls: break subS = S[i:i+lt] for ss, st in zip(subS, T): if ss != st: temp += 1 ans = min(ans, temp) print(ans)
S = list(input()) T = list(input()) ls = len(S) lt = len(T) ans = lt for i in range(ls): temp = 0 if i+lt > ls: break subS = S[i:i+lt] for ss, st in zip(subS, T): if ss != st: temp += 1 ans = min(ans, temp) print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
92
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int slen = s.size(); int tlen = t.size(); int ans = tlen; for (int i = 0; i < slen - tlen; i++) { int diff = 0; for (int j = 0; j < tlen; j++) { diff += s[i + j] != t[j]; } ans = min(ans, diff); ...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int slen = s.size(); int tlen = t.size(); int ans = tlen; for (int i = 0; i <= slen - tlen; i++) { int diff = 0; for (int j = 0; j < tlen; j++) { diff += s[i + j] != t[j]; } ans = min(ans, diff); ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
114
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++) #define REP(i, n) for (int(i) = 0; (i) <= (int)(n); (i)++) #define rep1(i, x, n) for (int(i) = (x); (i) < (int)(n); (i)++) #define REP1(i, x, n) for (int(i) = (x); (i) <= (int)(n); (i)++) #define rrep(i, x) for (int i = ((int)(x)-1); i >...
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++) #define REP(i, n) for (int(i) = 0; (i) <= (int)(n); (i)++) #define rep1(i, x, n) for (int(i) = (x); (i) < (int)(n); (i)++) #define REP1(i, x, n) for (int(i) = (x); (i) <= (int)(n); (i)++) #define rrep(i, x) for (int i = ((int)(x)-1); i >...
[["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
256
S=input() T=input() result=len(T) for s in range(0,len(S)-len(T)+1): diff=0 for i in range(0,len(T)): if T[i]!=S[s+i]: diff+=1 result=min(ans,diff) print(result)
S=input() T=input() result=len(T) for s in range(0,len(S)-len(T)+1): diff=0 for i in range(0,len(T)): if T[i]!=S[s+i]: diff+=1 result=min(result,diff) print(result)
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
80
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { string s, t; cin >> s >> t; int ans = 1000; for (int i = 0; i < s.size() - t.size() + 1; ++i) { int replace = 0; for (int j = 0; j < t.size(); ++j) { if (s[i + j] != t[i + j]) ++replace; } ans = min(...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { string s, t; cin >> s >> t; int ans = 1000; for (int i = 0; i < s.size() - t.size() + 1; ++i) { int replace = 0; for (int j = 0; j < t.size(); ++j) { if (s[i + j] != t[j]) ++replace; } ans = min(ans,...
[["-", 51, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 17, 72]]
1
121
#include <bits/stdc++.h> using namespace std; int main() { string S, T; cin >> S >> T; int ans = T.size(); for (int i = 0; i < S.size() - T.size(); i++) { int count = 0; for (int j = 0; j < T.size(); j++) { if (S[i + j] != T[j]) count++; } if (count < ans) ans = count; }...
#include <bits/stdc++.h> using namespace std; int main() { string S, T; cin >> S >> T; int ans = T.size(); for (int i = 0; i < S.size() - T.size() + 1; i++) { int count = 0; for (int j = 0; j < T.size(); j++) { if (S[i + j] != T[j]) count++; } if (count < ans) ans = count;...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
116
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int ans = t.size(); for (int start = 0; start <= s.size() - t.size(); start++) { int diff; for (int i = 0; i < t.size(); i++) { if (s[start + i] != t[i]) { diff++; } } ans = min(ans, diff);...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int ans = t.size(); for (int start = 0; start <= s.size() - t.size(); start++) { int diff = 0; for (int i = 0; i < t.size(); i++) { if (s[start + i] != t[i]) { diff++; } } ans = min(ans, di...
[["+", 0, 7, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13]]
1
120
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ll; #define mod 1000000007 #define all(x) (x).begin(), (x).end() void solve() { string s, t; cin >> s >> t; int cnt = t.size(); for (int i = 0; i < s.size() - t.size(); i++) { int diff = 0; for (int j = 0; j < t.size(); j++) { ...
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ll; #define mod 1000000007 #define all(x) (x).begin(), (x).end() void solve() { string s, t; cin >> s >> t; int cnt = t.size(); for (int i = 0; i <= s.size() - t.size(); i++) { int diff = 0; for (int j = 0; j < t.size(); j++) { ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
159
def main(): s = (input()) t = (input()) mn = 10**5 for i in range(len(s)-len(t)): result = 0 for j in range(len(t)): if s[i+j] != t[j]: result += 1 mn = min(result, mn) print(mn) if __name__ == '__main__': main()
def main(): s = (input()) # d,t,s = map(int, input().split()) # a = list(map(int, input().split())) # s = input() t = (input()) mn = 10**5 for i in range(len(s)-len(t)+1): result = 0 for j in range(len(t)): if s[i+j] != t[j]: result += 1 m...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
92
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; typedef long long unsigned llu; typedef long double ld; #define ll long long #define P...
#include <algorithm> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; typedef long long unsigned llu; typedef long double ld; #define ll long long #define P...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
257
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s; cin >> t; int minCount = t.size(); for (unsigned int i = 0; i < s.size() - t.size(); i++) { int count = 0; for (unsigned int j = 0; j < t.size(); j++) { if (s.at(i + j) != t.at(j)) { count++; } ...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s; cin >> t; int minCount = t.size(); for (unsigned int i = 0; i < s.size() - t.size() + 1; i++) { int count = 0; for (unsigned int j = 0; j < t.size(); j++) { if (s.at(i + j) != t.at(j)) { count++; ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
128
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define po pop_back #define fi first #define se second #define mxn 100005 #define ll long long int #define ldb long double #define fr(i, a, b, k) for (int i = a; i < b; i += k) #define frr(i, a, b, k) for (int i = a; i > b; i -= k...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define po pop_back #define fi first #define se second #define mxn 100005 #define ll long long int #define ldb long double #define fr(i, a, b, k) for (int i = a; i < b; i += k) #define frr(i, a, b, k) for (int i = a; i > b; i -= k...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
469