text
stringlengths
59
71.4k
// Library - static, Cell - thxor0, View - schematic // LAST TIME SAVED: May 23 18:25:41 2014 // NETLIST TIME: May 23 18:27:37 2014 `timescale 1ns / 1ns module thxor0 ( y, a, b, c, d ); output y; input a, b, c, d; specify specparam CDS_LIBNAME = "static"; specparam CDS_CELLNAME = "thxor0"; specpar...
module testbench (); `include "c_functions.v" `include "c_constants.v" parameter num_buffers = 8; parameter data_width = 16; parameter reset_type = `RESET_TYPE_ASYNC; parameter Tclk = 2; parameter runtime = 1000; parameter rate_in = 50; parameter rate_out = 50; parameter initial_seed ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; pair<int, int> s[n + 1]; for (int a = 0; a < n; a++) { int x, y; cin >> x >> y; s[a] = make_pair(max(x - y, 1), min(x + y, m)); } sort(s, s + n); int dp[m + 1]; dp[m] = 0; for (i...
// ---------------------------------------------------------------------- // Copyright (c) 2015, The Regents of the University of California All // rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:...
/** * 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; char t[100][100]; int main(int argc, char* argv[]) { unsigned int n; cin >> n; for (unsigned int i = 0; i < n; ++i) for (unsigned int j = 0; j < n; ++j) cin >> t[i][j]; unsigned int r = 0; for (unsigned int i = 0; i < n; ++i) { for (uns...
#include <bits/stdc++.h> using namespace std; const int N = 1e5; map<int, int> dic; int n, a[N + 10], ma[N + 10], ma2[N + 10]; int main() { ios::sync_with_stdio(0), cin.tie(0); cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; ma[1] = a[1]; ma2[1] = -1; for (int i = 2; i <= n; i++) {...
/* **************************************************************************** This Source Code Form is subject to the terms of the Open Hardware Description License, v. 1.0. If a copy of the OHDL was not distributed with this file, You can obtain one at http://juliusbaxter.net/ohdl/ohdl.txt Description: mo...
/* * 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 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> #pragma 03 using namespace std; int mod = 998244353; int add(int a, int b) { a += b; if (a < 0) a += mod; if (a >= mod) a -= mod; return a; } int main() { int n, m; string s, t; cin >> n >> m >> s >> t; int pw = 1, res = 0, ans = 0; for (int i = 0...
/* * 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; int main() { int b, g, n; scanf( %d%d%d , &b, &g, &n); printf( %d n , min(b, n) - (n - min(g, n)) + 1); return 0; }
#include <bits/stdc++.h> using namespace std; int x[110]; int y[110]; int d[110][2100]; int c[2010][2010]; int modd = 1000000007; int sum[10010]; int main() { int n, ans = 0, schet = 0; cin >> n; for (int i = 0; i < 1001; i++) { c[i][i] = 1; c[i][0] = 1; } for (int i = 1;...
// // 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) // ...
/* * MBus Copyright 2015 Regents of the University of Michigan * * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required ...
#include <bits/stdc++.h> using namespace std; int main() { int a[4]; cin >> a[0] >> a[1] >> a[2] >> a[3]; int sum, i; sum = 0; string s; cin >> s; for (i = 0; i < s.length(); i++) { sum += a[((s[i]) - 0 ) - 1]; } cout << sum; }
/** * 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; int SquareRoot(int n) { int l = 1, r = n + 1; while (l < r) { int mid = (l + r) / 2; if (n / mid < mid) { r = mid; } else { l = mid + 1; } } --l; if (l * l == n) { return l; } return -1; } int...
// -------------------------- testHarness.v ----------------------- `include "timescale.v" module testHarness (); reg rst; reg clk; reg i2cHostClk; wire sda; wire scl; wire sdaOutEn; wire sdaOut; wire sdaIn; wire [2:0] adr; wire [7:0] masterDout; wire [7:0] masterDin; wire we; wire stb; wire cyc; wire ack; wire scl_...
//----------------------------------------------------------------------------- // Title : CIC decimator with dynamically-adjustable decimator // Project : //----------------------------------------------------------------------------- // File : cic_decim.v // Author : danielot <> // Company ...
#include <bits/stdc++.h> using namespace std; int n; vector<pair<long long, int> > v; vector<int> lef, rig; long long pitaj(int t, int a, int b, int c) { long long res; cout << 3 - t << << a << << b << << c << endl; cin >> res; return res; } int main() { ios_base::sync_with...
#include <bits/stdc++.h> using namespace std; bool cmp(int a, int b) { return a > b; } int main() { long long a[100005]; long long b[100005]; int n; cin >> n; long long sum = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; sum += a[i]; } for (int i = 1; i <= n; i++) cin ...
#include <bits/stdc++.h> using namespace std; int getint() { int s = 0, o = 1; char c; for (c = getchar(); c < 0 || c > 9 ; c = getchar()) if (c == - ) o = -1; for (; c >= 0 && c <= 9 ; c = getchar()) s *= 10, s += c - 0 ; return s * o; } const int mod = (int)1e9 + 7; struct ...
/* * 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; int32_t main() { int64_t t; cin >> t; for (int64_t i = 0; i < t; i++) { int64_t a, b; cin >> a >> b; if (a == b) { cout << 0 << endl; continue; } int64_t k = abs(b - a); int64_t ans = k / 5; k %= 5; ...
#include <bits/stdc++.h> using namespace std; int a, b, c, d, e, n, m, t, kk, tt = 0, l[5007], r[5007], fa[5007], type[5007], ind[5007]; int y[5007] = {0}, qw[5007], tree[1000007], a1[5007], a2[5007], a3[5007], a4[5007]; vector<int> q[5007]; vector<short> w[5007]; voi...
#include <bits/stdc++.h> using namespace std; const int maxn = (int)5e5 + 9; const int maxm = (int)1e6 + 9; const long long mod = (long long)1e9 + 7; const double pi = acos(-1); const double eps = 1e-15; vector<pair<int, int> > to[maxn]; int fa[maxn]; int tobig[maxn]; int n, m; int e[maxn]; int ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1005; int a[maxn]; int ans[maxn << 1]; int vis1[maxn], vis[maxn]; int main() { int T; scanf( %d , &T); while (T--) { int n; scanf( %d , &n); int res = n; int p = 0; int mex; for (int i = 1; i <= n;...
#include <bits/stdc++.h> int B = 400; using namespace std; const long long inf = 1e8; int MOD = 1e9 + 7; const int mxn = 300010; const int N = 1000005; const double pi = 3.14159; int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}; int dy[] = {1, 0, -1, 0, -1, 1, 1, -1}; int n, d, k; vector<int> g[mxn]; vect...
#include <bits/stdc++.h> using namespace std; long long int getT(vector<vector<long long int>>&, int, int); void _dp(vector<vector<long long int>>& dp, int n) { for (int j = 0; j < n; j++) dp[0][j] = 1; for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) for (int k = 0; k < i; k++) ...
/* * Copyright (c) 2002 Richard M. Myers * * 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) * ...
/** * 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; const int N = 1e5 + 3; int n; vector<int> G[N]; int h[N], cnt[N]; int res = 0; void dfs(int u, int p) { cnt[h[u]]++; for (int v : G[u]) if (v != p) { h[v] = h[u] + 1; dfs(v, u); } } int main() { ios::sync_with_stdio(...
#include <bits/stdc++.h> using namespace std; struct fast_ios { fast_ios() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; const int inf = 0x3f3f3f3f; const long long INF = 0x3f3f3f3f3f3f3f3f; const int mod = 1e9 + 7; const double eps = 1e-8; const double PI = acos(-1); int n, k, b, c, t[N]; pair<int, int> a[N]; long long ans = INF; long long cnt = 0...
/** * 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; #define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define int long long #define rep(i,a,b) for(int i=a;i<b;i++) #define repn(i,a,b) for(int i=a;i>=b;i--) #define ff first #define ss second #define lb lower_bound #define ub upper_...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; char a[n][m]; bool vis[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> a[i][j]; vis[i][j] = false; } } for (int i = 0; i < n; i++) { for (int j ...
// (C) 1992-2014 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 simulati...
#include <bits/stdc++.h> using namespace std; const int MAXN = 7007; const int MAXM = 300007; const int INF = 1 << 29; const int dir[][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; char reactor[15][15], rescue[15][15]; int N; int table[15][15]; bool isIn(int x, int y) { return x >= 1 && y >= 1 && x <= N &&...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used solely * * for design, simulation, implementation and creation of design files * * limited to Xilinx devices or technologies. Use with non-Xilinx ...
#include <bits/stdc++.h> using namespace std; int n, u, r, i; bool flag = false; long long max_score = 0; vector<long long> a, b, k, p; inline long long score(vector<long long> a) { long long s = 0; for (i = (0); i < (n); ++i) { s += a[i] * k[i]; } return s; } vector<long long> per...
`include "defines.v" module mem_wb( input wire clk, input wire rst, //À´×Ô¿ØÖÆÄ£¿éµÄÐÅÏ¢ input wire[5:0] stall, input wire flush, //À´×Էôæ½×¶ÎµÄÐÅÏ¢ input wire[`RegAddrBus] mem_wd, input wire mem_wreg, input wire[`RegBus] ...
#include <bits/stdc++.h> using namespace std; const int N = 400005; int tr[N << 2], lz[N << 2]; set<int> st[N]; inline void push(int v, int l, int r) { tr[v] += lz[v]; if (l != r) { lz[2 * v] += lz[v]; lz[2 * v + 1] += lz[v]; } lz[v] = 0; } void build(int v, int l, int r, int n...
#include <bits/stdc++.h> using namespace std; long long x, y, u = 0, v = 0; vector<pair<long long, long long> > visited; void move(char c) { if (c == U ) v++; else if (c == D ) v--; else if (c == L ) u--; else u++; } int main() { ios_base::sync_with_stdio(0); ...
//This is essentially a 24h digital clock //Clk is a 1hz clock that will add a second to the initial time set //Load must be a key!! allows setting an initial value for the digital clock //output current time: chour: cminute: csecond module run_clock (nLoad, Clk, hour2, hour1, minute2, minute1, second2, second1, ...
#include <bits/stdc++.h> using vi = std::vector<long long int>; using vvi = std::vector<vi>; using pii = std::pair<long long int, long long int>; using vpii = std::vector<pii>; using vvpii = std::vector<vpii>; using namespace std; const long long int N = 2e6 + 10; const long long int inf = 1e18 + 10; ...
/** * 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...
// -*- Mode: Verilog -*- // Filename : uart_tasks.v // Description : UART Tasks // Author : Philip Tracton // Created On : Mon Apr 20 16:12:43 2015 // Last Modified By: Philip Tracton // Last Modified On: Mon Apr 20 16:12:43 2015 // Update Count : 0 // Status ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:29:53 10/26/2015 // Design Name: UART_tx // Module Name: C:/Users/Ariel/Xilinx/Workspace/UART/TXTest.v // Project Name: UART // Target Device: // Too...
#include <bits/stdc++.h> using namespace std; double pi = acos(-1); long long power(long long a, long long b) { long long p_res = 1; while (b > 0) { if (b % 2 == 1) { p_res *= a; b--; } a *= a; b /= 2; } return p_res; } int cc[300001]; int ans[300001];...
#include <bits/stdc++.h> long long k, pa, pb, dp[1107][1107]; int main() { scanf( %lld%lld%lld , &k, &pa, &pb); long long invb = 1, base = pb; for (int t = 1000000007 - 2; t; t >>= 1, (base *= base) %= 1000000007) if (t & 1) (invb *= base) %= 1000000007; long long inva_b = 1; base = pa + p...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: FIFO_WRITE.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // altera_mf // ================================...
#include <bits/stdc++.h> using namespace std; int M = 1000000007; map<string, long long int> b1; int main() { ios ::sync_with_stdio(false); cin.tie(0); long long int n, k; cin >> n >> k; long long int c = max(n - 2 * k, 0ll); long long int a = n * (n - 1) / 2 - c * (c - 1) / 2; cout ...
#include <bits/stdc++.h> using namespace std; long long int sum, max_lev; vector<pair<long long int, long long int>> level[5010]; vector<long long int> adj[5010]; vector<pair<long long int, long long int>> store[5010]; vector<pair<pair<long long int, long long int>, long long int>> v; long long int vis[50...
/* * 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; const int N = 100005; int n; int head[N], Next[N << 1], ver[N << 1], size[N], edge[N << 1], w[N]; int tot; long long ans; void add(int x, int y, int z) { ver[++tot] = y; edge[tot] = z; Next[tot] = head[x]; head[x] = tot; } void dfs(int x, i...
#include <bits/stdc++.h> using namespace std; long long power(long long base, long long exp) { long long res = 1; while (exp > 0) { if (exp % 2 == 1) res = (res * base); base = (base * base); exp /= 2; } return res; } long long mod(long long a, long long b) { return (a % b + b)...
#include <bits/stdc++.h> using namespace std; long long sign(long long x) { return x < 0 ? -1 : 1; } pair<long long, long long> part(long long from, long long to, long long s, long long dir) { pair<long long, long long> res{dir, abs(to - from)}; if (to != from && sign(to ...
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, m; cin >> n >> m; vector<vector<vector<long long>>> g(n); vector<vector<long long>> store(m); for (long long i = 0; i < m; i++) { long long a, b, c...
#include <bits/stdc++.h> using namespace std; int a[100005]; int main() { map<string, bool> vis; int n; scanf( %d , &n); while (n--) { string s; cin >> s; if (vis[s]) puts( YES ); else puts( NO ); vis[s] = 1; } return 0; }
// // 8192 bytes, 32bit interface `timescale 1ns/1ps module next_hop_ram(clk, addr, data_in, data_out, we, en, reset); input clk; input [12:2] addr; input [31:0] data_in; output [31:0] data_out; input [3:0] we; input en; input reset; wire [3:0] dip; RAMB16_S9_altera ram0 ( .address ( addr[12:2] ...
/** * 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; const int LEN = 100009; int n; int a[LEN]; int ch = 0, nech = 0; int ans = 0; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { if (a[i] % 2 == 0) ch++; else nech++; } ...
#include <bits/stdc++.h> using namespace std; const int MX = 500005; const int MC = 2; int get(char c) { if (c == ( ) return 0; return 1; } struct Node { int l, r, pardp; Node *par, *sLink; Node *chd[MC]; bool isLeaf; int st; Node() { l = r = pardp = 0; par = sLi...
#include <bits/stdc++.h> using namespace std; const long long inf = 1e18 + 1; int n, ans[51], t[51]; long long k, fac[51], dp[51]; bool v[51]; long long mul(long long x, long long y) { return !x ? 0 : inf / x < y ? inf : x * y; } long long cal(int x) { return x < 2 ? 1 : fac[x - 2]; } void work(in...
#include <bits/stdc++.h> using namespace std; char S[5000005], T[5000005]; int n, l = 1, tot = 0, R[5000005], st[5000005], ed[5000005]; void modify() { T[0] = $ , T[1] = # ; for (int i = 0; i < n; ++i) T[++l] = S[i], T[++l] = # ; T[++l] = 0 ; } void Manacher() { int p = 0, mx = 0; f...
#include <bits/stdc++.h> using namespace std; inline long long mmul(long long a, long long b) { return (a * b) % 998244353; } inline long long madd(long long a, long long b) { return (a + b) % 998244353; } long long mpow(long long a, long long p) { if (p == 0) return 1; long long halfPow = mpow(a, p / 2...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017 // Date : Tue Oct 17 02:50:46 2017 // Host : Juice-Laptop running 64-bit major relea...
/////////////////////////////////////////////////////////////////////////////// // // Silicon Spectrum Corporation - All Rights Reserved // Copyright (C) 2009 - All rights reserved // // This File is copyright Silicon Spectrum Corporation and is licensed for // use by Conexant Systems, Inc., hereafter the "li...
#include <bits/stdc++.h> using namespace std; const int Maxn = 20; const int Maxmask = (1 << 16); int out[Maxn][Maxn]; bool making[Maxn][Maxmask]; int n; int s; int a[Maxn * Maxn]; int mod; void input() { cin >> n; for (int i = 0; i < n * n; i++) { cin >> a[i]; s += a[i]; } ...
#include <bits/stdc++.h> using namespace std; int func(int n) { int sum = 1; if (n == 3) return 4; if (n == 2) return 2; if (n == 1) return 1; if (n % 2 == 0) { sum += 2 * (n / 2 - 1) + 1 + func(n - 2); } else { sum += 2 * (n - 1) / 2 + func(n - 2); } return sum; } in...
// (c) Copyright 1995-2014 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 ...
/** * 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 compare(int a, int b) { return a > b; } int main() { int n, a, index; cin >> n; vector<int> A; int temp; int count = 0; for (int i = 0; i < n; i++) { cin >> a; A.push_back(a); } for (int i = 0; i < n; i++) { if (A...
#include <bits/stdc++.h> using namespace std; #define F first #define S second typedef pair<int, int> pi; typedef long long ll; const ll big = 1e6 + 9; ll GCD(ll a,ll b) { if(!b) return a; return GCD(b, a % b); } ll LCM(ll a,ll b) { return ...
// ***************************** // Luis F. Mora // B24449 // Circuitos Digitales II // Prof. Enrique Coen // ***************************** module probador_dma(output reg reset, output reg clk, // Señales de entrada del DMA output reg TFC, // Senal del fifo (cuando system_address = data_address + length) ...
#include <bits/stdc++.h> template <typename Iter> long long maxsum(Iter begin, Iter end) { long long mins = 0, s = 0; long long maxs = 0; long long max = *begin; while (begin != end) { s += *begin; max = std::max(max, *begin); maxs = std::max(maxs, s - mins); mins = std::min(...
/** * 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 main() { string str; while (cin >> str) { int len = str.size(); int times = 0; int c = 0, p = 0; char tmp; for (int i = int(0); i <= int(len - 1); i++) { c = 0, p = 0; tmp = str[i]; if (tmp == C ) { ...
#include <bits/stdc++.h> using namespace std; template <class T> inline void rd(T &x) { x = 0; char c = getchar(); int f = 1; while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) x = x * 10 - 0 + c, c = getchar(); x *= f; } template <class T...
#include <bits/stdc++.h> using namespace std; int main() { char a[150], b[150]; int c, d, e, f, g, x, y, z; gets(a); gets(b); c = strlen(a); for (x = 0; x < c; x++) { if (a[x] >= A && a[x] <= Z ) a[x] = a[x] + ( a - A ); if (b[x] >= A && b[x] <= Z ) b[x] = b[x] + ( a - ...
/** * 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; const int inf = (int)1e9; const int mod = inf + 7; const double eps = 1e-9; int a[100][100]; int n, x, y; bool u[400], u1[400]; vector<int> v; int main() { ios_base ::sync_with_stdio(false); cin.tie(NULL); cin >> n; for (int i = 1; i <= n *...
#include <bits/stdc++.h> const double EPS = 1e-9; const int INT_INF = 1 << 31 - 1; const long long I64_INF = 1ll << 63 - 1ll; const double PI = acos(-1.0); using namespace std; long long solve(int len) { if (len == 1 || len == 2) return 9LL; long long pow = 1LL; for (int i = 0; i < len - 2; 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 law...
#include <bits/stdc++.h> using namespace std; int n; vector<pair<int, int> > a; set<pair<int, int> > d; void solve(int l, int r) { if (r - l <= 1) return; int m = (l + r) / 2; solve(l, m); solve(m, r); for (int i = l; i < r; ++i) { d.insert({a[m].first, a[i].second}); } } sig...
/* * 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; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int ans = 0; for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) { int inp; cin >> inp; if (i == j || i + j == n - 1 || i == n / 2 || j == n...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100005; vector<long long> g[100005]; long long vis[MAXN], s[MAXN], gc[MAXN]; long long n; void dfs(long long v) { vis[v] = 1; s[v] = 1; for (auto i : g[v]) { if (!vis[i]) { dfs(i); s[v] += s[i]; gc[v] = ...
#include <bits/stdc++.h> using namespace std; int getInt(); int getNegInt(); int T, N; int get_nearest(int p, int a, vector<vector<int> >& path, unordered_set<int>& me) { if (me.find(a) != me.end()) return a; for (auto b : path[a]) { if (b == p) continue; int tar = get_ne...
// DGS 3/2/2018 // // Synchronous 1 read-port and 1 write port ram. // `define bsg_mem_1r1w_sync_macro(bits,words) \ if (els_p == words && width_p == bits) \ begin: macro \ saed90_``bits``x``words``_2P mem \ (.CE1 (clk_lo) \ ,.OEB1 ...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.4 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1 ns / 1 ...
#include <bits/stdc++.h> using namespace std; const double PI = 3.14159265358979323846264338327950288419716939937510582097494459230; void swaps(char *x, char *y) { char temp; temp = *x; *x = *y; *y = temp; } void swapi(int *a, int *b) { int temp; temp = *a; *a = *b; *b = ...
#include <bits/stdc++.h> using namespace std; const int MAX = 10000; int n; set<pair<int, int> > a; set<pair<int, int> >::iterator it; pair<int, int> b[MAX]; void dive(int s, int e) { if (e - s == 1) return; int mid = s + e; mid /= 2; dive(s, mid); dive(mid, e); for (int i = s; 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 law...
// (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 n, k, v; map<int, int> mp; vector<int> a; bool can(int mid) { int rem = 0; for (int i = 0; i < a.size(); i++) { if (mp[a[i]] >= mid) { rem += mp[a[i]] / mid; } } return rem >= k; } bool cmp(int s, int f) { return mp[s] >...