text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; char inp[2000]; int toNum(char x) { if (x >= 0 && x <= 9 ) return x - 0 ; return 10 + x - A ; } char toChar(int x) { if (x < 10) return 0 + x; return A + (x - 10); } long long ato10(int a) { int len = strlen(inp); int lw = 0; ...
// testbench_7.v //////////////////////////////////////////////////////////////////////////////// // a testbench using the suggested program of lab 7 //////////////////////////////////////////////////////////////////////////////// // Dimitrios Paraschas () /////////////////////////////////////////////////////////////...
/** * 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; vector<string> s; string ans(200, ); set<string> Set; vector<string> cand; int main() { cin >> n; ans.resize(2 * n - 2); for (int i = 0; i < 2 * n - 2; ++i) { string a; cin >> a; Set.insert(a); s.push_back(a); ...
#include <bits/stdc++.h> using namespace std; vector<string> ans; int main() { char c; string ss = ; while ((c = getchar()) != n ) { if ( a <= c && z >= c) { ss += c; continue; } else if (c == ) { if (!ss.empty()) { ans.push_back(ss); s...
module SmallSerDes #( parameter BYPASS_GCLK_FF = "FALSE", // TRUE, FALSE parameter DATA_RATE_OQ = "DDR", // SDR, DDR | Data Rate setting parameter DATA_RATE_OT = "DDR", // SDR, DDR, BUF | Tristate Rate setting. parameter integer DATA_WIDTH = 2, ...
module automatic test(); function static integer accumulate1(input integer value); static int acc = 1; acc = acc + value; return acc; endfunction function integer accumulate2(input integer value); int acc = 1; acc = acc + value; return acc; endfunction localparam value1 = accumulate1(2); localparam value...
#include <bits/stdc++.h> const int maxN = 2000; const unsigned int mod = 998244353; constexpr int inf = INT_MAX; class Array { public: inline const int *begin() const { return data; } inline const int *end() const { return endPtr; } inline void push_back(const int x) { *(endPtr++) = x; } inli...
/** * 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; inline long long read() { long long res = 0, f = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { res = res * 10 + c - 48; c = getchar(); } retur...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:256000000 ) using namespace std; const long long inf = 1e18; const double eps = 1e-9; const double pi = 4 * atan(1.0); const int N = int(2e5) + 100; const int ITERS = 80; int m; pair<int, int> a[N]; vector<pair<int, int> > group[N]; long lon...
`include "defines.v" module data_ram( input wire clk, input wire ce, input wire we, input wire[`DataAddrBus] addr, input wire[3:0] sel, input wire[`DataBus] data_i, output reg[`DataBus] data_o, output wire[`DataBus] check, input wire[2:0] ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Xilinx // Engineer: bwiec // Create Date: Mon Jun 05 07:43:03 MDT 2015 // Design Name: dma_controller // Module Name: tlast_gen // Project Name: DMA Controller // Target Devices: 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 law...
/*********************************************************************** Single Port RAM that maps to a Xilinx/Lattice BRAM This file is part FPGA Libre project http://fpgalibre.sf.net/ Description: This is a program memory for the AVR. It maps to a Xilinx/Lattice BRAM. This version can be modified by th...
#include <bits/stdc++.h> using namespace std; int main() { string str; cin >> str; string s = WUB ; size_t pos = str.find(s); while (pos != string::npos) { string token = str.substr(0, pos); if (token.length() != 0) cout << token << ; str.erase(0, pos + 3); pos = str....
#include <bits/stdc++.h> using namespace std; template <class T1, class T2> istream &operator>>(istream &in, pair<T1, T2> &P) { in >> P.first >> P.second; return in; } template <class T1, class T2> ostream &operator<<(ostream &out, const pair<T1, T2> &P) { out << ( << P.first << , << P.seco...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 08:18:40 03/03/2016 // Design Name: // Module Name: register // Project Name: // Target Devices: // Tool versions: // Description: // // Depend...
// *************************************************************************** // *************************************************************************** // 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> using namespace std; using ll = long long; const long double PI2 = atan2(1.L, 0.L); int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; long double r; cin >> n >> r; long double res = r * r * n * sin(PI2 / n) * sin(2 * PI2 / n) / sin(3 * PI2 / n...
`timescale 1 ns / 1 ps `include "interface_axi_master_v1_0_tb_include.vh" module interface_axi_master_v1_0_tb; reg tb_ACLK; reg tb_ARESETn; reg M00_AXI_INIT_AXI_TXN; wire M00_AXI_TXN_DONE; wire M00_AXI_ERROR; // Create an instance of the example tb `BD_WRAPPER dut (.ACLK(tb_ACLK), .ARESETN(tb_ARESETn), ...
/* wb_data_resize. Part of wb_intercon * * ISC License * * Copyright (C) 2019 Olof Kindgren <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies...
/** * 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 \$__NX_PDPSC512K (CLK2, A1ADDR, A1DATA, A1EN, B1ADDR, B1DATA, B1EN); parameter CFG_ABITS = 14; parameter CFG_DBITS = 32; parameter CFG_ENABLE_A = 4; parameter CLKPOL2 = 1; parameter [524287:0] INIT = 524287'b0; input CLK2; input [CFG_ABITS-1:0] A1ADDR; input [CFG_DBITS-1:0] A1DATA; input [CFG_ENABLE_...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; int mn = INT_MAX; int cnt = 0; for (int i = n - 1; i >= 0; i--) { if (v[i] > mn) cnt++; ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string s; cin >> s; int dp[10][10][10][10]; for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) for (int k = 0; k < 10; k++) for (int l = 0; l < 10; l++) ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:32:13 02/28/2016 // Design Name: Alu // Module Name: C:/Users/Ranolazine/Desktop/Lab/lab5/tes.v // Project Name: lab5 // Target Device: // Tool versi...
// -*- Mode: Verilog -*- // Filename : fw_interface_logic.v // Description : FW Interface Test Logic // Author : Philip Tracton // Created On : Wed Dec 21 14:09:23 2016 // Last Modified By: Philip Tracton // Last Modified On: Wed Dec 21 14:09:23 2016 // Update Count...
/** * 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> int days(int y) { if (y % 400 == 0 || (y % 4 == 0 && y % 100 != 0)) { return 366; } else { return 365; } } int main() { int year, i, d, di, dii; unsigned long long int count = 0; scanf( %d , &year); d = days(year); di = d; for (i = year;; i+...
#include <bits/stdc++.h> using namespace std; int Id[2 * 105]; int L[2 * 105]; int W[2 * 105]; long long int dp[2 * 105][3005]; bool vis[2 * 105][3005]; int n, l; long long int solve(int LastTp, int Len) { if (Len > l) return 0LL; if (Len == l) return 1LL; if (vis[LastTp][Len] == 1) return d...
/** * 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 Power(int base, int exp) { int ans = 1; while (exp > 0) { if (exp & 1) ans = (1LL * ans * base) % 1000000007; exp = exp >> 1; base = (1LL * base * base) % 1000000007; } return ans; } vector<map<long double, int> > p_CntS(2005); ...
/** * 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...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 11:42:35 09/12/2015 // Design Name: CPU // Module Name: Z:/share/ISE/CPUFly/tests/CPU_test.v // Project Name: CPUFly // Target Device: // Tool versions:...
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; vector<int> get_sb(int num) { vector<int> res; while (num) { res.push_back(num % 10); num /= 10; } return res; } string get_a(vector<int> kol, string sub) { string reserve = 9 ; ++reserve[0]; ...
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { int n; long long a = 0, b; cin >> n; b = pow(2, n); for (int i = 1; i < n / 2; i++) b += pow(2, i); for (int i = n / 2; i < n; i++) a += pow(2, i); cout << abs(b - a)...
#include <bits/stdc++.h> using namespace std; const int N = 200007, inf = 0x3f3f3f3f; vector<int> edges[N]; int d[N]; void bfs(int s) { queue<int> q; q.push(s); memset(d, -1, sizeof d); d[s] = 0; while (q.size()) { int u = q.front(); q.pop(); for (int v : edges[u]) { ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; scanf( %lld , &n); long long int a[n]; long long int i, j, k; long long int ans = 0; k = 0; for (i = 0; i < n; i++) { scanf( %lld , &j); if (j == 1) { a[k++] = i; } } if (k == 0)...
//Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:47:07 MST 2014 //Date : Mon Mar 7 12:11:16 2016 //Host : lubuntu running 64-bit Ubuntu 15.04 //Command ...
#include <bits/stdc++.h> using namespace std; vector<int> dif; map<int, int> g; int a[120000]; int main() { int n, flag; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + 1 + n); for (int i = 2; i <= n; i++) { if (g[a[i] - a[i - 1]] == 0) dif.push_back(a[i] - a[i - ...
// $Header: $ /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2009 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int _; for (cin >> _; _--;) { int n, q; cin >> n >> q; string a; cin >> a; ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, m, d, ans; struct node; struct edge { node *ed; edge *next; } E[N << 1], *newE = E; struct node { edge *son; node *pa; bool flag; int dist[2], dis; void dfs() { dist[0] = dist[1] = dis = -1e8; ...
#include <bits/stdc++.h> using namespace std; int a[100007], b[100007]; vector<int> v, ans; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m, x; cin >> n >> m; for (int i = 0; i < n; i++) cin >> x, a[x]++; for (int i = 0; i < n; i++) cin >> x, b[m - x - 1]++; for (int ...
// (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; vector<int> gph[500005]; int n, par[500005], dep[500005], msk[500005]; int dp[500005], sz[500005]; int mx[1 << 22]; int l[23] = {}; void dfs2(int x, vector<pair<int, int> > &v) { v.push_back(pair<int, int>(dep[x], msk[x])); for (auto &i : gph[x]) dfs2(...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2008 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc = 0; reg [63:0] crc; ...
// // Copyright (c) 2015 Jan Adelsbach <>. // All Rights Reserved. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your optio...
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<long long int> a(n); vector<long long int> mp(n + 1, 0); for (int i = 0; i < n; i++) { cin >> a[i]; mp[a[i]]++; } vector<long long int> ans(n + 1); priority_queue<pair<long long, long lon...
#include <bits/stdc++.h> using namespace std; int main() { ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long i, j, k, n, m, ans = 0, sum = 0, a[100005] = {0}, mn = 2e9, mx = 0, cnt = 1, index = 0, x, y, z, xptr, yptr, id1, id2, ...
#include <bits/stdc++.h> using namespace std; const int MAX_H = 100; const int MAX_W = 100; int hs[MAX_H], vs[MAX_W]; int ps[MAX_H][MAX_W], as[MAX_H * MAX_W]; int main() { int h, w, q; scanf( %d%d%d , &h, &w, &q); for (int y = 0, p = 0; y < h; y++) for (int x = 0; x < w; x++, p++) ps[y][x]...
#include <bits/stdc++.h> using namespace std; int N, M; int tam[200005], ans[200005]; map<pair<int, int>, bool> ex; int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin >> N >> M; for (int m = 0; m < M; m++) { int u, v; cin >> u >> v; tam[u]++; tam[v]++; ex[...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int t; cin >> t; while (t--) { long long int n, k; cin >> n >> k; long long int a[n * k], c = 0; for (long long int i = 0; i < n * k; ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; const long long mo = 1e9 + 7; const long long inf = 1e9; const long long Inf = 1e18; int a[N], b[N]; int main() { int n, m, tot = 0; scanf( %d%d , &n, &m); int nw = 0; for (int i = (1); i <= (m); ++i) { scanf( %d ,...
#include <bits/stdc++.h> using namespace std; long long n, k; long double ans, eps = 1e-10, l, v1, v2; bool solve(long double mid) { int x = (n + k - 1) / k; long double tl = mid, pos = l; while (x--) { if (tl < 0) return 0; long double trav = (v2 * v1 * tl - v2 * pos) / (v1 - v2); ...
#include <bits/stdc++.h> using namespace std; long long mInv[41]; long long fact[41]; long long factInv[41]; map<long, long> mymap; long long heights[5]; long long segTree[3]; long nums[5005]; long g[5005]; vector<long> primes; vector<long> badPrimes; long funcVal[1000006]; long long N; set<...
// Copyright (c) 2000-2009 Bluespec, Inc. // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, pub...
#include <bits/stdc++.h> using namespace std; inline long long max(long long a, long long b) { return a > b ? a : b; } class Box { public: string name; int type, border, spacing; vector<Box *> con; bool hcalc, wcalc; long long w, h; Box() { hcalc = wcalc = 0; } Box(string ni, int t)...
#include <bits/stdc++.h> using namespace std; const int N = 4e4 + 10, M = 32, INF = 1e9 + 10; int a, b, n; int dp[N][M]; long long mypw(long long a, int b) { double ans = pow(a, b); if (ans > INF) { return INF; } long long ret = 1; while (b--) ret = ret * a; return ret; } int...
#include <bits/stdc++.h> using namespace std; long long x, a[] = {3, 15, 81, 6723, 50625, 2562991875LL}; int sg[] = {0, 1, 2, 0, 3, 1, 2}, n, ans = 0; int main() { cin >> n; while (n--) { cin >> x; ans ^= sg[lower_bound(a, a + 6, x) - a]; } cout << (ans ? Furlo : Rublo ) << endl; ...
/* * Copyright 2013, Homer Hsing <> * * 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 by applicable law or agreed to ...
/* * 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: RIT // Engineer: Cody Cziesler and Nick Desaulniers // // Create Date: 3:03 04/17/2011 // Design Name: reg_block // Module Name: reg_block // Project Name: Omicron // Target Device...
/** * 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) 2017 Simon Southwell. All rights reserved. // // Date: 30th May 2017 // // This code is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free So...
// megafunction wizard: %FIFO%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo_mixed_widths // ============================================================ // File Name: playback_fifo.v // Megafunction Name(s): // dcfifo_mixed_widths // // Simulation Library Files(s): // // ====================...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017 // Date : Tue Sep 19 00:30:00 2017 // Host : DarkCube running 64-bit major release ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int temp; map<int, vector<int>> mpp; for (int i = 2; i <= n; i++) { cin >> temp; mpp[temp].push_back(i); } for (auto itr = mpp.begin(); itr != mpp.end(); ++itr) { vector<int> v = (*itr).second; ...
#include <bits/stdc++.h> using namespace std; long long n, a, b, c, res = LONG_LONG_MAX; int main() { cin >> n >> a >> b >> c; if (n % 4 == 0) return puts( 0 ); if (n % 4 == 1) { res = min(res, a * 3); res = min(res, a + b); res = min(res, c); } else if (n % 4 == 2) { res =...
#include <bits/stdc++.h> int main() { int team1, team2; std::string s; std::cin >> s; team1 = s.find( 1111111 ); team2 = s.find( 0000000 ); if (team1 >= 0 || team2 >= 0) { std::cout << YES ; } else std::cout << NO ; }
#include <bits/stdc++.h> int main() { int N; std::cin >> N; std::set<std::pair<int, int>> doubled; std::set<std::pair<int, int>> pend; int to_double = 0; int f_doubled = 0; int64_t total_damage = 0; int t; int d; for (int i = 0; i < N; i++) { std::cin >> t; std::cin...
module relay_decode( clk, reset, mode, data_in, data_out, data_available ); input clk, reset, mode, data_in; output[3:0] data_out; output[0:0] data_available; reg [3:0] data_out = 4'b0; reg [0:0] data_available = 1'b0; reg [6:0] one_counter = 7'b0; reg [6:0] zero_co...
`define ADDER_WIDTH 014 `define DUMMY_WIDTH 128 `define 2_LEVEL_ADDER module adder_tree_top ( clk, isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1, sum, ); input clk; input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,...
module printvga(input wire clk, reset, vgae, input wire [15:0] e, output wire [7:0] vgax, vgay, output wire vgaw); // reg [7:0] i,j; integer i; // always @(posedge clock, posedge reset) // if (reset) // begin // i <= 8'b00000000; // j <= 8'b00...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: reading.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ================================...
#include <bits/stdc++.h> using namespace std; struct edge { int src, dst; }; int const MOD = 1000000007; long long _MOD = 1000000009; double EPS = 1e-9; long long INF = LLONG_MAX / 2; int main() { int N, w; cin >> N >> w; vector<int> a(N); for (int i = 0; i < N; i++) cin >> a[i]; ...
#include <bits/stdc++.h> using namespace std; const int Maxn = 2e5 + 10; long long Inf = 1e18; const int Log = 20; const long long Sqrt = 1000000; const long long Mod = 998244353LL; long long mul(long long a, long long b) { a %= Mod; b %= Mod; return (a * b) % Mod; } long long bin_pow(long...
#include <bits/stdc++.h> using namespace std; inline long long getnum() { char c = getchar(); long long num, sign = 1; for (; c < 0 || c > 9 ; c = getchar()) if (c == - ) sign = -1; for (num = 0; c >= 0 && c <= 9 ;) { c -= 0 ; num = num * 10 + c; c = getchar(); } ...
#include <bits/stdc++.h> int main() { int n, m, a[1003], b[1003], i, j, count = 0, k = 0, flag = 0; scanf( %d %d , &n, &m); for (i = 0; i < n; i++) { scanf( %d , &a[i]); } for (i = 0; i < m; i++) { scanf( %d , &b[i]); } for (i = 0; i < m; i++) { for (j = k; j < n; j++) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << n << endl; for (int i = 1; i <= n; ++i) cout << 1 ; }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int x, y, n = 0; cin >> x >> y; for (int i = 2; i <= x; i++) { if (x % i == 0) { n = i; break; } } cout << x + n + (y - 1) * 2 << endl; } }
#include <bits/stdc++.h> using namespace std; int main(){ int T; cin >> T; long long A[114514]; while(T--){ int N; cin >> N; long long S = 0; for(int i = 0; i < N; i++){ cin >> A[i]; S += A[i]; } sort(A, A+N, greater<long long>()); if(S == 0) cout << 0 << n ; else ...
#include <bits/stdc++.h> using namespace std; vector<int> ev[1000099]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> p(n), pos(n); for (int(i) = (0); (i) < (int)(n); ++(i)) { cin >> p[i]; p[i]--; pos[p[i]] = i; ev[n - i].push_bac...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:43:37 11/03/2014 // Design Name: // Module Name: trial // Project Name: // Target Devices: // Tool versions: // Description: // // Dependenc...
#include <bits/stdc++.h> using namespace std; const int N = 2010; int n, a[N], p[N], pos[N]; vector<int> c[26], ans; string s, t; void add(int x) { if (0 < x) { ans.push_back(x); } vector<int> nw; for (int i = n - 1; i >= n - x; --i) { nw.push_back(p[i]); } for (int i = n...
`timescale 1ns / 1ns module eth_rx (input c, // must be the 50 MHz RMII reference clock input [1:0] phy_rxd, input phy_rxdv, output [7:0] d, output dv, output erx); // end of RX wire [1:0] rmii_d; sync #(2) rmii_d_sync_r (.in(phy_rxd), .clk(c), .out(rmii_d)); wire rmii_dv; sync rmii_dv_sync_r (.in(phy_rxdv), .c...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; template <typename T> inline void read(T &x) { x = 0; T fl = 1; char ch = 0; for (; ch < 0 || ch > 9 ; ch = getchar()) if (ch == - ) fl = -1; for (; ch >= 0 && ch <= 9 ; ch = getchar()) 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 law...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; } template <typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; } struct UnionFind { vector<int> data; UnionFind(int size_) : data(size_, -1...
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int a, long long int b) { if (a == 0) return b; return gcd(b % a, a); } long long int INF = 1e17; long long int NINF = (INF * -1); priority_queue<pair<long long int, long long int>, vector<pair<long long int, ...
#include <bits/stdc++.h> using namespace std; const long long int INF = 1e18; const int inf = 1e9; const int MOD = 1e9 + 7; const int nax = 500000 + 10; int arr[nax], color[nax]; vector<int> graph[nax]; map<int, set<int> > map1; int main() { ios::sync_with_stdio(0); int n, m; cin >> n >> m...
#include <bits/stdc++.h> int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return x * f; } using namespace std; ...
#include <bits/stdc++.h> using namespace std; template <class T> int len(const T& c) { return (int)c.size(); } int main() { int n, bb; double b1; vector<double> b; cin >> n >> bb; for (int i(0), _n(n); i < _n; ++i) { cin >> b1; b.push_back(b1); } double sum = accumu...
/** * 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 s; int i, count1 = 0, count = 0; cin >> s; for (i = 0; i < s.length(); i++) { if (s[i] == 1 ) { count++; count1 = 0; if (count == 7) { cout << YES ; return 0; } } else ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2008 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 `define stop $stop `define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got...
/** * 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 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...