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
from math import gcd n = int(input()) p = 10**9 + 7 iwashi = {} bad = 0 ans = 1 for i in range(n): x, y = map(int, input().split()) if(x == 0 and y == 0): bad += 1 continue elif(x == 0): try: iwashi[(0, -1)] += 1 except KeyError: iwashi[(0, -1)] = 1 ...
from math import gcd n = int(input()) p = 10**9 + 7 iwashi = {} bad = 0 ans = 1 for i in range(n): x, y = map(int, input().split()) if(x == 0 and y == 0): bad += 1 continue elif(x == 0): try: iwashi[(0, 1)] += 1 except KeyError: iwashi[(0, 1)] = 1 ...
[["-", 0, 677, 31, 206, 206, 660, 0, 664, 17, 33], ["-", 0, 662, 31, 206, 206, 660, 0, 664, 17, 33], ["+", 0, 1, 0, 662, 12, 432, 0, 664, 17, 33], ["-", 0, 1, 0, 662, 12, 432, 0, 664, 17, 33]]
5
312
import math n = int(input()) ab = [] for i in range(n): ab.append(tuple(map(int,input().split()))) MOD = 1000000007 d = {} zero = 0 for a,b in ab: if a == 0 and b == 0: zero += 1 continue g = math.gcd(a,b) a //= g b //= g if b < 0: a,b = -a,-b elif a < 0 and b == 0: a = -a rot90 = Fals...
import math n = int(input()) ab = [] for i in range(n): ab.append(tuple(map(int,input().split()))) MOD = 1000000007 d = {} zero = 0 for a,b in ab: if a == 0 and b == 0: zero += 1 continue g = math.gcd(a,b) a //= g b //= g if b < 0: a,b = -a,-b elif a < 0 and b == 0: a = -a rot90 = Fals...
[["-", 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
272
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 200010, M = 1e9 + 7; struct kk { ll a, b; bool operator<(const kk &x) const { if (a != x.a) return a < x.a; else return b < x.b; } }; struct KK { ll pos, neg; }; map<kk, KK> m; set<kk> s; set<kk>::iterator iter;...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 200010, M = 1e9 + 7; struct kk { ll a, b; bool operator<(const kk &x) const { if (a != x.a) return a < x.a; else return b < x.b; } }; struct KK { ll pos, neg; }; map<kk, KK> m; set<kk> s; set<kk>::iterator iter;...
[["-", 8, 9, 0, 57, 64, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
587
from collections import defaultdict from math import gcd def GCD(a,b): gc = gcd(a,b) a//=gc b//=gc return a,b zero = 0 First_quadrant = defaultdict(int) Second_quadrant = defaultdict(int) n = int(input()) for i in range(n): a,b = map(int, input().split()) if a == 0 and b == 0: zero +=1 ...
from collections import defaultdict from math import gcd def GCD(a,b): gc = gcd(a,b) a//=gc b//=gc return a,b zero = 0 First_quadrant = defaultdict(int) Second_quadrant = defaultdict(int) n = int(input()) for i in range(n): a,b = map(int, input().split()) if a == 0 and b == 0: zero +=1 ...
[["-", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["-", 0, 57, 75, 665, 15, 679, 31, 666, 667, 47], ["+", 0, 57, 75, 665, 15, 679, 31, 666, 667, 20]]
5
226
import sys import math from collections import defaultdict input = sys.stdin.buffer.readline MOD = 1000000007 N = int(input()) dd = defaultdict(int) count = 1 iwashi = [list(map(int, input().split())) for _ in range(N)] checked = defaultdict(bool) zeros = 0 for i in range(N): if iwashi[i][0] == iwashi[i][1] == ...
import sys import math from collections import defaultdict input = sys.stdin.buffer.readline MOD = 1000000007 N = int(input()) dd = defaultdict(int) count = 1 iwashi = [list(map(int, input().split())) for _ in range(N)] checked = defaultdict(bool) zeros = 0 for i in range(N): if iwashi[i][0] == iwashi[i][1] == ...
[["-", 0, 1, 0, 662, 12, 41, 0, 666, 667, 20], ["+", 0, 1, 0, 662, 12, 41, 0, 666, 667, 47]]
5
323
mod = 1_000_000_007 gets h = Hash.new{|h, k| h[k] = [0, 0] } genten_iwashi = 0 $<.read.split.map(&:to_i).each_slice(2) do |(a,b)| if 0 == a && b genten_iwashi += 1 else f = a.zero? || a * b > 0 r = ( f ? Rational(a,b) : -Rational(b,a) ) h[r][ f ? 0 : 1 ] += 1 end end ans = 1 h.values.each do ...
mod = 1_000_000_007 gets h = Hash.new{|h, k| h[k] = [0, 0] } genten_iwashi = 0 $<.read.split.map(&:to_i).each_slice(2) do |(a,b)| if 0 == a | b genten_iwashi += 1 else f = a.zero? || a * b > 0 r = ( f ? Rational(a,b) : -Rational(b,a) ) h[r][ f ? 0 : 1 ] += 1 end end ans = 1 h.values.each do |...
[["-", 196, 737, 8, 736, 0, 121, 15, 738, 17, 98], ["+", 8, 736, 0, 121, 15, 738, 12, 738, 17, 139]]
4
165
#include <bits/stdc++.h> using namespace std; // #define int long long // intで書いたけど心配なときにlong longに変換する struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast; /* short */ #define pb push_back #define eb emplace_back #define mp make_pair #define Fi first #define Se second #define AL...
#include <bits/stdc++.h> using namespace std; // #define int long long // intで書いたけど心配なときにlong longに変換する struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast; /* short */ #define pb push_back #define eb emplace_back #define mp make_pair #define Fi first #define Se second #define AL...
[["-", 0, 14, 8, 9, 0, 57, 64, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 1, 0, 34, 0, 21]]
1
1,376
#pragma GCC optimize("O3") #pragma GCC target("avx2") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef __int128 lll; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp...
#pragma GCC optimize("O3") #pragma GCC target("avx2") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef __int128 lll; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46]]
1
1,048
#pragma GCC optimize("O3") #pragma GCC target("avx2") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " "...
#pragma GCC optimize("O3") #pragma GCC target("avx2") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " "...
[["+", 0, 52, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 52, 15, 339, 51, 16, 17, 98]]
1
978
//#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; using ll = long long; using db = double; using ld = long double; template <typename T> using V = vector<T>; template <typen...
//#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; using ll = long long; using db = double; using ld = long double; template <typename T> using V = vector<T>; template <typen...
[["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22]]
1
940
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i <= (b); ++i) #define per(i, a, b) for (int i = a; i >= (b); --i) #define mem(a, x) memset(a, x, sizeof(a)) #define pb push_back #define pi pair<int, int> #define mk make_pair using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b ? gcd(b,...
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i <= (b); ++i) #define per(i, a, b) for (int i = a; i >= (b); --i) #define mem(a, x) memset(a, x, sizeof(a)) #define pb push_back #define pi pair<int, int> #define mk make_pair using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b ? gcd(b,...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
487
#include <bits/stdc++.h> #define ll long long using namespace std; const int MD = 1e9 + 7; map<pair<ll, ll>, ll> ma; ll quick_pow(ll a, ll b) { ll res = 1; for (; b; b >>= 1) { if (b & 1) res = res * a % MD; a = a * a % MD; } return res; } int main() { int n, s = 0; scanf("%d", &n); for (in...
#include <bits/stdc++.h> #define ll long long using namespace std; const int MD = 1e9 + 7; map<pair<ll, ll>, ll> ma; ll quick_pow(ll a, ll b) { ll res = 1; for (; b; b >>= 1) { if (b & 1) res = res * a % MD; a = a * a % MD; } return res; } int main() { int n, s = 0; scanf("%d", &n); for (in...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
361
from math import gcd MOD = 10**9+7 N = int(input()) d = {} zero = 0 for _ in range(N): a, b = map(int, input().split()) if a == b == 0: zero += 1 continue # 正規化する if b < 0: b = -b a = -a g = gcd(a, b) b //= g a //= g # 入力のbが0の時はaの値を正の1に統一する if b == 0 a...
from math import gcd MOD = 10**9+7 N = int(input()) d = {} zero = 0 for _ in range(N): a, b = map(int, input().split()) if a == b == 0: zero += 1 continue # 正規化する if b < 0: b = -b a = -a g = gcd(a, b) b //= g a //= g # 入力のbが0の時はaの値を正の1に統一する if b == 0 a...
[["+", 36, 36, 0, 656, 0, 1, 0, 677, 17, 107], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 12, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 31, 22]]
5
255
#include <cstdio> #include <map> #define mod 1000000007 #define LL long long using namespace std; map<pair<LL, LL>, pair<int, int>> mp; LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; } LL quick_pow(LL a, LL b) { LL ret = 1; while (b) { if (b & 1) ret = ret * a % mod; a = a * a % mod; b >>= 1; ...
#include <cstdio> #include <map> #define mod 1000000007 #define LL long long using namespace std; map<pair<LL, LL>, pair<int, int>> mp; LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; } LL quick_pow(LL a, LL b) { LL ret = 1; while (b) { if (b & 1) ret = ret * a % mod; a = a * a % mod; b >>= 1; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
382
from sys import stdin from collections import defaultdict from math import gcd def main(): MOD = 1000000007 N, *AB = map(int, stdin.buffer.read().split()) d = defaultdict(int) n_zeros = 0 for a, b in zip(AB[::2], AB[1::2]): if a == 0 and b == 0: n_zeros += 1 cont...
from sys import stdin from collections import defaultdict from math import gcd def main(): MOD = 1000000007 N, *AB = map(int, stdin.buffer.read().split()) d = defaultdict(int) n_zeros = 0 for a, b in zip(AB[::2], AB[1::2]): if a == 0 and b == 0: n_zeros += 1 cont...
[["-", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22]]
5
269
import math n=int(input()) D={} for _ in range(n): a,b=(map(int, input().split())) if a==0 and b==0: key=(0,0) elif a==0: key=(0,1) elif b==0: key=(1,0) else: if a<=0: a=-a b=-b g=math.gcd(a,abs(b)) key=(a//g, b//g) if key ...
import math n=int(input()) D={} for _ in range(n): a,b=map(int, input().split()) if a==0 and b==0: key=(0,0) elif a==0: key=(0,1) elif b==0: key=(1,0) else: if a<0: a=-a b=-b g=math.gcd(a, abs(b)) key=(a//g, b//g) if key no...
[["-", 8, 196, 0, 1, 0, 662, 12, 23, 0, 24], ["-", 8, 196, 0, 1, 0, 662, 12, 23, 0, 25], ["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 18], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]]
5
296
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; using namespace std; template <typename T> using vec = std::vector<T>; const ll MOD = 1000000007; struct mint { ll x; mint(ll x = 0) : x((x % MOD + MOD) % MOD) {} mint operator-() ...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; using namespace std; template <typename T> using vec = std::vector<T>; const ll MOD = 1000000007; struct mint { ll x; mint(ll x = 0) : x((x % MOD + MOD) % MOD) {} mint operator-() ...
[["+", 341, 342, 0, 83, 0, 16, 31, 2, 63, 22], ["+", 0, 83, 0, 16, 31, 2, 3, 4, 0, 24], ["+", 0, 83, 0, 16, 31, 2, 3, 4, 0, 25]]
1
831
#pragma GCC optimize(3, "Ofast", "inline") #include <bits/stdc++.h> #define start \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout....
#pragma GCC optimize(3, "Ofast", "inline") #include <bits/stdc++.h> #define start \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout....
[["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22]]
1
443
import math N = int(input()) T = [] for i in range(N): a = list(map(int, input().split())) T.append(a) mod = 10**9+7 A = {} c_zero = 0 a_zero = 0 b_zero = 0 for i in range(N): if T[i][0] == 0 and T[i][1] == 0: c_zero += 0 elif T[i][0] == 0: a_zero += 1 elif T[i][1] == 0: b_...
import math N = int(input()) T = [] for i in range(N): a = list(map(int, input().split())) T.append(a) mod = 10**9+7 A = {} c_zero = 0 a_zero = 0 b_zero = 0 for i in range(N): if T[i][0] == 0 and T[i][1] == 0: c_zero += 1 elif T[i][0] == 0: a_zero += 1 elif T[i][1] == 0: b_...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612]]
5
495
# 解説と 13355391 を参考に実装予定 import math def solve(): N = int(input()) ABs = [[int(i) for i in input().split()] for _ in range(N)] mod = 10 ** 9 + 7 lonlieness = 0 pairs = {} for AB in ABs: a, b = AB if a == 0 and b == 0: lonlieness += 1 continue e...
# 解説と 13355391 を参考に実装予定 import math def solve(): N = int(input()) ABs = [[int(i) for i in input().split()] for _ in range(N)] mod = 10 ** 9 + 7 lonlieness = 0 pairs = {} for AB in ABs: a, b = AB if a == 0 and b == 0: lonlieness += 1 continue e...
[["+", 0, 1, 0, 662, 12, 432, 0, 664, 17, 33]]
5
349
// 問題の URL を書いておく // https://atcoder.jp/contests/abc168/tasks/abc168_e #include <algorithm> #include <bitset> #include <iostream> #include <map> #include <numeric> #include <set> #include <vector> using namespace std; //#define ENABLE_PRINT template <typename T> T Input() { T v; cin >> v; return v; } template...
// 問題の URL を書いておく // https://atcoder.jp/contests/abc168/tasks/abc168_e #include <algorithm> #include <bitset> #include <iostream> #include <map> #include <numeric> #include <set> #include <vector> using namespace std; //#define ENABLE_PRINT template <typename T> T Input() { T v; cin >> v; return v; } template...
[["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["-", 64, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 64, 9, 0, 43, 49, 50, 51, 83, 0, 13]]
1
1,247
import functools MOD=10**9+7 def euclid(a, b): if b == 0: return a else: return euclid(b, a%b) def gcd(nums): return functools.reduce(euclid, nums) n=int(input()) t=[] for i in range(n): a,b=map(int,input().split()) t.append((a,b)) z=0 y={} for i in range(n): if t[i][0]==0 and t[i][1]==0: ...
import functools MOD=10**9+7 def euclid(a, b): if b == 0: return a else: return euclid(b, a%b) def gcd(nums): return functools.reduce(euclid, nums) n=int(input()) t=[] for i in range(n): a,b=map(int,input().split()) t.append((a,b)) z=0 y={} for i in range(n): if t[i][0]==0 and t[i][1]==0: ...
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 25], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
392
n = int(input()) zeros = 0 ab = {} for _ in range(n): a, b = [int(i) for i in input().split()] if a == b == 0: zeros += 1 elif a == 0 or b == 0: if None not in ab: ab[None] = [0, 0] if a == 0: ab[None][0] += 1 else: ab[None][1] += 1 els...
n = int(input()) zeros = 0 ab = {} for _ in range(n): a, b = [int(i) for i in input().split()] if a == b == 0: zeros += 1 elif a == 0 or b == 0: if None not in ab: ab[None] = [0, 0] if a == 0: ab[None][0] += 1 else: ab[None][1] += 1 els...
[["-", 0, 657, 31, 657, 31, 657, 31, 664, 17, 33], ["+", 12, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["+", 3, 4, 0, 657, 12, 23, 0, 664, 17, 33], ["+", 12, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
259
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<LL, LL> PLL; const int M = 2e5 + 5; const int MO = 1e9 + 7; const int INV2 = 5e8 + 4; inline int add(int x, int y) { x += y; if (x >= MO) x -= MO; return x; } inline int sub(int x, int y) { x -= y; if (x < 0) x += MO; ...
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<LL, LL> PLL; const int M = 2e5 + 5; const int MO = 1e9 + 7; const int INV2 = 5e8 + 4; inline int add(int x, int y) { x += y; if (x >= MO) x -= MO; return x; } inline int sub(int x, int y) { x -= y; if (x < 0) x += MO; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
661
#include <algorithm> #include <cstdio> #include <map> #define FOR(i, a, b) for (register int i = (a); i < (b); ++i) using namespace std; typedef long long ll; typedef pair<ll, ll> pi; const ll p = 1000000007; const int maxn = 200005; int n; map<pi, ll> mp; map<pi, bool> vis; ll gcd(ll a, ll b) { return b == 0 ? a : gcd...
#include <algorithm> #include <cstdio> #include <map> #define FOR(i, a, b) for (register int i = (a); i < (b); ++i) using namespace std; typedef long long ll; typedef pair<ll, ll> pi; const ll p = 1000000007; const int maxn = 200005; int n; map<pi, ll> mp; map<pi, bool> vis; ll gcd(ll a, ll b) { return b == 0 ? a : gcd...
[["-", 0, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 0, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
1
466
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1e9 + 7; ll power(ll a, ll b) { return b ? power(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; } main() { ll n, a, b, ans = 1, MOD = mod - 1; cin >> n; map<pair<ll, ll>, pair<ll, ll>> m; for (int i = 0; i < n; i++) { cin...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1e9 + 7; ll power(ll a, ll b) { return b ? power(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; } main() { ll n, a, b, ans = 1, MOD = mod - 1; cin >> n; map<pair<ll, ll>, pair<ll, ll>> m; for (ll i = 0; i < n; i++) { cin ...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 0, 57, 64, 1, 0, 34, 31, 11, 17, 110], ["+", 0, 57, 64, 1, 0, 34, 31, 11, 17, 32], ["-", 0, 57, 64, 1, 0, 34, 12, 11, 17, 110], ["+", 0, 57, 64, 1, 0, 34, 12, 11, 17, 32], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 17, 72], ["+", 12, 1...
1
255
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 1000000007; vector<int> Power2; void initPower2(int n) { ll rtn = 1; for (int i = 0; i <= n; i++) { Power2.push_back(rtn); // 0乗は1 rtn *= 2; rtn %= MOD; } } ll gcd(ll c, ll d) { // c*d=0をもとから除外 if (c < d) swa...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 1000000007; vector<int> Power2; void initPower2(int n) { ll rtn = 1; for (int i = 0; i <= n; i++) { Power2.push_back(rtn); // 0乗は1 rtn *= 2; rtn %= MOD; } } ll gcd(ll c, ll d) { // c*d=0をもとから除外 if (c < d) swa...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 12, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22]]
1
430
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; bool R() { return true; } template <typename T, typename... Args> bool R(T &x, Args &...args) { return cin >> x && R(args...); } void init_io() { ios::sync_with_stdio(false); cin.tie(0); } #define PB push_back #d...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; bool R() { return true; } template <typename T, typename... Args> bool R(T &x, Args &...args) { return cin >> x && R(args...); } void init_io() { ios::sync_with_stdio(false); cin.tie(0); } #define PB push_back #d...
[["-", 3, 4, 0, 2, 3, 4, 0, 91, 17, 111], ["-", 0, 2, 3, 4, 0, 91, 28, 91, 17, 111]]
1
898
#include <bits/stdc++.h> //Carefully Crafted by hetp111 using namespace std; #define int long long #define double long double #define all(v) (v).begin(), (v).end() #define vi vector<int> #define vvi vector<vi> #define pii pair<int, int> #define vii vector<pii> #define MOD (1000000007) #define MOD2 (998244353) #define M...
#include <bits/stdc++.h> //Carefully Crafted by hetp111 using namespace std; #define int long long #define double long double #define all(v) (v).begin(), (v).end() #define vi vector<int> #define vvi vector<vi> #define pii pair<int, int> #define vii vector<pii> #define MOD (1000000007) #define MOD2 (998244353) #define M...
[["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22]]
1
641
import sys sys.setrecursionlimit(10**6) #再帰関数の上限 import math from copy import copy, deepcopy from operator import itemgetter from bisect import bisect_left, bisect, bisect_right#2分探索 #bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下 from collections import deque #deque(l), pop(), append(x), pople...
import sys sys.setrecursionlimit(10**6) #再帰関数の上限 import math from copy import copy, deepcopy from operator import itemgetter from bisect import bisect_left, bisect, bisect_right#2分探索 #bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下 from collections import deque #deque(l), pop(), append(x), pople...
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 0, 531], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 0, 612], ["-", 8, 196, 0, 1, 0, 662, 12, 660, 0, 25], ["-", 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]]
5
657
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long int lli; #define int lli typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<lli> vli; typedef vector<pii> vii; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long int lli; #define int lli typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<lli> vli; typedef vector<pii> vii; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
[["-", 51, 16, 31, 23, 0, 16, 31, 16, 17, 18], ["+", 51, 16, 31, 23, 0, 16, 31, 16, 17, 19], ["-", 51, 16, 31, 23, 0, 16, 12, 16, 17, 18], ["+", 51, 16, 31, 23, 0, 16, 12, 16, 17, 19], ["-", 51, 16, 12, 23, 0, 16, 31, 16, 17, 47], ["+", 51, 16, 12, 23, 0, 16, 31, 16, 17, 20], ["-", 51, 16, 12, 23, 0, 16, 12, 16, 17, 18...
1
933
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; const ll MOD = 1000000007; int main() { int N; cin >> N; vector<ll> p2(N...
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; const ll MOD = 1000000007; int main() { int N; cin >> N; vector<ll> p2(N...
[["-", 31, 23, 0, 16, 31, 16, 12, 69, 28, 22], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["-", 0, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["-", 0, 16, 31, 16, 31, 23, 0, 16, 12, 13]]
1
488
#include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string.h> #include <string> #include <tuple> #include <vector> using namespa...
#include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string.h> #include <string> #include <tuple> #include <vector> using namespa...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
698
#include <bits/stdc++.h> #define Int int64_t using namespace std; template <typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); } int64_t modpow(int64_t a, int64_t b, int64_t MOD) { int64_t ret = 1; while (b > 0) { if (b & 1) { (ret *= a) %= MOD; } (a *= a) %= MOD; b >>= 1; } ...
#include <bits/stdc++.h> #define Int int64_t using namespace std; template <typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); } int64_t modpow(int64_t a, int64_t b, int64_t MOD) { int64_t ret = 1; while (b > 0) { if (b & 1) { (ret *= a) %= MOD; } (a *= a) %= MOD; b >>= 1; } ...
[["+", 49, 50, 51, 2, 3, 4, 0, 2, 63, 22], ["+", 51, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 51, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
598
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; using P = pair<int, int>; const int mod = 1000000007; struct mint { ll x; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; using P = pair<int, int>; const int mod = 1000000007; struct mint { ll x; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 51, 22], ["-", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 57, 64, 9, 0, 43, 39, 78]]
1
645
from collections import defaultdict import math import sys input=sys.stdin.readline MOD=10**9+7 N=int(input()) def powmod(a,p): if p==0: return 1 else: pow2=powmod(a,p//2) if p%2==0: return (pow2**2)%MOD else: return (a*pow2**2)%MOD ratio_dic=defaultdict(int) zero2_num=0 for i in rang...
from collections import defaultdict import math import sys input=sys.stdin.readline MOD=10**9+7 N=int(input()) def powmod(a,p): if p==0: return 1 else: pow2=powmod(a,p//2) if p%2==0: return (pow2**2)%MOD else: return (a*pow2**2)%MOD ratio_dic=defaultdict(int) zero2_num=0 for i in rang...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
361
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i < (int)(n); i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define vout(x) rep(i, x.size()) cout << x[i] << " " template <class T> bool chmin(T &a, T b) { if (a > b) { a =...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i < (int)(n); i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define vout(x) rep(i, x.size()) cout << x[i] << " " template <class T> bool chmin(T &a, T b) { if (a > b) { a =...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
849
#include <bits/stdc++.h> using namespace std; using ll = long long; using vll = vector<ll>; #define all(x) (x).begin(), (x).end() #define fsp(x) fixed << setprecision(x) const ll inf = LLONG_MAX; const long double pi = acos(-1); void Yes() { cout << "Yes" << endl; } void No() { cout << "No" << endl; } void YES() { cout...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vll = vector<ll>; #define all(x) (x).begin(), (x).end() #define fsp(x) fixed << setprecision(x) const ll inf = LLONG_MAX; const long double pi = acos(-1); void Yes() { cout << "Yes" << endl; } void No() { cout << "No" << endl; } void YES() { cout...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
683
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; long long gcd(long long a, long long b) { a = abs(a), b = abs(b); if (a < b) swap(a...
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; long long gcd(long long a, long long b) { a = abs(a), b = abs(b); if (a < b) swap(a...
[["-", 0, 338, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 338, 8, 9, 0, 1, 0, 11, 17, 108]]
1
924
# coding: utf-8 import sys,pprint, math from fractions import Fraction from collections import defaultdict MOD = 1000000007 N = int(input()) params =[] hatemasks = [] tilts = defaultdict(lambda: [0,0]) zerozero = 0 zerodiv = 0 for i in range(N): (ai, bi) = map(int,input().split()) if ai == 0 and bi == 0: ...
# coding: utf-8 import sys,pprint, math from fractions import Fraction from collections import defaultdict MOD = 1000000007 N = int(input()) params =[] hatemasks = [] tilts = defaultdict(lambda: [0,0]) zerozero = 0 zerodiv = 0 for i in range(N): (ai, bi) = map(int,input().split()) if ai == 0 and bi == 0: ...
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 75, 665, 15, 679, 31, 23, 0, 666, 667, 19], ["+", 0, 57, 15, 679, 31, 23, 0, 666, 667, 18]]
5
240
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; #define REP(i, n) for (ll(i) = 0; (i) < (n); (i)++) #define REPR(i, n) for (ll(i) = (n); (i) >= 0; (i)--) #define FOR(i, m, n) for (ll(i) = (m); (i) < (n); (i)++) #define INF 1e9 #define ALL(v)...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; #define REP(i, n) for (ll(i) = 0; (i) < (n); (i)++) #define REPR(i, n) for (ll(i) = (n); (i) >= 0; (i)--) #define FOR(i, m, n) for (ll(i) = (m); (i) < (n); (i)++) #define INF 1e9 #define ALL(v)...
[["+", 0, 14, 8, 9, 0, 14, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 14, 8, 9, 0, 46]]
1
811
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include ...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include ...
[["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
1,401
from collections import defaultdict from math import gcd n = int(input()) zeros = 0 d = defaultdict(lambda: [0, 0]) for _ in range(n): a, b = map(int, input().split()) if a == 0 and b == 0: zeros += 1 continue g = gcd(a, b) a, b = a // g, b // g if a == 0: b = 1 if b ==...
from collections import defaultdict from math import gcd n = int(input()) zeros = 0 d = defaultdict(lambda: [0, 0]) for _ in range(n): a, b = map(int, input().split()) if a == 0 and b == 0: zeros += 1 continue g = gcd(a, b) a, b = a // g, b // g if a == 0: b = 1 if b ==...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
210
import sys input = sys.stdin.readline import math MOD = 10**9+7 N = int(input()) F = [] zero_v = 0 inf = 0 zero = 0 for _ in range(N): x,y = map(int,input().split()) if x==0 and y==0: zero_v += 1 elif x==0: inf += 1 elif y==0: zero += 1 else: G = math.gcd(abs(x),abs(y)) F.append((x,y)) a...
import sys input = sys.stdin.readline import math MOD = 10**9+7 N = int(input()) F = [] zero_v = 0 inf = 0 zero = 0 for _ in range(N): x,y = map(int,input().split()) if x==0 and y==0: zero_v += 1 elif x==0: inf += 1 elif y==0: zero += 1 else: G = math.gcd(abs(x),abs(y)) F.append((x//G,y//...
[["+", 0, 652, 3, 4, 0, 660, 0, 657, 17, 676], ["+", 0, 652, 3, 4, 0, 660, 0, 657, 12, 22]]
5
392
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math import bisect from collections import deque from math import gcd from functools import lru_cache ############# # Constants # ############# MOD = 10**9+7 INF = float('inf') ############# # Functions...
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math import bisect from collections import deque from math import gcd from functools import lru_cache ############# # Constants # ############# MOD = 10**9+7 INF = float('inf') ############# # Functions...
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
814
import sys input = sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N,M=MI() adj=[[]for _ in range(N)] for i in range(M): a,b=MI() a-=1 b-=1 adj[a].ap...
import sys input = sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N,M=MI() adj=[[]for _ in range(N)] for i in range(M): a,b=MI() a-=1 b-=1 adj[a].ap...
[["+", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
236
#include <algorithm> #include <iomanip> #include <iostream> #include <queue> #include <vector> using namespace std; int n, m; vector<vector<int>> edg; vector<int> d; int main(void) { cin >> n >> m; edg.assign(n + 1, vector<int>()); for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; edg[a].push_bac...
#include <algorithm> #include <iomanip> #include <iostream> #include <queue> #include <vector> using namespace std; int n, m; vector<vector<int>> edg; vector<int> d; int main(void) { cin >> n >> m; edg.assign(n + 1, vector<int>()); for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; edg[a].push_bac...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
232
#include <bits/stdc++.h> // ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); // clock_t start=clock();clock_t // end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl; using namespace std; typedef long long ll; typedef unsigned long long ull; typedef unsigned int ui; typedef pair<int, int> pii; typedef pair<pii...
#include <bits/stdc++.h> // ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); // clock_t start=clock();clock_t // end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl; using namespace std; typedef long long ll; typedef unsigned long long ull; typedef unsigned int ui; typedef pair<int, int> pii; typedef pair<pii...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
911
#include <bits/stdc++.h> #define FOR(i, n) for (int i = 0; i < (n); ++i) #define REP(i, a, b) for (int i = (a); i < (b); ++i) #define TRAV(i, a) for (auto &i : (a)) #define SZ(x) ((int)(x).size()) #define PR std::pair #define MP std::make_pair #define X first #define Y second typedef long long ll; typedef std::pair<int...
#include <bits/stdc++.h> #define FOR(i, n) for (int i = 0; i < (n); ++i) #define REP(i, a, b) for (int i = (a); i < (b); ++i) #define TRAV(i, a) for (auto &i : (a)) #define SZ(x) ((int)(x).size()) #define PR std::pair #define MP std::make_pair #define X first #define Y second typedef long long ll; typedef std::pair<int...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
297
#include <bits/stdc++.h> using namespace std; const int N = 200005; int n, m; vector<int> G[N]; int vis[N]; queue<int> q; int p[N]; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < m; i++) { int a, b; scanf("%d%d", &a, &b); G[a].push_back(b); G[b].push_back(a); } memset(p, -1, sizeof(p));...
#include <bits/stdc++.h> using namespace std; const int N = 200005; int n, m; vector<int> G[N]; int vis[N]; queue<int> q; int p[N]; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < m; i++) { int a, b; scanf("%d%d", &a, &b); G[a].push_back(b); G[b].push_back(a); } memset(p, -1, sizeof(p));...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
242
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { int n, m; cin >> n >> m; vector<vector<int>> adj(n + 1); for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; adj[x].push_back(y); adj[y].push_back(x); } vector<bool> vis(n + 1, false); vector<int> par(n + 1,...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { int n, m; cin >> n >> m; vector<vector<int>> adj(n + 1); for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; adj[x].push_back(y); adj[y].push_back(x); } vector<bool> vis(n + 1, false); vector<int> par(n + 1,...
[["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
324
#include <cstdio> #include <queue> #include <vector> using namespace std; int n, m, v[100100]; vector<int> G[100100]; int main() { scanf("%d %d", &n, &m); for (int i = 0; i < m; i++) { int x, y; scanf("%d %d", &x, &y); G[x].push_back(y); G[y].push_back(x); } for (int i = 1; i <= n; i++) v...
#include <cstdio> #include <queue> #include <vector> using namespace std; int n, m, v[100100]; vector<int> G[100100]; int main() { scanf("%d %d", &n, &m); for (int i = 0; i < m; i++) { int x, y; scanf("%d %d", &x, &y); G[x].push_back(y); G[y].push_back(x); } for (int i = 1; i <= n; i++) v...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
270
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() using namespace std; using ll = int64_t; using ld = long double; using P = pair<int, int>; using vs = vector<string>; using vi = vector<int>; using vvi =...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() using namespace std; using ll = int64_t; using ld = long double; using P = pair<int, int>; using vs = vector<string>; using vi = vector<int>; using vvi =...
[["-", 0, 16, 31, 16, 12, 16, 12, 91, 17, 111], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72]]
1
1,077
#include <bits/stdc++.h> #define int long long using namespace std; const int mod = 1000000007; int p2(int B) { if (!B) return 1; if (B & 1) return p2(B - 1) * 2 % mod; int C = p2(B / 2); return C * C % mod; } signed main() { int N; cin >> N; map<pair<int, int>, int> mp; int ans = -1, ans2 = 1; ...
#include <bits/stdc++.h> #define int long long using namespace std; const int mod = 1000000007; int p2(int B) { if (!B) return 1; if (B & 1) return p2(B - 1) * 2 % mod; int C = p2(B / 2); return C * C % mod; } signed main() { int N; cin >> N; map<pair<int, int>, int> mp; int ans = -1, ans2 = 1; ...
[["-", 341, 342, 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
361
#include <cmath> #include <iostream> #include <map> #include <set> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; typedef pair<ll, ll> llP; ll gcd(ll a, ll b) { if (b == 0) return a; else return gcd(b, a % b); } ll mod_pow(ll...
#include <cmath> #include <iostream> #include <map> #include <set> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; typedef pair<ll, ll> llP; ll gcd(ll a, ll b) { if (b == 0) return a; else return gcd(b, a % b); } ll mod_pow(ll...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47]]
1
394
from math import gcd import math import numpy as np import decimal import collections import itertools import sys import random #Union-Find class UnionFind(): def __init__(self, n): self.n = n self.par = [-1 for i in range(self.n)] def find(self, x): if self.par[x] < 0: retur...
from math import gcd import math import numpy as np import decimal import collections import itertools import sys import random #Union-Find class UnionFind(): def __init__(self, n): self.n = n self.par = [-1 for i in range(self.n)] def find(self, x): if self.par[x] < 0: retur...
[["-", 8, 196, 0, 57, 15, 666, 0, 634, 0, 70], ["+", 8, 196, 0, 57, 15, 666, 0, 660, 0, 24], ["-", 8, 196, 0, 57, 15, 666, 0, 634, 0, 73], ["+", 8, 196, 0, 57, 15, 666, 0, 660, 0, 25]]
5
1,633
#include <bits/stdc++.h> using namespace std; #define ll long long #define loop(__x, __start, __end) for (int __x = __start; __x < __end; __x++) template <int MOD> struct ModInt { ll x; ModInt() : x(0) {} ModInt(ll x) : x((x % MOD + MOD) % MOD) {} int getMod() { return MOD; } ModInt operator-() const { retur...
#include <bits/stdc++.h> using namespace std; #define ll long long #define loop(__x, __start, __end) for (int __x = __start; __x < __end; __x++) template <int MOD> struct ModInt { ll x; ModInt() : x(0) {} ModInt(ll x) : x((x % MOD + MOD) % MOD) {} int getMod() { return MOD; } ModInt operator-() const { retur...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 355], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 354]]
1
820
#include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 0; i < int(N); ++i) #define rep1(i, N) for (int i = 1; i < int(N); ++i) #define all(a) (a).begin(), (a).end() #define print(v) \ { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 0; i < int(N); ++i) #define rep1(i, N) for (int i = 1; i < int(N); ++i) #define all(a) (a).begin(), (a).end() #define print(v) \ { ...
[["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
1,202
MOD = 10 ** 9 + 7 from math import gcd from collections import defaultdict n = int(input()) plus = defaultdict(int) minus = defaultdict(int) zero = [0, 0, 0] for _ in range(n): a, b = map(int, input().split()) if a * b == 0: if a == b == 0: zero[0] += 1 elif a == 0: zero...
MOD = 10 ** 9 + 7 from math import gcd from collections import defaultdict n = int(input()) plus = defaultdict(int) minus = defaultdict(int) zero = [0, 0, 0] for _ in range(n): a, b = map(int, input().split()) if a * b == 0: if a == b == 0: zero[0] += 1 elif a == 0: zero...
[["-", 36, 36, 0, 656, 0, 1, 0, 677, 17, 110], ["+", 36, 36, 0, 656, 0, 1, 0, 677, 17, 107], ["+", 0, 1, 0, 677, 12, 657, 31, 206, 51, 22], ["+", 0, 1, 0, 677, 12, 657, 31, 206, 0, 70], ["+", 0, 1, 0, 677, 12, 657, 31, 206, 206, 612], ["+", 0, 1, 0, 677, 12, 657, 31, 206, 0, 73], ["+", 0, 656, 0, 1, 0, 677, 12, 657, 17...
5
301
from collections import defaultdict from math import gcd as g n = int(input()) mod = 10**9+7 sardines = set() Ddic = defaultdict(int) ans = 1 zcount = 0 for i in range(n): a,b = map(int,input().split()) if a == 0 and b == 0: zcount += 1 continue if a == 0: Ddic[(0,1)] += 1 sardines.add((0,1)) ...
from collections import defaultdict from math import gcd as g n = int(input()) mod = 10**9+7 sardines = set() Ddic = defaultdict(int) ans = 1 zcount = 0 for i in range(n): a,b = map(int,input().split()) if a == 0 and b == 0: zcount += 1 continue if a == 0: Ddic[(0,1)] += 1 sardines.add((0,1)) ...
[["-", 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, 25]]
5
326
#include <bits/stdc++.h> int64_t gcd(int64_t a, int64_t b) { if (b < a) std::swap(a, b); if (a == 0) return b; return gcd(b % a, a); } const int MAX_N = 200005; const int64_t MOD = 1000000007; int64_t N; int64_t as[MAX_N], bs[MAX_N]; std::map<std::pair<int64_t, int64_t>, int64_t> counts1, counts2; std::...
#include <bits/stdc++.h> int64_t gcd(int64_t a, int64_t b) { if (b < a) std::swap(a, b); if (a == 0) return b; return gcd(b % a, a); } const int MAX_N = 200005; const int64_t MOD = 1000000007; int64_t N; int64_t as[MAX_N], bs[MAX_N]; std::map<std::pair<int64_t, int64_t>, int64_t> counts1, counts2; std::...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 147], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 146], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29]]
1
528
#include <bits/stdc++.h> using namespace std; typedef long long lint; #define rep(i, n) for (lint(i) = 0; (i) < (n); (i)++) #define repp(i, m, n) for (lint(i) = (m); (i) < (n); (i)++) #define repm(i, n) for (lint(i) = (n - 1); (i) >= 0; (i)--) #define INF (1ll << 60) #define all(x) (x).begin(), (x).end() const lint MOD...
#include <bits/stdc++.h> using namespace std; typedef long long lint; #define rep(i, n) for (lint(i) = 0; (i) < (n); (i)++) #define repp(i, m, n) for (lint(i) = (m); (i) < (n); (i)++) #define repm(i, n) for (lint(i) = (n - 1); (i) >= 0; (i)--) #define INF (1ll << 60) #define all(x) (x).begin(), (x).end() const lint MOD...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
892
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int mod = 1000000007; ll gcd(ll a, ll b) { while (b) { ll c = a % b; a = b; b = c; } return a; } in...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int mod = 1000000007; ll gcd(ll a, ll b) { while (b) { ll c = a % b; a = b; b = c; } return a; } in...
[["-", 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], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29]]
1
451
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef long long ll; typedef unsigned long long ull; #define faster \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef long long ll; typedef unsigned long long ull; #define faster \ ios_base::sync_with_stdio(false); ...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
335
#include <bits/stdc++.h> #include <stdio.h> using namespace std; #define inputInt(a) \ int a; \ cin >> a; #define inputInt2(a, b) \...
#include <bits/stdc++.h> #include <stdio.h> using namespace std; #define inputInt(a) \ int a; \ cin >> a; #define inputInt2(a, b) \...
[["-", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["-", 31, 16, 12, 23, 0, 2, 3, 4, 0, 25], ["-", 31, 23, 0, 16, 31, 16, 12, 23, 0, 24]]
1
2,199
#include <bits/stdc++.h> using namespace std; #ifndef aa #define trace(...) #define endl '\n' #endif #define pb push_back #define ub upper_bound #define lb lower_bound #define fi first #define se second #define int long long typedef long long ll; typedef long double ld; #define double long double #define pii pair<int...
#include <bits/stdc++.h> using namespace std; #ifndef aa #define trace(...) #define endl '\n' #endif #define pb push_back #define ub upper_bound #define lb lower_bound #define fi first #define se second #define int long long typedef long long ll; typedef long double ld; #define double long double #define pii pair<int...
[["+", 0, 30, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 27, 28, 69, 341, 342, 0, 83, 0, 13], ["+", 0, 27, 28, 69, 341, 342, 0, 83, 0, 13], ["+", 0, 1, 0, 11, 31, 23, 0, 16, 17, 72], ["+", 0, 1, 0, 11, 31, 23, 0, 16, 12, 22]]
1
710
#include <bits/stdc++.h> using namespace std; // conversion //------------------------------------------ inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } // math //--------...
#include <bits/stdc++.h> using namespace std; // conversion //------------------------------------------ inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } // math //--------...
[["-", 0, 338, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 338, 8, 9, 0, 1, 0, 11, 12, 22]]
1
1,281
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) #define show(x) \ { \ for (auto i : x) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) #define show(x) \ { \ for (auto i : x) { ...
[["-", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
916
M=10**9+7 H=Hash.new{_1[_2]=0,0} $<.drop(s=o=1).map{a,b=_1.split.map &:to_r a==0&&b==0 ? o-=1 :(r,f=b==0 ? [0,1] : a/b<0 ? [-b/a,1] : [a/b,0] H[r][f]+=1)} H.map{|k,v|t=-1 v.map{t+=2.pow _1,M} s=s*t%M} p (s-o)%M
M=10**9+7 H=Hash.new{_1[_2]=0,0} $<.drop(s=o=1).map{a,b=_1.split.map &:to_r a==0&&b==0?o-=1:(r,f=b==0?[b,1]:a/b<0?[-b/a,1]:[a/b,0] H[r][f]+=1)} H.map{|k,v|t=-1 v.map{t+=2.pow _1,M} s=s*t%M} p (s-o)%M
[["-", 75, 739, 0, 662, 12, 754, 64, 516, 0, 612], ["+", 75, 739, 0, 662, 12, 754, 64, 516, 0, 22]]
4
148
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { MyScanner sc = new MyScanner(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); int n = sc.nextInt(); long[] a = new long[n]; long[] b = new long[n]; long mod = (long)1e...
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { MyScanner sc = new MyScanner(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); int n = sc.nextInt(); long[] a = new long[n]; long[] b = new long[n]; long mod = (long)1e...
[["-", 12, 16, 31, 23, 0, 16, 12, 492, 141, 22], ["+", 12, 16, 31, 23, 0, 16, 12, 492, 141, 22], ["+", 31, 23, 0, 16, 12, 492, 3, 4, 0, 21], ["+", 31, 23, 0, 16, 12, 492, 3, 4, 0, 499]]
3
1,657
#include <bits/stdc++.h> using namespace std; using ll = long long; #define INT(...) \ int __VA_ARGS__; \ in(__VA_ARGS__) #define LL(...) ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define INT(...) \ int __VA_ARGS__; \ in(__VA_ARGS__) #define LL(...) ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
1,350
#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>; const int mod = 1000000007; struct mint { ll x; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) {...
#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>; const int mod = 1000000007; struct mint { ll x; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) {...
[["-", 49, 50, 51, 23, 0, 16, 31, 16, 31, 22], ["-", 49, 50, 51, 23, 0, 16, 31, 16, 17, 18], ["-", 49, 50, 51, 23, 0, 16, 31, 16, 12, 13], ["-", 0, 43, 49, 50, 51, 23, 0, 16, 17, 98]]
1
645
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <chrono> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #inclu...
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <chrono> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #inclu...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
2,217
# ベクトルを既約分数にしてなおかつ方向を第一象限か第二象限に集める from collections import defaultdict from math import gcd N = int(input()) MOD = 10**9 + 7 d = defaultdict(lambda: [0, 0]) zeros = 0 for _ in range(N): x, y = map(int, input().split()) if x == 0 and y == 0: zeros += 1 elif x == 0: d[(0, 0)][0] += 1 elif...
# ベクトルを既約分数にしてなおかつ方向を第一象限か第二象限に集める from collections import defaultdict from math import gcd N = int(input()) MOD = 10**9 + 7 d = defaultdict(lambda: [0, 0]) zeros = 0 for _ in range(N): x, y = map(int, input().split()) if x == 0 and y == 0: zeros += 1 elif x == 0: d[(0, 0)][0] += 1 elif...
[["-", 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
244
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <tuple> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (n); i++...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <tuple> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (n); i++...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
940
#include <bits/stdc++.h> using namespace std; #define int long long inline int read() { int x = 0, f = 1; char ch = getchar(); for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = -1; for (; ch >= '0' && ch <= '9'; ch = getchar()) x = (x << 1) + (x << 3) + ch - '0'; return x * f; } ...
#include <bits/stdc++.h> using namespace std; #define int long long inline int read() { int x = 0, f = 1; char ch = getchar(); for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = -1; for (; ch >= '0' && ch <= '9'; ch = getchar()) x = (x << 1) + (x << 3) + ch - '0'; return x * f; } ...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
408
MOD = 10**9 + 7 P = 7 ** 21 + 52 def F(a, b): return (a * pow(b, P-2, P)) % P def main(): from collections import Counter import sys input = sys.stdin.buffer.readline N = int(input()) T = [[int(i) for i in input().split()] for j in range(N)] cnt_zero = [0, 0] # 片方が0のとき p = 0 # 両方0 ...
MOD = 10**9 + 7 P = 7 ** 21 + 52 def F(a, b): return (a * pow(b, P-2, P)) % P def main(): from collections import Counter import sys input = sys.stdin.buffer.readline N = int(input()) T = [[int(i) for i in input().split()] for j in range(N)] cnt_zero = [0, 0] # 片方が0のとき p = 0 # 両方0 ...
[["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["-", 0, 57, 15, 679, 12, 666, 0, 657, 17, 109], ["-", 0, 57, 15, 679, 12, 666, 0, 657, 12, 22]]
5
318
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define USE_LLONG_AS_INT #ifdef USE_LLONG_AS_INT #define int long long #define inf (1ll << 60) #else #define inf (1 << 30) #endif #define rep(i, n) for (int i = 0; i < (n); i++) #define Rep(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, a, b) for (int i = (a);...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define USE_LLONG_AS_INT #ifdef USE_LLONG_AS_INT #define int long long #define inf (1ll << 60) #else #define inf (1 << 30) #endif #define rep(i, n) for (int i = 0; i < (n); i++) #define Rep(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, a, b) for (int i = (a);...
[["-", 0, 57, 64, 1, 0, 11, 12, 83, 0, 13], ["-", 0, 57, 64, 1, 0, 11, 12, 83, 0, 21], ["+", 0, 57, 64, 1, 0, 11, 12, 83, 0, 21], ["+", 0, 57, 64, 1, 0, 11, 12, 83, 0, 13]]
1
539
/* これを入れて実行 g++ code.cpp ./a.out */ #include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <...
/* これを入れて実行 g++ code.cpp ./a.out */ #include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
909
n=int(input()) mod=10**9+7 #初期値が0の辞書 from collections import defaultdict pp = defaultdict(lambda: 0) pm = defaultdict(lambda: 0) def seiki(x,y): tmp=gcd(x,y) return (x//tmp,y//tmp) from math import gcd zero=0 for _ in range(n): a,b=map(int,input().split()) if a==0 and b==0: zero+=1 el...
n=int(input()) mod=10**9+7 #初期値が0の辞書 from collections import defaultdict pp = defaultdict(lambda: 0) pm = defaultdict(lambda: 0) def seiki(x,y): tmp=gcd(x,y) return (x//tmp,y//tmp) from math import gcd zero=0 for _ in range(n): a,b=map(int,input().split()) if a==0 and b==0: zero+=1 el...
[["-", 75, 665, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 12, 612]]
5
264
package main import ( "bufio" . "fmt" "io" "os" ) // github.com/EndlessCheng/codeforces-go func run(_r io.Reader, _w io.Writer) { in := bufio.NewReader(_r) out := bufio.NewWriter(_w) defer out.Flush() gcd := func(a, b int) int { for a != 0 { a, b = b%a, a } return b } abs := func(x int) int { if ...
package main import ( "bufio" . "fmt" "io" "os" ) // github.com/EndlessCheng/codeforces-go func run(_r io.Reader, _w io.Writer) { in := bufio.NewReader(_r) out := bufio.NewWriter(_w) defer out.Flush() gcd := func(a, b int) int { for a != 0 { a, b = b%a, a } return b } abs := func(x int) int { if ...
[["+", 0, 16, 31, 16, 12, 23, 0, 2, 63, 22], ["+", 31, 16, 12, 23, 0, 2, 3, 4, 0, 24], ["+", 31, 16, 12, 23, 0, 2, 3, 4, 0, 433], ["+", 31, 16, 12, 23, 0, 2, 3, 4, 0, 21], ["-", 0, 16, 31, 16, 12, 23, 0, 16, 17, 72], ["-", 0, 16, 31, 16, 12, 23, 0, 16, 12, 433], ["+", 31, 16, 12, 23, 0, 2, 3, 4, 0, 25]]
7
518
#include <bits/stdc++.h> using namespace std; using ll = int_fast64_t; using ld = long double; using pll = pair<ll, ll>; constexpr ll INF = 1LL << 60, MOD = 1e9 + 7; // 998244353; void solve(); int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); solve(); return 0; } ...
#include <bits/stdc++.h> using namespace std; using ll = int_fast64_t; using ld = long double; using pll = pair<ll, ll>; constexpr ll INF = 1LL << 60, MOD = 1e9 + 7; // 998244353; void solve(); int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); solve(); return 0; } ...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
1,374
def e_bullet(MOD=10**9 + 7): from math import gcd from collections import defaultdict N = int(input()) zero_all = 0 pair = defaultdict(int) for _ in range(N): a, b = [int(i) for i in input().split()] if a == 0 and b == 0: zero_all += 1 continue #...
def e_bullet(MOD=10**9 + 7): from math import gcd from collections import defaultdict N = int(input()) zero_all = 0 pair = defaultdict(int) for _ in range(N): a, b = [int(i) for i in input().split()] if a == 0 and b == 0: zero_all += 1 continue #...
[["-", 75, 665, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 665, 64, 196, 0, 1, 0, 662, 12, 22], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]]
5
257
from math import gcd mod = 1000000007 n = int(input()) counter = {} zeros = 0 for i in range(n): a, b = map(int, input().split()) if (a == 0 and b == 0): zeros += 1 continue g = gcd(a, b) a //= g b //= g if (b < 0): a = -a b = -b if (b == 0 and a < 0): ...
from math import gcd mod = 1000000007 n = int(input()) counter = {} zeros = 0 for i in range(n): a, b = map(int, input().split()) if (a == 0 and b == 0): zeros += 1 continue g = gcd(a, b) a //= g b //= g if (b < 0): a = -a b = -b if (b == 0 and a < 0): ...
[["-", 64, 196, 0, 57, 15, 679, 31, 666, 667, 20], ["+", 64, 196, 0, 57, 15, 679, 31, 666, 667, 47]]
5
265
//四則演算 #pragma GCC target("avx") //並列計算 #pragma GCC optimize("O3") //条件分岐を減らす #pragma GCC optimize("unroll-loops") //浮動小数点演算 #pragma GCC //target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using VI = vector<int>;...
//四則演算 #pragma GCC target("avx") //並列計算 #pragma GCC optimize("O3") //条件分岐を減らす #pragma GCC optimize("unroll-loops") //浮動小数点演算 #pragma GCC //target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using VI = vector<int>;...
[["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 72], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22]]
1
1,618
#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>; const int mod = 1000000007; // const int mod = 998244353; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint operator-() const ...
#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>; const int mod = 1000000007; // const int mod = 998244353; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint operator-() const ...
[["-", 0, 11, 12, 16, 31, 2, 3, 4, 0, 13], ["+", 0, 11, 12, 16, 31, 2, 3, 4, 0, 22]]
1
659
/* confirm 0LL and 1LL confirm cornercases such as 0 confirm times of cin < 10^6 */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; using Pld = pair<ld, ld>; using Vec = vector<ll>; using VecP = vector<P>; using VecB = vector<bool>; using VecC = vector...
/* confirm 0LL and 1LL confirm cornercases such as 0 confirm times of cin < 10^6 */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; using Pld = pair<ld, ld>; using Vec = vector<ll>; using VecP = vector<P>; using VecB = vector<bool>; using VecC = vector...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 22]]
1
975
import sys from collections import Counter from math import gcd def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j i...
import sys from collections import Counter from math import gcd def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j i...
[["-", 0, 1, 0, 677, 31, 206, 206, 660, 0, 612], ["+", 0, 1, 0, 677, 31, 206, 206, 660, 0, 612]]
5
513
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
1,150
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define P pair<int, int> #define fi first #define se second #define rep(i, n) for (int i = 0; i < n; i++) #define all(v) v.begin(), v.end() #define pb push_back template <class T> void chmax(T &a, T b) { if (a < b) a = b; } t...
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define P pair<int, int> #define fi first #define se second #define rep(i, n) for (int i = 0; i < n; i++) #define all(v) v.begin(), v.end() #define pb push_back template <class T> void chmax(T &a, T b) { if (a < b) a = b; } t...
[["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 19]]
1
818
import sys import math input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import defaultdict MOD = 10**9+7 N = int(input()) dic = defaultdict(int) zero = 0 for i in range(N): a, b = map(int, input().split()) if b < 0: a = -a b = -b if a == 0 and b == 0: zero +=...
import sys import math input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import defaultdict MOD = 10**9+7 N = int(input()) dic = defaultdict(int) zero = 0 for i in range(N): a, b = map(int, input().split()) if b < 0: a = -a b = -b if a == 0 and b == 0: zero +=...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
261
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using pli = pair<ll, int>; using pil = pair<int, ll>; using uint = unsigned int; template <typename T> using Graph = vector<vector<T>>; const ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using pli = pair<ll, int>; using pil = pair<int, ll>; using uint = unsigned int; template <typename T> using Graph = vector<vector<T>>; const ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
480
// agrawal117 // chahatagrawal117 #include <bits/stdc++.h> #define endl '\n' #define mod 1000000007 typedef long long int ll; using namespace std; #define MAX 100005 ll power(ll a, ll b) { if (b < 0) return 0; ll res = 1LL; while (b > 0) { if (b & 1LL) res = (res * a) % mod; a = (a * a) % mod; ...
// agrawal117 // chahatagrawal117 #include <bits/stdc++.h> #define endl '\n' #define mod 1000000007 typedef long long int ll; using namespace std; #define MAX 100005 ll power(ll a, ll b) { if (b < 0) return 0; ll res = 1LL; while (b > 0) { if (b & 1LL) res = (res * a) % mod; a = (a * a) % mod; ...
[["-", 51, 16, 31, 23, 0, 16, 31, 16, 17, 47], ["+", 51, 16, 31, 23, 0, 16, 31, 16, 17, 20], ["-", 51, 16, 31, 23, 0, 16, 12, 16, 17, 47], ["+", 51, 16, 31, 23, 0, 16, 12, 16, 17, 20], ["-", 51, 16, 12, 23, 0, 16, 31, 16, 17, 18], ["+", 51, 16, 12, 23, 0, 16, 31, 16, 17, 19], ["-", 15, 339, 51, 16, 12, 23, 0, 16, 17, 1...
1
702
#include <bits/stdc++.h> #include <iostream> #define ll long long #define IO \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(...
#include <bits/stdc++.h> #include <iostream> #define ll long long #define IO \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29]]
1
327
// #pragma GCC optimize("Ofast") // #pragma GCC // target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") // #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define FAST ...
// #pragma GCC optimize("Ofast") // #pragma GCC // target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") // #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define FAST ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
1,768
import sys from collections import defaultdict from math import gcd sys.setrecursionlimit(10 ** 7) rl = sys.stdin.readline MOD = 10 ** 9 + 7 def solve(): N = int(rl()) AB = tuple(tuple(map(int, rl().split())) for _ in range(N)) zero_pare = 0 zero_a, zero_b = 0, 0 counter = defaultdict(int) ...
import sys from collections import defaultdict from math import gcd sys.setrecursionlimit(10 ** 7) rl = sys.stdin.readline MOD = 10 ** 9 + 7 def solve(): N = int(rl()) AB = tuple(tuple(map(int, rl().split())) for _ in range(N)) zero_pare = 0 zero_a, zero_b = 0, 0 counter = defaultdict(int) ...
[["-", 75, 665, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 31, 22]]
5
317
import math import collections from collections import defaultdict n=int(input()) l=[list(map(int,input().split())) for i in range(n)] mod=10**9+7 L=[] ct0=0 for i in range(n): if l[i][0]==0 and l[i][1]==0: ct0+=1 elif l[i][0]==0: L.append((0,1)) elif l[i][1]==0: L.append((1,0)) elif l[i][0]<0: ...
import math import collections from collections import defaultdict n=int(input()) l=[list(map(int,input().split())) for i in range(n)] mod=10**9+7 L=[] ct0=0 for i in range(n): if l[i][0]==0 and l[i][1]==0: ct0+=1 elif l[i][0]==0: L.append((0,1)) elif l[i][1]==0: L.append((1,0)) elif l[i][0]<0: ...
[["+", 3, 4, 0, 657, 31, 23, 0, 657, 17, 72], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 12, 22]]
5
418
#!python3 def LI(): return list(map(int, input().split())) # input N = int(input()) AB = [LI() for _ in range(N)] MOD = 10 ** 9 + 7 def gcd(a, b): while b: a, b = b, a % b return a def create_pairs(): z = 0 d = {} for a, b in AB: # irre if a == 0 and b == 0: ...
#!python3 def LI(): return list(map(int, input().split())) # input N = int(input()) AB = [LI() for _ in range(N)] MOD = 10 ** 9 + 7 def gcd(a, b): while b: a, b = b, a % b return a def create_pairs(): z = 0 d = {} for a, b in AB: # irre if a == 0 and b == 0: ...
[["-", 75, 665, 64, 196, 0, 1, 0, 666, 667, 60], ["+", 75, 665, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107]]
5
341
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; i < (n); ++(i)) using ll = long long int; const ll MOD = 1e9 + 7; template <long long int P> struct _mint { long long int x; _mint(long long int x = 0) : x((x % P + P) % P) {} _mint operator-() const { return _mint(-x); } _mint &operator+=(const _...
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; i < (n); ++(i)) using ll = long long int; const ll MOD = 1e9 + 7; template <long long int P> struct _mint { long long int x; _mint(long long int x = 0) : x((x % P + P) % P) {} _mint operator-() const { return _mint(-x); } _mint &operator+=(const _...
[["-", 0, 43, 49, 50, 51, 23, 0, 16, 17, 18], ["+", 0, 43, 49, 50, 51, 23, 0, 16, 17, 19]]
1
639
#include <iostream> #include <map> #include <numeric> #include <vector> using namespace std; #define repl(i, l, r) for (ll i = l; i < r; i++) #define rep(i, n) repl(i, 0, n) using ll = long long; const ll MOD = 1000000007; ll modpow(ll a, ll n) { ll res = 1; while (n > 0) { if (n & 1) res = res * a % MOD;...
#include <iostream> #include <map> #include <numeric> #include <vector> using namespace std; #define repl(i, l, r) for (ll i = l; i < r; i++) #define rep(i, n) repl(i, 0, n) using ll = long long; const ll MOD = 1000000007; ll modpow(ll a, ll n) { ll res = 1; while (n > 0) { if (n & 1) res = res * a % MOD;...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 12, 16, 31, 23, 0, 16, 31, 16, 17, 72], ["+", 12, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22]]
1
552