message
stringlengths
2
39.6k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
219
108k
cluster
float64
11
11
__index_level_0__
int64
438
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal to x / y. Your favorite rational number in the [0;1] range is p / q. Now you wonder: what is the smallest number of submissions you have to make if you want your success rate to be p / q? Input The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases. Each of the next t lines contains four integers x, y, p and q (0 ≤ x ≤ y ≤ 109; 0 ≤ p ≤ q ≤ 109; y > 0; q > 0). It is guaranteed that p / q is an irreducible fraction. Hacks. For hacks, an additional constraint of t ≤ 5 must be met. Output For each test case, output a single integer equal to the smallest number of submissions you have to make if you want your success rate to be equal to your favorite rational number, or -1 if this is impossible to achieve. Example Input 4 3 10 1 2 7 14 3 8 20 70 2 7 5 6 1 1 Output 4 10 0 -1 Note In the first example, you have to make 4 successful submissions. Your success rate will be equal to 7 / 14, or 1 / 2. In the second example, you have to make 2 successful and 8 unsuccessful submissions. Your success rate will be equal to 9 / 24, or 3 / 8. In the third example, there is no need to make any new submissions. Your success rate is already equal to 20 / 70, or 2 / 7. In the fourth example, the only unsuccessful submission breaks your hopes of having the success rate equal to 1. Submitted Solution: ``` t = int(input()) for _ in range(t): x, y, p, q = map(int, input().split()) if p == q: print(0 if x == y else -1) elif p == 0: print(0 if x == 0 else -1) elif x * q == y * p: print(0) else: l = 0 r = 2**64 cnt = 0 while l + 1 < r: cnt += 1 c = (l + r) // 2 if x <= c * p <= x + c * q - y: r = c else: l = c print(r * q - y) ```
instruction
0
50,165
11
100,330
Yes
output
1
50,165
11
100,331
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal to x / y. Your favorite rational number in the [0;1] range is p / q. Now you wonder: what is the smallest number of submissions you have to make if you want your success rate to be p / q? Input The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases. Each of the next t lines contains four integers x, y, p and q (0 ≤ x ≤ y ≤ 109; 0 ≤ p ≤ q ≤ 109; y > 0; q > 0). It is guaranteed that p / q is an irreducible fraction. Hacks. For hacks, an additional constraint of t ≤ 5 must be met. Output For each test case, output a single integer equal to the smallest number of submissions you have to make if you want your success rate to be equal to your favorite rational number, or -1 if this is impossible to achieve. Example Input 4 3 10 1 2 7 14 3 8 20 70 2 7 5 6 1 1 Output 4 10 0 -1 Note In the first example, you have to make 4 successful submissions. Your success rate will be equal to 7 / 14, or 1 / 2. In the second example, you have to make 2 successful and 8 unsuccessful submissions. Your success rate will be equal to 9 / 24, or 3 / 8. In the third example, there is no need to make any new submissions. Your success rate is already equal to 20 / 70, or 2 / 7. In the fourth example, the only unsuccessful submission breaks your hopes of having the success rate equal to 1. Submitted Solution: ``` def Ans(k): x, y, p, q = k[0], k[1], k[2], k[3] if (p/q == 1 and x != y) or (p == 0 and x!= 0): print(-1) elif p == 0 and x == 0: print(0) else: up = 10**9 down = 1 dy = y-x while (up > down + 1): mid = (up+down)//2 ## print(" up: " + str(up) + " mid: " + str(mid) + " down: " + str(down) ) qf = q*mid pf = p*mid dq = qf-pf if( qf-y >= dq-dy and qf >= y and dq >= dy): up = mid else: down = mid if( q*down-y >= (q-p)*down-dy and q*down >= y and (q-p)*down >= dy): print(q*down - y) elif q*mid-y >= (q-p)*mid-dy and q*mid >= y and (q-p)*mid>=dy: print(q*mid - y) else: print(q*up - y) t = int( input() ) k = [0]*t for i in range(t): k[i] = list(map(int, input().split() )) for i in range(t): Ans(k[i]) ```
instruction
0
50,166
11
100,332
Yes
output
1
50,166
11
100,333
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal to x / y. Your favorite rational number in the [0;1] range is p / q. Now you wonder: what is the smallest number of submissions you have to make if you want your success rate to be p / q? Input The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases. Each of the next t lines contains four integers x, y, p and q (0 ≤ x ≤ y ≤ 109; 0 ≤ p ≤ q ≤ 109; y > 0; q > 0). It is guaranteed that p / q is an irreducible fraction. Hacks. For hacks, an additional constraint of t ≤ 5 must be met. Output For each test case, output a single integer equal to the smallest number of submissions you have to make if you want your success rate to be equal to your favorite rational number, or -1 if this is impossible to achieve. Example Input 4 3 10 1 2 7 14 3 8 20 70 2 7 5 6 1 1 Output 4 10 0 -1 Note In the first example, you have to make 4 successful submissions. Your success rate will be equal to 7 / 14, or 1 / 2. In the second example, you have to make 2 successful and 8 unsuccessful submissions. Your success rate will be equal to 9 / 24, or 3 / 8. In the third example, there is no need to make any new submissions. Your success rate is already equal to 20 / 70, or 2 / 7. In the fourth example, the only unsuccessful submission breaks your hopes of having the success rate equal to 1. Submitted Solution: ``` for _ in range(int(input())): x,y,p,q=[int(x) for x in input().split(' ')] if(y*p==x*q): print(0) continue m1=-1 m2=-1 if(p==0): m1=-1 else: if(x%p): m1=(x//p)+1 else: m1=(x//p) if(p==q): m2=-1 else: if((y-x)%(q-p)): m2=((y-x)//(q-p))+1 else: m2=((y-x)//(q-p)) if(m2==-1 or m1==-1): print(-1) else: print(max(m1,m2)*q-y) ```
instruction
0
50,167
11
100,334
Yes
output
1
50,167
11
100,335
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal to x / y. Your favorite rational number in the [0;1] range is p / q. Now you wonder: what is the smallest number of submissions you have to make if you want your success rate to be p / q? Input The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases. Each of the next t lines contains four integers x, y, p and q (0 ≤ x ≤ y ≤ 109; 0 ≤ p ≤ q ≤ 109; y > 0; q > 0). It is guaranteed that p / q is an irreducible fraction. Hacks. For hacks, an additional constraint of t ≤ 5 must be met. Output For each test case, output a single integer equal to the smallest number of submissions you have to make if you want your success rate to be equal to your favorite rational number, or -1 if this is impossible to achieve. Example Input 4 3 10 1 2 7 14 3 8 20 70 2 7 5 6 1 1 Output 4 10 0 -1 Note In the first example, you have to make 4 successful submissions. Your success rate will be equal to 7 / 14, or 1 / 2. In the second example, you have to make 2 successful and 8 unsuccessful submissions. Your success rate will be equal to 9 / 24, or 3 / 8. In the third example, there is no need to make any new submissions. Your success rate is already equal to 20 / 70, or 2 / 7. In the fourth example, the only unsuccessful submission breaks your hopes of having the success rate equal to 1. Submitted Solution: ``` def gcd(a, b): if a == 0: return b return gcd(b % a, a) def get(x, y, p, q): low, high, mid, best = 1, 1 << 65, 0, -1 while low <= high: mid = (low + high + 1) >> 1 tp = p * mid tq = q * mid if tq >= y and x <= tp <= x + tq - y: best = mid high = mid - 1 else: low = mid + 1 return best T = int(input()) for _ in range(T): x, y, p, q = map(int, input().split()) if x == 0 and p == q: print(-1) continue if x == y and p == 0: print(-1) continue if x == 0 and p == 0: if y > q: print(-1) else: print(q - y) continue nx, ny = x, y nx //= gcd(x, y) ny //= gcd(x, y) #print("reduced", nx, ny) need = get(nx, ny, p, q) rx = need * p ry = need * q #print("first new", rx, ry) low, high, mid, best = 0, 1 << 63, 0, -1 while low <= high: mid = (low + high + 1) >> 1 if rx + mid * p >= x and ry + mid * q >= y and ry + mid * q - y >= rx + mid * p - x: best = mid high = mid - 1 else: low = mid + 1 if best == -1: print(-1) continue rx += best * p ry += best * q #print("resulting", rx, ry) if rx * q == ry * p: print(ry - y) else: print(-1) ```
instruction
0
50,168
11
100,336
No
output
1
50,168
11
100,337
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal to x / y. Your favorite rational number in the [0;1] range is p / q. Now you wonder: what is the smallest number of submissions you have to make if you want your success rate to be p / q? Input The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases. Each of the next t lines contains four integers x, y, p and q (0 ≤ x ≤ y ≤ 109; 0 ≤ p ≤ q ≤ 109; y > 0; q > 0). It is guaranteed that p / q is an irreducible fraction. Hacks. For hacks, an additional constraint of t ≤ 5 must be met. Output For each test case, output a single integer equal to the smallest number of submissions you have to make if you want your success rate to be equal to your favorite rational number, or -1 if this is impossible to achieve. Example Input 4 3 10 1 2 7 14 3 8 20 70 2 7 5 6 1 1 Output 4 10 0 -1 Note In the first example, you have to make 4 successful submissions. Your success rate will be equal to 7 / 14, or 1 / 2. In the second example, you have to make 2 successful and 8 unsuccessful submissions. Your success rate will be equal to 9 / 24, or 3 / 8. In the third example, there is no need to make any new submissions. Your success rate is already equal to 20 / 70, or 2 / 7. In the fourth example, the only unsuccessful submission breaks your hopes of having the success rate equal to 1. Submitted Solution: ``` t=int(input()) for l in range(t): x,y,p,q=map(int,input().split()) if p==1 and q==1 or p==0 and x==0 : c=0 else: if p==1 and q==1 or p==0 : c=-1 else: if (x/y)>(p/q): r=p r2=q m=q-(y%q) y=(y+m) p=p*(y//q) q=q*(y//q) if p>=x: c=m else: if x%r==0: z=(x-p)//r else: z=(x-p)//r+1 c=m+z*r2 else: if (x/y)==(p/q): c=0 else: r=p r2=q m=q-(y%q) x=x+m y=(y+m) p=p*(y//q) q=q*(y//q) if x>=p: c=m else: if (p-x)%(r2-r)==0: z=(p-x)//(r2-r) else: z=(p-x)//(r2-r)+1 c=m+z*r2 print(c) ```
instruction
0
50,169
11
100,338
No
output
1
50,169
11
100,339
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal to x / y. Your favorite rational number in the [0;1] range is p / q. Now you wonder: what is the smallest number of submissions you have to make if you want your success rate to be p / q? Input The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases. Each of the next t lines contains four integers x, y, p and q (0 ≤ x ≤ y ≤ 109; 0 ≤ p ≤ q ≤ 109; y > 0; q > 0). It is guaranteed that p / q is an irreducible fraction. Hacks. For hacks, an additional constraint of t ≤ 5 must be met. Output For each test case, output a single integer equal to the smallest number of submissions you have to make if you want your success rate to be equal to your favorite rational number, or -1 if this is impossible to achieve. Example Input 4 3 10 1 2 7 14 3 8 20 70 2 7 5 6 1 1 Output 4 10 0 -1 Note In the first example, you have to make 4 successful submissions. Your success rate will be equal to 7 / 14, or 1 / 2. In the second example, you have to make 2 successful and 8 unsuccessful submissions. Your success rate will be equal to 9 / 24, or 3 / 8. In the third example, there is no need to make any new submissions. Your success rate is already equal to 20 / 70, or 2 / 7. In the fourth example, the only unsuccessful submission breaks your hopes of having the success rate equal to 1. Submitted Solution: ``` def Ans(k): x, y, p, q = k[0], k[1], k[2], k[3] if p/q == x/y: print(0) elif p/q == 1 or p == 0: print(-1) else: if x/y < p/q: d1 = y-x d2 = q-p t = d1/d2 if t != int(t): t = int(t+1) else: t = int(t) print(int(t*q-y)) else: t = x/p if t != int(t): t = int(t+1) print(int( t*q - y )) t = int( input() ) k = [0]*t for i in range(t): k[i] = list(map(int, input().split() )) for i in range(t): Ans(k[i]) ```
instruction
0
50,170
11
100,340
No
output
1
50,170
11
100,341
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal to x / y. Your favorite rational number in the [0;1] range is p / q. Now you wonder: what is the smallest number of submissions you have to make if you want your success rate to be p / q? Input The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases. Each of the next t lines contains four integers x, y, p and q (0 ≤ x ≤ y ≤ 109; 0 ≤ p ≤ q ≤ 109; y > 0; q > 0). It is guaranteed that p / q is an irreducible fraction. Hacks. For hacks, an additional constraint of t ≤ 5 must be met. Output For each test case, output a single integer equal to the smallest number of submissions you have to make if you want your success rate to be equal to your favorite rational number, or -1 if this is impossible to achieve. Example Input 4 3 10 1 2 7 14 3 8 20 70 2 7 5 6 1 1 Output 4 10 0 -1 Note In the first example, you have to make 4 successful submissions. Your success rate will be equal to 7 / 14, or 1 / 2. In the second example, you have to make 2 successful and 8 unsuccessful submissions. Your success rate will be equal to 9 / 24, or 3 / 8. In the third example, there is no need to make any new submissions. Your success rate is already equal to 20 / 70, or 2 / 7. In the fourth example, the only unsuccessful submission breaks your hopes of having the success rate equal to 1. Submitted Solution: ``` t=int(input()) for l in range(t): x,y,p,q=map(int,input().split()) if p==1 and q==1 and x//y==1: c=0 else: if p==1 and q==1 or p==0: c=-1 else: if (x/y)>(p/q): r=p r2=q m=q-(y%q) if m==q: m=0 y=(y+m) p=p*(y//q) q=q*(y//q) if p>=x: c=m else: if x%r==0: z=(x-p)//r else: z=(x-p)//r+1 c=m+z*r2 else: if (x/y)==(p/q): c=0 else: r=p r2=q m=q-(y%q) if m==q: m=0 x=x+m y=(y+m) p=p*(y//q) q=q*(y//q) if x>=p: c=m else: if p%(r2-r)==0: z=(p-x)//(r2-r) else: z=(p-x)//(r2-r)+1 c=m+z*r2 print(c) ```
instruction
0
50,171
11
100,342
No
output
1
50,171
11
100,343
Provide a correct Python 3 solution for this coding contest problem. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes
instruction
0
50,282
11
100,564
"Correct Solution: ``` n,m=[i for i in input().split()] print('Yes' if n==m else 'No') ```
output
1
50,282
11
100,565
Provide a correct Python 3 solution for this coding contest problem. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes
instruction
0
50,283
11
100,566
"Correct Solution: ``` n,m=input().split() print("Yes" if n==m else "No") ```
output
1
50,283
11
100,567
Provide a correct Python 3 solution for this coding contest problem. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes
instruction
0
50,284
11
100,568
"Correct Solution: ``` a,c = map(int,input().split()) print("Yes") if a==c else print("No") ```
output
1
50,284
11
100,569
Provide a correct Python 3 solution for this coding contest problem. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes
instruction
0
50,285
11
100,570
"Correct Solution: ``` N, M = map(int, input().split()) print('YNeos'[N!=M::2]) ```
output
1
50,285
11
100,571
Provide a correct Python 3 solution for this coding contest problem. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes
instruction
0
50,286
11
100,572
"Correct Solution: ``` n,m=input().split();print('NYoe s'[n==m::2]) ```
output
1
50,286
11
100,573
Provide a correct Python 3 solution for this coding contest problem. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes
instruction
0
50,288
11
100,576
"Correct Solution: ``` a,o=map(int, input().split()) print("Yes" if a <= o else "No") ```
output
1
50,288
11
100,577
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes Submitted Solution: ``` # AC or WA N, M = map(int, input().split()) print(['No', 'Yes'][N == M]) ```
instruction
0
50,289
11
100,578
Yes
output
1
50,289
11
100,579
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes Submitted Solution: ``` n, m = map(int, input().split(' ')) print('Yes' if n == m else 'No') ```
instruction
0
50,290
11
100,580
Yes
output
1
50,290
11
100,581
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes Submitted Solution: ``` N, M = input().split(' ') print('Yes' if N == M else 'No') ```
instruction
0
50,291
11
100,582
Yes
output
1
50,291
11
100,583
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes Submitted Solution: ``` a,b = input().split(' ') if a == b: print('Yes') else: print('No') ```
instruction
0
50,292
11
100,584
Yes
output
1
50,292
11
100,585
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes Submitted Solution: ``` input m; input n; if m=n: print("yes") else: print("no") ```
instruction
0
50,293
11
100,586
No
output
1
50,293
11
100,587
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes Submitted Solution: ``` n=input() p=input() p=p.split() q=[] for i in range(int(n)): j=min(p[:i+1]) if j==p[i]: q.append(p[i]) print(len(q)) ```
instruction
0
50,294
11
100,588
No
output
1
50,294
11
100,589
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes Submitted Solution: ``` n,m = map(int,input().split()) if n == m; print(Yes) else: print(No) ```
instruction
0
50,295
11
100,590
No
output
1
50,295
11
100,591
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints * 1 \leq N \leq 100 * 0 \leq M \leq N * All values in input are integers. Input Input is given from Standard Input in the following format: N M Output If Takahashi's submission gets an AC, print `Yes`; otherwise, print `No`. Examples Input 3 3 Output Yes Input 3 2 Output No Input 1 1 Output Yes Submitted Solution: ``` a = input("A") b = input("B") sumA = "" sumB = "" for i in range(int(b)): sumA +=""+str(a) for i in range(int(a)): sumB +=""+str(b) if(int(sumA)>int(sumB)): print(sumA) elif(int(sumB)>int(sumA)): print(sumB) elif(int(sumA) == int(sumB)): print(sumA) ```
instruction
0
50,296
11
100,592
No
output
1
50,296
11
100,593
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. One of the unique features of this contest is the great number of judges that sometimes counts up to one hundred. The number of judges may differ from one contestant to another, because judges with any relationship whatsoever with a specific contestant are temporarily excluded for scoring his/her performance. Basically, scores given to a contestant's performance by the judges are averaged to decide his/her score. To avoid letting judges with eccentric viewpoints too much influence the score, the highest and the lowest scores are set aside in this calculation. If the same highest score is marked by two or more judges, only one of them is ignored. The same is with the lowest score. The average, which may contain fractions, are truncated down to obtain final score as an integer. You are asked to write a program that computes the scores of performances, given the scores of all the judges, to speed up the event to be suited for a TV program. Input The input consists of a number of datasets, each corresponding to a contestant's performance. There are no more than 20 datasets in the input. A dataset begins with a line with an integer n, the number of judges participated in scoring the performance (3 ≤ n ≤ 100). Each of the n lines following it has an integral score s (0 ≤ s ≤ 1000) marked by a judge. No other characters except for digits to express these numbers are in the input. Judges' names are kept secret. The end of the input is indicated by a line with a single zero in it. Output For each dataset, a line containing a single decimal integer indicating the score for the corresponding performance should be output. No other characters should be on the output line. Example Input 3 1000 342 0 5 2 2 9 11 932 5 300 1000 0 200 400 8 353 242 402 274 283 132 402 523 0 Output 342 7 300 326 Submitted Solution: ``` while True: n = int(input()) if n == 0: break data=[] for i in range(n): a=int(input()) data.append(a) print((sum(data)-max(data)-min(data))//(n-2)) ```
instruction
0
50,447
11
100,894
Yes
output
1
50,447
11
100,895
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. One of the unique features of this contest is the great number of judges that sometimes counts up to one hundred. The number of judges may differ from one contestant to another, because judges with any relationship whatsoever with a specific contestant are temporarily excluded for scoring his/her performance. Basically, scores given to a contestant's performance by the judges are averaged to decide his/her score. To avoid letting judges with eccentric viewpoints too much influence the score, the highest and the lowest scores are set aside in this calculation. If the same highest score is marked by two or more judges, only one of them is ignored. The same is with the lowest score. The average, which may contain fractions, are truncated down to obtain final score as an integer. You are asked to write a program that computes the scores of performances, given the scores of all the judges, to speed up the event to be suited for a TV program. Input The input consists of a number of datasets, each corresponding to a contestant's performance. There are no more than 20 datasets in the input. A dataset begins with a line with an integer n, the number of judges participated in scoring the performance (3 ≤ n ≤ 100). Each of the n lines following it has an integral score s (0 ≤ s ≤ 1000) marked by a judge. No other characters except for digits to express these numbers are in the input. Judges' names are kept secret. The end of the input is indicated by a line with a single zero in it. Output For each dataset, a line containing a single decimal integer indicating the score for the corresponding performance should be output. No other characters should be on the output line. Example Input 3 1000 342 0 5 2 2 9 11 932 5 300 1000 0 200 400 8 353 242 402 274 283 132 402 523 0 Output 342 7 300 326 Submitted Solution: ``` import math while True: n = int(input()) scores = [int(input()) for i in range(n)] scores.sort() if n == 0: break total = 0 for i in range(1, n - 1): total += scores[i] print(math.floor(total / (n - 2))) ```
instruction
0
50,448
11
100,896
Yes
output
1
50,448
11
100,897
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. One of the unique features of this contest is the great number of judges that sometimes counts up to one hundred. The number of judges may differ from one contestant to another, because judges with any relationship whatsoever with a specific contestant are temporarily excluded for scoring his/her performance. Basically, scores given to a contestant's performance by the judges are averaged to decide his/her score. To avoid letting judges with eccentric viewpoints too much influence the score, the highest and the lowest scores are set aside in this calculation. If the same highest score is marked by two or more judges, only one of them is ignored. The same is with the lowest score. The average, which may contain fractions, are truncated down to obtain final score as an integer. You are asked to write a program that computes the scores of performances, given the scores of all the judges, to speed up the event to be suited for a TV program. Input The input consists of a number of datasets, each corresponding to a contestant's performance. There are no more than 20 datasets in the input. A dataset begins with a line with an integer n, the number of judges participated in scoring the performance (3 ≤ n ≤ 100). Each of the n lines following it has an integral score s (0 ≤ s ≤ 1000) marked by a judge. No other characters except for digits to express these numbers are in the input. Judges' names are kept secret. The end of the input is indicated by a line with a single zero in it. Output For each dataset, a line containing a single decimal integer indicating the score for the corresponding performance should be output. No other characters should be on the output line. Example Input 3 1000 342 0 5 2 2 9 11 932 5 300 1000 0 200 400 8 353 242 402 274 283 132 402 523 0 Output 342 7 300 326 Submitted Solution: ``` # coding: utf-8 # Your code here! while(1): risuto = [] num = int(input()) if num == 0 : break for i in range(num): risuto.append(int(input())) print((sum(risuto)-max(risuto)-min(risuto))//(num-2)) ```
instruction
0
50,449
11
100,898
Yes
output
1
50,449
11
100,899
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. One of the unique features of this contest is the great number of judges that sometimes counts up to one hundred. The number of judges may differ from one contestant to another, because judges with any relationship whatsoever with a specific contestant are temporarily excluded for scoring his/her performance. Basically, scores given to a contestant's performance by the judges are averaged to decide his/her score. To avoid letting judges with eccentric viewpoints too much influence the score, the highest and the lowest scores are set aside in this calculation. If the same highest score is marked by two or more judges, only one of them is ignored. The same is with the lowest score. The average, which may contain fractions, are truncated down to obtain final score as an integer. You are asked to write a program that computes the scores of performances, given the scores of all the judges, to speed up the event to be suited for a TV program. Input The input consists of a number of datasets, each corresponding to a contestant's performance. There are no more than 20 datasets in the input. A dataset begins with a line with an integer n, the number of judges participated in scoring the performance (3 ≤ n ≤ 100). Each of the n lines following it has an integral score s (0 ≤ s ≤ 1000) marked by a judge. No other characters except for digits to express these numbers are in the input. Judges' names are kept secret. The end of the input is indicated by a line with a single zero in it. Output For each dataset, a line containing a single decimal integer indicating the score for the corresponding performance should be output. No other characters should be on the output line. Example Input 3 1000 342 0 5 2 2 9 11 932 5 300 1000 0 200 400 8 353 242 402 274 283 132 402 523 0 Output 342 7 300 326 Submitted Solution: ``` def main(): N = int(input()) while N != 0: s = [int(input()) for i in range(N)] s.sort() print(sum(s[1:N-1])//(N-2)) N = int(input()) if __name__ == '__main__': main() ```
instruction
0
50,450
11
100,900
Yes
output
1
50,450
11
100,901
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. One of the unique features of this contest is the great number of judges that sometimes counts up to one hundred. The number of judges may differ from one contestant to another, because judges with any relationship whatsoever with a specific contestant are temporarily excluded for scoring his/her performance. Basically, scores given to a contestant's performance by the judges are averaged to decide his/her score. To avoid letting judges with eccentric viewpoints too much influence the score, the highest and the lowest scores are set aside in this calculation. If the same highest score is marked by two or more judges, only one of them is ignored. The same is with the lowest score. The average, which may contain fractions, are truncated down to obtain final score as an integer. You are asked to write a program that computes the scores of performances, given the scores of all the judges, to speed up the event to be suited for a TV program. Input The input consists of a number of datasets, each corresponding to a contestant's performance. There are no more than 20 datasets in the input. A dataset begins with a line with an integer n, the number of judges participated in scoring the performance (3 ≤ n ≤ 100). Each of the n lines following it has an integral score s (0 ≤ s ≤ 1000) marked by a judge. No other characters except for digits to express these numbers are in the input. Judges' names are kept secret. The end of the input is indicated by a line with a single zero in it. Output For each dataset, a line containing a single decimal integer indicating the score for the corresponding performance should be output. No other characters should be on the output line. Example Input 3 1000 342 0 5 2 2 9 11 932 5 300 1000 0 200 400 8 353 242 402 274 283 132 402 523 0 Output 342 7 300 326 Submitted Solution: ``` import math def main(): r = [] while True: n = int(input()) if n == 0: break m = [] for i in range(n): m.append(int(input())) r.append(math.floor((sum(m) - max(m) - min(m)/(n-2)))) res = '' for j in r: res += str(j) print(res) main() ```
instruction
0
50,451
11
100,902
No
output
1
50,451
11
100,903
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. One of the unique features of this contest is the great number of judges that sometimes counts up to one hundred. The number of judges may differ from one contestant to another, because judges with any relationship whatsoever with a specific contestant are temporarily excluded for scoring his/her performance. Basically, scores given to a contestant's performance by the judges are averaged to decide his/her score. To avoid letting judges with eccentric viewpoints too much influence the score, the highest and the lowest scores are set aside in this calculation. If the same highest score is marked by two or more judges, only one of them is ignored. The same is with the lowest score. The average, which may contain fractions, are truncated down to obtain final score as an integer. You are asked to write a program that computes the scores of performances, given the scores of all the judges, to speed up the event to be suited for a TV program. Input The input consists of a number of datasets, each corresponding to a contestant's performance. There are no more than 20 datasets in the input. A dataset begins with a line with an integer n, the number of judges participated in scoring the performance (3 ≤ n ≤ 100). Each of the n lines following it has an integral score s (0 ≤ s ≤ 1000) marked by a judge. No other characters except for digits to express these numbers are in the input. Judges' names are kept secret. The end of the input is indicated by a line with a single zero in it. Output For each dataset, a line containing a single decimal integer indicating the score for the corresponding performance should be output. No other characters should be on the output line. Example Input 3 1000 342 0 5 2 2 9 11 932 5 300 1000 0 200 400 8 353 242 402 274 283 132 402 523 0 Output 342 7 300 326 Submitted Solution: ``` j = 0 lists = [] flag = 0 cnt = 0 while 1: n = int(input()) if n == 0: break for i in range(n): s = int(input()) lists.append(s) for i in range(n): if lists[i] == max(lists): flag += 1 pass elif lists[i] == min(lists): flag += 1 pass else: cnt += lists[i] if flag >= 2: n -= 2 print(cnt // n) ```
instruction
0
50,452
11
100,904
No
output
1
50,452
11
100,905
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. One of the unique features of this contest is the great number of judges that sometimes counts up to one hundred. The number of judges may differ from one contestant to another, because judges with any relationship whatsoever with a specific contestant are temporarily excluded for scoring his/her performance. Basically, scores given to a contestant's performance by the judges are averaged to decide his/her score. To avoid letting judges with eccentric viewpoints too much influence the score, the highest and the lowest scores are set aside in this calculation. If the same highest score is marked by two or more judges, only one of them is ignored. The same is with the lowest score. The average, which may contain fractions, are truncated down to obtain final score as an integer. You are asked to write a program that computes the scores of performances, given the scores of all the judges, to speed up the event to be suited for a TV program. Input The input consists of a number of datasets, each corresponding to a contestant's performance. There are no more than 20 datasets in the input. A dataset begins with a line with an integer n, the number of judges participated in scoring the performance (3 ≤ n ≤ 100). Each of the n lines following it has an integral score s (0 ≤ s ≤ 1000) marked by a judge. No other characters except for digits to express these numbers are in the input. Judges' names are kept secret. The end of the input is indicated by a line with a single zero in it. Output For each dataset, a line containing a single decimal integer indicating the score for the corresponding performance should be output. No other characters should be on the output line. Example Input 3 1000 342 0 5 2 2 9 11 932 5 300 1000 0 200 400 8 353 242 402 274 283 132 402 523 0 Output 342 7 300 326 Submitted Solution: ``` import sys while True: n = int(sys.stdin.readline().rstrip()) if n == 0: break scores = [int(sys.stdin.readline().rstrip()) for i in range(n)] result = (sum(scores) - (min(scores) + max(scores)) // n - 2) print(result) ```
instruction
0
50,453
11
100,906
No
output
1
50,453
11
100,907
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. One of the unique features of this contest is the great number of judges that sometimes counts up to one hundred. The number of judges may differ from one contestant to another, because judges with any relationship whatsoever with a specific contestant are temporarily excluded for scoring his/her performance. Basically, scores given to a contestant's performance by the judges are averaged to decide his/her score. To avoid letting judges with eccentric viewpoints too much influence the score, the highest and the lowest scores are set aside in this calculation. If the same highest score is marked by two or more judges, only one of them is ignored. The same is with the lowest score. The average, which may contain fractions, are truncated down to obtain final score as an integer. You are asked to write a program that computes the scores of performances, given the scores of all the judges, to speed up the event to be suited for a TV program. Input The input consists of a number of datasets, each corresponding to a contestant's performance. There are no more than 20 datasets in the input. A dataset begins with a line with an integer n, the number of judges participated in scoring the performance (3 ≤ n ≤ 100). Each of the n lines following it has an integral score s (0 ≤ s ≤ 1000) marked by a judge. No other characters except for digits to express these numbers are in the input. Judges' names are kept secret. The end of the input is indicated by a line with a single zero in it. Output For each dataset, a line containing a single decimal integer indicating the score for the corresponding performance should be output. No other characters should be on the output line. Example Input 3 1000 342 0 5 2 2 9 11 932 5 300 1000 0 200 400 8 353 242 402 274 283 132 402 523 0 Output 342 7 300 326 Submitted Solution: ``` while True: n = int(input()) if n == 0: exit() score = [] for i in range(n): score.append(int(input())) print(sum(sorted(score)[1:-1])) ```
instruction
0
50,454
11
100,908
No
output
1
50,454
11
100,909
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a mysterious language (codenamed "Secret") available in "Custom Test" tab. Find out what this language is and write a program which outputs its name. Note that the program must be written in this language. Input This program has only one test, and it's empty (it doesn't give your program anything to read). Output Output the name of the mysterious language. Examples Submitted Solution: ``` print("Python3") ```
instruction
0
50,757
11
101,514
No
output
1
50,757
11
101,515
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a mysterious language (codenamed "Secret") available in "Custom Test" tab. Find out what this language is and write a program which outputs its name. Note that the program must be written in this language. Input This program has only one test, and it's empty (it doesn't give your program anything to read). Output Output the name of the mysterious language. Examples Submitted Solution: ``` print("Python") ```
instruction
0
50,759
11
101,518
No
output
1
50,759
11
101,519
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. N friends of Takahashi has come to a theme park. To ride the most popular roller coaster in the park, you must be at least K centimeters tall. The i-th friend is h_i centimeters tall. How many of the Takahashi's friends can ride the roller coaster? Constraints * 1 \le N \le 10^5 * 1 \le K \le 500 * 1 \le h_i \le 500 * All values in input are integers. Input Input is given from Standard Input in the following format: N K h_1 h_2 \ldots h_N Output Print the number of people among the Takahashi's friends who can ride the roller coaster. Examples Input 4 150 150 140 100 200 Output 2 Input 1 500 499 Output 0 Input 5 1 100 200 300 400 500 Output 5 Submitted Solution: ``` N, K = map(int, input().split()) print(sum([int(i) >= K for i in input().split()])) ```
instruction
0
51,099
11
102,198
Yes
output
1
51,099
11
102,199
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. N friends of Takahashi has come to a theme park. To ride the most popular roller coaster in the park, you must be at least K centimeters tall. The i-th friend is h_i centimeters tall. How many of the Takahashi's friends can ride the roller coaster? Constraints * 1 \le N \le 10^5 * 1 \le K \le 500 * 1 \le h_i \le 500 * All values in input are integers. Input Input is given from Standard Input in the following format: N K h_1 h_2 \ldots h_N Output Print the number of people among the Takahashi's friends who can ride the roller coaster. Examples Input 4 150 150 140 100 200 Output 2 Input 1 500 499 Output 0 Input 5 1 100 200 300 400 500 Output 5 Submitted Solution: ``` N,K=map(int,input().split()) h=list(map(int,input().split())) print(sum(x>=K for x in h)) ```
instruction
0
51,102
11
102,204
Yes
output
1
51,102
11
102,205
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. N friends of Takahashi has come to a theme park. To ride the most popular roller coaster in the park, you must be at least K centimeters tall. The i-th friend is h_i centimeters tall. How many of the Takahashi's friends can ride the roller coaster? Constraints * 1 \le N \le 10^5 * 1 \le K \le 500 * 1 \le h_i \le 500 * All values in input are integers. Input Input is given from Standard Input in the following format: N K h_1 h_2 \ldots h_N Output Print the number of people among the Takahashi's friends who can ride the roller coaster. Examples Input 4 150 150 140 100 200 Output 2 Input 1 500 499 Output 0 Input 5 1 100 200 300 400 500 Output 5 Submitted Solution: ``` N_K = str(input()) H = str(input()).split(" ") N = N_K.split(" ")[0] K = N_K.split(" ")[1] count = 0 for h in H: if K <= h: count += 1 print(count) ```
instruction
0
51,105
11
102,210
No
output
1
51,105
11
102,211
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. «Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the next test will have, the system suggests the default value of the index. It is calculated as the smallest positive integer which is not used as an index for some previously added test. You are to implement this feature. Create a program which determines the default index of the next test, given the indexes of the previously added tests. Input The first line contains one integer n (1 ≤ n ≤ 3000) — the amount of previously added tests. The second line contains n distinct integers a1, a2, ..., an (1 ≤ ai ≤ 3000) — indexes of these tests. Output Output the required default value for the next test index. Examples Input 3 1 7 2 Output 3 Submitted Solution: ``` count = int(input()) numbers = list(map(lambda x: int(x), input().split(' '))) num = 1 while True: if num in numbers: pass else: print(num) break num += 1 ```
instruction
0
51,630
11
103,260
Yes
output
1
51,630
11
103,261
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. «Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the next test will have, the system suggests the default value of the index. It is calculated as the smallest positive integer which is not used as an index for some previously added test. You are to implement this feature. Create a program which determines the default index of the next test, given the indexes of the previously added tests. Input The first line contains one integer n (1 ≤ n ≤ 3000) — the amount of previously added tests. The second line contains n distinct integers a1, a2, ..., an (1 ≤ ai ≤ 3000) — indexes of these tests. Output Output the required default value for the next test index. Examples Input 3 1 7 2 Output 3 Submitted Solution: ``` from collections import Counter n=int(input()) l=list(map(int,input().split())) l1=[0]*3002 l1[0]=1 for i in range(n): l1[l[i]]=1 print(l1.index(0)) ```
instruction
0
51,631
11
103,262
Yes
output
1
51,631
11
103,263
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. «Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the next test will have, the system suggests the default value of the index. It is calculated as the smallest positive integer which is not used as an index for some previously added test. You are to implement this feature. Create a program which determines the default index of the next test, given the indexes of the previously added tests. Input The first line contains one integer n (1 ≤ n ≤ 3000) — the amount of previously added tests. The second line contains n distinct integers a1, a2, ..., an (1 ≤ ai ≤ 3000) — indexes of these tests. Output Output the required default value for the next test index. Examples Input 3 1 7 2 Output 3 Submitted Solution: ``` n = int(input()); i = 1; x = sorted(list(map(int, input().split()))) while i in x: i+=1 print(i) ```
instruction
0
51,632
11
103,264
Yes
output
1
51,632
11
103,265
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. «Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the next test will have, the system suggests the default value of the index. It is calculated as the smallest positive integer which is not used as an index for some previously added test. You are to implement this feature. Create a program which determines the default index of the next test, given the indexes of the previously added tests. Input The first line contains one integer n (1 ≤ n ≤ 3000) — the amount of previously added tests. The second line contains n distinct integers a1, a2, ..., an (1 ≤ ai ≤ 3000) — indexes of these tests. Output Output the required default value for the next test index. Examples Input 3 1 7 2 Output 3 Submitted Solution: ``` n = int(input()) ll = list(map(int , input().split())) minn = 1 while minn in ll: minn += 1 print(minn) ```
instruction
0
51,633
11
103,266
Yes
output
1
51,633
11
103,267
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. «Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the next test will have, the system suggests the default value of the index. It is calculated as the smallest positive integer which is not used as an index for some previously added test. You are to implement this feature. Create a program which determines the default index of the next test, given the indexes of the previously added tests. Input The first line contains one integer n (1 ≤ n ≤ 3000) — the amount of previously added tests. The second line contains n distinct integers a1, a2, ..., an (1 ≤ ai ≤ 3000) — indexes of these tests. Output Output the required default value for the next test index. Examples Input 3 1 7 2 Output 3 Submitted Solution: ``` n=int(input()) a=sorted(list(map(int,input().split())))+[3001] for i in range(n): if a[i+1]-a[i]>1: print(a[i]+1) exit() ```
instruction
0
51,634
11
103,268
No
output
1
51,634
11
103,269
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. «Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the next test will have, the system suggests the default value of the index. It is calculated as the smallest positive integer which is not used as an index for some previously added test. You are to implement this feature. Create a program which determines the default index of the next test, given the indexes of the previously added tests. Input The first line contains one integer n (1 ≤ n ≤ 3000) — the amount of previously added tests. The second line contains n distinct integers a1, a2, ..., an (1 ≤ ai ≤ 3000) — indexes of these tests. Output Output the required default value for the next test index. Examples Input 3 1 7 2 Output 3 Submitted Solution: ``` n = int(input()) a = input().split(" ") for i in range(n): a[i] = int(a[i]) a = sorted(a) for i in range(n): if a[i] != i+1: break print(i+1) ```
instruction
0
51,635
11
103,270
No
output
1
51,635
11
103,271
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. «Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the next test will have, the system suggests the default value of the index. It is calculated as the smallest positive integer which is not used as an index for some previously added test. You are to implement this feature. Create a program which determines the default index of the next test, given the indexes of the previously added tests. Input The first line contains one integer n (1 ≤ n ≤ 3000) — the amount of previously added tests. The second line contains n distinct integers a1, a2, ..., an (1 ≤ ai ≤ 3000) — indexes of these tests. Output Output the required default value for the next test index. Examples Input 3 1 7 2 Output 3 Submitted Solution: ``` import sys #считывание данных n = int(sys.stdin.readline().strip('\n')) an_raw = ((sys.stdin.readline().strip('\n')).split()) an = list(map(int,an_raw)) an_sorted=sorted(an) i = 1 flag ='down' if an_sorted[0] >= 2: print(1) flag ='end' if (n >= 2)and(flag =='down'): while i < n: if (an_sorted[i] - an_sorted[i-1]) >= 2: print(an_sorted[i-1]+1) flag ='up' i =i+1 if flag == 'down': print(an_sorted[n-1]+1) ```
instruction
0
51,636
11
103,272
No
output
1
51,636
11
103,273
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. «Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the next test will have, the system suggests the default value of the index. It is calculated as the smallest positive integer which is not used as an index for some previously added test. You are to implement this feature. Create a program which determines the default index of the next test, given the indexes of the previously added tests. Input The first line contains one integer n (1 ≤ n ≤ 3000) — the amount of previously added tests. The second line contains n distinct integers a1, a2, ..., an (1 ≤ ai ≤ 3000) — indexes of these tests. Output Output the required default value for the next test index. Examples Input 3 1 7 2 Output 3 Submitted Solution: ``` import math t=int(input()) l=list(map(int,input().split())) if(t<=2): print(t+1) else: print(t) ```
instruction
0
51,637
11
103,274
No
output
1
51,637
11
103,275
Provide tags and a correct Python 3 solution for this coding contest problem. While resting on the ship after the "Russian Code Cup" a boy named Misha invented an interesting game. He promised to give his quadrocopter to whoever will be the first one to make a rectangular table of size n × m, consisting of positive integers such that the sum of the squares of numbers for each row and each column was also a square. Since checking the correctness of the table manually is difficult, Misha asks you to make each number in the table to not exceed 108. Input The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the size of the table. Output Print the table that meets the condition: n lines containing m integers, separated by spaces. If there are multiple possible answers, you are allowed to print anyone. It is guaranteed that there exists at least one correct answer. Examples Input 1 1 Output 1 Input 1 2 Output 3 4
instruction
0
51,674
11
103,348
Tags: constructive algorithms, math, probabilities Correct Solution: ``` """ Codeforces Round 241 Div 1 Problem E Author : chaotic_iak Language: Python 3.3.4 """ class InputHandlerObject(object): inputs = [] def getInput(self, n = 0): res = "" inputs = self.inputs if not inputs: inputs.extend(input().split(" ")) if n == 0: res = inputs[:] inputs[:] = [] while n > len(inputs): inputs.extend(input().split(" ")) if n > 0: res = inputs[:n] inputs[:n] = [] return res InputHandler = InputHandlerObject() g = InputHandler.getInput ############################## SOLUTION ############################## n,m = [int(x) for x in g()] def sqr(n): if n == 1: return [1] if n == 2: return [4,3] if n % 2: return [(n+1)//2, 2] + [1] * (n-2) return [(n-2)//2] + [1] * (n-1) a = sqr(n) b = sqr(m) for i in range(n): res = [str(a[i]*x) for x in b] print(" ".join(res)) ```
output
1
51,674
11
103,349
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. While resting on the ship after the "Russian Code Cup" a boy named Misha invented an interesting game. He promised to give his quadrocopter to whoever will be the first one to make a rectangular table of size n × m, consisting of positive integers such that the sum of the squares of numbers for each row and each column was also a square. Since checking the correctness of the table manually is difficult, Misha asks you to make each number in the table to not exceed 108. Input The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the size of the table. Output Print the table that meets the condition: n lines containing m integers, separated by spaces. If there are multiple possible answers, you are allowed to print anyone. It is guaranteed that there exists at least one correct answer. Examples Input 1 1 Output 1 Input 1 2 Output 3 4 Submitted Solution: ``` def ff(x): if x==1: return [1] elif x==2: return [3,4] elif x%2==1: return [x/2+1,2]+[1]*(x-2) else: return [x/2-1]+[1]*(x-1) n,m=map(int,input().split()) for a in ff(n): for b in ff(m): print (a*b,) print() ```
instruction
0
51,675
11
103,350
No
output
1
51,675
11
103,351
Provide tags and a correct Python 3 solution for this coding contest problem. The Department of economic development of IT City created a model of city development till year 2100. To prepare report about growth perspectives it is required to get growth estimates from the model. To get the growth estimates it is required to solve a quadratic equation. Since the Department of economic development of IT City creates realistic models only, that quadratic equation has a solution, moreover there are exactly two different real roots. The greater of these roots corresponds to the optimistic scenario, the smaller one corresponds to the pessimistic one. Help to get these estimates, first the optimistic, then the pessimistic one. Input The only line of the input contains three integers a, b, c ( - 1000 ≤ a, b, c ≤ 1000) — the coefficients of ax2 + bx + c = 0 equation. Output In the first line output the greater of the equation roots, in the second line output the smaller one. Absolute or relative error should not be greater than 10 - 6. Examples Input 1 30 200 Output -10.000000000000000 -20.000000000000000
instruction
0
51,740
11
103,480
Tags: math Correct Solution: ``` import math a, b, c = list(map(int, input().split())) delta = b*b-4*a*c x1 = (-b-math.sqrt(delta))/(2*a) x2 = (-b+math.sqrt(delta))/(2*a) if(x1>=x2): print(x1, end = ' ') print(x2) else: print(x2, end = ' ') print(x1) ```
output
1
51,740
11
103,481
Provide tags and a correct Python 3 solution for this coding contest problem. The Department of economic development of IT City created a model of city development till year 2100. To prepare report about growth perspectives it is required to get growth estimates from the model. To get the growth estimates it is required to solve a quadratic equation. Since the Department of economic development of IT City creates realistic models only, that quadratic equation has a solution, moreover there are exactly two different real roots. The greater of these roots corresponds to the optimistic scenario, the smaller one corresponds to the pessimistic one. Help to get these estimates, first the optimistic, then the pessimistic one. Input The only line of the input contains three integers a, b, c ( - 1000 ≤ a, b, c ≤ 1000) — the coefficients of ax2 + bx + c = 0 equation. Output In the first line output the greater of the equation roots, in the second line output the smaller one. Absolute or relative error should not be greater than 10 - 6. Examples Input 1 30 200 Output -10.000000000000000 -20.000000000000000
instruction
0
51,742
11
103,484
Tags: math Correct Solution: ``` a,b,c=input().split(' ') a=int(a) b=int(b) c=int(c) d=(b*b-4*a*c)**0.5 print("{:.15f}".format(max((-b+d)/(2*a),(-b-d)/(2*a)))) print("{:.15f}".format(min((-b+d)/(2*a),(-b-d)/(2*a)))) ```
output
1
51,742
11
103,485
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Department of economic development of IT City created a model of city development till year 2100. To prepare report about growth perspectives it is required to get growth estimates from the model. To get the growth estimates it is required to solve a quadratic equation. Since the Department of economic development of IT City creates realistic models only, that quadratic equation has a solution, moreover there are exactly two different real roots. The greater of these roots corresponds to the optimistic scenario, the smaller one corresponds to the pessimistic one. Help to get these estimates, first the optimistic, then the pessimistic one. Input The only line of the input contains three integers a, b, c ( - 1000 ≤ a, b, c ≤ 1000) — the coefficients of ax2 + bx + c = 0 equation. Output In the first line output the greater of the equation roots, in the second line output the smaller one. Absolute or relative error should not be greater than 10 - 6. Examples Input 1 30 200 Output -10.000000000000000 -20.000000000000000 Submitted Solution: ``` from math import sqrt a,b,c = map(int,input().split()) r = ((-b + sqrt(b*b-4*a*c))/(2*a)) r1 = ((-b - sqrt(b*b-4*a*c))/(2*a)) a = max(r,r1) b = min(r,r1) print(a) print(b) ```
instruction
0
51,746
11
103,492
Yes
output
1
51,746
11
103,493
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Department of economic development of IT City created a model of city development till year 2100. To prepare report about growth perspectives it is required to get growth estimates from the model. To get the growth estimates it is required to solve a quadratic equation. Since the Department of economic development of IT City creates realistic models only, that quadratic equation has a solution, moreover there are exactly two different real roots. The greater of these roots corresponds to the optimistic scenario, the smaller one corresponds to the pessimistic one. Help to get these estimates, first the optimistic, then the pessimistic one. Input The only line of the input contains three integers a, b, c ( - 1000 ≤ a, b, c ≤ 1000) — the coefficients of ax2 + bx + c = 0 equation. Output In the first line output the greater of the equation roots, in the second line output the smaller one. Absolute or relative error should not be greater than 10 - 6. Examples Input 1 30 200 Output -10.000000000000000 -20.000000000000000 Submitted Solution: ``` a,b,c=map(float,input().split()) q=((b*b-4*a*c)**0.5) x=((-b+q)/(2*a)) y=((-b-q)/(2*a)) print(max(x,y)) print(min(x,y)) ```
instruction
0
51,747
11
103,494
Yes
output
1
51,747
11
103,495
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Department of economic development of IT City created a model of city development till year 2100. To prepare report about growth perspectives it is required to get growth estimates from the model. To get the growth estimates it is required to solve a quadratic equation. Since the Department of economic development of IT City creates realistic models only, that quadratic equation has a solution, moreover there are exactly two different real roots. The greater of these roots corresponds to the optimistic scenario, the smaller one corresponds to the pessimistic one. Help to get these estimates, first the optimistic, then the pessimistic one. Input The only line of the input contains three integers a, b, c ( - 1000 ≤ a, b, c ≤ 1000) — the coefficients of ax2 + bx + c = 0 equation. Output In the first line output the greater of the equation roots, in the second line output the smaller one. Absolute or relative error should not be greater than 10 - 6. Examples Input 1 30 200 Output -10.000000000000000 -20.000000000000000 Submitted Solution: ``` from math import * a,b,c=map(int,input().split()) Delta=b**2-4*a*c x1=(-b-sqrt(Delta))/(2*a) x2=(-b+sqrt(Delta))/(2*a) if x1>x2: x2,x1=x1,x2 x2="%.7f" % x2 x1="%.7f" % x1 print(x2[:-1]) print(x1[:-1]) ```
instruction
0
51,748
11
103,496
Yes
output
1
51,748
11
103,497
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Department of economic development of IT City created a model of city development till year 2100. To prepare report about growth perspectives it is required to get growth estimates from the model. To get the growth estimates it is required to solve a quadratic equation. Since the Department of economic development of IT City creates realistic models only, that quadratic equation has a solution, moreover there are exactly two different real roots. The greater of these roots corresponds to the optimistic scenario, the smaller one corresponds to the pessimistic one. Help to get these estimates, first the optimistic, then the pessimistic one. Input The only line of the input contains three integers a, b, c ( - 1000 ≤ a, b, c ≤ 1000) — the coefficients of ax2 + bx + c = 0 equation. Output In the first line output the greater of the equation roots, in the second line output the smaller one. Absolute or relative error should not be greater than 10 - 6. Examples Input 1 30 200 Output -10.000000000000000 -20.000000000000000 Submitted Solution: ``` X = list (map (int, input ().split (' '))) D = X [1] ** 2 - 4 * X [0] * X [2] print (max ((- X [1] + D ** (1 / 2)) / (2 * X [0]), (- X [1] - D ** (1 / 2)) / (2 * X [0]))) print (min ((- X [1] + D ** (1 / 2)) / (2 * X [0]), (- X [1] - D ** (1 / 2)) / (2 * X [0]))) ```
instruction
0
51,749
11
103,498
Yes
output
1
51,749
11
103,499