text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> int main() { int n, flag = 0; while (scanf( %d , &n) != EOF) { int a[n]; for (int i = 0; i < n; i++) { scanf( %d , &a[i]); if (a[i] == 1) { flag = 1; } } if (flag == 1) printf( -1 n ); else printf( 1 n ); ... |
/*
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... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 50; const int magic = 2500; struct Node { int from, to, delta, add; Node(int from, int to, int delta, int add) : from(from), to(to), delta(delta), add(add) {} }; int n, a[maxn], c[maxn], q[maxn], id[maxn], b[maxn], ans[maxn... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; const int maxn = 2e5 + 10; int N, K; int L[105], R[105]; struct min_segtree { int tree[maxn * 3]; void init() { for (int i = 0; i <= 2 * 2 * N + 2048; ++i) tree[i] = INF; } void update(int l, int r, int pos, int id, int... |
#include <bits/stdc++.h> using namespace std; int main() { long long l, i = 0, n, d, t; cin >> d >> n; if (d != 1 && n == 0) { cout << No solution n ; return 0; } cout << n; for (t = 1; t <= d - 1; t++) cout << 0; cout << endl; return 0; } |
// 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... |
#include <bits/stdc++.h> using namespace std; long long n, v[5000], d[5000], p[5000]; bool used[5000]; int main() { cin >> n; for (long long i = 0; i < n; i++) { used[i] = true; cin >> v[i] >> d[i] >> p[i]; } vector<long long> ans; for (long long i = 0; i < n; i++) { long l... |
//Frequency of
//Frequency of 50Hz w/ 50MHz clock
//so 50000000/50=
//also Log2()=~20
//For accuracy lets reset when reaches ?
//
//Now in terms of Pulse width generally 1ms to 2ms
//this results in 50,000 to 100,000 CMPR value
//MIN: 50M * 1.0m = 50,000 = 50,000,000 * .000000001
//CENTER: 50M * 1.5m = 75,000
... |
/*
* 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 MAXN = 1100; struct VIS { int c, p; int id; bool operator<(const VIS& t) const { if (p == t.p) return c < t.c; return p > t.p; } } A[MAXN]; struct TAB { int c; int id; bool operator<(const int t) const { return c <... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2017/07/04 10:27:15
// Design Name:
// Module Name: Top
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:... |
#include <bits/stdc++.h> using namespace std; vector<int> G[14]; int dp[1 << 14], dp2[14][14][1 << 14]; vector<int> re[1 << 14]; pair<int, int> last_pair[1 << 14]; int pre[1 << 14]; int last[14][14][1 << 14]; bool v[1 << 14]; int main() { int n, m, x, y; scanf( %d%d , &n, &m); for (int i =... |
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; long long Min = min(a, b); Min = min(Min, c); long long day = 0; while (a + b + c >= 7 && a >= 3 && b >= 2 && c >= 2) { a -= 3; b -= 2; c -= 2; day += 7; } long 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 la... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2013 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// This test demonstrates how not only parameters but the type of a parent
// interface could propagate do... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); for (; ch < 0 || ch > 9 ; ch = getchar()) if (ch == - ) f = -1; for (; ch >= 0 && ch <= 9 ; ch = getchar()) x = x * 10 + ch - 0 ; return x * f; } int n, m; int dp[45][1 <<... |
//Legal Notice: (C)2010 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; const int MAXN = 1e2 + 10; const int INF = 1 << 30; char str[MAXN][MAXN]; int Pow(int a, int b) { if (b == 0) return 1; int res = 1; while (b--) res *= a; return res; } int main() { int a, b, n; while (scanf( %d%d%d , &a, &b, &n) != EOF... |
// megafunction wizard: %LPM_FIFO+%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: fifo_32x512a.v
// Megafunction Name(s):
// dcfifo
// ============================================================
// **********... |
#include <bits/stdc++.h> using namespace std; int main() { int k = 0; int a, b, c; string s1, s2, s3; cin >> s1 >> s2 >> s3; a = s1.size(); b = s2.size(); c = s3.size(); if ((a + b) != c) { cout << NO ; return 0; } s1 = s1 + s2; for (int i = 0; i < c; i++) { ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, max = -1; cin >> n; long long int a[n], b[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = n - 1; i >= 0; i--) { if (max < a[i]) { max = a[i]; b[n - i] = 0; } else { ... |
`timescale 1ns / 1ps
module lab6phase1I2C2015fall_tb;
reg Go, Reset, clock;
wire SCL, ClockLocked;
wire [2:0] State=uut.ControlUnit.State;
wire [2:0] NextState=uut.ControlUnit.NextState;
wire ControlClock=uut.ControlUnit.Clock;
wire ClockI2C=uut.ControlUnit.ClockI2C;
wire BaudEnable=uut.ControlUnit.Bau... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; const int MOD = 1e9 + 7; int a[MAXN]; class Matrix { public: void prinf() { for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { cout << a[i][j]; } cout << endl; } } 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... |
// --------------------------------------------------------------------
// ng_TPG.v - Time Pulse Generator
//
// AGC instructions are implemented in groups of 12 steps, called timing pulses. The timing
// pulses, named TP1 through TP12, are produced by the Time Pulse Generator (TPG). Each set
// of 12 timing pulses is ... |
/*
* 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... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e1 + 5; map<int, int> mp; long long n, arr[MAXN], brr[MAXN], crr[MAXN]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> arr[i]; brr[i] = arr[i]; } sort(arr, arr + n); for (int i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> using namespace std; int v[200005]; bool inQ[200005]; vector<pair<int, int> > foo; int main() { int n, k, q, p, m, i, j; bool ok; pair<int, int> x; cin >> n >> k >> m; for (i = 1; i <= n; ++i) cin >> v[i]; priority_queue<pair<int, int> > pq; for (j = 0; j <... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Thu Feb 02 02:49:15 2017
// Host : TheMosass-PC running 64-bit major release ... |
#include <bits/stdc++.h> using namespace std; const int N = 100 + 7; const int M = 59; const int mid = M / 2; const int mod = 1e9 + 9; const int inf = 1e6 + 3; const long long linf = 1ll * inf * inf; const double pi = acos(-1); const double eps = 1e-7; const double ep = 1e-5; const int maxn = 1e5 ... |
#include <bits/stdc++.h> using namespace std; int arr[200005]; map<int, int> mp; int main() { int n, k; cin >> n >> k; vector<int> v; for (int i = 0; i < n; i++) { int a; cin >> a; v.push_back(a); } sort(v.begin(), v.end()); int ans = 1e9; for (int i = 0; i < n;... |
#include <bits/stdc++.h> using namespace std; long long ans; int n, m, k; long long C[1100][1100]; long long s1[1100][1100]; long long p[1100][1100]; long long f[1100100]; long long Pow(long long i, int x) { long long tmp = 1; while (x) { if (x & 1) tmp = tmp * i % (1000000007LL); i ... |
#include <bits/stdc++.h> using namespace std; void quickly_quickly_kro() { long long n; cin >> n; vector<long long> v(n); for (long long i = 0; i < n; i++) cin >> v[i]; ; map<long long, long long> M, N, I; for (long long i = 0; i < n; i++) { if (v[i] != 0) M[v[i]]++; ... |
#include <bits/stdc++.h> using namespace std; int arr[100][100]; int main() { int n, a, b; scanf( %d , &n); for (int i = 0; i < n * n; i++) { scanf( %d%d , &a, &b); if (!arr[a][b]) { printf( %d , i + 1); for (int y = 0; y <= n; y++) { arr[a][y] = 1; arr... |
#include <bits/stdc++.h> using namespace std; int main() { char arr[100][100]; int m, n, k = 0; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> arr[i]; } if (m == 1 || n == 1) { cout << 0; return 0; } for (int i = 0; i < n - 1; i++) { for (int j = 0; j < 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; const int N = 300010; class cmp { public: bool operator()(const pair<long long int, long long int> &a, const pair<long long int, long long int> &b) { if (a.first == b.first) return a.second > b.second; return a.first < b.first; ... |
#include <bits/stdc++.h> using namespace std; const long long Mod = 1e9 + 7; const long long INF = (long long)(1e18) + 5; const long long N = 2e5 + 5, M = 18; int n, m, p; int a[N]; tuple<long long, long long, long long> b[N]; long long suf_s[N], suf_c[N]; long long dp[N], prev_dp[N]; void solve(int... |
#include <bits/stdc++.h> using namespace std; int main() { const int maxn = 1005; char a[2 * maxn], b[maxn]; scanf( %s , a); scanf( %s , b); int lenA = strlen(a); int lenB = strlen(b); int cntA = 0, cntB = 0; int i; for (i = 0; i < lenA; i++) if (a[i] == 1 ) cntA++; fo... |
#include <bits/stdc++.h> using namespace std; int ans[11][11]; bool ok; string s; int sol; queue<int> dulj, broj; int pomocnopolje[11][11]; void bfs(int x, int y, int a, int b) { broj.push(a); dulj.push(1); int v[10] = {0}; while (!broj.empty()) { int duljina = dulj.front(); ... |
// file: clk_wiz_1.v
//
// (c) Copyright 2008 - 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 property
// laws.
//
// DISCLAIMER
// This disclaimer is not a... |
#include <bits/stdc++.h> using namespace std; long long int j, k, n; int main() { long long int q; string x, y; map<string, string> m; map<string, string>::iterator it; cin >> q; while (q--) { cin >> x >> y; if (m.count(x)) { string z; z = m[x]; m.erase(... |
//
// Designed by Qiang Wu
//
// 2048 bytes, 64bit interface
`timescale 1ns/1ps
module packet_memory(
clk,
input_mode,
addr64,
data_in64,
data_out64,
byte_we8,
addr32,
data_in32,
data_out32,
byte_we4
);
input clk;
input input_mode; //1 for 64, 0 for 32
input [10:3] addr64;
input [63:0] data_in64;
output [6... |
#include <bits/stdc++.h> using namespace std; int stop, n, k, x, i, ind, j, y[1000001], mini[2001][2001]; string s[2001]; struct name { int a[26]; int cnt; } trie[1000001]; vector<int> d[1000001]; int m; void add(int v, int pos) { if (pos > s[i].length()) return; if (trie[v].a[s[i][pos] ... |
#include <bits/stdc++.h> using namespace std; char gc() { static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++; } long long read() { char ch = getchar(); long long x = 0; int o... |
#include <bits/stdc++.h> #pragma warning(disable : 4786) #pragma comment(linker, /STACK:102400000,102400000 ) using namespace std; const int INF = 0x3f3f3f3f; const int mod = 1e9 + 7; const double PI = acos(-1.0); const double eps = 1e-6; const int maxn = 2e5 + 5; int isu[maxn], sz[maxn], dis[maxn], ... |
/***************************************************************************************************
** fpga_nes/hw/src/wram.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following... |
// MBT 11/9/2014
//
// Synchronous 1-port ram.
// Only one read or one write may be done per cycle.
`define bsg_mem_1rw_sync_macro_2rf(words,bits,lgEls,mux) \
if (els_p == words && width_p == bits) \
begin: macro \
tsmc180_2... |
/*
* 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; bool isPrime[1000005] = {false}; vector<long long int> SPF(1000005); long long int fastPower(long long int a, long long int b) { if (b == 0) return 1; long long int prod = 1; while (b > 0) { if (b & 1) prod = prod * a; b = b >> 1; a = a... |
#include <bits/stdc++.h> using namespace std; char a[55]; int main() { int n, i, j, k, ans, x; int len; while (cin >> a) { ans = 0; x = 0; len = strlen(a); for (i = 0; i < len; i++) { for (j = len - 1; j > i; j--) { for (k = i; k <= j; k++) { if (a... |
//altiobuf_out CBX_AUTO_BLACKBOX="ALL" CBX_SINGLE_OUTPUT_FILE="ON" DEVICE_FAMILY="Cyclone V" ENABLE_BUS_HOLD="FALSE" NUMBER_OF_CHANNELS=1 OPEN_DRAIN_OUTPUT="FALSE" PSEUDO_DIFFERENTIAL_MODE="TRUE" USE_DIFFERENTIAL_MODE="TRUE" USE_OE="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN1="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN2="FALSE" USE_TE... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast , inline , -ffast-math ) #pragma GCC target( avx,sse2,sse3,sse4,mmx ) inline long long read() { long long s(0); bool w(1); char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) w = -1; ch = getchar(); } while (... |
// 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 : Wed Oct 18 11:58:34 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1005; const long long mod = 1000000007; int grid[maxn][maxn]; inline void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); } int main() { fast(); int h, w; cin >> h >> w; for (int i = 0; i < h;... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:34:47 09/03/2013
// Design Name:
// Module Name: synchronizer
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
... |
//----------------------------------------------------------------------------
// Copyright (C) 2015 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; inline long long read() { long long x = 0, f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) f = -1; for (; isdigit(c); c = getchar()) x = x * 10 + c - 0 ; return x * f; } const long long MAXN = 100010; const lo... |
#include <bits/stdc++.h> using namespace std; int n, q, a[300003], near[300003][20], last[300003]; signed main() { cin >> n >> q; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = n; i >= 1; i--) { for (int k = 0; k < 20; k++) { near[i][k] = n + 1; if (((1 << k... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: bios86.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =====================... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2008, 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... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); vector<int> update(n); for (int i = 0; i < n; i++) { cin >> a[i]; update[i] = 0; } int accumalated = 0; for (int i = 0; i < m; i++) { int t; cin >> t; i... |
#include <bits/stdc++.h> using namespace std; long long a, b; bool check(int k, int x, int y) { long long ca = 1LL * k * x; long long cb = 1LL * k * y; return ca <= a && cb <= b; } long long gcd(long long a, long long b) { if (!b) return a; else return gcd(b, a % b); } int ... |
module lcd (
input clk,
output reg lcd_rs,
output reg lcd_rw,
output reg lcd_e,
output reg [7:4] lcd_d,
output [4:0] mem_addr,
input [7:0] mem_bus
);
parameter n = 24;
parameter j = 17; // Initialization is slow, runs at clk/2^(j+2) ~95Hz
parame... |
#include <bits/stdc++.h> const int N = 25, Mod = 1e6 + 3; const int n = 11; int y[N], k, inv[Mod + 2]; int fm[] = {404910, 950915, 220896, 410947, 30845, 962989, 30845, 410947, 220896, 950915, 404910}; inline int po(int x, int y) { int r = 1; while (y) { if (y & 1) r = 1ll * r * x... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T abs(T zz) { return zz < 0 ? -zz : zz; } template <typename T> inline T sqr(T zz) { return zz * zz; } const int MAGIC = 1000500; vector<int> used; vector<int> primes; bool is_prime(int n) { for (int p : primes)... |
#include <bits/stdc++.h> using namespace std; string s; int find_47(const string& s, int from) { for (int i = from; i < (s.size() - 1); i++) { if ((s[i] == 4 ) && (s[i + 1] == 7 )) return i; } return -1; } int main() { int n, k; cin >> n >> k; cin >> s; int from = 0; wh... |
#include <bits/stdc++.h> int A, B, M = 6, N; int main() { scanf( %d%d%d , &N, &A, &B); int nda = N / A; for (int i = 1; (i <= 2) && (B * i <= N); ++i) M = std::min((i ^ 3) + (4 - ((N - B * i) / A) * (i ^ 3) + nda - 1) / nda, M); printf( %d n , M); return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int itr = 0; itr < t; itr++) { int n; vector<int> s; cin >> n; for (int i = 1; i <= n; i++) { int tmp; cin >> tmp; s.push_back(tmp); } int token = 0; for (in... |
module spi_clock_generator(
//CLK
// i_clk is the system clock (10-200MHz)
input i_clk,
//RST
// i_reset is the system reset. This is a active high signal.
// '1' : reset is active
input i_reset,
//Controll inputs from registers
input i_spr0,
input i_spr1,
input i_cp... |
// (C) 2001-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 doc... |
//
// Copyright 2011 Ettus Research LLC
//
// 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 option) any later version.
//
// This program is dis... |
/*
* 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 juniversalShiftRegisterTb;
wire [3:0] DATAOUT;
reg clock, reset;
reg [1:0] MODE;
reg [3:0] DATAIN;
juniversalShiftRegister jusr(DATAOUT, clock, reset, MODE, DATAIN);
initial
begin
clock =0; MODE = 2'b00; DATAIN = 4'b0000;
reset = 1; #10; reset = 0; #10;
$display("RSLT\tD == D... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i; cin >> n; if (n == 1 || n == 2) cout << -1 ; else { for (i = n; i >= 1; i--) cout << i << ; cout << n ; } 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 long long N = 1e5 + 30, Mod = 1e9 + 7; const long long SQ = 330; unordered_map<int, int> Par[N]; map<pair<int, int>, int> ans; vector<int> G[N]; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); inline int find(int x, int c) { ... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e15; long long q[300005]; long long d[300005]; long long dd[300005]; struct st { long long x, w, id; }; vector<st> v[300005]; st t; vector<long long> ans; long long sum; long long n, m; long long x, y, z; inline void di... |
// file: dcm_tb.v
//
// (c) Copyright 2008 - 2011 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 lic... |
//-----------------------------------------------------------------
// AltOR32
// Alternative Lightweight OpenRisc
// V2.1
// Ultra-Embedded.com
// Copyright 2011 - 2014
//
// Email:
//
// ... |
#include <bits/stdc++.h> using namespace std; template <typename T> T nextInt() { T x = 0, p = 1; char ch; do { ch = getchar(); } while (ch <= ); if (ch == - ) { p = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + (ch - 0 ); ch = g... |
#include <bits/stdc++.h> using namespace std; int cntinv(vector<int> &a) { int n = a.size(); int ans = 0; for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; ++j) { if (a[j] < a[i]) ans++; } } return ans; } int main(int argc, char const *argv[]) { int n; scan... |
#include <bits/stdc++.h> using namespace std; string c; int main() { int i, j, k, n, m, l; scanf( %d%d , &n, &k); if (n * (n - 1) / 2 <= k) { puts( no solution ); return 0; } for (i = 1; i <= n; i++) printf( %d %d n , 0, i); return 0; } |
#include <bits/stdc++.h> using namespace std; int a1, a2, b1, b2, c1, c2; int main() { cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2; if (a1 == 0 && b1 == 0 && c1 != 0 || a2 == 0 && b2 == 0 && c2 != 0) { cout << 0 n ; return 0; } int m1 = b1 * a2, m2 = b2 * a1; if (m1 == m2) if (c... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0; char ch = getchar(); bool f = 0; for (; !isdigit(ch); ch = getchar()) if (ch == - ) f = 1; for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 0 ; return f ? -x : x; } void write(long long ... |
//faux_hd_command_layer.v
/*
Distributed under the MIT license.
Copyright (c) 2011 Dave McCoy ()
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 t... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2025; const int MOD = 998244353; int n, k; namespace Task1 { int ans; int f[MAXN][MAXN]; int sum[MAXN][MAXN]; void solve() { f[0][n] = 1; for (int i = n; i >= 1; i--) sum[0][i] = 1; for (int i = 1; i <= n; i++) for (int j... |
#include <bits/stdc++.h> using namespace std; int main() { long int i, m, n; double add, ans, t1, t2; scanf( %ld%ld , &m, &n); for (i = 1; i <= m; i++) { t1 = (double)i / m; t2 = (double)(i - 1) / m; add = i * (pow(t1, n) - pow(t2, n)); ans += add; } printf( %.7lf , a... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) #pragma GCC optimization( unroll-loops ) using namespace std; int n; pair<int, int> e[200005]; int deg[200005]; vector<int> Adj[200005]; void solve(); int main() { solve(); } void solve() { cin >> n; ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; int n, k, m, res = 0, sm = 0, edge = -1, nb = 1; int a[200055], b[200050], nxt[200505], dp[200005] = {0}, ans[500005]; multiset<int> st, st1, st2; set<int> stres; string s, s1, s2, s3, s4; vector<int> v[200050], vnode, vans, v3... |
#include <bits/stdc++.h> #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( O3 ) #pragma GCC optimize( fast-math ) using namespace std; const int INF = 1e9; const long long INFll = 2e18; const int BASE1 = 179; const int BASE2 = 653; const long long MOD = 1e9 + 7; const int MAXN = 2e5; cons... |
#include <bits/stdc++.h> using namespace std; int main() { int n = 5, sum = 0; while (n--) { int a; cin >> a; sum += a; } if (sum == 0) { cout << -1 << endl; return 0; } cout << (sum % 5 == 0 ? sum / 5 : -1) << endl; } |
#include <bits/stdc++.h> std::map<std::string, std::string> opcodes; std::string next(std::string s) { std::string res = s; res[res.size() - 1]++; for (int i = (int)res.size() - 1; i >= 0; i--) { if (res[i] > f ) { res[i] = a ; res[i - 1]++; } } return res; } in... |
#include <bits/stdc++.h> using namespace std; const int M = 1010; int n; vector<pair<int, int> > pt; vector<int> vx, vy; vector<int> gx[M], gy[M]; vector<tuple<int, int, int> > sh, sv; int pa[M], pb[M], ln, lm; vector<int> v[M]; bool used[M], used1[M]; vector<int> dx[M], dy[M]; bool dfs(int p) {... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e13; const int MAGIC = 3500000; long long add(long long x, long long y) { return (x + y) % MOD; } long long mul(long long x, long long y) { long long coef = (long double)(x)*y / MOD + 0.5; long long ret = x * y - coef * MOD; ret ... |
/*+--------------------------------------------------------------------------
Copyright (c) 2015, Microsoft Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code ... |
#include <bits/stdc++.h> using namespace std; vector<long long> ans; long long gcd(long long x, long long y) { while (true) { if (x == y) return x; if (x < y) { long long k = (y - 1) / x; ans.push_back(-k); y -= k * x; } else { long long k = (x - 1) / y; ... |
#include <bits/stdc++.h> using namespace std; inline int qr() { int f = 0, fu = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) fu = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { f = (f << 3) + (f << 1) + c - 48; c = getchar(); } return f *... |
#include <bits/stdc++.h> using namespace std; int n, k; int main() { cin >> n >> k; if (k >= (n * (n - 1)) / 2) cout << no solution ; else { for (int i = 0; i < n; ++i) cout << 0 << << i << n ; } return 0; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.