text stringlengths 198 433k | conversation_id int64 0 109k |
|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T.
Let us change some of the characters in S so that T will be a substring of S.
At least how many characters do we need to change?
Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.
Constraints
* The lengths of S and T are each at least 1 and at most 1000.
* The length of T is at most that of S.
* S and T consist of lowercase English letters.
Input
Input is given from Standard Input in the following format:
S
T
Output
Print the minimum number of characters in S that need to be changed.
Examples
Input
cabacc
abc
Output
1
Input
codeforces
atcoder
Output
6
Submitted Solution:
```
s=input()
t=input()
lt=len(t)
x=lt
for i in range(len(s)-lt+1):
a=0
for j in range(lt):
if s[i+j]!=t[j]:
a+=1
x=min(x,a)
print(x)
```
Yes
| 11,400 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T.
Let us change some of the characters in S so that T will be a substring of S.
At least how many characters do we need to change?
Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.
Constraints
* The lengths of S and T are each at least 1 and at most 1000.
* The length of T is at most that of S.
* S and T consist of lowercase English letters.
Input
Input is given from Standard Input in the following format:
S
T
Output
Print the minimum number of characters in S that need to be changed.
Examples
Input
cabacc
abc
Output
1
Input
codeforces
atcoder
Output
6
Submitted Solution:
```
S = input()
T = input()
print(min([sum(map(lambda x:x[0]!=x[1], zip(S[i:i+len(T)],T))) for i in range(1+len(S)-len(T))]))
```
Yes
| 11,401 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T.
Let us change some of the characters in S so that T will be a substring of S.
At least how many characters do we need to change?
Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.
Constraints
* The lengths of S and T are each at least 1 and at most 1000.
* The length of T is at most that of S.
* S and T consist of lowercase English letters.
Input
Input is given from Standard Input in the following format:
S
T
Output
Print the minimum number of characters in S that need to be changed.
Examples
Input
cabacc
abc
Output
1
Input
codeforces
atcoder
Output
6
Submitted Solution:
```
S,T=input(),input()
res=n=len(T)
m=len(S)
for i in range(m-n+1):
c = 0
for k in range(n):
if S[i+k]!=T[k]:
c+=1
res=min(res,c)
print(res)
```
Yes
| 11,402 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T.
Let us change some of the characters in S so that T will be a substring of S.
At least how many characters do we need to change?
Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.
Constraints
* The lengths of S and T are each at least 1 and at most 1000.
* The length of T is at most that of S.
* S and T consist of lowercase English letters.
Input
Input is given from Standard Input in the following format:
S
T
Output
Print the minimum number of characters in S that need to be changed.
Examples
Input
cabacc
abc
Output
1
Input
codeforces
atcoder
Output
6
Submitted Solution:
```
s=input()
t=input()
ans=10**7
for i in range(len(s)-len(t)+1):
ansi=0
for j in range(len(t)):
if s[i+j]!=t[j]:
ansi+=1
ans=min(ans,ansi)
print(ans)
```
Yes
| 11,403 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T.
Let us change some of the characters in S so that T will be a substring of S.
At least how many characters do we need to change?
Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.
Constraints
* The lengths of S and T are each at least 1 and at most 1000.
* The length of T is at most that of S.
* S and T consist of lowercase English letters.
Input
Input is given from Standard Input in the following format:
S
T
Output
Print the minimum number of characters in S that need to be changed.
Examples
Input
cabacc
abc
Output
1
Input
codeforces
atcoder
Output
6
Submitted Solution:
```
s = input()
t = input()
ls = len(s)
lt = len(t)
a = []
sum_ = 0
for i in range(ls-lt+1):
ss = s[i:i+lt]
sum_ = 0
for i, alb in enumerate(lt):
if alb == ss[i]:
sum_+= 1
a.append(sum_)
print(lt - max(a))
```
No
| 11,404 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T.
Let us change some of the characters in S so that T will be a substring of S.
At least how many characters do we need to change?
Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.
Constraints
* The lengths of S and T are each at least 1 and at most 1000.
* The length of T is at most that of S.
* S and T consist of lowercase English letters.
Input
Input is given from Standard Input in the following format:
S
T
Output
Print the minimum number of characters in S that need to be changed.
Examples
Input
cabacc
abc
Output
1
Input
codeforces
atcoder
Output
6
Submitted Solution:
```
S = input()
T = input()
min_count = len(T)
for s_i in range(len(S)):
i = s_i
matched = 0
for j in range(len(T)):
i += 1
if len(S) <= i: # Out of S
matched = 0 # Cannot append characters to S
break
if S[i] == T[j]:
matched += 1
count = len(T) - matched
if count < min_count:
min_count = count
print(min_count)
```
No
| 11,405 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T.
Let us change some of the characters in S so that T will be a substring of S.
At least how many characters do we need to change?
Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.
Constraints
* The lengths of S and T are each at least 1 and at most 1000.
* The length of T is at most that of S.
* S and T consist of lowercase English letters.
Input
Input is given from Standard Input in the following format:
S
T
Output
Print the minimum number of characters in S that need to be changed.
Examples
Input
cabacc
abc
Output
1
Input
codeforces
atcoder
Output
6
Submitted Solution:
```
s=list(input())
t=list(input())
n=len(t)
m=len(s)
for i in range(n):
l=n-i
for j in range(i+1):
if ''.join(t[j:j+l]) in ''.join(s[j:j+m-i]):
print(i)
exit()
print(n)
```
No
| 11,406 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given are two strings S and T.
Let us change some of the characters in S so that T will be a substring of S.
At least how many characters do we need to change?
Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.
Constraints
* The lengths of S and T are each at least 1 and at most 1000.
* The length of T is at most that of S.
* S and T consist of lowercase English letters.
Input
Input is given from Standard Input in the following format:
S
T
Output
Print the minimum number of characters in S that need to be changed.
Examples
Input
cabacc
abc
Output
1
Input
codeforces
atcoder
Output
6
Submitted Solution:
```
S = input()
T = input()
ans = len(T)
for i in range(len(S)):
for s,t in zip(S[i:i+len(T)],T):
tmp = len(T)
if t == s:
tmp -= 1
ans = min(ans,tmp)
else:
print(ans)
```
No
| 11,407 |
Provide a correct Python 3 solution for this coding contest problem.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
"Correct Solution:
```
s = input()
n = 0
ans = 0
mods = [0]*2019
mods[0] = 1
for i, j in enumerate(reversed(s)):
n += int(j)*pow(10, i, 2019)
n %= 2019
mods[n] += 1
for i in mods:
ans += i*(i-1)//2
print(ans)
```
| 11,408 |
Provide a correct Python 3 solution for this coding contest problem.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
"Correct Solution:
```
S=input()
ans,n=0,len(S)
dp=[0]*(2019)
s,dp[0],k=0,1,1
for i in range(1,n+1):
s=(s+int(S[-i])*k)%2019
k=(k*10)%2019
ans+=dp[s]
dp[s]+=1
print(ans)
```
| 11,409 |
Provide a correct Python 3 solution for this coding contest problem.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
"Correct Solution:
```
S=input()
p=2019
h=0
d=1
t=0
c=[0]*p
c[0]=1
for s in reversed(S):
m=int(s)*d%p
h=(h+m)%p
t+=c[h]
c[h]+=1
d=d*10%p
print(t)
```
| 11,410 |
Provide a correct Python 3 solution for this coding contest problem.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
"Correct Solution:
```
mod = 2019
cnt = [0 for i in range(2019)]
cnt[0] = 1
x = 0
ten = 1
ans = 0
for s in input()[::-1]:
x = (x + int(s) * ten) % mod
ans += cnt[x]
cnt[x] += 1
ten *= 10
ten %= mod
print(ans)
```
| 11,411 |
Provide a correct Python 3 solution for this coding contest problem.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
"Correct Solution:
```
M=2019
S=input()+'0'
t = 1
p=0
mcnt = [0] * 2019
ans = 0
for x in S[::-1]:
dm = int(x) * t % M
am = (dm+p) % M
ans += mcnt[am]
mcnt[am]+=1
t=t*10%M
p=am
print(ans)
```
| 11,412 |
Provide a correct Python 3 solution for this coding contest problem.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
"Correct Solution:
```
s = input()
n = len(s)
m = 2019
a = 0
r = [0 for _ in range(m+1)]
r[0] = 1
z = 0
for i in range(0,n):
z = (int(s[n-i-1])*pow(10,i,m) + z)%m
a += r[z]
r[z] += 1
print(a)
```
| 11,413 |
Provide a correct Python 3 solution for this coding contest problem.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
"Correct Solution:
```
s = input()
n = len(s)
dp = [1] + [0]*2019
now = 0
i = 1
for c in reversed(s):
now = (now+i*int(c))%2019
dp[now] += 1
i = (i*10)%2019
ans = sum([i*(i-1)/2 for i in dp])
print(int(ans))
```
| 11,414 |
Provide a correct Python 3 solution for this coding contest problem.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
"Correct Solution:
```
n = input()
p = 2019
t = 1
y = 0
c = p*[0]
for x in map(int,n[::-1]):
y+=t*x
y%=p
c[y]+=1
t*=10
t%=p
print(sum(i*(i-1)//2 for i in c)+c[0])
```
| 11,415 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
Submitted Solution:
```
P=2019
S = input()
N=len(S)
count=[0]*P
ans = 0
count[0] = 1
u = 0
for i, s in enumerate(reversed(S)):
u = (int(s) * pow(10, i, P) + u) % P
ans += count[u]
count[u] += 1
print(ans)
```
Yes
| 11,416 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
Submitted Solution:
```
y=2019
a=[0]*y
k=1
r=p=0
for c in input()[::-1]:
a[p]+=1
p-=int(c)*k
p%=y
r+=a[p]
k*=10
k%=y
print(r)
```
Yes
| 11,417 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
Submitted Solution:
```
s=input()
d=[0]*2019
dp=0
d[0]+=1
l=len(s)
r=1
for i in range(l):
dp+=int(s[l-1-i])*r
dp%=2019
r*=10
r%=2019
d[dp]+=1
res=0
for a in d:
res+=a*(a-1)//2
print(res)
```
Yes
| 11,418 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
Submitted Solution:
```
s=input()[::-1]
ans=0
u=0
d=1
l=[0]*2019
l[0]=1
for i in map(int,s):
u=(u+i*d)%2019
l[u]+=1
d=d*10%2019
for i in l:
ans+=i*(i-1)//2
print(ans)
```
Yes
| 11,419 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
Submitted Solution:
```
# ABC164 D
def main():
s = input()
count = 0
#results = []
for i in range(len(s)-4):
for j in range(i+5, len(s)+1):
if int(s[i:j]) % 2019 == 0:
count += 1
#results.append((i+1,j))
print(count)
#print(len(s))
#print(results)
if __name__ == '__main__':
main()
```
No
| 11,420 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
Submitted Solution:
```
s=input()
n=0
for i in range(len(s)):
for j in range(i, len(s)):
if int(s[i:j+1])%2019==0:
n+=1
print(n)
```
No
| 11,421 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
Submitted Solution:
```
s = int(input())
str = str(s)
n = len(str)
cnt = 0
for i in range(4, n+1):
for j in range(n+1-i):
if (int(str[j:j+i])%2019 == 0):
cnt += 1
print(cnt)
```
No
| 11,422 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given is a string S consisting of digits from `1` through `9`.
Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:
Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.
Constraints
* 1 ≤ |S| ≤ 200000
* S is a string consisting of digits from `1` through `9`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.
Examples
Input
1817181712114
Output
3
Input
14282668646
Output
2
Input
2119
Output
0
Submitted Solution:
```
def countSubStr(str1, l, k):
count = 0
for i in range(l):
n = 0
# Take all sub-strings starting from i
for j in range(i, l, 1):
n = n * 10 + (ord(str1[j]) - ord('0'))
# If current sub-string is divisible by k
if (n % k == 0):
count += 1
# Return the required count
return count
# Driver code
str1 = str(input())
l = len(str1)
k = 2019
print(countSubStr(str1, l, k))
```
No
| 11,423 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
"Correct Solution:
```
import fractions
A,B=map(int,input().split())
f=A*B//fractions.gcd(A,B)
print(f)
```
| 11,424 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
"Correct Solution:
```
a,b=map(int,input().split())
import fractions as fr
print(int(a*b/fr.gcd(a,b)))
```
| 11,425 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
"Correct Solution:
```
import fractions
A,B=map(int,input().split())
a=fractions.gcd(A,B)
print((A * B) // a)
```
| 11,426 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
"Correct Solution:
```
import math
a, b= map(int,input().split())
d= math.gcd(a,b)
print(a*b//d)
```
| 11,427 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
"Correct Solution:
```
A,B = map(int,input().split())
x = A
y = B
while y>0:
x,y = y,x%y
print((A//x)*B)
```
| 11,428 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
"Correct Solution:
```
import math
A,B=map(int,input().split())
print(A*B//math.gcd(A,B))
```
| 11,429 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
"Correct Solution:
```
from math import gcd
a, b = map(int,input().split())
print(int(a * b / gcd(a, b)))
```
| 11,430 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
"Correct Solution:
```
import math
x, y = map(int,input().split())
print((x * y) // math.gcd(x, y))
```
| 11,431 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
Submitted Solution:
```
import fractions as fra
n,m=map(int,input().split())
print((n*m)//fra.gcd(n,m))
```
Yes
| 11,432 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
Submitted Solution:
```
import math
a,b=map(int,input().split())
ans=a*b//(math.gcd(a,b))
print(ans)
```
Yes
| 11,433 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
Submitted Solution:
```
import math
a,b=map(int,input().split());print((a*b)//math.gcd(a,b))
```
Yes
| 11,434 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
Submitted Solution:
```
import fractions
a,b=map(int,input().split())
g=fractions.gcd(a,b)
print(a*b//g)
```
Yes
| 11,435 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
Submitted Solution:
```
A, B = map(int, input().split(" "))
A_, B_ = A, B
common = 1
n_max = int(min(A,B)**0.5+1)
if A % B == 0:
print(B)
elif B % A == 0:
print(A)
else:
for n in range(2, n_max+1):
while True:
if (A_ % n == 0) and (B_ % n == 0):
common *= n
A_ = A_ // n
B_ = B_ // n
else:
break
print(common * A_ * B_)
```
No
| 11,436 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
Submitted Solution:
```
num = [int(s) for s in input().split()]
com = 1
tes = 2
if max(num)%min(num) == 0:
print(max(num))
else:
while tes < min(num)**0.5:
if min(num)%tes == 0 and max(num)%tes == 0:
com *= tes
num = [int(n/tes) for n in num]
else:
tes += 1
print(com*min(num)*max(num))
```
No
| 11,437 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
Submitted Solution:
```
l = input().split()
a = int(l[0])
b = int(l[1])
def gcd(ac, bc):
x = max(ac, bc)
y = min(ac, bc)
while x%y != 0:
z = x%y
x = y
y = z
else:
return z
print(a * b // gcd(a, b))
```
No
| 11,438 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.
We assume that a piece cannot be divided and distributed to multiple guests.
Constraints
* 1 \leq A, B \leq 10^5
* A \neq B
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
A B
Output
Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.
Examples
Input
2 3
Output
6
Input
123 456
Output
18696
Input
100000 99999
Output
9999900000
Submitted Solution:
```
import math
# 最小公倍数lcm( least common multiple)を返す関数は用意されていない
# が、lcm(a, b) = a * b / gcd(a, b)で求められる
A, B = map(int, input().split())
ans = A * B // math.gcd(A, B)
print(ans)
```
No
| 11,439 |
Provide a correct Python 3 solution for this coding contest problem.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
"Correct Solution:
```
N, M = map(int, input().split())
cost = 0
for A, B in sorted((tuple(map(int, input().split())) for i in range(N)), key=lambda p: p[0]):
bought = min(M, B)
cost += A * bought
M -= bought
print(cost)
```
| 11,440 |
Provide a correct Python 3 solution for this coding contest problem.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
"Correct Solution:
```
n, m = map(int, input().split())
d = [tuple(map(int, input().split())) for _ in range(n)]
d.sort()
ans = 0
for ai, bi in d:
if m <= bi:
ans += ai * m
break
ans += ai * bi
m -= bi
print(ans)
```
| 11,441 |
Provide a correct Python 3 solution for this coding contest problem.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
"Correct Solution:
```
n, m = map(int, input().split())
st = []
for _ in range(n):
st.append(tuple(map(int, input().split())))
st.sort()
i = 0
c = 0
while m > 0:
b = min(m, st[i][1])
c += b * st[i][0]
m -= b
i += 1
print(c)
```
| 11,442 |
Provide a correct Python 3 solution for this coding contest problem.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
"Correct Solution:
```
n,m=map(int,input().split())
drinks = sorted([list(map(int,input().split())) for _ in range(n)])
rest, res = m, 0
for i in range(n):
buy = min(rest, drinks[i][1])
res += buy * drinks[i][0]
rest -= buy
print(res)
```
| 11,443 |
Provide a correct Python 3 solution for this coding contest problem.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
"Correct Solution:
```
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[0])
ans = 0
bought = 0
for a, b in AB:
m = min(M - bought, b)
bought += m
ans += a * m
print(ans)
```
| 11,444 |
Provide a correct Python 3 solution for this coding contest problem.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
"Correct Solution:
```
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
ab.sort()
x = 0
c = 0
for a,b in ab:
if x+b <= m:
x += b
c += a*b
else:
c += a*(m-x)
break
print(c)
```
| 11,445 |
Provide a correct Python 3 solution for this coding contest problem.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
"Correct Solution:
```
n,m = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(n)]
A.sort()
ans = 0
cnt = 0
for a in A:
tmp = min(m-cnt,a[1])
ans += tmp*a[0]
cnt+=tmp
if cnt >= m:
break
print(ans)
```
| 11,446 |
Provide a correct Python 3 solution for this coding contest problem.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
"Correct Solution:
```
N,M = map(int,input().split())
D = sorted([list(map(int,input().split())) for n in range(N)])
ans = 0
num = 0
for a,b in D:
num+=b
ans+=a*b
if M<=num:
ans-=a*(num-M)
break
print(ans)
```
| 11,447 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
Submitted Solution:
```
N, M = map(int, input().split())
X = sorted([list(map(int,input().split())) for _ in range(N)])
m = 0
c = 0
for x in X:
c += x[0]*min(M-m, x[1])
m += min(M-m, x[1])
if m == M:
break
print(c)
```
Yes
| 11,448 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
Submitted Solution:
```
from collections import deque
n,m = map(int,input().split())
l =deque(sorted([list(map(int,input().split())) for i in range(n)]))
money = 0
while m!=0:
a,b = l.popleft()
t = min(b,m)
m -= t
money += a*t
print(money)
```
Yes
| 11,449 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
Submitted Solution:
```
n,m,*l=map(int,open(0).read().split());c=0
for a,b in sorted(zip(*[iter(l)]*2)):t=min(b,m);c+=a*t;m-=t
print(c)
```
Yes
| 11,450 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
Submitted Solution:
```
I = lambda: map(int, input().split())
n, m = I()
A = sorted([list(I()) for _ in range(n)])
c = p = 0
for a, b in A:
if c >= m: break
p += a*min(b, m-c)
c += b
print(p)
```
Yes
| 11,451 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
Submitted Solution:
```
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab.sort()
ans = 0
cnt = 0
i = 0
while cnt < m:
ans += ab[i][0]*ab[i][1]
cnt += ab[i][1]
i += 1
print(ans - (cnt - m)*ab[i][0])
```
No
| 11,452 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
Submitted Solution:
```
N, M = map(int, input().split())
shop_dic = {}
for _ in range(N):
a, b = map(int, input().split())
shop_dic[a] = b
total = 0
for a in sorted(shop_dic.keys()):
b = shop_dic[a]
if M <= b:
total += a * M
break
else:
total += a * min(b, M)
M -= min(b, M)
print(total)
```
No
| 11,453 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
Submitted Solution:
```
import numpy as np
N, M = map(int, input().split())
num_dict = dict()
A_list = []
for n in range(N):
A, B = map(int, input().split())
num_dict[A] = B
A_list.append(A)
A_list.sort()
b_accum = 0
all_pay = 0
for a in A_list:
if M <= b_accum:
break
if b_accum + num_dict[a] <= M:
all_pay += num_dict[a] * a
b_accum += num_dict[a]
else:
all_pay += (M - b_accum) * a
b_accum += num_dict[a]
print(all_pay)
```
No
| 11,454 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.
There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
What is the minimum amount of money with which he can buy M cans of energy drinks?
It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 10^5
* 1 \leq A_i \leq 10^9
* 1 \leq B_i \leq 10^5
* B_1 + ... + B_N \geq M
Input
Input is given from Standard Input in the following format:
N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N
Output
Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.
Examples
Input
2 5
4 9
2 4
Output
12
Input
4 30
6 18
2 5
3 10
7 9
Output
130
Input
1 100000
1000000000 100000
Output
100000000000000
Submitted Solution:
```
import sys
input = sys.stdin.readline
from collections import deque
def main():
N, M = map(int, input().split())
AB = [0] * N
for i in range(N):
AB[i] = list(map(int, input().split()))
AB = sorted(AB)
have = 0
price = 0
while M != have:
AB[0][1] -= 1
price += AB[0][0]
have += 1
if AB[0][1] == 0:
del AB[0]
print(price)
main()
```
No
| 11,455 |
Provide a correct Python 3 solution for this coding contest problem.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
"Correct Solution:
```
n,m,x,y=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
X.append(x)
Y.append(y)
print("No War" if max(X)<min(Y) else "War")
```
| 11,456 |
Provide a correct Python 3 solution for this coding contest problem.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
"Correct Solution:
```
N, M, X, Y = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if max(A + [X]) < min(B + [Y]):
print('No War')
else:
print('War')
```
| 11,457 |
Provide a correct Python 3 solution for this coding contest problem.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
"Correct Solution:
```
n,m,x,y=map(int,input().split())
xi=[int(_) for _ in input().split()]+[x]
yi=[int(_) for _ in input().split()]+[y]
print('War' if max(xi) >= min(yi) else 'No War')
```
| 11,458 |
Provide a correct Python 3 solution for this coding contest problem.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
"Correct Solution:
```
N,M,X,Y = map(int, input().split())
Z = max(map(int, input().split())) + 1
min_y = min(map(int, input().split()))
print("No War" if (X < Z) and (Z <= min_y) and (Z <= Y) else "War")
```
| 11,459 |
Provide a correct Python 3 solution for this coding contest problem.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
"Correct Solution:
```
N,M,X,Y=map(int,input().split())
x=map(int,input().split())
y=map(int,input().split())
z1=max(x)
z2=min(y)
print('No War' if min(z2,Y)>max(z1,X) else 'War')
```
| 11,460 |
Provide a correct Python 3 solution for this coding contest problem.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
"Correct Solution:
```
n,m,x,y = map(int,input().split())
print("No War" if max(max(list(map(int,input().split()))),x)<min(min(list(map(int,input().split()))),y)
else "War")
```
| 11,461 |
Provide a correct Python 3 solution for this coding contest problem.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
"Correct Solution:
```
n,m,x,y=map(int,input().split())
a=max(list(map(int,input().split())))
b=min(list(map(int,input().split())))
print("No War" if a<b and x<b and a<y else "War")
```
| 11,462 |
Provide a correct Python 3 solution for this coding contest problem.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
"Correct Solution:
```
a,b,x,y=map(int,input().split())
print(['War','No War'][sorted([x]+[int(i) for i in input().split()])[-1]<sorted([y]+[int(i) for i in input().split()])[0]])
```
| 11,463 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
Submitted Solution:
```
I=lambda:map(int,input().split())
N,M,X,Y=I()
print("No War"if max(list(I())+[X])<min(list(I())+[Y]) else"War")
```
Yes
| 11,464 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
Submitted Solution:
```
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
print('No War' if max(max(x),X)<min(min(y),Y) else 'War')
```
Yes
| 11,465 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
Submitted Solution:
```
x,y=input().split()[2:];print('No '*(max(map(int,input().split()+[x]))<min(map(int,input().split()+[y])))+'War')
```
Yes
| 11,466 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
Submitted Solution:
```
N, M, X, Y = map(int, input().split())
A = [X] + [int(x) for x in input().split()]
B = [Y] + [int(x) for x in input().split()]
print('No War' if max(A) < min(B) else 'War')
```
Yes
| 11,467 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
Submitted Solution:
```
N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
if max(x)>min(y):
print("No War")
else:
print("War")
```
No
| 11,468 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
Submitted Solution:
```
N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
if X<Y or max(x)>min(y):
print("No War")
else:
print("War")
```
No
| 11,469 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
Submitted Solution:
```
_,b,c,d,*e=map(int,open(0).read().split())
print((len(set(range(max(e[:b]),min(e[b:])+1))&set(range(c,d+1)))>0)*"No "+"War")
```
No
| 11,470 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
* X < Z \leq Y
* x_1, x_2, ..., x_N < Z
* y_1, y_2, ..., y_M \geq Z
Determine if war will break out.
Constraints
* All values in input are integers.
* 1 \leq N, M \leq 100
* -100 \leq X < Y \leq 100
* -100 \leq x_i, y_i \leq 100
* x_1, x_2, ..., x_N \neq X
* x_i are all different.
* y_1, y_2, ..., y_M \neq Y
* y_i are all different.
Input
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M
Output
If war will break out, print `War`; otherwise, print `No War`.
Examples
Input
3 2 10 20
8 15 13
16 22
Output
No War
Input
4 2 -48 -1
-20 -35 -91 -23
-22 66
Output
War
Input
5 3 6 8
-10 3 1 5 -100
100 6 14
Output
War
Submitted Solution:
```
(n, m, x, y) = list(map(int, input().split()))
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
xs.sort()
ys.sort()
#print(n, m, x, y)
#print(xs)
#print(ys)
z = ys[0]
if(z < xs[-1]):
print("War")
elif(x < z and z <= y):
print("No War")
else:
print("War")
```
No
| 11,471 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
"Correct Solution:
```
a, b = map(int, input().split())
print(41, 100)
for _ in range(10):
for _ in range(50):
print('.', end='')
if b>1:
print('#', end='')
b -= 1
else:
print('.', end='')
print()
print('.'*100)
print('#'*100)
for _ in range(10):
for _ in range(50):
print('#', end='')
if a>1:
print('.', end='')
a -= 1
else:
print('#', end='')
print()
print('#'*100)
```
| 11,472 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
"Correct Solution:
```
a, b = map(int, input().split())
a -= 1
b -= 1
ans = [["#" for _ in range(90)] for _ in range(40)] + [["." for _ in range(90)] for _ in range(40)]
pos = 0
for i in range(a):
x = pos % 90
y = (pos // 90) * 2
ans[y][x] = "."
pos += 2
pos = 0
for j in range(b):
x = pos % 90
y = 45 + (pos // 90) * 2
ans[y][x] = "#"
pos += 2
print(80, 90)
for row in ans:
print("".join(row))
```
| 11,473 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
"Correct Solution:
```
# editorial参照
# 格子まで詰め込もうとしたのが困難
# 十分大きい黒白の塊一つに孤立した白黒の点を取る
a,b = map(int, input().split( ))
k=50
W = [["."]*(k*2) for i in range(k)]
B = [["#"]*(k*2) for i in range(k)]
for i in range(b-1):
h = (i//k)*2
w = (i%k)*2
W[h][w]="#"
for i in range(a-1):
h = (i//k)*2+1
w = (i%k)*2+1
B[-h][-w]="."
ans = [''.join(W[i]) for i in range(k)]+ [''.join(B[i]) for i in range(k)]
print(100,100)
print('\n'.join(ans))
```
| 11,474 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
"Correct Solution:
```
A,B = list(map(int,input().split()))
QA=(A-1)//50
QB=(B-1)//50
RA=(A-1)%50
RB=(B-1)%50
def PRINTw(x): #x個の白1黒3ブロック
for j in range(x):
print(".#",end="")
for j in range(50-x):
print("##",end="")
print()
for j in range(100):
print("#",end="")
print()
def PRINTb(x): #x個の白3黒1ブロック
for j in range(100):
print(".",end="")
print()
for j in range(x):
print(".#",end="")
for j in range(50-x):
print("..",end="")
print()
print("40 100")
for i in range(QA):
PRINTw(50)
PRINTw(RA)
for i in range(10-(QA+1)):
PRINTw(0)
for i in range(QB):
PRINTb(50)
PRINTb(RB)
for i in range(10-(QB+1)):
PRINTb(0)
```
| 11,475 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
"Correct Solution:
```
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
"""
1 <= A, B <= 1659まで対応してるよ
"""
A, B = inpl()
L = [["."]*50 for i in range(100)]
R = [["#"]*50 for i in range(100)]
def plot(R):
print("\n".join(["".join(r) for r in R]))
count = 0
for i in range(98):
for j in range(16):
if count == B-1:
break
L[i+1][j*3 + i%3 + 1] = "#"
count += 1
count = 0
for i in range(98):
for j in range(16):
if count == A-1:
break
R[i+1][j*3 + i%3 + 1] = "."
count += 1
ANS = [l+r for l, r in zip(L, R)]
print(100, 100)
plot(ANS)
```
| 11,476 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
"Correct Solution:
```
def main():
buf = input()
buflist = buf.split()
A = int(buflist[0])
B = int(buflist[1])
board = []
for i in range(100):
board.append([])
for j in range(100):
if i < 50:
board[-1].append('#')
else:
board[-1].append('.')
A_remaining = A - 1
for i in range(0, 50, 2):
if A_remaining <= 0:
break;
for j in range(0, 100, 2):
board[i][j] = '.'
A_remaining -= 1
if A_remaining <= 0:
break;
B_remaining = B - 1
for i in range(100-1, 50-1, -2):
if B_remaining <= 0:
break;
for j in range(0, 100, 2):
board[i][j] = '#'
B_remaining -= 1
if B_remaining <= 0:
break;
print(100, 100)
for i in range(100):
print(''.join(board[i]))
if __name__ == '__main__':
main()
```
| 11,477 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
"Correct Solution:
```
from math import gcd
from math import factorial as f
from math import ceil, floor, sqrt
import math
import bisect
import re
import heapq
from copy import deepcopy
import itertools
from itertools import permutations
from sys import exit
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))
yes = "Yes"
no = "No"
def main():
a, b = mi()
print(100, 100)
ans = [[] for i in range(100)]
for i in range(50):
for j in range(100):
ans[i].append('#')
for i in range(50, 100):
for j in range(100):
ans[i].append('.')
for i in range(a - 1):
ans[2 * (i // 50)][2 * (i % 50)] = '.'
for i in range(b - 1):
ans[99 - 2 * (i // 50)][2 * (i % 50)] = '#'
for i in range(100):
print(''.join(ans[i]))
main()
```
| 11,478 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
"Correct Solution:
```
import sys
import math
import collections
import bisect
import itertools
# import numpy as np
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353
ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))
# ===CODE===
def main():
w, b = ns()
l = 100
mat = [["#" for _ in range(l)] for __ in range(l)]
if w == 1 and b == 1:
mat[0][0] = "."
cnt = 0
breakflg = False
tmp = 1 if b > 1 else 0
flg = False
for i in range(0, l - 3, 3):
for j in range(0, l - 3, 3):
if not flg:
if cnt < w - tmp:
around = "#"
center = "."
else:
flg = True
break
if flg:
if cnt < w - tmp + b - 1:
around = "."
center = "#"
else:
breakflg = True
break
for n in range(3):
for m in range(3):
mat[i + n][j + m] = center if n == 1 and m == 1 else around
cnt += 1
if breakflg:
break
print(l, l)
for mi in mat:
print(*mi, sep="")
if __name__ == '__main__':
main()
```
| 11,479 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
Submitted Solution:
```
# D
A, B = map(int, input().split())
res_list = [["."]*100 for _ in range(20)] + [["#"]*100 for _ in range(20)]
A -= 1
B -= 1
for i in range(0, 20, 2):
for j in range(0, 100, 2):
if B > 0:
res_list[i][j] = "#"
B -= 1
for i in range(21, 40, 2):
for j in range(0, 100, 2):
if A > 0:
res_list[i][j] = "."
A -= 1
print("40 100")
for res in res_list:
print("".join(res))
```
Yes
| 11,480 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
Submitted Solution:
```
a,b = map(int,input().split())
ans = [["." for i in range(100)] for j in range(100)]
for i in range(100):
for j in range(50):
ans[i][j] = "#"
a-=1
b-=1
ind = 0
while True:
loop = min(a,25)
for i in range(loop):
ans[ind][i*2] = "."
a-=loop
ind += 2
if a == 0:
break
ind = 0
while True:
loop = min(b,25)
for i in range(loop):
ans[ind][51+i*2] = "#"
b-=loop
ind += 2
if b == 0:
break
print("100 100")
for i in range(100):
for j in range(99):
print(ans[i][j],end="")
print(ans[i][-1])
```
Yes
| 11,481 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
Submitted Solution:
```
a,b = map(int,input().split())
print("40 100")
kuro = [["#" for i in range(100)] for j in range(20)]
siro = [["." for i in range(100)] for j in range(20)]
cou = 0
flag = False
for i in range(0,20,2):
if flag:
break
for j in range(0,100,2):
if cou >= a-1:
flag = True
break
elif cou < a-1:
cou += 1
kuro[i][j] = "."
cou = 0
flag = False
for i in range(1,20,2):
if flag:
break
for j in range(0,100,2):
if cou >= b-1:
flag = True
break
elif cou < b-1:
cou += 1
siro[i][j] = "#"
for i in range(20):
for j in range(100):
print(kuro[i][j],end="")
print()
for i in range(20):
for j in range(100):
print(siro[i][j],end="")
print()
```
Yes
| 11,482 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
Submitted Solution:
```
A, B = map(int, input().split())
N = 100
board = [['.#'[row >= N//2] for _ in range(N)] for row in range(N)]
for i in range(B-1):
r, c = i // 25 * 2, (i % 25) * 2
board[r][c] = "#"
for i in range(A-1):
r, c = i // 25 * 2, (i % 25) * 2
board[-r-1][c] = "."
print(N, N)
print("\n".join(''.join(row) for row in board))
```
Yes
| 11,483 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
Submitted Solution:
```
a,b=map(int,input().split())
grid=[["." for i in range(100)] for j in range(50)]+[["#" for i in range(100)] for j in range(50)]
white=0;black=0
for i in range(49):
for j in range(100):
if i%2==j%2:
grid[i][j]="#"
black+=1
if black==b-1:break
if black==b-1:break
for i in range(51,100):
for j in range(100):
if i%2==j%2:
grid[i][j]="."
white+=1
if white==a-1:break
if white==a-1:break
for i in range(100):
stri=""
for j in grid[i]:
stri+=j
print(stri)
```
No
| 11,484 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
Submitted Solution:
```
a, b = map(int, input().split())
N = 100
f = [['#'] * N if i < (N/2) else ['.'] * N for i in range(N)]
for i in range(a-1):
h = 2 * ((2 * i) // N)
w = (2 * i) % N
print(h, w)
f[h][w] = '.'
for i in range(b-1):
h = (N//2 + 1) + 2 * (2 * i // N)
w = 2 * i % N
print(h, w)
f[h][w] = '#'
print(N, N)
for line in f:
print(''.join(line))
```
No
| 11,485 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
Submitted Solution:
```
import sys
sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A, B = map(int, readline().split())
color_flipped = False
if A < B:
A, B = B, A
color_flipped = True
def solve():
hb = min(A, 12)
h = hb * 2 * 3
w = 100
# If not flipped, False -> White (A), True -> Black (B)
grid = [[None] * w for _ in range(h)]
for i in range(hb):
for c in range(w):
for j in range(3):
grid[6 * i + j][c] = False
grid[6 * i + 3 + j][c] = i < B
black = min(hb, B)
white = black + 1
def paint_black(i):
nonlocal black
for c in range(0, w, 2):
if black == B:
return
grid[6 * i + 1][c] = True
black += 1
def paint_white(i):
nonlocal white
for c in range(0, w, 2):
if white == A:
return
grid[6 * i + 4][c] = False
white += 1
for i in range(hb):
paint_black(i)
paint_white(i)
return grid
def print_grid(grid):
h, w = len(grid), len(grid[0])
print(h, w)
for r in range(h):
for c in range(w):
if grid[r][c] ^ color_flipped:
print("#", end="")
else:
print(".", end="")
print()
if __name__ == "__main__":
print_grid(solve())
```
No
| 11,486 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers A and B.
Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:
* Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.
* The set of the squares painted white is divided into exactly A connected components.
* The set of the squares painted black is divided into exactly B connected components.
It can be proved that there always exist one or more solutions under the conditions specified in Constraints section. If there are multiple solutions, any of them may be printed.
Constraints
* 1 \leq A \leq 500
* 1 \leq B \leq 500
Input
Input is given from Standard Input in the following format:
A B
Output
Output should be in the following format:
* In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.
* Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be `.`.
* If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be `#`.
Examples
Input
2 3
Output
3 3
##.
..#
#.#
Input
7 8
Output
3 5
.#.#
.#.#.
.#.#
Input
1 1
Output
4 2
..
.
Input
3 14
Output
8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
.........#..####.
Submitted Solution:
```
ansl1 = list("#" * (99 * 25))
ansl2 = list("." * (99 * 25))
a,b = map(int,input().split())
for i in range(a-1):
ansl1[2*i] = "."
for i in range(b-1):
ansl2[2*i] = "#"
print(100, 99)
for i in range(25):
print("".join(ansl1[(i*50):(i*50)+99]))
print("#"*99)
for j in range(24, -1, -1):
print("".join(ansl2[(j*50):(j*50)+99]))
print("." * 99)
```
No
| 11,487 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke built an online judge to hold a programming contest.
When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)
Determine whether the judge can return the string `AC` as the verdict to a program.
Constraints
* 2 \leq |S| \leq 5
* S consists of uppercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
If the judge can return the string `AC` as a verdict to a program, print `Yes`; if it cannot, print `No`.
Examples
Input
BACD
Output
Yes
Input
ABCD
Output
No
Input
CABD
Output
No
Input
ACACA
Output
Yes
Input
XX
Output
No
"Correct Solution:
```
S = input()
print("YNeos"[not "AC" in S::2])
```
| 11,488 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke built an online judge to hold a programming contest.
When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)
Determine whether the judge can return the string `AC` as the verdict to a program.
Constraints
* 2 \leq |S| \leq 5
* S consists of uppercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
If the judge can return the string `AC` as a verdict to a program, print `Yes`; if it cannot, print `No`.
Examples
Input
BACD
Output
Yes
Input
ABCD
Output
No
Input
CABD
Output
No
Input
ACACA
Output
Yes
Input
XX
Output
No
"Correct Solution:
```
s=input()
ans='No'
if s.count('AC')!=0:
ans='Yes'
print(ans)
```
| 11,489 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke built an online judge to hold a programming contest.
When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)
Determine whether the judge can return the string `AC` as the verdict to a program.
Constraints
* 2 \leq |S| \leq 5
* S consists of uppercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
If the judge can return the string `AC` as a verdict to a program, print `Yes`; if it cannot, print `No`.
Examples
Input
BACD
Output
Yes
Input
ABCD
Output
No
Input
CABD
Output
No
Input
ACACA
Output
Yes
Input
XX
Output
No
"Correct Solution:
```
s=input()
ans="No"
for i in range(len(s)-1):
if s[i]+s[i+1]=="AC":
ans="Yes"
print(ans)
```
| 11,490 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke built an online judge to hold a programming contest.
When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)
Determine whether the judge can return the string `AC` as the verdict to a program.
Constraints
* 2 \leq |S| \leq 5
* S consists of uppercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
If the judge can return the string `AC` as a verdict to a program, print `Yes`; if it cannot, print `No`.
Examples
Input
BACD
Output
Yes
Input
ABCD
Output
No
Input
CABD
Output
No
Input
ACACA
Output
Yes
Input
XX
Output
No
"Correct Solution:
```
print('Yes') if 'AC' in input() else print('No')
```
| 11,491 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke built an online judge to hold a programming contest.
When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)
Determine whether the judge can return the string `AC` as the verdict to a program.
Constraints
* 2 \leq |S| \leq 5
* S consists of uppercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
If the judge can return the string `AC` as a verdict to a program, print `Yes`; if it cannot, print `No`.
Examples
Input
BACD
Output
Yes
Input
ABCD
Output
No
Input
CABD
Output
No
Input
ACACA
Output
Yes
Input
XX
Output
No
"Correct Solution:
```
s = str(input())
if "AC" in s:
print("Yes")
else:
print("No")
```
| 11,492 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke built an online judge to hold a programming contest.
When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)
Determine whether the judge can return the string `AC` as the verdict to a program.
Constraints
* 2 \leq |S| \leq 5
* S consists of uppercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
If the judge can return the string `AC` as a verdict to a program, print `Yes`; if it cannot, print `No`.
Examples
Input
BACD
Output
Yes
Input
ABCD
Output
No
Input
CABD
Output
No
Input
ACACA
Output
Yes
Input
XX
Output
No
"Correct Solution:
```
a= input()
if a[0:2]=="AC" or a[1:3]=="AC" or a[2:4]=="AC" or a[3:5]=="AC":
print("Yes")
else:
print("No")
```
| 11,493 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke built an online judge to hold a programming contest.
When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)
Determine whether the judge can return the string `AC` as the verdict to a program.
Constraints
* 2 \leq |S| \leq 5
* S consists of uppercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
If the judge can return the string `AC` as a verdict to a program, print `Yes`; if it cannot, print `No`.
Examples
Input
BACD
Output
Yes
Input
ABCD
Output
No
Input
CABD
Output
No
Input
ACACA
Output
Yes
Input
XX
Output
No
"Correct Solution:
```
s = input()
for i in range(len(s)-1):
if s[i:i+2] == 'AC':
print('Yes')
exit()
print('No')
```
| 11,494 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke built an online judge to hold a programming contest.
When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)
Determine whether the judge can return the string `AC` as the verdict to a program.
Constraints
* 2 \leq |S| \leq 5
* S consists of uppercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
If the judge can return the string `AC` as a verdict to a program, print `Yes`; if it cannot, print `No`.
Examples
Input
BACD
Output
Yes
Input
ABCD
Output
No
Input
CABD
Output
No
Input
ACACA
Output
Yes
Input
XX
Output
No
"Correct Solution:
```
S = input()
print("Yes" if sum([S[i:i+2]=="AC" for i in range(len(S))]) else "No")
```
| 11,495 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke built an online judge to hold a programming contest.
When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)
Determine whether the judge can return the string `AC` as the verdict to a program.
Constraints
* 2 \leq |S| \leq 5
* S consists of uppercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
If the judge can return the string `AC` as a verdict to a program, print `Yes`; if it cannot, print `No`.
Examples
Input
BACD
Output
Yes
Input
ABCD
Output
No
Input
CABD
Output
No
Input
ACACA
Output
Yes
Input
XX
Output
No
Submitted Solution:
```
s = input()
ans = 'Yes' if any(s[i:i + 2] == 'AC' for i in range(len(s) - 1)) else 'No'
print(ans)
```
Yes
| 11,496 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke built an online judge to hold a programming contest.
When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)
Determine whether the judge can return the string `AC` as the verdict to a program.
Constraints
* 2 \leq |S| \leq 5
* S consists of uppercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
If the judge can return the string `AC` as a verdict to a program, print `Yes`; if it cannot, print `No`.
Examples
Input
BACD
Output
Yes
Input
ABCD
Output
No
Input
CABD
Output
No
Input
ACACA
Output
Yes
Input
XX
Output
No
Submitted Solution:
```
S=str(input())
for i in range(len(S)-1):
if S[i]=="A" and S[i+1]=="C":
print("Yes")
break
else: print("No")
```
Yes
| 11,497 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke built an online judge to hold a programming contest.
When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)
Determine whether the judge can return the string `AC` as the verdict to a program.
Constraints
* 2 \leq |S| \leq 5
* S consists of uppercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
If the judge can return the string `AC` as a verdict to a program, print `Yes`; if it cannot, print `No`.
Examples
Input
BACD
Output
Yes
Input
ABCD
Output
No
Input
CABD
Output
No
Input
ACACA
Output
Yes
Input
XX
Output
No
Submitted Solution:
```
S = input()
for k in range(1,len(S)):
if S[k-1:k+1] == "AC":
print("Yes")
exit(0)
print("No")
```
Yes
| 11,498 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke built an online judge to hold a programming contest.
When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)
Determine whether the judge can return the string `AC` as the verdict to a program.
Constraints
* 2 \leq |S| \leq 5
* S consists of uppercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
If the judge can return the string `AC` as a verdict to a program, print `Yes`; if it cannot, print `No`.
Examples
Input
BACD
Output
Yes
Input
ABCD
Output
No
Input
CABD
Output
No
Input
ACACA
Output
Yes
Input
XX
Output
No
Submitted Solution:
```
if (input().count("AC")):
print("Yes")
else:
print("No")
```
Yes
| 11,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.