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> using namespace std; #define pb push_back #define int long long #define endl "\n" #define pii pair<int, int> #define ff first #define ss second #define mii map<int, int> #define si set<int> #define sti stack<int> #define qi queue<int> #define vi vector<int> #define pq priority_queue<int> #defin...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define int long long #define endl "\n" #define pii pair<int, int> #define ff first #define ss second #define mii map<int, int> #define si set<int> #define sti stack<int> #define qi queue<int> #define vi vector<int> #define pq priority_queue<int> #defin...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
158
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define pa(x, n) \ for (ll i = 0; i < n; i++) { \ cout << (x[i]) << " \n"[i == n - 1]; \ };...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define pa(x, n) \ for (ll i = 0; i < n; i++) { \ cout << (x[i]) << " \n"[i == n - 1]; \ };...
[["+", 8, 9, 0, 7, 15, 16, 12, 2, 63, 40], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 25]]
1
276
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <utili...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <utili...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
688
import sys s=input() l=len(s) if l==1: print('No') sys.exit() for i in range(0,l,2): if s[i]=='h': if s[i+1]!='i': print('No') sys.exit() else: print('No') sys.exit() print('Yes')
import sys s=input() l=len(s) if l%2==1: print('No') sys.exit() for i in range(0,l,2): if s[i]=='h': if s[i+1]!='i': print('No') sys.exit() else: print('No') sys.exit() print('Yes')
[["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 109], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612]]
5
93
package main import "fmt" import "strings" func main() { var str string fmt.Scan(&str) if strings.Trim(str, "hi") != "" { fmt.Println("No") } else { fmt.Println("Yes") } }
package main import "fmt" import "strings" func main() { var str string fmt.Scan(&str) if strings.Replace(str, "hi", "", -1) != "" { fmt.Println("No") } else { fmt.Println("Yes") } }
[["-", 0, 57, 15, 16, 31, 2, 63, 438, 119, 120], ["+", 0, 57, 15, 16, 31, 2, 63, 438, 119, 120], ["+", 15, 16, 31, 2, 3, 4, 0, 429, 0, 62], ["+", 0, 57, 15, 16, 31, 2, 3, 4, 0, 21], ["+", 15, 16, 31, 2, 3, 4, 0, 91, 17, 33], ["+", 15, 16, 31, 2, 3, 4, 0, 91, 439, 433]]
7
70
#include <bits/stdc++.h> #define int long long using namespace std; inline int read() { int sum = 0, ff = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') ff = -1; ch = getchar(); } while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar(); return sum * ff; } const int ...
#include <bits/stdc++.h> #define int long long using namespace std; inline int read() { int sum = 0, ff = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') ff = -1; ch = getchar(); } while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar(); return sum * ff; } const int ...
[["-", 0, 34, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 34, 31, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
205
#include <algorithm> #include <bitset> #include <cctype> #include <cstdlib> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include ...
#include <algorithm> #include <bitset> #include <cctype> #include <cstdlib> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include ...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
1,479
def main(): s=list(input()) if len(s) == 1: print('No') return for i in range(len(s)): if i%2 == 0: if not s[i] == "h": print('No') return else: if not s[i] == "i": print('No') return ...
def main(): s=list(input()) if not len(s)%2 == 0: print('No') return for i in range(len(s)): if i%2 == 0: if not s[i] == "h": print('No') return else: if not s[i] == "i": print('No') re...
[["+", 0, 14, 8, 196, 0, 57, 15, 681, 0, 372], ["+", 0, 57, 15, 681, 28, 666, 0, 657, 17, 109], ["+", 0, 57, 15, 681, 28, 666, 0, 657, 12, 612], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 681, 28, 666, 0, 612]]
5
93
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using P = pair<int, int>; int main(void) { string s; cin >> s; if (s.length() % 2 != 1) { cout << "No" << endl; return 0; } rep(i, s.length()) { if (i % 2 == 0 && s[i] != 'h') { cout << "No" << end...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using P = pair<int, int>; int main(void) { string s; cin >> s; if (s.length() % 2 == 1) { cout << "No" << endl; return 0; } rep(i, s.length()) { if (i % 2 == 0 && s[i] != 'h') { cout << "No" << end...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
147
def main(): s = input() for _ in range(15): s=s.replace("hi", " ") for _ in range(15): s=s.replace(" ", "") if s=="": print("Yes") else: print(s,"No") main()
def main(): s = input() for _ in range(15): s=s.replace("hi", " ") for _ in range(15): s=s.replace(" ", "") if s=="": print("Yes") else: print("No") main()
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21]]
5
78
n = input() l = n.replace("hi","a") print("No" if len(set(l)) != 1 else "Yes")
n = input() l = n.replace("hi","") print("No" if len(set(l)) != 0 else "Yes")
[["-", 0, 662, 12, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 652, 3, 4, 0, 41, 0, 666, 0, 612], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 0, 612]]
5
39
#ifdef __APPLE__ #include <algorithm> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #else #include <bits/stdc++.h> #endif using namespace std; #define rep(i, a, n) for (int i =...
#ifdef __APPLE__ #include <algorithm> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #else #include <bits/stdc++.h> #endif using namespace std; #define rep(i, a, n) for (int i =...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
388
#include <algorithm> #include <iostream> #include <sstream> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; using ull_t = unsigned long long; int main() { string S; cin >> S; auto judge = [&]() { if (S.size() < 2) return false; for (int ...
#include <algorithm> #include <iostream> #include <sstream> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; using ull_t = unsigned long long; int main() { string S; cin >> S; auto judge = [&]() { if (S.size() % 2 != 0) return false; for ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
149
#include <bits/stdc++.h> using namespace std; #define int int64_t #define rep(i, a, n) for (int i = (a); i < (n); ++i) #define reps(i, a, n) for (int i = (a); i < (n); --i) #define all(x) (x).begin(), (x).end() #define gsort(x, n) sort((x), (x + n) greater<int>()) #define rv(s) reverse((s).begin(), (s).end()) #define ...
#include <bits/stdc++.h> using namespace std; #define int int64_t #define rep(i, a, n) for (int i = (a); i < (n); ++i) #define reps(i, a, n) for (int i = (a); i < (n); --i) #define all(x) (x).begin(), (x).end() #define gsort(x, n) sort((x), (x + n) greater<int>()) #define rv(s) reverse((s).begin(), (s).end()) #define ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
266
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #inc...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #inc...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
438
s = input() a='hi' b=0 for n in range(4): if s==a*(n+1): print("Yes") b=1 if b!=1: print("No")
s = input() a='hi' b=0 for n in range(5): if s==a*(n+1): print("Yes") b=1 if b!=1: print("No")
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
52
#include <bits/stdc++.h> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) #define drep(i, cc, n) for (int i = cc; i >= n; --i) #define sz(s) (int)(s.size()) #define vecprint(v) \ rep(i, 0, v.size() - 1) cout << v[i] << " "; ...
#include <bits/stdc++.h> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) #define drep(i, cc, n) for (int i = cc; i >= n; --i) #define sz(s) (int)(s.size()) #define vecprint(v) \ rep(i, 0, v.size() - 1) cout << v[i] << " "; ...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
194
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < (n); ++i) using ll = long long; using pll = pair<ll, ll>; constexpr ll INF = (1LL << 60); constexpr ll MOD = (1e9 + 7); // constexpr ll MOD = (998244353); template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; r...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < (n); ++i) using ll = long long; using pll = pair<ll, ll>; constexpr ll INF = (1LL << 60); constexpr ll MOD = (1e9 + 7); // constexpr ll MOD = (998244353); template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; r...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
573
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from collections import deque as deq import re S = input() print('Yes' if re.match(r'(hi)+', S) else 'No')
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from collections import deque as deq import re S = input() print('Yes' if re.match(r'^(hi)+$', S) else 'No')
[["-", 0, 41, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 41, 0, 652, 3, 4, 0, 557, 0, 6]]
5
38
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); sc.close(); if (S.length() <= 1) { System.out.println("No"); return; } String ans = "Yes"; for (int i = 0; i < S.length(); i++) ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); sc.close(); if (S.length() % 2 == 1) { System.out.println("No"); return; } String ans = "Yes"; for (int i = 0; i < S.length(); i...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19], ["+", 0, 57, 15, 15, 0, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 15, 0, 16, 31, 16, 12, 499], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 60]]
3
166
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 1e5 + 10; char ch[N]; signed main() { cin >> ch + 1; int fl = 1; if (strlen(ch + 1) % 2) { cout << "No " << endl; return 0; } for (int i = 1; i <= strlen(ch + 1); i++) { if (i % 2) { if (ch[i] != 'i') { ...
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 1e5 + 10; char ch[N]; signed main() { cin >> ch + 1; int fl = 1; if (strlen(ch + 1) % 2) { cout << "No " << endl; return 0; } for (int i = 1; i <= strlen(ch + 1); i++) { if (i % 2 == 0) { if (ch[i] != 'i') { ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
162
s = str(input()) Sample = ["hi","hihi","hihihi""hihihihi","hihihihihi"] if s in Sample: print("Yes") else: print("No")
s = str(input()) Sample = ["hi","hihi","hihihi","hihihihi","hihihihihi"] if s in Sample: print("Yes") else: print("No")
[["+", 0, 656, 0, 1, 0, 662, 12, 634, 0, 21]]
5
49
s = input() if len(s) == 1: print('No') exit() for i in range(len(s)): if i % 2 == 0 and s[i] != 'h': print('No') exit() if i % 2 == 1 and s[i] != 'i': print('No') exit() print('Yes')
s = input() if len(s) % 2 == 1: print('No') exit() for i in range(len(s)): if i % 2 == 0 and s[i] != 'h': print('No') exit() if i % 2 == 1 and s[i] != 'i': print('No') exit() print('Yes')
[["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 109], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612]]
5
89
#include <bits/stdc++.h> using namespace std; #define int long long #define MOD 1000000007 #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i < (n); i++) #define rrep(i, n) ...
#include <bits/stdc++.h> using namespace std; #define int long long #define MOD 1000000007 #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i < (n); i++) #define rrep(i, n) ...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
243
s = input() count = len(s) / 2 if s == 'hi' * count: print('Yes') else: print('No')
s = input() count = len(s) // 2 if s == 'hi' * count: print('Yes') else: print('No')
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 85], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 676]]
5
36
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define all(a) a.begin(), a.end() #define P pair<int, int> #define F first #define S second #define mod 1000000007 #define MOD 998244353 #define INF 40000000000000000 int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1...
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define all(a) a.begin(), a.end() #define P pair<int, int> #define F first #define S second #define mod 1000000007 #define MOD 998244353 #define INF 40000000000000000 int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1...
[["-", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 14, 8, 9, 0, 7, 26, 11, 17, 107], ["+", 0, 14, 8, 9, 0, 7, 26, 11, 12, 13]]
1
224
#include <bits/stdc++.h> #include <cmath> #include <stdio.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) // rep…「0からn-1まで」の繰り返し #define rep2(i, s, n) for (long long i = s; i <= (long long)(n); i++) // rep2…「sからnまで」の繰り返し #define repr(i, s, n) for (long long i = s; i >= (long lo...
#include <bits/stdc++.h> #include <cmath> #include <stdio.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) // rep…「0からn-1まで」の繰り返し #define rep2(i, s, n) for (long long i = s; i <= (long long)(n); i++) // rep2…「sからnまで」の繰り返し #define repr(i, s, n) for (long long i = s; i >= (long lo...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
177
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; signed main() { ios_...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; signed main() { ios_...
[["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
265
#include <bits/stdc++.h> using namespace std; typedef long long ll; using P = pair<ll, ll>; const ll mod = 1e9 + 7; #define ALL(x) (x).begin(), (x).end() #define pow(x, y) modpow(x, y) #define REP(i, n) for (ll(i) = 0; (i) < (n); (i)++) template <class T = int> T in() { T x; cin >> x; return (x); } signed main(...
#include <bits/stdc++.h> using namespace std; typedef long long ll; using P = pair<ll, ll>; const ll mod = 1e9 + 7; #define ALL(x) (x).begin(), (x).end() #define pow(x, y) modpow(x, y) #define REP(i, n) for (ll(i) = 0; (i) < (n); (i)++) template <class T = int> T in() { T x; cin >> x; return (x); } signed main(...
[["+", 31, 16, 12, 23, 0, 41, 15, 16, 17, 98], ["+", 12, 23, 0, 41, 15, 16, 12, 16, 31, 22], ["+", 12, 23, 0, 41, 15, 16, 12, 16, 17, 60], ["+", 12, 23, 0, 41, 15, 16, 12, 16, 12, 13]]
1
228
s = input() cnt = 0 for i in range(0, len(s), 2): if s[i:i+2] == 'hi': cnt += 1 if cnt == len(s)//2: print('Yes') else: print('No')
s = input() cnt = 0 for i in range(0, len(s), 2): if s[i:i+2] == 'hi': cnt += 1 if cnt*2 == len(s): print('Yes') else: print('No')
[["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 48], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 676], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612]]
5
64
s = gets.chomp n = s.size ok = true (n/2).times do |i| ok = false if s[i*2,2] != "hi" end puts (ok ? "Yes" : "No")
s = gets.chomp n = s.size ok = true (n/2).times do |i| ok = false if s[i*2,2] != "hi" end puts (ok && n.even? ? "Yes" : "No")
[["+", 3, 4, 0, 739, 0, 754, 15, 738, 17, 98], ["+", 0, 739, 0, 754, 15, 738, 12, 652, 486, 22], ["+", 0, 739, 0, 754, 15, 738, 12, 652, 17, 131], ["+", 0, 739, 0, 754, 15, 738, 12, 652, 735, 22]]
4
53
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define lsb(x) (x & (-x)) using namespace std; int main() { #ifdef HOME ifstream cin("C.in"); ofstream cout("C.out"); #endif int i; ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); string str; cin >> str; for (i = 0; i ...
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define lsb(x) (x & (-x)) using namespace std; int main() { #ifdef HOME ifstream cin("C.in"); ofstream cout("C.out"); #endif int i; ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); string str; cin >> str; for (i = 0; i ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 67]]
1
169
s=input() for i in range(5): if s=="hi"*i: print("Yes") break else: print("No")
s=input() for i in range(6): if s=="hi"*i: print("Yes") break else: print("No")
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
37
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; bool ok = 1; if (s.size() % 2) ok = 0; for (int i = 0; i < (int)s.size(); i += 2) if (!(s[i] == 'h' && s[i + 1] == 'i')) ok = 0; if (ok) cout << "YES\n"; else cout << "NO\n"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; bool ok = 1; if (s.size() % 2) ok = 0; for (int i = 0; i < (int)s.size(); i += 2) if (!(s[i] == 'h' && s[i + 1] == 'i')) ok = 0; if (ok) cout << "Yes\n"; else cout << "No\n"; return 0; }
[["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]]
1
111
#include <algorithm> #include <bitset> #include <cassert> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vect...
#include <algorithm> #include <bitset> #include <cassert> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vect...
[["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13]]
1
560
#include <bits/stdc++.h> #define f(i, a, b) for (ll i = a; i < (ll)b; i++) #define af(i, a, b) for (ll i = a; i >= (ll)b; i--) #define rep(i, a, b, k) for (ll i = a; i < b; i += k) #define arep(i, a, b, k) for (ll i = a; i >= b; i -= k) #define fs first #define sc second #define pb push_back #define mp make_pair #defi...
#include <bits/stdc++.h> #define f(i, a, b) for (ll i = a; i < (ll)b; i++) #define af(i, a, b) for (ll i = a; i >= (ll)b; i--) #define rep(i, a, b, k) for (ll i = a; i < b; i += k) #define arep(i, a, b, k) for (ll i = a; i >= b; i -= k) #define fs first #define sc second #define pb push_back #define mp make_pair #defi...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
542
#include <cassert> #include <iostream> #include <vector> using namespace std; template <long long mod> class modint { private: long long a; public: constexpr modint(const long long x = 0) noexcept : a(x % mod) {} constexpr long long &value() noexcept { return a; } constexpr const long long &value() const noex...
#include <cassert> #include <iostream> #include <vector> using namespace std; template <long long mod> class modint { private: long long a; public: constexpr modint(const long long x = 0) noexcept : a(x % mod) {} constexpr long long &value() noexcept { return a; } constexpr const long long &value() const noex...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117], ["-", 0, 7, 8, 9, 0, 57, 64, 116, 0, 35], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
541
#include <bits/stdc++.h> #define MAXN 100005 #define INF 1000000000 #define MOD 1000000007 #define F first #define S second using namespace std; typedef long long ll; typedef pair<int, int> P; int n, k; string str; void add(int &a, int b) { a += b; if (a >= MOD) a -= MOD; } void dec(int &a, int b) { a -= b; ...
#include <bits/stdc++.h> #define MAXN 100005 #define INF 1000000000 #define MOD 1000000007 #define F first #define S second using namespace std; typedef long long ll; typedef pair<int, int> P; int n, k; string str; void add(int &a, int b) { a += b; if (a >= MOD) a -= MOD; } void dec(int &a, int b) { a -= b; ...
[["+", 31, 16, 31, 69, 341, 342, 0, 16, 31, 13], ["+", 31, 16, 31, 69, 341, 342, 0, 16, 17, 48], ["+", 31, 69, 341, 342, 0, 16, 31, 16, 31, 13], ["+", 31, 69, 341, 342, 0, 16, 31, 16, 17, 48]]
1
251
#include "algorithm" #include "bitset" #include "cassert" #include "climits" #include "cmath" #include "cstdio" #include "ctime" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "str...
#include "algorithm" #include "bitset" #include "cassert" #include "climits" #include "cmath" #include "cstdio" #include "ctime" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "str...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 79]]
1
255
#include <bits/stdc++.h> using namespace std; using int64 = long long; const int mod = 1e9 + 7; // const int mod = 998244353; const int64 infll = (1LL << 62) - 1; const int inf = (1 << 30) - 1; struct IoSetup { IoSetup() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10...
#include <bits/stdc++.h> using namespace std; using int64 = long long; const int mod = 1e9 + 7; // const int mod = 998244353; const int64 infll = (1LL << 62) - 1; const int inf = (1 << 30) - 1; struct IoSetup { IoSetup() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10...
[["-", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 14, 8, 9, 0, 7, 26, 11, 17, 107], ["+", 0, 14, 8, 9, 0, 7, 26, 11, 12, 13]]
1
725
a,b,m = gets.split.map(&:to_i) list_a = gets.split.map(&:to_i) list_b = gets.split.map(&:to_i) discount = [] m.times { discount << gets.split.map(&:to_i) } min = list_a.min + list_b.min discount.each do |ia,ib,d| min = [min,list_a[ia-1] + list_a[ib-1] - d].min end puts min
_,_,m = gets.split.map(&:to_i) list_a = gets.split.map(&:to_i) list_b = gets.split.map(&:to_i) discount = [] m.times { discount << gets.split.map(&:to_i) } min = list_a.min + list_b.min discount.each do |ia,ib,d| min = [min,list_a[ia-1] + list_b[ib-1] - d].min end puts min
[["-", 36, 36, 0, 493, 0, 662, 31, 761, 0, 22], ["+", 36, 36, 0, 493, 0, 662, 31, 761, 0, 22], ["-", 486, 516, 0, 738, 31, 738, 12, 742, 500, 22], ["+", 486, 516, 0, 738, 31, 738, 12, 742, 500, 22]]
4
103
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; const int N = 100005; int A, B, n; int a[N], b[N]; int x[N], y[N], c[N]; int main() { scanf("%d%d%d", &A, &B, &n); for (int i = 1; i <= A; i++) scanf("%d", &a[i]); for (int i = 1; i <= B; i++) scanf("%d", &b[i]); int ans = (...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; const int N = 100005; int A, B, n; int a[N], b[N]; int x[N], y[N], c[N]; int main() { scanf("%d%d%d", &A, &B, &n); for (int i = 1; i <= A; i++) scanf("%d", &a[i]); for (int i = 1; i <= B; i++) scanf("%d", &b[i]); int ans = (...
[["-", 3, 4, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 3, 4, 0, 16, 31, 16, 12, 69, 28, 22]]
1
242
#include <bits/stdc++.h> using namespace std; int A, B, a[100100], b[100100], M; int main() { cin >> A >> B >> M; int mna = 10000000, mnb = 10000000; for (int i = 1; i <= A; i++) scanf("%d", a + i), mna = min(mna, a[i]); for (int i = 1; i <= B; i++) scanf("%d", b + i), mnb = min(mnb, b[i]); int ans = ...
#include <bits/stdc++.h> using namespace std; int A, B, a[100100], b[100100], M; int main() { cin >> A >> B >> M; int mna = 10000000, mnb = 10000000; for (int i = 1; i <= A; i++) scanf("%d", a + i), mna = min(mna, a[i]); for (int i = 1; i <= B; i++) scanf("%d", b + i), mnb = min(mnb, b[i]); int ans = ...
[["-", 3, 4, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 3, 4, 0, 16, 31, 16, 12, 69, 28, 22]]
1
191
a, b, m = map(int, input().split()) a_price = list(map(int, input().split())) b_price = list(map(int, input().split())) coupon = [] for _ in range(m): coupon.append(list(map(int, input().split()))) a_copy = a_price.copy() a_copy.sort() b_copy = b_price.copy() b_copy.sort() a_min = a_copy[0] b_min = b_copy[0] min =...
a, b, m = map(int, input().split()) a_price = list(map(int, input().split())) b_price = list(map(int, input().split())) coupon = [] for _ in range(m): coupon.append(list(map(int, input().split()))) a_copy = a_price.copy() a_copy.sort() b_copy = b_price.copy() b_copy.sort() a_min = a_copy[0] b_min = b_copy[0] min =...
[["-", 0, 662, 12, 657, 31, 657, 31, 206, 51, 22], ["+", 0, 662, 12, 657, 31, 657, 31, 206, 51, 22], ["-", 0, 662, 12, 657, 31, 657, 12, 206, 51, 22], ["+", 0, 662, 12, 657, 31, 657, 12, 206, 51, 22]]
5
182
A, B, M = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) xyc = [list(map(int, input().split())) for _ in range(M)] # print(xyc) cost = [] cost.append(min(a) + min(b)) for x, y, c in xyc: tmp = a[x - 1] + b[y - 1] - c cost.append(tmp) print(cost)
A, B, M = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) xyc = [list(map(int, input().split())) for _ in range(M)] # print(xyc) cost = [] cost.append(min(a) + min(b)) for x, y, c in xyc: tmp = a[x - 1] + b[y - 1] - c cost.append(tmp) print(min(cost))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
133
#include <bits/stdc++.h> using namespace std; int aa[100010], bb[100010]; #define INF 1000000 int main() { cin.tie(0); ios::sync_with_stdio(0); int a, b, m; cin >> a >> b >> m; int mina = INF, minb = INF; for (int i = 0; i < a; i++) { cin >> aa[i]; mina = min(mina, aa[i]); } for (int i = 0...
#include <bits/stdc++.h> using namespace std; int aa[100010], bb[100010]; #define INF 1000000 int main() { cin.tie(0); ios::sync_with_stdio(0); int a, b, m; cin >> a >> b >> m; int mina = INF, minb = INF; for (int i = 0; i < a; i++) { cin >> aa[i]; mina = min(mina, aa[i]); } for (int i = 0...
[["+", 31, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
202
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <numeric> #include <set> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { int A, B, M; int ans = 1000000; int x, y, c; int a_min = 100000; int b_min = 100000; cin >> A >> B >> M; ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <numeric> #include <set> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { int A, B, M; int ans = 1000000; int x, y, c; int a_min = 100000; int b_min = 100000; cin >> A >> B >> M; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
220
A,B,M=map(int,input().split()) a=list(map(int,input().split())) b=list(map(int,input().split())) D=[] for i in range(M): D.append(list(map(int,input().split()))) S=min(a)+min(b) P=[] for i in range(M): P.append(a[D[i][0]-1]+b[D[i][0]-1]-D[i][2]) P.append(S) print(min(P))
A,B,M=map(int,input().split()) a=list(map(int,input().split())) b=list(map(int,input().split())) D=[] for i in range(M): D.append(list(map(int,input().split()))) S=min(a)+min(b) P=[] for i in range(M): P.append(a[D[i][0]-1]+b[D[i][1]-1]-D[i][2]) P.append(S) print(min(P))
[["-", 31, 657, 12, 206, 206, 657, 31, 206, 206, 612], ["+", 31, 657, 12, 206, 206, 657, 31, 206, 206, 612]]
5
158
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) #define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++) #define repr(i, n) for (ll i = n; i >= 0; i--) #define pb push_back #define COUT(x) cout << (x) << "\n" #define COUTF(x) cout << setprecision(15) << (x) << "\n" #define ENDL cout << "\n" #d...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) #define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++) #define repr(i, n) for (ll i = n; i >= 0; i--) #define pb push_back #define COUT(x) cout << (x) << "\n" #define COUTF(x) cout << setprecision(15) << (x) << "\n" #define ENDL cout << "\n" #d...
[["-", 0, 11, 12, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 69, 28, 22]]
1
1,092
def resolve(): a, b, m = map(int, input().split()) a_list = sorted(list(map(int, input().split()))) b_list = sorted(list(map(int, input().split()))) ans = min(a_list) + min(b_list) for _ in range(m): x, y, c = map(int, input().split()) ans = min(ans, a_list[x-1]+b_list[y-1]-c) pr...
def resolve(): a, b, m = map(int, input().split()) a_list = list(map(int, input().split())) b_list = list(map(int, input().split())) ans = min(a_list) + min(b_list) for _ in range(m): x, y, c = map(int, input().split()) ans = min(ans, a_list[x-1]+b_list[y-1]-c) print(ans) resolve...
[["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
129
A, B, M = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = min(a)+min(b) for _ in range(M): x, y, c = map(int, input().split()) ans = min(a[x-1]+b[y-1]-c, ans) prins(ans)
A, B, M = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = min(a)+min(b) for _ in range(M): x, y, c = map(int, input().split()) ans = min(a[x-1]+b[y-1]-c, ans) print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22]]
5
115
a, b, m = map(int, input().split()) a_s = list(map(int, input().split())) b_s = list(map(int, input().split())) m_s =[] for _ in range(m): m_s.append(list(map(int, input().split()))) mini = min(a_s) + min(b_s) for am, bm, sale in m_s: mini = min(mini, a_s[am]+b_s[bm]-sale) print(mini)
a, b, m = map(int, input().split()) a_s = list(map(int, input().split())) b_s = list(map(int, input().split())) m_s =[] for _ in range(m): m_s.append(list(map(int, input().split()))) mini = min(a_s) + min(b_s) for am, bm, sale in m_s: mini = min(mini, a_s[am-1]+b_s[bm-1]-sale) print(mini)
[["+", 0, 657, 31, 657, 31, 206, 206, 657, 17, 33], ["+", 0, 657, 31, 657, 31, 206, 206, 657, 12, 612], ["+", 0, 657, 31, 657, 12, 206, 206, 657, 17, 33], ["+", 0, 657, 31, 657, 12, 206, 206, 657, 12, 612]]
5
126
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int a, b, c, d, mi = 100000000; cin >> a >> b >> c; vector<int> va(a); vector<int> vb(b); int x, y; int mia = 100000000, mib = 100000000; for (int i = 0; i < a; i++) { cin >> ...
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int a, b, c, d, mi = 100000000; cin >> a >> b >> c; vector<int> va(a); vector<int> vb(b); int x, y; int mia = 100000000, mib = 100000000; for (int i = 0; i < a; i++) { cin >> ...
[["-", 0, 11, 12, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
236
# n, m, l = map(int, input().split()) # list_n = list(map(int, input().split())) # n = input() # list = [input() for i in range(N) # list = [[i for i in range(N)] for _ in range(M)] import sys input = sys.stdin.readline A, B, M = map(int, input().split()) List_A = list(map(int, input().split())) List_B = list(map(...
# n, m, l = map(int, input().split()) # list_n = list(map(int, input().split())) # n = input() # list = [input() for i in range(N) # list = [[i for i in range(N)] for _ in range(M)] import sys input = sys.stdin.readline A, B, M = map(int, input().split()) List_A = list(map(int, input().split())) List_B = list(map(...
[["-", 31, 657, 12, 206, 206, 657, 31, 206, 206, 612], ["+", 31, 657, 12, 206, 206, 657, 31, 206, 206, 612]]
5
163
A,B,M = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) min_price = max(a)+max(b) for i in range(M): x,y,c = map(int,input().split()) min_price = min(min_price,a[x-1]+b[y-1]-c) print(min_price)
A,B,M = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) min_price = min(a)+min(b) for i in range(M): x,y,c = map(int,input().split()) min_price = min(min_price,a[x-1]+b[y-1]-c) print(min_price)
[["-", 0, 1, 0, 662, 12, 657, 31, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 657, 31, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 657, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 657, 12, 652, 63, 22]]
5
115
a, b, m = map(int, input().split()) reizo = list(map(int, input().split())) renji = list(map(int, input().split())) p = [list(map(int,input().split())) for i in range(m)] ans = [] for i in range(m): cost = reizo[p[i][0]] + renji[p[i][1]] - p[i][2] ans.append(cost) ans.append(min(reizo) + min(renji)) print(min(ans))
a, b, m = map(int, input().split()) reizo = list(map(int, input().split())) renji = list(map(int, input().split())) p = [list(map(int,input().split())) for i in range(m)] ans = [] for i in range(m): cost = reizo[p[i][0] - 1] + renji[p[i][1] - 1] - p[i][2] ans.append(cost) ans.append(min(reizo) + min(renji)) print(m...
[["+", 12, 657, 31, 657, 31, 206, 206, 657, 17, 33], ["+", 12, 657, 31, 657, 31, 206, 206, 657, 12, 612], ["+", 12, 657, 31, 657, 12, 206, 206, 657, 17, 33], ["+", 12, 657, 31, 657, 12, 206, 206, 657, 12, 612]]
5
148
#include <bits/stdc++.h> #define repl(i, l, r) for (ll i = l; i < r; i++) #define rep(i, n) repl(i, 0, n) using namespace std; using ll = long long; using Graph = vector<vector<int>>; using P = pair<int, int>; const ll INF = 100100100; int main() { int a, b, m; cin >> a >> b >> m; vector<ll> A(a); vector<ll> ...
#include <bits/stdc++.h> #define repl(i, l, r) for (ll i = l; i < r; i++) #define rep(i, n) repl(i, 0, n) using namespace std; using ll = long long; using Graph = vector<vector<int>>; using P = pair<int, int>; const ll INF = 100100100; int main() { int a, b, m; cin >> a >> b >> m; vector<ll> A(a); vector<ll> ...
[["-", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120]]
1
229
#include <iostream> using namespace std; const int maxn = 1e5 + 5; int A, B, M, a[maxn], b[maxn], x[maxn], y[maxn], c[maxn]; int main() { cin >> A >> B >> M; for (int i = 0; i < A; i++) { cin >> a[i]; } for (int i = 0; i < B; i++) { cin >> b[i]; } for (int i = 0; i < M; i++) { cin >> x[i] >> ...
#include <iostream> using namespace std; const int maxn = 1e5 + 5; int A, B, M, a[maxn], b[maxn], x[maxn], y[maxn], c[maxn]; int main() { cin >> A >> B >> M; for (int i = 0; i < A; i++) { cin >> a[i]; } for (int i = 0; i < B; i++) { cin >> b[i]; } for (int i = 0; i < M; i++) { cin >> x[i] >> ...
[["+", 31, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
272
#include <bits/stdc++.h> using namespace std; #define ll long long void read(int &x) { int f = 1; x = 0; char s = getchar(); while (s < '0' || s > '9') { if (s == '-') f = -1; s = getchar(); } while (s >= '0' && s <= '9') { x = x * 10 + s - '0'; s = getchar(); } x *= f; } #define N...
#include <bits/stdc++.h> using namespace std; #define ll long long void read(int &x) { int f = 1; x = 0; char s = getchar(); while (s < '0' || s > '9') { if (s == '-') f = -1; s = getchar(); } while (s >= '0' && s <= '9') { x = x * 10 + s - '0'; s = getchar(); } x *= f; } #define N...
[["-", 0, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["+", 0, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22]]
1
288
#include <algorithm> #include <array> #include <bitset> #include <chrono> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <string> #include <unordered_map> #includ...
#include <algorithm> #include <array> #include <bitset> #include <chrono> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <string> #include <unordered_map> #includ...
[["-", 3, 4, 0, 16, 31, 66, 28, 2, 63, 22], ["+", 3, 4, 0, 16, 31, 66, 28, 2, 63, 22], ["-", 3, 4, 0, 16, 12, 66, 28, 2, 63, 22], ["+", 3, 4, 0, 16, 12, 66, 28, 2, 63, 22]]
1
2,088
#include <stdio.h> int main() { int a, b, m, i, minf, minr, ans; minf = 10 * 10 * 10 * 10 * 10; minr = 10 * 10 * 10 * 10 * 10; scanf("%d %d %d", &a, &b, &m); int frz[a], range[b], x[m], y[m], c[m]; for (i = 0; i < a; ++i) { scanf("%d", &frz[i]); if (minf > frz[i]) minf = frz[i]; } for (...
#include <stdio.h> int main() { int a, b, m, i, minf, minr, ans; minf = 10 * 10 * 10 * 10 * 10; minr = 10 * 10 * 10 * 10 * 10; scanf("%d %d %d", &a, &b, &m); int frz[a], range[b], x[m], y[m], c[m]; for (i = 0; i < a; ++i) { scanf("%d", &frz[i]); if (minf > frz[i]) minf = frz[i]; } for (...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22]]
0
291
require 'pp' $DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|} # 空白区切の入力値を数値の配列で返却する def gets_i_list() gets.chomp.split(" ").map(&:to_i) end # [a, b].min が遅いので def min(a, b) return a < b ? a : b end A, B, M = gets_i_list a_list = gets_i_list b_list = gets_i_list total = a_list.min + b_list.min M....
require 'pp' $DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|} # 空白区切の入力値を数値の配列で返却する def gets_i_list() gets.chomp.split(" ").map(&:to_i) end # [a, b].min が遅いので def min(a, b) return a < b ? a : b end A, B, M = gets_i_list a_list = gets_i_list b_list = gets_i_list total = a_list.min + b_list.min M....
[["-", 0, 738, 31, 738, 12, 742, 0, 738, 31, 22], ["+", 0, 738, 31, 738, 12, 742, 0, 738, 31, 22]]
4
124
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <string> using namespace std; int main() { int A, B, M, *a, *b, x, y, c, minA = pow(10, 5), minB = pow(10, 5), p = 3 * pow(10, 5), tmp = 0; cin >> A >> B >> M; ; a = new int[A]; b = new int[B]...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <string> using namespace std; int main() { int A, B, M, *a, *b, x, y, c, minA = pow(10, 5), minB = pow(10, 5), p = 3 * pow(10, 5), tmp = 0; cin >> A >> B >> M; ; a = new int[A]; b = new int[B]...
[["-", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 69, 28, 22]]
1
256
A,B,M = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) min = min(a)+min(b) for i in range(M): c =list(map(int,input().split())) s = a[c[0]-1]+b[c[1]-1]-c[2] min = min(s,min) print(min)
A,B,M = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) ans = min(a)+min(b) for i in range(M): c =list(map(int,input().split())) s = a[c[0]-1]+b[c[1]-1]-c[2] ans = min(s,ans) print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0...
5
126
A, B, M = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) kingaku=[] for i in range(M): x_input, y_input, c_input = map(int, input().split()) kingaku.append(a[x_input-1]+b[y_input-1]+c_input) kingaku.append(min(a)+min(b)) print(min(kingaku))
#入力処理 A, B, M = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) kingaku=[] for i in range(M): x_input, y_input, c_input = map(int, input().split()) kingaku.append(a[x_input-1]+b[y_input-1]-c_input) kingaku.append(min(a)+min(b)) print(min(kingaku))
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]]
5
123
# coding: utf-8 import re import math import itertools from copy import deepcopy import random from heapq import heappop,heappush import time import os import queue import sys import datetime from functools import lru_cache readline=sys.stdin.readline sys.setrecursionlimit(2000) #import numpy as np alphabet="abcdefghij...
# coding: utf-8 import re import math import itertools from copy import deepcopy import random from heapq import heappop,heappush import time import os import queue import sys import datetime from functools import lru_cache readline=sys.stdin.readline sys.setrecursionlimit(2000) #import numpy as np alphabet="abcdefghij...
[["-", 3, 4, 0, 657, 31, 657, 12, 206, 51, 22], ["+", 3, 4, 0, 657, 31, 657, 12, 206, 51, 22]]
5
2,248
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; /* run this program using the console pauser or add your own getch, * system("pause") or input loop */ #define rep(i, a, b) for (int i = a; i <= b; i++) #define rep2(i, a, b) for (int i = a; i >= b; i--) #define ll long long...
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; /* run this program using the console pauser or add your own getch, * system("pause") or input loop */ #define rep(i, a, b) for (int i = a; i <= b; i++) #define rep2(i, a, b) for (int i = a; i >= b; i--) #define ll long long...
[["+", 12, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
145
#include <bits/stdc++.h> using namespace std; #define ll long long #define fw(p) for (int w = 0; w < (p); w++) #define fx(p) for (int x = 0; x < (p); x++) #define fy(p) for (int y = 0; y < (p); y++) #define fz(p) for (int z = 0; z < (p); z++) #define fyg(p, g) for (int y = (g); y < (p); y++) #define fzg(p, g) for (int...
#include <bits/stdc++.h> using namespace std; #define ll long long #define fw(p) for (int w = 0; w < (p); w++) #define fx(p) for (int x = 0; x < (p); x++) #define fy(p) for (int y = 0; y < (p); y++) #define fz(p) for (int z = 0; z < (p); z++) #define fyg(p, g) for (int y = (g); y < (p); y++) #define fzg(p, g) for (int...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
254
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> #define F first #define S second #define pb push_back #define mp make_pair #define pi acos(-1) using ll = long long; const ll mod = 1000000007; const ll infi = 1000000000000000; const ll md = 998244353;...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> #define F first #define S second #define pb push_back #define mp make_pair #define pi acos(-1) using ll = long long; const ll mod = 1000000007; const ll infi = 1000000000000000; const ll md = 998244353;...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35]]
1
202
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define MAX_INF 0x7f #define MAX_INF_VAL 0x7f7f7f7f #define pi 3.141592653589 #define eps 1e-6 //#define p 2173412051LL //#define sz 2 using namespace std; char s[100]; int main() { int n; scanf("%s", s); n = strlen(s); if (n % 2) {...
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define MAX_INF 0x7f #define MAX_INF_VAL 0x7f7f7f7f #define pi 3.141592653589 #define eps 1e-6 //#define p 2173412051LL //#define sz 2 using namespace std; char s[100]; int main() { int n; scanf("%s", s); n = strlen(s); if (n % 2) {...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
138
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define s second #define f first long long const mod = 1000000007; #define inf 1000000000000000000 inline ll add(ll a, ll b) { return ((a % mod) + (b % mod) + mod) % mod; } inline ll mul(ll a, ll b) { return (((a % mod) * (b %...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define s second #define f first long long const mod = 1000000007; #define inf 1000000000000000000 inline ll add(ll a, ll b) { return ((a % mod) + (b % mod) + mod) % mod; } inline ll mul(ll a, ll b) { return (((a % mod) * (b %...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 110], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32]]
1
362
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define per(i, a, n) for (int i = n - 1; i >= a; i--) #define pb push_back #define mp make_pair #define fi first #define se second #define debug(x) cout << x << endl #define int long long const int mod = 1000000007; int powmo...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define per(i, a, n) for (int i = n - 1; i >= a; i--) #define pb push_back #define mp make_pair #define fi first #define se second #define debug(x) cout << x << endl #define int long long const int mod = 1000000007; int powmo...
[["+", 12, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
362
import re pattern = re.compile("(hi)+") s = input() print("YES" if pattern.fullmatch(s) else "NO")
import re pattern = re.compile("(hi)+") s = input() print("Yes" if pattern.fullmatch(s) else "No")
[["-", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6]]
5
34
<?php $s = str(); for($i = 0; $i <= 5; $i++){ if(str_repeat($s, $i)==$s){ echo "Yes"; exit; } } echo "No"; function str(){ return trim(fgets(STDIN)); } function ints(){ return array_map("intval", explode(" ", trim(fgets(STDIN)))); } function int(){ return intval(trim(fgets(STDIN))); } func...
<?php $s = str(); for($i = 0; $i <= 5; $i++){ if(str_repeat("hi", $i)==$s){ echo "Yes"; exit; } } echo "No"; function str(){ return trim(fgets(STDIN)); } function ints(){ return array_map("intval", explode(" ", trim(fgets(STDIN)))); } function int(){ return intval(trim(fgets(STDIN))); } fu...
[["-", 31, 613, 3, 3, 0, 28, 0, 606, 0, 607], ["-", 31, 613, 3, 3, 0, 28, 0, 606, 0, 141], ["+", 31, 613, 3, 3, 0, 28, 0, 609, 0, 62], ["+", 31, 613, 3, 3, 0, 28, 0, 609, 0, 610]]
6
806
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <time.h> #include <tuple> #include <unis...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <time.h> #include <tuple> #include <unis...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 146], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 147]]
1
393
import bisect import cmath import heapq import itertools import math import operator import os import random import re import string import sys from collections import Counter, deque, defaultdict from copy import deepcopy from decimal import Decimal from math import gcd from functools import lru_cache, reduce from oper...
import bisect import cmath import heapq import itertools import math import operator import os import random import re import string import sys from collections import Counter, deque, defaultdict from copy import deepcopy from decimal import Decimal from math import gcd from functools import lru_cache, reduce from oper...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
171
#include <bits/stdc++.h> const int maxn = 1e5 + 5; char str[maxn]; bool stat = true; int n; int main() { scanf("%s", str + 1); n = strlen(str + 1); for (int i = 1; i < n; i += 2) { if (str[i] != 'h' || str[i + 1] != 'i') stat = false; } if (stat) printf("Yes\n"); else printf("No\n"); }
#include <bits/stdc++.h> const int maxn = 1e5 + 5; char str[maxn]; bool stat = true; int n; int main() { scanf("%s", str + 1); n = strlen(str + 1); for (int i = 1; i <= n; i += 2) { if (str[i] != 'h' || str[i + 1] != 'i') stat = false; } if (stat) printf("Yes\n"); else printf("No\n"); }
[["-", 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> using namespace std; #define ll long long #define FASTINOUT \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie...
#include <bits/stdc++.h> using namespace std; #define ll long long #define FASTINOUT \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 109]]
1
131
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #incl...
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #incl...
[["-", 3, 4, 0, 16, 12, 16, 12, 5, 0, 6], ["+", 3, 4, 0, 16, 12, 16, 12, 5, 0, 6]]
1
2,120
#include <bits/stdc++.h> using namespace std; int main() { char str[15]; scanf("%s", str); int l = strlen(str); for (int i = 0; i < l; i++) { if (i % 2 == 0 && str[i] != 'h') { printf("No"); return 0; } else if (i % 2 == 1 && str[i] != 'i') { printf("No"); return 0; } } ...
#include <bits/stdc++.h> using namespace std; int main() { char str[15]; scanf("%s", str); int l = strlen(str); for (int i = 0; i < l; i++) { if (i % 2 == 0 && str[i] != 'h') { printf("No"); return 0; } else if (i % 2 == 1 && str[i] != 'i') { printf("No"); return 0; } } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
131
#include <bits/stdc++.h> #define int long long using namespace std; string s; main() { cin >> s; if (s.size() % 2 == 1) { cout << "NO"; return 0; } string a = ""; for (int k = 0; k < s.size(); k += 2) a += "hi"; if (a == s) cout << "YES"; else cout << "NO"; return 0; }
#include <bits/stdc++.h> #define int long long using namespace std; string s; main() { cin >> s; if (s.size() % 2 == 1) { cout << "No"; return 0; } string a = ""; for (int k = 0; k < s.size(); k += 2) a += "hi"; if (a == s) cout << "Yes"; else cout << "No"; return 0; }
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]]
1
97
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; template <typename X> ostream &operator<<(ostream &x, const vector<X> &v) { for (ll i = 0; i < v.size(); ++i) x << v[i] << " "; return x; } template <typename X> ostream &operator<<(ostream &x, const set<X> &v) { for (...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; template <typename X> ostream &operator<<(ostream &x, const vector<X> &v) { for (ll i = 0; i < v.size(); ++i) x << v[i] << " "; return x; } template <typename X> ostream &operator<<(ostream &x, const set<X> &v) { for (...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
468
import sys import heapq import re from itertools import permutations from bisect import bisect_left, bisect_right from collections import Counter, deque from math import gcd from math import factorial, sqrt from functools import lru_cache, reduce INF = 1 << 60 mod = 1000000007 sys.setrecursionlimit(10 ** 7) input = sys...
import sys import heapq import re from itertools import permutations from bisect import bisect_left, bisect_right from collections import Counter, deque from math import gcd from math import factorial, sqrt from functools import lru_cache, reduce INF = 1 << 60 mod = 1000000007 sys.setrecursionlimit(10 ** 7) input = sys...
[["-", 3, 4, 0, 657, 31, 657, 12, 206, 51, 22], ["+", 3, 4, 0, 657, 31, 657, 12, 206, 51, 22]]
5
843
A, B, M = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) dis = [] for i in range(M): dis.append(list(map(int, input().split()))) total = [] total.append(min(a) + min(b)) for k in range(M): x = dis[k][0] - 1 y = dis[k][1] - 1 c = dis[k][2] - 1 discount = a...
A, B, M = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) dis = [] for i in range(M): dis.append(list(map(int, input().split()))) total = [] total.append(min(a) + min(b)) for k in range(M): x = dis[k][0] - 1 y = dis[k][1] - 1 c = dis[k][2] discount = a[x] ...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
169
#include <bits/stdc++.h> using namespace std; int main() { int A, B, M; cin >> A >> B >> M; vector<int> a(A); for (int i = 0; i < A; ++i) cin >> a[i]; vector<int> b(B); for (int i = 0; i < B; ++i) cin >> b[i]; int minA = *min_element(a.begin(), a.end()); int minB = *min_element(b.begin(), b.e...
#include <bits/stdc++.h> using namespace std; int main() { int A, B, M; cin >> A >> B >> M; vector<int> a(A); for (int i = 0; i < A; ++i) cin >> a[i]; vector<int> b(B); for (int i = 0; i < B; ++i) cin >> b[i]; int minA = *min_element(a.begin(), a.end()); int minB = *min_element(b.begin(), b.e...
[["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33]]
1
197
a, b, m = map(int, input().split()) A = [int(ae) for ae in input().split()] B = [int(be) for be in input().split()] amin = min(A) bmin = min(B) smin = amin + bmin for i in range(m): x, y, c= map(int, input().split()) th = smin -c apmin = A[x-1] if apmin > th: pass else: bpmin = B[y-1] spmin = ap...
a, b, m = map(int, input().split()) A = [int(ae) for ae in input().split()] B = [int(be) for be in input().split()] amin = min(A) bmin = min(B) smin = amin + bmin for i in range(m): x, y, c= map(int, input().split()) th = smin + c apmin = A[x-1] if apmin > th: pass else: bpmin = B[y-1] spmin = a...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72]]
5
148
import cmath import sys INF=10**18 MOD=10**9+7 MAX=10**5+7 def main(): A,B,M=map(int, input().split()) a=list(map(int, input().split())) b=list(map(int, input().split())) ans=min(a)+min(b) for i in range(M): x,y,c=map(int, input().split()) x-=1 y-=1 ans=max(ans, a[x]+b[y]-c) print(...
import cmath import sys INF=10**18 MOD=10**9+7 MAX=10**5+7 def main(): A,B,M=map(int, input().split()) a=list(map(int, input().split())) b=list(map(int, input().split())) ans=min(a)+min(b) for i in range(M): x,y,c=map(int, input().split()) x-=1 y-=1 ans=min(ans, a[x]+b[y]-c) print(...
[["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22]]
5
155
a, b, m = gets.chomp.split(' ').map(&:to_i) c = gets.chomp.split(' ').map(&:to_i) d = gets.chomp.split(' ').map(&:to_i) g = 0 m.times do |i| a,b,e = gets.chomp.split(' ').map(&:to_i) g = [g, (c[a-1] + d[b - 1] - e)].min end puts [g, (c.min + d.min)].min
a, b, m = gets.chomp.split(' ').map(&:to_i) c = gets.chomp.split(' ').map(&:to_i) d = gets.chomp.split(' ').map(&:to_i) g = 10000000000000000000000000 m.times do |i| a,b,e = gets.chomp.split(' ').map(&:to_i) g = [g, (c[a-1] + d[b - 1] - e)].min end puts [g, (c.min + d.min)].min
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612]]
4
132
a,b,m=map(int,input().split()) price_A=list(map(int,input().split())) price_B=list(map(int,input().split())) coupon=[] for _ in range(m): coupon.append(list(map(int,input().split()))) ans=min(price_A)+min(price_B[0]) for i in range(m): deprice=price_A[coupon[i][0]-1]+price_B[coupon[i][1]-1]-coupon[i][2] if depric...
a,b,m=map(int,input().split()) price_A=list(map(int,input().split())) price_B=list(map(int,input().split())) coupon=[] for _ in range(m): coupon.append(list(map(int,input().split()))) ans=min(price_A)+min(price_B) for i in range(m): deprice=price_A[coupon[i][0]-1]+price_B[coupon[i][1]-1]-coupon[i][2] if deprice <...
[["-", 12, 657, 12, 652, 3, 4, 0, 206, 0, 70], ["-", 12, 657, 12, 652, 3, 4, 0, 206, 206, 612], ["-", 12, 657, 12, 652, 3, 4, 0, 206, 0, 73]]
5
153
#include <limits.h> #include <stdio.h> #include <stdlib.h> int *A, *B; int an, bn, mn; int min(int a, int b) { return a > b ? b : a; } int main(void) { int i, j; int sp; scanf("%d %d %d", &an, &bn, &mn); A = (int *)malloc(sizeof(int) * an); B = (int *)malloc(sizeof(int) * bn); int sa = INT_MAX, sb = ...
#include <limits.h> #include <stdio.h> #include <stdlib.h> int *A, *B; int an, bn, mn; int min(int a, int b) { return a > b ? b : a; } int main(void) { int i, j; int sp; scanf("%d %d %d", &an, &bn, &mn); A = (int *)malloc(sizeof(int) * an); B = (int *)malloc(sizeof(int) * bn); int sa = INT_MAX, sb = ...
[["-", 31, 16, 31, 16, 12, 69, 71, 16, 31, 22], ["+", 31, 16, 31, 16, 12, 69, 71, 16, 31, 22], ["-", 12, 16, 31, 16, 12, 69, 71, 16, 31, 22], ["+", 12, 16, 31, 16, 12, 69, 71, 16, 31, 22]]
0
293
numA, numB, numCoupon = map(int, input().split(' ')) priceA = map(int, input().split(' ')) priceB = map(int, input().split(' ')) # initial best price bestPrice = min(priceA) + min(priceB) for n in range(numCoupon): # get coupon details typeA, typeB, discount = map(int, input().split(' ')) # calculate price when...
numA, numB, numCoupon = map(int, input().split(' ')) priceA = list(map(int, input().split(' '))) priceB = list(map(int, input().split(' '))) # initial best price bestPrice = min(priceA) + min(priceB) for n in range(numCoupon): # get coupon details typeA, typeB, discount = map(int, input().split(' ')) # calculat...
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
128
A, B, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) l = [input().split() for i in range(m)] ans = min(a) + min(b) for i in range(m): ai = a[int(l[i][0]) - 1] bi = b[int(l[i][1]) - 1] ci = int(l[i][2]) nc = ai + bi - ci ans = min(ans, nc) print(...
A, B, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) l = [input().split() for i in range(m)] ans = min(a) + min(b) for i in range(m): ai = a[int(l[i][0]) - 1] bi = b[int(l[i][1]) - 1] ci = int(l[i][2]) nc = ai + bi - ci ans = min(ans, nc) print...
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]]
5
154
listA=[] while True: try: listA.append(list(map(int,input().split()))) except: break; money = min(listA[1]) + min(listA[2]) for k in range(listA[0][2]): wari = 1000 a = listA[k+3][0] b = listA[k+3][1] if wari > listA[1][a-1] + listA[2][b-1] - listA[k+3][2]: ...
listA=[] while True: try: listA.append(list(map(int,input().split()))) except: break; money = min(listA[1]) + min(listA[2]) wari = 100000000 for k in range(listA[0][2]): a = listA[k+3][0] b = listA[k+3][1] if wari > listA[1][a-1] + listA[2][b-1] - listA[k+3][2]: ...
[["+", 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
168
A, B, M = map(int, input().split()) a = [int(i) for i in input().split] b = [int(i) for i in input().split] ans = min(a) + min(b) for i in range(M): x, y, c = map(int, input().split()) val = a[x-1] + b[y-1] - c ans = min(ans, val) print(ans)
A, B, M = map(int, input().split()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] ans = min(a) + min(b) for i in range(M): x, y, c = map(int, input().split()) val = a[x-1] + b[y-1] - c ans = min(ans, val) print(ans)
[["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 24], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 25]]
5
116
A, B, M = map(int, input().split()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] data = [list(map(int, input().split())) for _ in range(M)] aMIN = min(a) bMIN = min(b) MIN = aMIN + bMIN for k in data: min(MIN, a[k[0]-1]+b[k[1]-1]-k[2]) print(MIN)
A, B, M = map(int, input().split()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] data = [list(map(int, input().split())) for _ in range(M)] aMIN = min(a) bMIN = min(b) MIN = aMIN + bMIN for k in data: MIN = min(MIN, a[k[0]-1]+b[k[1]-1]-k[2]) print(MIN)
[["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32]]
5
135
_, _, M = map(int, input().split(" ")) a = list(map(int, input().split(" "))) b = list(map(int, input().split(" "))) min = min(a) + min(b) for i in range(M): x, y, c = map(int, input().split(" ")) s = a[x] + b[y] - c if min > s: min = s print(min)
_, _, M = map(int, input().split(" ")) a = list(map(int, input().split(" "))) b = list(map(int, input().split(" "))) min = min(a) + min(b) for i in range(M): x, y, c = map(int, input().split(" ")) s = a[x-1] + b[y-1] - c if min > s: min = s print(min)
[["+", 12, 657, 31, 657, 31, 206, 206, 657, 17, 33], ["+", 12, 657, 31, 657, 31, 206, 206, 657, 12, 612], ["+", 12, 657, 31, 657, 12, 206, 206, 657, 17, 33], ["+", 12, 657, 31, 657, 12, 206, 206, 657, 12, 612]]
5
126
G =-> {gets.split.map &:to_i} *,M = G[] A = G[] B = G[] v = A.min+B.min M.times { a,b,c = G[] c = A[a-1]+B[b-1]+c v = c if v > c } p v
G =-> {gets.split.map &:to_i} *,M = G[] A = G[] B = G[] v = A.min+B.min M.times { a,b,c = G[] c = A[a-1]+B[b-1]-c v = c if v > c } p v
[["-", 196, 196, 8, 734, 0, 662, 12, 738, 17, 72], ["+", 196, 196, 8, 734, 0, 662, 12, 738, 17, 33]]
4
78
#B a,b,m=map(int,input().split()) al=list(map(int,input().split())) bl=list(map(int,input().split())) amin=min(al) bmin=min(bl) minp=amin+bmin print(amin,bmin) for i in range(m): num=list(map(int,input().split())) price=al[num[0]-1]+bl[num[1]-1]-num[2] minp=min(price,minp) print(minp)
#B a,b,m=map(int,input().split()) al=list(map(int,input().split())) bl=list(map(int,input().split())) amin=min(al) bmin=min(bl) minp=amin+bmin for i in range(m): num=list(map(int,input().split())) price=al[num[0]-1]+bl[num[1]-1]-num[2] minp=min(price,minp) print(minp)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
139
a,b,m = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) xyc = [map(int,input().split()) for i in range(m)] ans = 100000000 for i in range(m): x,y,c = xyc[i] cost = A[x-1] + B[y-1] - c if ans > cost: ans = cost if cost > min(A) + min(B): ans = mi...
a,b,m = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) xyc = [map(int,input().split()) for i in range(m)] ans = 100000000 for i in range(m): x,y,c = xyc[i] cost = A[x-1] + B[y-1] - c if ans > cost: ans = cost if ans > min(A) + min(B): ans = min...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
149
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; int main() { int A, B, M; cin >> A >> B >> M; vector<int> a(A), b(B); fo...
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; int main() { int A, B, M; cin >> A >> B >> M; vector<int> a(A), b(B); fo...
[["-", 31, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 31, 22]]
1
208