text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int de(int x) { if (x == 0) return 0; if (x & 1) return de(x / 2) + 1; return de(x / 2); } long long val[101000]; int main() { int n, i, j, a; while (scanf( %d , &n) != EOF) { memset(val, 0, sizeof(val)); for (i = 0; i < n; 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 la... |
#include <bits/stdc++.h> using namespace std; long long x; long long n, f = 1; int main() { cin >> n; if (n < 0) { f = -1; n = -n; } x = (n % 360) * f * (-1); long long a0 = x, a1 = x + 90, a2 = x + 180, a3 = x + 270; a0 = min(abs(a0), (360 + a0) % 360); if (a0 > 180) a0 ... |
/*
* Copyright (c) 2006 Stephen Williams ()
*
* 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 a[3000]; int n, k; int ans = 0; int main() { scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) scanf( %d , a + i); sort(a + 1, a + 1 + n); for (int i = 1; i <= k; i++) ans += a[i]; printf( %d n , ans); return 0; } |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; int a[N], ret[N]; pair<pair<int, int>, int> qi[N]; int pen[N]; void update(int ind, int add) { while (ind < N) { pen[ind] += add; ind += ind & (-ind); } } int query(int ind) { int ret = 0; while (ind > 0) { ... |
// Matthew Lovell <>
module top_test(/*AUTOARG*/
// Outputs
ba, aa,
// Inputs
z, dc, db, da, \c-escaped-vec , \c-escaped-nvec , Z_int, Z0_int
);
/*AUTOOUTPUT*/
// Beginning of automatic outputs (from unused autoinst outputs)
o... |
//-----------------------------------------------------------------------------
// (c) Copyright 2012 - 2013 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 proper... |
/*
* 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:
// Engineer:
//
// Create Date: 29.06.2017 01:34:06
// Design Name:
// Module Name: t_ctrlunit
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Re... |
#include <bits/stdc++.h> int main() { int a, b; scanf( %d %d , &a, &b); printf( %d , a * b / 2); return 0; } |
#include <bits/stdc++.h> using namespace std; vector<int> pr; vector<bool> used(1000001, false); vector<int> d(1000001, 0); void sieve() { for (long long i = 2; i <= 1000000; i++) { for (long long k = i * i; k <= 1000000; k += i) used[k] = true; } for (int i = 2; i <= 1000000; i++) if ... |
// megafunction wizard: %LPM_MULT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_mult
// ============================================================
// File Name: mult8x8.v
// Megafunction Name(s):
// lpm_mult
//
// Simulation Library Files(s):
// lpm
// =============================... |
//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... |
module clkgen(input wire clkin, output wire clkout, clk25m, locked);
//reg cnt ;
wire clkout_div ;
//always @ ( posedge clkout )
// cnt <= ~cnt ;
//assign clk25m = cnt ;
//assign clk25m = clkout_div ;
ODDR2 ODDR2_inst (
.Q (clk25m), // 1-bit DDR output data
.C0(clkout_div), // 1-bit clock input
.C1(~clkou... |
#include <bits/stdc++.h> using namespace std; int n, i; double p[2], poly[100005][2], minD = 1e18, maxD = 0, d, answer, lo, hi, EPS = 1e-12, mid1, mid2, x, y, d1, d2; int main() { scanf( %d %lf %lf , &n, &p[0], &p[1]); for (i = 0; i < n; i++) { scanf( %lf %lf , &pol... |
module dma_axis_control_if
#(
parameter C_s_axis_TDATA_WIDTH = 32,
parameter C_m_axis_TDATA_WIDTH = 32,
parameter C_m_axis_START_COUNT = 32,
parameter C_S_AXIS_RXS_TDATA_WIDTH = 32,
parameter C_M_AXIS_TXC_TDATA_WIDTH = 32,
parameter C_m_axis_txc_START_COUNT = 32,
parameter ENABLE_LEN ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:36:19 04/19/2016
// Design Name:
// Module Name: display
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y, need4demon, puppets; cin >> n >> x >> y; need4demon = ceil((y / 100.0) * n); if (x >= need4demon) puppets = 0; else puppets = need4demon - x; cout << puppets << endl; } |
/**
* 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() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long l, r; cin >> l >> r; string s_l = to_string(l), s_r = to_string(r); long long m = s_l.length(), n = s_r.length(); if (m == n) { long long num = ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, sum = 0; vector<int> ans; cin >> n; cout << (n * (n + 1) / 2) % 2 << n ; sum = n * (n + 1) / 4; while (sum) { if (n <= sum) { sum -= n; ans.emplace_back(n); } n--; } cout <... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:16:09 07/10/2009
// Design Name:
// Module Name: spi
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// 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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 04/26/2016 08:42:14 AM
// Design Name:
// Module Name: ROM_test
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// R... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > allModify; class Polygon { private: int n; vector<int> label; vector<set<int> > adj; void splitPolygon(Polygon &a, Polygon &b, int x, int y) const { if (x > y) return (splitPolygon(a, b, y, x)); for (int i = (x), ... |
/*
* 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 uint = unsigned int; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; using pli = pair<ll, int>; using pil = pair<int, ll>; using pll = pair<ll, ll>; template <typename T> using vec = vector<T>; using vi = vec<int... |
#include <bits/stdc++.h> using namespace std; int n, m; int a[111]; int b[111]; int main() { cin >> n >> m; int s = 0; for (int i = 0; i < n; i++) { cin >> a[i]; s ^= a[i]; } int tmp = 0; for (int i = 0; i < m; i++) { cin >> b[i]; tmp ^= b[i]; } if (tmp ... |
/**
* 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 MAX = 1e5 + 5; const double PI = acos(-1); vector<double> vec; double getAngle(double x, double y) { if (x == 0) { if (y > 0) return 90; return 270; } if (y == 0) { if (x > 0) return 0; return 180; } double ang... |
/**
* 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 Sn = 1000010; const int Rtm = 10; long long a[Sn]; int n; long long b[Sn]; int m, c[Sn]; long long g[Sn]; long long G[Sn]; int tG, Gc[Sn]; long long P[Sn]; int tP; long long Ans = 1; long long gcd(long long a, long long b, long long t =... |
`timescale 1ns / 1ps
/*
-- Module Name: Test Engine NiC Input Control Unit
-- Description: Unida de control para el bloque de entrada de la
interfaz de red. Este bloque se encarga de la captura de
nuevos paquetes provenientes de la red.
Ejerce control sobre registros de almacenamiento
individuales... |
#include <bits/stdc++.h> using namespace std; template <typename T> bool chkmax(T &x, T y) { return x < y ? x = y, true : false; } template <typename T> bool chkmin(T &x, T y) { return x > y ? x = y, true : false; } int readint() { int x = 0, f = 1; char ch = getchar(); while (ch < ... |
#include <bits/stdc++.h> using namespace std; int n, m; map<int, int> mp; int a[11], aa[11]; int b[11]; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { cin >> b[i]; if (a[b[i]] == 0) { a[b[i]]++; mp[b[i]]++; } } for (int i = 0; i < m; 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 <bits/stdc++.h> using namespace std; int main() { int n, k, op, i, index = 0; cin >> n >> k; char ss[n - 1]; op = k; i = 97; while (op--) { ss[index] = char(i); i++; index++; } if (n - k != 0) { for (int d = 0; d < n - k; d++) { ss[index] = ss... |
// Quick negation of single-precision floating-point number
// (C) 1992-2014 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files ... |
/***********************************************************************************************************************
* Copyright (C) 2016 Andrew Zonenberg and contributors *
* ... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
#include<iostream> #include <math.h> using namespace std; bool issquare(long int num) { long int sqrtnum=sqrt(num); if(num==(sqrtnum*sqrtnum)) { return true; } else{ return false; } } int main() { int t; cin>>t; for(int i=0;i<t;i... |
#include <bits/stdc++.h> using namespace std; double dp[2][600 + 10]; int main(void) { int N, K, i, j; double ans = 0.0; cin >> N >> K; dp[0][1] = 1.0; for ((i) = 0; (i) < (int)(N); (i)++) { int cur = i % 2, next = (i + 1) % 2; for ((j) = 0; (j) < (int)(600); (j)++) ans += ... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const int INF = 1e9; const int N = 150010; int n, m, s, k; int a[110][110]; int main() { scanf( %d%d%d , &n, &m, &k); int s0 = 0, s1 = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { scanf( %d ,... |
module jaxa (
autostart_external_connection_export,
clk_clk,
controlflagsin_external_connection_export,
controlflagsout_external_connection_export,
creditcount_external_connection_export,
errorstatus_external_connection_export,
linkdisable_external_connection_export,
linkstart_external_connection_export,
link... |
#include <bits/stdc++.h> using namespace std; int a[4000000]; int f[4000000]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } int s, t; cin >> s >> t; s--; t--; long long ans = 0; for (int i = s; i < t; i++) ans += a[i]; long long num ... |
/**
* 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 top;
reg [31:0] in_32, out_32, out_32x;
reg [63:0] out_64;
integer res, fd;
reg passed;
initial begin
passed = 1'b1;
// Check that a normal 32 bit %z catches missing bytes.
fd = $fopen("work/test_fscanf.bin", "wb");
in_32 = 32'b000x100z_001z000x_101xxxzz_100z111x;
$fwrite(fd, "%u"... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 02:36:05 03/22/2014
// Design Name:
// Module Name: LC3_RAMblock
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: ITCR
// Engineer: ADRIAN CERVANTES SEGURA
//
// Create Date: 03.03.2016 01:49:40
// Design Name:
// Module Name: LUT_SHIFT
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
// ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (a == 0) return b; if (b == 0) return a; return gcd(b % a, a); } long long power(long long a, long long b) { long long res = 1; while (b > 0) { if (b % 2 != 0) res = (res * 1ll * a); b /= 2... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/05/27 21:57:37
// Design Name:
// Module Name: Datapath_with_mux_adder_register_memory_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description: ... |
/**
* 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, d[100001], b[100001], x, ans = 0; int main() { scanf( %d , &n); for (int i = 1; i < n; i++) { scanf( %d , &x); d[i] = d[--x] + 1; b[d[i]]++; } for (int i = 1; i < n; i++) ans += b[i] % 2; printf( %d , ans + 1); 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 la... |
#include <bits/stdc++.h> using namespace std; const int N = 2e6 + 5; struct bing { int fa[N]; void init() { for (int i = (1); i < (N); i++) fa[i] = i; } int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); } void unite(int x, int y) { fa[find(x)] = find(y); } bool same(int ... |
//----------------------------------------------------------------------------
// Copyright (C) 2001 Authors
//
// This source file may be used and distributed without restriction provided
// that this copyright statement is not removed from the file and that any
// derivative work contains the original copyright notic... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long int LINF = 0x3f3f3f3f3f3f3f; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int k; cin >> k; string second, t; int freq[130]; while (k--) { memset(freq, ... |
/*
* 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; inline long long rd() { long long x = 0, w = 1; char c = getchar(); while (!isdigit(c) && c != - ) c = getchar(); if (c == - ) c = getchar(), w = -1; while (isdigit(c)) x = x * 10 + c - 48, c = getchar(); return x * w; } const int N = 30000... |
/**
* 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, p; cin >> n >> p; string s; cin >> s; bool f = 0; int i = s.size() - 1; if (i > 0) { while (s[i] - a == p - 1) { s[i] = a ; i--; } s[i]++; } if (s.size() == 2) i = s.size() - 1;... |
#include <bits/stdc++.h> using namespace std; string file[10005]; unordered_map<string, pair<int, int> > ss; unordered_map<string, bool> sk; void deal(const string &in, int loc) { sk.clear(); int len = in.size(); string temp; for (int i = 1; i <= len; ++i) { for (int j = 0; j <= len - 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... |
`define bsg_inv_macro(bits) \
if (harden_p && (width_p==bits) && vertical_p) \
begin: macro \
bsg_rp_tsmc_250_INVX8_b``bits inv_gate (.i0(i),.o); \
end ... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; int type[200010]; int weight[200010]; map<int, long long int> M; long long int power(long long int a, int b) { a %= mod; long long int res = 1; while (b) { if (b & 1) res = res * a % mod; a = a * a % mod; ... |
module arbiter(rst, clk, push, d, full, q, stall, valid, almost_full);
parameter WIDTH = 8;
parameter PORTS = 8;
parameter FIFO_DEPTH = 32;
parameter ALMOST_FULL_THRESHOLD = 1;
parameter PORTS_ADDR_WIDTH = log2(PORTS-1);
parameter FIFO_DEPTH_ADDR_WIDTH = log2(FIFO_DEPTH-1);
input rst;
... |
// 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 : Fri Sep 22 20:11:26 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; bool adj[4005][4005]; int edges[4005]; int main() { int n, m, res = INF; cin >> n >> m; while (m--) { int a, b; cin >> a >> b; adj[a][b] = adj[b][a] = 1; edges[a]++; edges[b]++; } for (int i = ... |
#include <bits/stdc++.h> using namespace std; int main() { size_t rnn; cin >> rnn; size_t rnsize = 2 * rnn; size_t rncnt = rnsize; vector<long> rnvec(rnsize); while (rncnt--) cin >> rnvec[rncnt]; sort(rnvec.begin(), rnvec.end()); long rnsum_fin = 999999; long rnsum = 0; for (... |
//IEEE Floating Point to Integer Converter (Double Precision)
//Copyright (C) Jonathan P Dawson 2014
//2014-01-11
module double_to_long(
input_a,
input_a_stb,
output_z_ack,
clk,
rst,
output_z,
output_z_stb,
input_a_ack);
input clk;
input rst;
... |
#include <bits/stdc++.h> using namespace std; string s1, s2; int main() { cin >> s1 >> s2; if (s1.length() != s2.length()) cout << NO ; else { int x = 0; int y = 0; for (int i = 0; i < s1.length(); i++) { if (s1[i] - 0 == 1) x++; if (s2[i] - 0 == 1) y++; ... |
#include <bits/stdc++.h> using namespace std; int n, j; string a, b; int main() { cin >> n; cin >> a >> b; sort(a.begin(), a.end()); sort(b.begin(), b.end()); j = n - 1; for (int i = n - 1; i >= 0; i--) { if (a[i] <= b[j]) j--; } cout << j + 1 << n ; j = 0; for (i... |
#include <bits/stdc++.h> using namespace std; const int MAXP = 1e5; long long int n, s, p, q, x, sell[MAXP + 5] = {0}, buy[MAXP + 5] = {0}; char d; vector<pair<long long int, long long int> > ansell; int main() { cin >> n >> s; for (int i = 0; i < n; i++) { cin >> d >> p >> q; if (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... |
// =======================================================================
// Filename: alu_top_tb.v
// Created by: Tareque Ahmad
// Date: Feb 20, 2015
//
// Description: Top level testbench module for simple_alu
// and alu_test modules
// =========================================... |
#include <bits/stdc++.h> using namespace std; const long long INF = (long long)1e18 + 5; const long long MOD = (long long)1e9 + 7; const int MAXN = 55; const int MAXM = 20005; struct ST { long long val[4 * MAXM], add[4 * MAXM]; void init(int l, int r, int idx) { add[idx] = val[idx] = 0; ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) #pragma GCC optimize( unroll-loops ) using namespace std; template <class A> istream& operator>>(istream& in, vector<A>& a) { for (A& i : a) in >> i; return in; } ... |
/**
* 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; if (((n * (n - 1)) / 2) <= k) cout << no solution ; else { while (n--) cout << 0 << n << endl; } return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int A[200010]; int fri[100010]; for (int i = 0; i < N; i++) { int p, q; cin >> p >> q; fri[i] = p; A[p] = q; A[q] = p; } int res[200010] = {}; for (int i = 1; i <= 2 * N; i++) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, n; cin >> a >> b >> n; if (abs(a) + abs(b) <= n) { if ((n - abs(a) - abs(b)) % 2 == 0) cout << Yes ; else cout << No ; } else { cout << No ; } } |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Thu Oct 26 22:46:24 2017
// Host : Juice-Laptop running 64-bit major relea... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100 + 10; int a[maxn], chk[maxn]; string str; int main() { int n, k = 0; cin >> n >> str; if (str.size() < n) { cout << NO ; return 0; } for (int i = 0; i < str.size(); i++) { if (a[str[i] - 0 ] == 0) 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 law... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N = 1e5 + 7; const int inf = INT_MAX / 2; const long long INF = LLONG_MAX / 3; const int MOD = 998244353; const long double eps = 1e-6; const pair<int, int> dir[] = {{0, 1}, {0, -... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int MM = 600005; const long long MOD = 1000000007; double a[MM], sum[MM]; char s[MM]; int main() { sum[0] = a[0] = 0; for (int i = 1; i < MM; i++) { a[i] = a[i - 1] + 1.0 / i; sum[i] = sum[i - 1] + a[i]; } scanf( %s , s + 1); ... |
#include <bits/stdc++.h> using namespace std; int main(void) { ios::sync_with_stdio(false); cin.tie(NULL); long long k; cin >> k; long long second = 2000 + k; long long ar[2000]; ar[0] = -1; for (long long int i = 1; i < 2000; i++) { if (second <= 1000000) { ar[i] = sec... |
#include <bits/stdc++.h> using namespace std; bool debug = 1; int n, m, k; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; long long ln, lk, lm; vector<int> mp[100005]; int r1, r2, fa[100005], s[100005], no[100005], cnt, d[100005], w[100005]; bool vis[100005]; int bfs(int x) { queue<int> q; ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int node[(ll)(1e5 + 7)], in[(ll)(1e5 + 7)], out[(ll)(1e5 + 7)], ti = 1, hie[(ll)(1e5 + 7)]; int dp[(ll)(1e5 + 7)][17]; vector<int> gr[(ll)(1e5 + 7)], hi[(ll)(1e5 + 7)]; void dfs(int node, int h) { hi[h].p... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int N, M; cin >> N >> M; vector<int> ceff(N * 2); for (int i = 0; i < N; ++i) { cin >> ceff[i * 2]; } cin >> ceff[N * 2 - 1]; for (int i = 1; i < N; ++i) { cin >> ceff... |
#include <bits/stdc++.h> using namespace std; long long mod = 998244353; long long power(long long x, long long y) { long long z = 1; while (y > 0) { if (y % 2) z = z * x; x = x * x; y /= 2; } return z; } long long gcd(long long a, long long b) { if (a < b) return gcd(b, ... |
module ADT7310P32LS32L (
(* 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,
(* inte... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1000000000 ) #pragma GCC optimize( Ofast,no-stack-protector ) using namespace std; const int maxn = (int)3e5 + 10, mod = 998244353; int add(int x, int y) { x += y; if (x >= mod) { x -= mod; } return x; } int sub(int x, int y) {... |
#include <bits/stdc++.h> using namespace std; int n; char color[16]; int r[16], b[16]; int redCount[1 << 16], blueCount[1 << 16]; int dp[1 << 16][2][257]; int calc(int mask, bool noRed, int other) { other = min(other, n * n); if (dp[mask][noRed][other] != -1) return dp[mask][noRed][other]; if ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int f[N], ff[N]; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n; cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; f[x]++; } multiset<int> ms; for (int i = 1; i < N; i+... |
#include <bits/stdc++.h> #pragma GCC optimize(3) using namespace std; signed main() { long long t; cin >> t; while (t--) { long long n; cin >> n; string s; cin >> s; map<long long, long long> maps; long long sum = 0; for (auto &i : s) { sum += i - 0 ... |
//-----------------------------------------------------------------------------
// setbit.v
//-----------------------------------------------------------------------------
//- (C) BQ, August 2015
//- Written by Juan Gonzalez (Obijuan)
//- GPL License
//-------------------------------------------------------------------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.