text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int N = 110000; const int B = 60; int n, q, mc; int aint[4 * N][B]; void update(int nod, int pozx, int pozy, int poz, int val) { int i; if (pozx == pozy) { for (i = 0; i < B; ++i) { aint[nod][i] = 1; if (i % val == 0) aint[nod... |
#include <bits/stdc++.h> using namespace std; int q, n, x; void f() { cin >> n; vector<int> v; for (int i = 0; i < n; i++) { cin >> x; v.push_back(x); } sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); int maxi = v.back(); for (int i = v.size() - ... |
#include <bits/stdc++.h> int A[1000000], i, j, k, l, m, n, a, b, c, d, e, f, g, B[500000]; int main() { scanf( %d%d%d%d , &a, &b, &m, &A[0]); for (i = 1; i <= 100005; i++) { A[i] = (a * A[i - 1] + b) % m; if (B[A[i]]) { printf( %d , i - B[A[i]]); return 0; } B[A[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 (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module cdc_syncfifo #(
parameter DSIZE = 32,
... |
/*
* 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... |
/*
* Milkymist 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 distribut... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vector<int>>; using vl = vector<ll>; using vvl = vector<vector<ll>>; using pi = pair<int, int>; using pl = pair<ll, ll>; template <typename U> void print(U arr) { for (auto element : ar... |
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); cout << setprecision(12); int l; cin >> l; string s; cin >> s; size_t t = 0; for (auto c : s) t += (c == 1 ); if (t * 2 == s.length()) { cout << 2 << endl; cout <<... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<vector<int>> v(n); int mat[4][4] = { {8, 9, 1, 13}, {3, 12, 7, 5}, {0, 2, 4, 11}, {6, 10, 15, 14}}; int ans[n][n]; for (int i = 0; i < n * n; i++) { int x = i / n; v[x].push_back(i); } ... |
// A shifting buffer to buffer the input image. The buffer should be 28x28
// registers to hold the entire image and the buffer should be the size of
// the kernel (9x9) to input part of the image into the mult-adder tree.
// buffer wire[0][0] is in the bottom right corner of image so that the video
// stream can ... |
#include <bits/stdc++.h> using namespace std; const long long FASTIO = []() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); return 0; }(); long long n; vector<vector<long long>> ans; long long ask(long long x1, long long y1, long long x2, long long y2) { cout << ? << x1 << << ... |
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved.
////////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor: Xilinx
// \ \ \/ Version: P.20... |
#include <bits/stdc++.h> using namespace std; int main() { set<string> qq; string s, q, g[100000]; int h, j = -1; while (cin >> s) { h = 3; q = ; q = q + s[0] + s[1] + s[2]; while (h != s.length()) { while (s[h] != && s[h] != . ) { q += s[h]; ... |
/**
* 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; signed main() { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; auto solve = []() { int n; cin >> n; vector<pair<int, int>> a(n); for (int i = 0; i < n; i++) { cin >> a[i].first; a[i].first--; }... |
#include <bits/stdc++.h> using namespace std; int cekTanda(char ch) { switch (ch) { case > : return 8; case < : return 9; case + : return 10; case - : return 11; case . : return 12; case , : return 13; case [ : ... |
/**
* 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) 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)
// ... |
// 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
//
// This is a copy of t_param.v with the parentheses around the module parameters
// removed.
module t (... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, d; cin >> n; unordered_set<int> s; int mx = n; int c = 0; for (int i = 0; i < n; i++) { cin >> d; if (d == mx) { for (int i = 0; i < c; i++) cout << n ; ... |
module FSM_Ctrol (
input RST, // Reset maestro
input CLK, // Reloj maestro
input STM, // Iniciar multiplicacion
output reg ENpH, // Habilitaciones Rp Alto
output reg ENpL, // Habilitaciones Rp Bajo
output reg ENa, // Habilitaciones Ra
output reg ENr, // Habilitaciones Rr
output reg SEL, // S... |
/* SPDX-License-Identifier: MIT */
/* (c) Copyright 2018 David M. Koltak, all rights reserved. */
//
// Bus address filter - squash any cycle within ranges
//
module rcn_filter
(
input clk,
input rst,
input [68:0] rcn_in,
output [68:0] rcn_out,
output reg filtered
);
parameter START_0 = ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, m, x, y; cin >> n >> m >> x >> y; char a[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> a[i][j]; } } int county = 0, c... |
#include <bits/stdc++.h> using namespace std; void matches(vector<int> arr) { int i; for (i = 0; i < arr.size(); i++) { if (arr[i] == 2) cout << 2 << endl; else if (arr[i] % 2 == 0 && arr[i] != 2) cout << 0 << endl; else cout << 1 << endl; } } int main() { ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int k, t; int a[11]; long long b[16], c[11], ele[11], hash_val; map<pair<int, long long>, long long> vis; void add(int i) { c[b[i]]--; hash_val -= ele[b[i]]; b[i]++; c[b[i]]++; hash_val += ele[b[i]]; } void remove... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 2000005; int n, m; int in[MAX_N]; int inv[MAX_N]; int out[MAX_N], temp[MAX_N]; int pos2bckt[MAX_N]; int bckt[MAX_N], relabel[MAX_N]; int bpos[MAX_N]; void build() { for (int i = 0; i < n; i++) out[i] = i; sort(out, out + n, [](i... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; char c; int sum = 0; if (n % 2 == 0) { int f = 1; for (int i = 1; i <= n; i++) { cin >> c; if (c == ( ) sum++; else sum--; if (sum < -1) break; } ... |
/*
* 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 x, y, n, tx, ty, m; scanf( %d %d , &n, &m); double res = 0; for (int i = 0; i < n; i++) { scanf( %d %d , &x, &y); if (i == 0) { tx = x, ty = y; continue; } res = res + sqrt(((x - tx) * (x - tx)) + ... |
#include <bits/stdc++.h> using namespace std; int N, M; typedef struct node { double x; double y; node operator-(node b) { node ret; ret.x = x - b.x; ret.y = y - b.y; return ret; } node operator+(node b) { node ret; ret.x = x + b.x; ret.y = y + b.y; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x(0); cin >> n; string s; while (n--) { cin >> s; if (s[1] == + ) { ++x; } else { --x; } } cout << x << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k, i, j, total, cnt; cin >> n >> k; double r, g, b; r = ceil((n * 2.0) / k); g = ceil((n * 5.0) / k); b = ceil((n * 8.0) / k); cout << int(r + g + b) << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; scanf( %d%d%d%d , &a, &b, &c, &d); double r = (1 - 1.0 * a / b) * (1 - 1.0 * c / d); r = 1.0 / (1 - r); printf( %.10f n , r * a / b); return 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; char s[500005], t[500005]; long long ans; int n, k, now, tmp; int main() { scanf( %d %d n , &n, &k); fread(s + 1, 1, n, stdin); getchar(); fread(t + 1, 1, n, stdin); s[n + 1] = # ; if (k == 1) return printf( %d n , n), 0; for (now = 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; long long dpf[110][100][60]; long long dpg[110][100][60]; int diff; int likes_init = 0; const long long mod = 998244353; long long fast_exp(long long b, int e) { b = b % mod; if (e == 0) return 1; if (e == 1) return b; if (e % 2 == 1) return (b... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0; char ch = getchar(); bool positive = 1; for (; !isdigit(ch); ch = getchar()) if (ch == - ) positive = 0; for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 0 ; return positive ? x : -x; } inline void ... |
/*
* Copyright (c) 2001 Stephan Boettcher <>
*
* 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 Header Begin ==========================================
//
// OpenSPARC T1 Processor File: cluster_header.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 it an... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:19:56 05/01/2013
// Design Name:
// Module Name: top
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencie... |
/*
Copyright (c) 2020 Alex Forencich
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, publish, distribute,... |
#include <bits/stdc++.h> using namespace std; int main() { int n, c, a, b; scanf( %d %d %d %d , &n, &c, &a, &b); a--; b--; int ca = a % c, cb = b % c; if (ca == 0) { if ((cb == (c - 1)) or b == (n - 1)) printf( 1 n ); else if (b / c == a / c) printf( 1 n ); ... |
#include <bits/stdc++.h> using namespace std; const long long N = 2e3 + 10, INF = 1e9 + 10; long long dp[N][2], a[N], n, k; inline bool check(long long x) { for (long long i = 1; i <= n; i++) dp[i][0] = i - 1; for (long long i = 1; i <= n; i++) for (long long j = i - 1; j; --j) { if (a[i] ... |
module Online_test1(
// Input signals
clk,
rst_n,
in_valid,
in,
mode,
// Output signals
out_valid,
out
);
//---------------------------------------------------------------------
// INPUT AND OUTPUT DECLARATION
//--------------------------------------------------... |
#include <bits/stdc++.h> void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } int max(int a, int b) { return (a > b) ? a : b; } int main() { int t, n, k, a[1005], b[1005]; scanf( %d , &t); while (t--) { int total = 0; scanf( %d %d , &n, &k); for (int i = 0; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y, ans = 0; scanf( %d , &n); while (n--) scanf( %d%d , &x, &y), ans = max(ans, x + y); printf( %d , ans); } |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); const double eps = 1e-6; const int INF = 1e12; const int maxnnn = 2e8 + 30; const long long zero = 0; long long gcd(long long a, long long b) { if (a < b) swap(a, b); if (a % b == 0) return b; else gcd(b, 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> const int maxn = 150010; const int INF = 0x3f3f3f3f; using namespace std; vector<int> V; int a[maxn]; long long ans = 0; int ok(int i) { if (i & 1) return a[i] < a[i - 1] && a[i] < a[i + 1]; return a[i] > a[i + 1] && a[i] > a[i - 1]; } int ok2(int i, int j) { int f... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2016.2
// Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1ns/1ps
... |
#include <bits/stdc++.h> using namespace std; vector<int> prime_Numbers; bool primes[1000005]; void prime(int n) { for (int i = 2; i <= n; i++) primes[i] = true; for (int i = 2; i <= n; i++) { if (primes[i] == true) { prime_Numbers.push_back(i); for (int j = i + i; j <= n; j += i) ... |
/*
Copyright (c) 2014-2018 Alex Forencich
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, publish, distri... |
module top_receptor (ready, clk, reset, CharSalida, rxd, String);
input clk;
input reset;
input rxd;
output [0:6] CharSalida;
output ready;
output [0:76] String;
// wire [0:76] String;
wire [0:6] char;
wire clk_2;
wire WriteChar;
wire error;
wire [2:0] char_count;
wire... |
/*
* 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; vector<pair<int, int> > E[1010]; int deg[1010], vis[1010]; vector<pair<int, pair<int, int> > > ans; int N, P; int main() { int u, v, d; while (~scanf( %d%d , &N, &P)) { for (int i = 0; i < N; i++) deg[i] = 0, E[i].clear(); for (int i = 0; i <... |
`timescale 1ns/1ps
module I2CFSM (
input Reset_n_i,
input Clk_i,
// FSM control
input Start_i,
output reg Done_o,
output reg Error_o,
output reg [7:0] Byte0_o,
output reg [7:0] Byte1_o,
// to/from I2C_Master
// 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... |
// 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
// modul... |
//lpm_divide CBX_SINGLE_OUTPUT_FILE="ON" LPM_DREPRESENTATION="UNSIGNED" LPM_HINT="LPM_REMAINDERPOSITIVE=TRUE" LPM_NREPRESENTATION="UNSIGNED" LPM_TYPE="LPM_DIVIDE" LPM_WIDTHD=8 LPM_WIDTHN=8 denom numer quotient remain
//VERSION_BEGIN 16.0 cbx_mgl 2016:07:21:01:49:21:SJ cbx_stratixii 2016:07:21:01:48:16:SJ cbx_util_mgl 2... |
//======================================================================
//
// gcm_ghash.v
// -----------
// GHASH module for the GCM core.
//
//
// Author: Joachim Strombergson
// Copyright (c) 2018, Secworks Sweden AB
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or
// without ... |
#include <bits/stdc++.h> using namespace std; vector<int> v[1000005]; int n, ar[100005]; int main() { cin >> n; set<int> st; for (int i = 0; i < n; i++) { cin >> ar[i]; st.insert(ar[i]); v[ar[i]].push_back(i + 1); } vector<int> fr(st.begin(), st.end()); int mx = 0, l = ... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016
// Date : Tue Sep 19 11:36:02 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
#include <bits/stdc++.h> using namespace std; int dp[25][25][5], ans, n, t; int main() { cin >> n >> t; for (int i = 1; i <= 4; i++) for (int j = i + 1; j <= 4; j++) dp[2][1][j]++; for (int i = 3; i <= n; i++) for (int j = 1; j <= t * 2; j++) for (int k = 1; k <= 4; 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... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_eb_e
//
// Generated
// by: wig
// on: Tue Mar 30 18:39:52 2004
// cmd: H:\work\mix_new\MIX\mix_0.pl -strip -nodelta ../../autoopen.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!... |
/**
* 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 maxn = 100010, inf = 1e9; int n, ty, l, r, x; bitset<maxn> v[26], ans; char s[maxn], s2[maxn], c; inline void read(int &k) { int f = 1; k = 0; char c = getchar(); while (c < 0 || c > 9 ) c == - && (f = -1), c = getchar(); while... |
//-----------------------------------------------------------------------------
// Copyright 2017 Damien Pretet ThotIP
//
// 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... |
#include <bits/stdc++.h> using namespace std; mt19937 rnd; const long long maxn = 2e6 + 5; const long long mod = 1e9 + 7; long long fac[maxn]; long long inv[maxn]; vector<char> prime(maxn, true); long long spf[maxn]; long long binpow(long long a, long long b) { if (b == 0) return 1; if (b == 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... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: nuny_new2.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==============================... |
#include <bits/stdc++.h> using namespace std; const int pw = 1 << 17; const int maxn = 1e5 + 20; int ans[maxn]; void work() { int n, x; cin >> n >> x; if (n == 1) { printf( YES n ); cout << x << endl; return; } else if (n == 2 && x == 0) { printf( NO n ); return; ... |
#include <bits/stdc++.h> std::mt19937 rng( (int)std::chrono::steady_clock::now().time_since_epoch().count()); const int ms = 101; long long memo[ms][ms], memo2[ms][ms][ms]; long long a[ms]; std::string str; long long dp(int l, int r); long long dp2(int l, int r, int x) { if (r - l <= 0) return 0... |
#include <bits/stdc++.h> using namespace std; int l[6]; int main() { int n, m, a; cin >> m >> n; for (int i = 0; i < m; i++) { for (int i = 1; i <= n; i++) { cin >> a; l[i] = max(l[i - 1], l[i]) + a; } cout << l[n] << ; } return 0; } |
#include <bits/stdc++.h> using namespace std; template <typename T1> void print_list(const T1& a) { cerr << a << endl; } template <typename T1, typename T2> void print_list(const T1& a, const T2& b) { cerr << a << << b << endl; } template <typename T1, typename T2, typename T3> void print_... |
/*
Copyright (c) 2014 Alex Forencich
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, publish, distribute,... |
#include <bits/stdc++.h> const bool DEBUG = false; using namespace std; const long long maxn = 2e5 + 5; const long long INF = 1e18 + 1; const long long M = 1e9 + 7; const int lg = 21; int n, m, x[maxn], b[maxn], a[maxn], y[maxn]; vector<pair<int, int> > v; set<int> s; int main() { ios::sync_with... |
/**
* 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; double p[110], S; int main() { scanf( %d , &n); for (int i = 0; i <= n; i++) scanf( %lf , p + i); for (int i = 0; i < n; i++) for (int j = i + 1; j <= n; j++) if (i * 2 <= n && n <= j * 2) S = max( S, (n * 0.5... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int b, g; cin >> b; int i; int B[n]; for (i = 0; i < n; i++) { B[i] = 0; } int bb[b]; for (i = 0; i < b; i++) { cin >> bb[i]; B[bb[i]] = 1; } cin >> g; int G[m]; ... |
/*
* 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[10000]; int n, m, mn, mn1; multiset<int> s; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a[i]; s.insert(a[i]); } int q = *s.rbegin() + m; while (m--) { int t = *s.begin(); s.erase(s.begin()); ... |
/*
Copyright (c) 2015-2016 Alex Forencich
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, publish, distri... |
#include <bits/stdc++.h> template <typename T> inline void read(T &x) { x = 0; char c = getchar(); bool flag = false; while (!isdigit(c)) { if (c == - ) flag = true; c = getchar(); } while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar(); if (flag) x = -x; } using names... |
// MBT 7/7/2016
//
// 1 read-port, 1 write-port ram
//
// reads are synchronous
//
// although we could merge this with normal bsg_mem_1r1w
// and select with a parameter, we do not do this because
// it's typically a very big change to the instantiating code
// to move to/from sync/async, and we want to reflect this.
... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2005; const int MOD = 1e9 + 7; long long int dp[MAXN][MAXN]; void c() { for (int i = 0; i < MAXN; i++) { for (int j = 0; j < MAXN; j++) { if (i == j) dp[i][j] = 1; else if (j == 0) dp[i][j] = 1; ... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 500; char s[MAX_N + 2][MAX_N + 2]; int D[2][MAX_N + 1][MAX_N + 1]; int main() { int N, M; scanf( %d%d n , &N, &M); for (int i = 0; i <= M; ++i) s[0][i] = # ; for (int i = 1; i <= N; ++i) { s[i][0] = # ; gets(s[i] + 1... |
// Copyright 1986-2015 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2015.3 (win64) Build Mon Sep 28 20:06:43 MDT 2015
// Date : Wed Mar 30 14:50:02 2016
// Host : DESKTOP-5FTSDRT running 64-bit major releas... |
#include <bits/stdc++.h> using namespace std; long double ans; long long one, two; map<pair<long long, long long>, pair<long long, long long> > o, t; map<pair<long long, long long>, pair<long long, long long> >::iterator ii; void add(long long a, long long b, long long c, long long ind) { pair<long long... |
/*------------------------------------------------------------------------------
* 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... |
/*
Copyright (c) 2015 Alex Forencich
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, publish, distribute,... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2005 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc = 0;
reg [63... |
`timescale 1ns / 1ps
module nkmd_dai_tx_t;
// ins
reg clk;
parameter TCLK = 20;
initial clk = 0;
always #(TCLK/2) clk = ~clk;
reg rst;
reg pop;
reg [31:0] nkmd_data_i;
wire [31:0] nkmd_data_o;
reg [31:0] nkmd_addr;
reg nkmd_we;
nkmd_dai_tx uut(
.clk(clk),
.rst(rst),
.tx_pop_i(pop),
.data_i(nkmd_d... |
#include <bits/stdc++.h> using namespace std; long long n, ns, a[1111]; void ok(long long x) { long long l = 0, r = min(2000000000ll, (1ll << 62) / (x + 1) + 1); while (l < r) { long long m = (l + r) / 2; if (m * (m - 1) / 2 + m * x >= n) r = m; else l = m + 1; if (... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: ccx_iob_rptr.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 it and/... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (int i = 0; i < n - 2; i++) { if (a[i] == a[i + 1] && a[i] == a[i + 2]) { cout << NO ; return 0; } ... |
#include <bits/stdc++.h> using namespace std; template <class _T> inline _T sqr(const _T& x) { return x * x; } template <class _T> inline string tostr(const _T& a) { ostringstream os( ); os << a; return os.str(); } const long double PI = 3.1415926535897932384626433832795; const long d... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if (y1 == y2) cout << abs(x2 - x1) << n ; else if (x1 == x2) cout << abs(y2 - y1) << n ; else { int x, y; ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.