problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02613
s191922704
Accepted
n=int(input()) l=[0,0,0,0] for _ in range(n): s=input() if(s=='AC'): l[0]+=1 elif(s=='WA'): l[1]+=1 elif(s=='TLE'): l[2]+=1 elif(s=='RE'): l[3]+=1 print("AC x",l[0]) print("WA x",l[1]) print("TLE x",l[2]) print("RE x",l[3])
p02791
s046532983
Wrong Answer
n = int(input()) p = list(map(int, input().split())) ans = 0 min_p = n for i in p: if i < min_p: min_p = i ans += 1 print(ans)
p03136
s527798897
Wrong Answer
N = int(input()) L = list(map(int, input().split())) lmax = max(L) suml = 0 for i in L: if i != lmax: suml += i if lmax < suml: print('Yes') exit() print('No')
p02765
s713326035
Accepted
line = list(map(int,input().split())) if line[0] >= 10: print(line[1]) else: print(line[1] + (100 * (10 - line[0])))
p03544
s364016326
Accepted
N = int(input()) mylist=[] for i in range(N+1): if i==0: mylist.append(2) elif i==1: mylist.append(1) else: a=0 a=mylist[-1]+mylist[-2] mylist.append(a) print(mylist[-1])
p02658
s922286295
Wrong Answer
GI = lambda: int(input()); GIS = lambda: map(int, input().split()); LGIS = lambda: list(GIS()) def main(): GI() CEIL = 10 ** 18 prod = 1 for x in GIS(): prod *= x if prod > CEIL: prod = -1 break print(prod) main()
p02862
s181749909
Accepted
M = 10**9 + 7 x,y = map(int, input().split()) def solve(): at = 2*x - y bt = 2*y - x if at < 0 or bt < 0 or at % 3 != 0 or bt %3 != 0: return 0 a = at // 3 b = bt // 3 num = den = 1 for i in range(max(a, b)+1, (a+b)+1): num = num * i % M for i in range(2, min(a, b)+1): den = den * i % M inv_den = pow(den, M-2, M) return num * inv_den % M print(solve())
p02888
s567609646
Wrong Answer
import bisect N = int(input()) l = [int(i) for i in input().split()] count = 0 l_new = sorted(l) for i in range(N-2): for j in range(i+1,N-1): left = bisect.bisect_right(l_new,abs(l_new[i]-l_new[j])) right = bisect.bisect_left(l_new,l_new[i] + l_new[j]) count += right - left print(count//3)
p03611
s322217775
Accepted
import sys def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) N = I() a = LI() ans = 0 num_count = [0]*(10**5+2) for x in a: num_count[x-1] += 1 num_count[x] += 1 num_count[x+1] += 1 print(max(num_count))
p02935
s540984768
Accepted
n = int(input()) slist = list(map(int, input().split())) #print(slist) score=0 while len(slist)>=2: m1 = min(slist) slist.remove(m1) m2 = min(slist) slist.remove(m2) # print(m1,m2) slist.append((m1+m2)/2) # print((m1+m2)/2) # print(slist) print(slist[0])
p03607
s843485767
Wrong Answer
n=int(input()) arr=[0]*n for i in range(n): arr[i]=int(input()) arr=sorted(arr) num=arr[0] tmp=1 ans=0 for i in range(1,n): if arr[i]==num: tmp+=1 else: if tmp%2==1: ans+=1 num=arr[i] tmp=1 print(ans)
p03293
s571434818
Accepted
import sys input = sys.stdin.readline S = input().rstrip('\n') T = input().rstrip('\n') result = 'No' for i in range(len(S)): if S[-i:]+S[:-i] == T: result ='Yes' print(result)
p03324
s109203191
Accepted
d, n = map(int,input().split()) def cal(x): if x % 100 != 0: return 0 return cal(x/100) + 1 cnt = 0 tmp = 1 while True: if cal(tmp) == d: cnt += 1 if cnt == n: break tmp += 1 print(tmp)
p03137
s983666077
Accepted
n, m = map(int, input().split()) if n >= m: print(0) exit() lx = sorted(list(map(int, input().split()))) ld = sorted([lx[i+1]-lx[i] for i in range(m-1)]) if n == 1: print(sum(ld)) else: print(sum(ld[:-(n-1)]))
p03150
s593155024
Accepted
s = input() master = "keyence" i = 0 f = 0 if(s[0:7] == master or s[-7:] == s): print("YES") else: i = 0 while (s[i] == master[i]): i += 1 if (s[-7+i:] == master[i:]): print("YES") else: print("NO")
p03779
s151300243
Accepted
x = int(input()) for i in range(0,100000): ix = i*(i+1)/2 if x <= ix : print(i) exit() else: pass
p03371
s015018251
Accepted
a, b, c, x, y = map(int, input().split()) ans = a * x + b * y ans = min(c * max(x, y) * 2, ans) if x < y: ans = min(c * x * 2 + (y - x) * b, ans) else: ans = min(c * y * 2 + (x - y) * a, ans) print(ans)
p03206
s754164295
Accepted
D = int(input()) ans = "Christmas" + " Eve" * (25-D) print(ans)
p03264
s903787666
Wrong Answer
K=int(input()) if K%2==0: n=K//2 n=n*(n-1) n+=(K-n)*(K-n-1) print(n) else: n=(K+1)//2 n=n*(n-1) n+=(K-n)*(K-n-1) print(n)
p03817
s296659264
Wrong Answer
import sys def solve(): input = sys.stdin.readline X = int(input()) if X % 11 <= 6: print(((X - 1) // 11 + 1) * 2 - 1) else: print(((X - 1) // 11 + 1) * 2) return 0 if __name__ == "__main__": solve()
p03067
s570511772
Wrong Answer
a,b,c=map(int,input().split()) if a <= b <= c or a >= b >= c: print('Yes') else: print('No')
p03657
s568401881
Wrong Answer
a, b = map(int, input().split()) # intは入力に対しての関数、出力ではない if (a+b)%3 == 0: print("Possible") if a%3 == 0: print("Possible") if b%3 == 0: print("Possible") else: print("Impossible")
p03017
s457700550
Wrong Answer
N, A, B, C, D = map(int, input().split()) s = input() if C > D: if "##" in s: print("No") else: if "..." in s[B-2:D+1]: print("Yes") else: print("No") else: if "##" in s: print("No") else: print("Yes")
p02695
s092915087
Wrong Answer
N,M,Q = map(int,input().split()) ABCD = [list(map(int,input().split())) for _ in [0]*Q] A = [1]*N ans = 0 while A[0] == 1: A[N-1] += 1 tmp = 0 for a,b,c,d in ABCD: if A[b-1]-A[a-1]==c: tmp += d ans = max(ans,tmp) for i in range(N-1,-1,-1): if A[i]>=M: A[i-1] += 1 for j in range(i,N): A[j] = A[i-1] print(ans)
p02768
s394525464
Accepted
N, A, B = map(int, input().split()) MOD = 10 ** 9 + 7 def calc_inv(n, k, mod): a = 1 b = 1 for i in range(1,k+1): a *= i a %= mod b *= n n -= 1 b %= mod return b * pow(a, mod-2, mod) % mod ret = pow(2, N, MOD) - 1 - calc_inv(N,A,MOD) - calc_inv(N,B,MOD) ret %= MOD if ret < 0: ret += MOD print(int(ret))
p03861
s335124839
Accepted
a, b, x = map(int, input().split()) bans = b//x aans = a//x if a%x == 0: aans -= 1 print(bans - aans)
p02645
s378714612
Accepted
s = input() print(s[:3])
p03360
s207923070
Accepted
lis= list(map(int,input().split())) k = int(input()) mt = max(lis) a = sum(lis)-mt for i in range(k): mt *= 2 print(a + mt)
p02725
s438672170
Accepted
k,n=map(int,input().split()) a=list(map(int,input().split())) s = 0 for i in range(n): if i == n-1: s = max(s,a[0] + k - a[i]) else: s = max(s,a[i+1] - a[i]) print(k-s)
p02661
s668946501
Accepted
N = int(input()) L, H = [0] * N, [0] * N for i in range(N): L[i], H[i] = list(map(int, input().split())) L.sort() H.sort(reverse=True) if N%2 == 1: i = (N-1)//2 l, h = L[i], H[i] print(h-l+1) else: i = N//2 ll, lh = L[i-1], L[i] hl, hh = H[i-1], H[i] print((hh+hl) - (lh+ll) + 1)
p02660
s660985347
Wrong Answer
import math n = int(input()) count = 0 if n == 1: print(0) exit() for i in range(2, int(math.sqrt(n)) + 1): if n % i == 0: count += 1 n = n // i print(count)
p02910
s089241612
Accepted
S = list(input()) for i in range(0,len(S),2): if S[i] == 'L': print('No') exit() for j in range(1,len(S),2): if S[j] == 'R': print('No') exit() print('Yes')
p02768
s878698320
Accepted
def solve(): N,A,B = map(int, input().split()) prod = 1 MOD = 10**9 + 7 ans = pow(2,N,MOD) -1 #bit全探索と同じ理屈 for i in [A,B]: num, inv = 1, 1 for j in range(N-i+1,N+1): num = (num * j) % MOD for k in range(1, i+1): inv = inv * k % MOD ans = ans -(num * pow(inv, MOD-2, MOD)) % MOD print(ans%MOD) if __name__ == '__main__': solve()
p03494
s974204660
Accepted
n = int(input()) a = list(map(int,input().split())) count = 0 ans = 10000 for i in range(n): while True: if a[i]%2 == 0: count += 1 a[i] = a[i]//2 else: ans = min(ans,count) count = 0 break print(ans)
p02988
s183287737
Accepted
n = int(input()) p = list(map(int, input().split())) ans = 0 for i in range(n-2): if p[i] < p[i+1] < p[i+2] or p[i] > p[i+1] > p[i+2]: ans += 1 print(ans)
p04033
s756629634
Wrong Answer
a = list(map(int,input().split())) if a[0] * (a[0]+1) * a[1] > 0: print("Positive") elif a[0] * (a[0]+1) * a[1] < 0: print("Negative") else: print("Zero")
p03075
s174380251
Accepted
a=int(input()) b=int(input()) c=int(input()) d=int(input()) e=int(input()) k=int(input()) lis=[a,b,c,d,e] lis.sort() if(abs(lis[4]-lis[0])<=k): print("Yay!") else: print(":(")
p02754
s592478150
Accepted
N, A, B = map(int, input().split()) period = A + B times = N//period k = N%period N = A if k >A else k print(times*A + N)
p03145
s763722384
Accepted
A,B,C=map(int,input().split()) print(A*B//2)
p02602
s347922424
Wrong Answer
# [] = list(map(int, input().split())) # = map(int, input().split()) import numpy as np [n, k] = list(map(int, input().split())) aList = list(map(int, input().split())) aList_kai = [] for i in range(n-k+1): aList_kai.append(np.prod(aList[i:i+k])) ptr = 0 for i in range(1, n-k+1): if aList_kai[i] > aList_kai[i-1]: print("Yes") else: print("No")
p02731
s144656829
Wrong Answer
#整数の入力 N = int(input()) a = int(N/3) print(a*a*a)
p03998
s803711554
Accepted
cards = {} cards['a'] = list(input()) cards['b'] = list(input()) cards['c'] = list(input()) card = 'a' while True: if len(cards[card]) ==0: break card = cards[card].pop(0) print(card.upper())
p02791
s551125959
Accepted
n = int(input()) p = list(map(int,input().split())) ans = 0 mn = float('inf') for i in range(n): if p[i] < mn: ans += 1 mn = min(mn,p[i]) print(ans)
p02556
s183817196
Accepted
import sys from operator import itemgetter N = int(input()) V = set() for s in sys.stdin.readlines(): x, y = map(int, s.split()) V.add((x + y, x - y)) y_max = max(V, key=itemgetter(1))[1] y_min = min(V, key=itemgetter(1))[1] x_max = max(V, key=itemgetter(0))[0] x_min = min(V, key=itemgetter(0))[0] print(max(x_max - x_min, y_max - y_min))
p03106
s722249695
Accepted
a,b,k = map(int, input().split()) l = list() for i in range(1, min(a,b)+1): if a%i == 0 and b%i == 0: l.append(i) print(l[-(k)])
p02759
s453117686
Accepted
n = int(input()) print(n//2 + n%2)
p04034
s887190534
Accepted
n, m = map(int, input().split()) rednow = [-1, 1] + [0 for i in range(n-1)] # maybe there's red ball balnum = [-1] + [1 for i in range(n)] # the number of ball, each box order = [] for i in range(m): order.append(list(map(int, input().split()))) for q in order: if rednow[q[0]] == 1: rednow[q[1]] = 1 if balnum[q[0]] == 1: rednow[q[0]] = 0 balnum[q[0]] -= 1 balnum[q[1]] += 1 print(rednow.count(1))
p03854
s326066559
Accepted
S = input() # Greedyアルゴリズム S = S[::-1] S = S.replace("resare","") S = S.replace("esare","") S = S.replace("remaerd","") S = S.replace("maerd","") if S == "": print("YES") else: print("NO")
p02743
s415891076
Accepted
a, b, c = map(int, input().split()) if c-(a+b) >= 0: if 4*a*b < (c-(a+b))**2: print('Yes') else: print('No') else: print('No')
p04045
s687408430
Accepted
N,K = map(int,input().split()) D = list(map(int,input().split())) l = [i for i in range(10)] for i in range(K): l.remove(D[i]) ansl = [] def dfs(s): if len(s) < len(str(N))+1: for i in l: new = s+str(i) ansl.append(int(new)) dfs(new) dfs("") ansl.sort() for i in ansl: if i >= N: print(i) break
p02681
s182684820
Accepted
s = input() t = input() if s == t[:-1] and 1<=len(s)<=10: print('Yes') else: print('No')
p02555
s930174506
Accepted
def f(n): res = 1 if n <= 1: return 1 while n>1: res *= n n-=1 return res def h(n,m): return f(n+m-1)//f(n)//f(m-1) s=int(input()) res = 0 pair = s//3 for i in range(1,pair+1): res += h(s-3*i,i) print(res%(10**9+7))
p03817
s992388771
Accepted
import math x = int(input()) mod = x%11 print((x//11)*2 + math.ceil(mod/6))
p02933
s401605452
Accepted
A = int(input()) S = input() if A >= 3200: print(S) else: print("red")
p02555
s765212141
Wrong Answer
from math import factorial as kai from decimal import Decimal as dec s = int(input()) max_len = s // 3 num = 0 mod = 10 ** 9 + 7 for i in range(max_len, 0, -1): amari = s - (3 * i) num += int(dec(dec(kai(amari + i - 1)) / (dec((kai(amari)) * dec(kai(i - 1)))))) % mod print(int(num % mod))
p03617
s996510461
Wrong Answer
Q,H,S,D = map(int, input().split()) N = int(input()) if N >=2: if N%2 == 0: ans = N/min([8*Q,4*H,2*S,D]) else: ans = (N-1)/min([8*Q,4*H,2*S,D]) + min([4*Q,2*H,S]) else: ans = min([4*Q,2*H,S]) print(ans)
p02993
s137246998
Accepted
import sys input = sys.stdin.readline a,b,c,d = input().rstrip("\r\n") ans = "Bad" if a==b or b==c or c==d else "Good" print(ans)
p03037
s365219385
Accepted
n, m = map(int, input().split()) left = 1 right = n for _ in range(m): l, r = map(int, input().split()) left = max(left, l) right = min(right, r) if left <= right: print(right - left + 1) else: print("0")
p03416
s731844070
Accepted
A, B = map(int, input().split()) ans = 0 for i in range(A, B+1): s = str(i) if s == s[::-1]: ans += 1 print(ans)
p02817
s315396542
Wrong Answer
S,T=map(str,input().split()) print(S+T)
p03698
s795595749
Wrong Answer
import math l = list(input()) strlen = l.__len__() "yes" if strlen == list(set(l)).__len__() else "no"
p02843
s819106929
Accepted
x = int(input()) if x <= 105*(x//100): print(1) else: print(0)
p02687
s090229689
Wrong Answer
s = input() if s == 'ABC': print('ABC') if s == 'ARC': print('ARC')
p02661
s317196968
Wrong Answer
N=int(input()) A=[] B=[] for i in range(N): a,b=map(int,input().split()) A.sort() B.sort() A.append(a) B.append(b) def median(x): l=len(x) if l%2==0: return (x[l//2-1]+x[l//2])/2 else: return x[l//2] if N%2==1: print(median(B)-median(A)+1) else: print(int((median(B)-median(A))*2+1))
p02983
s536073107
Accepted
L,R=map(int,input().split()) R=min(L+2019,R) m=3000 for x1 in range(L,R): for x2 in range(x1+1,R+1): if m>(x1*x2)%2019:m=(x1*x2)%2019 print(m)
p02688
s817230470
Wrong Answer
whatMan = [] N, K = input().split() print(N)
p03137
s641654318
Accepted
N, M = map(int,input().split()) xl = list(map(int,input().split())) xl.sort() diff_list = [] for i in range(1,M): diff_list.append(xl[i] - xl[i-1]) diff_list.sort(reverse=True) print(sum(diff_list[N-1:]))
p02813
s121592754
Accepted
import itertools from math import factorial N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) f = factorial(N) all = list(itertools.permutations(range(1,N+1), N)) count = 0 for i in range(f): if all[i] == P: count += i+1 if all[i] == Q: count -= i+1 print(abs(count))
p02624
s763454200
Wrong Answer
n=int(input()) import math nn=int(math.sqrt(n)) a=[0] a*=(n+1) for i in range(1,nn+1): t=i while t<=n: a[t]+=1 t+=i for i in range(nn+1,n+1): a[i]+=1 ans=0 for i in range(1,n+1): ans+=a[i]*i print(ans)
p02947
s513243112
Wrong Answer
import sys from collections import Counter import numpy as np n, *s = sys.stdin.read().split() n = int(n) def comb_2(n): return n * (n - 1) // 2 def main(): t = [''.join(sorted(t)) for t in s] v = np.array(list(Counter(t).values()), dtype=np.int32) return np.sum(comb_2(v)) if __name__ == '__main__': ans = main() print(ans)
p03387
s442014975
Accepted
ABC = list(map(int, input().split())) n_odd = sum([Xi % 2 for Xi in ABC]) ans = 0 if n_odd == 1: ans += 1 ABC[0] += int(ABC[0] % 2 == 0) ABC[1] += int(ABC[1] % 2 == 0) ABC[2] += int(ABC[2] % 2 == 0) elif n_odd == 2: ans += 1 ABC[0] += int(ABC[0] % 2 == 1) ABC[1] += int(ABC[1] % 2 == 1) ABC[2] += int(ABC[2] % 2 == 1) ABC.sort() ans += (ABC[2] - ABC[0]) // 2 ans += (ABC[2] - ABC[1]) // 2 print(ans)
p04031
s289362279
Accepted
N = int(input()) a = list(map(int, input().split())) average = (sum(a) + N // 2) // N cost = 0 for i in range(N): cost += (average - a[i]) ** 2 print(cost)
p02859
s715249774
Accepted
#A r=int(input()) print(r**2)
p02918
s889124494
Wrong Answer
N, K = map(int, input().split()) S = input() cnt =0 for i in range(N-1): p = S[i]+S[i+1] if p =='RL': cnt += 1 cnt2 = 0 if S[0] == 'L': cnt2 += 1 if S[-1] == 'R': cnt2 += 1 N -= cnt *2+cnt2 if cnt - 1 >= K: print(N+2*K) else: print(N-1)
p02691
s466301477
Accepted
import numpy as np import sys import math import collections read = sys.stdin.readline N = int(read().rstrip()) A = list(map(int,read().rstrip().split())) da = [] for i , a in enumerate(A): da.append([i,a]) dR = collections.defaultdict(int) dL = collections.defaultdict(int) ans = 0 for d in reversed(da): r = d[0] + d[1] + 1 l = d[0] - d[1] + 1 dR[r] += 1 ans += dL[r] dL[l] += 1 print(ans)
p03030
s093408577
Accepted
N = int(input()) SP = [] for _ in range(N): a = input().split() a.append(_+1) SP.append(a) sorted_items = sorted( SP, key = lambda x: (x[0], -int(x[1])) ) for s in sorted_items: print(s[2])
p02553
s005093798
Wrong Answer
a,b,c,d=list(map(int, input("Enter a multiple value: ").split())) prod=[] prod.append(a*c) prod.append(a*d) prod.append(b*c) prod.append(b*d) print(max(prod))
p03017
s540175777
Accepted
n,a,b,c,d = map(int,input().split()) s=input() s=list(s) for i in range(a,max(c,d)): if s[i-1] == s[i] == '#': print('No') exit() if c < d: print('Yes') else: for i in range(b-2,d-1): if s[i] == s[i+1] == s[i+2] == '.': print('Yes') exit() print('No')
p02987
s749181557
Wrong Answer
word=input() word=sorted(word) print(word) if word[0]==word[1] and word[2]==word[3] and word[0]!=word[2]: print('Yes') else: print('No')
p02697
s897863908
Wrong Answer
import sys readline = sys.stdin.readline n,m = map(int,readline().split()) l=1 r=n if r % 2 == 1: r -= 1 for i in range(m): print(l,r) l += 1 r -= 1
p03814
s162904899
Wrong Answer
import sys import re s = str(input()) if len(s) < 0 or len(s) > 200000: sys.exit() array_str = re.findall(r'A.*Z', s) max = 0 for I in array_str: print(I) if len(I) > max: max = len(I) print(max)
p02838
s519485983
Accepted
n = int(input()) a = list(map(int, input().split())) ans=0 for i in range(60): g = [0,0] for j in a: g[(j>>i)%2]+=1 ans+=2**i*g[0]*g[1] ans%=10**9+7 print(ans)
p03469
s069616537
Wrong Answer
a = input() print('2018'+a[4:6])
p03433
s472442822
Accepted
n = int(input()) a = int(input()) if n%500 <= a: print('Yes') else: print('No')
p03998
s010356970
Accepted
S={c:list(input()) for c in "abc"} s="a" while S[s]:s=S[s].pop(0) print(s.upper())
p02601
s697412002
Wrong Answer
i = list(map(int, input().split())) K = int(input()) red=i[0] green=i[1] blue=i[2] success=0 for num in range(K): if green < red: green = green*2 elif blue < green: blue = blue*2 if (blue > green and green > red): print("Yes") else: print("No")
p03774
s813809942
Accepted
n, m = map(int, input().split()) student = list() for x in range(n): student.append(list(map(int, input().split()))) checkpoint = list() for y in range(m): checkpoint.append(list(map(int, input().split()))) INF = 4*(10**8) + 1 tmp = INF ans = 51 for x in range(n): for y in range(m-1, -1, -1): distance = abs(student[x][0] - checkpoint[y][0]) + \ abs(student[x][1] - checkpoint[y][1]) if tmp >= distance: tmp = distance ans = y print(ans+1) tmp = INF
p03243
s767783819
Wrong Answer
N = int(input()) ans = 0 for i in range(1,9): if 111*i <= N < (111*i+1): ans += 111*i else: pass print(ans)
p03407
s219920090
Wrong Answer
a,b,c=map(int,input().split()) if c<=(a+(2*b)):print('Yes') else:print('No')
p02780
s905261447
Accepted
n, k = map(int, input().split()) P = list(map(int, input().split())) total = sum(P[:k]) tmp = total start = 0 for i in range(0, n - k): tmp = tmp - P[i] + P[i + k] if total < tmp: total = tmp start = i + 1 ret = 0 for i in range(start, start + k): ret += (P[i] + 1) / 2 print(ret)
p03645
s270054677
Wrong Answer
N, M = map(int, input().split()) from collections import defaultdict edges = defaultdict(list) for i in range(M): a,b = map(int, input().split()) edges[b].append(a) # edges[b].append(a) # print(edges) # print(1,edges[1]) first = edges[1] # print("----") for e in first: # print(e,edges[e]) second = edges[e] if N in second: print("POSSIBLE") exit() print("IMPOSSIBLE")
p02854
s763049644
Wrong Answer
n = (int)(input()) a = list(map(int, input().split(" "))) total = sum(a) temp = 0 for i in range(n): temp += a[i] if temp >= total / 2: break print(temp - (total - temp))
p02819
s716266067
Accepted
import sys X = int(input()) P = [2] if X == 2: print(2) sys.exit() for i in range(3, 10**6): for l in range(len(P)): if i % P[l] == 0: break elif l == len(P)-1 and i >= X: print(i) sys.exit() elif l == len(P)-1: P.append(i)
p04020
s443094943
Accepted
n=int(input()) c=0 cu=0 for i in range(n): a=int(input()) if cu and a: a-=1 c+=1 c+=a//2 cu=a%2 print(c)
p03041
s482373202
Wrong Answer
N, K = list(map(int,input().split())) S = input() ls = list(S) if ls[K-1] == 'A': ls[K-1] = 'a' elif ls[K-1] == 'B': ls[K-1] = 'b' elif ls[K-1] == 'A': ls[K-1] = 'b' print(''.join(ls))
p02797
s876543900
Wrong Answer
N,K,S=map(int,input().split()) A=[] for i in range(K): A.append(S) for i in range(N-K): A.append(S-1) print(*A)
p02683
s794881211
Accepted
N,M,X = map(int, input().split()) CA = [list(map(int, input().split())) for _ in range(N)] ans = 1e9 for i in range(2**N): cnt = [0]*(M+1) for j in range(N): if i>>j & 1: cnt = [x+y for (x,y) in zip(cnt,CA[j])] if len([i for i in cnt[1:] if i>=X]) == M: ans = min(ans, cnt[0]) print(ans if ans<1e9 else -1)
p03639
s950269188
Wrong Answer
N = int(input()) a = list(map(int, input().split())) c2=c4=0 for i in range(N): if a[i]%4==0: c4+=1 if a[i]%2==0: c2+=1 nodd=N-c2 if round(nodd/2)<=c4: print("Yes") else: print("No")
p03592
s487740411
Accepted
n,m,k = map(int, input().split()) if n*m == k: print("Yes") exit() for i in range(n): for j in range(m): if j*(n-i) + i*(m-j) == k: print("Yes") exit() print("No")
p02697
s651016806
Accepted
# import sys import math import numpy as np import itertools # いくつか入力 n,m = (int(i) for i in input().split()) if m % 2 == 0: for i in range(0,m//2): print(i+1,m+1-i) for i in range(m//2,m): print(m//2+2+i,m*2+m//2+1-i) else: for i in range(0,m//2): print(i+1,m-i) for i in range(m//2+1,m+1): print(m//2+1+i,m*2+m//2+2-i)