problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02689
s479301229
Accepted
n, m = map(int, input().split()) H = list(map(int, input().split())) ans = [1] * n for i in range(m): a, b = map(int, input().split()) if H[a-1]<H[b-1]: ans[a-1] = 0 elif H[b-1]<H[a-1]: ans[b-1] = 0 else: ans[a-1], ans[b-1] = 0, 0 print(sum(ans))
p03339
s760625043
Accepted
from collections import Counter n = int(input()) s = input() e = int(s.count('E')) ans = e a = 0 for i in range(n): if s[i] == 'W': a += 1 b = e - ((i+1)-a) ans = min(ans, a+b) print(ans)
p03338
s354765465
Accepted
N = int(input()) S = input() answer = 0 for i in range(1, N): # print(S[:i], S[i:]) x = list(set(S[:i])) y = list(set(S[i:])) # print(x) # print(y) count = 0 for j in range(len(x)): if x[j] in y: count += 1 if answer <= count: answer = count print(answer)
p03469
s749702451
Wrong Answer
s = input() print("2017/01/"+s[-2:])
p02775
s977335115
Accepted
import sys input = sys.stdin.readline a = ['0'] + list(input()) n = len(a)-1 for i in range(n): a[i] = int(a[i]) res = 0 for i in range(n-1,-1,-1): if a[i] <= 4: res += a[i] elif a[i] == 5: if a[i-1] >= 5: res += 5 a[i-1] += 1 else: res += 5 else: res += 10-a[i] a[i-1] += 1 print(res)
p02923
s251413951
Accepted
from sys import stdin nii=lambda:map(int,stdin.readline().split()) lnii=lambda:list(map(int,stdin.readline().split())) n=int(input()) h=lnii()+[10**10] ans=0 t_ans=0 for i in range(n): if h[i]>=h[i+1]: t_ans+=1 else: ans=max(ans,t_ans) t_ans=0 print(ans)
p02951
s104431867
Wrong Answer
a, b, c = map(int, input().split()) ab = a - b cab = c - ab if cab >= 0: print(0) if cab < 0: print(cab)
p03281
s734544920
Accepted
N = int(input()) ans = 0 for i in range(1, N+1): if i%2 != 0: cnt = 0 for j in range(1, i+1): if i%j == 0: cnt += 1 if cnt == 8: ans += 1 print(ans)
p02772
s374170180
Wrong Answer
import sys n = int(sys.stdin.readline().rstrip()) li = list(map(int, sys.stdin.readline().split())) li2 = [] for i in li: if not i % 2: li2.append(i) if not len(li2): flag = True else: flag = False for i in li2: if not i % 3 and not i % 5: flag = False break print('APPROVED' if flag else 'DENIED')
p03778
s579686233
Wrong Answer
w, a, b = map(int, input().split()) if a + w < b: print(b - (a + w)) elif b + w < a: print(a - (b + w)) elif a < b < a + w : print(0)
p02993
s600387493
Accepted
a,b,c,d = input() print('Bad' if a==b or b==c or c==d else 'Good')
p03105
s657123027
Accepted
A,B,C = list(map(int,input().split())) if B >= A*C: print(C) else: print(B//A)
p02987
s998561305
Accepted
s = list(input()) s = sorted(s) if s[0] == s[1] and s[1] != s[2] and s[2] == s[3]: print('Yes') else: print('No')
p03071
s608588934
Accepted
A,B=map(int,input().split()) ans=0 for i in range(2): if A>=B: ans=ans+A A=A-1 else: ans=ans+B B=B-1 print(ans)
p02608
s285324549
Wrong Answer
N = 20 x,y,z = [0,0,0] for i in range(1,N+1): ans = 0 if i < 6: print(0) continue for j in range(1,int(i**0.5)+1): for k in range(1,int(i**0.5)+1): for m in range(1,int(i**0.5)+1): if j**2 + k**2 + m**2 +j*k + j*m + m*k == i: ans += 1 print(ans)
p02642
s519745844
Accepted
n = int(input()) a = list(map(int, input().split())) cnt = [0] * ((10 ** 6) + 1) for elem in a: cnt[elem] += 1 unique = [] for i in range((10 ** 6) + 1): if cnt[i] == 1: unique.append(i) cnt = [0] * ((10 ** 6) + 1) a = list(set(a)) for elem in a: for m in range(elem * 2, (10 ** 6) + 1, elem): cnt[m] = 1 ans = 0 for elem in unique: if cnt[elem] == 0: ans += 1 print(ans)
p02772
s595112960
Accepted
input() a = map(int, input().split()) for i in a : if i%2==0 and i%3 != 0 and i%5 != 0 : print("DENIED") break else: print("APPROVED")
p02600
s156406377
Accepted
x=int(input()) print(8-int((x-400)/200))
p03448
s822026058
Accepted
coin = [int(input()) for _ in range(3)] X = int(input()) A = [] for i in range(coin[0]+1): for j in range(coin[1]+1): for k in range(coin[2]+1): A.append(500*i+100*j+50*k) ans = A.count(X) print(ans)
p03126
s454902387
Accepted
def i(): return int(input()) def i2(): return map(int,input().split()) def s(): return str(input()) def l(): return list(input()) def intl(): return list(int(k) for k in input().split()) n,m = i2() ls = [] for _ in range(n): a = intl() a = a[1:] ls.append(a) for i in range(n-1): tmp = [] for j in ls[i]: for k in ls[i+1]: if j == k: tmp.append(j) ls[i+1] = tmp print( len(ls[-1]) )
p03611
s015222129
Accepted
N = int(input()) A_list = list(map(int, input().split())) A_dict = dict() for a in A_list: if A_dict.get(a) is None: A_dict[a] = 1 else: A_dict[a] += 1 ans = 0 for key, val in A_dict.items(): temp = 0 if A_dict.get(key - 1) is not None: temp += A_dict.get(key - 1) if A_dict.get(key) is not None: temp += A_dict.get(key) if A_dict.get(key + 1) is not None: temp += A_dict.get(key + 1) ans = max(temp, ans) print(ans)
p02665
s834387142
Accepted
N = int(input()) A = list(map(int, input().split())) flg = True n_node = 0.5 ans = 0 As = [0]*(N+2) for i in range(N, -1, -1): As[i] = As[i+1] + A[i] for i in range(N+1): if A[i] > n_node*2: flg = False break n_node = min(int(n_node*2)-A[i], As[i+1]) ans += n_node + A[i] print(ans if flg else -1)
p02647
s436762621
Accepted
n, k = map(int, input().split()) a = list(map(int, input().split())) for _ in range(k): b = [0] * (n + 1) for i in range(n): b[max(0, i - a[i])] += 1 b[min(n, i + a[i] + 1)] -= 1 a[0] = b[0] for i in range(1, n): a[i] = b[i] + a[i - 1] if sum(a) == pow(n, 2): break print(*a)
p03723
s700830100
Accepted
a, b, c = map(int, input().split()) ans = 0 while True: if ans > 999999: print(-1) break elif a % 2 != 0 or b % 2 != 0 or c % 2 != 0: print(ans) break a, b, c = (b+c) // 2, (a+c) // 2, (a+b) // 2 ans += 1
p03632
s865761684
Accepted
#https://atcoder.jp/contests/abc070/tasks/abc070_b a,b,c,d=map(int,input().split()) s1=set() s2=set() for i in range(a,b+1): s1.add(i) for i in range(c,d+1): s2.add(i) s1_s2_and=s1&s2 if len(s1_s2_and)==0: print(0) else: print(len(s1_s2_and)-1)
p03705
s058797315
Accepted
N, A, B = map(int, input().split()) print(max((B - A) * (N - 2) + 1, 0))
p04011
s960076930
Wrong Answer
# 入力 n = int(input()) k = int(input()) x = int(input()) y = int(input()) # 処理 if n >= k: first_stay = k * x second_stay = (n - k) * y total = first_stay + second_stay elif n < k: total = n * k print(total)
p02622
s992560954
Wrong Answer
S = input() T = input() count = 0 if S == T: print(count) exit(0) for i in range(len(S)): if S[i] != T[i]: S = S.replace(S[i], T[i]) count += 1 print(count)
p02646
s359168999
Wrong Answer
import sys if __name__ == '__main__': A, V = list(map(lambda x:int(x), sys.stdin.readline().rstrip().split(' '))) B, W = list(map(lambda x:int(x), sys.stdin.readline().rstrip().split(' '))) T = int(sys.stdin.readline()) dist = B - A d_dist = V - W if d_dist * T >= dist: print('YES') else: print('NO')
p02618
s073824580
Accepted
D = int(input()) c = list(map(int, input().split())) s = [list(map(int, input().split())) for _ in range(D)] last = [0 for _ in range(26)] calc = [0 for _ in range(26)] for i in range(D): for j in range(26): day = i + 1 calc[j] = c[j] * (day - last[j]) min_idx = calc.index(max(calc)) last[min_idx] = day print(min_idx + 1)
p02713
s140571987
Accepted
def gcd(a, b): if b == 0: return a return gcd(b, a%b) N=int(input()) s=0 for i in range(1,N+1): for j in range(i+1,N+1): for h in range(j+1,N+1): a=gcd(i,j) s+=6*gcd(a,h) for p in range(1,N+1): for q in range(1,N+1): if p==q: s+=p else: s+=3*gcd(p,q) print(s)
p03617
s084647777
Wrong Answer
q,h,s,d=map(int,input().split()) n=int(input()) l=min(q*n*8,h*n*4,s*n*2,d*n) if l != d*n: print(int(l/2)) else: m=min(q*4,h*2,s) print(int((d*(n-1)/2)+m) if n%2==1 else int(l/2))
p02823
s637595525
Accepted
n,a,b = map(int, input().split()) if (abs(a-b)%2==0): print(abs(a-b)//2) else: print(min((a+b-1)//2, (2*n-a-b+1)//2))
p02623
s570035447
Accepted
from bisect import * N,M,K,*f = map(int, open(0).read().split()) A = f[:N] B = f[N:] csa = [0] ans = 0 for i in range(N): csa.append(csa[i]+A[i]) csb = [0] for i in range(M): csb.append(csb[i]+B[i]) for i in range(N+1): if csa[i] <= K: bs = bisect_right(csb,K-csa[i]) ans = max(ans,i+bs-1) else: break print(ans)
p02621
s409465804
Accepted
a = int(input()) print(a + (a*a) + (a*a*a))
p02832
s075431878
Accepted
n = int(input()) a = list(map(int, input().split())) ans = 0 k = 1 for i in range(n): if a[i] != k: ans += 1 else: k += 1 ans = ans if ans < n else -1 print(ans)
p03485
s279581661
Accepted
import math a,b=map(int,input().split()) print(math.ceil(a/2+b/2))
p02773
s852369168
Wrong Answer
N = int(input()) S = sorted(input() for i in range(N)) C = [0] * N for i in range(N): C[i] = S.count(S[i]) for i in range(N): if C[i] == max(C) and S[i] == S[(i+1) % N]: print(S[i])
p03038
s022270095
Accepted
n, m = map(int, input().split()) a = sorted(list(map(int, input().split()))) b = sorted([list(map(int, input().split())) for _ in range(m)], key=lambda x: x[1], reverse=True) c = 0 for i, j in b: for k in range(c, i + c): if k == n: break if a[k] < j: a[k] = j c += 1 else: break print(sum(a))
p02802
s613681158
Wrong Answer
N,M = map(int,input().split()) X = [[str(i) for i in input().split()] for i in range(M)] a=[] count_ac = 0 count_wa = 0 for i in range(M): if X[i][0] in a: continue if X[i][1] == 'AC': a.append(X[i][0]) count_ac += 1 else: count_wa += 1 print(count_ac,count_wa)
p03281
s837992186
Wrong Answer
#abc106b n = int(input()) ans = 0 for i in range(1,n+1): if i % 2 != 0: cnt = 0 for ni in range(1,i+1): if n % ni == 0: cnt += 1 if cnt == 8: ans += 1 print(ans)
p02917
s123242589
Wrong Answer
# C - Maximal Value N = int(input()) B = [int(b) for b in input().split()] A = [0] * N for i in range(N - 1): A[i + 1] = B[i] if B[i] < A[i]: A[i] = B[i] print(sum(A))
p03359
s581930791
Wrong Answer
a, b = map(int, input().split()) if a <= b: print(a+1) else: print(a)
p02570
s582270231
Accepted
import math d, t, s = map(int, input().split()) num = math.ceil(d/s) print("Yes" if num <= t else "No")
p02603
s167488047
Accepted
n = int(input()) a = list(map(int, input().split())) wallet = 1000 stock = 0 for i in range(len(a)-1): if a[i+1] > a[i]: new_stock = wallet // a[i] stock += new_stock wallet -= new_stock * a[i] elif a[i+1] < a[i]: wallet += stock * a[i] stock = 0 wallet += stock * a[n-1] print(wallet)
p03001
s626757003
Accepted
w, h, x, y = map(int, input().split()) ans = w * h / 2 n = 1 if w == x * 2 and h == y * 2 else 0 print(ans, n)
p02797
s594049817
Wrong Answer
# coding: utf-8 # Your code here! N,K,S=map(int,input().split()) ans=[] p=N-K for i in range(N-K): ans.append(str(S+1)) for i in range(K): ans.append(str(S)) #print(ans) #ans=' '.join(ans) #print(len(ans)) #print(" ".join([str(n) for n in ans])) print(*ans)
p03469
s047529161
Wrong Answer
a=input() a.replace(a[3],"8") print(a)
p03323
s435303616
Wrong Answer
a,b = map(int,input().split()) if 0 < a < 9 and 0 < b < 9: print('YaY!') else: print(':(')
p02677
s717241745
Accepted
A,B,h,M = list(map(int,input().split())) #余弦定理よりL^2=A^2+B^2-2ABcosα import math H = h + M/60 #M分だけ移動した時針  cos = math.cos(math.radians(6*abs(5*H-M))) print(math.sqrt(A ** 2 + B ** 2 - 2*A*B*cos))
p02663
s957551750
Accepted
h1, m1, h2, m2, k = map(int, input().split()) start_mins = h1 * 60 + m1 end_min = h2 * 60 + m2 is_up = end_min - start_mins can_start = is_up - k print(can_start)
p02779
s530714471
Accepted
N = int(input()) *l, = map(int, input().split()) print("YES" if len(l)==len(set(l)) else "NO")
p02726
s405769524
Accepted
from collections import defaultdict n, x, y = map(int, input().split()) x -= 1 y -= 1 d = defaultdict(int) for i in range(n-1): for j in range(i+1, n): path = min([j-i, abs(x-i)+abs(y-j)+1, abs(x-j)+abs(y-i)+1]) d[path] += 1 for i in range(1, n): print(d[i])
p02951
s251720150
Accepted
a,b,c=map(int,input().split()) if c-(a-b)>=0: print(c-(a-b)) else: print(0)
p02787
s351837240
Accepted
import sys read = sys.stdin.read def main(): h, n = map(int, input().split()) m = map(int, read().split()) mm = zip(m, m) large_num = 10**9 dp = [large_num] * (h + 10**4 + 1) dp[0] = 0 for a, b in mm: for i1 in range(h + 1): if dp[i1 + a] > dp[i1] + b: dp[i1 + a] = dp[i1] + b r = min(dp[h:]) print(r) if __name__ == '__main__': main()
p02972
s450624012
Wrong Answer
N = int(input()) a = list(map(int, input().split())) b = [] for i in range(N, 0, -1): j = i * 2 s = a[i - 1] while j <= N: s += a[j - 1] j += i if s % 2 == 1: b.append(i) print(len(b)) b = list(map(str, b)) print(" ".join(b))
p03106
s360313173
Accepted
a, b, k = list(map(int, input().split())) ans = [] for i in range(1, min(a, b) + 1): if a % i == 0 and b % i == 0: ans.append(i) print(ans[-k])
p03680
s874190824
Accepted
# https://atcoder.jp/contests/abc065/tasks/abc065_b def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) N = INT() a = [] for _ in range(N): a.append(INT() - 1) light_idx = 0 ans = 0 while True: light_idx = a[light_idx] ans += 1 if light_idx == 1: break if ans > N: ans = -1 break print(ans)
p02607
s028254840
Accepted
print(sum(map(lambda x:int(x)%2,open(0).read().split()[1::2])))
p03773
s926383696
Accepted
a, b = input().split() if int(a) + int(b) < 24: print(int(a) + int(b)) elif int(a) + int(b) >= 24: print(int(a) + int(b) - 24)
p03796
s991550298
Accepted
N = int(input()) ans = 1 for i in range(1, N+1): ans = ans * i % (10**9+7) print(ans % (10**9+7))
p02859
s284528117
Accepted
r = int(input()) print(r**2)
p02681
s095423837
Accepted
s = input() print("YNeos"[input()[:-1]!=s::2])
p02600
s934914995
Accepted
X=int(input()) a=X//200 print(10-a)
p03695
s067109970
Accepted
n = int(input()) a = list(map(int, input().split())) ans = 0 t = 400 while t < 3201: for i in a: if i >= t-400 and i < t: ans += 1 break t += 400 s = 0 for i in a: if i >= 3200: s += 1 if ans == 0: print(1, s) else: print(ans, ans+s)
p03852
s642965074
Wrong Answer
c = input() if "aiueo" in c: print("vowel") else : print("consonant")
p03543
s333804331
Wrong Answer
n = input() print('Yes' if n.count(n[0]) >= 3 or n.count(n[1]) >= 3 or n.count(n[0]) == 4 else 'No')
p02732
s758587010
Accepted
from collections import defaultdict N = int(input()) A = list(map(int, input().split())) A_dic = defaultdict(int) for i in A: A_dic[i] += 1 S = sum([(i*(i-1))//2 for i in list(A_dic.values()) if i >= 2]) for i in range(N): print(S - A_dic[A[i]] + 1)
p02836
s239032292
Wrong Answer
s = input() cnt = 0 for i in range(int(len(s) // 2)): if s[i] != s[-i]: cnt += 1 print(cnt)
p03795
s182642467
Wrong Answer
from sys import stdin, stdout def main(): line = stdin.readline() parts = line.split() X = int(parts[0]) x = X*800 y = 200*int(X/15) stdout.write(str(x-y) + '\n') stdout.write('So far, Snuke has paid ' +str(x) + ' yen, and the restaurant has paid back' + str(y)+ 'yen. Thus, the answer is '+ str(x-y) + '.') main()
p02661
s437038661
Accepted
n = int(input()) a = [0] * n b = [0] * n for i in range(n): a[i], b[i] = [int(j) for j in input().split()] a.sort() b.sort() if n % 2 == 1: print(b[n//2] - a[n//2] + 1) else: print(b[n//2] + b[n//2-1] - a[n//2] - a[n//2-1] + 1)
p02768
s913508748
Accepted
n, a, b = [int(i) for i in input().split()] mod = 10**9 + 7 total = (2**n - 1) % mod def modinv(a, mod=10**9+7): return pow(a, mod-2, mod) def combination(n, r, mod=10**9+7): r = min(r, n-r) res = 1 for i in range(r): res = res * (n - i) * modinv(i+1, mod) % mod return res at = combination(n,a) bt = combination(n,b) result = total - at - bt result %= mod if result < 0: result += mod print(result)
p03474
s548887579
Accepted
import os import sys import math if os.environ.get("DEBUG") is not None: sys.stdin = open("in.txt", "r") rl = sys.stdin.readline a, b = map(int, rl().split()) s = rl().rstrip("\n") failed = False for i in range(0, a): if not 48 <= ord(s[i]) <= 57: failed = True break if s[a] != "-": failed = True for i in range(a + 1, len(s)): if not 48 <= ord(s[i]) <= 57: failed = True break print("No" if failed else "Yes")
p03637
s671789727
Wrong Answer
def main(): N = int(input()) A = list(map(int, input().split(' '))) c_4, c_2, c_0 = 0, 0, 0 for a in A: if a % 4 == 0: c_4 += 1 elif a % 2 == 0: c_2 += 1 else: c_0 += 1 print('Yes' if c_4 >= c_0 else 'No') if __name__ == '__main__': main()
p02606
s073448710
Accepted
import sys input = lambda:sys.stdin.readline().strip() l,r,d = map(int,input().split()) print(max((r//d)-(l-1)//d,0))
p03632
s704731901
Accepted
A,B,C,D=map(int,input().split()) if B<C or D<A: print(0) exit() else: start=max(A,C) end=min(B,D) print(end-start)
p03095
s565520023
Accepted
n = int(input()) s = list(input()) p=10**9+7 from collections import Counter c = Counter(s) ans = 1 for k,v in c.items(): ans *=(v+1)%p ans -=1 print(ans%p)
p02707
s803063643
Accepted
N = int(input()) A = list(map(int, input().split())) count = 0 buka = [0 for _ in range(N)] for i in range(N-1): buka[A[i]-1] += 1 for k in range(N): print(buka[k])
p03545
s372036516
Accepted
a = input() for x in range(1<<3): s = a[0] for i in range(3): if x & (1<<i): s += '+' else: s += '-' s += a[i+1] if eval(s) == 7: print(s + '=7') exit()
p02833
s579683882
Wrong Answer
N = int(input()) cnt = 0 N //= 2 while N: cnt += N//5 N //= 5 print(cnt)
p03386
s395511038
Accepted
a,b,k = map(int,input().split()) if 2*k>=b-a+1: for i in range(a,b+1): print(i) else: for i in range(a,a+k): print(i) for i in range(b-k+1,b+1): print(i)
p03438
s585032358
Accepted
N=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) plus=0 minus=0 gomi=0 for i in range(N): if(a[i]-b[i]<0): minus+=((b[i]-a[i])//2)*2 else: plus+=a[i]-b[i] if(minus>=plus*2): print("Yes") else: print("No")
p02854
s956607420
Wrong Answer
n = int(input()) a = list(map(int,input().split())) ruiseki_WA=[0] for i in range(n): ruiseki_WA.append(ruiseki_WA[i]+a[i]) ans=114514 for i in range(n): kari=abs(ruiseki_WA[i]-(ruiseki_WA[-1]-ruiseki_WA[i])) ans=min(ans,kari) print(ans)
p03013
s416372657
Wrong Answer
n,m=map(int,input().split()) A=[] for i in range(m): A.append(int(input())) x=[0]*(n+1) x[0]=1 if 1 in A: x[1]=0 else: x[1]=1 for j in range(2,n+1): if j in A: x[j]=0 else: x[j]=x[j-1]+x[j-2] x[j]%1000000007 print(x[n])
p02823
s316062986
Accepted
n,a,b=map(int,input().split()) if a%2==b%2: print((b-a)//2) exit() if a-1<n-b: print(a+(b-a-1)//2) else: print(n-b+1+(b-a-1)//2)
p04031
s462613473
Wrong Answer
n = int(raw_input()) ais = map(int, raw_input().split()) ais.sort() def f(ais): if len(ais) % 2: return [ais[len(ais)/2]] v = ais[len(ais)/2 -1] + ais[len(ais)/2] return [v/2,v/2-1,v/2+1] meds = f(ais) def g(ais,m): s= 0 for v in ais: s+=abs(v-m)**2 return s print min([g(ais,m) for m in meds])
p02613
s187951870
Wrong Answer
N = int(input()) A = [input() for i in range(N)] print('AC × {}'.format(A.count('AC'))) print('WA × {}'.format(A.count('WA'))) print('TLE × {}'.format(A.count('TLE'))) print('RE × {}'.format(A.count('RE')))
p02789
s939286234
Accepted
A,B = map(int,input().split()) print("Yes" if A==B else "No")
p02820
s500010833
Accepted
from collections import deque n,k = map(int,input().split()) r,s,p = map(int,input().split()) t = list(input()) points = {"r":r,"s":s,"p":p} d = {"r":"p","s":"r","p":"s"} que = deque([None]*k) ans = 0 for ti in t: x = que.popleft() if d[ti] != x: #print(d[ti]) que.append(d[ti]) ans+=points[d[ti]] else: #print(None) que.append(None) #que.popleft() #print(que,ti) print(ans)
p02866
s141869915
Accepted
from collections import Counter def resolve(): MOD = 998244353 N = int(input()) D = list(map(int, input().split())) if D[0] != 0: print(0) return CNT = Counter(D) if CNT[0] > 1: # 距離0は1個 print(0) return ans = 1 for i in range(1, max(D) + 1): ans *= pow(CNT[i - 1], CNT[i], MOD) ans %= MOD print(ans) if __name__ == "__main__": resolve()
p02676
s485625440
Accepted
# ABC168B k = int(input()) s = input() print(s if len(s) <= k else s[:k] + '...')
p03239
s153344905
Accepted
n,t=map(int,input().split()) ans=[] for i in range(n): a,b=map(int,input().split()) if b<=t: ans.append(a) if ans==[]: print("TLE") else: print(min(ans))
p02687
s427727896
Wrong Answer
print('A%sC'%'BR'[id(id)%9%2])
p03000
s107521153
Accepted
import bisect import sys input = sys.stdin.readline N,X = list(map(int,input().split())) L = list(map(int,input().split())) bn = [0] for i in range(N): bn.append(bn[-1]+L[i]) print(bisect.bisect_right(bn,X))
p02718
s563925475
Accepted
N, M = map(int, input().split(' ')) lis1 = list(map(int, input().split(' '))) S = sum(lis1) thresh = S / (4 * M) lis2 = sorted(lis1) if lis2[-M] < thresh: print('No') else: print('Yes')
p02688
s267730412
Accepted
n,k=[int(i) for i in input().split()] a=[0]*n for i in range(k): d=int(input()) motteru=[int(i) for i in input().split()] for j in motteru: a[j-1]+=1 print(a.count(0))
p03681
s359614079
Accepted
def test(): mod = 10**9 + 7 n, m = map(int, input().split()) if abs(n-m) > 1: print(0) exit() i_n = n i_m = m np = 1 mp = 1 while True: np = (np%mod) * (i_n%mod) mp = (mp%mod) * (i_m%mod) i_n -= 1 i_m -= 1 if i_n < 1: i_n = 1 if i_m < 1: i_m = 1 if i_n == 1 and i_m == 1: break s = 2 if n == m else 1 r = (mp*np*s) % (10**9 + 7) print(r) test()
p03317
s678092788
Accepted
import math n, k = map(int,input().split()) a = list(map(int,input().split())) print(math.ceil((n-1)/(k-1)))
p02766
s908020932
Accepted
import math N, K = map(int, input().split()) print(int(math.log(N, K) + 1))
p02756
s778040182
Wrong Answer
s = input() q = int(input()) for i in range(q): query = input() try: int(query) t = query except: t, f, c = query.split() if t == "1": s = s[-1] + s[1:-1] + s[0] else: if f == "1": s = c + s else: s = s + c print(s)