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
S = int(input()) mod = 10**9+7 def comb_mod(n,r,mod): ans = 1 for i in range(r): ans *= (n-i)*pow(i+1,mod-2,mod) ans %= mod return ans ans = 0 for k in range(1,S): if S-2*k-1<=0: continue ans += comb_mod(S-2*k-1,k-1,mod) ans %= mod print(ans)
S = int(input()) mod = 10**9+7 def comb_mod(n,r,mod): ans = 1 for i in range(r): ans *= (n-i)*pow(i+1,mod-2,mod) ans %= mod return ans ans = 0 for k in range(1,S+1): if S-2*k-1<0: continue ans += comb_mod(S-2*k-1,k-1,mod) ans %= mod print(ans)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18]]
5
111
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> // using namespace __gnu_pbds; using namespace std; typedef long long ll; typedef long double ld; // typedef tree<int,null_type,less<int // >,rb_tree_tag,tree_order_statistics_node_update>indexed_set; template <class T1, class T2> ostream &operator<<(o...
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> // using namespace __gnu_pbds; using namespace std; typedef long long ll; typedef long double ld; // typedef tree<int,null_type,less<int // >,rb_tree_tag,tree_order_statistics_node_update>indexed_set; template <class T1, class T2> ostream &operator<<(o...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35]]
1
670
S = int(input()) tmp = [0]*2010 mod = 10**9+7 for i in range(3,2001): count = 0 for j in range(3,2001): if i - j < 0: break count += tmp[i-j] tmp[i] = (count+1)%mod tmp[S]
S = int(input()) tmp = [0]*2010 mod = 10**9+7 for i in range(3,2001): count = 0 for j in range(3,2001): if i - j < 0: break count += tmp[i-j] tmp[i] = (count+1)%mod print(tmp[S])
[["+", 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, 25]]
5
77
#include <bits/stdc++.h> using namespace std; #define dbg(a) cerr << __LINE__ << ": " << #a << " = " << a << '\n' typedef long long ll; const int N = 2002; const ll mod = 1e9 + 7; ll fact[N], invf[N]; ll bigmod(ll a, ll b, ll mod) { a %= mod; ll ret = 1; while (b) { if (b & 1) ret = ret * a % mod; ...
#include <bits/stdc++.h> using namespace std; #define dbg(a) cerr << __LINE__ << ": " << #a << " = " << a << '\n' typedef long long ll; const int N = 2002; const ll mod = 1e9 + 7; ll fact[N], invf[N]; ll bigmod(ll a, ll b, ll mod) { a %= mod; ll ret = 1; while (b) { if (b & 1) ret = ret * a % mod; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
348
''' from operator import mul from functools import reduce def cmb(n,r): r = min(n-r,r) if r == 0: return 1 over = reduce(mul, range(n, n - r, -1)) under = reduce(mul, range(1,r + 1)) return over // under ''' def cmb(n, r, p): if (r < 0) or (n < r): return 0 r = min(r, n - r) re...
''' from operator import mul from functools import reduce def cmb(n,r): r = min(n-r,r) if r == 0: return 1 over = reduce(mul, range(n, n - r, -1)) under = reduce(mul, range(1,r + 1)) return over // under ''' def cmb(n, r, p): if (r < 0) or (n < r): return 0 r = min(r, n - r) re...
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 20]]
5
211
import java.util.Scanner; public class Main { static int mod = (int)1e9 + 7; static int max = 1000000 * 2; static long[] fact = new long[max]; static long[] modinv = new long[max]; static long[] factinv = new long[max]; public static void initCombi() { fact[0] = 1; fact[1] = 1; modinv[1] = ...
import java.util.Scanner; public class Main { static int mod = (int)1e9 + 7; static int max = 1000000 * 2; static long[] fact = new long[max]; static long[] modinv = new long[max]; static long[] factinv = new long[max]; public static void initCombi() { fact[0] = 1; fact[1] = 1; modinv[1] = ...
[["-", 8, 196, 0, 52, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 52, 15, 15, 0, 16, 17, 20]]
3
319
#include <bits/stdc++.h> #define m 1000000007 using namespace std; long long dp[2005]; long long done(int n) { if (n < 0) { return 0; } if (n == 0) { return 1; } if (dp[n] != -1) return dp[n]; long long ans = 0; for (int i = 3; i <= 9; i++) { ans += done(n - i); } dp[n] = (ans % m); ...
#include <bits/stdc++.h> #define m 1000000007 using namespace std; long long dp[2005]; long long done(int n) { if (n < 0) { return 0; } if (n == 0) { return 1; } if (dp[n] != -1) return dp[n]; long long ans = 0; for (int i = 3; i <= n; i++) { ans += done(n - i); } dp[n] = (ans % m); ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
145
#import #=input() s=int(input()) #=map(int,input().split()) #=list(map(int,input().split())) #=[list(map(int,input().split())) for _ in range()] mod = 10 ** 9 + 7 def f(a,b,c): re = 1 q = max(b, c) for i in range(q+1, a+1): re *= i w = min(b, c) for i in range(1, w+1): re //= i ...
#import #=input() s=int(input()) #=map(int,input().split()) #=list(map(int,input().split())) #=[list(map(int,input().split())) for _ in range()] mod = 10 ** 9 + 7 def f(a,b,c): re = 1 q = max(b, c) for i in range(q+1, a+1): re *= i w = min(b, c) for i in range(1, w+1): re //= i ...
[["+", 0, 662, 12, 23, 0, 657, 31, 23, 0, 24], ["+", 31, 23, 0, 657, 12, 652, 3, 4, 0, 25]]
5
137
#include <bits/stdc++.h> //#include <boost/multiprecision/cpp_int.hpp> using namespace std; // using namespace boost::multiprecision; typedef long long int ll; typedef long double ld; typedef pair<ll, ll> P; #define PI 3.141592653589793 #define MOD 1000000007 //#define MOD 998244353 #define ALL(obj) (obj).begin(), (obj...
#include <bits/stdc++.h> //#include <boost/multiprecision/cpp_int.hpp> using namespace std; // using namespace boost::multiprecision; typedef long long int ll; typedef long double ld; typedef pair<ll, ll> P; #define PI 3.141592653589793 #define MOD 1000000007 //#define MOD 998244353 #define ALL(obj) (obj).begin(), (obj...
[["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 38]]
1
329
#include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; using pll = pair<ll, ll>; #define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i) #define all(x) (x).begin(), (x).end() template <class T1, class T2> inline bool chmax(T1 &a, const T2 &b) { if (a < b) { ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; using pll = pair<ll, ll>; #define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i) #define all(x) (x).begin(), (x).end() template <class T1, class T2> inline bool chmax(T1 &a, const T2 &b) { if (a < b) { ...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
270
s = int(input()) import sys p = 10**9+7 dp = [0]*100#2003 dp[2]=1 if s<=3: print(dp[s-1]) sys.exit() for i in range(3,s): dp[i] = (dp[i-1]%p+dp[i-3]%p)%p print(dp[s-1])
s = int(input()) import sys p = 10**9+7 dp = [0]*2003 dp[2]=1 if s<=3: print(dp[s-1]) sys.exit() for i in range(3,s): dp[i] = (dp[i-1]%p+dp[i-3]%p)%p print(dp[s-1])
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
95
// Classic #include <bits/stdc++.h> using namespace std; #define ll long long #define vll vector<ll> #define vi vector<int> #define pi pair<int, int> #define vp vector<pi> #define pb push_back #define mp make_pair #define F first #define S second #define For(i, a, b) for (ll i = a; i < b; i++) #define endl "\n" #define...
// Classic #include <bits/stdc++.h> using namespace std; #define ll long long #define vll vector<ll> #define vi vector<int> #define pi pair<int, int> #define vp vector<pi> #define pb push_back #define mp make_pair #define F first #define S second #define For(i, a, b) for (ll i = a; i < b; i++) #define endl "\n" #define...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 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
291
#include <bits/stdc++.h> #include <chrono> using namespace std; template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } // typedef //------------------------------------------ typedef pair<int, int> PII; typedef long long LL; typedef pair<LL, LL> PLL; // container u...
#include <bits/stdc++.h> #include <chrono> using namespace std; template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } // typedef //------------------------------------------ typedef pair<int, int> PII; typedef long long LL; typedef pair<LL, LL> PLL; // container u...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20]]
1
461
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; (i) < ((int)(n)); ++(i)) const ll INF = 1e10; const ll MOD = 1e9 + 7; long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a =...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; (i) < ((int)(n)); ++(i)) const ll INF = 1e10; const ll MOD = 1e9 + 7; long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a =...
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 47], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 17, 20], ["-", 75, 76, 0, 9, 0, 7, 8, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
376
#include <bits/stdc++.h> //#include <ext/pb_ds/detail/standard_policies.hpp> const double pi = acos(-1.0); // memset ( a , 0 , n * sizeof(ll) ) ; using namespace std; // using namespace __gnu_pbds; #define endl '\n' #define sl(n) scanf("%lld", &n) #define mp make_pair #define pb push_back #define ppb pop_back #define ...
#include <bits/stdc++.h> //#include <ext/pb_ds/detail/standard_policies.hpp> const double pi = acos(-1.0); // memset ( a , 0 , n * sizeof(ll) ) ; using namespace std; // using namespace __gnu_pbds; #define endl '\n' #define sl(n) scanf("%lld", &n) #define mp make_pair #define pb push_back #define ppb pop_back #define ...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35], ["-", 49, 50, 51, 16, 31, 23, 0, 16, 17, 72], ["-", 49, 50, 51, 16, 31, 23, 0, 16, 12, 13]]
1
1,017
#define DEBUG 0 #include <bits/stdc++.h> #define all(v) (v).begin(), (v).end() #define pb push_back #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>;...
#define DEBUG 0 #include <bits/stdc++.h> #define all(v) (v).begin(), (v).end() #define pb push_back #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
1,402
n=int(input()) dp=[1 for i in range(n+1)] dp[0]=dp[1]=dp[2]=0 modd=1e9+7 for i in range(3,n): for j in range(3,n-i+1): dp[i+j]=(dp[i+j]+dp[i])%modd print(int(dp[n]))
n=int(input()) dp=[1 for i in range(n+2)] dp[0]=dp[1]=dp[2]=0 modd=1e9+7 for i in range(3,n): for j in range(3,n-i+1): dp[i+j]=(dp[i+j]+dp[i])%modd print(int(dp[n]))
[["-", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]]
5
99
//#include <bits/stdc++.h> #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric...
//#include <bits/stdc++.h> #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
353
#include <bits/stdc++.h> using namespace std; #define int long long #define SZ(X) ((int)(X).size()) const int m = 1000000007; int C[2001][2001]; int32_t main() { int n; cin >> n; int ans = 0; C[0][0] = 1; for (int i = 1; i <= n; ++i) { for (int j = 0; j <= i; ++j) { C[i][j] = C[i - 1][j] + C[i - 1...
#include <bits/stdc++.h> using namespace std; #define int long long #define SZ(X) ((int)(X).size()) const int m = 1000000007; int C[2001][2001]; int32_t main() { int n; cin >> n; int ans = 0; C[0][0] = 1; for (int i = 1; i <= n; ++i) { for (int j = 0; j <= i; ++j) { C[i][j] = C[i - 1][j] + C[i - 1...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
187
if __name__ == '__main__': MODULO = 10**9 + 7 res_arr = [0, 0, 0, 1, 1, 1, 2] S = int(input()) for i in range(7, S+1): res = 0 for k in range(3, i-3 + 1): res = (res + res_arr[k]) % MODULO res_arr.append(res + 1) print(res_arr[-1])
if __name__ == '__main__': MODULO = 10**9 + 7 res_arr = [0, 0, 0, 1, 1, 1, 2] # if (S < 7): S = int(input()) for i in range(7, S+1): res = 0 for k in range(3, i-3 + 1): res = (res + res_arr[k]) % MODULO res_arr.append(res + 1) print(res_arr[S])
[["-", 0, 652, 3, 4, 0, 206, 206, 664, 17, 33], ["-", 0, 652, 3, 4, 0, 206, 206, 664, 28, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 22]]
5
96
/* Created by Rahul Goel. */ #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; template <typename T> using ordered_set = tree<T,...
/* Created by Rahul Goel. */ #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; template <typename T> using ordered_set = tree<T,...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 20]]
1
616
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdint> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string.h> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdint> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string.h> #includ...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 51, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 51, 16,...
1
1,298
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <utility> #include <vector> using namespace std; type...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <utility> #include <vector> using namespace std; type...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
355
from math import factorial mod=10**9+7 def comb(n,r): return ((factorial(n)//factorial(r))//factorial(n-r))%mod n=int(input()) ans=0 for k in range(1,min((n+2)//3,(n-1)//2+1)): ans+=comb(n-2*k-1,k-1) ans%=mod print(ans%mod)
from math import factorial mod=10**9+7 def comb(n,r): return ((factorial(n)//factorial(r))//factorial(n-r))%mod n=int(input()) ans=0 for k in range(1,min((n)//3+1,(n-1)//2+1)): ans+=comb(n-2*k-1,k-1) ans%=mod print(ans%mod)
[["-", 3, 4, 0, 657, 31, 23, 0, 657, 17, 72], ["-", 3, 4, 0, 657, 31, 23, 0, 657, 12, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
107
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define fastio() \ ios_base::sync_with_stdio(0); ...
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define fastio() \ ios_base::sync_with_stdio(0); ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
673
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll MOD = 1e9 + 7; constexpr ll INF = 1LL << 60; #define REP(i, init, n) for (int i = (int)(init); i < (int)(n); i++) #define vi vector<int> #define vl vector<long> #define vvi vector<vector<int>> #define vvl vector<vector<long>> #define pin...
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll MOD = 1e9 + 7; constexpr ll INF = 1LL << 60; #define REP(i, init, n) for (int i = (int)(init); i < (int)(n); i++) #define vi vector<int> #define vl vector<long> #define vvi vector<vector<int>> #define vvl vector<vector<long>> #define pin...
[["-", 0, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 52, 15, 339, 51, 16, 17, 20]]
1
288
#include <bits/stdc++.h> using namespace std; int main() { int s; cin >> s; vector<int> F(s, 0); for (int i = 3; i <= s; ++i) { F[i] = 1; } int mod = 1e9 + 7; for (int i = 5; i <= s; ++i) { for (int j = 0; j < i; ++j) { if (j >= 3 && i - j >= 3) { F[i] = (F[i] + F[j]) % mod; }...
#include <bits/stdc++.h> using namespace std; int main() { int s; cin >> s; vector<int> F(s + 1, 0); for (int i = 3; i <= s; ++i) { F[i] = 1; } int mod = 1e9 + 7; for (int i = 1; i <= s; ++i) { for (int j = 0; j < i; ++j) { if (j >= 3 && i - j >= 3) { F[i] = (F[i] + F[j]) % mod; ...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
137
import sys read = sys.stdin.read readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def main(): S = int(input()) ans = 0 j = 1 fact = [1, 1] factinv = [1, 1] inv = [0, 1] for i in range(2, 3000 + 1): fact.append((fact[-1] * i...
import sys read = sys.stdin.read readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def main(): S = int(input()) ans = 0 j = 1 fact = [1, 1] factinv = [1, 1] inv = [0, 1] for i in range(2, 3000 + 1): fact.append((fact[-1] * i...
[["-", 0, 14, 8, 196, 0, 52, 15, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 52, 15, 666, 667, 20]]
5
255
S=int(input()) x=10**9+7 a=[0 for i in range(S+1)] a[3]=1 a[4]=1 a[5]=1 a[6]=2 for i in range(7,S+1): a[i]=(a[i-1]+a[i-3])%x print(a[S])
S=int(input()) x=10**9+7 a=[0 for i in range(2001)] a[3]=1 a[4]=1 a[5]=1 a[6]=2 for i in range(7,S+1): a[i]=(a[i-1]+a[i-3])%x print(a[S])
[["-", 0, 659, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
94
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <numeric> #include <string> #include <vector> #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 INF 2e9 #define ALL(v) v.begin(), ...
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <numeric> #include <string> #include <vector> #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 INF 2e9 #define ALL(v) v.begin(), ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20]]
1
682
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define REPR(i, n) for (int i = n - 1; i >= 0; --i) using namespace std; #define MOD 1000000007 #define int long long int //------------ATCODER TEMPLATE------------- vector<int> fact, finv, inv; void init(int N) { fact.resize(N + 1); fin...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define REPR(i, n) for (int i = n - 1; i >= 0; --i) using namespace std; #define MOD 1000000007 #define int long long int //------------ATCODER TEMPLATE------------- vector<int> fact, finv, inv; void init(int N) { fact.resize(N + 1); fin...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
316
#include <bits/stdc++.h> using namespace std; using ll = long long int; using lc = complex<double>; int main(void) { constexpr ll MOD = 1e9 + 7; constexpr double PI = acos(-1); cout << fixed << setprecision(32); cin.tie(0); ios::sync_with_stdio(false); constexpr ll MAX = 3e3; vector<ll> fact, ifact; ...
#include <bits/stdc++.h> using namespace std; using ll = long long int; using lc = complex<double>; int main(void) { constexpr ll MOD = 1e9 + 7; constexpr double PI = acos(-1); cout << fixed << setprecision(32); cin.tie(0); ios::sync_with_stdio(false); constexpr ll MAX = 3e3; vector<ll> fact, ifact; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
344
# コンビネーション mod = 10**9+7 def cmb(n, r, mod=mod): if ( n<=0 or r<0 or r>n ): return 0 r = min(r, n-r) return g1[n] * g2[r] * g2[n-r] % mod NN = 10**6 # 使うデータによって変える g1 = [1, 1] # 元テーブル g2 = [1, 1] #逆元テーブル inverse = [0, 1] #逆元テーブル計算用テーブル for i in range( 2, NN + 1 ): g1.append( ( g1[-1] * i ) % m...
# コンビネーション mod = 10**9+7 def cmb(n, r, mod=mod): if ( n<0 or r<0 or r>n ): return 0 r = min(r, n-r) return g1[n] * g2[r] * g2[n-r] % mod NN = 10**6 # 使うデータによって変える g1 = [1, 1] # 元テーブル g2 = [1, 1] #逆元テーブル inverse = [0, 1] #逆元テーブル計算用テーブル for i in range( 2, NN + 1 ): g1.append( ( g1[-1] * i ) % mo...
[["-", 15, 23, 0, 679, 31, 679, 31, 666, 667, 19], ["+", 15, 23, 0, 679, 31, 679, 31, 666, 667, 18]]
5
217
using namespace std; //#define fileio #ifndef fileio #include <iostream> #endif #include <algorithm> #include <assert.h> #include <ctime> #include <fstream> #include <functional> #include <map> #include <math.h> #include <queue> #include <set> #include <string> #include <vector> typedef long long ll; #ifdef fileio...
using namespace std; //#define fileio #ifndef fileio #include <iostream> #endif #include <algorithm> #include <assert.h> #include <ctime> #include <fstream> #include <functional> #include <map> #include <math.h> #include <queue> #include <set> #include <string> #include <vector> typedef long long ll; #ifdef fileio...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
858
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; // using namespace atcoder; #define ll long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define rep1(i, n) FOR(i, 1, n + 1) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i) #define whole(x) (x)....
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; // using namespace atcoder; #define ll long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define rep1(i, n) FOR(i, 1, n + 1) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i) #define whole(x) (x)....
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
871
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; cin >> n; ll max_z = 0; ll min_z = 1000000000; ll max_w = 0; ll min_w = 1000000000; for (int i = 0; i < n; i++) { ll x, y, z, w; cin >> x >> y; z = x + y; w = x - y; max_z = max(max_z, z); min_z...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; cin >> n; ll max_z = -1000000000; ll min_z = 1000000000; ll max_w = -1000000000; ll min_w = 1000000000; for (int i = 0; i < n; i++) { ll x, y, z, w; cin >> x >> y; z = x + y; w = x - y; max_z = max(...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
148
#include <algorithm> #include <iostream> #include <math.h> typedef long long ll; using namespace std; ll n, a, b; ll x[200005], y[200005], z[200005]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b; x[i] = a + b; y[i] = a - b; z[i] = b - a; } sort(x, x + n); sort(y, y + n...
#include <algorithm> #include <iostream> #include <math.h> typedef long long ll; using namespace std; ll n, a, b; ll x[200005], y[200005], z[200005]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b; x[i] = a + b; y[i] = a - b; z[i] = b - a; } sort(x, x + n); sort(y, y + n...
[["-", 3, 4, 0, 23, 0, 16, 12, 69, 28, 22], ["+", 3, 4, 0, 23, 0, 16, 12, 69, 28, 22]]
1
177
/* Author : Nishant Gupta 2.0 */ #include <bits/stdc++.h> using namespace std; #define LL long long int #define getcx getchar_unlocked #define X first #define Y second #define PB push_back #define MP make_pair #define MAX 100005 #define LOG_MAX 20 #define MOD 1000000007 #define INF 0x3f3f3f3f #define INFL (LL(1e18...
/* Author : Nishant Gupta 2.0 */ #include <bits/stdc++.h> using namespace std; #define LL long long int #define getcx getchar_unlocked #define X first #define Y second #define PB push_back #define MP make_pair #define MAX 100005 #define LOG_MAX 20 #define MOD 1000000007 #define INF 0x3f3f3f3f #define INFL (LL(1e18...
[["-", 12, 2, 3, 4, 0, 16, 12, 118, 119, 120], ["+", 12, 2, 3, 4, 0, 16, 12, 118, 119, 120]]
1
624
#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; #ifndef ONLINE_JUDGE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <class Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name << " : " << arg1 ...
#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; #ifndef ONLINE_JUDGE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <class Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name << " : " << arg1 ...
[["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13]]
1
1,214
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include ...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 28, 22]]
1
315
#include <bits/stdc++.h> #include <iostream> #define mod 1000000007 using namespace std; int main() { long long n; cin >> n; long long a = LONG_MAX, b = LONG_MIN, c = LONG_MAX, d = LONG_MIN; long long x, y, a1 = 0, a2 = 0, b1 = 0, b2 = 0, c1 = 0, c2 = 0, d1 = 0, d2 = 0; vector<vector<long>> ...
#include <bits/stdc++.h> #include <iostream> #define mod 1000000007 using namespace std; int main() { long long n; cin >> n; long long a = LONG_MAX, b = LONG_MIN, c = LONG_MAX, d = LONG_MIN; long long x, y, a1 = 0, a2 = 0, b1 = 0, b2 = 0, c1 = 0, c2 = 0, d1 = 0, d2 = 0; vector<vector<long>> ...
[["-", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["-", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
1
235
// #include <chutiya_mistakes_avoid.h> // implementation bekar hai tera #include <bits/stdc++.h> #include <string.h> #define int long long #define MAX (int)(1e7 + 5) #define MAX2D (int)(1e3 + 5) #define itn int #define inf 5e18 #define MOD (int)(1e9 + 7) #define pb push_back #define mk make_pair #define all(x) x.begin(...
// #include <chutiya_mistakes_avoid.h> // implementation bekar hai tera #include <bits/stdc++.h> #include <string.h> #define int long long #define MAX (int)(1e7 + 5) #define MAX2D (int)(1e3 + 5) #define itn int #define inf 5e18 #define MOD (int)(1e9 + 7) #define pb push_back #define mk make_pair #define all(x) x.begin(...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 28, 22]]
1
732
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define fi first #define se second #define UP(a, b, c) for (ll(a) = (b); (a) < (c); (a)++) #define UU(a, b, c) for (ll(a) = (b); (a) <= (c); (a)++)...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define fi first #define se second #define UP(a, b, c) for (ll(a) = (b); (a) < (c); (a)++) #define UU(a, b, c) for (ll(a) = (b); (a) <= (c); (a)++)...
[["-", 0, 16, 12, 118, 28, 69, 341, 342, 0, 22], ["+", 0, 16, 12, 118, 28, 69, 341, 342, 0, 22], ["-", 0, 16, 31, 118, 28, 69, 341, 342, 0, 22], ["+", 0, 16, 31, 118, 28, 69, 341, 342, 0, 22]]
1
403
/* -ensure correct output format -ensure printing required output -reread the problem statement */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> pll; typedef pair<ll, pair<ll, ll>> plll; #define fastread() (ios_base::sync_with_std...
/* -ensure correct output format -ensure printing required output -reread the problem statement */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> pll; typedef pair<ll, pair<ll, ll>> plll; #define fastread() (ios_base::sync_with_std...
[["-", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22]]
1
470
n = int(input()) a = [] b = [] for i in range(n): x , y = map(int,input().split()); a.append(x + y) b.append(abs(x - y)) aa = max(a)-min(a) bb = max(b)-min(b) if aa >= bb: print(aa) else: print(bb)
n = int(input()) a = [] b = [] for i in range(n): x , y = map(int,input().split()); a.append(x + y) b.append(x - y) aa = max(a)-min(a) bb = max(b)-min(b) if aa >= bb: print(aa) else: print(bb)
[["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
97
#include <bits/stdc++.h> #include <iostream> #include <string> #include <vector> #define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i)) #define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i)) #define REP_R(i, n) for (int i = (int)(n)-1; (i) >= 0; --(i)) #define REP3R(i, m, n) for (int i = (int)(n)-1; (i) >= (i...
#include <bits/stdc++.h> #include <iostream> #include <string> #include <vector> #define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i)) #define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i)) #define REP_R(i, n) for (int i = (int)(n)-1; (i) >= 0; --(i)) #define REP3R(i, m, n) for (int i = (int)(n)-1; (i) >= (i...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 28, 22]]
1
394
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; long long s[n][2]; for (int i = 0; i < n; i++) { cin >> x >> y; s[i][0] = x; s[i][1] = y; } long long res = INT_MIN; long long mxPlus = INT_MIN, mxSub = INT_MIN, mnPlus = INT_MAX, mnSub = INT_MAX; for (int i = ...
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n; long long s[n][2]; for (int i = 0; i < n; i++) { cin >> x >> y; s[i][0] = x; s[i][1] = y; } long long res = INT_MIN; long long mxPlus = INT_MIN, mxSub = INT_MIN, mnPlus = INT_MAX, mnSub = INT_MAX; f...
[["+", 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
223
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long int ll; typedef unsigned long long int ull; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long int ll; typedef unsigned long long int ull; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
[["-", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22]]
1
399
#include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second #define M 1000000007 #define N 100001 #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second #define M 1000000007 #define N 100001 #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
200
#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() { int n; cin >> n; int cmax0 = 0; int cmin0 = 2001001001; int cmax1 = 0; int cmin1 = 2001001001; rep(i, n) { int x, y; cin >> x >> y; cmax0...
#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() { int n; cin >> n; int cmax0 = -2001001001; int cmin0 = 2001001001; int cmax1 = -2001001001; int cmin1 = 2001001001; rep(i, n) { int x, y; cin ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
144
#!/usr/bin/env python3 import sys def s(points, k, l): np = list(map(lambda arg: k*arg[0] + l*arg[0], points)) return abs(max(np)-min(np)) def solve(N: int, x: "List[int]", y: "List[int]"): points = list(zip(x, y)) print(max([ s(points, +1, +1), s(points, -1, -1), ...
#!/usr/bin/env python3 import sys def s(points, k, l): np = list(map(lambda arg: k*arg[0] + l*arg[1], points)) return abs(max(np)-min(np)) def solve(N: int, x: "List[int]", y: "List[int]"): points = list(zip(x, y)) print(max([ s(points, +1, +1), s(points, -1, -1), ...
[["-", 0, 670, 8, 657, 12, 657, 12, 206, 206, 612], ["+", 0, 670, 8, 657, 12, 657, 12, 206, 206, 612]]
5
254
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; #define int long long const int INF = 1e10; signed main() { int n; cin >> n; vector<int> x(n), y(n); rep(i, n) cin >> x[i] >> y[i]; int min_1 = INF; int max_1 = 0; int min_2 = INF; int max_2 = 0; re...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; #define int long long const int INF = 1e10; signed main() { int n; cin >> n; vector<int> x(n), y(n); rep(i, n) cin >> x[i] >> y[i]; int min_1 = INF; int max_1 = -INF; int min_2 = INF; int max_2 = -INF;...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 28, 22]]
1
195
N = int(input()) x1, y1 = map(int, input().split()) x2, y2 = map(int, input().split()) if x1+y1 > x2+y2: xmax = x1+y1 xmin = x2+y2 else: max1 = x2+y2 min1 = x1+y1 if x1-y1 > x2-y2: max2 = x1-y1 min2 = x2-y2 else: max2 = x2-y2 min2 = x1-y1 for i in range(N-2): x, y = map(int, input(...
N = int(input()) x1, y1 = map(int, input().split()) x2, y2 = map(int, input().split()) if x1+y1 > x2+y2: max1 = x1+y1 min1 = x2+y2 else: max1 = x2+y2 min1 = x1+y1 if x1-y1 > x2-y2: max2 = x1-y1 min2 = x2-y2 else: max2 = x2-y2 min2 = x1-y1 for i in range(N-2): x, y = map(int, input(...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32]]
5
193
#include <algorithm> #include <iostream> #include <vector> using namespace std; int mod = 1000000007; int main() { int n; cin >> n; vector<int> x(n), y(n), a(n), b(n); for (int i = 0; i < n; i++) { cin >> x[i] >> y[i]; a[i] = x[i] - y[i]; b[i] = x[i] + y[i]; } int mx[2] = {}, mn[2] = {201010...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int mod = 1000000007; int main() { int n; cin >> n; vector<int> x(n), y(n), a(n), b(n); for (int i = 0; i < n; i++) { cin >> x[i] >> y[i]; a[i] = x[i] - y[i]; b[i] = x[i] + y[i]; } int mx[2] = {-2010101010, -2010...
[["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 21]]
1
248
#include <iostream> using namespace std; long long mod = 1e9 + 7; long long power(long long a, long long b) { long long res = 1; while (b > 0) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; } long long factorial(long long n) { long long fact = 1; for (long ...
#include <iostream> using namespace std; long long mod = 1e9 + 7; long long power(long long a, long long b) { long long res = 1; while (b > 0) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; } long long factorial(long long n) { long long fact = 1; for (long ...
[["-", 0, 16, 12, 16, 31, 23, 0, 16, 17, 48], ["-", 0, 16, 12, 16, 31, 23, 0, 16, 12, 22]]
1
294
S = int(input()) div = 10 ** 9 + 7 dp = [0, 0, 0, 1, 1, 1] for i in range(6, S + 1): dp.append((dp[i-3]+dp[i-1]) % div) print(dp[-1])
S = int(input()) div = 10 ** 9 + 7 dp = [0, 0, 0, 1, 1, 1] for i in range(6, S + 1): dp.append((dp[i-3]+dp[i-1]) % div) print(dp[S])
[["-", 0, 652, 3, 4, 0, 206, 206, 664, 17, 33], ["-", 0, 652, 3, 4, 0, 206, 206, 664, 28, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 22]]
5
72
#include <bits/stdc++.h> #define lld long long int #define vec vector<lld> #define pll pair<lld, lld> #define pb push_back #define ss second #define ff first #define mp make_pair #define mod 1000000007 #define answer(x) cout << endl << "answer : " << x << endl << endl; #define op(x) cout << x << endl; #define maxn 5000...
#include <bits/stdc++.h> #define lld long long int #define vec vector<lld> #define pll pair<lld, lld> #define pb push_back #define ss second #define ff first #define mp make_pair #define mod 1000000007 #define answer(x) cout << endl << "answer : " << x << endl << endl; #define op(x) cout << x << endl; #define maxn 5000...
[["-", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22]]
1
253
#include <bits/stdc++.h> using namespace std; #define ll long long #define LI list<int> #define vct vector #define D(a) (double)(a) #define vi vct<int> #define pii pair<int, int> #define pll pair<ll, ll> #define vvi vct<vi> #define vll vct<ll> #define vvll vct<vll> #define vpii vct<pii> #define vpll vct<pll> #define vb...
#include <bits/stdc++.h> using namespace std; #define ll long long #define LI list<int> #define vct vector #define D(a) (double)(a) #define vi vct<int> #define pii pair<int, int> #define pll pair<ll, ll> #define vvi vct<vi> #define vll vct<ll> #define vvll vct<vll> #define vpii vct<pii> #define vpll vct<pll> #define vb...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
244
import numpy as np MOD = 10**9+7 n = int(input()) arr = np.zeros((n+1,n+1), dtype=np.int16) for i in np.arange(3,n+1): arr[0,i] = 1 for i in np.arange(1,n+1): sum_ = 0 for j in np.arange(3*i,n+1): sum_ += arr[i-1,j] sum_ %= MOD if j+3 >= n + 1: break arr[i,j+3]...
import numpy as np MOD = 10**9+7 n = int(input()) arr = np.zeros((n+1,n+1), dtype=int) for i in np.arange(3,n+1): arr[0,i] = 1 for i in np.arange(1,n+1): sum_ = 0 for j in np.arange(3*i,n+1): sum_ += arr[i-1,j] sum_ %= MOD if j+3 >= n + 1: break arr[i,j+3] = su...
[["-", 12, 652, 3, 4, 0, 653, 51, 319, 500, 22], ["-", 12, 652, 3, 4, 0, 653, 51, 319, 0, 131], ["-", 12, 652, 3, 4, 0, 653, 51, 319, 319, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 653, 51, 22]]
5
157
from operator import mul from functools import reduce def cmb(n,r): r = min(n-r,r) if r == 0: return 1 over = reduce(mul, range(n, n - r, -1)) under = reduce(mul, range(1,r + 1)) return over // under N = 10**9 +7 S = int(input()) if S==1 or S==2: print(0) n = S // 3 ans =0 for i in range(1, ...
from operator import mul from functools import reduce def cmb(n,r): r = min(n-r,r) if r == 0: return 1 over = reduce(mul, range(n, n - r, -1)) under = reduce(mul, range(1,r + 1)) return over // under N = 10**9 +7 S = int(input()) if S==1 or S==2: print(0) exit(0) n = S // 3 ans =0 for i ...
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
143
s = int(input()) mod = 10**9 + 7 # dp[i]: 最後に切った場所がi dp = [0]*(s + 1) dp[0] = 1 for i in range(3, s+1): for j in range(3, (i-3)+1): dp[i] += dp[j] dp[i] %= mod print(dp[s])
s = int(input()) mod = 10**9 + 7 # dp[i]: 最後に切った場所がi dp = [0]*(s + 1) dp[0] = 1 for i in range(3, s+1): for j in range(0, (i-3)+1): dp[i] += dp[j] dp[i] %= mod print(dp[s])
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
83
// Problem : D - Redistribution // Contest : AtCoder - AtCoder Beginner Contest 178 // URL : https://atcoder.jp/contests/abc178/tasks/abc178_d // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) /* WINNERS NEVER QUIT AND QUITTERS NEVER WIN!! Falling down ...
// Problem : D - Redistribution // Contest : AtCoder - AtCoder Beginner Contest 178 // URL : https://atcoder.jp/contests/abc178/tasks/abc178_d // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) /* WINNERS NEVER QUIT AND QUITTERS NEVER WIN!! Falling down ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 20]]
1
435
import math s = int(input()) MOD = 10**9+7 maximum = int(s/3) ans = 0 for i in range(maximum): ans += (math.factorial(i + s-(i*3+3))/(math.factorial(i)*math.factorial(s-(i*3+3))))%MOD print(int(ans)%(10**9+7))
import math s = int(input()) MOD = 10**9+7 maximum = int(s/3) ans = 0 for i in range(maximum): ans += (math.factorial(i + s-(i*3+3))//(math.factorial(i)*math.factorial(s-(i*3+3))))%MOD print(int(ans)%(10**9+7))
[["-", 0, 677, 12, 657, 31, 23, 0, 657, 17, 85], ["+", 0, 677, 12, 657, 31, 23, 0, 657, 17, 676]]
5
97
MOD = 10**9 + 7 S = int(input()) dp = [0]*(S+1) dp[0] = 1 dp[3] = 1 for i in range(4,S+1): for k in range(i-2): dp[i] += dp[k] print(dp[S]%MOD)
MOD = 10**9 + 7 S = int(input()) dp = [0]*(S+4) dp[0] = 1 dp[3] = 1 for i in range(4,S+1): for k in range(i-2): dp[i] += dp[k] print(dp[S]%MOD)
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612]]
5
78
#include <iostream> #include <vector> using namespace std; using ll = long long; int main() { ll MOD = 1e9 + 7; int S; cin >> S; vector<ll> ans(S + 1, 0); ans[0] = 1; for (int i = 4; i <= S; i++) { ans[i] = (ans[i - 1] + ans[i - 3]) % MOD; } cout << ans[S] << endl; return 0; }
#include <iostream> #include <vector> using namespace std; using ll = long long; int main() { ll MOD = 1e9 + 7; int S; cin >> S; vector<ll> ans(S + 1, 0); ans[0] = 1; for (int i = 3; i <= S; i++) { ans[i] = (ans[i - 1] + ans[i - 3]) % MOD; } cout << ans[S] << endl; return 0; }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
105
MOD = 10**9+7 s = int(input()) a = [0]*range(s+1) a[0] = 1 for i in range(3, s+1): a[i] = sum(a[:i-2]) % MOD print(a[s])
MOD = 10**9+7 s = int(input()) a = [0]*(s+1) a[0] = 1 for i in range(3, s+1): a[i] = sum(a[:i-2]) % MOD print(a[s])
[["-", 0, 1, 0, 662, 12, 657, 12, 652, 63, 22]]
5
69
package main import ( "bufio" "fmt" "math" "os" "strconv" ) //Util func nextStr() string { sc.Scan() return sc.Text() } func nextInt() int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil { panic(e) } return i } func maxInt(a, b int) int { if a > b { return a } else { return b } } func ...
package main import ( "bufio" "fmt" "math" "os" "strconv" ) //Util func nextStr() string { sc.Scan() return sc.Text() } func nextInt() int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil { panic(e) } return i } func maxInt(a, b int) int { if a > b { return a } else { return b } } func ...
[["-", 8, 196, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 36, 36, 0, 434, 0, 435, 8, 196, 0, 165], ["-", 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], ["-", 0, 1, 0, 2, 3, 4, 0, 437, 439, 22]]
7
1,069
S = int(input()) mod = 10**9 + 7 dp = [0] * (S+1) dp[0] = 1 for i in range(1, S+1): for j in range((i+3)+1): dp[i] += dp[j] dp[i] %= mod print(dp[S])
S = int(input()) mod = 10**9 + 7 dp = [0] * (S+1) dp[0] = 1 for i in range(1, S+1): for j in range((i-3)+1): dp[i] += dp[j] dp[i] %= mod print(dp[S])
[["-", 3, 4, 0, 657, 31, 23, 0, 657, 17, 72], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 17, 33]]
5
80
#include <bits/stdc++.h> int main() { using namespace std; constexpr unsigned long MOD{1000000007}; // my fast in constexpr unsigned long buf_size = 5UL; char buffer[buf_size]; fread(buffer, 1, buf_size, stdin); unsigned long tmp_buf = 0; const auto &read = [&tmp_buf, &buffer] { unsigned long ret; ...
#include <bits/stdc++.h> int main() { using namespace std; constexpr unsigned long MOD{1000000007}; // my fast in constexpr unsigned long buf_size = 5UL; char buffer[buf_size]; fread(buffer, 1, buf_size, stdin); unsigned long tmp_buf = 0; const auto &read = [&tmp_buf, &buffer] { unsigned long ret; ...
[["-", 8, 9, 0, 1, 0, 11, 31, 23, 0, 22], ["+", 8, 9, 0, 1, 0, 11, 31, 23, 0, 22]]
1
166
#D s = int(input()) num = [0,0,1] for i in range(s-3): num = [num[1],num[2],num[0]+num[2]] #print(num) print(num[2]%(10**9+7))
#D s = int(input()) num = [1,0,0] for i in range(s-2): num = [num[1],num[2],num[0]+num[2]] #print(num) print(num[2]%(10**9+7))
[["-", 0, 656, 0, 1, 0, 662, 12, 634, 0, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 634, 0, 612], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
67
def resolve(): base = 10**9+7 S = int(input()) dp = [0] * (S+1) dp[0] = 1 if S > 3: dp[3] = 1 for i in range(4, S+1): dp[i] = dp[i-2] + dp[i-3] + dp[i-4] # print(dp) print(dp[S]%base) if __name__ == "__main__": resolve()
def resolve(): base = 10**9+7 S = int(input()) dp = [0] * (S+1) dp[0] = 1 if S >= 3: dp[3] = 1 for i in range(4, S+1): dp[i] = dp[i-2] + dp[i-3] + dp[i-4] # print(dp) print(dp[S]%base) if __name__ == "__main__": resolve()
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20]]
5
105
mod = (10 ** 9 + 7) tot = 1 l = [1, 0, 0] for i in range(2000): nex = (tot - l[-1] - l[-2]) tot = (tot + nex) l.append(nex) print(l[int(input())])
mod = (10 ** 9 + 7) tot = 1 l = [1, 0, 0] for i in range(2000): nex = (tot - l[-1] - l[-2]) % mod tot = (tot + nex) % mod l.append(nex) print(l[int(input())])
[["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
71
S = int(input()) if S < 3: return 0 MODULO = int(1e9+7) dp = [0,0,0,1] for i in range(4,S+1): x = dp[i-3] + dp[i-1] x %= MODULO dp.append(x) print(dp[-1])
S = int(input()) if S < 3: print(0) else: MODULO = int(1e9+7) dp = [0,0,0,1] for i in range(4,S+1): x = dp[i-3] + dp[i-1] x %= MODULO dp.append(x) print(dp[-1])
[["-", 0, 656, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
78
#dt = {} for i in x: dt[i] = dt.get(i,0)+1 import sys;input = sys.stdin.readline inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()] M = 10**9+7 n = inp() dp = [0]*2001 if n <= 2: print(dp[n]) exit() dp[0] = 1 t = 0 for i in range(3,n+1): t += dp[i-3] dp[i] = t print(dp[n])
#dt = {} for i in x: dt[i] = dt.get(i,0)+1 import sys;input = sys.stdin.readline inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()] M = 10**9+7 n = inp() dp = [0]*2001 if n <= 2: print(dp[n]) exit() dp[0] = 1 t = 0 for i in range(3,n+1): t += dp[i-3] dp[i] = t%M print(dp[n]%M)
[["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
118
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define ll long long #define REP(i, n) for (int i = 0; i < (n); ++i) #define PI 3.141592653589 #define MOD 1000000007 using namespace std; template <typename T> T gcd(T a, T b)...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define ll long long #define REP(i, n) for (int i = 0; i < (n); ++i) #define PI 3.141592653589 #define MOD 1000000007 using namespace std; template <typename T> T gcd(T a, T b)...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20]]
1
407
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long int #define ld long double #define MAX 100005 #define MOD 1000000007 #define fast \ ios::sync_with_stdio(0); \ ...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long int #define ld long double #define MAX 100005 #define MOD 1000000007 #define fast \ ios::sync_with_stdio(0); \ ...
[["-", 8, 9, 0, 43, 49, 80, 81, 16, 31, 22], ["-", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
213
#include <bits/stdc++.h> using namespace std; #define ll long long int ll mod = 1000000007; int main() { ios::sync_with_stdio(false); cin.tie(NULL); ll s; cin >> s; ll dp[s + 1], cum[s + 1]; dp[0] = 0; dp[1] = 0; dp[2] = 0; dp[3] = 1; cum[0] = 0; cum[1] = 0; cum[2] = 0; cum[3] = 1; for (...
#include <bits/stdc++.h> using namespace std; #define ll long long int ll mod = 1000000007; int main() { ios::sync_with_stdio(false); cin.tie(NULL); ll s; cin >> s; ll dp[s + 2], cum[s + 2]; dp[0] = 0; dp[1] = 0; dp[2] = 0; dp[3] = 1; cum[0] = 0; cum[1] = 0; cum[2] = 0; cum[3] = 1; for (...
[["-", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13]]
1
181
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> //#include <atcoder/all> // using namespace atcoder; using namespace std; #define all(v) v.begin(), v.end() using in = int64_t; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define Yes cout << "Yes" ...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> //#include <atcoder/all> // using namespace atcoder; using namespace std; #define all(v) v.begin(), v.end() using in = int64_t; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define Yes cout << "Yes" ...
[["+", 0, 43, 49, 50, 51, 4, 0, 2, 63, 22], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 24], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 21], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 25]]
1
319
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 long long powMOD(long long base, long long pow) { long long result = 1; while (pow > 0) { if (pow % 2 == 1) { result = (result * base) % MOD; } base = (base * base) % MOD; pow >>= 1; } return result; } long long c...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 long long powMOD(long long base, long long pow) { long long result = 1; while (pow > 0) { if (pow % 2 == 1) { result = (result * base) % MOD; } base = (base * base) % MOD; pow >>= 1; } return result; } long long c...
[["-", 8, 9, 0, 1, 0, 11, 12, 23, 0, 24], ["-", 8, 9, 0, 1, 0, 11, 12, 23, 0, 25], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20]]
1
238
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1LL << 60; const ll MOD = 1e9 + 7; ll modPow(long long a, long long n, long long p) { if (n == 0) return 1; // 0乗にも対応する場合 if (n == 1) return a % p; if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p; long long t =...
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1LL << 60; const ll MOD = 1e9 + 7; ll modPow(long long a, long long n, long long p) { if (n == 0) return 1; // 0乗にも対応する場合 if (n == 1) return a % p; if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p; long long t =...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78]]
1
297
from sys import stdin input = stdin.readline S = int(input()) A = [-1] * (S + 1) mod = 10 ** 9 + 7 for i in range(3): A[i] = 0 for i in range(3, 6): A[i] = 1 def dfs(n): if A[n] != -1: return A[n] else: A[n] = (dfs(n - 3) + dfs(n - 1)) % mod return A[n] print(dfs(S))
from sys import stdin input = stdin.readline S = int(input()) A = [-1] * (2001) mod = 10 ** 9 + 7 for i in range(3): A[i] = 0 for i in range(3, 6): A[i] = 1 def dfs(n): if A[n] != -1: return A[n] else: A[n] = (dfs(n - 3) + dfs(n - 1)) % mod return A[n] print(dfs(S))
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 31, 22], ["-", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 612]]
5
122
#!/usr/bin/python3 # -*- coding: utf-8 -*- s = int(input()) mod = 10**9 + 7 a_list = [0] * (s + 1) a_list[0] = 1 a_list[1] = 0 a_list[2] = 0 a_list[3] = 1 for i in range(4, s + 1): a_list[i] = a_list[i - 1] + a_list[i - 3] a_list[i] %= mod print(a_list[s])
#!/usr/bin/python3 # -*- coding: utf-8 -*- s = int(input()) mod = 10**9 + 7 a_list = [0] * (2000 + 1) a_list[0] = 1 a_list[1] = 0 a_list[2] = 0 a_list[3] = 1 for i in range(4, s + 1): a_list[i] = a_list[i - 1] + a_list[i - 3] a_list[i] %= mod print(a_list[s])
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 31, 22], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 31, 612]]
5
95
N = int(input()) x, y = map(int, input().split()) d = [x - y, x - y, x + y, x + y] for i in range(1,N): x, y = map(int, input().split()) d[0] = max(d[0], x-y) d[1] = min(d[1], x-y) d[2] = max(d[2], x+y) d[3] = min(d[3], x+y) print(d) print(max(d[0]-d[1], d[2]-d[3]))
N = int(input()) x, y = map(int, input().split()) d = [x - y, x - y, x + y, x + y] for i in range(1,N): x, y = map(int, input().split()) d[0] = max(d[0], x-y) d[1] = min(d[1], x-y) d[2] = max(d[2], x+y) d[3] = min(d[3], x+y) print(max(d[0]-d[1], d[2]-d[3]))
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
162
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; const ll MOD = 1e9 + 7; // const ll MOD = 998244353; const ll INF = 1ll << 60; #define FOR(i, a, b) for (ll i = (a); i < (ll)(b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() #define DEBUG(x) ; #d...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; const ll MOD = 1e9 + 7; // const ll MOD = 998244353; const ll INF = 1ll << 60; #define FOR(i, a, b) for (ll i = (a); i < (ll)(b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() #define DEBUG(x) ; #d...
[["-", 8, 9, 0, 1, 0, 11, 12, 11, 12, 13], ["+", 0, 1, 0, 11, 12, 11, 12, 91, 17, 33], ["+", 0, 1, 0, 11, 12, 11, 12, 91, 28, 22]]
1
315
#include <bits/stdc++.h> using namespace std; long long n, a[200005], b[200005], c[200005], d[200005]; int main() { cin >> n; for (long long i = 1; i <= n; i++) { cin >> a[i] >> b[i]; c[i] = a[i] + b[i]; d[i] = abs(a[i] - b[i]); } sort(c + 1, c + n + 1); sort(d + 1, d + n + 1); cout << max(c[n] ...
#include <bits/stdc++.h> using namespace std; long long n, a[200005], b[200005], c[200005], d[200005]; int main() { cin >> n; for (long long i = 1; i <= n; i++) { cin >> a[i] >> b[i]; c[i] = a[i] + b[i]; d[i] = (a[i] - b[i]); } sort(c + 1, c + n + 1); sort(d + 1, d + n + 1); cout << max(c[n] - c...
[["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22]]
1
156
N = int(input()) p = [[None] for i in range(N)] for i in range(N): p[i] = list(map(int, input().split())) p.sort() #print(p) INFINITE = 5 * 10**9 maxUp = {} minDown = {} for i in range(1, N): maxUp[i] = max(maxUp.get(i-1, -INFINITE), p[i-1][1] - p[i-1][0]) for i in range(1, N): minDown[i] = min(minDown....
N = int(input()) p = [[None] for i in range(N)] for i in range(N): p[i] = list(map(int, input().split())) p.sort() #print(p) INFINITE = 5 * 10**9 maxUp = {} minDown = {} for i in range(1, N): maxUp[i] = max(maxUp.get(i-1, -INFINITE), p[i-1][1] - p[i-1][0]) for i in range(1, N): minDown[i] = min(minDown....
[["-", 12, 652, 3, 4, 0, 657, 31, 664, 17, 33], ["-", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 662, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33]]
5
252
#include <algorithm> #include <climits> #include <iostream> using namespace std; using ll = long long; struct p { ll z, w; // z = x + y, w = x - y; }; const int maxn = 2e5 + 5; p points[maxn]; int main(void) { int n; cin >> n; ll x, y; for (int i = 0; i < n; ++i) { cin >> x >> y; points[i].z = x ...
#include <algorithm> #include <climits> #include <iostream> using namespace std; using ll = long long; struct p { ll z, w; // z = x + y, w = x - y; }; const int maxn = 2e5 + 5; p points[maxn]; int main(void) { int n; cin >> n; ll x, y; for (int i = 0; i < n; ++i) { cin >> x >> y; points[i].z = x ...
[["-", 12, 118, 28, 69, 341, 342, 0, 16, 31, 22], ["-", 12, 118, 28, 69, 341, 342, 0, 16, 17, 33], ["-", 12, 118, 28, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 16, 12, 118, 28, 69, 341, 342, 0, 13]]
1
233
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) (v).begin(), (v).end() using ll = long long; constexpr int INF = 1e9; constexpr long long LINF = 1e18; constexpr long long MOD = 1e9 + 7; signed main() { int n; cin >> n; ll x[n], y[n]; ll xx[n], y...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) (v).begin(), (v).end() using ll = long long; constexpr int INF = 1e9; constexpr long long LINF = 1e18; constexpr long long MOD = 1e9 + 7; signed main() { int n; cin >> n; ll x[n], y[n]; ll xx[n], y...
[["-", 12, 2, 3, 4, 0, 16, 12, 69, 28, 22], ["+", 12, 2, 3, 4, 0, 16, 12, 69, 28, 22]]
1
185
#include <bits/stdc++.h> using namespace std; using ll = long long; using vec = vector<ll>; using mat = vector<vec>; using pll = pair<ll, ll>; #define INF (1LL << 60) #define MOD 1000000007 #define PI 3.14159265358979323846 #define REP(i, m, n) for (ll(i) = (m), (i_len) = (n); (i) < (i_len); ++(i)) #define FORR(i, v...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vec = vector<ll>; using mat = vector<vec>; using pll = pair<ll, ll>; #define INF (1LL << 60) #define MOD 1000000007 #define PI 3.14159265358979323846 #define REP(i, m, n) for (ll(i) = (m), (i_len) = (n); (i) < (i_len); ++(i)) #define FORR(i, v...
[["-", 31, 16, 31, 118, 28, 69, 341, 342, 0, 13], ["+", 31, 16, 31, 118, 28, 69, 341, 342, 0, 22], ["-", 31, 16, 12, 118, 28, 69, 341, 342, 0, 13], ["+", 31, 16, 12, 118, 28, 69, 341, 342, 0, 22]]
1
599
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) typedef long long ll; typedef pair<int, int> P; typedef pair<long long, long long> Pll; typedef vector<int> vi; typedef vector<ll> vll; const long long mod = 1000000007LL; int ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) typedef long long ll; typedef pair<int, int> P; typedef pair<long long, long long> Pll; typedef vector<int> vi; typedef vector<ll> vll; const long long mod = 1000000007LL; int ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
223
#include <bits/stdc++.h> #define nl '\n' using namespace std; typedef long long ll; void solve() { int N; cin >> N; vector<int> x(N), y(N); for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; x[i] = a, y[i] = b; } int mx1 = 0, mn1 = 1e9 + 4; int mx2 = mx1, mn2 = mn1; for (int i = 0; ...
#include <bits/stdc++.h> #define nl '\n' using namespace std; typedef long long ll; void solve() { int N; cin >> N; vector<int> x(N), y(N); for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; x[i] = a, y[i] = b; } int mx1 = -1e9 - 4, mn1 = 1e9 + 4; int mx2 = mx1, mn2 = mn1; for (int ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
234
n = int(input()) p = [list(map(int, input().split())) for _ in range(n)] q = [[x+y, x-y] for x, y in p] print(max(max(q)[0] - min(q)[0], max(q, key=lambda x: x[1])[0] - min(q, key=lambda x: x[1])[0]))
n = int(input()) p = [list(map(int, input().split())) for _ in range(n)] q = [[x+y, x-y] for x, y in p] print(max(max(q)[0] - min(q)[0], max(q, key=lambda x: x[1])[1] - min(q, key=lambda x: x[1])[1]))
[["-", 0, 652, 3, 4, 0, 657, 31, 206, 206, 612], ["+", 0, 652, 3, 4, 0, 657, 31, 206, 206, 612], ["-", 0, 652, 3, 4, 0, 657, 12, 206, 206, 612], ["+", 0, 652, 3, 4, 0, 657, 12, 206, 206, 612]]
5
110
#include <bits/stdc++.h> #include <functional> #include <stdio.h> using namespace std; #define ll long long int #define dd long double #define pb push_back #define pf push_front #define pi pair<ll, ll> #define vi vector<ll> #define vpi vector<pi> #define mi map<ll, ll> #define vvi vector<vector<ll>> #define mpi map<pi,...
#include <bits/stdc++.h> #include <functional> #include <stdio.h> using namespace std; #define ll long long int #define dd long double #define pb push_back #define pf push_front #define pi pair<ll, ll> #define vi vector<ll> #define vpi vector<pi> #define mi map<ll, ll> #define vvi vector<vector<ll>> #define mpi map<pi,...
[["-", 8, 9, 0, 9, 0, 57, 75, 76, 0, 95]]
1
493
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define RREP...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define RREP...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 28, 22]]
1
332
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; #define REP(i, n) for (ll i = 0; i < (n); ++i) #define RREP(i, n) for (ll i = (n)-1; i >= 0; --i) #define ALL(v) (v).begin(), (v).end() template <class T> using reverse_priority_queue = priority_queue<T, vector<T>, great...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; #define REP(i, n) for (ll i = 0; i < (n); ++i) #define RREP(i, n) for (ll i = (n)-1; i >= 0; --i) #define ALL(v) (v).begin(), (v).end() template <class T> using reverse_priority_queue = priority_queue<T, vector<T>, great...
[["+", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33]]
1
884
#include <algorithm> #include <iostream> #define ll long long using namespace std; ll codx[200000 + 5], cody[200000 + 5]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> codx[i] >> cody[i]; ll min1 = 0x7f7f7f7f; ll min2 = 0x7f7f7f7f; ll max1 = -0x7f7f7f7f; ll max2 = -0x7f7f7f7f; fo...
#include <algorithm> #include <iostream> #define ll long long using namespace std; ll codx[200000 + 5], cody[200000 + 5]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> codx[i] >> cody[i]; ll min1 = 0x7f7f7f7f; ll min2 = 0x7f7f7f7f; ll max1 = -0x7f7f7f7f; ll max2 = -0x7f7f7f7f; fo...
[["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22]]
1
187
#include <climits> #include <iostream> #include <string> #include <vector> #define input std::cin using vector = std::vector<int>; using lint = long long int; using string = std::string; int main() { int n; input >> n; int max_sum = INT_MIN, min_sum = INT_MAX; int max_dif = INT_MIN, min_dif = INT_MIN; for (...
#include <climits> #include <iostream> #include <string> #include <vector> #define input std::cin using vector = std::vector<int>; using lint = long long int; using string = std::string; int main() { int n; input >> n; int max_sum = INT_MIN, min_sum = INT_MAX; int max_dif = INT_MIN, min_dif = INT_MAX; for (...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22]]
1
168
#include <bits/stdc++.h> //#include <atcoder/all> // using namespace atcoder; using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef pair<int, int> P; typedef long long ll; int main() { int n; cin >> n; ll xd0, yd0, xd1, yd1; xd0 = yd0 = 1001001001001001001; xd1 = yd1 = 0; rep(i, n) ...
#include <bits/stdc++.h> //#include <atcoder/all> // using namespace atcoder; using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef pair<int, int> P; typedef long long ll; int main() { int n; cin >> n; ll xd0, yd0, xd1, yd1; xd0 = yd0 = 100100100100; xd1 = yd1 = -100100100100; rep(i...
[["-", 8, 9, 0, 1, 0, 11, 12, 11, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 12, 13]]
1
145
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; typedef long long ll; const int maxn = 5e5 + 10; int main() { int n; cin >> n; vector<ll> a, b; for (int i = 1; i <= n; i++) { ll x, y; cin >> x >> y; a.push_back(x + y); b.push_back(abs(x - y)); } ...
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; typedef long long ll; const int maxn = 5e5 + 10; int main() { int n; cin >> n; vector<ll> a, b; for (int i = 1; i <= n; i++) { ll x, y; cin >> x >> y; a.push_back(x + y); b.push_back(x - y); } sor...
[["-", 0, 1, 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, 25]]
1
156
#include <bits/stdc++.h> using namespace std; using ll = long long; #include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <string_view> #include <unordered_map> #inc...
#include <bits/stdc++.h> using namespace std; using ll = long long; #include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <string_view> #include <unordered_map> #inc...
[["-", 0, 16, 12, 2, 3, 4, 0, 83, 0, 45], ["-", 0, 16, 12, 2, 3, 4, 0, 83, 0, 21], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 16, 12, 2, 3, 4, 0, 83, 0, 46]]
1
1,087