problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03698
s393970419
Wrong Answer
s = input() if len(s)!=set(s): print('yes') else: print('no')
p02754
s642034755
Accepted
n, a, b = map(int, input().split()) ans = n // (a + b) * a x = n % (a + b) ans += min(a, x) print(ans)
p02879
s696600023
Accepted
a,b=list(map(int,input().split())); hh=False; if a>9 or b>9: hh=True; if hh: print(-1); else: print(a*b);
p02606
s746774183
Wrong Answer
l,r,d=map(int,input().split()) print(r//d-l//r)
p02947
s062335467
Wrong Answer
n = int(input()) def aC2(a): ans = 1 for i in range(3,a+1): ans *= i return ans dic = {} for i in range(n): s = list(input()) s.sort() s = ''.join(s) if(dic.get(s) is None): dic[s] = 1 else: dic[s] += 1 ans = 0 for x in dic.values(): if(x==0 or x==1): continue ans += aC2(x) print(ans)
p02642
s216575880
Accepted
import sys from collections import Counter def input(): return sys.stdin.readline().rstrip() # ----------------------------------------------------------- # n = int(input()) A = list(int(x) for x in input().split()) A.sort() counter = Counter(A) ans = 0 cache = set() for a in A: if a in cache: continue tmp = a while tmp <= 10**6: cache.add(tmp) tmp += a if counter[a] == 1: ans += 1 print(ans)
p03309
s344815933
Accepted
N=int(input()) A=[(int(num)-i,i) for i,num in enumerate(input().split(),1)] b=(sorted(A)[N//2][0]) ans=0 for i in range(N): ans += abs(b-A[i][0]) print(ans)
p03239
s127814332
Accepted
N,T=map(int,input().split()) l=[] for i in range(N): c,t=map(int,input().split()) if t<=T: l.append(c) if len(l)==0: print("TLE") else: print(min(l))
p02748
s117637825
Accepted
import sys a,b,m = map(int,input().split()) ai = list(map(int,input().split())) bj = list(map(int,input().split())) #xyc =[] #for i in range(m): # xyc.append(list(map(int,input().split()))) an = min(ai)+min(bj) for i in range(m): x,y,c = map(int,input().split()) an = min(an,ai[x-1]+bj[y-1]-c) print(an)
p02947
s361265391
Accepted
n = int(input()) Dict = {} ans = 0 tmp_list = [] for i in range(n): tmp = list(input()) tmp_list.append(tmp) tmp_list.reverse() for i in range(n): tmp = tmp_list[i] tmp = sorted(tmp) tmp = ''.join(tmp) if tmp not in Dict.keys(): Dict[tmp] = 1 else: ans += Dict[tmp] Dict[tmp] += 1 print(ans)
p03639
s982339828
Accepted
n = int(input()) a = list(map(int, input().split())) count = 0 for i in a: if i % 4 == 0: count +=2 elif i %2 == 0 : count+=1 else: continue if len(a)%2 == 0: if count >=len(a): print("Yes") else: print("No") else: if count >= len(a)-1: print("Yes") else: print("No")
p02923
s007515088
Accepted
n = int(input()) h = list(map(int,input().split())) cnt = 0 ans = 0 for i in range(n-1): if h[i] >= h[i+1]: cnt += 1 else: ans = max(cnt,ans) cnt = 0 ans = max(cnt,ans) print(ans)
p02663
s434630194
Wrong Answer
H1, M1, H2, M2, K = map(int, input().split()) print(60 * (H2 - H1) - (M2 - M1) - K)
p02973
s749843080
Accepted
from bisect import bisect n = int(input()) ma = [-int(input()) for _ in range(n)] ans = [1] * n for ai in ma: tmp = bisect(ans, ai) ans[tmp] = ai print(sum(num <= 0 for num in ans))
p02753
s873352693
Accepted
#!/usr/bin/env python3 S = input() print("Yes" if "A" in S and "B" in S else "No")
p03693
s455822411
Wrong Answer
r,g,b = map(int,input().split()) number = r * 100 + g * 10 + b if number % 4 == 0: print("Yes") else: print("No")
p02622
s073337782
Accepted
S=input() T=input() l = len(S) r = 0 for i in range(l): if S[i]!=T[i]: r = r+ 1 print(r)
p03815
s982005581
Accepted
x = input() x = int(x) y1 = x // 11 * 2 p = x % 11 y2 = 0 if p > 0: y2 = 1 if p > 6: y2 = 2 # print("y1,y2,y=",y1,y2,y1+y2) print(y1+y2)
p03592
s687585350
Accepted
# -*- coding: utf-8 -*- N, M, K = map(int, input().split(' ')) for n in range(N+1): for m in range(M+1): k = n*(M-m) + m*(N-n) if k == K: print('Yes') exit() print('No')
p02753
s071500617
Wrong Answer
X = input() Y = X.count("A") Z = X.count("B") if (Y == 3 or Z ==3): print("Yes") else: print("No")
p03264
s530101041
Accepted
n = int(input()) if n%2 == 1: print((n//2) * (n//2+1)) else: print((n//2) * (n//2))
p02640
s346313535
Wrong Answer
import numpy as np X, Y = map(int, input().split()) cranes = np.arange(X+1) * 2 turtles = (np.arange(X+1)*4).reshape(-1,1) total = cranes + turtles if np.any(total == Y): print('Yes') else: print('No')
p03041
s147335230
Accepted
a,b = input().split(" ") c = list(map(str,input().split())) print(c[0][:int(b)-1] + c[0][int(b)-1].lower() + c[0][int(b):])
p02678
s094680331
Accepted
from collections import deque N,M=map(int,input().split()) haba=[[] for i in range(N+1)] for i in range(M): A,B=map(int,input().split()) haba[A].append(B) haba[B].append(A) kyori=[-1]*(N+1) kyori[0]=0 kyori[1]=0 que=deque() que.append(1) while que: kari=que.popleft() for i in haba[kari]: if kyori[i]!=-1: continue kyori[i]=kari que.append(i) ans=kyori[2:] print("Yes") for i in range(len(ans)): print(ans[i])
p02548
s451435219
Accepted
## coding: UTF-8 N = int(input()) ans = 0 for A in range(1, N+1): #rint(A, (N-1)//A) ans += (N-1) // A print(ans)
p03071
s976592728
Accepted
x,y=map(int,input().split()) z=max(x,y)-1 e=max(x,y,z) if x==y: print(2*x) else: print(z+e)
p03962
s416693937
Wrong Answer
S = input() print(len(set(S))-1)
p02973
s876315785
Accepted
# --*-coding:utf-8-*-- import bisect N = int(input()) A = [int(input()) for _ in range(N)] Q = [] x = 0 for a in A: idx = bisect.bisect_right(Q, -a) if idx >= len(Q): x += 1 Q.append(-a) else: Q[idx] = -a print(x)
p03644
s144695365
Accepted
# B - Break Number N = int(input()) print(2**(N.bit_length()-1))
p03471
s354459842
Wrong Answer
nums = [] nums = input().split() N = int(nums[0]) Y = int(nums[1]) for c in range(N+1) : for b in range(N + 1): for a in range(N + 1): if( Y == 10000 * a + 5000 * b + 1000 *c ): break else: continue break else: continue break if( N < (a + b + c)): print("-1 -1 -1") else : print(a,b,c)
p02873
s008004152
Wrong Answer
s = str(input()) a = [0] l = len(s) k = 1000000000000 for i in range(l): if(s[i]=="<"): a.append(a[-1]+1) else: a.append(a[-1]-1) k = min(a[-1],k) ans = sum(a) if(k<0): ans += (l+1)*abs(k) print(ans)
p02759
s004183190
Accepted
n = int(input()) print((n+1)//2)
p02660
s653156972
Accepted
N = int(input()) pf={} m=N for i in range(2,int(m**0.5)+1): while m%i==0: pf[i]=pf.get(i,0)+1 m//=i if m>1:pf[m]=1 cnt = 0 for k, v in pf.items(): t = 1 while v>0: v += -1*t if v<0: break cnt += 1 t+= 1 print(cnt)
p03548
s911620993
Wrong Answer
x,y,z=map(int,input().split()) w=y+2*z ans=1 while w<x-(y+z): w+=y+z ans+=1 print(ans)
p03455
s196183426
Wrong Answer
a,b = map(int,input().split()) if a*b % 2 == 0: print('Odd') else: print('Even')
p02790
s918593675
Wrong Answer
a, b = map(int, raw_input() .split()) x = '' for i in range(a): x += str(b) for i in range(b): x += str(a) print x
p02811
s775050867
Accepted
# coding: utf-8 k, x = map(int, input().split()) if 500 * k < x: print("No") else: print("Yes")
p02848
s232813472
Accepted
n = int(input()) s = list(input()) alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" for i in range(len(s)): s[i] = alpha[(alpha.index(s[i]) + n) % 26] print("".join(s))
p02819
s326896295
Accepted
x=int(input()) j=0 while j==0: ans=0 if x%2==0 and x!=2: x+=1 continue for i in range(2,x//2): if x%i==0: ans+=1 if ans==0: j=x x+=1 print(j)
p03371
s058926350
Accepted
def main(): A, B, C, X, Y = map(int, input().split()) ans = 1 << 30 c = 0 # even while True: j = c // 2 t = A * max(0, X - j) + B * max(0, Y - j) + C * c if ans <= t: break ans = t c += 2 print(ans) if __name__ == '__main__': main()
p02708
s301084784
Wrong Answer
from operator import mul from functools import reduce mod=pow(10,9)+7 def combinations_count(n, r): r = min(r, n - r) numer = reduce(mul, range(n, n - r, -1), 1) denom = reduce(mul, range(1, r + 1), 1) return numer // denom %mod a,b=map(int,input().split()) a+=1 ans=0 for i in range(a-b+1): ans=(ans+combinations_count(a,b+i))%mod a-=2 for i in range(a-b+1): ans=(ans-combinations_count(a,b+i))%mod print(ans)
p03481
s231391738
Accepted
x, y = map(int, input().split()) count = 0 while x * 2 ** count <= y: count += 1 print(count)
p02618
s855730875
Wrong Answer
import numpy as np D=int(input()) c=[int(i) for i in input().split()] s=[] for i in range(D): s.append([int(j) for j in input().split()]) t=[i for i in range(D)] for i in range(D): print(t[i])
p03548
s907752924
Accepted
x,y,z=map(int,input().split()) print((x-z)//(y+z))
p03106
s248283080
Wrong Answer
a,b,k = [int(x) for x in input().split()] lst = [] for i in range(1, 100): if (a % i == 0) and (b % i == 0): lst.append(i) lst.reverse() print(lst[k-1])
p03264
s478112064
Accepted
K = int(input()) from math import ceil print(ceil(K/2) * ceil((K-1)/2))
p02713
s648825075
Accepted
n = int(input()) import math ans = 0 for i in range(1, n+1): for j in range(1, n+1): for k in range(1, n+1): tmp = math.gcd(i,j) ans += math.gcd(tmp,k) print(ans)
p02707
s219591769
Accepted
# coding: utf-8 num = int(input()) shain = input().split(" ") kazu = [] for i in range(len(shain)): shain[i] = int(shain[i]) for i in range(num): kazu.append(0) for j in range(len(shain)): kazu[shain[j] - 1] += 1 for k in range(num): print(kazu[k])
p02843
s091174973
Accepted
x = int(input()) a = x//100 b = x%100 l = list(range(1,6))[::-1] i = 0 cnt = 0 while b > 0: if l[i] > b: i += 1 cnt += b//l[i] b = b % l[i] print(1 if cnt <= a else 0)
p03107
s827730688
Accepted
S = input() zero_count=S.count("0") one_count=S.count("1") ans=2*min(int(zero_count),int(one_count)) print(ans)
p02595
s995910408
Accepted
n,d = map(int,input().split()) xy = [list(map(int,input().split())) for _ in range(n)] ans = sum(x*x+y*y<=d*d for x,y in xy) print(ans)
p03617
s559322887
Accepted
Q, H, S, D = map(int, input().split()) N = int(input()) nS = min(4*Q, 2*H, S) print(min(N * nS, (N//2)*D + (N%2) * nS))
p02598
s007245376
Accepted
def count_cuts(a, unit): return (a + unit - 1) // unit - 1 def is_good(mid, key): return sum(count_cuts(a, mid) for a in A) <= key def binary_search(key): bad, good = 0, 1_000_000_000 while good - bad > 1: mid = (bad + good) // 2 if is_good(mid, key): good = mid else: bad = mid return good N, K, *A = map(int, open(0).read().split()) print(binary_search(K))
p02596
s350385221
Accepted
k=int(input()) mod=[0]*k c=7 cnt=1 while True: if c%k==0: print(cnt) break mod[c%k]=1 c*=10 c+=7 c%=k cnt+=1 if mod[c]==1: print(-1) break
p02791
s004770758
Wrong Answer
n = int(input()) p = list(map(int,input().split())) ans = 0 for i in range(n): check = p[i] ans_ = 0 for j in range(i): if p[j] <= p[i]: ans_ += 1 if ans_ == i - 1: ans += 0 print(ans)
p02995
s771763270
Accepted
import math a,b,c,d = map(int,input().split()) s1=b//c - (a-1)//c s2=b//d - (a-1)//d s12=b//(c*d//math.gcd(c,d)) - (a-1)//(c*d//math.gcd(c,d)) #print(s1,s2,s12) print(b-a+1-(s1+s2-s12))
p03556
s155305535
Accepted
n = int(input()) print(int(n**.5)**2)
p02744
s636718846
Wrong Answer
import queue n = int(input()) alp = "abcdefghijklmn" q = queue.Queue() q.put("a") while not q.empty(): qi = q.get() if len(qi) == n: print(qi) elif len(qi) < n: idx = alp.index(qi[-1]) for i in range(idx+2): q.put(qi+alp[i])
p03815
s727305582
Wrong Answer
x = int(input()) ans = x//11 * 2 ans += (x % 11)//6 * 1 + 1 print(ans)
p03814
s489288589
Wrong Answer
s = input() ans = 0 for i in range(len(s)): ans_a = 0 ans_z = 0 if (s[i] == "A"): ans_a = i if (s[-(i+1)] == "Z"): ans_z = len(s) - i if(ans_z - ans_a + 1 > ans): ans = ans_z - ans_a + 1 print(ans)
p02848
s949436540
Wrong Answer
n = int(input()) s = input() for i in range(len(s)): a = ord(s[i]) + n%26 if a <= ord("Z"): s = s.replace(s[i], chr(a + 32)) else: s = s.replace(s[i], chr(a + 6)) s = s.upper() print(s)
p02881
s733569819
Wrong Answer
n=int(input()) div = n result = 10**12 for i in range(1,n): if n % i == 0: result = min(result, i+div) div = div // i print(int(result-2))
p03951
s582232402
Wrong Answer
n = int(input()) s = input() t = input() if s == t: print(n) else: same = 0 for i in range(n): # print(i, s[-1 - i], t[i]) if s[-1 - i] != t[i]: break same += 1 print(2 * n - same)
p03773
s121438268
Accepted
a, b = map(int, input().split()) print((a+b)%24)
p03012
s491321434
Wrong Answer
a = list(map(int,input().split())) difference = 100 for i in range(len(a)): if abs(sum(a[:i]) - sum(a[i:])) < difference: difference = abs(sum(a[:i]) - sum(a[i:])) print(difference)
p02582
s799682341
Accepted
S=input() if S[1-1]=='R': if S[2-1]=='R': if S[3-1]=='R': print(3) else: print(2) else: print(1) elif S[2-1]=='R': if S[3-1]=='R': print(2) else: print(1) elif S[3-1]=='R': print(1) else: print(0)
p03261
s895761254
Wrong Answer
N = int(input()) past = [] last = "" for i in range(N): W = input() print("past:", past) print("W[0]:", W[0]) print("last[-1]:", last[-1:]) if last == "": past.append(W) last = W elif W in past or W[0] != last[-1:]: print("No") exit() else: past.append(W) last = W print("Yes")
p02795
s763120491
Accepted
H,W,N=map(int,open(0)) L=max(H,W) print((N+L-1)//L)
p03206
s501740651
Wrong Answer
d = int(input()) print("Christmas"+"Eve"*(25-d))
p02911
s740794478
Accepted
N, K, Q = [int(s) for s in input().split(' ')] S = [K] * (N + 1) A = [Q] * (N + 1) for i in range(Q): a = int(input()) A[a] -= 1 for s, a in zip(S[1:], A[1:]): if s - a > 0: print('Yes') else: print('No')
p03127
s173734042
Wrong Answer
n = int(input()) a = sorted(list(map(int,input().split()))) cnt = [a[1],a[0]] for i in range(1,n): a[i] %= cnt[-1] if (a[i] != 0) and (a[i] < cnt[-1]): cnt.append(a[i]) cnt.pop(0) if a[1] == 0: print(a[0]) else: if cnt[0] % cnt[1] == 0: print(cnt[1]) else: print(cnt[0] % cnt[1])
p03109
s538903693
Wrong Answer
s = int(input().replace('/','')) print('Heisei') if s <= 2019430 else print('TBD')
p03286
s407017330
Accepted
N = int(input()) if N==0: print(0) else: answer=[] while N != 0: if N % (-2) == 0: N=N//(-2) answer.append(0) else: N=N//(-2)+1 answer.append(1) print(''.join(list(map(str, reversed(answer)))))
p03059
s722779485
Accepted
A, B, T = map(int, input().split()) cnt = T // A print(B * cnt)
p02924
s711092924
Wrong Answer
n=int(input()) ans=n*(n-1)/2 print(ans)
p03438
s427165452
Wrong Answer
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = 0 for i in range(n): if a[i] < b[i]: c += -((a[i]-b[i])//2) a[i] += -((a[i]-b[i])//2) * 2 d = 0 for i in range(n): if b[i] < a[i]: d += a[i]-b[i] if c == d: ans = 1 elif c < d: ans = 0 elif d < c: if (d-c)%2 == 1: ans = 1 else: ans = 0 print(["No","Yes"][ans])
p03371
s071424275
Wrong Answer
a,b,c,x,y=map(int,input().split()) result=[] if(x>y): result.append(a*x+b*y) result.append(a*(x-y)+2*c*y) result.append(2*c*x) elif(x<y): result.append(a*x+b*y) result.append(b*(y-a)+2*c*x) result.append(2*c*y) else: result.append(a*x+b*y) result.append(2*c*x) print(min(result))
p03075
s731538318
Accepted
def main(): a = [int(input()) for i in range(6)] if a[4] - a[0] > a[5]: print(':(') else: print('Yay!') if __name__ == '__main__': main()
p03795
s304101773
Accepted
import sys import copy import math import bisect import pprint import bisect from functools import reduce from copy import deepcopy from collections import deque if __name__ == '__main__': a = int(input()) ans = a*800 - 200*(a//15) print(ans)
p02630
s657117295
Accepted
from collections import Counter n = int(input()) a = [int(i) for i in input().split()] q = int(input()) bc = [[int(i) for i in input().split()] for _ in range(q)] cnt = Counter(a) s = sum(a) for b, c in bc: s += (c - b) * cnt[b] cnt[c] += cnt[b] cnt[b] = 0 print(s)
p02783
s022951876
Wrong Answer
import math h, a = list(map(int, input().split())) print(math.floor(h/a))
p02843
s914170193
Accepted
X = int(input()) if 0 <= X%100 <= 5*(X//100): print(1) else: print(0)
p02848
s868053673
Wrong Answer
n = int(input()) s = input() for i in s: if ord(i) + n > 90: print(chr(64+n-(90-ord(i)))) else: print(chr(ord(i)+n))
p02831
s632504805
Accepted
import fractions A, B = map(int, input().split()) print(int(A * B / fractions.gcd(A, B)))
p03329
s327136612
Accepted
n = int(input()) ans = n for i in range(n + 1): cc = 0 t = i while t > 0: cc += t % 6 t //= 6 t = n - i while t > 0: cc += t % 9 t //= 9 ans = min(ans, cc) print(ans)
p02971
s973151035
Wrong Answer
N = int(input()) l = [int(input()) for i in range(N)] l_sort = sorted(l) for i in range(N): if (l[i] != l_sort[-1]): print(l_sort[-2]) else: print(l_sort[-1])
p02613
s479116058
Wrong Answer
N = int(input()) i = 0 C0 = 0 C1 = 0 C2 = 0 C3 = 0 while (i < N): i += 1 S = input() if(S == 'AC'): C0 += 1 elif(S == 'WA'): C1 += 1 elif(S == 'TLE'): C2 += 1 elif(S == 'RE'): C3 += 1 print("AC ×" + str(C0)) print("WA ×" + str(C1)) print("TLE ×" + str(C2)) print("RE ×" + str(C3))
p02572
s390523711
Accepted
from itertools import accumulate def main(): n=int(input()) a=list(map(int,input().split())) aa=list(accumulate(a)) mod=10**9+7 ans=0 for i in range(n): ans += a[i]*(aa[-1]-aa[i])%mod print(ans%mod) if __name__ == "__main__": main()
p03077
s776932874
Wrong Answer
import math n = int(input()) a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) print(math.floor(n // min([a,b,c,d,e])) + 4)
p03435
s728586717
Accepted
C = [list(map(int, input().split())) for _ in range(3)] a = C[1][0]-C[0][0] == C[1][1]-C[0][1] == C[1][2]-C[0][2] b = C[2][0]-C[0][0] == C[2][1]-C[0][1] == C[2][2]-C[0][2] if a and b: print('Yes') else: print('No')
p02792
s204065192
Wrong Answer
n=int(input()) ct=0 for i in range(1,n+1): j=str(i) if i%10==0: pass elif int(j[::-1])==i and len(j)==1: ct+=1 #print(i) elif int(j[::-1])<i: ct+=2 #print(i,int(j[::-1])) elif int(j[::-1])==i: ct+=(len(j)-1)*2+1 #print(i,(len(j)-1)*2+1) print(ct)
p02664
s445436775
Wrong Answer
s = input() s = list(s) #s = list('PD?D??P') #print(s) nagasa = len(s) for m in range(nagasa): for i in s[m]: if i == '?': s[m] = 'D' else: pass print(s)
p02995
s758221646
Accepted
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 9) MOD = 10 ** 9 + 7 from fractions import gcd A, B, C, D = map(int, input().split()) A -= 1 lcm = C * D // gcd(C, D) def calc(x): count = 0 count += x // C count += x // D count -= x // lcm return x - count ans = calc(B) - calc(A) print (ans)
p02681
s836484742
Wrong Answer
S = input() T = input() Slen = len(S) Tlen = len(T) if Slen == (Tlen -1) and S[0:Slen-1] == T[0:Slen-1]:print("Yes") else: print("No")
p03556
s930498997
Accepted
N = int(input()) ans = 1 while ans**2 <= N: ans += 1 print((ans-1)**2)
p03434
s466823754
Wrong Answer
# -*- coding: utf-8 -*- n = int(input()) a = list(map(int, input().split())) alice = 0 bob = 0 sorted_a = sorted(a) print(a, sorted_a) for i in sorted_a: alice += sorted_a.pop() bob += sorted_a.pop() print(alice - bob)
p02971
s612123650
Accepted
N = int(input()) A = [int(input()) for _ in range(N)] first = max(A) second = sorted(A)[-2] index = A.index(first) for i in range(N): print(first if i != index else second)
p02838
s534514538
Wrong Answer
import sys def main(): input = sys.stdin.readline n = int(input()) a = tuple(map(int,input().split())) b = [] mod = 10**9+7 for i in range(n-1): for j in range(i+1,n): b.append((a[i]^a[j])%mod) ans = sum(b) print(ans) if __name__ == '__main__': main()
p02642
s962558227
Accepted
n = int(input()) a = list(map(int, input().split())) a.sort() furui = [False] * (10**6+1) ans = 0 for i in range(n): if i-1 >= 0 and a[i] == a[i-1]: continue if furui[a[i]] == False: if (i + 1 < n and a[i] != a[i + 1]) or i==n-1: ans += 1 now = a[i] while now <= 10**6: furui[now] = True now += a[i] print(ans)
p02696
s401648252
Accepted
import math a, b, n = map(int, input().split()) if n < b: x = n else: x = b - 1 print(math.floor(a * x / b) - a * math.floor(x / b))