text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> const int maxn = 100005; int nbs[maxn], ev[maxn * 2], next[maxn * 2], color[maxn], d[maxn], ans[maxn], size[2], view[maxn], n, m, k; void addedge(int x, int y) { next[++k] = nbs[x]; ev[k] = y; nbs[x] = k; } void init() { scanf( %d%d , &n, &m); for (int i = 0;... |
#include <bits/stdc++.h> using namespace std; map<string, int> H; string s; int l, rs; void Read_Input() { cin >> s; l = s.length(); rs = 0; int i, j, k; for (i = 0; i < l; i++) for (j = i + 1; j < l; j++) { for (k = 0; j + k < l && s[i + k] == s[j + k]; k++) ; ... |
#include <bits/stdc++.h> using namespace std; const int N = 4e4 + 1; int n, m, x[N], y[N], freq[N], q[N], vis[N], match[N], T, ans[N]; vector<int> g[N]; bool get(int u) { vis[u] = T; for (auto i : g[u]) { if (match[i] != -1 && vis[match[i]] == T) continue; if (match[i] == -1 || get(match[i... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14.10.2017 19:53:13
// Design Name:
// Module Name: control_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Re... |
/*
* 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 a, b, l, r; void load() { cin >> a >> b >> l >> r; } string s; bool jel[30]; void konstrukcija() { s = ; for (int i = 0; i < a; i++) { char c = i + a ; s += c; } char c = s[s.size() - 1]; for (int i = 0; i < b; i++) s += c;... |
#include <bits/stdc++.h> using namespace std; struct edge { int t, nxt; } e[600010]; int n, cnt, be[300010], mn_mx[300010], f, vid[300010], tot; void add(const int& x, const int& y) { e[++cnt].t = y, e[cnt].nxt = be[x], be[x] = cnt; } void dfs(const int& x) { if (!be[x]) return (void)(++tot, v... |
#include <bits/stdc++.h> using namespace std; const int MAX = 2e5 + 100; vector<int> ans; set<pair<int, int>> add[MAX], rem[MAX], cur; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) { int x, y; c... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 305; struct sss { int a, b, c; bool operator<(const sss& a) const { return c < a.c; } }; vector<sss> v[MAXN * MAXN]; int cost(int a, int b, int c, int d) { return abs(a - c) + abs(b - d); } int main() { int m, n, i, j, k, p; ci... |
// megafunction wizard: %Shift register (RAM-based)%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altshift_taps
// ============================================================
// File Name: Line_Buffer1.v
// Megafunction Name(s):
// altshift_taps
//
// Simulation Library Files(s):
// altera_mf
// ======... |
///////////////////////////////////////////////////////////////////////////////
//
// Module: cnet_reprogram.v
// Project: CPCI (PCI Control FPGA)
// Description: Manages the reprogramming of the CNET device.
// Programming is performed using Slave SelectMAP mode
// (refer to Chapter 4 o... |
#include <bits/stdc++.h> using namespace std; int main() { long long a = 0, b = 0; bool gr = 0; cout << ? << 0 << << 0 << endl; fflush(stdout); int g; cin >> g; if (g == 1) gr = 1; else gr = 0; for (int i = 29; i >= 0; i--) { cout << ? << (a + (1 << i)... |
`timescale 1ns/1ps
`define period 10
// http://www.nxp.com/documents/data_sheet/PCF8570.pdf
// iverilog -o test i2c_sram_embedded.v sram.v i2c_mock_master.v tb_i2c_sram.v && vvp test
module i2c_sram_embedded (
sda,
scl,
my_addr,
curr_data,
rcvd_device_address,
state,
rcvd_mode
);
inout sda;
input scl;
wi... |
#include <bits/stdc++.h> using namespace std; const int N = 10000; vector<int> vec(N); int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> vec[i]; } sort(vec.begin(), vec.begin() + n); int sum = 0; for (int i = 0; i < m; i++) { sum += vec[i]; } ... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f, MOD = 1e9 + 7; const int n_ = 3010; long long gcd(long long a, long long b) { return (a ? gcd(b % a, a) : b); } long long power(long long a, long long n) { long long p = 1; while (n > 0) { if (n % 2) { p = p * a; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, d, val, ind = 0, counter = 0, ans = 0; cin >> n >> d; string v; cin >> v; while (ind <= n - 1) { counter++; ans = 0; for (int i = d; i >= 1; i--) { if (v[ind + i] == 1 ) { ind += i; a... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date:
// Design Name:
// Module Name: ETAII_N16_Q4
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
/**
* 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2005-2007 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/);
reg [3:0] value;
reg [3:0] valuex;
// verilator lint_off CASEOVERL... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; long long int n, m; cin >> n >> m; long long int a[n]; for (long long int i = 0; i < n; i++) cin >> a[i]; priority_queue<int> pq; long long int res[n]; pq.push(a[0]);... |
module s27 (
G1,
G2,
clk_net,
reset_net,
G3,
G0,
G17);
// Start PIs
input G1;
input G2;
input clk_net;
input reset_net;
input G3;
input G0;
// Start POs
output G17;
// Start wires
wire G1;
wire net_5;
wire net_15;
wire net_27;
wire G17;
wire reset_net;
wire net_14;
wire G3;
wire net_26;
wire clk_net;
wire net_13;
wi... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); long long n, x; cin >> n, x = n; long long cnt = 0, d = n; for (int i = 2; 1LL * i * i <= x; i++) { if (x % i == 0) { cnt++, d = i; whi... |
//Legal Notice: (C)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
//simulation files), and any associated do... |
// (c) Copyright 1995-2017 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 i, j, k, m; int a[100010]; long long f[110][100010], n; long long dfs(int n, long long m) { if (!n) return m; if (m < 100010 && f[n][m] >= 0) return f[n][m]; long long A = dfs(n - 1, m) - dfs(n - 1, m / a[n]); if (m < 100010) f[n][m] = A; r... |
/**
* 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 = 2e5 + 5; int a[N], b[N], par[N], val[N], sz[N], lst[N]; vector<int> his; pair<int, int> get(int v) { if (par[v] == v) return make_pair(v, val[v]); pair<int, int> g = get(par[v]); g.second ^= val[v]; return g; } bool merge(int u, i... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 200100; int arr[MAXN], tmp[MAXN]; vector<int> ve[MAXN]; map<pair<int, int>, vector<int> > mapa; int ind[MAXN]; vector<int> out[MAXN]; int sol = 0; vector<int> t1, t2; vector<int> comp; map<int, int> aaa; void tour(int x, int i) { ... |
#include <bits/stdc++.h> using namespace std; int gcd(int u, int v) { return (v != 0) ? gcd(v, u % v) : u; } struct disjoint_sets { int parent[100000 + 10]; int ccOfParent[100000 + 10]; int cc; disjoint_sets(int V) { cc = V; for (int i = 1; i <= V; i++) parent[i] = i, ccOfParent[i] = 1... |
#include <bits/stdc++.h> long long MOD = 1000000007; using namespace std; bool sortbysec(const pair<long long, long long> &a, const pair<long long, long long> &b) { return (a.second < b.second); } long long POW(long long a, long long b) { if (b == 0) return 1; if (b == 1) return 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... |
/**
* 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() { int n; cin >> n; int mas[n]; for (int i = 0; i < n; i++) { cin >> mas[i]; } int d = 0; int t = 0; for (int i = 0; i < n; i++) { if (mas[i] - d == 1) { t++; d = mas[i]; } } if (!d) { ... |
#include <bits/stdc++.h> using namespace std; const long long MAXN = 1e5 + 10; const long long MAXL = 20; long long n, m; long long v[MAXN], s[MAXN]; long long rmq[MAXL][MAXN]; long long resp[MAXN]; long long best[MAXN]; void buildRMQ() { for (long long k = 0; k < n; k++) rmq[0][k] = s[k]; for... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pll = pair<ll, ll>; using vll = vector<ll>; using vpll = vector<pll>; struct d_ { template <typename T> d_& operator,(const T& x) { cerr << << x; return *this; } } d_t; int mix... |
// megafunction wizard: %FIFO%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: sfifo_112x256_la.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ======================... |
#include <bits/stdc++.h> using namespace std; int main() { int n, s = 1, i; cin >> n; int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; if (a[i] == s) { s++; } } cout << s - 1 << endl; s = 1; for (i = 0; i < n; i++) { if (a[i] == s) { cout << i ... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
*
* 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, version 3 of the License.
*
* This program is distri... |
#include <bits/stdc++.h> using namespace std; int main() { vector<int> v; int n, m; cin >> n >> m; int maks = 0; for (int i = 0; i < n; i++) v.push_back(i + 1); do { int res = 0; for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { int x = 100; ... |
#include <bits/stdc++.h> using namespace std; int is_prime[5000010 + 10], primes[5000010 + 10], firstp[5000010 + 10], prime_cnt; void get_primes() { memset(is_prime, -1, sizeof(is_prime)); for (int i = 2; i <= 5000010; i++) { if (is_prime[i]) { primes[prime_cnt++] = i; firstp[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... |
#include <iostream> #include <cstdio> #include <cstring> using namespace std; char s[5010]; int n; bool ok(int x,int y,int fx,int fy){ if(x==fx && y==fy)return 0; return 1; } bool check(int fx,int fy){ int x=0,y=0; for(int i=1;i<=n;i++){ if(s[i]== D ){ if(ok(x,y-1,fx,fy))y--; ... |
/**
* 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; string A[18][18], s; int n, m, U[101], us, J[3][3]; bool B[1001]; int r1, c1, r2, c2, size; int tonum(char ch) { if (ch == C ) return 1; if (ch == D ) return 2; if (ch == H ) return 3; if (ch == S ) return 4; if (ch == T ) return 8; ... |
#include <bits/stdc++.h> using namespace std; int main() { int a[3], ans; cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); ans = (a[1] - a[0]) + (a[2] - a[1]); cout << ans << endl; return 0; } |
#include <bits/stdc++.h> int main() { int ss, x, y, flag = 0, kk, flag2 = 1; scanf( %d%d%d , &ss, &x, &y); if (x == 1 || x == ss) flag++; if (y == 1 || y == ss) flag++; if (x >= ss / 2 && x <= ss / 2 + 1 && y >= ss / 2 && y <= ss / 2 + 1) flag2 = 0; if (flag == 0) kk = 9; if (flag ==... |
/* SPDX-License-Identifier: MIT */
/* (c) Copyright 2018 David M. Koltak, all rights reserved. */
/*
* rcn bus bridge.
*
*/
module rcn_bridge
(
input rst,
input clk,
input [68:0] main_rcn_in,
output [68:0] main_rcn_out,
input [68:0] sub_rcn_in,
output [68:0] sub_rcn_out
);
parameter 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 law... |
module ADT7310P32S16L (
(* intersynth_port="Reset_n_i" *)
input Reset_n_i,
(* intersynth_port="Clk_i" *)
input Clk_i,
(* intersynth_port="ReconfModuleIn_s", intersynth_conntype="Bit" *)
input Enable_i,
(* intersynth_port="ReconfModuleIRQs_s", intersynth_conntype="Bit" *)
output CpuIntr_o,
(* inter... |
#include <bits/stdc++.h> using namespace std; int n, m; int res[100010], k = 0; struct edge { int id, v, w, next; } e[100010]; int head[100010], cnt = 0; void adde(int u, int v, int w, int id) { e[cnt].id = id; e[cnt].v = v; e[cnt].w = w; e[cnt].next = head[u]; head[u] = cnt++; }... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: jbi_min_rq_rdq_buf.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute 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... |
`timescale 1ns / 1ps
// nexys3MIPSSoC is a MIPS implementation originated from COAD projects
// Copyright (C) 2014 @Wenri, @dtopn, @Speed
//
// 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 Found... |
// (C) 2001-2015 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 doc... |
/**
* 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... |
//Legal Notice: (C)2017 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// The code as shown makes a really big file name with Verilator.
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Todd Strader.
`define LONG_NAME_MOD modlongnameiuqyrewewriqyewroiquyweriuqyewriuyewrioryqoiewyriuewyrqrqio... |
#include <bits/stdc++.h> using namespace std; int N; int main(void) { ios_base::sync_with_stdio(false); cin.tie(0); cin >> N; int x = 0; int res = 0; if (N == 1) { printf( 1 n ); printf( 1 n ); return 0; } for (int i = 1; i <= N; i++) { x += i; if (x >... |
#include <bits/stdc++.h> using namespace std; struct ii { int a, b; bool operator<(ii o) const { return make_tuple(a, b) < make_tuple(o.a, o.b); } }; struct iii { int a, b, c; bool operator<(iii o) const { return make_tuple(a, b, c) < make_tuple(o.a, o.b, o.c); } }; int TC, N, M, K... |
/**
* 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... |
/*****************************************************************************
* File : processing_system7_bfm_v2_0_ocm_mem.v
*
* Date : 2012-11
*
* Description : Mimics OCM model
*
*****************************************************************************/
module processing_system7_bfm_v2_0_ocm_mem();
`incl... |
#include <bits/stdc++.h> using namespace std; int main() { int n, t, cost = 0, r, min = 100000000; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (int i = 1; i <= a[n - 1]; i++) { t = i; for (int j = 0; j < n; j++) { if (a[j... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Octoate, Nilquader
// ACID Reverse engineering by nocash
//
// Create Date : 00:45:53 09/03/2010
// Design Name : amsacid
// Module Name : amsacid
// Project Name :
// Target Devic... |
/*
* 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; using ll = long long; using ld = long double; using P = pair<ll, ll>; constexpr ll inf = 1000000000; constexpr ll mod = 1000000007; constexpr long double eps = 1e-6; template <typename T1, typename T2> ostream& operator<<(ostream& os, pair<T1, T2> p) { ... |
`timescale 1ns / 1ps
`include "Defintions.v"
module MiniAlu
(
input wire Clock,
input wire Reset,
output wire [7:0] oLed
);
wire [15:0] wIP,wIP_temp;
reg rWriteEnable,rBranchTaken;
wire [27:0] wInstruction;
wire [3:0] wOperation;
reg [15:0] rResult;
wire [7:0] wSourceAddr0,wSou... |
#include <bits/stdc++.h> using namespace std; template <typename _T> inline void _DBG(const char *s, _T x) { cerr << s << = << x << n ; } template <typename _T, typename... args> void _DBG(const char *s, _T x, args... a) { while (*s != , ) cerr << *s++; cerr << = << x << , ; _DBG... |
#include <bits/stdc++.h> using namespace std; bool check(string new_l, string old_l) { int len_1; int col_izm; col_izm = 0; len_1 = new_l.length(); if (len_1 == old_l.length()) { for (int i = 0; i < len_1; i++) { if (new_l[i] == old_l[i]) { col_izm++; } else if ((... |
`timescale 1ns/10ps
module system_acl_iface_pll(
// interface 'refclk'
input wire refclk,
// interface 'reset'
input wire rst,
// interface 'outclk0'
output wire outclk_0,
// interface 'locked'
output wire locked
);
altera_pll #(
.fractional_vco_multiplier("false"),
.reference_clock_frequency("50.0 M... |
`include "../include/tune.v"
// Pentevo project (c) NedoPC 2011
//
// VGA scandoubler
module video_vga_double(
input wire clk,
input wire hsync_start,
input wire scanin_start,
input wire [ 5:0] pix_in,
input wire scanout_start,
output reg [ 5:0] pix_out
);
/*
addressing of ... |
//*****************************************************************************
// (c) Copyright 2008-2010 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
// ... |
#include <bits/stdc++.h> using namespace std; struct point { int x, y; point() {} point(int a, int b) { x = a, y = b; } }; template <class T> T sqr(T a) { return a * a; } template <class T> T power(T n, T p) { T res = 1; for (int i = 0; i < p; i++) res *= n; return res; } ... |
// testbench for chan_ctrl.v
`timescale 10ns/1ns
`define HALF_CLK (5.0)
class channel_data;
bit [13:0] base;
bit [19:0] size;
bit [19:0] loop; // actually loop-size
bit [ 5:0] add_int;
bit [11:0] add_frac;
bit [19:0] offset_int;
bit [11:0] offset_frac;
bit surround;
bit loopena;
bit [ ... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, 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 Found... |
#include <bits/stdc++.h> using namespace std; long long sqr(long long a) { return a * a; } int main() { ios_base::sync_with_stdio(0); int n, m; cin >> n >> m; vector<long long> sumx(n, 0ll); vector<long long> sumy(m, 0ll); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { ... |
//Legal Notice: (C)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
//simulation files), and any associated do... |
#include <bits/stdc++.h> using namespace std; string s; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> s; long long n = s.size(); long long a = 0, b = 0; for (auto f : s) { a += (f == 1 ); b += (f == 0 ); } long long z = n - a - b; if (a < b + z... |
#include <bits/stdc++.h> using namespace std; const long long INF = sizeof(long long) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f; const long long MOD = (long long)(1e9) + 7; const double PI = acos(-1); const double EPS = 1e-9; using pii = pair<long long, long long>; template <typename ... |
#include <bits/stdc++.h> using namespace std; int a[1005][1005], i, m, ans, k, l, j, q, x, n, ma, mi; string s; int main() { cin >> n >> k; if (k >= (n + 1) / 2) { cout << -1; return 0; } cout << n * k << endl; for (int i = 1; i <= n; i++) { int w = k; for (int j = 1;... |
#include <bits/stdc++.h> using namespace std; using LL = long long; const int MAXN = 200010; vector<int> x[MAXN], y[MAXN]; int v[MAXN], out[MAXN], sg[MAXN]; int xr[MAXN]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; for (int i = 0; i < n; ++i) cin >> v... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { int n, x; cin >> n >> x; int arr[n]; int o, e; o = e = 0; int i = 0; for (int j = 0; j < 10; j+... |
/**
* 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> long long tt, x, y, z, sum, n, i, j, h, k, t, d, m, l, ll, rr, r, a[1000006], b[1000006], f[1000006]; using namespace std; long long xl(long long i) { long long res = 0; for (j = 1; j <= d; j++) b[j] = a[j]; l = 1; r = i; tt = 1; z = b[1]; x = 1; whil... |
#include <bits/stdc++.h> using namespace std; void print(vector<int> s) { for (int i = 0; i < s.size(); i++) cout << s[i] << ; cout << endl; } const int INF = 1e9 + 7; char next(char v) { if (v == R ) return L ; if (v == L ) return R ; if (v == U ) return D ; if (v == D ) ret... |
/**
* 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() { int n, k; cin >> n >> k; map<int, int> mp; long long ans = 0, mx = 1e6; for (int i = 0; i < n; i++) { int first; scanf( %d , &first); int second = 1; long long yy = 1; for (int j = 2; j * j <= first; j++) ... |
#include <bits/stdc++.h> using namespace std; vector<int> adj[1005]; int w[1005]; int main() { int n, k; cin >> n >> k; if (n - k - 1 < k) return cout << -1, 0; cout << n * k << endl; for (int i = 1; i <= n; i++) { int t = w[i]; for (int j = i + 1; j <= n; j++) { if (w[i]... |
#include <bits/stdc++.h> using namespace std; void Read(int &n) { int sign = 1; n = 0; char c; do { c = getchar(); } while (!isdigit(c) && c != - ); if (c == - ) { c = getchar(); sign = -1; } do { n = n * 10 + c - 48; c = getchar(); } while (isdigi... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_ab
//
// Generated
// by: wig
// on: Tue Jun 27 05:12:12 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author: w... |
/******************************************************************************
* File Name : ec_alu.v
* Package Module Name : Elliptic Curve Cryptoprocessor for GF(2^233)
* Author : Chester Rebeiro
* Date of Creation : 3/Apr/2008
* Type of file : Verilog source code
* Synopsis : This file contai... |
#include <bits/stdc++.h> using namespace std; int arr[150]; int main() { int n, k, i, j, ans = 0, curr, temp; scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %d , &curr); arr[curr]++; } for (i = 1; i <= 100; i++) { ans += (arr[i] / 2); } ans /= 2; printf( %d n ,... |
#include <bits/stdc++.h> using namespace std; int main() { int z, n, m; while (cin >> n >> m) { if (m > n) z = -1; else { if (n % 2 == 0) z = n / 2; else z = (n / 2) + 1; while (z % m != 0) { z++; } } cout << z; ... |
//
// 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; template <class t> t mag(t a) { return a > 0 ? a : -a; } template <class T, class U> T cdiv(T num, U den) { return (num / den) + ((num % den) > 0); } std::ifstream term( /dev/tty ); std::string tempstring; using ll = int_fast64_t; using ii = pa... |
/*
* 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 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:16 2017
// Host : DarkCube running 64-bit major release ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000; set<pair<long long, long long> > q; long long prod(pair<long long, long long> a, pair<long long, long long> b) { return a.first * b.second - a.second * b.first; } bool check(pair<long long, long long> a, pair<long long, long long> b,... |
//////////////////////////////////////////////////////////////////////
//// ////
//// usbHostCyc2Wrap_usb1t11.v ////
//// ////
//// This file is part of th... |
#include <bits/stdc++.h> using namespace std; vector<int> edge[100005]; int v[100005]; bool cycle = false; int mx = -1, last; void dfs(int u, int dis = 0) { v[u] = 1; if (dis > mx) { mx = dis; last = u; } for (int i = 0; i <= (int)((int)edge[u].size() - 1); i++) { int first... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.