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; int main() { string s; cin >> s; int ans = 0; for (int i = 0; i < s.size(); i++) ans += s[i]; if (ans % 9 == 0) cout << "Yes"; else cout << "No"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int ans = 0; for (int i = 0; i < s.size(); i++) ans += (s[i] - '0'); // cout<<ans<<endl; if (ans % 9 == 0) cout << "Yes"; else cout << "No"; return 0; }
[["+", 0, 7, 8, 1, 0, 11, 12, 23, 0, 24], ["+", 8, 1, 0, 11, 12, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 23, 0, 16, 12, 103, 0, 104], ["+", 0, 11, 12, 23, 0, 16, 12, 103, 0, 125], ["+", 0, 7, 8, 1, 0, 11, 12, 23, 0, 25]]
1
73
#include <bits/stdc++.h> using namespace std; #define pb push_back #define endl '\n' #define mod 1000000007 #define forn(i, n) for (int i = 0; i < (int)(n); i++) #define REPa(i, b) for (int i = 1; i <= b; i++) #define REP(i, n) for (int i = 0; i < n; i++) #define init(arr, value) memset(arr, value, sizeof(arr)) #define...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define endl '\n' #define mod 1000000007 #define forn(i, n) for (int i = 0; i < (int)(n); i++) #define REPa(i, b) for (int i = 1; i <= b; i++) #define REP(i, n) for (int i = 0; i < n; i++) #define init(arr, value) memset(arr, value, sizeof(arr)) #define...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
398
import java.util.Scanner; public class Main { private static Scanner sc; public static void main(String[] args) { sc = new Scanner(System.in); String n = sc.next(); String[] nArray = n.split(""); long sum = 0; for (String nChar : nArray) { sum += nChar.length(); } if (0 == (sum ...
import java.util.Scanner; public class Main { private static Scanner sc; public static void main(String[] args) { sc = new Scanner(System.in); String n = sc.next(); String[] nArray = n.split(""); long sum = 0; for (String nChar : nArray) { sum += Integer.parseInt(nChar); } if (0...
[["-", 8, 196, 0, 1, 0, 11, 12, 492, 500, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 492, 500, 22], ["-", 8, 196, 0, 1, 0, 11, 12, 492, 141, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 492, 141, 22], ["+", 0, 1, 0, 11, 12, 492, 3, 4, 0, 22]]
3
120
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) typedef long long ll; typedef std::vector<long long> vll; typedef std::vector<std::vector<long long>> vvll; typedef long double ld; typedef std::vector<long double> vld; typedef std::vector<std::vector<long double>> vvld; using namespace std; v...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) typedef long long ll; typedef std::vector<long long> vll; typedef std::vector<std::vector<long long>> vvll; typedef long double ld; typedef std::vector<long double> vld; typedef std::vector<std::vector<long double>> vvld; using namespace std; v...
[["+", 0, 9, 0, 1, 0, 11, 12, 23, 0, 24], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 17, 33], ["+", 0, 9, 0, 1, 0, 11, 12, 23, 0, 25]]
1
183
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back typedef pair<int, int> pii; typedef long long ll; string s; int len; int sum; int dig; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ...
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back typedef pair<int, int> pii; typedef long long ll; string s; int len; int sum; int dig; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.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
151
#include <bits/stdc++.h> #define dbug printf("I am here\n"); #define Fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); #define vs v.size() #define sot(v) sort(v.begin(), v.end()) #define rev(v) reverse(...
#include <bits/stdc++.h> #define dbug printf("I am here\n"); #define Fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); #define vs v.size() #define sot(v) sort(v.begin(), v.end()) #define rev(v) reverse(...
[["-", 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
168
#include <bits/stdc++.h> #define int long long using namespace std; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); //////////////////////////////// string s; cin >> s; int res = 0; for (int i = 0; i < (int)s.length(); i++) { res = (res * 10 + (s[i] - '0')) % 9; } if...
#include <bits/stdc++.h> #define int long long using namespace std; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); //////////////////////////////// string s; cin >> s; int res = 0; for (int i = 0; i < (int)s.length(); i++) { res = (res * 10 + (s[i] - '0')) % 9; } if...
[["-", 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
117
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define IOS \ { \ io...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define IOS \ { \ io...
[["-", 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
445
#include <bits/stdc++.h> using namespace std; char s[200005]; int main() { int i, n = 0; scanf("%s", s + 1); for (i = 1; s[i]; i++) n += (s[i] - '0'); if (n % 9 == 0) printf("YES\n"); else printf("NO\n"); return 0; }
#include <bits/stdc++.h> using namespace std; char s[200010]; int main() { int i, n = 0; scanf("%s", s + 1); for (i = 1; s[i]; i++) n += (s[i] - '0'); if (n % 9 == 0) printf("Yes\n"); else printf("No\n"); return 0; }
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 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
91
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int INF = 1e9; int main() { string s; cin >> s; int sum = 0; for (int i = 0; i < s.size(); i++) { sum += s[i] + '0'; } string ans = "No"; if (sum % 9 == 0) ans = "Yes"; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int INF = 1e9; int main() { string s; cin >> s; int sum = 0; for (int i = 0; i < s.size(); i++) { sum += s[i] - '0'; } // cout << sum << endl; string ans = "No"; if (sum % 9 == 0) ans = "Yes"; cout << ans << endl...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33]]
1
97
#include <bits/stdc++.h> //#include <ext/pb_ds/detail/standard_policies.hpp> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define ll long long #define int long long #define pb push_back #define ins insert #define rs resize #define br break; #define cont continue; #define vi vector<i...
#include <bits/stdc++.h> //#include <ext/pb_ds/detail/standard_policies.hpp> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define ll long long #define int long long #define pb push_back #define ins insert #define rs resize #define br break; #define cont continue; #define vi vector<i...
[["-", 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
287
from collections import defaultdict,deque import math def main(): n = input() tmp = 0 for i in range(len(n)): tmp += int(n) tmp%=9 if(tmp%9==0): print("Yes") else: print("No") if __name__ == '__main__': main()
from collections import defaultdict,deque import math def main(): n = input() tmp = 0 for i in range(len(n)): tmp += int(n[i]) tmp%=9 if(tmp%9==0): print("Yes") else: print("No") if __name__ == '__main__': main()
[["+", 0, 677, 12, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 677, 12, 652, 3, 4, 0, 206, 206, 22], ["+", 0, 677, 12, 652, 3, 4, 0, 206, 0, 73]]
5
74
#include <bits/stdc++.h> #define repl(i, l, r) for (int i = l; i < r; i++) #define rep(i, n) repl(i, 0, n) using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; int main() { string n; cin >> n; int x = 0; rep(i, n.size()) { x += n[i]; } if (x % 9 == 0) cout << "Yes"...
#include <bits/stdc++.h> #define repl(i, l, r) for (int i = l; i < r; i++) #define rep(i, n) repl(i, 0, n) using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; int main() { string n; cin >> n; int x = 0; rep(i, n.size()) { x += n[i] - '0'; } if (x % 9 == 0) cout <<...
[["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 104], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125]]
1
112
#include <bits/stdc++.h> using namespace std; #define ll long long int #define FUP(i, a, b) for (int i = a; i <= b; i++) #define FDOWN(i, a, b) for (int i = a; i >= b; i--) #define MS(a, b) memset(a, b, sizeof(a)) #define ALL(v) v.begin(), v.end() #define CIN(a) cin >> a; #define CIN2(a, b) cin >> a >> b #define CIN3(a...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define FUP(i, a, b) for (int i = a; i <= b; i++) #define FDOWN(i, a, b) for (int i = a; i >= b; i--) #define MS(a, b) memset(a, b, sizeof(a)) #define ALL(v) v.begin(), v.end() #define CIN(a) cin >> a; #define CIN2(a, b) cin >> a >> b #define CIN3(a...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 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
211
def main(): n = map(int, list(input())) ret = 0 for i in n: ret += i ret %= 9 if ret == 0: print("Yes") else: print("no") if __name__ == "__main__": main()
def main(): n = map(int, list(input())) ret = 0 for i in n: ret += i ret %= 9 if ret == 0: print("Yes") else: print("No") if __name__ == "__main__": main()
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
61
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int sum = 0; for (int i = 0; i < (int)s.size(); ++i) { sum += (s[i] - '0'); } if (sum % 9 == 0) cout << "YES\n"; else cout << "NO\n"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int sum = 0; for (int i = 0; i < (int)s.size(); ++i) { sum += (s[i] - '0'); } if (sum % 9 == 0) 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
86
#include <bits/stdc++.h> // Common using namespace std; using f64 = double; using i64 = long long; using u64 = unsigned long long; template <typename T> using Arr = vector<T>; template <typename T> using Func = function<T>; template <typename T> using Str = basic_string<T>; #define hfor(v, s, e) ...
#include <bits/stdc++.h> // Common using namespace std; using f64 = double; using i64 = long long; using u64 = unsigned long long; template <typename T> using Arr = vector<T>; template <typename T> using Func = function<T>; template <typename T> using Str = basic_string<T>; #define hfor(v, s, e) ...
[["-", 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
1,272
/* Ujjawal Pabreja [cuber_coder] */ #include <bits/stdc++.h> #include <functional> using namespace std; #define speed_cubing \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
/* Ujjawal Pabreja [cuber_coder] */ #include <bits/stdc++.h> #include <functional> using namespace std; #define speed_cubing \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
[["-", 0, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 0, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 0, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 0, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
450
#define taskname "test" #include <bits/stdc++.h> using namespace std; #define sz(x) (int)x.size() #define fi first #define se second typedef long long lli; typedef pair<int, int> pii; string s; void read_input() { cin >> s; } void solve() { int sum = 0; for (int i = 0; i < sz(s); ++i) sum += s[i] - '0'; ...
#define taskname "test" #include <bits/stdc++.h> using namespace std; #define sz(x) (int)x.size() #define fi first #define se second typedef long long lli; typedef pair<int, int> pii; string s; void read_input() { cin >> s; } void solve() { int sum = 0; for (int i = 0; i < sz(s); ++i) sum += s[i] - '0'; ...
[["-", 0, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 0, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 0, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 0, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
133
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> using namespace std; // bool cmp(long long a, long long b){ // ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> using namespace std; // bool cmp(long long a, long long b){ // ...
[["-", 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
585
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define REP(i, start, end) for (ll i = start, i##Len = (end); i < i##Len; ++i) #define REPR(i, start, end) for (ll i = start, i##Len = (end); i > i##Len; --i) using ll = long long; using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define REP(i, start, end) for (ll i = start, i##Len = (end); i < i##Len; ++i) #define REPR(i, start, end) for (ll i = start, i##Len = (end); i > i##Len; --i) using ll = long long; using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ...
[["-", 12, 23, 0, 41, 15, 16, 31, 16, 17, 47], ["-", 12, 23, 0, 41, 15, 16, 31, 16, 12, 13], ["-", 31, 16, 12, 23, 0, 41, 15, 16, 17, 98], ["-", 0, 41, 15, 16, 12, 16, 31, 16, 31, 22]]
1
115
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep3(i, m, n) for (int(i) = m; (i) <= (n); (i)++) #define rep3rev(i, m, n) for (int(i) = m; (i) >= (n); (i)--) #define all(a) (a.begin()), (a.end()) #define rall(a) (a.rbegin()), (a.rend()) #define fi first #defi...
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep3(i, m, n) for (int(i) = m; (i) <= (n); (i)++) #define rep3rev(i, m, n) for (int(i) = m; (i) >= (n); (i)--) #define all(a) (a.begin()), (a.end()) #define rall(a) (a.rbegin()), (a.rend()) #define fi first #defi...
[["-", 8, 9, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 12, 13]]
1
206
import static java.lang.Long.max; import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class Main { static class Pair { int num; int cut; Pair(int num, int cut) { this.num = num; this.cut = cut; } double getVal() { return -num / (double)cut; } } ...
import static java.lang.Long.max; import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class Main { static class Pair { int num; int cut; Pair(int num, int cut) { this.num = num; this.cut = cut; } double getVal() { return -num / (double)cut; } } ...
[["-", 49, 200, 51, 492, 3, 4, 0, 5, 0, 62], ["-", 49, 200, 51, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 503, 49, 200, 51, 492, 3, 4, 0, 252]]
3
1,035
# t=int(input()) # for _ in range(t): # n=int(input()) # arr=[int(x) for x in input().split()] n=int(input()) if n%9 == 0: print("Yes") else: print("N0")
# t=int(input()) # for _ in range(t): # n=int(input()) # arr=[int(x) for x in input().split()] n=int(input()) if n%9 == 0: print("Yes") else: print("No")
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
33
#include <bits/stdc++.h> using namespace std; #define ll long long void test_case() { string s; cin >> s; // cout<<s; ll total = 0; for (char &ch : s) { total += ch - '0'; } if (total % 9 == 0) cout << "YES"; else cout << "NO"; return; } int main() { //#ifndef ONLINE_JUDGE // freopen(...
#include <bits/stdc++.h> using namespace std; #define ll long long void test_case() { string s; cin >> s; // cout<<s; ll total = 0; for (char &ch : s) { total += ch - '0'; } if (total % 9 == 0) cout << "Yes"; else cout << "No"; return; } int main() { //#ifndef ONLINE_JUDGE // freopen(...
[["-", 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
94
<?php fscanf(STDIN, "%d", $n); $arr = str_split($n); $sum=array_sum($arr); //echo $sum; if($sum%9==0){ echo "Yes"; }else{ echo "No"; }
<?php fscanf(STDIN, "%s", $n); //echo $n; $arr = str_split($n); //print_r($arr); $sum=array_sum($arr); //echo $sum; if($sum%9==0){ echo "Yes"; }else{ echo "No"; }
[["-", 0, 613, 3, 3, 0, 28, 0, 609, 0, 610], ["+", 0, 613, 3, 3, 0, 28, 0, 609, 0, 610]]
6
56
N = str(input()) count = 0 for i in range(len(N)): count = count + int(N[i]) print(count) if (count/9) - (count//9) == 0: print("Yes") else: print("No")
N = str(input()) count = 0 for i in range(len(N)): count = count + int(N[i]) if (count/9) - (count//9) == 0: print("Yes") else: print("No")
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
66
#include <bits/stdc++.h> using namespace std; #define LL long long int #define L long int #define IM INT_MAX #define Im INT_MIN #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define LL long long int #define L long int #define IM INT_MAX #define Im INT_MIN #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
[["-", 8, 1, 0, 11, 12, 23, 0, 42, 0, 32], ["+", 8, 1, 0, 11, 12, 23, 0, 16, 17, 33]]
1
124
n=input() c= 0 for i in range(len(n)): c= c+int(i) if(c%9==0): print("Yes") else: print("No")
n=input() c= 0 for i in range(len(n)): c= c+int(n[i]) if(c%9==0): print("Yes") else: print("No")
[["+", 12, 657, 12, 652, 3, 4, 0, 206, 51, 22], ["+", 12, 657, 12, 652, 3, 4, 0, 206, 0, 70], ["+", 12, 657, 12, 652, 3, 4, 0, 206, 0, 73]]
5
50
#include <bits/stdc++.h> using namespace std; int main() { string N; cin >> N; long long total = 0; for (int i = 0; i < N.size(); i++) { total += int(i); } if (total % 9 == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { string N; cin >> N; long long total = 0; for (int i = 0; i < N.size(); i++) { total += N.at(i) - '0'; } if (total % 9 == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
[["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 40], ["+", 0, 11, 12, 16, 31, 2, 63, 118, 28, 22], ["+", 0, 11, 12, 16, 31, 2, 63, 118, 17, 131], ["+", 0, 11, 12, 16, 31, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 104], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125]]
1
81
N=int(input()) S=0 N=str(N) for i in N: S+=int(i) if S%9==0: print("YES") else: print("NO")
N=int(input()) S=0 N=str(N) for i in N: S+=int(i) if S%9==0: print("Yes") else: print("No")
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
49
#include <math.h> #include <stdio.h> #include <string.h> #include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> constexpr long long INFLL = 1e18; using namespace std; using ll = long long; using P = pair<int, int>; int main() { ...
#include <math.h> #include <stdio.h> #include <string.h> #include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> constexpr long long INFLL = 1e18; using namespace std; using ll = long long; using P = pair<int, int>; int main() { ...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 104], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125]]
1
128
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { string number; getline(cin, number); long long int count = 0; for (long unsigned int i = 0; i < number.size(); i++) count += int(number[i]) - 48; if (count % 9 == 0) cout << "YES"; else { cout << "NO"; } return 0;...
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { string number; getline(cin, number); long long int count = 0; for (long unsigned int i = 0; i < number.size(); i++) count += int(number[i]) - 48; if (count % 9 == 0) cout << "Yes"; else { cout << "No"; } return 0;...
[["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
89
N = input() L = len(N) S = 0 for i in range(L - 1): S += int(N[i]) if S % 9 == 0: print("Yes") else: print("No")
N = input() L = len(N) S = 0 for i in range(L): S += int(N[i]) if S % 9 == 0: print("Yes") else: print("No")
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
54
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define inf 10000000002 #define pb push_back #define loop(i, a, b) for (ll i = a; i < b; i++) #define MAX 100 #define yes cout << "YES" << endl #define no cout << "NO" << endl #define bye return 0 int main() { ios_base::sync_with_s...
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define inf 10000000002 #define pb push_back #define loop(i, a, b) for (ll i = a; i < b; i++) #define MAX 100 #define yes cout << "YES" << endl #define no cout << "NO" << endl #define bye return 0 int main() { ios_base::sync_with_s...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
144
//#include <bits/stdc++.h> #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define fast_io() ...
//#include <bits/stdc++.h> #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define fast_io() ...
[["+", 0, 338, 8, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 338, 8, 1, 0, 11, 12, 16, 12, 13]]
1
107
package main import ( "fmt" "strconv" ) func main() { var n string fmt.Scan(&n) var sum int sum = 0 for _, c := range n { a, _ := strconv.Atoi(string([]rune{c})) sum = sum + int(a) } fmt.Println(sum) if sum%9 == 0 { fmt.Println("Yes") } else { fmt.Println("No") } }
package main import ( "fmt" "strconv" ) func main() { var n string fmt.Scan(&n) var sum int sum = 0 for _, c := range n { a, _ := strconv.Atoi(string([]rune{c})) sum = sum + int(a) } if sum%9 == 0 { fmt.Println("Yes") } else { fmt.Println("No") } }
[["-", 8, 196, 0, 1, 0, 2, 63, 438, 439, 22], ["-", 8, 196, 0, 1, 0, 2, 63, 438, 0, 131], ["-", 8, 196, 0, 1, 0, 2, 63, 438, 119, 120], ["-", 8, 196, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 36, 36, 0, 434, 0, 435, 8, 196, 0, 165]]
7
117
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 1e6 + 5, M = 1e9 + 7; void solve() { string s; cin >> s; int sum = 0; for (int i = 0; i < s.size(); ++i) sum += (s[i] - '0'); if (sum % 9 == 0) cout << "YES"; else cout << "NO"; } main() { ios ::sync_with_std...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 1e6 + 5, M = 1e9 + 7; void solve() { string s; cin >> s; int sum = 0; for (int i = 0; i < s.size(); ++i) sum += (s[i] - '0'); if (sum % 9 == 0) cout << "Yes"; else cout << "No"; } main() { ios ::sync_with_std...
[["-", 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
141
a = int(input()) print("Yes" if a % 9 == 0 and a != 0 else "No")
a = int(input()) print("Yes" if a % 9 == 0 else "No")
[["-", 0, 652, 3, 4, 0, 41, 0, 679, 17, 355], ["-", 3, 4, 0, 41, 0, 679, 12, 666, 0, 22], ["-", 3, 4, 0, 41, 0, 679, 12, 666, 667, 79], ["-", 3, 4, 0, 41, 0, 679, 12, 666, 0, 612]]
5
28
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define RREP(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; int main(void) { char c; int ans = 0; while (cin >> c) { ans = a...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define RREP(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; int main(void) { char c; int ans = 0; while (cin >> c) { ans = (...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 12, 74, 51, 23, 0, 25]]
1
111
N = str(input()) result = sum(list(map(int, N))) if result ==0: print('No') elif result%9 ==0: print('Yes') else: print('No')
N = str(input()) result = sum(list(map(int, N))) if result ==0: print('Yes') elif result%9 ==0: print('Yes') else: print('No')
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
54
#include <cmath> #include <cstdio> #include <cstring> #include <iostream> using namespace std; char a[10005]; int main() { scanf("%s", a + 1); int s = 0; for (int i = 1; i <= strlen(a); i++) { s += a[i] - '0'; } if (s % 9 == 0) printf("Yes"); else printf("No"); return 0; }
#include <cmath> #include <cstdio> #include <cstring> #include <iostream> using namespace std; char a[1000005]; int main() { scanf("%s", a + 1); int s = 0; for (int i = 1; i <= strlen(a + 1); i++) { s += a[i] - '0'; } if (s % 9 == 0) printf("Yes"); else printf("No"); return 0; }
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 15, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 15, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
96
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define T \ int time; \ scanf("%d", &time); ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define T \ int time; \ scanf("%d", &time); ...
[["-", 0, 1, 0, 11, 12, 16, 31, 69, 28, 22], ["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 70], ["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 22], ["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22]]
1
106
#include "bits/stdc++.h" using namespace std; #define mx 100001 #define ll long long #define llu long long unsigned #define pb push_back #define s(v) sort(v.begin(), v.end()) int main() { string s; int sum = 0; cin >> s; for (int i = 0; i < s.size(); i++) { sum += s[i] - 48; } sum % 9 == 0 && sum != 0 ...
#include "bits/stdc++.h" using namespace std; #define mx 100001 #define ll long long #define llu long long unsigned #define pb push_back #define s(v) sort(v.begin(), v.end()) int main() { string s; int sum = 0; cin >> s; for (int i = 0; i < s.size(); i++) { sum += s[i] - 48; } sum % 9 == 0 ? cout << "Y...
[["-", 8, 9, 0, 1, 0, 41, 15, 16, 17, 98], ["-", 0, 1, 0, 41, 15, 16, 12, 16, 31, 22], ["-", 0, 1, 0, 41, 15, 16, 12, 16, 17, 79], ["-", 0, 1, 0, 41, 15, 16, 12, 16, 12, 13]]
1
100
ls=[int(s) for s in input()] sm = sum(ls) if sm%9 == 0: print("YES") else: print("NO")
ls=[int(s) for s in input()] sm = sum(ls) if sm%9 == 0: print("Yes") else: print("No")
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
41
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pii pair<int, int> #define PII pair<ll, ll> const ll sz = 1e5 + 100; int main() { string str; cin >> str; ll sum = 0; for (ll i = 0; str[i]; i++) sum += (str[i] - '0'); if (sum % 9 == 0 && sum > 0) cout << "Yes\n"; el...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pii pair<int, int> #define PII pair<ll, ll> const ll sz = 1e5 + 100; int main() { string str; cin >> str; ll sum = 0; for (ll i = 0; str[i]; i++) sum += (str[i] - '0'); if (sum % 9ll == 0) cout << "Yes\n"; else co...
[["-", 15, 339, 51, 16, 31, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47]]
1
96
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll #define db(x) cout << #x << " = " << x << "\n"; #define FIN \ ios::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll #define db(x) cout << #x << " = " << x << "\n"; #define FIN \ ios::sync_with_stdio(false); \ cin.tie(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
97
#include <bits/stdc++.h> using namespace std; #define int long long #define mod 1000000007 #define maxn 200015 #define PI 3.1415926535 #define all(x) x.begin(), x.end() #define speedUp \ ios_base::sync_with_stdio(0); ...
#include <bits/stdc++.h> using namespace std; #define int long long #define mod 1000000007 #define maxn 200015 #define PI 3.1415926535 #define all(x) x.begin(), x.end() #define speedUp \ ios_base::sync_with_stdio(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
113
#include <bits/stdc++.h> using namespace std; #define SPEED \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #define fileio ...
#include <bits/stdc++.h> using namespace std; #define SPEED \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #define fileio ...
[["-", 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
116
#pragma GCC optimize(2) #pragma G++ optimize(2) #include <bits/stdc++.h> #define si(a) scanf("%d", &a) #define sl(a) scanf("%lld", &a) #define sd(a) scanf("%lf", &a) #define ss(a) scanf("%s", a) #define ms(a) memset(a, 0, sizeof(a)) #define repi(i, a, b) for (register int i = a; i <= b; ++i) #define repd(i, a, b) for (...
#pragma GCC optimize(2) #pragma G++ optimize(2) #include <bits/stdc++.h> #define si(a) scanf("%d", &a) #define sl(a) scanf("%lld", &a) #define sd(a) scanf("%lf", &a) #define ss(a) scanf("%s", a) #define ms(a) memset(a, 0, sizeof(a)) #define repi(i, a, b) for (register int i = a; i <= b; ++i) #define repd(i, a, b) for (...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 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
177
import java.util.Scanner; public class Main { public static void main(String args[]) throws Exception { Scanner scan = new Scanner(System.in); String n = scan.next(); int sum = 0; String ans = "No"; for (int i = 0; i < n.length() - 1; i++) { sum += Integer.parseInt(n.substring(i, i + 1)); ...
import java.util.Scanner; public class Main { public static void main(String args[]) throws Exception { Scanner scan = new Scanner(System.in); String n = scan.next(); int sum = 0; String ans = "No"; for (int i = 0; i < n.length(); i++) { sum += Integer.parseInt(n.substring(i, i + 1)); ...
[["-", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
123
N = int(input()) if N//9 == 0: ans = 'Yes' else: ans = 'No' print(ans)
N = int(input()) if N%9 == 0: ans = 'Yes' else: ans = 'No' print(ans)
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 676], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 109]]
5
31
/* I am not somebody you can put inside a box And I am not somebody who will let you take my spot It's written on my face I'm somebody who never stop I do it because I gotta I don't do it for you props Nah, you can keep those I'm aiming way higher than planes in Heathrow And I'm sorry to say but my game can't be sold A...
/* I am not somebody you can put inside a box And I am not somebody who will let you take my spot It's written on my face I'm somebody who never stop I do it because I gotta I don't do it for you props Nah, you can keep those I'm aiming way higher than planes in Heathrow And I'm sorry to say but my game can't be sold A...
[["-", 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
189
n=input() s=0 for i in range(n): s+=int(n[i]) if(s%9==0): print("Yes") else: print("No")
n=input() s=0 for i in range(len(n)): s+=int(n[i]) if(s%9==0): print("Yes") else: print("No")
[["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
48
/* Username : moondancer Name : Moon Dancer */ #include <bits/stdc++.h> using namespace std; #define int long long signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; int ans = 0; for (char i : s) { int x = i - '0'; ans = (ans + i) % 9; } if (ans % 9 ...
/* Username : moondancer Name : Moon Dancer */ #include <bits/stdc++.h> using namespace std; #define int long long signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; int ans = 0; for (char i : s) { int x = i - '0'; ans = (ans + x) % 9; } if (ans % 9 ...
[["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22]]
1
101
#include <bits/stdc++.h> using namespace std; signed main() { int sum; string n; cin >> n; sum = 0; for (int i = 0; i < n.size(); i++) { sum += n[i]; sum = sum % 9; } if (sum == 0) { cout << "Yes\n"; } else { cout << "No\n"; } return (0); }
#include <bits/stdc++.h> using namespace std; signed main() { int sum; string n; cin >> n; sum = 0; for (int i = 0; i < n.size(); i++) { sum += n[i] - '0'; sum = sum % 9; } if (sum == 0) { cout << "Yes\n"; } else { cout << "No\n"; } return (0); }
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 104], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125]]
1
89
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vector<int>>; using vl = vector<ll>; using vvl = vector<vector<ll>>; #define debug(x) cerr << #x << ": " << x << endl; #define MOD 1000000007ULL; #define rep(i, n) for (int i = 0; i < n; i++) int main() { s...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vector<int>>; using vl = vector<ll>; using vvl = vector<vector<ll>>; #define debug(x) cerr << #x << ": " << x << endl; #define MOD 1000000007ULL; #define rep(i, n) for (int i = 0; i < n; i++) int main() { s...
[["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 40], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
144
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define maxn 100001 #define LL long long #define inf 10000000000 #define mod 1000000007 #define pi 3.14159265359 using namespace std; int dx[9...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define maxn 100001 #define LL long long #define inf 10000000000 #define mod 1000000007 #define pi 3.14159265359 using namespace std; int dx[9...
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
1
449
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; #define ll long long #define pal pair<ll, ll> #define pad pai...
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; #define ll long long #define pal pair<ll, ll> #define pad pai...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
306
import numpy as np N = str(input()) array = np.array(list(map(int, s))) s = np.sum(array) if s % 9 == 0: print('Yes') else: print('No')
import numpy as np N = str(input()) array = np.array(list(map(int, N))) s = np.sum(array) if s % 9 == 0: print('Yes') else: print('No')
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
5
57
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; long long sum = 0; for (int i = 0; i < s.size(); i++) sum += s[i] - '0'; if (sum % 9 == 0) cout << "YES\n"; else cout << "NO\n"; }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; long long sum = 0; for (int i = 0; i < s.size(); i++) sum += s[i] - '0'; if (sum % 9 == 0) cout << "Yes\n"; else cout << "No\n"; }
[["-", 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
77
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define FOR(i, a, b) for (int i = a; i < (b); ++i) #define ll long long int using namespace std; int main() { string N; cin >> N; ll sum = 0; rep(i, N.length()) { sum += int(N[i]); } if (sum % 9 == 0) cout << "Yes" << endl; els...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define FOR(i, a, b) for (int i = a; i < (b); ++i) #define ll long long int using namespace std; int main() { string N; cin >> N; ll sum = 0; rep(i, N.length()) { sum += (N[i] - '0'); } if (sum % 9 == 0) cout << "Yes" << endl; ...
[["-", 0, 9, 0, 1, 0, 11, 12, 2, 63, 40], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 23, 0, 16, 12, 103, 0, 104], ["+", 0, 11, 12, 23, 0, 16, 12, 103, 0, 125]]
1
96
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int sum = 0; for (int i = 0; i < s.length(); i++) { sum += (s[i] - '0'); sum %= 9; } puts(!sum ? "YES" : "NO"); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int sum = 0; for (int i = 0; i < s.length(); i++) { sum += (s[i] - '0'); sum %= 9; } puts(!sum ? "Yes" : "No"); return 0; }
[["-", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["-", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6]]
1
78
#include <bits/stdc++.h> using namespace std; #define pi 3.14159265358979 #define mod 1000000007 #define ll long long int #define rep(i, a, b) for (ll i = a; i < b; i++) #define repn(i, a, b) for (ll i = a; i > b; i--) #define mod1 1000003 #define mod2 998244353 #define inf 2e18 #define hi "hello" #define nl "\n" #def...
#include <bits/stdc++.h> using namespace std; #define pi 3.14159265358979 #define mod 1000000007 #define ll long long int #define rep(i, a, b) for (ll i = a; i < b; i++) #define repn(i, a, b) for (ll i = a; i > b; i--) #define mod1 1000003 #define mod2 998244353 #define inf 2e18 #define hi "hello" #define nl "\n" #def...
[["-", 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
364
// ===================================================== // File : main.cpp // Author : eezyl // Synopsis: codeforces/atcoder template // Address : // Date : 2020/08/21 // ===================================================== #pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace s...
// ===================================================== // File : main.cpp // Author : eezyl // Synopsis: codeforces/atcoder template // Address : // Date : 2020/08/21 // ===================================================== #pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace s...
[["-", 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
787
#include <bits/stdc++.h> using namespace std; #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define pb push_back #define eb emplace_back #define fs first #define sc second using lint = long long; using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using vii = vec...
#include <bits/stdc++.h> using namespace std; #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define pb push_back #define eb emplace_back #define fs first #define sc second using lint = long long; using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using vii = vec...
[["-", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["-", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6]]
1
137
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define F first #define S second #define pb push_back #define mp make_pair #define mod 1000000007 #define vlli vector<ll> #define vi vector<int> #define vs vector<string> #define vplli vector<pair<ll, ll>> #define plli pair<ll, ll...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define F first #define S second #define pb push_back #define mp make_pair #define mod 1000000007 #define vlli vector<ll> #define vi vector<int> #define vs vector<string> #define vplli vector<pair<ll, ll>> #define plli pair<ll, ll...
[["-", 8, 9, 0, 9, 0, 1, 0, 11, 17, 108], ["-", 8, 9, 0, 9, 0, 1, 0, 11, 12, 13], ["-", 0, 14, 8, 9, 0, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 9, 0, 1, 0, 11, 31, 22]]
1
369
#include <algorithm> #include <complex> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define REP(i, m, n) for (int i...
#include <algorithm> #include <complex> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define REP(i, m, n) for (int i...
[["-", 12, 16, 31, 23, 0, 16, 12, 103, 0, 125], ["+", 12, 16, 31, 23, 0, 16, 12, 103, 0, 125]]
1
388
s=input() su=0 for i in range(len(s)): su+=int(s[i]) print("YNeos"[su%9::2])
s=input() su=0 for i in range(len(s)): su+=int(s[i]) print("YNeos"[su%9!=0::2])
[["+", 3, 4, 0, 206, 206, 663, 0, 666, 667, 79], ["+", 3, 4, 0, 206, 206, 663, 0, 666, 0, 612]]
5
42
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; #define pb push_back #define fi first #define se second #define mp make_pair #define all(a) a.begin(), a.end() #define lb lower_bound #define ub upper_bound #define owo \ ios_...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; #define pb push_back #define fi first #define se second #define mp make_pair #define all(a) a.begin(), a.end() #define lb lower_bound #define ub upper_bound #define owo \ ios_...
[["-", 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
158
N = Int(input()) print("Yes" if N % 9 == 0 else "No")
N = int(input()) print("Yes" if N % 9 == 0 else "No")
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
24
// Submitted by Subhash import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; public class Main { public static boolean solve(char c[]) { int sum = 0; for (char c1 : c) sum += c1 - '0';...
// Submitted by Subhash import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; public class Main { public static boolean solve(char c[]) { int sum = 0; for (char c1 : c) sum += c1 - '0';...
[["-", 0, 492, 3, 4, 0, 510, 64, 5, 0, 491], ["+", 0, 492, 3, 4, 0, 510, 64, 5, 0, 491], ["-", 0, 492, 3, 4, 0, 510, 75, 5, 0, 491], ["+", 0, 492, 3, 4, 0, 510, 75, 5, 0, 491]]
3
363
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define lli long long int #define F first #define S second #define all(v) v.begin(), v.end() #define mii map<lli, lli> #define msi map<string, lli> #define pii pair<lli, lli> #define vi vector<lli> #define vvi vector<vector<lli>> ...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define lli long long int #define F first #define S second #define all(v) v.begin(), v.end() #define mii map<lli, lli> #define msi map<string, lli> #define pii pair<lli, lli> #define vi vector<lli> #define vvi vector<vector<lli>> ...
[["-", 49, 50, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 49, 50, 51, 16, 31, 69, 341, 342, 0, 22]]
1
328
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; long long K = 0; for (int X = 0; X < S.size(); X++) { K += S[X]; } if (K % 9 == 0) cout << "Yes" << endl; else cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; long long K = 0; for (int X = 0; X < S.size(); X++) { K += (S[X] - '0'); } if (K % 9 == 0) cout << "Yes" << endl; else cout << "No" << endl; }
[["+", 8, 9, 0, 1, 0, 11, 12, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 23, 0, 16, 12, 103, 0, 104], ["+", 0, 11, 12, 23, 0, 16, 12, 103, 0, 125], ["+", 8, 9, 0, 1, 0, 11, 12, 23, 0, 25]]
1
77
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { string n; cin >> n; int x = 0; for (int i = 0; i < n.size(); ++i) x = (x + (n[i] - '0')) % 9; if (!x) cout << 'Yes' << endl; else cout << 'No' << endl; retu...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { string n; cin >> n; int x = 0; for (int i = 0; i < n.size(); ++i) x = (x + (n[i] - '0')) % 9; if (!x) cout << "Yes" << endl; else cout << "No" << endl; retu...
[["-", 64, 1, 0, 16, 31, 16, 12, 103, 0, 104], ["-", 64, 1, 0, 16, 31, 16, 12, 103, 0, 125], ["-", 0, 16, 31, 16, 12, 103, 0, 42, 0, 22], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 103, 0, 104], ["-", 0, 1, 0, 16, 31, 16, 12, 103, 0, 125], ["+", 0...
1
99
#include <bits/stdc++.h> #define F first #define S second #define endl "\n" #define Endl "\n" #define emdl "\n" #define mod 1000000007 #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() using namespace std; // bool sortBy(const pair<int,pair<int,int>> &a,const pair<int,pair<int,int>> // &b){ i...
#include <bits/stdc++.h> #define F first #define S second #define endl "\n" #define Endl "\n" #define emdl "\n" #define mod 1000000007 #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() using namespace std; // bool sortBy(const pair<int,pair<int,int>> &a,const pair<int,pair<int,int>> // &b){ i...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
183
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef long double ld; typedef set<int>::iterator sit; typedef map<int, int>::iterator mit; typedef vector<int>::iterator vit; const int INF = 1e9 + 7; const int MOD = 1e9 +...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef long double ld; typedef set<int>::iterator sit; typedef map<int, int>::iterator mit; typedef vector<int>::iterator vit; const int INF = 1e9 + 7; const int MOD = 1e9 +...
[["-", 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
363
#include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <tuple> #include <vector> using namespace std; typedef long long ll; ll const INF = 1LL << 60; int main() { string s; cin >> s; ll sum = 0; for ...
#include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <tuple> #include <vector> using namespace std; typedef long long ll; ll const INF = 1LL << 60; int main() { string s; cin >> s; ll sum = 0; for ...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 104], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125]]
1
122
#include <bits/stdc++.h> #define IOS ios::sync_with_stdio(false), cin.tie(0) #define debug(a) cout << #a ": " << a << endl using namespace std; typedef long long ll; int main(void) { IOS; string s; cin >> s; int tot = 0; for (int i = 0; i < s.size(); ++i) { tot += s[i] - '0'; } cout << (tot % 9 == 0 ?...
#include <bits/stdc++.h> #define IOS ios::sync_with_stdio(false), cin.tie(0) #define debug(a) cout << #a ": " << a << endl using namespace std; typedef long long ll; int main(void) { IOS; string s; cin >> s; int tot = 0; for (int i = 0; i < s.size(); ++i) { tot += s[i] - '0'; } cout << (tot % 9 == 0 ?...
[["-", 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
95
#include <bits/stdc++.h> #define forr(i, z, u, l) for (i = z; i < u; i += l) #define f(i, n) for (i = 0; i < n; i++) using namespace std; #define F first #define S second #define vi vector<int> #define vll vector<long long> #define vld vector<long double> #define vvi vector<vector<int>> #define vs vector<string> #defin...
#include <bits/stdc++.h> #define forr(i, z, u, l) for (i = z; i < u; i += l) #define f(i, n) for (i = 0; i < n; i++) using namespace std; #define F first #define S second #define vi vector<int> #define vll vector<long long> #define vld vector<long double> #define vvi vector<vector<int>> #define vs vector<string> #defin...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
273
""" Satwik_Tiwari ;) . 21st AUGUST , 2020 - FRIDAY """ #=============================================================================================== #importing some useful libraries. from __future__ import division, print_function from fractions import Fraction import sys import os from io import BytesIO,...
""" Satwik_Tiwari ;) . 21st AUGUST , 2020 - FRIDAY """ #=============================================================================================== #importing some useful libraries. from __future__ import division, print_function from fractions import Fraction import sys import os from io import BytesIO,...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
1,317
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long #define ull unsigned long long #define f first #define s second typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define ordered_set ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long #define ull unsigned long long #define f first #define s second typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define ordered_set ...
[["-", 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
484
#include <bits/stdc++.h> #define f first #define s second #define fore(i, a, b) for (int i = (a), ThxMK = (b); i < ThxMK; ++i) #define pb push_back #define all(s) begin(s), end(s) #define _ \ ios_base::sync_with_stdio(0); ...
#include <bits/stdc++.h> #define f first #define s second #define fore(i, a, b) for (int i = (a), ThxMK = (b); i < ThxMK; ++i) #define pb push_back #define all(s) begin(s), end(s) #define _ \ ios_base::sync_with_stdio(0); ...
[["-", 0, 16, 12, 23, 0, 16, 31, 69, 28, 22], ["-", 12, 23, 0, 16, 31, 69, 341, 342, 0, 70], ["-", 12, 23, 0, 16, 31, 69, 341, 342, 0, 73]]
1
674
#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; #define speed \ ios_base::sync_with_stdio(false); \ cin...
#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; #define speed \ ios_base::sync_with_stdio(false); \ cin...
[["-", 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
440
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<long long> vll; typedef vector<vector<long long>> vvll; typedef pair<int, int> pii; typedef pair<long long, int> pli; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<long long> vll; typedef vector<vector<long long>> vvll; typedef pair<int, int> pii; typedef pair<long long, int> pli; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define...
[["-", 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
273
#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; #define ll long long #define X first #define Y second #define all(x) x.begin(), x.end() #define ordered_set ...
#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; #define ll long long #define X first #define Y second #define all(x) x.begin(), x.end() #define ordered_set ...
[["+", 31, 16, 12, 23, 0, 41, 15, 16, 17, 60], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 12, 13]]
1
644
#include <bits/stdc++.h> #include <iostream> #include <stdio.h> // #include <ext/pb_ds/assoc_container.hpp> // Common file // #include <ext/pb_ds/tree_policy.hpp> // Including // tree_order_statistics_node_update // using namespace __gnu_pbds; using namespace std; #define ordered_set ...
#include <bits/stdc++.h> #include <iostream> #include <stdio.h> // #include <ext/pb_ds/assoc_container.hpp> // Common file // #include <ext/pb_ds/tree_policy.hpp> // Including // tree_order_statistics_node_update // using namespace __gnu_pbds; using namespace std; #define ordered_set ...
[["-", 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
219
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int ans = 0; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; if (i >= 1) { ans += max(0, a[i - 1] - a[i]); if (a[i - 1] - a[i] > 0) a[i] = a[i - 1]; } } cout << ans << endl; return...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int64_t ans = 0; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; if (i >= 1) { ans += max(0, a[i - 1] - a[i]); if (a[i - 1] - a[i] > 0) a[i] = a[i - 1]; } } cout << ans << endl; re...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
120
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { int n; cin >> n; int cnt = 0; int previous = 0; for (int i = 1; i <= n; i++) { int height; cin >> height; if (height < previous) { cnt += previous - height; height = previous; } previou...
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { int n; cin >> n; long long cnt = 0; long long previous = 0; for (int i = 1; i <= n; i++) { long long height; cin >> height; if (height < previous) { cnt += previous - height; height = previous;...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96]]
1
84
#include <iostream> #include <string> using namespace std; int n; int pprev; int ans; int main() { cin >> n; for (int i = 1; i <= n; i++) { int val; cin >> val; if (pprev > val) ans += pprev - val, val = pprev; pprev = val; } cout << ans << endl; }
#include <iostream> #include <string> using namespace std; int n; long long pprev; long long ans; int main() { cin >> n; for (int i = 1; i <= n; i++) { long long val; cin >> val; if (pprev > val) ans += pprev - val, val = pprev; pprev = val; } cout << ans << endl; }
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96]]
1
76
#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 <unordered_set> #include <vector> //...
#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 <unordered_set> #include <vector> //...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 14, 8, 9, 0, 43, 39, 78]]
1
218
N=int(input()) A=list(map(int,input().split())) a=0 s=[] for i in A: if i<a: s.append(a-i) a=i else: a=i print(sum(s))
N=int(input()) A=list(map(int,input().split())) a=0 s=[] for i in A: if i<a: s.append(a-i) else: a=i print(sum(s))
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
65
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repc(i, a, b) for (int i = a; i <= (int)(b); i++) #define ll long long #define vec vector #define pb push_back #define ft first #define sd second #define all(vec) vec.begin(), vec.end() typedef pair<int, int> P;...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repc(i, a, b) for (int i = a; i <= (int)(b); i++) #define ll long long #define vec vector #define pb push_back #define ft first #define sd second #define all(vec) vec.begin(), vec.end() typedef pair<int, int> P;...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
214
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a.at(i); ll min_val = a.at(0); ll max_val = 0; int flag = 0; rep(i, n) { min_val = max(min_val, a.at(i)); ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main() { int n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a.at(i); ll min_val = a.at(0); ll max_val = 0; ll flag = 0; rep(i, n) { min_val = max(min_val, a.at(i)); ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
127
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.LineNumberReader; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a[] = new int[n]; for (int i = ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.LineNumberReader; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a[] = new int[n]; for (int i = ...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]]
3
467
#include <bits/stdc++.h> #include <iostream> using namespace std; int a[200005]; int main() { int n; cin >> n; int sum = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; if (i > 1) { if (a[i - 1] > a[i]) { sum += a[i - 1] - a[i]; a[i] = a[i - 1]; } } } printf("%d\n", su...
#include <bits/stdc++.h> #include <iostream> using namespace std; int a[200005]; int main() { int n; cin >> n; long long sum = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; if (i > 1) { if (a[i - 1] > a[i]) { sum += a[i - 1] - a[i]; a[i] = a[i - 1]; } } } printf("%ll...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
118
#include <bits/stdc++.h> using namespace std; int main() { int N; int ans = 0; cin >> N; vector<int> S(N); for (int i = 0; i < N; i++) { cin >> S[i]; } for (int i = 0; i < N - 1; i++) { if (S[i] > S[i + 1]) { ans += S[i] - S[i + 1]; S[i + 1] = S[i]; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; long long ans = 0; cin >> N; vector<int> S(N); for (int i = 0; i < N; i++) { cin >> S[i]; } for (int i = 0; i < N - 1; i++) { if (S[i] > S[i + 1]) { ans += S[i] - S[i + 1]; S[i + 1] = S[i]; } } cout << ans << end...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
122
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int r = 0; int h = 0; for (int x : a) { if (x < h) { r += h - x; } else { h = x; } // cout << "h: " << h << " r: " << r << endl; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } long long r = 0; int h = 0; for (int x : a) { if (x < h) { r += h - x; } else { h = x; } // cout << "h: " << h << " r: " << r << e...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
99
#include <iostream> using namespace std; int main(void) { int n, ans; int h[200010]; cin >> n; for (int i = 0; i < n; i++) cin >> h[i]; ans = 0; for (int i = 1; i < n; i++) { if (h[i - 1] > h[i]) { ans += h[i - 1] - h[i]; h[i] = h[i - 1]; } } cout << ans << endl; return 0; }
#include <iostream> using namespace std; int main(void) { int n; long long ans; int h[200010]; cin >> n; for (int i = 0; i < n; i++) cin >> h[i]; ans = 0; for (int i = 1; i < n; i++) { if (h[i - 1] > h[i]) { ans += h[i - 1] - h[i]; h[i] = h[i - 1]; } } cout << ans << endl; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
120
#include <iostream> using namespace std; int n, a[200002]; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } int aim = a[1], sum = 0; for (int i = 2; i <= n; i++) { if (aim > a[i]) sum += aim - a[i]; else if (aim < a[i]) aim = a[i]; } cout << sum; return 0; }
#include <iostream> using namespace std; long long n, a[200002]; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } long long aim = a[1], sum = 0; for (int i = 2; i <= n; i++) { if (aim > a[i]) sum += aim - a[i]; else if (aim < a[i]) aim = a[i]; } cout << sum; r...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
117