Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03565 (python)

Fixed submission:
s = input()
t = input()
# s = 'c?????a'
# t = 'coder'
errorword = 'UNRESTORABLE'

ls=len(s)
lt=len(t)
if ls < lt:
    print(errorword)
else:
    for i in range(ls-lt,-1,-1):
        is_matched = True
        s_slice = slice(i, i+lt)

        for s_char, t_char in zip(s[s_slice], t):
            # 文字が不一致かつ？以外の場合は文字列不一致のためbreak
            if (s_char != t_char) and s_char != '?':
                is_matched = False
                break
                
        # ここまでbreakせずに来たら文字列一致のため文字列Sを出力
        if is_matched:
            temp_sl1 = slice(0, i)
            temp_sl2 = slice(i+lt, ls+1)
            out_str = '{}{}{}'.format(s[temp_sl1], t, s[temp_sl2])
            print(out_str.replace('?', 'a'))
            break
    
    if not is_matched:
        print(errorword)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

ls=len(s)
lt=len(t)
if ls < lt:
    print(errorword)
else:
    for i in range(ls-lt,-1,-1):
        is_matched = True
        s_slice = slice(i, lt+2)

        for s_char, t_char in zip(s[s_slice], t):
            # 文字が不一致かつ？以外の場合は文字列不一致のためbreak
            if (s_char != t_char) and s_char != '?':
                is_matched = False
                break
                
        # ここまでbreakせずに来たら文字列一致のため文字列Sを出力
        if is_matched:
            temp_sl1 = slice(0, i)
            temp_sl2 = slice(i+lt, ls+1)
            out_str = '{}{}{}'.format(s[temp_sl1], t, s[temp_sl2])
            print(out_str.replace('?', 'a'))
            break
    
    if not is_matched:
        print(errorword)
Problem p03633 (python)

Fixed submission:
n_in = int(input()) 
t = [int(input()) for i in range(n_in)] 

p = t[0]
for i in range(1, len(t)):
    q = t[i]

    if p >= q:
        m, n = p, q
    else:
        m, n = q, p

    while True:
        mod_value = m % n
        if mod_value  == 0:
            break

        m = n
        n = mod_value

    p = p//n * q

print(p)

Buggy submission (verdict: Runtime Error):
n_in = int(input()) 
l = [int(input()) for i in range(n_in)] 
# l = [3, 5, 10, 11]

p = l[0]
for i in range(1, len(l)):
    q = l[i]

    if p >= q:
        m, n = p, q
    else:
        m, n = q, p

    while True:
        mod_value = m % n
        if mod_value  == 0:
            break

        m = n
        n = mod_value

    p = int(p*q/n)

print(p)

Buggy submission (verdict: Runtime Error):
n_in = int(input()) 
l = [int(input()) for i in range(n_in)] 

p = l[0]
for i in range(1, len(l)):
    q = l[i]

    if p >= q:
        m = p
        n = q
    else:
        m = q
        n = p

    while True:
        mod_value = m % n

        if mod_value  == 0:
            n = mod_value
            break

        m = n
        n = mod_value

    p = int(p*q/n)

print(p)

Buggy submission (verdict: Runtime Error):
n_in = int(input()) 
l = [int(input()) for i in range(n_in)] 

p = l[0]
for i in range(1, len(l)):
    q = l[i]

    if p >= q:
        m = p
        n = q
    else:
        m = q
        n = p

    while True:
        mod_value = m % n

        if mod_value  == 0:
            break

        m = n
        n = mod_value

    p = int(p*q/n)

print(p)
Problem p03864 (python)

Fixed submission:
n, x = map(int, input().split())
l = list(map(int, input().split()))
total = 0

for i in range(n - 1):
    diff = l[i] + l[i+1] - x
    if diff > 0:
        total += diff
        if diff > l[i+1]:
            l[i+1]=0
        else:
            l[i+1] -= diff

print(total)

Buggy submission (verdict: Runtime Error):

n, x = map(int, input().split())
l = list(map(int, input().split()))
total = 0

for i in range(n - 1):
    sub = l[i] + l[i+1]
    if sub > x:
        total += sub - x
        l[i+1] -= sub - x
        if l[i+1] > x:
            l[i] -= l[i+1] - x
            total += l[i+1 - x]




print(total)
Problem p03947 (python)

Fixed submission:
s_long = input()

count = 0
prev = ''

for s in s_long:
    if prev == '':
        prev = s
        continue

    if prev != s:
        count += 1
        prev = s

print(count)

Buggy submission (verdict: Runtime Error):

s_long = input()

count = 0
prev = ''

for s in s_long:
    if prev == ''
        prev = s
        continue

    if prev != s:
        count += 1
        prev = s

print(count)
Problem p03200 (python)

Fixed submission:
S = input()
count_ans = 0
count_B = 0
right_W = 0
for i, c in enumerate(S):
	if c == "W":
		count_ans += count_B
	else:
		count_B += 1
print(count_ans)

Buggy submission (verdict: Runtime Error):
S = input()
count_B = 0
right_W = 0
for i in S:
  if i == "B":
    count_B += 1
  else:
    right_W = i
rb = len(S) - right_W - 1
print(count_B - rb)
Problem p03231 (python)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def lcm(a, b):
	return a * b // gcd (a, b)
n, m = map(int,input().split())
s = input()
t = input()
j = 0
a = gcd(n, m)
for i, c in enumerate(s):
	if i % (n // a) == 0:
		if c != t[(i // (n // a)) * (m // a)]:
			j = -1
			break
if j >= 0:
	j = lcm(n, m)
print(j)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def lcm(a, b):
	return a * b // gcd (a, b)
n, m = map(int,input().split())
s = input()
t = input()
j = 0
a = gcd(n, m)
for i, c in enumerate(s):
	if i % a == 0:
		if c != t[i // a * m]:
			j = -1
			break
if j >= 0:
	j = lcm(n, m)
print(j)
Problem p03206 (python)

Fixed submission:
d = int(input())
string = 'Christmas'
for i in range(25-d):
  string += ' Eve'
print(string)

Buggy submission (verdict: Runtime Error):
d = int(input())

if d = 25:
  print("Christmas")
elif d = 24:
  print("Christmas Eve")
elif d = 23:
  print("Christmas Eve Eve")
else
  print("Christmas Eve Eve Eve")
Problem p03219 (python)

Fixed submission:
X,Y = map(int,input().split())
 
print( X + (Y // 2))

Buggy submission (verdict: Runtime Error):
x,y = map(int,input.split())

print(x+(y//2))

Buggy submission (verdict: Runtime Error):
x = int(input())
y = int(input())
 
print(int(x+(y/2)))

Buggy submission (verdict: Runtime Error):
x = int(input())
y = int(input())

  print(int(x+(y/2)))

Buggy submission (verdict: Runtime Error):
x = int(input())
y = int(input())

if y==0:
 print(x+y)
else:
  print(int(x+(y/2)))

Buggy submission (verdict: Runtime Error):
x = int(input())
y = int(input())

if x==0 or y==0:
 print(x+y)
else:
  print(int(x+(y/2)))

Buggy submission (verdict: Runtime Error):
x = int(input())
y = int(input())

if x==0 or y==0:
 print(x+y)
else:
  print(x+(y/2))

Buggy submission (verdict: Runtime Error):
x=int(input())
y=int(input())


print(x+(y/2)):
Problem p03238 (python)

Fixed submission:
n = int(input())

if n==1:
  print('Hello World')
else:
  a = int(input())
  b = int(input())
  print(a+b)

Buggy submission (verdict: Runtime Error):
n = int(input())

if n==1:
  print('Hello World')
else:
  a,b = map(int,input().split())
  print(a+b)
Problem p03399 (python)

Fixed submission:
a,b,c,d=[int(input()) for i in range(4)]
print(min(a,b)+min(c,d))

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
print(min(a,b)+min(c,d))
Problem p03477 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
if a+b>c+d:
    print('Left')
elif a+b<c+d:
    print('Right')
else:
    print('Balanced')

Buggy submission (verdict: Runtime Error):
n,a,b = int(input().split())
ans = 0
for i in range(n+1):
    if a<= sum(list(map(int,list(str(i))))) <= b:
        ans += i:
print(ans)
Problem p03478 (python)

Fixed submission:
n,a,b=map(int,input().split())
s=0
for i in range(n+1):
    if a<=sum(list(map(int,str(i))))<=b:
        s+=i
print(s)

Buggy submission (verdict: Runtime Error):
n,a,b = int(input().split())
ans = 0

for i in range(n+1):
    if a<= sum(list(map(int,list(str(i))))) <= b:
        ans += i:
print(ans)
Problem p03494 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
c=0
while(all(a%2==0 for a in A)):
    A = [a//2 for a in A]
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split))
c = 0
while (all(a%2==0 for a in A)):
	A = [a//2 for a in A]
    c += 1
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split))
c = 0
while all(a%2==0 for a in A):
	A = [a//2 for a in A]
    c += 1
print(c)
Problem p03555 (python)

Fixed submission:
x,y =[str(input()) for i in range(2)]
if x[0]==y[2] and x[2]==y[0] and x[1]==y[1]:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(1,n+2):
    if i**2 > n:
        print((i-1)**2)
        break
Problem p03609 (python)

Fixed submission:
x,t= map(int,input().split())
if x>=t:
    print(x-t)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
x,t= map(int,inut().split)
if x>=t:
    print(x-t)
else:
    print(0)
Problem p03635 (python)

Fixed submission:
n,m = map(int,input().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split)
print((n-1)*(m-1))
Problem p03644 (python)

Fixed submission:
N = int(input())
for k in range(1,8):
    if(N < 2**k):
        ans = 2**(k-1)
        break

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
for k in range(1,7):
    if(N < 2**k):
        ans = 2**(k-1)
        break

print(ans)
Problem p03206 (python)

Fixed submission:
d = int(input())
string = 'Christmas'
for i in range(25 - d):
  string += ' Eve'
print(string)

Buggy submission (verdict: Runtime Error):
d = int(input())
string = 'Christmas'
for i range(25 - d):
  string += ' Eve'
print(string)
Problem p03210 (python)

Fixed submission:
X = int(input())
ans = 'NO'
if X == 3 or X == 5 or X ==7:
    ans = 'YES'
print(ans)

Buggy submission (verdict: Runtime Error):
X = int(input())
ans = No
if X == 3 or X == 5 or X ==7:
	ans = Yes
print(ans)
Problem p03495 (python)

Fixed submission:
N, K = map(int, input().split())
l = list(map(int, input().split()))
h = [0] * (N + 1)
for i in range(N):
    h[l[i]] += 1
h.sort()
print(sum(h[:-K]))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = list(map(int, input().split()))
h = [0] * N
for i in range(N):
    h[l[i]] += 1
h.sort()
print(sum(h[:-K]))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = list(map(int, input().split()))
count = 0

hoge = [0] * N

for i in range(N - 1):
    hoge[l[i]] += 1

for j in range(len(hoge)):
    if hoge[j] <= 1:
        count += 1

if count - K <= 0:
    print(0)
else:
    print(count - K)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = list(map(int, input().split()))
count = 0

hoge = [0] * N

for i in range(N - 1):
    hoge[l[i]] += 1

for j in range(len(hoge)):
    if hoge[j] <= 1:
        count += 1

if count - K <= 0:
    print(0)
else:
    print(count - K)
Problem p03547 (python)

Fixed submission:
x, y = input().split()
if x < y:
    print("<")
elif x > y:
    print(">")
else:
    print("=")

Buggy submission (verdict: Runtime Error):
x, y = int(input().split(),16)
if x > y:
    print(">")
elif x < y:
    print("<")
else:
    print("=")
Problem p03476 (python)

Fixed submission:
from pprint import pprint as pp
from functools import lru_cache
import math
"""
問題文
「N も (N+1)÷2 も素数」を満たす奇数 N を 2017に似た数 とします。
Q 個のクエリが与えられます。
クエリ i(1≦i≦Q) では奇数 li,ri が与えられるので、li≦x≦ri かつ 2017に似た数 となる奇数 x の個数を求めてください。
制約
    1≦Q≦105
    1≦li≦ri≦105
    li,ri は奇数
    入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
Q
l1 r1
:
lQ rQ
出力
i 行目 (1≦i≦Q) に、クエリ i の答えが x 個のとき、x を出力せよ。
"""

prime = [True] * 100000
prime[0] = False
prime[1] = False
for i in range(2,len(prime)):
    if prime[i]:
        for j in range(i*2, len(prime), i):
            prime[j] = False
prime2017 = [0] * 100000
prime2017[0] = 0
prime2017[1] = 0
prime2017[2] = 0
ruiseki=0
for x in range(3,len(prime)):
    if prime[x] and prime[int((x+1)/2)]:
        ruiseki+=1
    prime2017[x] = ruiseki
q=int(input())
lr_ary = []
for _ in range(q):
    l,r=list(map(int, input().split()))
    print(prime2017[r]-prime2017[l-1])

Buggy submission (verdict: Runtime Error):
from pprint import pprint as pp
from functools import lru_cache
import math
"""
問題文
「N も (N+1)÷2 も素数」を満たす奇数 N を 2017に似た数 とします。
Q 個のクエリが与えられます。
クエリ i(1≦i≦Q) では奇数 li,ri が与えられるので、li≦x≦ri かつ 2017に似た数 となる奇数 x の個数を求めてください。
制約
    1≦Q≦105
    1≦li≦ri≦105
    li,ri は奇数
    入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
Q
l1 r1
:
lQ rQ
出力
i 行目 (1≦i≦Q) に、クエリ i の答えが x 個のとき、x を出力せよ。
"""
q=int(input())
lr_ary = []
for _ in range(q):
  lr_ary.append(list(map(int, input().split())))

prime = [True] * 100000
prime[0] = False
prime[1] = False
for i in range(2,len(prime)):
    if prime[i]:
        for j in range(i*2, len(prime), i):
            print(j)
            prime[j] = False

for l,r in lr_ary:
    ret=0
    for x in range(l,r+1,2):
        if prime[x] and prime[(x+1)/2]:
            ret += 1
    print(ret)
Problem p03261 (python)

Fixed submission:
n = int(input())

last = None
seen = set()
for _ in range(n):
  w = input()
  if w in seen or (last and last[-1] != w[0]):
    print("No")
    break
  seen.add(w)
  last = w
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
    n = int(input())
     
    last = None
    seen = set()
    for _ in range(n):
      w = input()
      if w in seen or (last and last[-1] != w[0]):
        print("No")
        break
      seen.add(w)
    else:
      print("Yes")
Problem p03276 (python)

Fixed submission:
n, k = [int(x) for x in input().split()]

vs = [int(x) for x in input().split()]

ns = [-v for v in vs if v < 0][::-1]
ps = [v for v in vs if v >= 0]

res = float('inf')
if len(ps) >= k:
    res = ps[k-1]
for i in range(min(k, len(ns))):
    if len(ps) + i + 1 < k: continue
    res = min(res, ns[i] * 2 + (ps[k - i - 2] if k > i + 1 else 0))
    res = min(res, ns[i] + (ps[k - i - 2] if k > i + 1 else 0) * 2)

print(res)

Buggy submission (verdict: Runtime Error):
n, k = [int(x) for x in input().split()]

vs = [int(x) for x in input().split()]

ns = [-v for v in vs if v < 0][::-1]
ps = [v for v in vs if v >= 0]

res = float('inf')
if len(ps) >= k:
    res = ps[k-1]
for i in range(min(k, len(ns))):
    if len(ps) + i + 1 < k: continue
    res = min(res, ns[i] * 2 + ps[k - i - 2])
    res = min(res, ns[i] + ps[k - i - 2] * 2)

print(res)
Problem p03752 (python)

Fixed submission:
def dfs(index):
    global ans
    if index == N:
        if blst.count(1) >= K - 1:
            tmp = a[0]
            anstmp = 0
            for i in range(1, N):
                if blst[i - 1] == 0:
                    if tmp < a[i]:
                        tmp = a[i]
                    continue
                if tmp >= a[i]:
                    anstmp += tmp - a[i] + 1
                    tmp += 1
                else:
                    tmp = a[i]
            ans = min(ans, anstmp)
        return
    for i in range(2):
        blst[index - 1] = i
        dfs(index + 1)
    return

N, K = map(int, input().split())
a = list(map(int, input().split()))
blst = [0] * (N - 1)
ans = float('inf')
dfs(1)

print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
def dfs(index):
    global ans
    if index == N:
        if blst.count(1) == K:
            tmp = a[bisect_left(blst, 1)]
            anstmp = 0
            for i in range(N):
                if blst[i] == 0:continue
                if tmp >= a[i]:
                    anstmp += tmp - a[i] + 1
                    tmp += 1
                else:
                    tmp = a[i]
            ans = min(ans, anstmp)
        return
    for i in range(2):
        blst[index] = i
        dfs(index + 1)
    return

N, K = map(int, input().split())
a = list(map(int, input().split()))
blst = [0] * N
ans = float('inf')
dfs(0)

print(ans - K)
Problem p03910 (python)

Fixed submission:
N = int(input())
ans = 0

if N < 3:
    print(N)
    exit()

for i in range(1, N + 1):
    tmp = (i * (i - 1)) //  2
    if tmp >= N:
        ans = i - 1
        break

anslst = [i for i in range(ans, 0, -1)]
tmp = N - anslst[0]
print(anslst[0])
for i in anslst[1:]:
    if tmp - i < 0:
        continue
    if tmp == 0:
        break
    print(i)
    tmp -= i

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(1, N + 1):
    tmp = (i * (i - 1)) //  2
    if tmp >= N:
        ans = i - 1
        break

anslst = [i for i in range(ans, 0, -1)]
tmp = N - anslst[0]
print(anslst[0])
for i in anslst[1:]:
    if tmp == 0:
        break
    tmp -= i
    print(i)
Problem p03210 (python)

Fixed submission:
X = int(input())

if X == 3:
  print("YES")
elif X == 5:
  print("YES")
elif X == 7:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
X = int(input())

if X　== 3, 5, 7:
  print("YES")
else:
  print("NO")
Problem p03192 (python)

Fixed submission:
N= input()
s = N.count("2")
print(s)

Buggy submission (verdict: Runtime Error):
n,p = map(int,input().split())
N = round(p**(1/n))
for i in range(N,0,-1):
        if p%(i**n)==0:
            print(i)
            exit()
Problem p03351 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
x = abs(b-a)<=d and abs(c-b)<=d
if abs(c-a)<=d or x:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
if abs(c-a)<=d or (abs(b-a)<=d and abs(c-b)<=d)
    print("Yes")
else:
    print("No")
Problem p03370 (python)

Fixed submission:
n,x = map(int,input().split())
m = [int(input()) for i in range(n)]
l = x-sum(m)
a = l//min(m)
print(n+a)

Buggy submission (verdict: Runtime Error):
5 3000
150
130
150
130
110
Problem p03543 (python)

Fixed submission:
n = input()
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
    print("Yes")
else:
    print("No")
Problem p03194 (python)

Fixed submission:
import math


def get_max(n, p):
    factors = []
    counts = []

    count = 0
    while p % 2 == 0:
        count += 1
        p = p / 2

    if count > 0:
        factors.append(2)
        counts.append(count)

    for i in xrange(3, int(math.sqrt(p)) + 1, 2):
        # print i

        count = 0
        while p % i == 0:
            count += 1
            p = p / i

        if count > 0:
            factors.append(i)
            counts.append(count)

    if p > 2:
        factors.append(p)
        counts.append(1)

    if len(factors) == 0:
        return 1

    i = len(factors) - 1

    ans = 1

    while i >= 0:

        # print counts[i], n

        if counts[i] >= n:

            power = int(counts[i]/n)
            ans *= factors[i]**power

        i -= 1

    return ans

N, P = map(int, raw_input().split())
print get_max(N, P)

Buggy submission (verdict: Runtime Error):
import primefac
Problem p03195 (python)

Fixed submission:
n = int(raw_input())

answer = "second"

for i in xrange(n):
    a = int(raw_input())
    if not a % 2 == 0:
        answer = "first"

print answer

Buggy submission (verdict: Runtime Error):
N = int(raw_input())

answer = "first"
for i in xrange(n):
  a = int(raw_input())
  if not a % 2 == 0:
    answer = "second"
    
print answer
Problem p03192 (python)

Fixed submission:
a = list(input())
counter =0
for i in a:
    if i =='2':
        counter +=1
print(counter)

Buggy submission (verdict: Runtime Error):
N, H, W = map(int, input().split())
A = []
B = []
counter = 0
for i in range(0,N):
    a,b  = map(int, input().split())
    if a>H and b>W:
        counter +=1
print(counter)
Problem p03193 (python)

Fixed submission:
N, H, W = map(int, input().split())
A = []
B = []
counter = 0
for i in range(0,N):
    a,b  = map(int, input().split())
    if a>=H and b>=W:
        counter +=1
print(counter)

Buggy submission (verdict: Runtime Error):
N, H, W = map(int, input().split())
A = []
B = []
counter = 0
for i in range(0,N):
    a,b  = map(int, input().split())
    if a=>H and b=>W:
        counter +=1
print(counter)
Problem p03220 (python)

Fixed submission:
N = int(input())
T,A = map(int,input().split())
H = [A -(T - int(x)*0.006) for x in input().split()]
h = [abs(i) for i in H]
print(h.index(min(h))+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
T,A = map(int,input().split())
H = [(A -T + int(x)*0.006) for x in input().split()]
h = map(abs, H)
print(h.index(min(h))+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
T,A = map(int,input().split())
H = [A -(T - int(x)*0.006) for x in input().split()]
h = map(abs, H)
print(h.index(min(h))+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
T,A = map(int,input().split())
H = [A -(T - int(x)*0.006) for x in input().split()]
h = map(abs, H)
print(h.index(min(h))+1)
Problem p03251 (python)

Fixed submission:
n, m, X, Y = map(int,input().split())
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
if X>= Y:
  print('War')
else:
  xmax = max(x)
  ymin = min(y)
  if xmax >= ymin:
    print('War')
  elif xmax>=Y:
    print('War')
  elif X>= ymin:
    print('War')
  else:
    print('No War')

Buggy submission (verdict: Runtime Error):
n, m, X, Y = map(int,input().split())
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
if X>= Y:
  print('War')
else:
  xmax = max(x)
  ymin = min(y)
  if xmax >= ymin:
    print('War')
  elif: xmax>=Y:
    print('War')
  elif: X>= ymin:
    print('War')
  else:
    print('No War')
Problem p03254 (python)

Fixed submission:
n, x = map(int, input( ).split())
a = list(map(int, input().split()))
counter = 0
for i in sorted(a):
  x -= i
  counter += 1
  if x<0:
    print(counter-1)
    break
  elif x==0:
    print(counter)
    break
  else:
    if counter==n:
      print(counter-1)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input( ).split())
a = list(map(int, input().split()))
counter = 0
for i in sorted(a):
  x -= i
  if x < 0:
    print(counter)
  else:
    counter += 1
  if counter == n:
    print(n)
n, x = map(int, input( ).split())
a = list(map(int, input().split()))
counter = 0
for i in sorted(a):
  x -= i
  if x <= 0:
    print(counter)
  else:
    counter += 1
  if counter == n:
    print(n)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input( ).split())
a = list(map(int, input().split()))
counter = 0
for i in a.sort():
  x -= i
  if x <0:
    print(counter)
  else:
    counter += 1

Buggy submission (verdict: Runtime Error):
n, x = map(int, input( ).split())
a = []
for i in range(n):
  k = input().split( )[i]
  a.append(int(k))
counter = 0
for i in a.sort():
  x -= i
  if x <0:
    print(counter)
  else:
    counter += 1

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
a = []
for i in range(n):
  k = input().split()[i]
  a.append(int(k))
counter = 0
for i in a.sort():
  x -= i
  if x <0:
    print(counter)
  else:
    counter += 1
Problem p03195 (python)

Fixed submission:
N = int(input())
a = [int(input()) % 2 for _ in range(N)]
res = sum(a)
print("first" if res > 0 else "second")

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for _ in range(N)] * [0, 0]
a.sort()
if len(a) >= 2:
    res = a[-2]
else:
    res = a[-1]
res += sum(a[:-2])
print("second" if res % 2 == 0 else "first")

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for _ in range(N)]
a.sort()
res = a[-2] % 2
print("second" if res == 0 else "first")
Problem p03296 (python)

Fixed submission:
N = int(input())
S = input().split()
s = 0
for i in range(1, N):
	if S[i-1] == S[i]:
		S[i] = N + 1000000000
		s += 1
	
print(s, flush=True)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input().split(' ')
s = sum([S[i-1] == S[i] or S[i] == S[i+1] for i in  range(1, N-1, 2)])
s -= sum([S[i-1]== S[i] == S[i+1] for i in  range(2, N, 2)])
print(s, flush=True)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input().split()
s = sum([S[i-1] == S[i] or S[i] == S[i+1] for i in  range(1, N, 2)])
print(s, flush=True)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(N)]
s = sum([S[i-1] == S[i] or S[i] == S[i+1] for i in  range(1, N, 2)])
print(s)
Problem p03192 (python)

Fixed submission:
a = input()
print(str(a).count("2"))

Buggy submission (verdict: Runtime Error):
a = input()
return a.count("2")