text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; char str[1000000]; int len; bool yes(char s[3], int ls, int le) { while (true) { start: int mid = le - ls - 1, i; if (le != len - 1) { if (s[0] != s[1]) return 0; } int c[3] = {0}, sd[2]; c[(s[1] - 0 ) ^ 1] += len - le ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, dx, dy, ans = 0, a, b; map<long long, int> num; double k; scanf( %lld%lld%lld%lld , &n, &m, &dx, &dy); long long x, y; for (int i = 0; i < m; i++) { scanf( %lld%lld , &x, &y); k = ((dy * x - dx * y) % n + ...
#include <bits/stdc++.h> using namespace std; vector<long long int> small; vector<long long int> large; long long int largest(long long int digits, long long int sum) { long long int i; if (digits == 0) return sum; for (i = 9; i >= 0; i--) { if (sum >= i) { large.push_back(i); ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; bool endline = false; template <class T> istream& operator>>(istream& inp, vector<T>& v) { for (auto& it : v) inp >> it; return inp; } template <class T> ostream& operator<<(ostream& out, vector<T>& v) { for (auto& it : v) out << it << (endline ? ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long a, b, n, m; cin >> a >> b >> n >> m; if (m <= min(a, b) && n + m <= a + b) cout << Yes << endl; else cout << No << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; long long a[60][60], b[60][60], n, m; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> a[i][j]; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> b...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const int N = 1e6 + 7; const int INF = 1e9 + 7; int n, m; int mid = 0; int ile[70]; long long mnoz = 1; long long ans = 0; bitset<128> maska; void backtrack(int poz = 1) { ans += mnoz; if (poz > mid) return; for (...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2019 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 `define STRINGIFY(x) `"x`" `define checkd(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%...
#include <bits/stdc++.h> using namespace std; bool even(long long int x) { return (x % 2 == 0); } bool odd(long long int x) { return (x % 2 != 0); } vector<int> sieve(int n) { bool prime[n + 1]; memset(prime, true, sizeof(prime)); for (int p = 2; p * p <= n; p++) { if (prime[p] == true) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long q; cin >> q; while (q--) { long long a, b, m; cin >> a >> b >> m; if (a == b) { cout << 1 << << a << n ; continue; } ...
#include <bits/stdc++.h> int main() { int l, r, a, count; scanf( %d%d%d , &l, &r, &a); count = 0; while (count < a) { if (l > (r + a)) { r = r + a; goto x; } if (r > (l + a)) { l = l + a; goto x; } if (l < r) { l++; count++;...
// EE 471 Lab 3, Beck Pang, Spring 2015 // combine SRAM and ALU together // @require: // Instruction formula is formed by 3 bit control, 5 bit for address of A // 5 bit for address of B // fetch instructions and data into SRAM, and then move to register file module DE1_SoCPhaseII (CLOCK_50, LEDR, SW, KEY); input CLOC...
#include <bits/stdc++.h> using namespace std; int main() { long int n, k, a[222], i; cin >> n >> k; for (i = 1; i <= 2 * n + 1; i++) { cin >> a[i]; } for (i = 2; i <= 2 * n; i += 2) { if ((a[i] - a[i - 1] > 1) && (a[i] - a[i + 1] > 1) && k > 0) { a[i]--; k--; } ...
#include <bits/stdc++.h> using namespace std; long long const INF = 1e18; long long s[300100], a[300100]; int n, k; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; s[n + 1] = 0; for (int i = n; i >= 1...
#include <bits/stdc++.h> using namespace std; const long long mo = 1e9 + 7; const int maxi = 1e6 + 6; long long a[maxi], x[maxi], b[maxi]; int n; long long t; int sum[maxi]; int los[maxi]; int ll[maxi]; int main() { cin >> n >> t; for (int i = 1; i <= n; i++) scanf( %lld , &a[i]); for (i...
// DESCRIPTION: Verilator: Verilog Test module // // Use this file as a template for submitting bugs, etc. // This module takes a single clock input, and should either // $write("*-* All Finished *-*\n"); // $finish; // on success, or $stop. // // The code as shown applies a random vector to the Test // module, then ca...
// (c) Copyright 1995-2016 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant ...
#include <bits/stdc++.h> using namespace std; int main() { vector<int> v; int total, num, i, koita = 0; scanf( %d , &total); for (i = 0; i < total; i++) { scanf( %d , &num); v.push_back(num); } int maximum = v[0]; int minimum = v[0]; for (i = 1; i < total; i++) { nu...
//====================================================================== // // tb_gcm.v // -------- // Testbench for the GCM core top level wrapper. // // // Author: Joachim Strombergson // Copyright (c) 2016, Secworks Sweden AB // All rights reserved. // // Redistribution and use in source and binary forms, with or //...
#include <bits/stdc++.h> using namespace std; vector<long long> primes; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n, q; cin >> n >> q; vector<pair<int, int> > ans; int tmp(-1); vector<bool> state; for (int i = 0; i < n; ++i) { ...
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 25; const long long INF = 1e15 + 7; const long long mod = 998244353; long long dp[N]; long long binpow(long long a, long long b) { a %= mod; long long res = 1; while (b > 0) { if (b & 1) res = res * a % mod; a = ...
//Legal Notice: (C)2013 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associate...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int n, m, tab[105][105], pot[30]; int licz(int numer) { int wyn = 0; for (int i = (0); i <= ((m)-1); ++i) { int a = 0, b = 0; for (int j = (0); j <= ((n)-1); ++j) { a += (tab[j][i] != tab[j][numer]); b += (tab[j][i] == tab[j][numer]...
// bfloat16 // TODO: Write tests and fix obvious bugs first. module FP16BAddSubS0Of5( input clk, input rst, input [15:0] arg_0, input [15:0] arg_1, input arg_2, output [15:0] ret_0, output [15:0] ret_1, output ret_2, output ret_3); wire [15:0] x; wire [15:0] y; ...
//----------------------------------------------------------------------------- // // (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; long long int INF = (long long int)1e16; int n, m, r; vector<int> s, b; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); s.clear(); b.clear(); cin >> n >> m >> r; int x, y; int bax = INT_MAX; int bay = INT_MIN; for ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, d, i, j, k, s, t, ans; cin >> n >> d; s = 0; for (i = 0; i < n; i++) { cin >> t; s += t; } if (s + (n - 1) * 10 > d) ans = -1; else ans = (d - s) / 5...
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
//---------------------------------------------------------------------------- // Copyright (C) 2009 , Olivier Girard // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // * Redistributions of source code must re...
#include <bits/stdc++.h> using namespace std; int n, m, a[100005], b[2005], d[100005], z[100005], L[100005]; inline void upd(int &a, int b) { if (a < b) a = b; } int main(void) { while (cin >> n >> m) { for (int i = int(1); i <= int(n); i++) cin >> a[i]; for (int i = int(1); i <= int(m); i...
#include <bits/stdc++.h> using namespace std; using ll = long long; ll BASE_NUM = 998244353; class UnionFindTree { map<ll, ll> union_tree_data; public: UnionFindTree() {} UnionFindTree(vector<ll> verticals) { for (auto v : verticals) { union_tree_data[v] = v; } } vo...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2003 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 // Also check that SystemC is ordering properly // verilator lint_on IMPERFECTSCH module t (/*AUTOARG*/ ...
#include <bits/stdc++.h> using namespace std; int n, m, a, b, mas[30], summ[100005]; long long sum, countt; string s; map<pair<char, long long>, int> matr; int main() { ios_base::sync_with_stdio(false); cin.tie(0); for (int i = 0; i < 26; ++i) cin >> mas[i]; cin >> s; for (int i = 0; i <...
#include <bits/stdc++.h> using namespace std; const long long MOD = (long long)(1e9 + 7); const long long INF = (long long)(1e9 + 10); const int MAXN = (int)(2e5 + 5); int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); string caso; cin >> caso; while (caso == start ) { ...
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9 + 7; const int INF = (int)1e9; const long long LINF = (long long)1e18; const long double PI = acos((long double)-1); const long double EPS = 1e-9; long long gcd(long long a, long long b) { long long r; while (b) { r = a %...
// Copyright (c) 2015 CERN // @author Maciej Suminski <> // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
#include <bits/stdc++.h> using namespace std; int main() { int t, i; cin >> t; while (t--) { int flag = 0; string s, t, p; cin >> s >> t >> p; int a[26] = {0}; if (s.length() > t.length()) { flag = 0; } else { for (i = 0; i < min(t.length(), s.length()...
#include <bits/stdc++.h> using namespace std; class Graph { public: vector<vector<int> > adjList; vector<int> indegree; Graph(int v) { adjList.resize(v); indegree.resize(v, 0); } void add(int u, int v) { adjList[u].push_back(v); indegree[v]++; } }; struct subse...
#include <bits/stdc++.h> using namespace std; namespace red { inline long long read() { long long x = 0; char ch, f = 1; for (ch = getchar(); (ch < 0 || ch > 9 ) && ch != - ; ch = getchar()) ; if (ch == - ) f = 0, ch = getchar(); while (ch >= 0 && ch <= 9 ) { x = (x << 1) +...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> const int maxi = 2000000000; const int maxq = 1000000000; const double eps = 1e-10; const double pi = 3.1415926535897932; const double inf = 1e+18; const int mo = 1000000007; using namespace std; long long l, r; int main() { cin >> l >> r; if (l == r) { puts( 0 )...
// // Copyright (c) 1999 Peter Monta () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // an...
module top; integer chr, fd, code; reg [14*8:1] str; initial begin // Put a string into the file. fd = $fopen("work/test.txt", "w"); if (fd == 0) begin $display("Failed to open test file for writing!"); $finish; end $fdisplay(fd, "Hello World!"); $fclose(fd); // Now read ...
#include <bits/stdc++.h> using namespace std; int main() { char puzzel[600]; vector<string> Puz; int m, n; int stp; int len = 0, judge = 0; int prevstp; int prevlen; int minv = 1000; int maxv = -9; int flag = 0; scanf( %d%d , &m, &n); for (int i = 0; i < m; i++) { ...
//Legal Notice: (C)2016 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
//+FHDR------------------------------------------------------------------------ //Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved //GLADIC Open Source RTL //----------------------------------------------------------------------------- //FILE NAME : //DEPARTMENT : IC Design / Veri...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:100000000000000 ) using namespace std; long long n, cnt[5], fct[1000001]; pair<long long, long long> dp[1000001]; string st; map<char, int> mp; long long pw(long long a, long long b) { if (b == 0) return 1; if (b == 1) return a; long lon...
#include <bits/stdc++.h> using namespace std; int n, Q, x, y, z, kk; int dis[500005], head[500005], father[500005], top[500005], q[500005]; bool vis[500005]; int far[500005], heavyson[500005], rak[500005], sum[500005], leaf[500005], ans, d[500005]; struct Tree { int nxt, to, step; } e[500005]; ...
#include <bits/stdc++.h> template <class T> T gcd(T a, T b) { T r; while (b != 0) { r = a % b; a = b; b = r; } return a; } template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; } using namespace std; const long long MOD = 1e9 + 7; vector<int> p, q; long...
/* * c4puter northbridge - DRAM controller to Wishbone glue * Copyright (C) 2017 Chris Pavlina * * Wishbone to DDR3 glue * from MicroBlaze MCS to DDR3 glue * (C) Copyright 2012 Silicon On Inspiration * www.sioi.com.au * 86 Longueville Road * Lane Cove 2066 * New South Wales * AUSTRALIA * * This program is ...
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; template <typename T> void chkmin(T &x, T y) { if (y < x) x = y; } template <typename T> void chkmax(T &x, T y) { if (y > x) x = y; } template <typename T> void upd(T &x, T y) { if ((x += y) >= mod) x -= mod; } ...
#include <bits/stdc++.h> using namespace std; char str[5003]; int num[5003][2]; int main() { while (~scanf( %s , str + 1)) { memset(num, 0, sizeof(num)); int len = strlen(str + 1); for (int i = 1; i <= len; i++) { num[i][0] = num[i - 1][0]; num[i][1] = num[i - 1][1]; ...
// Copyright (C) 2005 Peio Azkarate, // Copyright (C) 2006 Jeff Carr, // Copyleft GPL v2 module pcidec_new (clk_i, nrst_i, ad_i, cbe_i, idsel_i, bar0_i, memEN_i, pciadrLD_i, adrcfg_o, adrmem_o, adr_o, cmd_o); // General input clk_i; input nrst_i; // pci input [31:0] ad_i; input [3:0] cb...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
module grom_top (input i_Clk, // Main Clock input i_Switch_1, // SW1 button output o_LED_1, output o_LED_2, output o_LED_3, output o_LED_4, // Segment1 is upper digit, Segment2 is lower digit output o_Segment1_A, output o_Segment1_B, output o_Segment1_C, output o_Segment1_D, ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vec(n); for (int i = 0; i < n; ++i) cin >> vec[i]; int sum = accumulate(vec.begin(), vec.end(), 0); if ((sum / 100) % 2 != 0) { cout << NO n ; return 0; } sum /= 2; int num_one = ...
#include <bits/stdc++.h> using namespace std; const int N = 2005; const int M = 1 << 16; bitset<N> mp[M]; int a[N], sum, rk[N], k, n; priority_queue<pair<int, int> > que; void dfs(int s, int t) { if (s == 0) return; int r = 0; for (; t * k < N && mp[s][t * k]; r++, t *= k) { } for (int...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 10; int n, b[maxn]; pair<int, int> a[maxn]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i].first); a[i].second = i; } sort(a + 1, a + 1 + n); reverse(a + 1, a + 1 + n); for ...
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long k; cin >> k; long long res[4][4]; for (long long i = 0; i < 4; ++i) { for (long long j = 0; j < 4; ++j) { if (i == 1 && j == 2) { re...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a[110]; for (int i = 0; i < n; i++) { cin >> a[i]; } int i, one, two, j, ans = 0; for (i = 0; i < k; i++) { for (one = 0, two = 0, j = i; j < n; j += k) { if (a[j] == 1) ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
//////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2012, Ameer M. Abdelhadi; . All rights reserved. // // // // Redistribution and use in source and binary forms, with or without...
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; int n, m; char a[5555][5555]; int r[5555][5555]; int c[5555]; int ans = 0; int main() { int i, j; cin >> n >> m; for (i = 1; i <= n; ++i) { getchar(); for (j = 1; j <= m; ++j) { a[i][j] = getchar(); ...
#include <bits/stdc++.h> using namespace std; const int mod = 7 + (int)1e9; long long process(string s) { for (int i = 0; i < s.size(); i++) s[i] = (s[i] - 0 ) % 2 + 0 ; return stoll(s); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; char c; map<long long, int> m...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int n, m, a, b, c, p[100010], cnt; bool vis[100010], ed; vector<pair<int, int> > V[100010]; int powmod(int x, int y) { int res = 1, cro = x; while (y) { if (y % 2) res = 1ll * res * cro % mod; cro = 1ll * cro * cro % ...
#include <bits/stdc++.h> using namespace std; void solution() { long long n; cin >> n; vector<vector<long long>> v(n, vector<long long>(n, 0)); if (n % 2 != 0) { v[n - 1][(n - 1) / 2] = 1; v[(n - 1) / 2][n - 1] = 1; } for (long long i = 0; i < n; i++) { for (long long j = 0...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; string s; for (int i = 1; i <= n; i++) { string str; ostringstream temp; temp << i; s += temp.str(); } cout << s[n - 1] << endl; }
#include <bits/stdc++.h> using namespace std; int n, m; long long a[100005]; long long sum1[100005], sum2[100005]; int main() { memset(sum1, 0, sizeof(sum1)); memset(sum2, 0, sizeof(sum2)); cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; sum1[i] = sum1[i - 1] + a[i]; } ...
#include <bits/stdc++.h> using namespace std; inline long long rd() { char c; while (c = getchar(), c < 0 || c > 9 ) ; long long X = c - 48; while (c = getchar(), c >= 0 && c <= 9 ) X = X * 10 + c - 48; return X; } template <class T> inline void print(T x) { if (x < 0) { ...
// Check behaviour with out-of-range and undefined array indices // on LHS of procedural continuous (net) assignment. module top; wire [1:0] array1[2:1]; wire [1:0] array2[1:0]; reg [1:0] var1; assign array1[1] = 2'd0; assign array1[2] = 2'd0; assign array2[0] = 2'd0; assign array2[1] = 2'd0; `ifdef __ICARUS__ wir...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const double eps = 1e-6; vector<int> mp[105], ans; char s[105][105]; int len[105], tmp[30]; queue<int> q; bool solve(int x, int y) { for (int i = 0; i < len[x] && i < len[y]; i++) { if (s[x][i] != s[y][i]) { mp...
#include <bits/stdc++.h> using namespace std; int main(void) { int n, max = 0; string a[100]; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { int count = 0; for (int j = 0; j < n; j++) { if (i != j) { if (a[i].compare(a[j]) == 0) cou...
#include <bits/stdc++.h> using namespace std; int n, m; char s[1008][1008], last[1008][1008]; int a[58][58]; int flag[58], x[58], y[58]; int ans, tot; bool in[8][8]; struct Tprogram { void open() { freopen( 1.in , r , stdin); freopen( 1.out , w , stdout); } void close() {} ...
#include <bits/stdc++.h> int main() { int n, w, cnt1, cnt2; scanf( %d , &n); cnt1 = cnt2 = 0; while (n-- > 0) { scanf( %d , &w); if (w == 100) cnt1++; else cnt2++; } printf( %s n , cnt1 % 2 == 0 && (cnt2 % 2 == 0 || cnt1 >= 2) ? YES : NO ); return 0; ...
////////////////////////////////////////////////////////////////// // // // 8KBytes SRAM configured with boot software // // // // This file is part of the Amber project ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e3 + 10; const int MOD = 1e9 + 7; long long bit[maxn], n, k; long long sum(int i) { long long s = 0; while (i > 0) { s += bit[i]; s %= MOD; i -= i & -i; } return s; } void add(int i, long long x) { while ...
//----------------------------------------------------------------- // RISC-V Core // V1.0.1 // Ultra-Embedded.com // Copyright 2014-2019 // // // // License: BSD //-----------------------...
module aludec(funct, aluop, alucontrol, signd, multseld); input [5:0] funct; input [3:0] aluop; output reg [2:0] alucontrol; output reg signd, multseld; always @(*) begin case(aluop) 4'b0000: begin alucontrol <= 3'b010; signd <= 1'b1; multseld <= 1'b0; end // add (for lw/sw/addi) ...
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; const int maxn = 2e5 + 10, mod = 1e9 + 7, inf = 0x3f3f3f3f; int n, a[maxn]; int main() { ios::sync_with_stdio(0); cin.tie(0); int _t; cin >> _t; while (_t--) { cin >> n; for (int i = 1; i <= n; i++) cin >> a[...
#include <bits/stdc++.h> using namespace std; int a, b, c, d; int ansa, ansb, ansc; int read() { int x = 0, f = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { x = x * 10 + c - 0 ; c = getchar(...
#include <bits/stdc++.h> using namespace std; const int inf = 0x7f7f7f7f; int main() { string s; cin >> s; int ans = 0; stack<char> S; for (int i = 0; i < s.length(); i++) { if (S.empty()) { S.push(s[i]); } else if (S.top() == s[i]) { ans++; S.pop(); }...
#include <bits/stdc++.h> using namespace std; const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; const long long linf = 4000000000000000000LL; const long long inf = 998244353; const long double pi = 3.1415926535; long long maximum(long long x, long long y) { if (x > y) return x; return y; } ...
// // Copyright (c) 1999 Steven Wilson () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
#include <bits/stdc++.h> using namespace std; const long long maxn = 2e5 + 10; const long long inf = 1e18; const long long mod = 1e9 + 7; long long n, q; long long a[maxn]; long long cost(long long g) { long long ans = 0; for (long long i = 1; i <= n; i++) { if (a[i] < g) ans += g - ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const int mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; long long ans = 0; cin >> n >> m; for (int i = 1; i <= n; i++) { ans += ((i % 5) + m) / 5; } cout ...
#include <bits/stdc++.h> using namespace std; class Solution { public: long long count(long long _m, long long _x) { if (_m < 3) { return max(0LL, _m); } m = _m; x = _x; vector<pair<long long, int>> cnts = factorize(m); long long res = 0; search(0, 1, cnts, r...
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; #define endl n #define ll long long #define sz(s) (int)(s.size()) #define INF 0x3f3f3f3f3f3f3f3fLL #define all(v) v.begin(),v.end() #define watch(x) cout<<(#x)<< = <<x<<endl const int dr[] { -1, -1, ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.or...
#include <bits/stdc++.h> using namespace std; void solve(); int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); return 0; } const int inf = 2e9; const long long linf = 2e18; const long long mod = 998244353; const int N = 2e5 + 100; vector<int> g[N]; struc...
#include <bits/stdc++.h> using namespace std; int n, a[200011], c[200011], isc[200011], cn, pow2[200011] = {1}, seen[200011]; int main() { int ans = 1, mod = 1e9 + 7; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , a + i); pow2[i] = pow2[i - 1] * 2LL % mod; } for (int i...
// File: ./ex-target/WordContextProduct.v // Generated by MyHDL 1.0dev // Date: Mon Oct 5 14:11:53 2015 `timescale 1ns/10ps module WordContextProduct ( y, y_dword_vec, y_dcontext_vec, word_embv, context_embv ); // Word-context embeddings product and derivative model. // // :param y: return relu...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 7; int n, lim, a[N], mn[N], mx[N], suf[N]; long long ans; int main() { scanf( %d%d , &n, &lim); for (int i = 1; i <= lim; i++) mn[i] = n + 1; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); mn[a[i]] = min(mn[a[i]], i)...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////// // // This file is part of Descrypt Ztex Bruteforcer // Copyright (C) 2014 Alexey Osipov <giftsungiv3n at gmail dot com> // // This program is free software: you can redistribute it and/or modify // it under the terms of ...