text stringlengths 59 71.4k |
|---|
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.1 (win64) Build Fri Apr 8 15:45:27 MDT 2016
// Date : Fri May 27 10:44:27 2016
// Host : Wojciech-PC running 64-bit Service Pack... |
#include <bits/stdc++.h> using namespace std; const int N = 4e6 + 7, M = 2e6; const long long mod = 1e9 + 7; inline int read() { int ret = 0; char ch = getchar(); bool f = 1; for (; !isdigit(ch); ch = getchar()) f ^= !(ch ^ - ); for (; isdigit(ch); ch = getchar()) ret = (ret << 1) + (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 a[1005], b[1005]; char c[1005][1005]; int main() { int n, m; cin >> n >> m; int cnt = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> c[i][j]; if (c[i][j] == * ) { a[i]++; b[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> #pragma warning(disable : 4996 4018) using namespace std; int n, k, p, pep[1000], key[2000]; int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin >> n >> k >> p; for (int i = 0; i < n; i++) cin >> pep[i]; for (int i = 0; i < k; i++) cin >> key[i]; int ans =... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 31; int dp[MAXN][MAXN][MAXN * MAXN]; int F(int n, int m, int k) { if (n > m) swap(n, m); if (k < 0) return (1 << 30); if (dp[n][m][k] != -1) return dp[n][m][k]; if (n * m == k || k == 0) return dp[n][m][k] = 0; int p = 1 << 30, q... |
(* -*- coding: utf-8 -*- *)
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
(* <O___,, * (see CREDITS file for the list of authors) ... |
#include <bits/stdc++.h> using namespace std; int cnt[3], ans; vector<int> c; vector<vector<int>> sum; vector<vector<int>> arr; void dfs(int x, int p) { for (auto i : arr[x]) { if (i != p) { dfs(i, x); sum[x][0] += sum[i][0]; sum[x][1] += sum[i][1]; sum[x][2] += sum... |
`timescale 1ns/100ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time base for each unit, ranging from seconds
* to femtoseconds, and must be... |
#include <bits/stdc++.h> using namespace std; void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << endl; err(++it, args...); } template <class T, class R> ostream& operator<<(ostream... |
/**
* 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 artemis_ddr3 (
input clk_333mhz,
input board_rst,
output calibration_done,
output usr_clk,
output rst,
//Memory Interface
inout [7:0] ddr3_dram_dq,
output [13:0] ddr3_dram_a,
output [2:0] ddr3_dram_ba,
output ddr3_dram_ras_n,... |
#include <bits/stdc++.h> using namespace std; int toBinary(int num) { vector<int> vec; while (num > 0) { vec.push_back(num % 2); num = num / 2; } while (vec.size() < 8) { vec.push_back(0); } int temp = 0; for (int i = 0; i < vec.size(); i++) { temp += vec[7 - i] *... |
`timescale 1ns / 1ps
// Modified by: Adam Michael, CM1884
// Mohammad Almisbaa, CM2060
// Date: November 5, 2015
// Summary: This controller generates VGA timing signals.
//File Name: CRTcontroller2015fall.v
//Author: Jianjian Song
//Date: October 30, 2015
//Test: On Nexys 3 board successfully
//Purpose: gen... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:03:17 03/01/2016
// Design Name: Pc
// Module Name: C:/Users/Ranolazine/Desktop/Lab/lab5/test_pc_.v
// Project Name: lab5
// Target Device:
// Tool v... |
#include <bits/stdc++.h> using namespace std; const int radix_len = 1e7 + 5; long long cnt[radix_len]; int main() { int n, k, a; ios_base::sync_with_stdio(false); cin >> n >> k; long long tot = 0; for (int i = (0), i_end_ = (n); i < i_end_; ++i) { cin >> a; cnt[a]++; tot +=... |
#include <bits/stdc++.h> using namespace std; const int maxN = 5000 + 5; const int lim = 1000 * 1000 * 1000; const int inf = 1000 * 1000 * 1000 + 5; int a[maxN]; vector<int> v[maxN]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; for (int i = 0; i < n; i++) cin >> a... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009 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 distributed ... |
#include <bits/stdc++.h> using namespace std; struct node { long long v; bool c; } arr[12000]; bool comparator(node a, node b) { return a.v < b.v; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long i, j, p, v, l, n = 0, a, ans = 0; cin >> a; ... |
// 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 : Mon Sep 25 13:52:36 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
/*
eTeak synthesiser for the Balsa language
Copyright (C) 2012-2016 The University of Manchester
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 opt... |
`timescale 1ns / 1ps
/*
Group Members: Thomas Hudson and Warren Seto
Lab Name: Combinational Logic
Project Name: eng312_proj2
Design Name: four_bit_adder.v
Design Description: Verilog Module for Four Bit Ripple Adder using full_adder implementation
*/
module four_bit_adder
(
input ... |
#include <bits/stdc++.h> using namespace std; long long value(const vector<long long>& a, long long b) { long long result = 0; for (int i = 0; i < a.size(); ++i) { result += min(b, a[i]); } return result; } int main() { long long n, k; cin >> n >> k; vector<long long> a(n); ... |
#include <bits/stdc++.h> using namespace std; const long long p = 1e9 + 7; long long dp[40][40][2], n, ans; int lim[45], len; int calc(int x, int sgn) { if (x == 0) return sgn ^ 1; return 1 << x >> 1; } int main() { cin >> n; if (n == 0) return puts( 1 ), 0; while (n) { lim[++len... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x[1000], y[1000], z[1000], t = 0, s = 0, d = 0; cin >> n; for (int i = 1; i <= n; i++) { cin >> x[i] >> y[i] >> z[i]; t += x[i]; s += y[i]; d += z[i]; } if (t == 0 && s == 0 && d == 0) cout << YES ; ... |
#include <bits/stdc++.h> using namespace std; int A[100005], B[100005]; long long pwr[15]; int main() { int n, k, i; long long res = 1, MOD = 1000000007, c; cin >> n >> k; for (i = 0; i < n / k; i++) cin >> A[i]; for (i = 0; i < n / k; i++) cin >> B[i]; for (i = pwr[0] = 1; i <= 10; i++)... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } void solve() { vector<long long> v(14); long long curr_score = 0; long long o = 0; for (int i = 0; i < 14; i++) { cin >> v[i]; } for (int i = 0; i < 14; i+... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string name, a; vector<pair<int, string> > s; vector<pair<int, string> > v(n); for (int i = 0; i < (int)n; i++) cin >> v[i].second >> v[i].first; sort(v.begin(), v.end()); int h = 1e9; for (int i = 0; i <... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int maxn = 10105; int n, b, q, st, ed; int First[maxn], cnt, dis[maxn]; struct edge { int to, Next, flow, c; } Tree[maxn * 100]; void init() { cnt = 0; memset(First, -1, sizeof(First)); } void addedge(int fro... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Version : 10.... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, i; scanf( %d%d , &n, &k); int sum = 0; int gave = 0; for (i = 0; (i < n) && gave < k; i++) { int curr; scanf( %d , &curr); sum += curr; int thisDay = min(sum, 8); sum -= thisDay; gave += this... |
///////////////////////////////////////////////////////////////////////////////
/// Andrew Mattheisen
/// Zhiyang Ong
///
/// EE-577b 2007 fall
/// VITERBI DECODER
/// bmu module
///
///////////////////////////////////////////////////////////////////////////////
module bmu (cx0, cx1, bm0, bm1, bm2, bm3, bm4, bm5, b... |
#include <bits/stdc++.h> using namespace std; const int maxm = 1e6 + 5; int a[maxm]; int n; struct BIT { int c[maxm]; int lowbit(int i) { return i & -i; } void add(int i, int t) { while (i < maxm) { c[i] += t, i += lowbit(i); } } int ask(int i) { int ans = 0; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01/24/2016 03:27:46 PM
// Design Name:
// Module Name: Problem3
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// 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 law... |
#include <bits/stdc++.h> using namespace std; long long int newarr[1005]; long long int dp[1005][1005]; long long int n, k; long long int solution(long long int index, long long int m) { if (m < 0) m += k; if (index >= n && m != 0) return 0; else if (m == 0) return 1; else if (dp[i... |
// Copyright 2007 Altera Corporation. All rights reserved.
// Altera products are protected under numerous U.S. and foreign patents,
// maskwork rights, copyrights and other intellectual property laws.
//
// This reference design file, and your use thereof, is subject to and governed
// by the terms and conditions... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
/*
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> using namespace std; const int maxn = 100101; int pre[maxn], ind[maxn], cnt[maxn], f[maxn]; vector<int> g[maxn], q; int main() { int n; cin >> n; for (int i = 2; i <= n; ++i) { int l, r; scanf( %d%d , &l, &r); g[l].push_back(r); g[r].push_back(l); ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int n1, n2, n3 = 0; bool flagm = true, flagr = true; while (n--) { cin >> n1 >> n2; if (n3 < n2 && n3 != 0) flagm = false; if (n1 != n2) flagr = false; n3 = n2; } if (!flagr) cout <<... |
module mgt_null_controller (
input grefclk,
input [0:1] rxn_mgt01,
input [0:1] rxp_mgt01,
output [0:1] txn_mgt01,
output [0:1] txp_mgt01,
input [0:1] rxn_mgt02,
input [0:1] rxp_mgt02,
output [0:1] txn_mgt02,
output [0:1] txp_mgt02,
input [0:1] rxn_mgt03,
input [0:1] rxp_mgt03,
output [0:1] txn_mgt03,
outpu... |
#include <bits/stdc++.h> using namespace std; int main() { int samples, len, temp, sz; cin >> samples >> len; deque<int> q; set<int> s; sz = s.size(); for (; samples--;) { cin >> temp; s.insert(temp); if (s.size() > sz) { q.push_front(temp); if (q.size() > l... |
/*
* Copyright (C) 2017 Systems Group, ETHZ
* 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 t... |
#include <bits/stdc++.h> using namespace std; bool debug = false; int n, m, k; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; long long a[305]; int pt[20]; int main() { scanf( %d , &n); for (int(i) = 0; (i) < (int)(n); (i)++) scanf( %lld , a + i + 1); long long ans = 0; int t; pt[0]... |
/*
* Copyright (c) 2015-2016 The Ultiparc Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2011 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
reg [63:0] crc;
reg [63:0] sum;
// Take CRC data and apply to test... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: jbi_pktout_asm.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... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3fffffff; const int SINF = 0x7fffffff; const long long LINF = 0x3fffffffffffffff; const long long SLINF = 0x7fffffffffffffff; const int MAXN = 65; const int MAXB = 10; const int MAXS = (1 << 10) + 7; int q; int b; long long l, r; in... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native ) #pragma GCC optimize( unroll-loops ) using namespace std; template <typename T1, typename T2> inline void chkmin(T1 &first, T2 second) { if (first > second) first = second; ... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353, inv2 = (mod + 1) / 2; const int N = (1 << 24); int n, m, X, Y, Z, mu, v1, v2, v3, v4, inv; vector<int> a, b, c, ans; inline int add(const int &x, const int &y) { return x + y < mod ? x + y : x + y - mod; } inline int sub(const ... |
#include <bits/stdc++.h> using namespace std; const int N = 131072 | 5, mod = 998244353; int add(int x, int y) { return (x += y) >= mod ? x - mod : x; } void ADD(int &x, int y) { (x += y) >= mod ? x -= mod : 0; } int qpow(int a, int b) { int ans = 1; for (; b >= 1; b >>= 1, a = (long long)a * a % mod)... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:29:00 05/19/2015
// Design Name: mean_filter3x3
// Module Name: /home/vka/Programming/VHDL/workspace/sysrek/skin_color_segm/tb_mean_filter3x3.v
// Project Name: v... |
#include <bits/stdc++.h> using namespace std; long long int M = 998244353, q, n, p[300001], d[300001], fans, products[300001], invproducts[300001]; long long int power(long long int x, long long int n) { if (n == 0) return (long long)1; else if (n % 2 == 0) return power((x * x)... |
#include <bits/stdc++.h> using namespace std; const double PI = 2 * acos(0.0); void solve(void) { string str; cin >> str; int one = 0, zero = 0; for (int i = 0; i < str.length(); i++) { if (str[i] == 1 ) { one++; while (i < str.length() && str[i] == 1 ) i++; i--; ... |
//
// 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; int IN() { int x = 0, f = 0, ch; for (; (ch = getchar()) < 0 || ch > 9 ;) f = (ch == - ); for (; ch >= 0 && ch <= 9 ; (ch = getchar())) x = x * 10 + ch - 0 ; return f ? -x : x; } const double Pi = acos(-1), eps = 1e-11; int N, M, T, C, ID[2... |
`timescale 1ns/1ps
module IDEXreg(clk,instructionin,datahazard,DatabusAin,DatabusBin,immin,PCplusin,
RegDstin,RegWrin,ALUSrc1in,ALUSrc2in,ALUFunin,Signin,MemWrin,MemRdin,MemtoRegin,
RegDstout,RegWrout,ALUSrc1out,ALUSrc2out,ALUFunout,Signout,MemWrout,MemRdout,MemtoRegout,
shamt,Rsout,Rtout,Rdout,DatabusAout,DatabusBout... |
#include <bits/stdc++.h> using namespace std; int a, b, n, m, l, t; bool check(int r) { if (a + 1ll * b * (r - 1) <= t && (1ll * a * (r - l + 1) + 1ll * b * (1ll * r * (r - 1) / 2 - 1ll * (l - 1) * (l - 2) / 2)) <= 1ll * m * t) return 1; else return 0; } int ma... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 13; int n, m; int a[maxn]; int main() { int T; scanf( %d , &T); while (T--) { long long n; long long x, y; scanf( %lld , &n); if (n == 1) { printf( 1 1 n ); continue; } long lon... |
#include <cassert> #include <climits> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <cctype> #include <vector> #include <string> #include <queue> #include <deque> #include <stack> #include <set> #include <map> #include <utility> #include <algorithm> #i... |
#include <bits/stdc++.h> using namespace std; int n, k; void query(int x) { cout << ? ; for (int i = 1; i <= k + 1; ++i) if (i != x) cout << << i; cout << endl; } int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> k; int x, y, px, py; query(k + 1); ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x, ser = 0, dim = 0; vector<int> v; cin >> n; for (int i = 0; i < n; i++) { cin >> x; v.push_back(x); } for (int i = 0; i < n; i++) { if (i % 2 == 0) { ser += max(v.front(), v.back()); if (v.f... |
#include <bits/stdc++.h> using namespace std; const long long modn = 1000000007; inline long long mod(long long x) { return x % modn; } template <class num> inline void rd(num &x) { char c; while (isspace(c = getchar())) ; bool neg = false; if (!isdigit(c)) neg = (c == - ), x = 0;... |
#include <bits/stdc++.h> using namespace std; vector<int> me; long long sum(long long x) { return (x * (x + 1)) / 2; } int main() { int k; string s; cin >> k >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == 1 ) { me.push_back(i); } } long long ans = 0, cnt = 0,... |
//-----------------------------------------------------------------------------
//-- Secuenciador de 2 estados a partir de registro de 4 bits con
//-- inicialización de carga
//-- (C) BQ. August 2015. Written by Juan Gonzalez (obijuan)
//-----------------------------------------------------------------------------
//--... |
#include <bits/stdc++.h> using namespace std; vector<pair<long double, int> > v; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { long double x, y; cin >> x >> y; v.push_back(make_pair(atan2(y, x), i)); } sort(v.begin(), v.end()); v.push_back(v[0]); if (v.... |
//---------------------------------------------------------------------
//
// Company: UNSW
// Original Author: Lingkan Gong
// Project Name: State_Migration
//
// Create Date: 12/06/2010
// Design Name: icapi_regs
//
//---------------------------------------------------------------------
`timescale 1ns/1ns
mo... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 29.11.2016 16:55:54
// Design Name:
// Module Name: frequency_analyzer_testbench
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Depend... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); } int main() { long long t, i, r, c, k, j, n, cnt, x, y, p, q, l, flag; vector<string> 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... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const long long N = 1e5 + 7; long long p[N], cnt; bool vis[N]; long long res1 = 0; long long res2 = 0; long long res3 = 0; inline void init(long long NN) { res1 = res2 = res3 = 0; for (long long i = 2; i <= NN + res1 + 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; int xx[4] = {0, 0, 1, -1}; int yy[4] = {1, -1, 0, 0}; int n, m, b, s; int x[int(1e5)], y[int(1e5)]; int main() { scanf( %d%d , &n, &m); scanf( %d , &b); for (int i = (1), _b = (b); i <= _b; i++) { scanf( %d , &s); x[s] = true; } s... |
/**
* 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; int count = 0; cin >> n; for (int i = 0; i < n; i++) { string a; cin >> a; if (a == ABSINTH || a == BEER || a == BRANDY || a == CHAMPAGNE || a == GIN || a == RUM || a == SAKE || a == TEQUILA ... |
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n, i; cin >> n; long long c1 = 0, c2 = 0; vector<long long> a(n); for (i = 0; i < n; i++) { cin >> a[i]; if (a[i] % 2) c1++; else ... |
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, k; cin >> n >> k; vector<long long> arr(n, 0); for (long long i = 0; i < n; i++) cin >> arr[i]; queue<pair<pair<long long, long long>, long long... |
/*
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> using namespace std; const int MOD = 1000000007; const double EXP = 2.7182818284590452; const double Pi = 3.14159265; const double EPS = 1e-13; const int INF = 1000 * 1000 * 1000; const long long INFL = (long long)INF * (long long)INF; long long n; long long res; void accept... |
#include <bits/stdc++.h> struct PP { int l, r, sum, lv, rv, cover; int mid() { return (l + r) >> 1; } void doit() { sum = lv = rv = cover ? 0 : dis(); } int dis() { return r - l; } } q[100005 * 3]; int max(int a, int b) { return a > b ? a : b; } void Build(int l, int r, int x) { q[x].l = l; ... |
#include <bits/stdc++.h> using namespace std; struct debugger { template <typename T> debugger& operator,(const T& v) { cerr << v << t ; return *this; } } dbg; template <class A, class B> ostream& operator<<(ostream& o, const pair<A, B>& p) { return o << ( << p.first << , <<... |
#include<bits/stdc++.h> using namespace std; int main() { long long t,n,x; cin>>t; while(t--) { cin>>n>>x; long long a[n+1],m=30,j,s=0,k,c; for (long long i = 0; i < n; ++i) { cin>>a[i]; k=a[i]; c=0; while(k%x==0) { k/=x; c++; } if (m>c) ... |
//*****************************************************************************
// (c) Copyright 2009 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.... |
#include <bits/stdc++.h> int main() { long int n, k, i, *a, *b, t, max, j; scanf( %ld , &t); while (t--) { scanf( %ld , &n); a = (long int *)malloc(n * sizeof(long int)); b = (long int *)malloc(n * sizeof(long int)); for (i = 0; i < n; i++) { scanf( %ld , &a[i]); b[... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (a < 0) a = -a; if (b < 0) b = -b; return b == 0 ? a : gcd(b, a % b); } template <typename T> void read(T &res) { bool flag = false; char ch; while (!isdigit(ch = getchar())) (ch == - ) && (flag... |
module udi_udi_inst_pow (
input gclk ,
input gscanenable ,
input [31:0] in_rs ,
input [15:0] in_rt ,
output [31:0] out_rd ,
input udi_ctl_thr_wr ,
input [1:0] udi_ctl_sum_mode ,
input udi_ctl_res_sel
);
wire [31:0] mult_i_out ;
wire [31:0] mult_q_out ;
wire [31:0] ... |
/*
* fake_uart.v
*
* Fake a uart with the DE10-Nano
*
* Part of the CPC2 project: http://intelligenttoasters.blog
*
* Copyright (C)2017
*
* 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 Foundat... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100 + 23, maxm = 30000; int n, K, a[maxn], w[maxn], F[maxn][maxm + 10000]; int main() { scanf( %d%d , &n, &K); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= n; i++) scanf( %d , &w[i]), w[i] = a[i] - w[i] * K; ... |
// (C) 2001-2016 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1024000000,1024000000 ) using namespace std; int sum[4000005]; int cover[4000005]; int n, m; void up(int rt) { if (cover[rt << 1] == cover[rt << 1 | 1] && cover[rt << 1] != -1 && cover[rt << 1]) cover[rt] = cover[rt << 1]; else ... |
#include <bits/stdc++.h> using namespace std; int v[200001], i, n, poz; bool cmp(int a, int b) { return a < b; } int main() { cin >> n; for (i = 1; i <= n; i++) cin >> v[i]; sort(v + 1, v + n + 1, cmp); poz = 1; for (i = 1; i <= n; i++) { if (v[i] >= poz) poz++; } cout << poz -... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; vector<int> g[N]; int a[N], b[N], last[N], indx[N], lvl[N], ans[N]; int n, m, q; void dfs(int node, int sz) { lvl[sz++] = node; for (int i = 0; i < g[node].size(); i++) { dfs(g[node][i], sz); } if (sz >= n) ans[... |
#include <bits/stdc++.h> const int maxn = 1e6 + 10; using namespace std; int pre[maxn]; int main() { string a, b; cin >> a; cin >> b; int LA = a.size(); int LB = b.size(); int flag = 0, ans = 0; for (int i = 0; i < LB; i++) { if (b[i] == 1 ) flag++; } flag %= 2; if... |
#include <bits/stdc++.h> using namespace std; int n, a[200007], q; int l[200007], r[200007], prime[1000007], id[1000007]; long long bit[200007], ans[200007], inv[1000007], prd[200007], divide[200007], cal[1000007]; vector<pair<int, int> > query[200007]; vector<int> dv[200007]; const long long mod = ... |
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<int> v(n); for (long long i = 0; i < n; i++) cin >> v[i]; ; vector<int> u(n); for (long long i = 0; i < n; i++) cin >> u[i]; ; sort((v).begin(), (v).end()); sort((u).begin(), (u).end()); ... |
#include <bits/stdc++.h> const int inf = 1 << 30; const long long INF = 1ll << 61; using namespace std; int n, m; int c[1000000 + 55]; int nnum[1000000 + 55]; int aa[1000000 + 55]; int sum[1000000 + 55]; int len; void init() { memset(c, 0, sizeof(c)); memset(aa, -1, sizeof(aa)); } bool i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.