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

Fixed submission:
a,b = map(int,input().split())

c = []
for i in range(b):
  c.append(list(map(int,input().split())))

c.sort(key = lambda x:x[1])

s = c[0][0]
l = c[0][1]
re = 1

for i in range(1,b):
  if l <= c[i][0]:
    re += 1
    l = c[i][1]
    
print(re)

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

c - []
for i in range(a[1]):
  c.append(list(map(int,input().split())))

c.sort(key = lambda x:x[1])

s = c[0][0]
l = c[0][1]
re = 1

for i in range(1,a[1]):
  if l >= c[i][0]:
    re += 1
    l = c[i][1]
    
print(re)
Problem p03307 (python)

Fixed submission:
n = int(input())

if n % 2==0:
  print(n)
else:
  print(n*2)

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

if n % 2==0
	print(n)
else:
  print(n*2)
Problem p03345 (python)

Fixed submission:
da = list(map(int,input().split()))
 
m = 0
l = pow(10,18)
  
if da[3] % 2 == 1:
  k = da[1] -da[0]
else:
  k = da[0] -da[1]

if abs(da[0] - da[1]) <= l:
  print(k)
elif abs(da[0] - da[1]) > l:
  print("Unfair")

Buggy submission (verdict: Runtime Error):
da = list(map(int,input().split()))
 
m = 0
l = pow(10,18)
  
if da[3] % 2 == 1:
  k = da[1] -da[0]
else:
  k = da[0] -da[1]

elif abs(da[0] - da[1]) < l:
  print(da[0] - da[1])
elif abs(da[0] - da[1]) >= l:
  print("Unfair")

Buggy submission (verdict: Runtime Error):
da = list(map(int,input().split()))
 
m = 0
l = pow(10,18)
 
def aaa(d,a,t):
  k = [0]*3
  k[0] = d + a
  k[1] = d + t
  k[2] = a + t
  return k
 
for i in range(da[3]):
  if da[0] == da[1] and da[1] == da[2]:
    break
  da = aaa(da[0],da[1],da[2])
  if abs(da[0] -da[1]) >= l:
    break
  elif abs(2(da[0] -da[1])) < l or m == 1:
    m = 1
    break
 
if abs(da[0] - da[1]) < l:
  print(da[0] - da[1])
elif abs(da[0] - da[1]) >= l:
  print("Unfair")

Buggy submission (verdict: Runtime Error):
da = list(map(int,input().split()))
 
m = 0
l = pow(10,18)
 
def aaa(d,a,t):
  k = [0]*3
  k[0] = d + a
  k[1] = d + t
  k[2] = a + t
  return k
 
for i in range(da[3]):
  if da[0] == da[1] and da[1] == da[2]:
    break
  da = aaa(da[0],da[1],da[2])
  if abs(da[0] -da[1]) >= l:
    break
  elif abs(2(da[0] -da[1])) < l or m == 1:
    m = 1
    break
 
if abs(da[0] - da[1]) < pow(10,18):
  print(da[0] - da[1])
elif abs(da[0] - da[1]) >= pow(10,18):
  print("Unfair")

Buggy submission (verdict: Runtime Error):
import sys
da = list(map(int,input().split()))

m = 0

if pow(2,da[3])*(da[0]-da[1]) >= pow(10,18):
  print("Unfair")
  sys.exit()

def aaa(d,a,t):
  k = [0]*3
  k[0] = d + a
  k[1] = d + t
  k[2] = a + t
  return k

for i in range(da[3]):
  if da[0] == da[1] and da[1] == da[2]:
    break
  da = aaa(da[0],da[1],da[2])
  if abs(da[0] -da[1]) >= pow(10,18):
    break
  if abs(2(da[0] -da[1])) < pow(10,18):
    m = 1
    break

if abs(da[0] - da[1]) < pow(10,18):
  print(da[0] - da[1])
elif abs(da[0] - da[1]) >= pow(10,18) or m ==1:
  print("Unfair")

Buggy submission (verdict: Runtime Error):
da = list(map(int,input().split()))

m = 0

def aaa(d,a,t):
  k = [0]*3
  k[0] = d + a
  k[1] = d + t
  k[2] = a + t
  return k

for i in range(da[3]):
  if da[0] == da[1] and da[1] == da[2]:
    break
  da = aaa(da[0],da[1],da[2])
  if abs(da[0] -da[1]) >= pow(10,18):
    break
  if abs(2(da[0] -da[1])) < pow(10,18):
    m = 1
    break

if abs(da[0] - da[1]) < pow(10,18):
  print(da[0] - da[1])
elif abs(da[0] - da[1]) >= pow(10,18) or m ==1:
  print("Unfair")

Buggy submission (verdict: Runtime Error):
da = list(map(int,input().split()))

m = 0

def aaa(d,a,t):
  k = [0]*3
  k[0] = d + a
  k[1] = d + t
  k[2] = a + t
  return k


for i in range(da[3]):
  if da[0] == da[1] and da[1] == da[2]:
    break
  da = aaa(da[0],da[1],da[2])
  if abs(da[0] -da[1]) >= pow(10,18):
    break
  if abs(2(da[0] -da[1])) < pow(10,18):
    m = 1
    break

if abs(da[0] - da[1]) < pow(10,18):
  print(da[0] - da[1])
elif abs(da[0] - da[1]) >= pow(10,18) or m ==1:
  print("Unfair")
Problem p03821 (python)

Fixed submission:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = onem()
po = []
for i in range(n):
    po.append(l())

co = 0

for i in range(n):
    on = po[-(i+1)]
    on[0] += co
    co += (on[1] - (on[0] % on[1])) if on[0] % on[1] != 0 else 0

print(co)

Buggy submission (verdict: Runtime Error):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = onem()
po = []
for i in range(n):
    po.append(l())

co = 0

for i in range(n):
    on = po[-(i+1)]
    on[0] += co
    co += ((on[1] - on[0]) % on[1]) if on[1] % on[0] != 0 else 0

print(co)
Problem p03077 (python)

Fixed submission:
import numpy as np
n = int(input())
a = []
for i in range(5):
    tmp = int(input())
    a.append(tmp)

print(int(np.ceil(n / min(a)) +4))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(5):
    inp = int(input())
    a.append(inp)

mini = min(a)
if n > mini:
    add = (int(n /10)*10) / mini
    n -= int(add*mini)
    #print(n)
num = [n]

for i in range(5):
    num.append(0)
    
count =0
while True:
    non_zero = [i for i in range(5) if num[i] !=0] 
    #print(non_zero)
    for i in reversed(non_zero):
        #print("i {}".format(i))
        move = min(a[i], num[i])
        num[i] -= move
        num[i+1] += move
    count +=1
   
    #print(num)
    #print(count)
    if num[-1]==n:
        break
print(int(count+add))
Problem p03272 (python)

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

Buggy submission (verdict: Runtime Error):
n, i = map(int,input.split())
print(n-i+1)
Problem p03426 (python)

Fixed submission:
h, w, d = map(int, input().split())
d_x = [-1] * (h*w + 1)
d_y = [-1] * (h*w + 1)
for i in range(h):
    tmp = list(map(int, input().split()))
    for j in range(len(tmp)):
        d_x[tmp[j]] = i
        d_y[tmp[j]] = j

dist = [-1] * (h*w + 1) 
for i in range(h*w):
    j = h*w - i
    if h*w - j < d:
        dist[j] = 0
    else:
        dist[j] = dist[j+d] + abs(d_x[j+d] - d_x[j]) + abs(d_y[j+d] - d_y[j])
    
q =  int(input())
for _ in range(q):
    start, end = map(int, input().split())
    print(dist[start]- dist[end])

Buggy submission (verdict: Runtime Error):
def loc_decide(loc, w, num):
    location = [i for i in range(len(loc)) if loc[i] == num][0]
    row = location // w
    column = location % w
    return [row, column]

h, w, d = map(int, input().split())
loc = []
for _ in range(h):
    tmp = list(map(int, input().split()))
    for i in range(len(tmp)):
        loc.append(tmp[i])
n = int(input())
mem = []
for _ in range(n):
    start, end = map(int, input().split())
    dist = 0
    if start == end:
        print(dist)
        mem.append([start, end, dist])
    else:
        judge = [i for i in range(len(mem)) if mem[i][0]==start and mem[i][1]==end]
        if len(judge) >=1:
            print(mem[judge[0][2]])
        else:
            for i in range(start, end+1, d):
                if i == start:
                    prev_loc = loc_decide(loc, w, i)
                else:
                    next_loc = loc_decide(loc, w, i)
                    dist += (abs(next_loc[0]- prev_loc[0]) + abs(next_loc[1] - prev_loc[1]))
                    prev_loc = next_loc
            mem.append([start, end, dist])
            print(dist)
Problem p02594 (python)

Fixed submission:
x = int(input())
if (x >= 30):
 	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
x = int(raw_input())
if (x >= 30):
 	print("Yes")
else:
	print("No")
Problem p02779 (python)

Fixed submission:
import sys

N = int(input())
A = list(map(int, input().split()))
A.sort()

for i in range(0, N - 1, 1):
	if A[i] == A[i + 1]:
		print("NO")
		sys.exit(0)

print("YES")

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())
A = list(map(int, input().split()))
A.sort()

for i in range(0, N, 1):
	if A[i] == A[i + 1]:
		print("NO")
		sys.exit(0)

print("YES")
Problem p02594 (python)

Fixed submission:
tem = int(input())
if tem >= 30:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
tem = input()
if tem >= 30:
  print('Yes')
else:
  print('No')
Problem p02629 (python)

Fixed submission:
#abc171c
n=int(input())
s=''
while n:
 n-=1
 s+=chr(n%26+97)
 n//=26
print(s[::-1])

Buggy submission (verdict: Runtime Error):
abc171c
n=int(input())
s=''
while n:
 n-=1
 s+=chr(n%26+97)
 n//=26
print(s[::-1])
Problem p02676 (python)

Fixed submission:
#abc168b
k=int(input())
s=input()
if len(s)<=k:
 print(s)
else:
 ss=s[:k]
 print(ss+'...')

Buggy submission (verdict: Runtime Error):
abc166b
k=int(input())
s=input()
if len(s)<=k:
 print(s)
else:
 ss=s[:k]
 print(ss+'...')
Problem p02699 (python)

Fixed submission:
#abc164a

s,w=map(int,input().split())
if s<=w:
 print('unsafe')
else:
 print('safe')

Buggy submission (verdict: Runtime Error):
#abc164a

a,b,c,d=map(int,input().split())
x=(a+d-1)//d
y=(c+b-1)//b
if x>=y:
 print('Yes')
else:
 print('No')

Buggy submission (verdict: Runtime Error):
#abc164a

a,b,c,d=map(int,input().split())
x=(a+d-1)/d
y=(c+b-1)/b
if x>=y:
 print('Yes')
else:
 print('No')
Problem p02831 (python)

Fixed submission:
#abc148c
from fractions import gcd

a,b=map(int,input().split())
print((a*b)//gcd(a,b))

Buggy submission (verdict: Runtime Error):
#abc148c
import math

a,b=map(int,input().split())
print((a*b)//math.gcd(a,b))
Problem p02835 (python)

Fixed submission:
#abc147a

a1,a2,a3=map(int,raw_input().split())
if a1+a2+a3>=22:
 print 'bust'
else:
 print 'win'

Buggy submission (verdict: Runtime Error):
#abc15047d
n=int(raw_input())
a=map(int,raw_input().split())
mod=10**9+7
res=0
for i in range(60):
 cnt=sum([1 for x in a if (x>>i & 1)])
 res+=cnt*(n-cnt)*(1<<i)
 res=res%mod
print res
Problem p02897 (python)

Fixed submission:
#abc142a
n=int(raw_input())
if n%2==0:
 print 0.5
else:
 print (1.0+n/2)/n

Buggy submission (verdict: Runtime Error):
#abc142d

def gcd(x,y):
 while y:
  x,y=y,x%y
 return x

def factorize(n):
 fct=[]
 b,e=2,0
 while b*b<=n:
  while n%b==0:
   n=n//b
   e =e+1
   if e>0:
    fct.append((b,e))
    b,e=b+1,0
 if n>1:
  fct.append((n,1))
 return fct

a,b=map(int,raw_input().split())
z=gcd(a,b)
print len(factorize(z))+1
Problem p03127 (python)

Fixed submission:
#abc118c
import functools

def gcd(a,b):
 while b:
  a,b=b,a%b
 return a

n=int(raw_input())
l=map(int,raw_input().split())
print functools.reduce(gcd,l)

Buggy submission (verdict: Runtime Error):
#abc118c

import functools
import math

n=int(input())
l=list(map(int,input().split()))
print(functools.reduce(math.gcd,l))
Problem p03135 (python)

Fixed submission:
#abc117a
t,x=map(int,raw_input().split())
print 1.0*t/x

Buggy submission (verdict: Runtime Error):
#abc117b

n=int(raw_input())
l=map(int,raw_input().split())
if max(l)>=sum(l)-max(l):
 print 'No'
else:
 print 'Yes'
Problem p03803 (python)

Fixed submission:
#ABC054A

a,b=map(int,raw_input().split())
if a==1:
 a=14
if b==1:
 b=14
if a>b:
 print 'Alice'
elif a<b:
 print 'Bob'
else:
 print 'Draw'

Buggy submission (verdict: Runtime Error):
#ABC054A

a,b=map(int<raw_input().split())
if a==1:
 a=14
if b==1:
 b=14
if a>b:
 print 'Alice'
elif a<b:
 print 'Bob'
else:
 print 'Draw'
Problem p02547 (python)

Fixed submission:
n = int(input())
a = []

for _ in range(n):
  aa, b = map(int,input().split())
  if aa == b:
    a.append("1")
  else:
    a.append("0")
if "111" in "".join(a):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
count = 0
total = 0

for _ in range(n):
  total += 1
  if x[n] == y[n]:
    count += 1
    if count == 3:
      print("Yes")
      break
  else:
    count = 0
  if total == n and count < 3:
    print("No")
Problem p02571 (python)

Fixed submission:
s = input()
t = input()
 
ans = 10000
for i in range(len(s) - len(t) + 1):
  tmp = 0
  for j in range(len(t)):
    if s[i + j] != t[j]:
      tmp+=1
  ans = min(ans, tmp)
print(ans)

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

ans = 10000
for i in range(len(s) - len(t) + 1):
  tmp = 0
  for i in range(len(t)):
    if s[i + j] != s[j]:
      tmp+=1
    ans = min(ans, tmp)
print(ans)
Problem p02693 (python)

Fixed submission:
k = int(input())
a, b = map(int, input().split())
 
for x in range(a, b+1):
    if x % k == 0:
        print('OK')
        break
else:
    print('NG')

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input().split())

 
for i in range(a, b+1):
	if i % k == 0:
    	print("OK")
    	break
else:
	print("NG")

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input().split())
B = b + 1
 
for i in range(a, B):
	if i % k == 0:
    	print("OK")
    	break
else:
	print("NG")

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input().split())
B = b + 1
 
for i in range(a, B):
	if i % k == 0:
    	print("OK")
    	break
else:
	print("NG")

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = list(map, int(input()))
B = b + 1

for i in range(a, B):
  if i % k == 0:
    print("OK")
  else:
    print("NG")
Problem p02711 (python)

Fixed submission:
n = input()
if "7" in n:
  print("Yes")
else:
  print("No")

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

if n in 7:
  print("Yes")
elif n not in 7:
  print("No")

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

if N.count(7) >= 1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N =input()
if N.count("7") >= 1:
  pirnt("Yes)
else:
	print("No"9

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

counted = n.count(7)

if counted == True:
  print("Yes")
else:
  print("No")
Problem p02753 (python)

Fixed submission:
s = input()
if "A" not in s or "B" not in s:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a, b, c = input().split()

if a == b and b== c and a==c:
  print("No")
else:
  print("Yes")
Problem p02754 (python)

Fixed submission:
n, a, b = map(int,input().split())
 
if a != 0:
  answer = n // (a+b)
  remainder = n % (a+b)
  print((answer*a) + min(a, remainder))
else:
  print(0)

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

if a != 0:
  answer = n // (a+b)
  remainder = n % (a+b)
  print(answer*a) + min(a, remainder)
else:
  print(0)
Problem p02777 (python)

Fixed submission:
s, t = input().split()
a, b = map(int, input().split())
u = input()
 
if u == s:
  print(a-1,b)
elif u == t:
  print(a, b-1)

Buggy submission (verdict: Runtime Error):
s, t = input().split()
a, b = map(int, input().split())
u = input()
 
if u == s:
  print(s-1,t)
elif u == t:
  print(s, t-1)

Buggy submission (verdict: Runtime Error):
s, t = input().split()
a, b = map(int, input().split())
u = int(input())
 
if u == s:
  print(s-1,t)
elif u == t:
  print(s, t-1)

Buggy submission (verdict: Runtime Error):
s, t = input()
a, b = map(int, input().split())
u = int(input())

if u == "red":
  print(int(s-1,t))
elif t == "blue":
  print(int(s, t-1))
Problem p02546 (python)

Fixed submission:
S=input()
s=len(S)
if S[s-1] == "s":
  print(S+"es")
else:
  print(S+"s")

Buggy submission (verdict: Runtime Error):
S=input()
s=len(S)
if S[s] == "s":
  print(S+"es")
else:
  print(S+"s")
Problem p02552 (python)

Fixed submission:
x=int(input())

if x==0:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
if x==0:
  return 1
elif x==1:
  return 0
else:
  break
Problem p02570 (python)

Fixed submission:
d, t, s = list(map(int, input().split(" ")))
 
min = d / s
 
if min <= t:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
D=int(input())
T=int(input())
S=int(input())
limit_speed=D/T+D%T

if(limit_speed<=S):
  print("Yes")
else:
  print("No")
Problem p02835 (python)

Fixed submission:
a,b,c=map(int,input().split())
sum=a+b+c
 
if sum >=22:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input()split())
sum=a+b+c

if sum >=22:
  print("bust")
else:
  print("win")
Problem p02773 (python)

Fixed submission:
from collections import Counter

N = int(input())

str_lis = [str(input()) for i in range(N)]
c = Counter(str_lis)
a = c.most_common()
num = a[0][1]
b = []
for i in a:
  if i[1] == num:
    b.append(i[0])
    num = i[1]
  else:
    break
    
new_b = sorted(b)
for i in new_b:
  print(i)

Buggy submission (verdict: Runtime Error):
N = int(input())
str_lis = []
for i in range(N):
  str_lis.append(ord(input()))

max_num = 0
max_str = []
for i in str_lis:
  if str_lis.count(i) > max_num and not i in max_str:
    max_num = str_lis.count(i)
    max_str = []
    max_str.append(i)
  elif str_lis.count(i) == max_num and not i in max_str:
    max_num = str_lis.count(i)
    max_str.append(i)
    
new_max_str = sorted(max_str)

for i in new_max_str:
  print(chr(i))
Problem p02847 (python)

Fixed submission:
S = input()
day_list = ["MON", "TUE", "WED", "THU", "FRI", "SAT"]
if S == "SUN":
  print(7)
else:
  ind = day_list.index(S)
  print(6-ind)

Buggy submission (verdict: Runtime Error):
S = str(input())
day_list = ["MON", "TUE", "WED", "THU", "FRI", "SAT"]
if S == "SUN":
  print(7)
else:
  ind = day_list.index(S)
  printt(6-ind)

Buggy submission (verdict: Runtime Error):
S = input()
day_list = ["MON", "TUE", "WED", "THU", "FRI", "SAT"]
if S == "SUN":
  print(7)
else:
  ind = day_list.index(S)
  printt(6-ind)
Problem p02577 (python)

Fixed submission:
num = input()

intNum = 0

loop = len(num)
for i in range(loop):
  intNum += int(num[i])

if intNum % 9 == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
num = input()

intNum = 0

loop = len(num)
for i in range(loop):
  intNum += int(num)[i]

if intNum % 9 == 0:
  print('Yes')
else:
  print('No')

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

intNum = 0

loop = len(num)
for i in loop:
  intNum += int(num)[i]
  
if inNum % 9 == 0:
  print('Yes')
else:
  print('No')
Problem p02623 (python)

Fixed submission:
n, m, k = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

a = []
a.append(0)
for i in range(n):
    a.append(a[i]+a_list[i])
    
b = []
b.append(0)
for i in range(m):
    b.append(b[i]+b_list[i])
    

ans = 0
for i in range(n+1):
    if a[i]>k:
        break
    while a[i] + b[m] > k:
        m -= 1
    ans = max(ans, i+m)
    
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

ab_list = a_list + b_list
ab_list.sort()

dp = [False] * 200000*2

dp[0] = ab_list[0]
j = ab_list[0]

count=1

for i in range(1,len(ab_list)):
    # print(ab_list[i]+j)
    a_min = a_list.pop(0)
    b_min = b_list.pop(0)
    dp[i] = min(a_min, b_min) + j
    j += ab_list[i]
    
    if dp[i]<=k:
        count+=1
    
    if j+ab_list[i+1]>k:
        break

    

print(count)
Problem p03295 (python)

Fixed submission:
n, m = map(int, input().split())

ab = []

for i in range(m):
    a, b = map(int, input().split())
    ab.append((a,b))

ab = sorted(ab, key = lambda x: x[1])

left = 0
ans = 0


for a, b in ab:
    if a > left:
        ans += 1
        left = b-1
    
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())

ab = []

for i in range(m):
    a, b = map(int, input().split())
    ab.append((a,b))

ab = sorted(ab, key = lambda x: x[[1])

left = 0
ans = 0


for a, b in ab:
    if a < left:
        ans += 1
        left = b-1
    
print(ans)
Problem p02987 (python)

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd


def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    s=list(input())
    t=set(s)
    if len(t)==2:
        print('Yes')
    else:
        print('No')


if  __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd


def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    P=list(input())
    ct_a=0
    ct_s=0
    for x in P:
        if x=='A' :
            ct_a+=1
        elif x=='S':
            ct_s+=1
    if ct_a==2 an ct_s==2:
        print('Yes')
    else:
        print('No')




if  __name__=='__main__':
    main()