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; typedef long long int ll; typedef unsigned long long int ull; typedef pair<ll, ll> PLL; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) \ for (int i = static_cas...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef pair<ll, ll> PLL; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) \ for (int i = static_cas...
[["+", 0, 7, 26, 34, 12, 11, 31, 23, 0, 24], ["+", 0, 7, 26, 34, 12, 11, 31, 23, 0, 25], ["+", 8, 9, 0, 7, 26, 34, 12, 11, 17, 132], ["+", 8, 9, 0, 7, 26, 34, 12, 11, 12, 13]]
1
233
s = gets M = 2019 m = Hash.new(0) sc = 1 dm = 0 s.reverse.each_char do |c| dm += c.to_i * sc dm %= M #puts "#{c} #{dm}" m[dm % M] += 1 sc *= 10 sc %= M end ans = 0 m.each do |key, value| ans += value * (value-1) / 2 if 2 <= value end puts ans + m[0]
s = gets.chomp M = 2019 m = Hash.new(0) sc = 1 dm = 0 s.reverse.each_char do |c| dm += c.to_i * sc dm %= M #puts "#{c} #{dm}" m[dm % M] += 1 sc *= 10 sc %= M end ans = 0 m.each do |key, value| ans += value * (value-1) / 2 if 2 <= value end puts ans + m[0]
[["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]]
4
90
#include <bits/stdc++.h> using namespace std; #define SELECTER(_1, _2, _3, SELECT, ...) SELECT #define REP1(i, n) for (int(i) = 0; (i) < (n); (i)++) #define REP2(i, a, b) for (int(i) = (a); (i) < (b); (i)++) #define REP(...) SELECTER(__VA_ARGS__, REP2, REP1, )(__VA_ARGS__) #define MOD 1'000'000'007 template <class T> ...
#include <bits/stdc++.h> using namespace std; #define SELECTER(_1, _2, _3, SELECT, ...) SELECT #define REP1(i, n) for (int(i) = 0; (i) < (n); (i)++) #define REP2(i, a, b) for (int(i) = (a); (i) < (b); (i)++) #define REP(...) SELECTER(__VA_ARGS__, REP2, REP1, )(__VA_ARGS__) #define MOD 1'000'000'007 template <class T> ...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22]]
1
308
g=[a=0]*M=2019;g[0]=t=1;gets.reverse.bytes{g[a=(a+_1%48*t=t*10%M)%M]+=1};p g.sum{_1*~-_1/2}
g=[a=0]*M=2019;t=1;gets.reverse.bytes{g[a=(a+_1%48*t=t*10%M)%M]+=1};p g.sum{_1*~-_1/2}
[["-", 36, 36, 0, 493, 0, 662, 31, 742, 500, 22], ["-", 36, 36, 0, 493, 0, 662, 31, 742, 0, 70], ["-", 36, 36, 0, 493, 0, 662, 31, 742, 0, 612], ["-", 36, 36, 0, 493, 0, 662, 31, 742, 0, 73], ["-", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32]]
4
66
g=[a=0]*M=2019;g[0]=t=1;gets.reverse.bytes{g[a=(a+_1%48*t=t*10%M)%M]+=1};p g.sum{_1*~-_1/2}
g=[a=0]*M=2019;g[0]=t=1;gets.chop.reverse.bytes{g[a=(a+_1%48*t=t*10%M)%M]+=1};p g.sum{_1*~-_1/2}
[["+", 0, 493, 0, 652, 486, 652, 486, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 652, 486, 652, 17, 131]]
4
66
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; #define INF 20000...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; #define INF 20000...
[["+", 8, 9, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 132], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 9, 0, 1, 0, 35]]
1
341
from collections import Counter S = input() #S = "1"*20000 p = 2019 N = len(S) m = [(int(S[i]) * pow(10, N-i, p)) % p for i in range(N)] # m の mod 累積和 r = [0] * N r[0] = m[0] for ri in range(1, N): r[ri] = (r[ri-1] + m[ri]) % p # この r[i] が一致するような区間が答えになるのでこれをもとめる c = Counter(r) ans = 0 for ci in [cv for cv in...
from collections import Counter S = input() p = 2019 N = len(S) # p は 10 と互いに素なのであんまり桁のずれは関係ないはずなので、とりあえず位は大きいのに合わせる m = [(int(S[i]) * pow(10, N-i, p)) % p for i in range(N)]# m は各桁の mod # m の mod 累積和をもとめる r = [0] * N r[0] = m[0] for ri in range(1, N): r[ri] = (r[ri-1] + m[ri]) % p # この r[i] が一致するような区間が答えになるので...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 0, 70], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 206, 612], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 0, 73]]
5
155
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int tt = 1, rr = 0; int r[672]; long long n, i, res = 0; long long t[2019]; string s; cin >> s; n = s.size(); fill(t, t + 2019, 0); for (i = 0; i < 672; i++) { r[i] = tt % 2019; tt = r[i] * 10; } f...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int tt = 1, rr = 0; int r[672]; long long n, i, res = 0; long long t[2019]; string s; cin >> s; n = s.size(); fill(t, t + 2019, 0); for (i = 0; i < 672; i++) { r[i] = tt % 2019; tt = r[i] * 10; } f...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]]
1
219
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define fi first #define se second #define forn(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) forn(i, 0, (n)) #define all(x) x.begin(), x.end() #define len(x) (int)x.size() #define endl '\n' #define int long long #define vc vector #define...
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define fi first #define se second #define forn(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) forn(i, 0, (n)) #define all(x) x.begin(), x.end() #define len(x) (int)x.size() #define endl '\n' #define int long long #define vc vector #define...
[["-", 0, 338, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 338, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 338, 8, 9, 0, 1, 0, 27, 17, 29]]
1
216
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools from collections import deque sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 DR = [1, -1, 0, 0] DC = [0, 0, 1, -1] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(...
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools from collections import deque sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 DR = [1, -1, 0, 0] DC = [0, 0, 1, -1] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 0, 70], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 206, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 0, 73]]
5
405
s=str(input()) n=len(s) k=[0]*(n+1) for i in range (1,n+1): k[i]=int(s[i-1]) t=[0]*(n+1) t[0]=0 for i in range(1,n+1): t[i]=(10*t[i-1]+k[i])%2019 p=1 q=[0]*448 for z in range(0,448): q[z]=p%2019 p=10*q[z] d=[0]*n for j in range(1,n+1): f=j%448 d[j-1]=q[n-f]*t[j]%2019 ds=sorted(d) ct=0 ans...
s=str(input()) n=len(s) k=[0]*(n+1) for i in range (1,n+1): k[i]=int(s[i-1]) t=[0]*(n+1) t[0]=0 for i in range(1,n+1): t[i]=(10*t[i-1]+k[i])%2019 p=1 q=[0]*448 for z in range(0,448): q[z]=p%2019 p=10*q[z] d=[0]*n for j in range(1,n+1): f=(n-j)%448 d[j-1]=q[f]*t[j]%2019 ds=sorted(d) ct=0 a...
[["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 31, 22], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25], ["-", 12, 657, 31, 657, 31, 206, 206, 657, 31, 22], ["-", 12, 657, 31, 657, 31, 206, 206, 657, 17, 33]]
5
246
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = s.size(); int d[n]; d[0] = s[n - 1] - '0'; int t = 1; for (int i = 1; i < n; i++) { t *= 10; t %= 2019; d[i] = d[i - 1] + (s[n - 1 - i] - '0') * t; d[i] %= 2019; } long long cnt[2019]; fill(cnt, c...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = s.size(); int d[n]; d[0] = s[n - 1] - '0'; int t = 1; for (int i = 1; i < n; i++) { t *= 10; t %= 2019; d[i] = d[i - 1] + (s[n - 1 - i] - '0') * t; d[i] %= 2019; } long long cnt[2019]; fill(cnt, c...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
211
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s; cin >> s; int len = s.size(); ll ans = 0, p = 1, now = 0, cnt[2020] = {0}; cnt[0] = 1; for (int i = len - 1; i--;) { now = (now + ll(s[i] - '0') * p) % 2019; ans += cnt[now]++; p = p * 10 % 2019; } cou...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s; cin >> s; int len = s.size(); ll ans = 0, p = 1, now = 0, cnt[2020] = {0}; cnt[0] = 1; for (int i = len; i--;) { now = (now + ll(s[i] - '0') * p) % 2019; ans += cnt[now]++; p = p * 10 % 2019; } cout <<...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
124
#include <iostream> #include <string> #include <vector> using namespace std; int main() { string S; cin >> S; int n = S.size(); vector<vector<int>> dp(n + 1, vector<int>(10, 0)); vector<int> cnt(2019, 0); for (int i = 1; i < 10; i++) dp[1][i] = i; for (int i = 2; i < n + 1; i++) { for (int j = 1;...
#include <iostream> #include <string> #include <vector> using namespace std; int main() { string S; cin >> S; int n = S.size(); vector<vector<int>> dp(n + 1, vector<int>(10, 0)); vector<int> cnt(2019, 0); for (int i = 1; i < 10; i++) dp[1][i] = i; for (int i = 2; i < n + 1; i++) { for (int j = 1;...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
280
s = input() MOD = 2019 r = [0]*MOD r[0] = 1 z = 0 t = 0 for i in reversed(s): z = int(i) * pow(10,t,m) + z z %= MOD r[z] += 1 t += 1 print(sum(i*(i-1)//2 for i in r))
s = input() MOD = 2019 r = [0]*MOD r[0] = 1 z = 0 t = 0 for i in reversed(s): z = int(i) * pow(10,t,MOD) + z z %= MOD r[z] += 1 t += 1 print(sum(i*(i-1)//2 for i in r))
[["-", 12, 657, 31, 657, 12, 652, 3, 4, 0, 22], ["+", 12, 657, 31, 657, 12, 652, 3, 4, 0, 22]]
5
83
s = input() n = len(s) m = 2019 a = 0 r = [0 for _ in range(m+1)] r[0] = 1 for i in range(0,n): z = (int(s[n-i-1])*pow(10,i,m) + z)%m a += r[z] r[z] += 1 print(a)
s = input() n = len(s) m = 2019 a = 0 r = [0 for _ in range(m+1)] r[0] = 1 z = 0 for i in range(0,n): z = (int(s[n-i-1])*pow(10,i,m) + z)%m a += r[z] r[z] += 1 print(a)
[["+", 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]]
5
91
#include <bits/stdc++.h> using namespace std; int cnt[2019]; int main() { string s; cin >> s; int ans = 0, now = 0, p = 0; cnt[0] = 1; for (int i = s.size() - 1; i >= 0; i--) { now = (now + (s[i] - '0') * p) % 2019; ans += cnt[now]++; p = p * 10 % 2019; } cout << ans; }
#include <bits/stdc++.h> using namespace std; int cnt[2019]; int main() { string s; cin >> s; int ans = 0, now = 0, p = 1; cnt[0] = 1; for (int i = s.size() - 1; i >= 0; i--) { now = (now + (s[i] - '0') * p) % 2019; ans += cnt[now]++; p = p * 10 % 2019; } cout << ans; }
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
108
package main import ( "bufio" "fmt" "os" ) const ( initialBufSize = 10000 maxBufSize = 100000000 ) var sc *bufio.Scanner = func() *bufio.Scanner { sc := bufio.NewScanner(os.Stdin) buf := make([]byte, initialBufSize) sc.Buffer(buf, maxBufSize) return sc }() // Input string func scanString() (s string) {...
package main import ( "bufio" "fmt" "os" ) const ( initialBufSize = 10000 maxBufSize = 100000000 ) var sc *bufio.Scanner = func() *bufio.Scanner { sc := bufio.NewScanner(os.Stdin) buf := make([]byte, initialBufSize) sc.Buffer(buf, maxBufSize) return sc }() // Input string func scanString() (s string) {...
[["+", 0, 7, 8, 196, 0, 436, 31, 432, 0, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 436, 17, 132], ["+", 0, 7, 8, 196, 0, 436, 12, 432, 0, 433], ["+", 0, 435, 8, 196, 0, 7, 8, 196, 0, 165]]
7
229
#include <bits/stdc++.h> #define INF 1e18 #define int long long #define Rep(i, a, n) for (int i = (a); i < (n); i++) #define rep(i, n) Rep(i, 0, n) #define all(a) (a).begin(), (a).end() using namespace std; typedef pair<int, int> P; typedef pair<int, P> PP; const int mod = 1000000007; // const int mod = 998244353; sig...
#include <bits/stdc++.h> #define INF 1e18 #define int long long #define Rep(i, a, n) for (int i = (a); i < (n); i++) #define rep(i, n) Rep(i, 0, n) #define all(a) (a).begin(), (a).end() using namespace std; typedef pair<int, int> P; typedef pair<int, P> PP; const int mod = 1000000007; // const int mod = 998244353; sig...
[["+", 8, 9, 0, 1, 0, 11, 31, 23, 0, 24], ["+", 8, 9, 0, 1, 0, 11, 31, 23, 0, 25], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]]
1
249
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = s.size(); vector<long long int> mods(2019, 0); long long int digit = 1, mod = 0; for (long long int i = n - 1; i >= 0; i--) { mod = (mod + int(s[i] - '0') * digit) % 2019; digit = digit * 10 % 2019; mods[mod]...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = s.size(); vector<long long int> mods(2019, 0); long long int digit = 1, mod = 0; for (long long int i = n - 1; i >= 0; i--) { mod = (mod + int(s[i] - '0') * digit) % 2019; digit = digit * 10 % 2019; mods[mod]...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
158
from collections import Counter S = input() N = len(S) dp = [0] * N dp[N-1] = int(S[N-1]) times = 10 for i in reversed(range(N-1)): dp[i-1] = (dp[i] + times * int(S[i-1])) % 2019 times *= 10 times %= 2019 T = Counter(dp) ans = T[0] for t in T.values(): ans += t*(t-1)//2 print(ans)
from collections import Counter S = input() N = len(S) dp = [0] * N dp[N-1] = int(S[N-1]) times = 10 for i in reversed(range(1, N)): dp[i-1] = (dp[i] + times * int(S[i-1])) % 2019 times *= 10 times %= 2019 T = Counter(dp) ans = T[0] for t in T.values(): ans += t*(t-1)//2 print(ans)
[["-", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
5
123
from collections import defaultdict S = list(input())[::-1] n = len(S) d = defaultdict(int) d[0] += 1 res = 0 for i, s in enumerate(S): res += int(s)*pow(10, i, 6) res %= 6 d[res] += 1 ans = 0 for v in d.values(): ans += v*(v-1)//2 print(ans)
from collections import defaultdict S = list(input())[::-1] n = len(S) d = defaultdict(int) d[0] += 1 res = 0 for i, s in enumerate(S): res += int(s)*pow(10, i, 2019) res %= 2019 d[res] += 1 ans = 0 for v in d.values(): ans += v*(v-1)//2 print(ans)
[["-", 0, 677, 12, 657, 12, 652, 3, 4, 0, 612], ["+", 0, 677, 12, 657, 12, 652, 3, 4, 0, 612], ["-", 0, 7, 8, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 612]]
5
100
#include "bits/stdc++.h" using namespace std; #define REP(i, n) for (ll i = 0; i < n; i++) #define ll long long #define MOD 1000000007 #define llMAX 9223372036854775807 #define llMIN -9223372036854775808 using vi = vector<ll>; // intの1次元の型に vi という別名をつける using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける // mapの使い方 #...
#include "bits/stdc++.h" using namespace std; #define REP(i, n) for (ll i = 0; i < n; i++) #define ll long long #define MOD 1000000007 #define llMAX 9223372036854775807 #define llMIN -9223372036854775808 using vi = vector<ll>; // intの1次元の型に vi という別名をつける using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける // mapの使い方 #...
[["-", 0, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["-", 341, 342, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 12, 22], ["-", 341, 342, 0, 16, 31, 23, 0, 16, 12, 22]]
1
332
#include "bits/stdc++.h" using namespace std; #define REP(i, n) for (ll i = 0; i < n; i++) #define ll long long #define MOD 1000000007 #define llMAX 9223372036854775807 #define llMIN -9223372036854775808 using vi = vector<ll>; // intの1次元の型に vi という別名をつける using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける // mapの使い方 #...
#include "bits/stdc++.h" using namespace std; #define REP(i, n) for (ll i = 0; i < n; i++) #define ll long long #define MOD 1000000007 #define llMAX 9223372036854775807 #define llMIN -9223372036854775808 using vi = vector<ll>; // intの1次元の型に vi という別名をつける using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける // mapの使い方 #...
[["-", 341, 342, 0, 16, 31, 23, 0, 16, 31, 22], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 31, 22], ["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
368
#include <bits/stdc++.h> using namespace std; int main(void) { string S; cin >> S; long long N = S.size(); vector<long long> V(N + 1); V[0] = 0; long long ten = 1; map<long long, long long> mp; mp[0]++; for (int i = 1; i <= N; i++) { V[i] = ((S[N - i] - '0') * ten + V[i - 1]) % 2019; ten *= 10...
#include <bits/stdc++.h> using namespace std; int main(void) { string S; cin >> S; long long N = S.size(); vector<long long> V(N + 1); V[0] = 0; long long ten = 1; map<long long, long long> mp; mp[0]++; for (int i = 1; i <= N; i++) { V[i] = ((S[N - i] - '0') * ten + V[i - 1]) % 2019; ten *= 10...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132]]
1
174
s = input() n = 0 ans = 0 mods = [0]*p mods[0] = 1 for i, j in enumerate(reversed(s)): n += int(j)*pow(10, i, 2019) n %= 2019 mods[n] += 1 for i in mods: ans += i*(i-1)//2 print(ans)
s = input() n = 0 ans = 0 mods = [0]*2019 mods[0] = 1 for i, j in enumerate(reversed(s)): n += int(j)*pow(10, i, 2019) n %= 2019 mods[n] += 1 for i in mods: ans += i*(i-1)//2 print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
81
#include <iostream> int main() { std::string s; std::cin >> s; long long mod[2019] = {0}; int T = 0; int ten = 1; for (auto itr = s.rbegin(); itr < s.rend(); ++itr) { T = ((*itr - '0') * ten + T) % 2019; mod[T]++; ten = (ten * 10) % 2019; } auto sum = mod[0]; for (int i = 1; i < 2019; ...
#include <iostream> int main() { std::string s; std::cin >> s; long long mod[2019] = {0}; int T = 0; int ten = 1; for (auto itr = s.rbegin(); itr < s.rend(); ++itr) { T = ((*itr - '0') * ten + T) % 2019; mod[T]++; ten = (ten * 10) % 2019; } auto sum = mod[0]; for (int i = 0; i < 2019; ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
154
package main import ( "fmt" "strconv" ) func main() { var mod [2020]int var input string tmp := 0 ans := 0 c := 1 fmt.Scanf("%s", &input) s := make([]int, len(input)) for i := 0; i < len(input); i++ { s[i], _ = strconv.Atoi(string(input[i])) } mod[0]++ for i := len(s) - 1; i >= 0; i-- { tmp += s[i...
package main import ( "fmt" "strconv" ) func main() { var mod [2020]int var input string tmp := 0 ans := 0 c := 1 fmt.Scanf("%s", &input) s := make([]int, len(input)) for i := 0; i < len(input); i++ { s[i], _ = strconv.Atoi(string(input[i])) } mod[0]++ for i := len(s) - 1; i >= 0; i-- { tmp += s[i...
[["+", 0, 7, 8, 196, 0, 436, 31, 432, 0, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 436, 17, 132], ["+", 0, 7, 8, 196, 0, 436, 12, 432, 0, 433], ["+", 0, 435, 8, 196, 0, 7, 8, 196, 0, 165]]
7
204
s=input() n=0 ans=0 A=[0]*2019 A[0]=1 for i,j in enumerate(reversed(s)): n=(n+int(j)*pow(10,i,2019))%2019 print(i,n) A[n]+=1 for i in A: ans+=i*(i-1)//2 print(ans)
s=input() n=0 ans=0 A=[0]*2019 A[0]=1 for i,j in enumerate(reversed(s)): n=(n+int(j)*pow(10,i,2019))%2019 #print(i,n) A[n]+=1 for i in A: ans+=i*(i-1)//2 print(ans)
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
90
#include <bits/stdc++.h> using namespace std; #define ll long long int #define ld long double #define mod 1000000007 #define endl "\n" #define pb push_back #define mp make_pair #define ff first #define ss second #define MAXX 1000000000000000000 int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll i, ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define ld long double #define mod 1000000007 #define endl "\n" #define pb push_back #define mp make_pair #define ff first #define ss second #define MAXX 1000000000000000000 int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll i, ...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]]
1
212
#include <bits/stdc++.h> using namespace std; constexpr long long MOD = 1000000007; using ll = long long; // O(N or NlogN) // 2*10^5だから // stoiで判定は桁数大きいので破滅しそう //単調性はないので尺取りとかにぶたんではなさそう? // 2019の倍数の次の桁が0ならこれも2019の倍数になる //任意の数に一桁付け足したら2019の倍数になるわけではない。が、そういうやつが存在 long long modpow(long long x, long long n, long long mod)...
#include <bits/stdc++.h> using namespace std; constexpr long long MOD = 1000000007; using ll = long long; // O(N or NlogN) // 2*10^5だから // stoiで判定は桁数大きいので破滅しそう //単調性はないので尺取りとかにぶたんではなさそう? // 2019の倍数の次の桁が0ならこれも2019の倍数になる //任意の数に一桁付け足したら2019の倍数になるわけではない。が、そういうやつが存在 long long modpow(long long x, long long n, long long mod)...
[["-", 12, 23, 0, 16, 12, 16, 31, 69, 28, 22], ["+", 12, 23, 0, 16, 12, 16, 31, 69, 28, 22]]
1
279
from math import pow n = input() MOD = 2019 ans = 0 dp = [0]*MOD dp[0] = 1 temp = 0 for i in range(len(n)): temp = (temp+int(n[-i-1])*int(pow(10, i))) % MOD dp[temp] += 1 for item in dp: if item > 1: ans += item*(item-1)//2 print(ans)
n = input() MOD = 2019 ans = 0 dp = [0]*MOD dp[0] = 1 temp = 0 for i in range(len(n)): temp = (temp+int(n[-i-1])*int(pow(10, i, MOD))) % MOD dp[temp] += 1 for item in dp: if item > 1: ans += item*(item-1)//2 print(ans)
[["-", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["-", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["-", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["-", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
5
101
def solve(): s = input() n = len(s) mod = 2019 reminder = [0]*mod pre_rem = 0 for i in range(n): pre_rem = (int(s[n-i-1])*pow(10, i) + pre_rem) % mod reminder[pre_rem] += 1 ans = reminder[0] # そのまま割り切れる奴ら for rem_num in reminder[1:]: # _nC_2をしてる if rem_num >=...
def solve(): s = input() n = len(s) mod = 2019 reminder = [0]*mod pre_rem = 0 for i in range(n): pre_rem = (int(s[n-i-1])*pow(10, i, mod) + pre_rem) % mod reminder[pre_rem] += 1 ans = reminder[0] for rem_num in reminder: if rem_num >= 2: ans += (rem...
[["+", 0, 657, 31, 657, 12, 652, 3, 4, 0, 21], ["+", 0, 657, 31, 657, 12, 652, 3, 4, 0, 22], ["-", 0, 14, 8, 196, 0, 7, 12, 206, 0, 70], ["-", 8, 196, 0, 7, 12, 206, 206, 663, 0, 612], ["-", 8, 196, 0, 7, 12, 206, 206, 663, 0, 102], ["-", 0, 14, 8, 196, 0, 7, 12, 206, 0, 73]]
5
111
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <set> #include <tuple> #include <vector> using namespace std; typedef long long ll; int main() { string S; cin >> S; ll length = S.length(); vector<ll> mod_map(2019, 0); ll cur_num = 0; ll base_10 = 1; for ...
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <set> #include <tuple> #include <vector> using namespace std; typedef long long ll; int main() { string S; cin >> S; ll length = S.length(); vector<ll> mod_map(2019, 0); ll cur_num = 0; ll base_10 = 1; for ...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
162
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define printV(v) \ for (int i = 0; i < v.size(); i++) { \ cout << v[i] << " "; ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define printV(v) \ for (int i = 0; i < v.size(); i++) { \ cout << v[i] << " "; ...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 24], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 25]]
1
374
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { string s; cin >> s; int n = s.size(); vector<int> a(n + 1, 0); int m = 2019; int ten = 1; for (int i = n - 1; i >= 0; i--) { int d = (s[i] - '0') ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { string s; cin >> s; int n = s.size(); vector<int> a(n + 1, 0); int m = 2019; int ten = 1; for (int i = n - 1; i >= 0; i--) { int d = (s[i] - '0') ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 11, 12, 69, 341, 342, 0, 69, 28, 22], ["+", 12, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 12, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
196
#include <bits/stdc++.h> using namespace std; template <typename T> istream &operator>>(istream &istr, vector<T> &v) { for (T &x : v) istr >> x; return istr; } template <typename T, typename U> istream &operator>>(istream &istr, pair<T, U> &p) { istr >> p.first >> p.second; return istr; } template <typen...
#include <bits/stdc++.h> using namespace std; template <typename T> istream &operator>>(istream &istr, vector<T> &v) { for (T &x : v) istr >> x; return istr; } template <typename T, typename U> istream &operator>>(istream &istr, pair<T, U> &p) { istr >> p.first >> p.second; return istr; } template <typen...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
1,230
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; map<long long, long long> t; long long res = 0; long long ans = 0; t[0]++; long long ten = 1; for (int i = s.size() - 1; i >= 0; i--) { res = (res + ten * (s[i] - '0')) % 2019; if (t.count(res)) ans += t[res]; ...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; map<long long, long long> t; long long res = 0; long long ans = 0; t[0]++; long long ten = 1; for (int i = s.size() - 1; i >= 0; i--) { res = (res + ten * (s[i] - '0')) % 2019; if (t.count(res)) ans += t[res]; ...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 108], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48]]
1
130
S = list(input()) for i in range(len(S)): S[i] = int(S[i]) A = [S[len(S)-1]] mod = 2019 for i in range(1,len(S)): A.append((S[len(S)-i-1]*pow(10,i,mod)+A[i-1]) % mod) from collections import Counter c = Counter(A) ans = c[0] for i in range(1,2019): if c[i] >= 2: ans += (c[i]*(c[i]-1)) //2 pr...
S = list(input()) for i in range(len(S)): S[i] = int(S[i]) A = [S[len(S)-1]] mod = 2019 for i in range(1,len(S)): A.append((S[len(S)-i-1]*pow(10,i,mod)+A[i-1]) % mod) from collections import Counter c = Counter(A) ans = c[0] for i in range(0,2019): if c[i] >= 2: ans += (c[i]*(c[i]-1)) //2 pr...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
153
S_str=str(input()) S=int(S_str[-1]) N=len(S_str) mod=[0]*2018 mod[0]=1 now=S%2019 mod[now]+=1 for i in range(N-1)[::-1]: #print(i+1,S,S%2019) next=pow(10,N-1-i,2019) next=(next*int(S_str[i]))%2019 now=(now+next)%2019 mod[now]+=1 def culc(x): return x*(x-1)//2 ans=0 for j in range(len(...
S_str=str(input()) S=int(S_str[-1]) N=len(S_str) mod=[0]*2019 mod[0]=1 now=S%2019 mod[now]+=1 for i in range(N-1)[::-1]: #print(i+1,S,S%2019) next=pow(10,N-1-i,2019) next=(next*int(S_str[i]))%2019 now=(now+next)%2019 mod[now]+=1 def culc(x): return x*(x-1)//2 ans=0 for j in range(len(...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
152
S=list(input()) S.reverse() N=len(S) R=[0]*N R10=[0]*N m=2019 K=0 R10[0]=1 R[0]=int(S[0])%m for i in range(1,N): R10[i]=(R10[i-1]*10)%m R[i]=(R[i-1]+int(S[i])*R10[i])%m print(R) d={} for i in range(2019): d[i]=0 for i in range(N): d[R[i]]+=1 ans=0 for i in range(2019): if i == 0: ans += d[...
S=list(input()) S.reverse() N=len(S) R=[0]*N R10=[0]*N m=2019 K=0 R10[0]=1 R[0]=int(S[0])%m for i in range(1,N): R10[i]=(R10[i-1]*10)%m R[i]=(R[i-1]+int(S[i])*R10[i])%m d={} for i in range(2019): d[i]=0 for i in range(N): d[R[i]]+=1 ans=0 for i in range(2019): if i == 0: ans += d[i] ...
[["-", 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
215
// Copyright 2020 yaito3014 #include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); string S; cin >> S; const size_t len = S.length(); reverse(begin(S), end(S)); vector<int> dp(len + 1, 0); for (size_t i = 0, d = 1; i < len; ++i, d *= 10) dp[i + 1] ...
// Copyright 2020 yaito3014 #include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); string S; cin >> S; const size_t len = S.length(); reverse(begin(S), end(S)); vector<int> dp(len + 1, 0); for (size_t i = 0, d = 1; i < len; ++i, d = d * 10 % 2019) ...
[["-", 8, 9, 0, 7, 26, 34, 12, 11, 17, 108], ["+", 8, 9, 0, 7, 26, 34, 12, 11, 17, 32], ["+", 26, 34, 12, 11, 12, 16, 31, 16, 31, 22], ["+", 26, 34, 12, 11, 12, 16, 31, 16, 17, 48], ["+", 0, 7, 26, 34, 12, 11, 12, 16, 17, 109], ["+", 0, 7, 26, 34, 12, 11, 12, 16, 12, 13]]
1
181
// g++ -std=c++14 test.cpp -o test.out #include <algorithm> #include <bitset> #include <cassert> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string.h> #include <utility> #include <vector>...
// g++ -std=c++14 test.cpp -o test.out #include <algorithm> #include <bitset> #include <cassert> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string.h> #include <utility> #include <vector>...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 85], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
312
d = {0: 1} s, p = 0, 1 for c in reversed(input()): s = (s + p * int(c)) % 2019 d[s] = d.get(s, 0) + 1 p = p * 10 % 2019 print(sum(x * (x - 1) // 2 for x in d))
d = {0: 1} s, p = 0, 1 for c in reversed(input()): s = (s + p * int(c)) % 2019 d[s] = d.get(s, 0) + 1 p = p * 10 % 2019 print(sum(x * (x - 1) // 2 for x in d.values()))
[["+", 3, 668, 0, 659, 12, 652, 63, 319, 0, 131], ["+", 3, 668, 0, 659, 12, 652, 63, 319, 319, 22], ["+", 3, 668, 0, 659, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 668, 0, 25]]
5
79
#include <iostream> #include <string> using namespace std; int main() { string S; cin >> S; int sum_l[200001]; sum_l[S.length()] = 0; int m = 1; for (int i = S.length() - 1; i >= 0; i--) { sum_l[i] = (m * (S[i] - '0') + sum_l[i + 1]) % 2019; m *= 10; m %= 2019; } int count[2019] = {0}; f...
#include <iostream> #include <string> using namespace std; int main() { string S; cin >> S; int sum_l[200001]; sum_l[S.length()] = 0; int m = 1; for (int i = S.length() - 1; i >= 0; i--) { sum_l[i] = (m * (S[i] - '0') + sum_l[i + 1]) % 2019; m *= 10; m %= 2019; } int count[2019] = {0}; f...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
189
mod_673 = [1] * 672 for i in range(1,672): mod_673[i] = (mod_673[i -1] * 10) % 672 S = input() S = S[::-1] A = [0] * (len(S) + 1) B = [0] * (len(S) + 1) x = 0 Ans = [[0] * 3 for i in range(673)] for i in range(1, len(S) + 1): A[i] = (A[i - 1] + int(S[i - 1]) * mod_673[(i - 1) % 672]) % 673 B[i] = (B[i - 1]...
mod_673 = [1] * 672 for i in range(1,672): mod_673[i] = (mod_673[i -1] * 10) % 673 S = input() S = S[::-1] A = [0] * (len(S) + 1) B = [0] * (len(S) + 1) x = 0 Ans = [[0] * 3 for i in range(673)] for i in range(1, len(S) + 1): A[i] = (A[i - 1] + int(S[i - 1]) * mod_673[(i - 1) % 672]) % 673 B[i] = (B[i - 1]...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
239
S=input() from collections import defaultdict d=defaultdict(int) n=len(S) b=0 for i in range(n): a=int(S[n-i-1]) b+=a*pow(10,i,2019) b%=2019 d[b]+=1 ans=0 for k,v in d.items(): if k==0: ans+=v else: ans+=v*(v-1)//2 print(ans)
S=input() from collections import defaultdict d=defaultdict(int) n=len(S) b=0 for i in range(n): a=int(S[n-i-1]) b+=a*pow(10,i,2019) b%=2019 d[b]+=1 ans=0 for k,v in d.items(): if k==0: ans+=v ans+=v*(v-1)//2 print(ans)
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102]]
5
105
from functools import lru_cache from tqdm import tqdm S=input() count=[0 for i in range(2019)] length=len(S) #S=int(S) S=S+'0' S=S[::-1] _S=0 base=1 for i,s in enumerate(S): _S=base*int(s)+_S count[_S%2019]+=1 base*=10 base=base%2019 _S=_S%2019 retval=0 for key in range(2019): retval+=cou...
from functools import lru_cache S=input() count=[0 for i in range(2019)] length=len(S) #S=int(S) S=S+'0' S=S[::-1] _S=0 base=1 for i,s in enumerate(S): _S=base*int(s)+_S count[_S%2019]+=1 base*=10 base=base%2019 _S=_S%2019 retval=0 for key in range(2019): retval+=count[key]*(count[key]-1)...
[["-", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["-", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["-", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["-", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22]]
5
127
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const double pi = acos(-1); const ll mod = 1e9 + 7; char s[200500]; int s1[2019]; int a[2019]; int main() { cin >> s; int n = strlen(s); ll sum = 0; int tem; for (int i = 0; i < n; i++) { tem = s[i] - '0'; a[t...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const double pi = acos(-1); const ll mod = 1e9 + 7; char s[200500]; ll s1[2019]; ll a[2019]; int main() { cin >> s; int n = strlen(s); ll sum = 0; int tem; for (int i = 0; i < n; i++) { tem = s[i] - '0'; a[tem...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107]]
1
196
#include <bits/stdc++.h> using namespace std; int modpow(int a, int n, int mod) { int res = 1; while (n > 0) { if (n & 1) res *= a % mod; a = a * a % mod; n >>= 1; } return res; } int main() { const static int mod = 2019; int cnt_bin[2019] = {}; string S; cin >> S; int size = S.siz...
#include <bits/stdc++.h> using namespace std; int modpow(int a, int n, int mod) { int res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } int main() { const static int mod = 2019; int cnt_bin[2019] = {}; string S; cin >> S; int size = ...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 108], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 64, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["+", 64, 1, 0, 11, 12, 16, 31, 16, 17, 48]]
1
227
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define REP(i, n) for (int i = 1; i <= (n); i++) typedef long long ll; typedef pair<int, int> pii; int main() { string s; cin >> s; int n = s.size(); vector<ll> vec(n); vector<ll> ls(2020, 0); vec[n - 1] = s[n - 1...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define REP(i, n) for (int i = 1; i <= (n); i++) typedef long long ll; typedef pair<int, int> pii; int main() { string s; cin >> s; int n = s.size(); vector<ll> vec(n); vector<ll> ls(2020, 0); vec[n - 1] = s[n - 1...
[["+", 31, 69, 341, 342, 0, 16, 31, 69, 28, 22], ["+", 341, 342, 0, 16, 31, 69, 341, 342, 0, 70], ["+", 341, 342, 0, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 69, 341, 342, 0, 16, 12, 103, 0, 104], ["+", 31, 69, 341, 342, 0, 16, 12, 103, 0, 125]]
1
241
#include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; typedef long long i64; typedef i64 int_t; typedef vector<int_t> vi; typedef vector<vi> vvi; typedef pair<int_t, int_t> pi; #define tr(c, i) for (aut...
#include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; typedef long long i64; typedef i64 int_t; typedef vector<int_t> vi; typedef vector<vi> vvi; typedef pair<int_t, int_t> pi; #define tr(c, i) for (aut...
[["+", 8, 9, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 132], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 14, 8, 9, 0, 9, 0, 1, 0, 35]]
1
276
#include <algorithm> #include <bits/stdc++.h> #include <climits> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iostream> #include <math.h> using namespace __gnu_pbds; using namespace std; #define ll long long #define str string #define deb_arr(arr, n) ...
#include <algorithm> #include <bits/stdc++.h> #include <climits> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iostream> #include <math.h> using namespace __gnu_pbds; using namespace std; #define ll long long #define str string #define deb_arr(arr, n) ...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
536
import sys readline = sys.stdin.readline S = readline().strip() S = list(map(int, S)) N = len(S) P = 2019 rems = [0] * N a = 1 b = 0 for i in range(N): b = (b + (a * S[N - i - 1]) % P) % P rems[N - i - 1] = b a = a * 10 % P rems = rems + [0] counts = [0] * P for i in range(len(rems)): counts[rems[...
import sys readline = sys.stdin.readline S = readline().strip() S = list(map(int, S)) N = len(S) P = 2019 rems = [0] * N a = 1 b = 0 for i in range(N): b = (b + (a * S[N - i - 1]) % P) % P rems[N - i - 1] = b a = a * 10 % P rems = rems + [0] counts = [0] * P for i in range(len(rems)): counts[rems[...
[["-", 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
159
#include <bits/stdc++.h> using namespace std; #define int long long mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int mod = 2019; const int MAXN = 1e6 + 26; int cnt[mod]; int pw[MAXN]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); string s; cin >> s; pw[0] =...
#include <bits/stdc++.h> using namespace std; #define int long long mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int mod = 2019; const int MAXN = 1e6 + 26; int cnt[mod]; int pw[MAXN]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); string s; cin >> s; pw[0] =...
[["+", 0, 338, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 338, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 338, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 338, 8, 9, 0, 1, 0, 35]]
1
223
#include <bits/stdc++.h> using namespace std; using Int = long long; #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) #define ALL(v) (v).begin(), (v).end() #define PUTS(x) cout << (x) << endl; #define SZ(x) ((int)(x).size()...
#include <bits/stdc++.h> using namespace std; using Int = long long; #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) #define ALL(v) (v).begin(), (v).end() #define PUTS(x) cout << (x) << endl; #define SZ(x) ((int)(x).size()...
[["-", 0, 338, 8, 9, 0, 57, 75, 76, 0, 95], ["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
407
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m; i >= n; i--) #define ALL(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef pair<ll, l...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m; i >= n; i--) #define ALL(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef pair<ll, l...
[["+", 8, 9, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 132], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 9, 0, 1, 0, 35]]
1
215
#include <bits/stdc++.h> #define LLI long long int #define pii pair<int, int> #define fst first #define sec second #define ULTRA 2134567890 #define de(x) if (x != 0 && MODE == x) #define MODE 0 using namespace std; char S[107]; int cnt[2019] = {}; int main() { int i, j; scanf("%s", S); int N = strlen(S); L...
#include <bits/stdc++.h> #define LLI long long int #define pii pair<int, int> #define fst first #define sec second #define ULTRA 2134567890 #define de(x) if (x != 0 && MODE == x) #define MODE 0 using namespace std; char S[200007]; int cnt[2019] = {}; int main() { int i, j; scanf("%s", S); int N = strlen(S); ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]]
1
204
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> typedef long long ll; typedef unsigned long long ull; typedef long double LD; using namespace std; const int INF = 2147483647...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> typedef long long ll; typedef unsigned long long ull; typedef long double LD; using namespace std; const int INF = 2147483647...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
645
//#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long int ll;...
//#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long int ll;...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
164
#include <bits/stdc++.h> #define all(vec) vec.begin(), vec.end() #define pb push_back #define eb emplace_back #define fi first #define se second using namespace std; using ll = long long; using P = pair<ll, ll>; template <class T> using V = vector<T>; constexpr ll INF = (1LL << 30) - 1LL; constexpr ll MOD = 1e9 + 7; co...
#include <bits/stdc++.h> #define all(vec) vec.begin(), vec.end() #define pb push_back #define eb emplace_back #define fi first #define se second using namespace std; using ll = long long; using P = pair<ll, ll>; template <class T> using V = vector<T>; constexpr ll INF = (1LL << 30) - 1LL; constexpr ll MOD = 1e9 + 7; co...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
401
S = list(map(int, list(input()))) mod = 2019 ss = [0] tmp = 0 for i, s in enumerate(S[::-1]): tmp += s * pow(10, i, mod) tmp %= mod ss.append(tmp) cnts = [0] * 2018 ans = 0 for s in ss: ans += cnts[s] cnts[s] += 1 print(ans)
S = list(map(int, list(input()))) mod = 2019 ss = [0] tmp = 0 for i, s in enumerate(S[::-1]): tmp += s * pow(10, i, mod) tmp %= mod ss.append(tmp) cnts = [0] * 2019 ans = 0 for s in ss: ans += cnts[s] cnts[s] += 1 print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
95
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define repo(i, n) for (int i = 1; i <= n; i++) #define ssort(a) sort(a.begin(), a.end()) #define INF 1001001001 #define INFll 100100100100100 // debug用 #define PrintVec(x) \ for (auto ele...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define repo(i, n) for (int i = 1; i <= n; i++) #define ssort(a) sort(a.begin(), a.end()) #define INF 1001001001 #define INFll 100100100100100 // debug用 #define PrintVec(x) \ for (auto ele...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 75, 76, 0, 9, 0, 43, 49, 50, 49, 22], ["+", 75, 76, 0, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, ...
1
618
#include <bits/stdc++.h> using namespace std; #define ll long long #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--) #define rrep(i, n) RREP(i, n - 1, 0) #define REPL(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i...
#include <bits/stdc++.h> using namespace std; #define ll long long #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--) #define rrep(i, n) RREP(i, n - 1, 0) #define REPL(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 17, 151], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 49, 50, 51, 4, 0, 2, 3, 4, 0, 22], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 22]]
1
594
#include <bits/stdc++.h> #define ll long long #define MAXN 60 #define MAXM 110 using namespace std; int N, M; int S; ll A[MAXN]; ll B[MAXN]; ll C[MAXN]; ll D[MAXN]; vector<pair<int, int>> e[MAXN]; pair<ll, ll> edges[MAXM]; ll min_time[MAXN][2600]; bool visited[MAXN][2600]; int u, v; vector<int> path; priority_q...
#include <bits/stdc++.h> #define ll long long #define MAXN 60 #define MAXM 110 using namespace std; int N, M; int S; ll A[MAXM]; ll B[MAXM]; ll C[MAXN]; ll D[MAXN]; vector<pair<int, int>> e[MAXN]; pair<ll, ll> edges[MAXM]; ll min_time[MAXN][3000]; bool visited[MAXN][3000]; int u, v; vector<int> path; priority_q...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]]
1
663
#include <iostream> #ifdef MBP #include "stdc++.h" #else #include <bits/stdc++.h> #endif #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define REP(i, n) for (long long int i = 0, i##_len = (n); i < i##_len; ++i) #define REP1(i, n) for (long long int i = 1, i##_len = (n); i <= i##_len; ...
#include <iostream> #ifdef MBP #include "stdc++.h" #else #include <bits/stdc++.h> #endif #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define REP(i, n) for (long long int i = 0, i##_len = (n); i < i##_len; ++i) #define REP1(i, n) for (long long int i = 1, i##_len = (n); i <= i##_len; ...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
2,276
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() using in = int64_t; #define rep(i, n) for (in i = 0; i < (in)(n); i++) #define REP(i, a, b) for (in i = (in)(a); i < (in)(b); i++) #define Yes cout << "Yes" << endl #define No cout << "No" << endl #define yes cout <...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() using in = int64_t; #define rep(i, n) for (in i = 0; i < (in)(n); i++) #define REP(i, a, b) for (in i = (in)(a); i < (in)(b); i++) #define Yes cout << "Yes" << endl #define No cout << "No" << endl #define yes cout <...
[["-", 0, 43, 49, 50, 51, 16, 12, 23, 0, 24], ["-", 49, 50, 51, 16, 12, 23, 0, 16, 31, 22], ["-", 49, 50, 51, 16, 12, 23, 0, 16, 17, 33], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 16, 12, 23, 0, 25]]
1
798
#include <bits/stdc++.h> #ifdef __LOCAL #define DBG(X) cout << #X << " = " << (X) << endl; #define SAY(X) cout << (X) << endl; #include <filesystem> namespace fs = std::filesystem; #else #define DBG(X) #define SAY(X) #endif using namespace std; using ll = long long int; using ull = unsigned long long int; using ld = ...
#include <bits/stdc++.h> #ifdef __LOCAL #define DBG(X) cout << #X << " = " << (X) << endl; #define SAY(X) cout << (X) << endl; #include <filesystem> namespace fs = std::filesystem; #else #define DBG(X) #define SAY(X) #endif using namespace std; using ll = long long int; using ull = unsigned long long int; using ld = ...
[["-", 49, 50, 51, 4, 0, 2, 3, 4, 0, 22], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
1,185
#include "bits/stdc++.h" using namespace std; /////////////////////////////////////////// const long long int INF = 1LL << 60; const long long int Mod = 1000000007; using ll = long long int; using ci = const int; using vi = vector<int>; using Vi = vector<long long int>; using P = pair<int, int>; using PLL = pair<ll, ll...
#include "bits/stdc++.h" using namespace std; /////////////////////////////////////////// const long long int INF = 1LL << 60; const long long int Mod = 1000000007; using ll = long long int; using ci = const int; using vi = vector<int>; using Vi = vector<long long int>; using P = pair<int, int>; using PLL = pair<ll, ll...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
1,092
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> pii; typedef ...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> pii; typedef ...
[["+", 3, 4, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
2,288
#include <bits/stdc++.h> #define id(i, j) ((i)*3000 + (j)) using namespace std; typedef long long LL; typedef pair<LL, int> PLI; const int INF = 0x3f3f3f3f; const int LINF = 0x3f3f3f3f3f3f3f3f; const int maxn = 2e5 + 10; int N, M, S; struct edge { int v, c; }; vector<edge> g[maxn]; bool vis[maxn]; LL dist[maxn]; void...
#include <bits/stdc++.h> #define id(i, j) ((i)*3000 + (j)) using namespace std; typedef long long LL; typedef pair<LL, int> PLI; const int INF = 0x3f3f3f3f; const LL LINF = 0x3f3f3f3f3f3f3f3f; const int maxn = 2e5 + 10; int N, M, S; struct edge { int v, c; }; vector<edge> g[maxn]; bool vis[maxn]; LL dist[maxn]; void ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78]]
1
571
from heapq import heappush, heappop inf = float('inf') def dijkstra(graph:list, node:int, start:int) -> list: dist = [inf]*node dist[start] = 0 heap = [(0,start)] while heap: cost,thisNode = heappop(heap) for NextCost,NextNode in graph[thisNode]: dist_cand = dist[thisNode]+N...
from heapq import heappush, heappop inf = float('inf') def dijkstra(graph:list, node:int, start:int) -> list: dist = [inf]*node dist[start] = 0 heap = [(0,start)] while heap: cost,thisNode = heappop(heap) for NextCost,NextNode in graph[thisNode]: dist_cand = dist[thisNode]+N...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 3, 4, 0, 206, 206, 657, 31, 657, 31, 612], ["+", 3, 4, 0, 206, 206, 657, 31, 657, 31, 612]]
5
373
// ----------------------------------- // Author : MatsuTaku // Country : Japan // Created : 04/26/20 20:17:32 // ----------------------------------- #include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll n, m, s; cin >> n...
// ----------------------------------- // Author : MatsuTaku // Country : Japan // Created : 04/26/20 20:17:32 // ----------------------------------- #include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll n, m, s; cin >> n...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
510
#include <bits/stdc++.h> #define endl "\n" using namespace std; typedef long long int ll; typedef vector<ll> vl; typedef pair<ll, ll> PP; #define rep(i, n) for (ll i = 0; i < ll(n); i++) #define all(v) v.begin(), v.end() #define ITR(v, i) for (auto ite = v.begin(); ite != v.end(); ite++) const ll INF = 999999999999999;...
#include <bits/stdc++.h> #define endl "\n" using namespace std; typedef long long int ll; typedef vector<ll> vl; typedef pair<ll, ll> PP; #define rep(i, n) for (ll i = 0; i < ll(n); i++) #define all(v) v.begin(), v.end() #define ITR(v, i) for (auto ite = v.begin(); ite != v.end(); ite++) const ll INF = 999999999999999;...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13]]
1
679
#include <bits/stdc++.h> using namespace std; const double pi = 3.14159265; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int r; cin >> r; cout << pi * r * r << '\n'; }
#include <bits/stdc++.h> using namespace std; double pi = 3.14159265; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int r; cin >> r; cout << pi * r * 2 << '\n'; }
[["-", 36, 36, 0, 30, 0, 43, 0, 153, 0, 154], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
51
#include <iostream> using namespace std; #define PI 3.14159265358979 int main() { long double r; cout << 2 * PI * r << endl; }
#include <iostream> using namespace std; #define PI 3.14159265358979 int main() { long double r; cin >> r; cout << 2 * PI * r << endl; }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
29
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) #define pb push_back #define ALL(v) v.begin(), v.end() const long long INF = 1LL << 60; // 仮想的な無限大の値; using namespace std; using ll = long long; using P = pair<int, int>; tem...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) #define pb push_back #define ALL(v) v.begin(), v.end() const long long INF = 1LL << 60; // 仮想的な無限大の値; using namespace std; using ll = long long; using P = pair<int, int>; tem...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
194
R = int(input()) import math pi = math.pi print(2 * pi * R ** 2)
R = int(input()) import math pi = math.pi print(2 * pi * R)
[["-", 0, 652, 3, 4, 0, 657, 12, 657, 17, 578], ["-", 0, 652, 3, 4, 0, 657, 12, 657, 12, 612]]
5
25
#include <iostream> using namespace std; int main(void) { double r, a; cin >> r; r * 2; a = r * 3.141592; a *= 1000000; a = (int)a; a /= 1000000; cout << a << endl; }
#include <iostream> using namespace std; int main(void) { double r, a; cin >> r; r *= 2; a = r * 3.141592; a *= 1000000; a = (int)a; a /= 1000000; cout << a << endl; }
[["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 48], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 108]]
1
53
$R = trim(fgets(STDIN)); echo $R * 3.14 * 2;
<?php $R = trim(fgets(STDIN)); echo $R * 3.14 * 2;
[["+", 36, 36, 36, 36, 36, 36, 0, 493, 0, 605]]
6
19
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define F first #define S second const int A = 5e2 + 2; const int mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); double r; cin >> r; cout << setprecision(6) << fixed; cout << 2.0 * acos...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define F first #define S second const int A = 5e2 + 2; const int mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); double r; cin >> r; cout << setprecision(6) << fixed << 2.0 * acos(-1) * r...
[["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 12, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 12, 16, 31, 16, 12, 2, 3, 4, 0, 13]]
1
91
#include <math.h> #include <stdio.h> int main(void) { int a; scanf("%d", &a); printf("%d\n", 2 * M_PI * a); return 0; }
#include <math.h> #include <stdio.h> int main(void) { int a; scanf("%d", &a); printf("%f\n", (double)2 * M_PI * a); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 3, 4, 0, 16, 31, 16, 31, 74, 0, 24], ["+", 0, 16, 31, 16, 31, 74, 39, 77, 39, 40], ["+", 3, 4, 0, 16, 31, 16, 31, 74, 0, 25]]
0
41
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using ll = long long; using namespace std; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define all(x) (x)...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using ll = long long; using namespace std; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define all(x) (x)...
[["-", 31, 16, 12, 2, 3, 4, 0, 16, 12, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
174
#include <bits/stdc++.h> using namespace std; int main() { int r; cin >> r; cout << fixed << setprecision(20); cout << r * 3.1415926535897932384 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int r; cin >> r; cout << fixed << setprecision(20); cout << 2 * r * 3.1415926535897932384 << endl; }
[["+", 0, 16, 31, 16, 12, 16, 31, 16, 31, 13], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48]]
1
36
import math R = int(input) print(2*math.pi*R)
import math R = int(input()) print(2*math.pi*R)
[["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
18
#include <bits/stdc++.h> using namespace std; int main() { double R; cin >> R; double pi = 3.141592653589; cout << pi * R * R << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int R; cin >> R; double pi = 3.141592653589; cout << 2 * pi * R << endl; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 31, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 31, 13], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22]]
1
34
import math R = int(input()) ans = R ** 2 * math.pi print(ans)
import math R = int(input()) ans = R * 2 * math.pi print(ans)
[["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 578], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 17, 48]]
5
23
#include <iostream> using namespace std; int main() { double R, pi = 3.141592; cin >> R; cout << R * pi << endl; }
#include <iostream> using namespace std; int main() { double R, pi = 3.141592; cin >> R; cout << 2 * R * pi << endl; }
[["+", 0, 16, 31, 16, 12, 16, 31, 16, 31, 13], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48]]
1
31
#include <bits/stdc++.h> using namespace std; int main() { int R, p = 3.141592; cin >> R; cout << 2 * R * p << endl; }
#include <bits/stdc++.h> using namespace std; int main() { double R, p = 3.141592; cin >> R; cout << 2 * R * p << endl; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
33
#include <iostream> #define _USE_MATH_DEFINES #include <math.h> using namespace std; int main() { int r; cout << 2 * r * M_PI; }
#include <iostream> #define _USE_MATH_DEFINES #include <math.h> using namespace std; int main() { int r; cin >> r; cout << 2 * r * M_PI; }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
27
#include <algorithm> #include <array> #include <bitset> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <stdint.h> #include <string> #include <time.h> #include <unorder...
#include <algorithm> #include <array> #include <bitset> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <stdint.h> #include <string> #include <time.h> #include <unorder...
[["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48]]
1
217
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll N; cin >> N; cout << N * 3.141592 << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll N; cin >> N; cout << 2 * N * 3.14159265359 << endl; }
[["+", 0, 16, 31, 16, 12, 16, 31, 16, 31, 13], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
33
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <string> #include <vector> using namespace std; void func() { int64_t R; cin >> R; printf("%.5llf\n", 2 * R * 3.14159265358979323846); } int main() { // while (1) func(); return 0; }
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <string> #include <vector> using namespace std; void func() { int64_t R; cin >> R; printf("%.10lf\n", 2 * R * 3.14159265358979323846); } int main() { // while (1) func(); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
59
#include <iostream> using namespace std; int main() { double r; cin >> r; cout << r * 3.14; return 0; }
#include <iostream> using namespace std; int main() { double r; cin >> r; cout << 2 * r * 3.14; return 0; }
[["+", 0, 1, 0, 16, 12, 16, 31, 16, 31, 13], ["+", 0, 1, 0, 16, 12, 16, 31, 16, 17, 48]]
1
28
import math def main(): r = int(input()) print(math.pi * r ** 2) if __name__ == "__main__": main()
import math def main(): r = int(input()) print(math.pi * r * 2) if __name__ == "__main__": main()
[["-", 0, 652, 3, 4, 0, 657, 12, 657, 17, 578], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 48]]
5
35
import math print(int(input()*math.pi*2))
import math print(int(input())*math.pi*2)
[["+", 0, 657, 31, 657, 31, 652, 3, 4, 0, 25], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
17
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> //#include<boost/multiprecision/cpp_int.hpp> //#include<boost/multiprecision/cpp_dec_float.hpp> // namespace mp=boost::multiprecision; //#define mulint mp::cpp_int //#define mulfloat mp::cpp_dec_float_100 using namespace std; struct __INIT { __INIT() { cin.ti...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> //#include<boost/multiprecision/cpp_int.hpp> //#include<boost/multiprecision/cpp_dec_float.hpp> // namespace mp=boost::multiprecision; //#define mulint mp::cpp_int //#define mulfloat mp::cpp_dec_float_100 using namespace std; struct __INIT { __INIT() { cin.ti...
[["-", 3, 4, 0, 83, 0, 16, 31, 16, 12, 22], ["-", 0, 2, 3, 4, 0, 83, 0, 16, 17, 72]]
1
747
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; const ll mod = 1e9 + 7; // const ll mod = 998244353; #define REP(i, n) for (int i = 0; i < (int)n; ++i) // debug #define dump(x) cer...
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; const ll mod = 1e9 + 7; // const ll mod = 998244353; #define REP(i, n) for (int i = 0; i < (int)n; ++i) // debug #define dump(x) cer...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
1,153
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, // tree_order_statistics_node_update> #define ll long long #define int long long #define FOR(i, x, y) for (int i = x; i <= y; ++i) #define pb ...
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, // tree_order_statistics_node_update> #define ll long long #define int long long #define FOR(i, x, y) for (int i = x; i <= y; ++i) #define pb ...
[["+", 3, 4, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
726
#include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #includ...
#include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #includ...
[["-", 28, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["-", 12, 66, 28, 2, 3, 4, 0, 16, 17, 72], ["-", 12, 66, 28, 2, 3, 4, 0, 16, 12, 13], ["+", 28, 2, 3, 4, 0, 16, 12, 16, 31, 13], ["+", 28, 2, 3, 4, 0, 16, 12, 16, 17, 48], ["+", 28, 2, 3, 4, 0, 16, 12, 16, 12, 13]]
1
813