source_code stringlengths 26 62k | lang_cluster stringclasses 11
values | src_uid stringlengths 32 32 | code_uid stringlengths 32 32 | difficulty int32 -1 3.5k ⌀ | exec_outcome stringclasses 1
value |
|---|---|---|---|---|---|
#include <bits/stdc++.h>
using namespace std;
void Get_Num(int x,int &x0,int &x1,int &x2,int &x3)
{
x0=x%10;
x1=x%100/10;
x2=x%1000/100;
x3=x/1000;
}
void Compare(int x,int y,int &b,int &c)
{
b=0,c=0;
int num[2][4];
Get_Num(x,num[0][0],num[0][1],num[0][2],num[0][3]);
Get_Num(y,num[1][0],num[1][1],num[1][2],nu... | C++ | ad56be6638b54bc91e6e9e25f0cfb2d9 | 8a04e6c05b3875ef6dba6a398f64199c | 2,500 | PASSED |
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
#define int long long
#define rep(i,begin,end) for(__typ... | C++ | 2bfd566ef883efec5211b01552b45218 | b195fa3279b5084d93ac7879ac2610b5 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define... | C++ | 2bfd566ef883efec5211b01552b45218 | 3596ef190be6d690b6c1f90f34bf8bec | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define PF push_front
#define P push
#define INC(i,a,b) for (ll i = a; i <= b; i++)
#define DEC(i,b,a) for (ll i = b; i >= a ; i--)
#define inf LLONG_MAX
#define neginf LLONG_MIN
#define mod 1000000007
#define eps 1e-9
... | C++ | 2bfd566ef883efec5211b01552b45218 | b99e1f424e7ccfce0dcc158028c88794 | 1,900 | PASSED |
// link here :
#include <bits/stdc++.h>
using namespace std;
#define NAME "do"
#define show(x) cout << (#x) << " is " << (x) << endl
#define ll long long
#define ms(arr,val) memset(arr,val,sizeof(arr))
#define len length()
#define pb push_back
#define epb emplace_back
const int maxn = 1e5+5;
int n,a,b,da,db;
vector< ... | C++ | 2bfd566ef883efec5211b01552b45218 | 648439e300f9091d7e7df3cdde0f152a | 1,900 | PASSED |
// link here :
#include <bits/stdc++.h>
using namespace std;
#define NAME "do"
#define show(x) cout << (#x) << " is " << (x) << endl
#define ll long long
#define ms(arr,val) memset(arr,val,sizeof(arr))
#define len length()
#define pb push_back
#define epb emplace_back
const int maxn = 1e5+5;
int n,a,b,da,db;
vector< ... | C++ | 2bfd566ef883efec5211b01552b45218 | f0f0a492455f03e17313d067233eeb4e | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define sz(a) ((int)a.size())
#define rep(i,a,b) for(ll i = (a);i < (b);(i)++)
#define per(i,a,b) for(ll i = (b-1);i >= (a);(i)--)
const int maxn = 1e6+10;
typedef long long ll;
int n,a,b,da,db,d;
vector<int>G[maxn];
int dp[maxn][2],dis[maxn];
bool is;
void dfs(int u,int ... | C++ | 2bfd566ef883efec5211b01552b45218 | ca353407287c3e35eae71a7185e6fc2f | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define sz(a) ((int)a.size())
#define rep(i,a,b) for(ll i = (a);i < (b);(i)++)
#define per(i,a,b) for(ll i = (b-1);i >= (a);(i)--)
const int maxn = 1e6+10;
typedef long long ll;
int n,a,b,da,db,c;
vector<int>G[maxn];
int dis[maxn][2],mx[maxn],t[maxn];
bool is;
int mmx;
vo... | C++ | 2bfd566ef883efec5211b01552b45218 | 5a5954d40dcba58575e45829667c5d61 | 1,900 | PASSED |
/*
若ab>da&&db>da*2&&maxd>da*2
分类讨论直径的位置,b一定能跑到一个安全的位置
*/
#include<bits/stdc++.h>
using namespace std;
#define sz(a) ((int)a.size())
#define rep(i,a,b) for(ll i = (a);i < (b);(i)++)
#define per(i,a,b) for(ll i = (b-1);i >= (a);(i)--)
const int maxn = 1e6+10;
typedef long long ll;
int n,a,b,da,db,d;
vector<int>G[maxn];... | C++ | 2bfd566ef883efec5211b01552b45218 | d7b6f2b2fb83fead9f2dd67a0c0e0abf | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) { for (; b; a %= b, swap(a, b)); return a; }
int dx[4] = { 1, 0, 0, 0 };
int dy[4] = { 0, 1, 1, -1 };
#define INF 101112987654321
vector<vector<ll>> graph(100002);
ll longest = 0,... | C++ | 2bfd566ef883efec5211b01552b45218 | 2ff5ecafae104ce6317b0c5c3872a850 | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) { for (; b; a %= b, swap(a, b)); return a; }
int dx[4] = { 1, 0, 0, 0 };
int dy[4] = { 0, 1, 1, -1 };
#define INF 101112987654321
vector<vector<ll>> graph(100002);
ll longest = 0,... | C++ | 2bfd566ef883efec5211b01552b45218 | 4c69ab7041ce464088033e96cdf4f220 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
ll t, n, m;
int a[10005];
int b[10005];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
vector<vector<int>>vis(n + 10, vector<int>(m + 10, 0));
int x, y;
cin >> x;
for (int i = 1; i <= x; ... | C++ | 88f0065bc0c3a661e325920fff483e83 | 1936822c6539c2d6de9f16270bc45d7e | 2,000 | PASSED |
#include "bits/stdc++.h"
using namespace std;
// DEBUG BEGIN
template<typename L, typename R>
ostream &operator<<(ostream &out, pair<L, R> p){
return out << "(" << p.first << ", " << p.second << ")";
}
template<typename Tuple, size_t ...Is>
void print_tuple(ostream &out, Tuple t, index_sequence<Is...>){
((out << (Is... | C++ | 88f0065bc0c3a661e325920fff483e83 | 9b9896c3d18552627a79c353e925ee4d | 2,000 | PASSED |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
template<typename T>
struct seti : public tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update> {
seti(): tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update... | C++ | 88f0065bc0c3a661e325920fff483e83 | 74d5a706ac5dbb940b867a20bc5f7837 | 2,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define MAX 10002
int n, m, k1;
multiset<int> v, vv;
vector < pair<int, int> > V;
vector<int> VV;
int main(){
cin >> n >> m >> k1;
for (int i = 0; i < k1; i++){
int a;
scanf("%d", &a);
v.insert(a);
}
cin >> k1;
for (int i = 0; i < k1; i++){
int k;
scanf("%d"... | C++ | 88f0065bc0c3a661e325920fff483e83 | 9b7547c4a3003bdd738464952a444a9a | 2,000 | PASSED |
#include <bits/stdc++.h>
bool solveleft(int x);
bool solveright(int x);
int T, n, m, k, x;
std::multiset<int> left, right;
inline bool solveleft(int x) {
std::multiset<int>::iterator it = left.upper_bound(x - 1);
if (it == left.end()) return 0;
left.erase(it);
return 1;
}
inline bool solveright(int x) {
std::mu... | C++ | 88f0065bc0c3a661e325920fff483e83 | 8d85890198a6f99199a465675c4c2b06 | 2,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int n,m,i,j,i1,k,l,a[111111],b[111111],c[11111][1111];
main () {
cin>>n>>m>>k;
for(i=1;i<=k;i++) cin>>a[i];
sort(a+1,a+k+1);
cin>>l;
for(i=1;i<=l;i++) cin>>b[i];
sort(b+1,b+l+1);
for(i1=1;i1<=k;i1++){
int x=0,y=0,x1=-1,y1=-1;
for(i=1;i<=n;i++){
for(j=1;j<=m;j++... | C++ | 88f0065bc0c3a661e325920fff483e83 | b5c821106852663c2df7cfa5cb31618b | 2,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int n,m,i,j,i1,k,l,a[111111],b[111111],c[11111][1111];
priority_queue<pair<pair<int , int> , pair<int , int> > >pq,pq1;
priority_queue<pair< int , pair<int , int> > >pq2,pq3;
main () {
cin>>n>>m>>k;
for(i=1;i<=k;i++) cin>>a[i];
sort(a+1,a+k+1);
cin>>l;
for(i=1;i<=l;i++)... | C++ | 88f0065bc0c3a661e325920fff483e83 | 1a1fce1508512ac44731c8c4a4ad6ab3 | 2,000 | PASSED |
#include "bits/stdc++.h"
using namespace std;
using LL = long long;
constexpr int N = 1e5 + 5;
constexpr int INF = 1e9;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n, m;
cin >> n >> m;
int k;
cin >> k;
vector< int> in(k);
for (int &e : in) cin >> e;
sort(begin(in), end(in));
vector... | C++ | 88f0065bc0c3a661e325920fff483e83 | 5dbe8a61c348e2323c323dd86a15af98 | 2,000 | PASSED |
#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <map>
#include <cstring>
#include <set>
#include <vector>
#define forr(i,x,n) for(int i=(x); i<(n); i++)
#define forn(i,n) forr(i,0,n)
using namespace std;
const int MAXN = 1e4 + 5;
const int INF = 1e9;
int N, M, K, L;
int distN(int... | C++ | 88f0065bc0c3a661e325920fff483e83 | c2deaa40aaaa70c5bf1233fcc68deac2 | 2,000 | PASSED |
// Phoenix
#include<bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=1e4+10,mod=1e9+7;
const ll inf=1e18;
int a[maxn],b[ma... | C++ | 88f0065bc0c3a661e325920fff483e83 | b895e38dd917ce3a8624be00451c4221 | 2,000 | PASSED |
/*
U FAIL U IMPROVE
U SKIP U LOSE!!
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
lli... | C++ | 64700ca85ef3b7408d7d7ad1132f8f81 | 84986c9b0fa8683d7193d5c3357039ef | 1,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >>s;
int i,j;
int n=s.size();
int count=0;
bool prime[1001];
memset(prime,true,sizeof(prime));
for(i=4;i<=n;i=i+2)
{
prime[i]=false;
... | C++ | 64700ca85ef3b7408d7d7ad1132f8f81 | 0571f3cd3c2665f776f453b327f53e80 | 1,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define sij 1000001
#define mod 1000000007
#define endl '\n'
#define pb push_back
#define eb emplace_back
#define loop(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin)... | C++ | 64700ca85ef3b7408d7d7ad1132f8f81 | 501b7477c84c3ea3dfc66ba61c546e14 | 1,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int N=1e3+5;
char s[N];
int n,f[N],mk[N],cnt[N];
vector<int> p;
void init()
{
for(int i=2;i<N;i++)if(!mk[i]){
p.push_back(i);
for(int j=i+i;j<N;j+=i) mk[j]=true;
}
}
int main()
{
scanf("%s",s+1);
n=strlen(s+1);
init();
memset(mk,0,sizeof(mk));
for(int ... | C++ | 64700ca85ef3b7408d7d7ad1132f8f81 | 7a4ad0cf78b8600e893a50ab41ad82be | 1,300 | PASSED |
/*
ID: hepic
PROG: sabotage
LANG: C++11
*/
#include <bits/stdc++.h>
#define FOR(i, a, b) for(auto i=a; i<=b; ++i)
#define REP(i, a, b) for(auto i=a; i<b; ++i)
#define FORI(i, a, b) for(auto i=a; i!=b+1-2*(a>b); i+=1-2*(a>b))
#define REPI(i, a, b) for(auto i=a-(a>b); i!=b-(a>b); i+=1-2*(a>b))
#define ALL(v) v.begin(),v... | C++ | 64700ca85ef3b7408d7d7ad1132f8f81 | e6c5303898a9038862d8eb19bb331986 | 1,300 | PASSED |
/*
ID: hepic
PROG: sabotage
LANG: C++11
*/
#include <bits/stdc++.h>
#define FOR(i, a, b) for(auto i=a; i<=b; ++i)
#define REP(i, a, b) for(auto i=a; i<b; ++i)
#define FORI(i, a, b) for(auto i=a; i!=b+1-2*(a>b); i+=1-2*(a>b))
#define REPI(i, a, b) for(auto i=a-(a>b); i!=b-(a>b); i+=1-2*(a>b))
#define ALL(v) v.begin(),v... | C++ | 64700ca85ef3b7408d7d7ad1132f8f81 | 1802ea474d9f1c7a7aad73e9382bc9fa | 1,300 | PASSED |
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;
int x,n,a[1000000],b,f=1;
int color[100000];
vector < int > v;
vector < pair<int,char> > vec;
map <int,int> ans;
bool ok[200000];
int lol[1304][1304];
void r(){
int N=1200;
for(int i=2;i<=N;i+=2)
ok[i]=1;
for(int i=3;i<=N;i+=... | C++ | 64700ca85ef3b7408d7d7ad1132f8f81 | 06174f9207f39241d3cfc7689a0d21b2 | 1,300 | PASSED |
//Author:Medo king
//ان الله لا يضيع اجر من احسن عملا
#include <cstring>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <f... | C++ | 64700ca85ef3b7408d7d7ad1132f8f81 | 691bba00be2386d714fae61b246f62f6 | 1,300 | PASSED |
//Author:Medo king
//ان الله لا يضيع اجر من احسن عملا
//#include "stdafx.h"
#include <cstring>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <string>
#include <cstdlib>
#inclu... | C++ | 64700ca85ef3b7408d7d7ad1132f8f81 | 83dc2795a0c7b5838cad1602585c0a86 | 1,300 | PASSED |
#include<bits/stdc++.h>
#define ll long long
#define ss string
#define pb push_back
#define rev(i,n) for(ll i=0;i<n;i++)
#define rev1(i,n) for(ll i=n-1;i>=0;i--)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) v.begin(),v.end()
#define S second
#define F first
#define tci(v,i) for(auto... | C++ | 64700ca85ef3b7408d7d7ad1132f8f81 | a73503ca87fe888e97501aa7db727b8c | 1,300 | PASSED |
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class apples{
public static void main(String[] args) {
Scanner zizo=new Scanner(System.in);
int n=zizo.nextInt();
String l="I love that";
String h="I hate that";
String r="";... | Java | 7f2441cfb32d105607e63020bed0e145 | a6a362eb085926683ccca27ebe1c1ffb | 800 | PASSED |
import java.util.Scanner;
public class imagine {
private static Scanner butts;
public static void main(String[] args) {
butts = new Scanner(System.in);
int n = butts.nextInt();
int shiva = 0;
for(int i = 1; i < n; i++)
{
shiva=i;
if(i%2==0)
{
... | Java | 7f2441cfb32d105607e63020bed0e145 | 122abddd05e93ab0c6bc235bf6beb5ed | 800 | PASSED |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
Zidan(Integer.parseInt(sc.nextLine()));
}
public static void Zidan(int x){
String y="";
for (int i=1 ; i <= x-1 ; i++ ){
if (i%2==0){
... | Java | 7f2441cfb32d105607e63020bed0e145 | 3b5103b2beb9896517421be47e878515 | 800 | PASSED |
import java.util.Scanner;
public class apples {
public static void main (String args[]) {
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
for (int i=1;i<=a;i++) {
if (i%2!=0) {
if(i==a)
System.out.print("I hate it");
else
System.out.print("I hate that");
}
else {
... | Java | 7f2441cfb32d105607e63020bed0e145 | 3ecea9ef4a539c129c8fd5e91530163d | 800 | PASSED |
import java.util.Scanner;
public class Hulk {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String res = "";
for (int i = 1; i <= n; i++) {
if ((i & 1) == 0)
res += "I love";
else
res += "I hate";
if (i != n)
res += " that ";
else
... | Java | 7f2441cfb32d105607e63020bed0e145 | e1c08282e26a2b6e2e4e7d9de7e335db | 800 | PASSED |
import java.util.Scanner;
public class Hulk {
/**
*
*/
public static int feelingNum = 0 ;
public static String printMessage = "";
public static void main(String[] args) {
Scanner myScanner = new Scanner(System.in);
int num = myScanner.nextInt();
for (in... | Java | 7f2441cfb32d105607e63020bed0e145 | 32a8d116652ab5763671c46af51cbb07 | 800 | PASSED |
import java.util.Scanner;
/**
*
* @author abosala7
*/
public class Hulk {
/**
*
*/
public static int feelingNum = 0 ;
public static String printMessage = "";
public static void main(String[] args) {
Scanner myScanner = new Scanner(System.in);
int num = myScan... | Java | 7f2441cfb32d105607e63020bed0e145 | 7ae873662aaa6dc24f425f408063fc85 | 800 | PASSED |
import java.util.Scanner;
/**
*
* @author abosala7
*/
public class Hulk {
public static void main(String[] args) {
int feelingNum = 0 ;
String printMessage = "";
Scanner myScanner = new Scanner(System.in);
int num = myScanner.nextInt();
for (int i = 0 ; i < num ; i+... | Java | 7f2441cfb32d105607e63020bed0e145 | edb066a29b8dfdd2ba0a4ef1221bc653 | 800 | PASSED |
import java.util.*;
public class hulk {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
boolean flag=true;
String s="";
for(int i=0;i<n;i++){
if(flag==true){
s="hate";
flag=false;
}
else{
s="love";
... | Java | 7f2441cfb32d105607e63020bed0e145 | e6d16d46056898a7701d50b11f015598 | 800 | PASSED |
import java.util.*;
public class hulk {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
boolean flag=true;
String s="";
if(n==1)
System.out.println("I hate it");
else{
for(int i=0;i<n;i++){
if(flag==true){
s="ha... | Java | 7f2441cfb32d105607e63020bed0e145 | e886af42ccf8a4173f8d2313d0463c89 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii > vii;
typedef vector<pair<int, pair<int, int> > > viii;
typedef pair<ll,ll> pll;
typedef vector<stri... | C++ | e3ca8338beb8852c201be72650e9aabd | 663de2344d59b08aaef799d037d905f9 | 1,700 | PASSED |
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
int main ()
{
long long n,m,i,j,a[1000001],d;
scanf("%lld",&n);
for(i=0;i<n;i++)
scanf("%lld",&a[i]);
sort(a,a+n);
if(n==1)
printf("-1");
else
if(n==2)
{
if(a[0]==a[1])
{
printf("1\n");
printf("%lld",a[... | C++ | e3ca8338beb8852c201be72650e9aabd | 4e65ae381423ff63975292c9ee56c10d | 1,700 | PASSED |
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<iterator>
#include<iomanip>
using namespace std;
int main()
{
cout.setf(ios::fixed);
long n,nClone;
scanf("%d" , &n);
nClone=n;
long temp;
vector<long> array;
while(nClone--)
{
scanf("%d" , &temp);
array.push_back(temp);
}
... | C++ | e3ca8338beb8852c201be72650e9aabd | 80ff96f2793bad3dc45e9a942e55686d | 1,700 | PASSED |
#include<cstdio>
#include<algorithm>
#include<climits>
using namespace std;
int n,m,k,i,j,l,sum,num,ar[1000000],br[1000000],y,u;
int main()
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&ar[i]);
}
sort(ar,ar+n);
for(j=1;j<n;j++)
{
br[j]=ar[j]-ar[j-1];
}
y=123456789;
for(i=1;i<n;i++)
if(y>br[i])
y=br[i];
sum... | C++ | e3ca8338beb8852c201be72650e9aabd | bfcad5b2cbcce851622be911ff63cc1f | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define EPS 1e-7
#define MOD 1000000007
#define ll long long int
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pair<int,int> >
#define MAX 1000100
int n, m, x, y;
... | C++ | e3ca8338beb8852c201be72650e9aabd | f27410757a43fdb30853d14957d3c45c | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define EPS 1e-7
#define MOD 1000000007
#define ll long long int
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pair<int,int> >
#define MAX 1000100
int n, m, x, y;
... | C++ | e3ca8338beb8852c201be72650e9aabd | d9ec1afb2794d0a0dfff792f7f095d54 | 1,700 | PASSED |
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <numeric>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); ++i... | C++ | e3ca8338beb8852c201be72650e9aabd | 1c9bf67239758deb8c5fb16a6959072b | 1,700 | PASSED |
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <deque>
#include <fstream>
#include <queue>
#include <stack>
#include <vector>
#include <iomanip>
#include <cstdio>
#include <new>
#define mp make_pai... | C++ | e3ca8338beb8852c201be72650e9aabd | d15ef6c0a176c3959a5e6eb1a0ba5e8a | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int n, num[100000], diff = -1,df[100000];
int main() {
cin >> n;
for(int i=0;i<n;i++)
cin >> num[i];
sort(num, num+n);
for(int i=0;i<n-1;i++)
df[i] = num[i+1]-num[i];
sort(df, df+n-1);
if(n==1)
cout << "-1\n";
else if(n... | C++ | e3ca8338beb8852c201be72650e9aabd | af7eaf42a8b2c57f509ae9283059c0df | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int MAXV = 111;
int n, m, inorder[MAXV];
int dp[MAXV][MAXV];
bool lhs[MAXV][MAXV], rhs[MAXV][MAXV];
bool solve(int l, int r) {
if (l == r) {
dp[l][r] = 0;
for (int i = 1; i <= n; i++) if (lhs[l][i] || rhs[l][i]) return dp[l][r];
dp[l][r... | C++ | e683d660af1e8a98f20296f289aa8960 | e5fefb7c54fb63432dfc4973b34f0485 | 2,400 | PASSED |
#ifdef ONLINE_JUDGE
#include <bits/stdc++.h>
#else
#include <algorithm>
#include <bitset>
#include <list>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
... | C++ | e683d660af1e8a98f20296f289aa8960 | 21bd85993275192c77e78abdd01b0386 | 2,400 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)for(int i=a;i<int(b);i++)
int N,C;struct node{int max,L=INT_MIN,R=INT_MAX;}nds[1000000];void fail(){puts("IMPOSSIBLE");exit(0);}vector<int>odr;int inorder(int n,int nMax){int cn=n+1;if(cn<=nds[n].L)cn=inorder(cn,nds[n].L);if(cn>nds[n].R)fail();odr.push_back... | C++ | e683d660af1e8a98f20296f289aa8960 | 0aa129357a212d903e947ebdc1e31943 | 2,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<int(b);i++)
int N, C;
struct node {
int max, L = INT_MIN, R = INT_MAX;
} nds[1000000];
void fail() {
puts("IMPOSSIBLE");
exit(0);
}
vector<int> odr;
int inorder(int n, int nMax) {
int cn = n+1;
if (cn <= nds[n].L) cn = inorder(cn, n... | C++ | e683d660af1e8a98f20296f289aa8960 | cbc35a4fcd4f29bc24766dce636c126d | 2,400 | PASSED |
//thank you Tourist :D
#include<bits/stdc++.h>
using namespace std;
#define sf scanf
#define pf printf
#define ll long long
#define fr(I,M,N) for(I=M;I<=N;I++)
#define fr_(I,M,N) for(I=M;I>=N;I--)
#define re return
#define sfn cin>>n
#define bal pf("bal\n")
#define pb push_back
#define ins insert
#define sz(X) X.siz... | C++ | e683d660af1e8a98f20296f289aa8960 | 8dcc5ea4abf6e9ae109d6748b2c3d2f9 | 2,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef pair<int, int> pii;
const int MAXN = 1<<20;
int n, c;
char s[10];
vector<int> adj[MAXN][2];
pii tree[2*MAXN]; //min, pos
int lazy[2*MAXN];
void down(int cur, int lt, int rt) {
tree[cur].fi += lazy[cur];
if (lt + 1 != ... | C++ | e683d660af1e8a98f20296f289aa8960 | 9acbbc806bcaaeef54ee32c47e87f4f3 | 2,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<int(b);i++)
int N, C;
struct node {
int max, L = INT_MIN, R = INT_MAX;
} nds[1000000];
void fail() {
puts("IMPOSSIBLE");
exit(0);
}
vector<int> odr;
int inorder(int n, int nMax) {
int cn = n+1;
if (cn <= nds[n].L) cn = inorder(cn, n... | C++ | e683d660af1e8a98f20296f289aa8960 | d1f488a34f227373817ceae1ea91ff00 | 2,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<int(b);i++)
int N, C;
struct node {
int max, L = INT_MIN, R = INT_MAX;
} nds[1000000];
void fail() {
puts("IMPOSSIBLE");
exit(0);
}
vector<int> odr;
int inorder(int n, int nMax) {
int cn = n+1;
if (cn <= nds[n].L) cn = inorder(cn, n... | C++ | e683d660af1e8a98f20296f289aa8960 | 01723912bc8e270c37e54ced0ff486ac | 2,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define INPUT freopen("draft.inp","r",stdin)
#define OUTPUT freopen("draft.out","w",stdout)
#define FOR(i,l,r) for(auto i=l;i<=r;i++)
#define REP(i,l,r) for(auto i=l;i<r;i++)
#define FORD(i,l,r) for(auto i=l;i>=r;i--)
#define REPD(i,l,r) f... | C++ | e683d660af1e8a98f20296f289aa8960 | 5c30b8ee908f91b244229aaae3048e41 | 2,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<int(b);i++)
int N, C;
struct node {
int max, L = INT_MIN, R = INT_MAX;
} nds[1000000];
void fail() {
puts("IMPOSSIBLE");
exit(0);
}
vector<int> odr;
int inorder(int n, int nMax) {
int cn = n+1;
if (cn <= nds[n].L) cn = inorder(cn, n... | C++ | e683d660af1e8a98f20296f289aa8960 | 8b71a454ca05fa4f317defc405353e67 | 2,400 | PASSED |
#include<cstdio>
#include<algorithm>
using namespace std;
int n, w[60], vis[60], P[60], UF[60];
long long D[60], INF = 1e18+123, F[60];
int Find(int a) {
if (a == UF[a])return a;
return UF[a] = Find(UF[a]);
}
long long Calc(int m) {
int i, cnt = 0, j;
for (i = 1; i <= n; i++)vis[i] = 0;
for (i = 1; i <= m; i++) {
... | C++ | d3580f1d7406740acfc4f4343d1844e8 | 9881c9968ad632fd719676bcefa6dab0 | 2,700 | PASSED |
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int maxn=50+10;
int cc,p[maxn],last[maxn],first[maxn];
ll dp_cycles[maxn],dp_ways[maxn],factorial[maxn],inf=1e18+5;
ll mul(ll x,ll y){
ll ret=inf;
ret/=x;
ret/=y;
if(ret==0)return inf;
return x*y;
}
ll add(ll ... | C++ | d3580f1d7406740acfc4f4343d1844e8 | 370854ec0ad2dae97872c27739dae442 | 2,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long double INF = 1e18;
long double fact[51];
long double dp[51];
vector<int> solve(int N, ll K) {
if (N == 0) return {};
long double sum = 0;
int x;
for (x = 1; x <= N; x++) {
if (x == 1) {
if (dp[N - 1] >... | C++ | d3580f1d7406740acfc4f4343d1844e8 | 8e434dcff48bba09dfd4aa6ccf64b72b | 2,700 | PASSED |
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second
using namespace std;
typedef long long ll;
const ll INF = (ll) 1e18;
ll fact[55], dp[55];
bool used[55], head[55], tail[55];
int answer[55];
vector <int> get_permut(ll num, int len)
{
for (int i = 1; i <= len; i++... | C++ | d3580f1d7406740acfc4f4343d1844e8 | 52e013b25f879f8e794850537f54d6a9 | 2,700 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 2e18;
const int MAX_N = 55;
ll dp[MAX_N], cycle[MAX_N];
ll mult(ll a, ll b) {
long double tmp = a;
tmp *= b;
if ( tmp > INF) return INF;
return a * b;
}
ll add(ll a, ll b) {
long double tmp = a;
tmp += b;
if ( tmp > INF) return ... | C++ | d3580f1d7406740acfc4f4343d1844e8 | 6d1c42cdb146e82e80899a2e9cf0b206 | 2,700 | PASSED |
#include <bits/stdc++.h>
#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <... | C++ | d3580f1d7406740acfc4f4343d1844e8 | c73635d5c556cca938d0fc2d9f760247 | 2,700 | PASSED |
/*
Author: Nguyen Tan Bao
Status:
Idea:
*/
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i... | C++ | d3580f1d7406740acfc4f4343d1844e8 | f1a0b4d9cd1c237b30db6a1624c69c71 | 2,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#undef LOCAL
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool x) { return (x ? "T" : "F"); }
string to_string(const char* s) { return to_string((string)s); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string... | C++ | d3580f1d7406740acfc4f4343d1844e8 | 205819a825a6bfc676dd9d061f95031d | 2,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const long long INF = (1e18) + 1e17;
struct InfNum {
long long v;
InfNum() : v(0) {}
InfNum(long long v_) : v(v_) { if (v > INF) v = INF; }
};
InfNum operator + (InfNum a, InfNum b) {
return min(INF, a.v + b.v);
}
InfNum operator * (InfNum a, InfNum b) {
if (a.v ==... | C++ | d3580f1d7406740acfc4f4343d1844e8 | a72d5ac00fdf5a1850fa4879594fe406 | 2,700 | PASSED |
/**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author Egor Kulikov
*/
#include <bits/stdc++.h>
using namespace std;
template<typename T>
class Vector : public vector<T> {
using parent = vector<T>;
public:
Vector() : parent() {}
explicit Vector(size_t ... | C++ | d3580f1d7406740acfc4f4343d1844e8 | 3595886e8ff695d9a48ed4a984d7ffb1 | 2,700 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[200020];
int main()
{
int n;
ll sum,val;
while(~scanf("%d%I64d",&n,&val))
{
sum=0;
for(int i=1;i<=n;i++)
{
scanf("%I64d",&a[i]);
sum+=a[i];
}
ll minn,maxn;
minn... | C++ | 2c51414eeb430ad06aac53a99ff95eff | 1e67b9a518034b6e6b450a0ada456265 | 1,600 | PASSED |
#include <bits/stdc++.h>
#define NMAX 200004
using namespace std;
/********************************************************/
/// INPUT / OUTPUT
ifstream f("input.in");
ofstream g("output.out");
/********************************************************/
/// GLOBAL DECLARATIONS
int n, dice[NMAX];
long long maxRollSum, ... | C++ | 2c51414eeb430ad06aac53a99ff95eff | 414f49c80860ced03f862a28612a272e | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
int const N = 200001;
int n, v[N];
ll a, s;
int main(){
#ifndef ONLINE_JUDGE
freopen("read.txt","r",stdin);
#endif
scanf("%d%lld", &n, &a);
set<int>x;
for(int i = 0; i<n; ++i){
scanf("%d... | C++ | 2c51414eeb430ad06aac53a99ff95eff | e106db3ade4a5f03e1e7fe556bf79924 | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define prior priority_queue
#define MOD 1000000007
#define INF64 (long long)1e18
#define INF (int)1e9
#define PI 3.1415926535897932384626433832795
#define ll long long
#define ld long double
#define ret retur... | C++ | 2c51414eeb430ad06aac53a99ff95eff | 9dba88ac4d815f173434c0baedd2b60b | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define prior priority_queue
#define MOD 1000000007
#define INF64 (long long)1e18
#define INF (int)1e9
#define PI 3.1415926535897932384626433832795
#define ll long long
#define ld long double
#define ret retur... | C++ | 2c51414eeb430ad06aac53a99ff95eff | f671dbb1a73f84554c853441018f71fd | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,a,d[200001],s=0,x,y;
cin>>n>>a;
for (long long i = 0; i < n; ++i)
{
cin>>d[i];
s+=d[i];
}
if (n==1)
cout<<s-1;
else
for (long long i = 0; i < n; ++i)
{
x=a-s+d[i]-1;y=d[i]-a+n-1;
if (x>=0&&y>=0)
cout<<x+y<<" ";
else if (x<0... | C++ | 2c51414eeb430ad06aac53a99ff95eff | 93bac829e15010adbe4f871fbd639796 | 1,600 | PASSED |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll n,a,s=0,num[200000];
cin>>n>>a;
for(ll i=0;i<n;i++){cin>>num[i]; s+=num[i];}
for(ll i=0;i<n;i++)
{
ll M=s-num[i],m=n-1,cnt=0;
ll x=a-m,y=a-M;
if(x<num[i])cnt+=num[i]-x;
if(y>1)cnt+=y-1;
... | C++ | 2c51414eeb430ad06aac53a99ff95eff | 4c3942db246ac78d55f48d44c71645cf | 1,600 | PASSED |
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define all(a) (a).begin(),(a).end()
#define X first
#define Y second
using namespace std;
const int N=2e5+5;
int d[N];
void solve()
{
int n,A; cin>>n>>A;
int s=0;
for(... | C++ | 2c51414eeb430ad06aac53a99ff95eff | 9396d5ec85537c6bf0443166769cfbd1 | 1,600 | PASSED |
#define _CRT_SECURE_NO_WARNINGS
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functio... | C++ | 2c51414eeb430ad06aac53a99ff95eff | 34ce85c9feaba6cb72b0582a25903edd | 1,600 | PASSED |
#include <bits/stdc++.h>
#define L(a) (int)((a).size())
#define sqr(x) ((x) * 1ll * (x))
#define vi vector<int>
#define mp make_pair
#define pub push_back
#define pob pop_back
#define ii pair<int, int>
#define vii vector <ii>
#define all(s) (s).begin(),(s).end()
#define fore(i, l ,r) for(int i = (int)l; i < (int)r; i+... | C++ | 2c51414eeb430ad06aac53a99ff95eff | eac586f4a68a840394e099469ff64051 | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef vector <vi> vvi;
typedef vector <ll> vll;
typedef vector <bool> vb;
#define f(i,j,n) for(int i=j;i<n;i++)
#define ff(i,j,n) for(int i=j;i>=n;i--)
#define pb push_back
#define mp make_pai... | C++ | 7925c949fa42cf93e8a901f9b371d7a3 | 9e25f4215a4361d475ed31a4d31ac643 | 2,100 | PASSED |
#include <iostream>
using namespace std;
#define MOD 1000000007
#define MAX 16
#define plus(a, b) a = (a+(b))%MOD
typedef long long ll;
ll n, k, i, j, a, b, c;
ll m[MAX][MAX] = {}, tmp[MAX][MAX] = {};
ll t[64][MAX][MAX] = {};
// pl = a*b
void mmul(ll pl[MAX][MAX], ll a[MAX][MAX], ll b[MAX][MAX]) {
int r, c, i;
... | C++ | 7925c949fa42cf93e8a901f9b371d7a3 | 51029d0ca625c47e82a76953bb3a1361 | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define INF 0x3f3f3f3fLL
typedef long long ll;
const ll mod = 1e9 + 7;
#define int long long
int a[105], b[105], c[105];
struct Martix{
ll a[20][20];
void print(int n){
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++) co... | C++ | 7925c949fa42cf93e8a901f9b371d7a3 | 83b1bad90eb8bd6ed53e95b97b63eb81 | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007LL;
typedef vector<vector<int> > matrix;
typedef vector<int> row;
matrix getMatrix(int size) {
matrix res(size, row(size));
for(int i = 0; i < size; ++i)
for(int j = 0; j < size; ++j)
res[i][j] = (abs(i - j) <= 1 ? 1 : 0);
return ... | C++ | 7925c949fa42cf93e8a901f9b371d7a3 | da62baa5171a5df3b7b2b794106b6378 | 2,100 | PASSED |
#define DM 16
#define MD 1000000007
#include <iostream>
using namespace std;
long long n, a, b, c, k;
long long aux[DM][DM], m1[DM][DM], m2[DM][DM];
void inmultire(long long x[][DM], long long y[][DM])
{
for (int i = 0; i < DM; ++i)
for (int j = 0; j < DM; ++j)
{
aux[i][j] = 0;
for (int l = 0; l < DM; ++l)... | C++ | 7925c949fa42cf93e8a901f9b371d7a3 | 6fe54fd640fd533fa30c68a1aef29bad | 2,100 | PASSED |
#include <cstdio>
#include <queue>
#include <cstring>
#include <algorithm>
using namespace std;
long long rd()
{
long long x = 0;
char c = getchar();
while (c > '9' || c < '0') c = getchar();
while (c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
return x;
}
const int P = 1e9 + 7;
struct Martix
... | C++ | 7925c949fa42cf93e8a901f9b371d7a3 | 045319edaecbeeee18bd6b520d431287 | 2,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll n,k,a,b,c;bool okabe;
ll reads()
{
ll x=0;char c=getchar();
while (c>'9'||c<'0') c=getchar();
while (c>='0'&&c<='9') x=x*10+c-48,c=getchar();
return x;
}
struct juzhen
{
ll m[18][18];
juzhen(){memset(m,0,sizeof(m));}
}answer,e;
... | C++ | 7925c949fa42cf93e8a901f9b371d7a3 | 1e7f3869da479ac50e60b6e962264f9f | 2,100 | PASSED |
#include <iostream>
#include <cassert>
#include <vector>
using namespace std;
using ll = long long;
int const nmax = 16;
int const modulo = 1000000007;
class Matrix{
//indexed from 1
private:
int n, m;
using ll = long long;
public:
vector<vector<int>> mat;
Matrix(int n, int m){
this->n = n;
this->m =... | C++ | 7925c949fa42cf93e8a901f9b371d7a3 | 23b7dac8a28ac551c6ba2a57b18ce41b | 2,100 | PASSED |
#include <iostream>
#include <cassert>
using namespace std;
#define ll long long
int const nmax = 16;
int const modulo = 1000000007;
struct Matrix{
int n , m;
int v[5 + nmax][5 + nmax];
void clearmat(){
for(int i = 0 ; i <= nmax ;i++){
for(int j = 0 ; j <= nmax ;j++){
v[i][j] = 0;
}
... | C++ | 7925c949fa42cf93e8a901f9b371d7a3 | ec0bcc1210b1e2ee5657d41ce3eb8034 | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
typedef vector<vector<long long>> Matrix;
Matrix operator *(const Matrix &a, const Matrix &b) {
assert(a[0].size() == b.size());
Matrix res(a.size(), vector<long long>(b.size(), 0));
for(int i = 0; i < a.size(); i++) {
fo... | C++ | 7925c949fa42cf93e8a901f9b371d7a3 | e746352cffa9e1c9165e0fbc983e32d9 | 2,100 | PASSED |
arr =[]
test_cases =int(input(''))
for x in range(test_cases):
a=[]
a = list(map(int,input().split()))
arr.append(a)
for t in range(test_cases):
x=arr[t][0]
y=arr[t][1]
a=arr[t][2]
b=arr[t][3]
if abs(y-x)%(a+b)==0:
if abs(y-x)%(a+b)==0:
print (int((y-x)/(a+b)))
... | Python | 9afcf090806cc9c3b87120b1b61f8f17 | 964ed75e9176ed9bbcd4caa596b89c05 | 800 | PASSED |
x = int(input())
lst = []
for i in range(x):
lst.append(input())
for i in lst:
a = list(map(int,i.split()))
distance = a[1]-a[0]
foot = a[2]+a[3]
if distance%foot!=0:
print(-1)
else:
print(distance//foot)
| Python | 9afcf090806cc9c3b87120b1b61f8f17 | 5d979ec0a70a29beaf399ffeef2b1edc | 800 | PASSED |
t=int(input())
for i in range(t):
x,y,a,b=map(int,input().split())
y=y-x
if y%(a+b)==0:
print(y//(a+b))
else:
print("-1")
| Python | 9afcf090806cc9c3b87120b1b61f8f17 | 6ff8d9c042aee493fd0fc6f562f8c075 | 800 | PASSED |
t=int(input())
for _ in range(t):
x,y,a,b=map(int,input().split())
speed=a+b
if((y-x)%speed!=0):
print(-1)
else:
print((y-x)//speed) | Python | 9afcf090806cc9c3b87120b1b61f8f17 | ab59bbba83ccfc7c14c948118ea29991 | 800 | PASSED |
exec(int(input())*'x,y,a,b=map(int,input().split());y-=x;a+=b;print((y//a,-1)[y%a>0]);') | Python | 9afcf090806cc9c3b87120b1b61f8f17 | 5d30b63c4b4ba87db6ebe20250d93861 | 800 | PASSED |
n=int(input())
for i in range(n):
x,y,a,b=map(int,input().split())
if (x-y)%(a+b)==0:
print((y-x)//(a+b))
else:
print(-1) | Python | 9afcf090806cc9c3b87120b1b61f8f17 | 4e463cc3d648c1dd345b17a2a4e936c6 | 800 | PASSED |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 1 23:47:08 2020
@author: SAIGANESH
"""
t=int(input())
for _ in range(t):
x,y,a,b=map(int,input().split())
y-=x
a+=b
print((y//a,-1)[y%a>0]) | Python | 9afcf090806cc9c3b87120b1b61f8f17 | fa37ea479b4e3dec75b1e5bca5483321 | 800 | PASSED |
def main(x, y, a, b):
t = (y - x) / (a + b)
return int(t) if t.is_integer() else -1
if __name__ == '__main__':
n = int(input())
for _ in range(n):
print(
main(
*map(int, input().split())
)
)
'''
x + t * a = y - t * b
t * a + t * b = y - x
t * (a... | Python | 9afcf090806cc9c3b87120b1b61f8f17 | ac7584006f08568ed850b40d06ee9d9a | 800 | PASSED |
for _ in range(int(input())):
x,y,a,b = map(int,input().split())
v = y-x
u = a+b
if v % u !=0:
print(-1);
else:
print((v)//(u)) | Python | 9afcf090806cc9c3b87120b1b61f8f17 | 69dd627c2e71377a7cdc0288863da0cd | 800 | PASSED |
n_test_cases = input()
for i in range(int(n_test_cases)):
x, y, a, b = input().split()
x, y, a, b = int(x), int(y), int(a), int(b)
t = (y-x)//(b+a)
if x+a*t == y-b*t:
print(t)
else:
print(-1) | Python | 9afcf090806cc9c3b87120b1b61f8f17 | d35e9dbbf8d523e5aa7667aeba15a735 | 800 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.