Problem:


Score : 100 points

Problem Statement

There are S sheep and W wolves.

If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.

If the wolves will attack the sheep, print unsafe; otherwise, print safe.

Constraints

1 \leq S \leq 100

1 \leq W \leq 100

Input

Input is given from Standard Input in the following format:

S W

Output

If the wolves will attack the sheep, print unsafe; otherwise, print safe.

Sample Input 1

4 5

Sample Output 1

unsafe

There are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.

Sample Input 2

100 2

Sample Output 2

safe

Many a sheep drive away two wolves.

Sample Input 3

10 10

Sample Output 3

unsafe



Sample input:
4 5


Sample output:
unsafe

Submission status: Runtime Error

Solution code:
S = int(input())
W = int(input())
if W >= S:
  print("unsafe")
else:
  print("safe")

Submission status: Runtime Error

Solution code:
S = int(input())
W = int(input())
if S > W:
  print("safe")
else:
  print("unsafe")

Submission status: Runtime Error

Solution code:
S=int(input())
W=int(input())
if W>=(S):
    print('Unsafe')
else:
    print('Safe')

Submission status: Runtime Error

Solution code:
from collections import Counter
N = list(input())
M = [0]
S = 0
K = 1
ans = 0

for i in range(len(N)):
    S += int(N[-i-1])*K
    S %= 2019

    K *= 10
    K %= 2019
    M.append(S)

P = Counter(M)
for i in range(2020):ans+=P[i]*(P[i]-1)//2
print(ans)

Submission status: Runtime Error

Solution code:
A,B,C,D= map(int, input().split())
while (True):
    C = C - B
    if ( C <= 0 ):
        result = "Yes"
        break
    A = A - D
    if ( A <= 0 ) :
        result = "No"
        break
print ( result )

Submission status: Runtime Error

Solution code:
n = len(s)
cou = [0 for i in range(n+1)]
cou[1]= s[-1]
coum = [0 for i in range(2019)]
for i in range(1,n):
  cou[i+1] = s[n-i-1]+ str(cou[i])
  a = int(cou[i+1])
  coum[a%2019] += 1
coum[0] += 1
coum[int(s[-1])]+= 1
ans = 0
for i in coum:
    ans += i*(i-1)*0.5
print(int(ans))

Submission status: Runtime Error

Solution code:
S, W = map(int, input().split())
if W >= S:
    print("unsafe")
else:
    print("safe")S, W = map(int, input().split())
if W >= S:
    print("unsafe")
else:
    print("safe")

Submission status: Runtime Error

Solution code:
S,W = map(int,input())

if W >= S:
    print("unsafe")
else:
    print("safe")

Submission status: Runtime Error

Solution code:
S,W=map(int,intput().split())
if S<=W:
  print("unsafe")
else:
  print("safe")

Submission status: Runtime Error

Solution code:
S, W = (int(x) for in input().split())
if W>=S:
  print("unsafe")
else:
  print("safe")

Submission status: Runtime Error

Solution code:
s,w = map(int,input().split())
if s <= w:
    print(unsafe)
else:
    print(safe)

Submission status: Runtime Error

Solution code:
S = int(input())
W = int(input())
if W >= S:
    print('unsafe')
else:
    print('safe')

Submission status: Runtime Error

Solution code:
S =  int(input('How many sheep'))
W =  int(input('How many wolf'))
if W >= S:
    print('unsafe')
else:
    print('safe')

Submission status: Runtime Error

Solution code:
A,B=map(int,input().split())
print("safe" if S>W else "unsafe")

Submission status: Runtime Error

Solution code:

S,W = map(int, input().split())

if W => S:
    print('unsafe')
else:
    print('safe')

Submission status: Runtime Error

Solution code:
import pandas as pd
import numpy as np
/
train=pd.read_csv("train.csv")
test=pd.read_csv("test.csv")
/
df=pd.concat([train,test])
df
/
X=train.iloc[:,1:-1]
Y=train.iloc[:,-1]

X=(X-df.iloc[:,1:-1].mean())/df.iloc[:,1:-1].std(ddof=0)

X.head()
/
from sklearn.model_selection import train_test_split

X_train,X_test,y_train,y_test=train_test_split(X,Y,test_size=0.4,random_state=3)
/
for i in range(len(X_test)):
    #print(X_test.iloc[i,:])
    for j in range(len(X_train)):
        #print(j)
        temp=[(X_test.iloc[i,k]-X_train.iloc[j,k])**2 for k in range(len(X_test.columns))]
        #print(temp)

Submission status: Runtime Error

Solution code:
NUM = list(map(int,input().split))

if(NUM[0] >= NUM[1]):
  print("unsafe")
elif(NUM[0] < NUM[1]):
  print("safe")

Submission status: Runtime Error

Solution code:
a = input().spolit()

if int(a[0]) > int(a[1]):
  print("safe")
else:
  print("unsafe")

Submission status: Runtime Error

Solution code:
s = int(input())
w = int(input())
if s < w :
    print("unsafe")
else :
    print("safe")

Submission status: Runtime Error

Solution code:
print('safe' if int(input()) > int(input()) else 'unsafe')

Submission status: Runtime Error

Solution code:
import math
import collections
import fractions
import itertools
 
def solve():
    n = int(input())
    s = [input() for i in range(n)]
    print(len(set(s)))
    return 0
 
if __name__ == '__main__':
    solve()

Submission status: Runtime Error

Solution code:
n = int(input())
s = set(map(int,input().split()))
a = len(s)
print(a)

Submission status: Runtime Error

Solution code:
a, b, c, d = list(map(int, input().split()))
A = a - d
B = c - b
if A>=B:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#include <bits/stdc++.h>
using namespace std;

int main() {
    int s,w; cin >> s >> w;
    if (w >= s){
        cout << "unsafe\n";
    }
    else{
        cout << "safe\n";
    }
}

Submission status: Runtime Error

Solution code:
S , W = (int(a) for a in input().split())
if S <= W :
    prit("unsafe")
else : print("safe")

Submission status: Runtime Error

Solution code:
N = int(input())
S = []
for i in range(N):
    si = input()
    if si not in S:
        S = S + [si]
print(len(S))

Submission status: Runtime Error

Solution code:
N = int(input())
S = []
for i in range(N):
    si = input()
    S = S + [si]
print(len(set(S)))

Submission status: Runtime Error

Solution code:
s,w =map(input().split())
 
if s>w:
  print("safe")
else:
  print("unsafe")

Submission status: Runtime Error

Solution code:
s,w =map(input().stlip())

if s>w:
  print("safe")
else:
  print("unsafe")

Submission status: Runtime Error

Solution code:
S = input()
count = 0

if len(S)<=200000:
    for i in range(len(S)-4):
        for j in range(i+5, len(S)+1):
            tmp = int(S[i:j])
            if tmp%2019==0:
                count += 1

print(count)

Submission status: Runtime Error

Solution code:
S = input()
count = 0

for i in range(len(S)-3):
    for j in range(i+3, len(S)+1):
        tmp = int(S[i:j])
        if tmp%2019==0:
            print(i, j)
            count += 1

print(count)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main(){
	int s, w; cin >> s >> w;
	if(w >= s) cout << "unsafe\n";
	else cout << "safe\n";
}

Submission status: Runtime Error

Solution code:

S, W= map(int,input().split(""))

if S < W:
    print("unsafe")
else :
    print("safe")

Submission status: Runtime Error

Solution code:
s = int(input())
w = int(input())

print(["", "un"][w>=s] + "safe")

Submission status: Runtime Error

Solution code:
S=int(input())
W=int(input())
if W>=S:
  print("unsafe")
else:
  print("safe")

Submission status: Runtime Error

Solution code:
s,w = map(int,input().split)

if s<=w:
  print('unsafe')
else:
  print('safe')

Submission status: Runtime Error

Solution code:
s,w = map(int,split.input())


if s<=w:
  print('unsafe')
else:
  print('safe')

Submission status: Runtime Error

Solution code:
s = int(input())
w = int(input())

if s<=w:
  print('unsafe')
else:
  print('safe')

Submission status: Runtime Error

Solution code:
s == int(input())
w == int(input())

if s<=w:
  print('unsafe')
else:
  print('safe')

Submission status: Runtime Error

Solution code:
s = int(input())
w = int(input())

if w >= s:
  print("unsafe")
elif w < s:
  print("safe")

Submission status: Runtime Error

Solution code:

a,b,c,d = map(int,input().split())

while a>0 and c>0:
    if c-=b < 0:
        print('Yes')
        eixt()
    if a-=-d < 0:
        print('No')
        exit()

Submission status: Runtime Error

Solution code:
A, B, C, D = map(int,input().split())
ans = "Yes"
curA = A
curC = C
for i in range(max(A,C)):
  curC  = curC-B
  if(curC<=0):
    ans = "Yes"
    break
  curA = curA-D
  if(curA<=0):
    ans = "No"
    break
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
num_list = []

def leg_num(c, t):
    return 2*c+4*t

for i in range(1, 101):
    leg_num_list = []
    for j in range(i):
        if leg_num(j, i-j) <= 100:
            leg_num_list.append(leg_num(j, i-j))
        if leg_num(i-j, j) <= 100:
            leg_num_list.append(leg_num(i-j, j))
    num_list.append(leg_num_list)

x, y = map(int, input().split(" "))
if y in num_list[x]:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
S, W = list(map(int, input().split()))
if S < W :
    print(unsafe)
if S > W :
    print(safe)

Submission status: Runtime Error

Solution code:
s, w = map(int, input().strip().split(" "))
print(["safe", "unsafe"][s < w])

Submission status: Runtime Error

Solution code:
#include <CodeforcesSolutions.h>
#include <ONLINE_JUDGE <solution.cf(contestID = "1364",problemID = "A",method = "GET")>.h>
"""
    Author : thekushalghosh
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    s,w = invr()
    print("unsafe" if w >= s else "safe")
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    t = inp()
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
    return(q)

def power_two(n):
    if n == 1:
        return(True)
    sttr = str(n)
    len_str = len(sttr)
    sttr = list(sttr)
    num = 0
    if (len_str == 1 and sttr[len_str - 1] == '1'): 
        return(False)
    while (len_str != 1 or sttr[len_str - 1] != '1'):
        if ((ord(sttr[len_str - 1]) - ord('0')) % 2 == 1):
            return(False)
        j = 0; 
        for i in range(len_str):  
            num = num * 10 + (ord(sttr[i]) - ord('0')); 
            if (num < 2): 
                if (i != 0):  
                    sttr[j] = '0'
                    j += 1
                continue
  
            sttr[j] = chr((num // 2) + ord('0'))
            j += 1; 
            num = (num) - (num // 2) * 2
        len_str = j
    return(True)

def getLeftmostBit(n): 
    m = 0
    while (n > 1) : 
        n = n >> 1
        m += 1
    return(m)
def getNextLeftmostBit(n, m) : 
    temp = 1 << m 
    while (n < temp) : 
        temp = temp >> 1
        m -= 1
    return m
def bitcounter(n) :
    m = getLeftmostBit(n) 
    return _countSetBits(n, m) 
def _countSetBits(n, m) :
    if (n == 0) : 
        return 0
    m = getNextLeftmostBit(n, m)
    if (n == (1 << (m + 1)) - 1) : 
        return ((m + 1) * (1 << m))
    n = n - (1 << m)
    return (n + 1) + bitcounter(n) + m * (1 << (m - 1)) 

def log_two(n): 
    return(math.log(n) / math.log(2))

#-----------------------------------------------------------------------#
        
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
    
main()

Submission status: Runtime Error

Solution code:
a, b, c, d = map(int, input().split())
while True:
    c = c - b
    if c <= 0:
        print('Yes')
        break
    a = a - d
    if a <= 0:
        print('No')
        break

Submission status: Runtime Error

Solution code:
N = int(input())
S = []
for i in range(N):
    S.append(input())
print(set(S))

Submission status: Runtime Error

Solution code:
a = list(input())
a.reverse()
add = 0
ans = [1] + [0] * 2018
ans_int = 0

for i in range(len(a)):
    add = (add + int(a[i]) * 10 ** i) %2019
    if ans[add] == 1:
        ans_int += 1
        continue
    else:
        ans[add] = 1


print(ans_int)

Submission status: Runtime Error

Solution code:
S,W = int(input().split())
if S <= W:
    print('unsafe')
print('safe')

Submission status: Runtime Error

Solution code:
s = str(input())
count = 0
s_len = len(s)
for i in range(s_len - 4):
    for j in range(i + 4, s_len + 1):
        if int(s[i:j]) % 2019 == 0:
            count += 1
print(count)

Submission status: Runtime Error

Solution code:
a, b, c, d = map(int, input().split())

while True:
  c -= b
  if c <= 0:
    print("Yes")
    break
  a -= d
  if a <= 0:
    print("No")
    break

Submission status: Runtime Error

Solution code:
a, b, c, d = map(int, input().split())
print(a, b, c, d)

while True:
  c -= b
  if c <= 0:
    print("Yes")
    break
  a -= d
  if a <= 0:
    print("No")
    break

Submission status: Runtime Error

Solution code:
import math
A,B,C,D = map(int,input().split())
print("Yes" if (math.ceil(C/B) >= math.ceil(A/D)) else "No")

Submission status: Runtime Error

Solution code:
s , w = int(input())

if s > w:
  print("safe")
else:
  print("unsafe")

Submission status: Runtime Error

Solution code:
S,W=map(unt,input().split())
if S>W:
  print("safe")
else:
  print("unsafe")

Submission status: Runtime Error

Solution code:
a,b= map(int,imput().split())
c = 'unsafe'
if a>b:
  c = 'safe'
print(c)

Submission status: Runtime Error

Solution code:
A, B, C, D = map(int, input().split())
flg = True
for i in range(2 * max(A, C) + 1):
    if i % 2 == 0:
        C -= B
        print('C: ', C)
        if C <= 0:
            flg = False
            print('Yes')
    else:
        A -= D
        if A <= 0:
            flg = False
            print('No')
    if not flg:
        break

Submission status: Runtime Error

Solution code:
S = input()
print(sum([int(S[i:j])  % 2019 == 0 for i in range(len(S)) for j in range(i, len(S) + 1) if i < j]))

Submission status: Runtime Error

Solution code:
A, B, C, D = map(int, input().split())
while A > 0 and C > 0:
  C -= B
  A -= D
print('Yes' if C <= 0 else 'No' )

Submission status: Runtime Error

Solution code:
s, w = map(int, input().split())
if w >= s:
print("unsafe")
else:
print("safe")

Submission status: Runtime Error

Solution code:
s, w = map(int, input().split())
if s > w:
  prtin('safe')
else:
  print('unsafe')

Submission status: Runtime Error

Solution code:
n,m=map(input,int().split())
if(n>m):
  print("safe")
else:
  print("unsafe")

Submission status: Runtime Error

Solution code:
a, b, c, d = map(int, input().split())
x = -(-c // b)
y = -(-a // d)
if x <= y:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
#include<iostream>
using namespace std;
int main(){
    int s,w;
    cin>>s>>w;
    if(s<=w){
        cout<<"unsafe\n";
    }
    else {
        cout<<"safe\n";
    }
    
}

Submission status: Runtime Error

Solution code:
s,w=input().split()
if s>w:
    print "safe"
else:
    print "unsafe"

Submission status: Runtime Error

Solution code:
s,w=map(int,raw_input().split())
if s>w:
    print "safe"
else:
    print "unsafe"

Submission status: Runtime Error

Solution code:
s,w=map(int,input().split())
if(s>w):
    print "safe"
else:
    print "unsafe"

Submission status: Runtime Error

Solution code:
   s,w=input().split()
s=int(s)
w=int(w)
if s>w:
    print("safe")
else:
    print("unsafe")

Submission status: Runtime Error

Solution code:
s,w=map(int.input().split());
if s<=w:
  print('unsafe');
else:
  print('safe');

Submission status: Runtime Error

Solution code:
s,w=map(int.input().split())
if s<=w:
  print('unsafe')
else:
  print('safe')

Submission status: Runtime Error

Solution code:
s,w=map(int.input().split());
if s<=w:
  print(unsafe);
else:
  print(safe);

Submission status: Runtime Error

Solution code:
s,w=map(int.input().split())
if s<=w:
  print(unsafe)
else:
  print(safe)

Submission status: Runtime Error

Solution code:
S = input()

ans = 0

## 4桁
for i in range(0, len(S)-3):
  for j in range(i+3, len(S)):
    #print(S[i:j+1])
    if int(S[i:j+1]) % 2019 == 0:
      ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
S, W = map(int, intput().split())

if S <= W:
  print('unsafe')
else:
  print('safe')

Submission status: Runtime Error

Solution code:
a , b = map(int,input().split())
if b>= a:
  print("safe")
elif :
  print("unsafe")

Submission status: Runtime Error

Solution code:
import itertools
s = input()
count = 0

for i,j in itertools.combinations(range(0,len(str(s))+1),2):
    if int(s[i:j]) % 2019 ==0:
        count +=1
    print(s[i:j])
print(count)

Submission status: Runtime Error

Solution code:
S,W = map(int,input,split)

if S <= W :
    print("unsafe")

else :
    print("safe")

Submission status: Runtime Error

Solution code:
S,W = amp(int,input,split)

if S <= W :
    print("unsafe")

else :
    print("safe")

Submission status: Runtime Error

Solution code:
S = input()
W = input()

S = int(S)
W = int(W)

if S <= W :
    print("unsafe")

else :
    print("safe")

Submission status: Runtime Error

Solution code:
#入力例全てOKだけど黄色#
S = input()
W = input()

S = int(S)
W = int(W)

if S <= W :
    print("unsafe")

elif S > W :
    print("safe")

Submission status: Runtime Error

Solution code:
S = input()
W = input()

S = int(S)
W = int(W)

if S <= W :
    print("unsafe")

elif S > W :
    print("safe")

Submission status: Runtime Error

Solution code:
S = input()
W = input()

if S <= W :
    print("unsafe")

elif S > W :
    print("safe")

Submission status: Runtime Error

Solution code:
S,W=int(input())
if S < W:
    print("safe")
else:
    print("unsafe")

Submission status: Runtime Error

Solution code:
s,w = int(input())

if s<=w:
  print("unsafe")
else:
  print("safe")

Submission status: Runtime Error

Solution code:
from collections import Counter
s = input()
n = len(s)
dp = [0]*(n+1)
mod = 2019
for i in range(n-1,-1,-1):
    dp[i] = (dp[i+1]+int(s[i])*pow(10,n-i-1,mod))%mod
c = Counter(dp)
ans = 0
for i in c.values():
    ans += i*(i-1)//2
print(ans)

Submission status: Runtime Error

Solution code:
s,w=map(int,input.split())
if w>=s:
  print("unsafe")
else:
  print("safe")

Submission status: Runtime Error

Solution code:
s,w=map(int,input().split())
if w>=s:
  print("unsafe")
 else:
  print("safe")

Submission status: Runtime Error

Solution code:
s,w =map(int(input().split()))
if s<=w:
  print('unsafe')
else:
  print('safe')

Submission status: Runtime Error

Solution code:
s,w = map(int,input())
print("unsafe" if s <= w else "safe")

Submission status: Runtime Error

Solution code:
Q = int(input())
for i in range(Q):
    S,W=[int(x) for x in input().split()]
    if W >= S:
        print('unsafe')
    else:
        print('safe')

Submission status: Runtime Error

Solution code:
wolves = int(input())
sheep = int(input())
if wolves >= sheep:
    print('unsafe')
else:
    print('safe')

Submission status: Runtime Error

Solution code:
for i in range(2):
    S, W = [int(x) for x in input().split()]
if W >= S:
    print('unsafe')
else:
    print('safe')

Submission status: Runtime Error

Solution code:
a,b=map(int,input().sprit())
if a<=b:
  print("unsafe")
else:
  print("safe")

Submission status: Runtime Error

Solution code:
a,b=map(int,input().sprit())
if a <=b:
  print("unsafe")
else:
  print("safe")

Submission status: Runtime Error

Solution code:
s,w = int(input())

if s <= w:
  print("unsafe")
else:
  print("safe")

Submission status: Runtime Error

Solution code:
N = int(input())
S = [input() for _ in range(N)]

print(len(set(S)))

Submission status: Runtime Error

Solution code:
A, B, C, D = map(int, input().split())
while 1:
  C -= B
  if C <= 0:
    print('Yes')
    break
  A -= D
  if A < 0:
     print('No')
     break

Submission status: Runtime Error

Solution code:
A, B, C, D = map(int, input().split())
while true:
  C -= B
  if C <= 0:
    print('Yes')
    break
  A -= D
  if A < 0:
     print('No')
      break

Submission status: Runtime Error

Solution code:
S, W = map(int, input().split())
if S < = W :
  print('unsafe')
else :
  print('safe')

Submission status: Runtime Error

Solution code:
main = do
    [s, w] <- (map (read :: String -> Int)).words <$> getLine
    if w >= s then putStrLn "unsafe"
    else putStrLn "safe"

Submission status: Runtime Error

Solution code:
A,B,C,D = map(int,input().split())
 
Takahashi = A
Aoki = C
 
while Takahashi >= 0 or Aoki >=0:
  Aoki -= B
  if Aoki <= 0:
    print('Yes')
    break
  Takahashi -= D
  if Takahashi <= 0:
    print('No')
    break

Submission status: Runtime Error

Solution code:
A,B,C,D = map(int,input().split())

Takahashi = A
Aoki = B

while Takahashi <= 0 or Aoki <=0:
  Aoki -= B
  if Aoki <= 0:
    print('Yes')
    break
  Takahashi -= D
  if Takahashi <= 0:
    print('No')
    break

Submission status: Runtime Error

Solution code:
S,W = map(int,input().split())

if s <= w:
  print('unsafe')
else:
  print('safe')

Submission status: Runtime Error

Solution code:
S = input()

result = []

for i in range(len(S) - 3):
    for j in range(i + 3, len(S)):
        if int(S[i:j+1]) % 2019 == 0:
            result.append([i + 1, j + 1])

print(len(result))

Submission status: Runtime Error

Solution code:
S = int(input())
W = int(input())
if W >= S:
  print('unsafe')
else:
  print('safe')

Submission status: Runtime Error

Solution code:
S = int(input())
W = int(input())
if W >= S:
	print('unsafe')
else:
	print('safe')

Submission status: Runtime Error

Solution code:
S=int()
W=int()
S=input()
W=input()

if S<=W:
    print("unsafe")
else:
    print("safe")

Submission status: Runtime Error

Solution code:
import sys
input=lambda: sys.stdin.readline().rstrip()
t=int(input())
for _ in range(t):
  c,d=map(int,input().split())
  XX=[int(i) for i in input().split()]
  Y=[]
  YY=[]
  X=[0]*c
  for i,x in enumerate(XX):
    if x>0:
      Y.append(x)
      X[i+1]=x
    else:
      YY.append((-x,i+1))

  Y.sort()
  Y=[0]+Y
  YY.sort()
  for x,i in YY:
    X[i]=Y[x-1]+1
    Y=Y[:x]+[Y[x-1]+1]+Y[x:]



  edge=[[] for i in range(c)]
  E=[0]*d
  for i in range(d):
    u,v=map(int,input().split())
    edge[u-1].append([v-1,i])
    edge[v-1].append([u-1,i])
  
  D=[[] for i in range(1000)]
  for i in range(1,c):
    D[X[i]].append(i)
  for i in range(1,1000):
    if not D[i]:
      continue
    else:
      for goal in D[i]:
        t_root=0
        dist=float("inf")
        t_ind=0
        for root,ind in edge[goal]:
          if X[root]<dist:
            t_root=root
            dist=X[root]
            t_ind=ind
        E[t_ind]=i-dist
  for i in range(d):
    if E[i]==0:
      E[i]=str(10**6)
    else:
      E[i]=str(E[i])
  ans=" ".join(E)
  print("Case #"+str(_+1)+": "+ans)

Submission status: Runtime Error

Solution code:
#Bです
import sys
input=lambda: sys.stdin.readline().rstrip()
t=int(input())
for _ in range(t):
  c,d=map(int,input().split())
  X=[0]+[-int(i) for i in input().split()]
  edge=[[] for i in range(c)]
  E=[0]*d
  for i in range(d):
    u,v=map(int,input().split())
    edge[u-1].append([v-1,i])
    edge[v-1].append([u-1,i])
  
  D=[[] for i in range(c)]
  for i in range(1,c):
    D[X[i]].append(i)
  for i in range(1,c):
    if not D[i]:
      continue
    else:
      for goal in D[i]:
        t_root=0
        dist=float("inf")
        t_ind=0
        for root,ind in edge[goal]:
          if X[root]<dist:
            t_root=root
            dist=X[root]
            t_ind=ind
        E[t_ind]=i-dist
  for i in range(d):
    if E[i]==0:
      E[i]=str(10**6)
    else:
      E[i]=str(E[i])
  ans=" ".join(E)
  print("Case #"+str(_+1)+": "+ans)

Submission status: Runtime Error

Solution code:
#Aです
import sys
input=lambda: sys.stdin.readline().rstrip()

def f(x,y):
  left,right=0,10**9
  while right-left>1:
    mid=(left+right)//2
    if x*mid+mid*(mid-1)//2<=y:
      left=mid
    else:
      right=mid
  return left

def f1(x,y):
  left,right=0,10**9
  while right-left>1:
    mid=(left+right)//2
    if x*mid+mid**2<=y:
      left=mid
    else:
      right=mid
  return left

def f2(x,y):
  left,right=0,10**9
  while right-left>1:
    mid=(left+right)//2
    if x*mid+mid*(mid+1)<=y:
      left=mid
    else:
      right=mid
  return left

t=int(input())
for _ in range(t):
  l,r=map(int,input().split())
  if l>=r:
    d=l-r
    ct=f(1,d)
    l-=ct*(ct+1)//2
    ct1=f1(ct,l)
    ct2=f2(ct,r)
    if ct1<=ct2:
      ans1=ct+2*ct1
      ans2=l-ct*ct1-ct1**2
      ans3=r-ct*ct1-ct1*(ct1+1)
    else:
      ans1=ct+2*ct2+1
      ans2=l-ct*(ct2+1)-(ct2+1)**2
      ans3=r-ct*ct2-ct2*(ct2+1) 
    print("Case #"+str(_+1)+": "+str(ans1)+" "+str(ans2)+" "+str(ans3))
  else:
    d=r-l
    ct=f(1,d)
    r-=ct*(ct+1)//2
    if l==r:
      ct1=f1(ct,l)
      ct2=f2(ct,r)
      if ct1<=ct2:
        ans1=ct+2*ct1
        ans2=l-ct*ct1-ct1**2
        ans3=r-ct*ct1-ct1*(ct1+1)
      else:
        ans1=ct+2*ct2+1
        ans2=l-ct*(ct2+1)-(ct2+1)**2
        ans3=r-ct*ct2-ct2*(ct2+1) 
      print("Case #"+str(_+1)+": "+str(ans1)+" "+str(ans2)+" "+str(ans3))
    
    else:
      ct1=f1(ct,r)
      ct2=f2(ct,l)
      if ct1<=ct2:
        ans1=ct+2*ct1
        ans3=r-ct*ct1-ct1**2
        ans2=l-ct*ct1-ct1*(ct1+1)
      else:
        ans1=ct+2*ct2+1
        ans3=r-ct*(ct2+1)-(ct2+1)**2
        ans2=l-ct*ct2-ct2*(ct2+1) 
      print("Case #"+str(_+1)+": "+str(ans1)+" "+str(ans2)+" "+str(ans3))

Submission status: Runtime Error

Solution code:
from math import ceil
A, B, C, D = map(int, input().split())
t_s = ceil(C/B)
a_s = ceil(A/D)

if ( t_s - a_s < 1 ):
  print("Yes")

else:
  print("No")

Submission status: Runtime Error

Solution code:
from math import ceil
A, B, C, D = map(int, input().split())

if (ceil(C/B)-1 <= ceil(A/D)):
  print("Yes")

else:
  print("No")

Submission status: Runtime Error

Solution code:
from math import ceil
A, B, C, D = map(int, input().split())

print(ceil(C/B) -1 ,ceil(A/D))
if (ceil(C/B) <= ceil(A/D)):
  print("Yes")

else:
  print("No")

Submission status: Runtime Error

Solution code:
# D
# Multiple of 2019

s = input()

d = len(s)

ans = 0

if d < 5:
    if int(s)%2019 == 0:
        print("1")
    else:
        print("0")
else:
    for j in range(4,d,1):
        for i in range(j-3):
            _tmp = int(s[i:j+1])
            if _tmp % 2019 == 0:
                ans +=1

    print(ans)

Submission status: Runtime Error

Solution code:
# A
# Sheep and Wolves

s w = map(int, input().split())

if s <= w:
    print("unsafe")
else:
    print("safe")

Submission status: Runtime Error

Solution code:
a,b,c,d=map(int,input().split())
while True:
  c-=b
  if c<=0:
    print('Yes')
    break
  a-=d
  if a<=0:
    print('No')
    break

Submission status: Runtime Error

Solution code:
s, w = map(int, input(),split())
if w > s:
  print("unsafe")
else:
  print("safe")

Submission status: Runtime Error

Solution code:
s, w = int(input()).split()
if w >= s:
  print("unsafe")
else:
  print("safe")

Submission status: Runtime Error

Solution code:
S = input()
n = len(S)
a = [0]*(n+1)
l = [0]*2019
t = pow(10, n-1)

a[0] = int(S)
l[a[0]%2019] += 1

for i in range(n):
    a[i+1] = a[i] - int(S[i])*t
    l[a[i+1]%2019] += 1
    t = t // 10

print(sum(map(lambda x: x*(x-1)//2, l)))

Submission status: Runtime Error

Solution code:
s, w = map(int, input().split())
if (s >= w):
    print(safe)
else:
    print(unsafe)

Submission status: Runtime Error

Solution code:
s, w = map(int, input().split())
if s > w:
    print(safe)
else:
    print(unsafe)

Submission status: Runtime Error

Solution code:
n = int(input())

l = []
for i in range(n):
  l.append(input())
  

L = []
for i in l:
  if i not in L:
    L.append(i)
 
print(len(L))

Submission status: Runtime Error

Solution code:
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
n = int(input())
ans = 0
c = defaultdict(lambda: 0)
for _ in n:
    s = input()
    if(s in c):
        ans += 1
        c[s] += 1
print(ans)

Submission status: Runtime Error

Solution code:
S,W = map(int, input().split())
if S > W:
    print(safe)
else:
    print(unsafe)

Submission status: Runtime Error

Solution code:
S,W = map(int,input().split())
if S > W: print(safe)
else: print(unsafe)

Submission status: Runtime Error

Solution code:
S,W = input()
if S > W: print(safe)
else: print(unsafe)

Submission status: Runtime Error

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S,W = map(int, readline())


if S > W:
  print('safe')
else:
  print('unsafe')

Submission status: Runtime Error

Solution code:
s, w = map(int, input())
if s <= w:
  print('unsafe')
else:
  print('safe')

Submission status: Runtime Error

Solution code:
N = input()
count=0
for i in range(len(N)+1):
  for j in range(i+1,len(N)+1):
    if(int(N[i:j])%3!=0):
      continue
    if(int(N[i:j])%673==0):
      count+=1

print(count)

Submission status: Runtime Error

Solution code:
[A, B, C, D] = list(map(int, input().split()))
X = A / D
Y = C / B
if (X - Y) > 1:
    print('Yes')
else:
    if Y > X:
        print('No')
    else:
        print('Yes')

Submission status: Runtime Error

Solution code:
S, W = map(int, input().split())
if W >= S:
    print('unsafe')
else:
    print('safe'

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())]
if a <= b:
  print("unsafe")
elif a > b:
  print("safe")

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())]
if a < b:
  print("unsafe")
else:
  print("safe")

Submission status: Runtime Error

Solution code:
S, W = int(map, input().split())

if S>W:
  print("safe")
else:
  print("unsafe")

Submission status: Runtime Error

Solution code:
n = input()
p=input()
p=p[0:-1]
if n==p:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N=int(input())
L=[input() for i in range(N)]
M=set(L)
print(len(M))

Submission status: Runtime Error

Solution code:
S, W = map(int, input().split())
    if S >= W:
        print('safe')
    else S < W:
      print('unsafe')

Submission status: Runtime Error

Solution code:
S, W = map(int, input().split())
    if S >= W:
        print('safe')
    else S < W
      print('unsafe')

Submission status: Runtime Error

Solution code:
S, W = map(int, input().split())
    if S >= W:
        print('safe')
    else:
      S < W
      print('unsafe')

Submission status: Runtime Error

Solution code:
S, W = map(int, input().split())
    if S >= W:
        print('safe')
    else:
      S < W:
      print('unsafe')

Submission status: Runtime Error

Solution code:
S,W = int(input())
    if S =< W:
        print('unsafe')
    else:
    S > W:
        print('safe')

Submission status: Runtime Error

Solution code:
S,W = input()
    if S < W:
        print('unsafe')
    else:
    S > W:
        print('safe')