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

Fixed submission:
import sys
 
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
 
import numpy as np
 
N = int(readline())
A = np.array(readline().split(), dtype=np.int64)
B = np.array(readline().split(), dtype=np.int64)
 
diff = A-B
lack = -diff[diff<0]
remain = diff[diff>0]
 
x = lack.sum()
remain.sort()
cum = remain[::-1].cumsum()
 
y = 0 if x == 0 else np.searchsorted(cum,x) + 1
 
answer = len(lack) + y if y <= len(remain) else -1
print(answer)

Buggy submission (verdict: Runtime Error):
import sys

readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)

import numpy as np

N = int(readline())
A = np.array(readline().split(), dtype=np.int64)
B = np.array(readline().split(), dtype=np.int64)

diff = A-B
lack = -diff[diff<0]
remain = diff[diff>0]

x = lack.sum()
remain.sort()
cum = remain[::-1].cumsum()

y = 0 if x == 0 else np.searchsorted(cum,x) + 1

answer = len(lack) + y if y <= len(remain) else -1
print(answer)
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())
a = int(input())
b = int(input())
if n == 1:
  print('Hello World')
else:
  print(a + b)
Problem p03285 (python)

Fixed submission:
import sys
 
N=int(input())
 
for i in range(101):
  for j in range(101):
    if 4*i + 7*j == N:
      print('Yes')
      sys.exit()
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import sys

N=int(input())

for i range(101):
  for j in range(101):
    if 4*i + 7*j == N:
      print('Yes')
      sys.exit()
else:
  print('No')
Problem p03294 (python)

Fixed submission:
import fractions
n = int(input())
a = list(map(int, input().split()))
m = 0
ans = 0

for i in range(n):
  m = m*a[i]//fractions.gcd(m, a[i])
m -= 1

for i in range(n):
  ans += m%a[i]

print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
n = int(input())
a = list(map(int, input().split()))
m = 0
ans = 0

for i in range(n):
  m = fractions.lcm(m, a[i])
m -= 1

for i in range(n):
  ans += m%a[i]

print(ans)
Problem p03308 (python)

Fixed submission:
n=int(input())
a=list(map(int, input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input()))
print(max(a)-min(a))
Problem p03323 (python)

Fixed submission:
a,b = map(int, input().split())
if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a,b = map(int, input())
if a<=8 and b <= 8:
  print('Yay!')
else:
  print(':(')
Problem p03399 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
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 p03427 (python)

Fixed submission:
N = list(i for i in input())
L = len(N)

if L == 1:
  answer = int(N[0])
else:
  if N[0] == '9' and len(set(N)) == 1:
    answer = 9*L
  else:
    if N[0] != '9' and '9' in N and len(set(N)) == 2:
      answer = 9*(L-1) + int(N[0])
    else:
      answer = 9*(L-1) + int(N[0]) - 1

print(answer)

Buggy submission (verdict: Runtime Error):
N = list(i for i in input())
L = len(N)

if L == 1:
  answer = int(N)
else:
  if N[0] == '9' and len(set(N)) == 1:
    answer = 9*L
  else:
    if N[0] != '9' and '9' in N and len(set(N)) == 2:
      answer = 9*(L-1) + int(N[0])
    else:
      answer = 9*(L-1) + int(N[0]) - 1

print(answer)
Problem p03493 (python)

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

Buggy submission (verdict: Runtime Error):
s=input()
print(s.count(1))
Problem p03543 (python)

Fixed submission:
n = input()

if n[1] != n[2]:
  print("No")
else:
  if n[0] == n[1] or n[-1] == n[1]:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = list(x for x in input())
for i in len(n):
  if n[1] != n[2]:
    print("No")
    break
  else:
    if n[0] == n[1] or n[-1] == n[1]:
      print("Yes")
Problem p03544 (python)

Fixed submission:
N=int(input())
L=[2,1]
 
for i in range(2,N+2):
  L.append(L[i-1]+L[i-2])

print(L[N])

Buggy submission (verdict: Runtime Error):
N=int(input())
L=[2,1]

for i in range(2,N):
  L.append(L[i-1]+L[i-2])
print(L[N+1])
Problem p03545 (python)

Fixed submission:
a,b,c,d = (int(i) for i in input())
 
if a+b+c+d == 7:
  print('{}+{}+{}+{}=7'.format(a,b,c,d))
elif a+b+c-d == 7:
  print('{}+{}+{}-{}=7'.format(a,b,c,d))
elif a+b-c+d == 7:
  print('{}+{}-{}+{}=7'.format(a,b,c,d))
elif a+b-c-d == 7:
  print('{}+{}-{}-{}=7'.format(a,b,c,d))
  
elif a-b+c+d == 7:
  print('{}-{}+{}+{}=7'.format(a,b,c,d))
elif a-b+c-d == 7:
  print('{}-{}+{}-{}=7'.format(a,b,c,d))
elif a-b-c+d == 7:
  print('{}-{}-{}+{}=7'.format(a,b,c,d))
elif a-b-c-d == 7:
  print('{}-{}-{}-{}=7'.format(a,b,c,d))

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

if a+b+c+d == 7:
  print('{}+{}+{}+{}=7'.format(a,b,c,d))
elif a+b+c-d == 7:
  print('{}+{}+{}-{}=7'.format(a,b,c,d))
elif a+b-c+d == 7:
  print('{}+{}-{}+{}=7'.format(a,b,c,d))
elif a-b-c-d == 7:
  print('{}-{}-{}-{}=7'.format(a,b,c,d))
  
elif a-b+c+d == 7:
  print('{}-{}+{}+{}=7'.format(a,b,c,d))
elif a-b+c-d == 7:
  print('{}-{}+{}-{}=7'.format(a,b,c,d))
elif a-b-c+d == 7:
  print('{}-{}-{}+{}=7'.format(a,b,c,d))
elif a-b-c-d == 7:
  print('{}-{}-{}-{}=7'.format(a,b,c,d))
Problem p03605 (python)

Fixed submission:
N=[x for x in input()]
if '9' in N:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N=[for x in input()]
if '9' in N:
  print('Yes')
else:
  print('No')
Problem p03609 (python)

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

Buggy submission (verdict: Runtime Error):
X=int(input())
t=int(input())
print(X-t if X>=t else 0)
Problem p03627 (python)

Fixed submission:
import collections
n = int(input())
l = map(int, input().split())
c = collections.Counter(l)
c = sorted(c.items(), key=lambda c:c[0], reverse=True)
 
ans = 1
cnt = 0
 
for key,val in c:
  if cnt==0 and val>=4:
    ans=key**2
    break
  if val>=2:
    ans*=key
    cnt+=1
  if cnt == 2:
    break
else:
  ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
l = map(int, input().split())
c = collections.Counter(l)
c = sorted(c.items(), key=lambda c:c[0], reverse=True)

ans = 1
cnt = 0

for key,val in c:
  if cnt=0 and val>=4:
    ans=key**2
    break
  if val>=2:
    ans*=key
    cnt+=1
  if cnt == 2:
    break
else:
  ans = 0
print(ans)
Problem p03636 (python)

Fixed submission:
S=input()
print(S[0]+str(len(S[1:-1]))+S[-1])

Buggy submission (verdict: Runtime Error):
S=input()
print(S[0]+len(S[1:-1])+S[-1])
Problem p03658 (python)

Fixed submission:
N,K=map(int,input().split())
L=list(map(int,input().split()))
L.sort(reverse=True)
print(sum(L[:K]))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input())
L=list(map(int,input().split()))
L.sort(reverse=True)
print(sum(L[:K]))
Problem p03679 (python)

Fixed submission:
X,A,B=map(int,input().split())
 
if A>=B:
  print('delicious')
else:
  if X>=B-A:
    print('safe')
  else:
    print('dangerous')

Buggy submission (verdict: Runtime Error):
X,A,B=map(int,input().split())

if A>B:
  print('delicious')
else:
  if X>=B-A:
    print('safe')
  else:
    pint('dangerous')
Problem p03697 (python)

Fixed submission:
A,B=map(int,input().split())
if A+B>=10:
  print('error')
else:
  print(A+B)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input())
if A+B>=10:
  print('error')
else:
  print(A+B)
Problem p03711 (python)

Fixed submission:
x,y=map(int,input().split())
 
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
 
if x==2 or y==2:
  print('No')
elif (x in A and y in A) or (x in B and y in B):
  print('Yes')
else:
  print('No')

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

A=[1,3,5,,7,8,10,12]
B=[4,6,9,11]

if x==2 or y==2:
  print('No')
elif (x in A and y in B):
  print('No')
else:
  print('Yes')
Problem p03720 (python)

Fixed submission:
N,M=map(int,input().split())
A=[0]*(N+1)
 
for _ in range(M):
  a,b=map(int,input().split())
  A[a]+=1
  A[b]+=1
 
for i in range(1,N+1):
  print(A[i])

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[0]*(N*1)
 
for _ in range(M):
  a,b=map(int,input().split())
  A[a]+=1
  A[b]+=1
 
for i in range(1,N+1):
  print(A[i])

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[0]*(N*1)

for _ in range(M):
  a,b=map(int,input())
  A[a]+=1
  A[b]+=1

for i in range(1,N+1):
  print(A[i])
Problem p03773 (python)

Fixed submission:
A,B=map(int,input().split())
 
if A+B>=24:
  print(A+B-24)
else:
  print(A+B)

Buggy submission (verdict: Runtime Error):
A,B=map(int,iput().split())
 
if A+B>=24:
  print(A+B-24)
else:
  print(A+B)

Buggy submission (verdict: Runtime Error):
A,B=map(int,iput().splilt())

if A+B>=24:
  print(A+B-24)
else:
  print(A+B)
Problem p03778 (python)

Fixed submission:
W,a,b=map(int,input().split())
print(max(max(a,b)-W-min(a,b),0))

Buggy submission (verdict: Runtime Error):
W,a,b=map(int,input())
print(max(max(a,b)-W-min(a,b),0))
Problem p03796 (python)

Fixed submission:
n = int(input())
ans = 1

for i in range(1, n+1):
  ans *= i
  ans %= 10**9+7

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
l = np.arange(1,n+1)
print(np.pord(l)%(10**9+7))
Problem p03813 (python)

Fixed submission:
x=int(input())
 
if x<1200:
  print('ABC')
else:
  print('ARC')

Buggy submission (verdict: Runtime Error):
x=int(inptu())

if x<1200:
  print('ABC')
else:
  print('ARC')
Problem p03838 (python)

Fixed submission:
x,y = map(int, input().split())
ans = 0

if (x==0 and y>0) or (y==0 and x<0):
  ans = abs(abs(y)-abs(x))
elif (x==0 and y<0) or (y==0 and x>0):
  ans = abs(abs(y)-abs(x))+1
else:
  ans = abs(abs(y)-abs(x))
  if x>0 and y>0:
    if x>y:
      ans += 2
  elif x>0 and y<0:
    ans += 1
  elif x<0 and y>0:
    ans += 1
  elif x<0 and y<0:
    if x>y:
      ans += 2

print(ans)

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


if x < 0:
  abs_x = abs(x)
  count += 1

if y < 0:
  abs_y = abs(y)
  count += 1
count += abs_y - abs_x

if x == y:
  count = 0
print(count)
Problem p03845 (python)

Fixed submission:
N=int(input())
T=list(map(int,input().split()))
M=int(input())
ans=sum(T)
for i in range(M):
  P,X=map(int,input().split())
  print(ans-T[P-1]+X)

Buggy submission (verdict: Runtime Error):
N=int(input())
T=list(map(int,input().split()))
M=int(input())
ans=sum(T)
for i in range(len(M)):
  P,X=map(int,input().split())
  print(ans-T[P-1]+X)
Problem p04019 (python)

Fixed submission:
S=set(x for x in input())
if len(S)==4:
  print('Yes')
elif len(S)==2:
  if 'W' in S and 'E' in S:
    print('Yes')
  elif 'N' in S and 'S' in S:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S=set(x for x in input())
if len(S)==4:
  print('Yes')
elif lens(S)==2:
  if 'W' in S and 'E' in S:
    print('Yes')
  elif 'N' in S and 'S' in S:
    print('Yes')
  else:
    print('No')
else:
  print('No')
Problem p02609 (python)

Fixed submission:
n = int(input())
x = input()
original_pop_cnt = x.count("1")

pop_cnt_add = original_pop_cnt + 1
pop_cnt_sub = original_pop_cnt - 1

n_after_once_popcount_add = 0
n_after_once_popcount_sub = 0

for i in range(n):
    n_after_once_popcount_add = (n_after_once_popcount_add * 2 + int(x[i])) % pop_cnt_add
    if pop_cnt_sub != 0:
        n_after_once_popcount_sub = (n_after_once_popcount_sub * 2 + int(x[i])) % pop_cnt_sub

pow_add = [1] * 250000
pow_sub = [1] * 250000
for i in range(1, n + 100):
    pow_add[i] = (pow_add[i-1]*2) % pop_cnt_add
    if pop_cnt_sub != 0:
        pow_sub[i] = (pow_sub[i-1]*2) % pop_cnt_sub

def f(nex):
    ans = 0
    num = nex
    while num != 0:
        num = num % bin(num).count("1")
        ans += 1
    return ans

for i in range(n-1, -1, -1):
    if x[n - 1 - i] == "0":
        nxt = n_after_once_popcount_add
        nxt = nxt + pow_add[i]
        nxt = nxt % pop_cnt_add
        print(f(nxt) + 1)
    if x[n - 1 - i] == "1":
        if pop_cnt_sub != 0:
            nxt = n_after_once_popcount_sub
            nxt = nxt - pow_sub[i]
            nxt = nxt % pop_cnt_sub
            print(f(nxt) + 1)
        else:
            print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = input()
original_pop_cnt = x.count("1")

pop_cnt_add = original_pop_cnt + 1
pop_cnt_sub = original_pop_cnt - 1

n_after_once_popcount_add = 0
n_after_once_popcount_sub = 0

for i in range(n):
    n_after_once_popcount_add = (n_after_once_popcount_add * 2 + int(x[i])) % pop_cnt_add
    n_after_once_popcount_sub = (n_after_once_popcount_sub * 2 + int(x[i])) % pop_cnt_sub

pow_add = [1] * (n + 100)
pow_sub = [1] * (n + 100)

for i in range(1, n + 100):
    pow_add[i] = (pow_add[i-1]*2) % pop_cnt_add
    pow_sub[i] = (pow_sub[i-1]*2) % pop_cnt_sub

def f(nex):
    ans = 0
    num = nex
    while num != 0:
        num = num % bin(num).count("1")
        ans += 1
    return ans

for i in range(n-1, -1, -1):
    if x[n - 1 - i] == "0":
        nxt = n_after_once_popcount_add
        nxt = nxt + pow_add[i]
        nxt = nxt % pop_cnt_add
        print(f(nxt) + 1)
    if x[n - 1 - i] == "1":
        if pop_cnt_sub != 0:
            nxt = n_after_once_popcount_sub
            nxt = nxt - pow_sub[i]
            nxt = nxt % pop_cnt_sub
            print(f(nxt) + 1)
        else:
            print(0)
Problem p02715 (python)

Fixed submission:
n,k = map(int,input().split())
gcds = []


def power_func(a,n,p):
    bi=str(format(n,"b"))#2進表現に
    res=1
    for i in range(len(bi)):
        res=(res*res) %p
        if bi[i]=="1":
            res=(res*a) %p
    return res

mod = 10**9+7
for i in range(k):
    div = k//(k-i)
    count = power_func(div,n, mod)
    for j in range(1,div):
        count = count - gcds[k-((k-i)*(j+1))]
    gcds.append(count)

total = 0

for i in range(k):
    total = (total + (gcds[i]*(k-i)%mod))%mod
print(total)

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

remain = [[0,0,0]]
for i in range(n):
    r, g, b = remain[-1]
    if s[-i-1] == "R":
        r = r+1
    elif s[-i-1] == "G":
        g = g + 1
    elif s[-i-1] == "B":
        b = b + 1

    remain.append([r,g,b])

total = 0
for i in range(n-2):
    if s[i] == "R":
        for j in range(i+1, n):
            if s[j] == "G":
                total += remain[-j-1][2]
                if i+((j-i)*2) < n:
                    if s[i+((j-i)*2)]=="B":
                        total -= 1
            elif s[j] == "B":
                total += remain[-j-1][1]
                if i+((j-i)*2) < n:
                    if s[i+((j-i)*2)]=="G":
                        total -= 1
    elif s[i] == "G":
        for j in range(i+1, n):
            if s[j] == "B":
                total += remain[-j-1][0]
                if i+((j-i)*2) < n:
                    if s[i+((j-i)*2)]=="R":
                        total -= 1
            elif s[j] == "R":
                total += remain[-j-1][2]
                if i+((j-i)*2) < n:
                    if s[i+((j-i)*2)]=="B":
                        total -= 1
    elif s[i] == "B":
        for j in range(i+1, n):

            if s[j] == "R":
                total += remain[-j-1][1]
                if i+((j-i)*2) < n:
                    if s[i+((j-i)*2)]=="G":
                        total -= 1
            elif s[j] == "G":
                total += remain[-j-1][0]
                if i+((j-i)*2) < n:
                    if s[i+((j-i)*2)]=="R":
                        total -= 1
print(total)
Problem p02969 (python)

Fixed submission:
r = int(input())


print(3*r**2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int,input().split()))
b_list = [0]*(n-n//2)+a_list[(n-n//2):]

for i in range(n//2+1):
    k = int(n//2-i-1)
    if a_list[k] != sum(b_list[k::k+1])%2:
        b_list[k] = 1

b_list = [i+1 for i,x in enumerate(b_list) if x ==1]
x = len(b_list)
print(x)
if x != 0:
    print(*b_list)
Problem p02983 (python)

Fixed submission:
l, r = map(int,input().split())

lmod=l%2019
rmod=r%2019

if r-l>=2019:
    mini = 0
elif l <= 2019*(r//2019):
    mini = 0
else:
    mini = 10**9
    for i in range(lmod,rmod+1):
        for j in range(i+1,rmod+1):
            mini = min(mini,(i*j)%2019)
print(mini)

Buggy submission (verdict: Runtime Error):
l, r = map(int,input().split())

lmod=l%2019
rmod=r%2019

if r-l>=2019:
    print(0)
elif l <= 2019*(r//2019):
    print(0)
else:
    mini = 10**9
    for i in range(lmod,rmod+1):
        for j in range(i+1,rmod+1):
            mini = min(mini,(i*j)%2019)
print(mini)
Problem p02996 (python)

Fixed submission:
n = int(input())
lists = []
limit = []
cost = [0 for _ in range(n)]
for i in range(n):
    a, b = (map(int,input().split()))
    lists.append([a,b])

lists.sort(key = lambda x:x[1])
sum_ = 0
for i in range(n):
    sum_ = sum_ + lists[i][0]
    if sum_ <= lists[i][1]:
        continue
    else:
        print('No')
        exit(0)
print('Yes')

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
lists = []
limit = []
cost = []
for i in range(n):
    a, b = (map(int,input().split()))
    lists.append([a,b,True])


def dfs(que, sum_cost, in_list):
    if que == n:
        print('Yes')
        exit(0)
    for i in range(n):
        if lists[i][2]:
            sum_cost_out = sum_cost + lists[i][0]
            if sum_cost_out <= lists[i][1]:
                out_list = in_list[:]
                out_list[i][2] = False
                dfs(que+1,sum_cost_out,out_list)


dfs(0,0,lists)
print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
lists = []
limit = []
cost = []
for i in range(n):
    a, b = (map(int,input().split()))
    lists.append([a,b,True])

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

def dfs(que, sum_cost, in_list):
    if que == n:
        print('Yes')
        exit(0)
    for i in range(n):
        if lists[i][2]:
            sum_cost_out = sum_cost + lists[i][0]
            if sum_cost_out <= lists[i][1]:
                out_list = in_list[:]
                out_list[i][2] = False
                dfs(que+1,sum_cost_out,out_list)

dfs(0,0,lists)
print('No')
Problem p03029 (python)

Fixed submission:
A, B = map(int,input().split())
print((A*3+B)//2)

Buggy submission (verdict: Runtime Error):
A, B = map(int,input())
print((A*3+B)//2)
Problem p03061 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
gcd_list=[]
reverse_gcd_list = []


def gcd(x,y):
    if x<y:
        x,y=y,x
    #x>y
    if y==0:
        return x
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)

gcd_list.append(A[0])
reverse_gcd_list.append(A[-1])

for i in range(1,N):
    gcd_list.append(gcd(gcd_list[i-1], A[i]))
    # reverse_gcd_list.insert(0,gcd(reverse_gcd_list[0], A[-1-i]))
    reverse_gcd_list.append(gcd(reverse_gcd_list[-1], A[-1-i]))

reverse_gcd_list.reverse()
num = [gcd_list[-2], reverse_gcd_list[1]]
for i in range(N-2):
    num.append(gcd(gcd_list[i], reverse_gcd_list[i+2]))

print(max(num))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
gcd_list=[]
reverse_gcd_list = []


def gcd(x,y):
    if x<y:
        x,y=y,x
    #x>y
    if y==0:
        return x
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)

gcd_list.append(A[0])
reverse_gcd_list.append(A[-1])

for i in range(1,N):
    gcd_list.append(gcd(gcd_list[i-1], A[i]))
    reverse_gcd_list.insert(0,gcd(reverse_gcd_list[0], A[-1-i]))

num = [gcd_list[-2], reverse_gcd_list[1]]
for i in range(N-2):
    num = num.append(gcd(gcd_list[i], reverse_gcd_list[i+2]))

print(max(num))

Buggy submission (verdict: Runtime Error):
import functools
import math

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

num = 1

for i in range(N):
    B = A[:]
    B.pop(i)

    gcd = functools.reduce(math.gcd, B)
    if num < gcd:
        num = gcd

print(num)

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

import functools
import math
num = 1

for i in range(N):
    B = A[:]
    B.pop(i)

    gcd = functools.reduce(math.gcd, B)
    if num < gcd:
        num = gcd

print(num)
Problem p03085 (python)

Fixed submission:
chara = input()
if chara == 'A':
  print('T')
elif chara == 'T':
  print('A')
elif chara == 'C':
  print('G')
elif chara == 'G':
  print('C')

Buggy submission (verdict: Runtime Error):
char = input()
if chara == 'A':
  print('T')
elif chara == 'T':
  print('A')
elif chara == 'C':
  print('G')
elif chara == 'G':
  print('C')
Problem p03220 (python)

Fixed submission:
N = int(input())
T, A = input().split()
T = int(T)
A = int(A)
H = [int(i) for i in input().split()]

n = 0
for i in range(N):
    if abs(A - (T - H[i] * 0.006)) < abs(A - (T - H[n] * 0.006)):
       n = i

print(n + 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
T, A = input().split()
T = int(T)
A = int(A)
H = [int(i) for i in input().split()]

n = 0
for i in range(N):
    if abs(A - (T - H[i] * 0.006) > abs(A - (T - H[n] * 0.006):
       n = i

print(n + 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input().split())
H = [int(i) for i in input().split()]

n = 0
for i in range(N):
    if abs(A - (T - H[i] * 0.006) > abs(A - (T - H[n] * 0.006):
       n = i

print(n + 1)

Buggy submission (verdict: Runtime Error):
N = input()
T, A = map(int, input().split())
H = [int(i) for i in input().split()]

n = 0
for i in range(N):
    if abs(A - (T - H[i] * 0.006) > abs(A - (T - H[n] * 0.006):
       n = i

print(n + 1)
Problem p02537 (python)

Fixed submission:
N,k=map(int,input().split())
n=3*10**5+10
#####segfunc######
def segfunc(x,y):
    return max(x,y)

def init(init_val):
    #set_val
    for i in range(n):
        seg[i+num-1]=init_val[i]    
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res

#####単位元######
ide_ele = 0

#num:n以上の最小の2のべき乗
num =2**(n-1).bit_length()
seg=[ide_ele]*2*num


for i in range(N):
  x=int(input())
  update(x,query(max(0,x-k),min(n,x+k+1))+1)
print(seg[0])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
#####segfunc######
def segfunc(x,y):
    return max(x,y)

def init(init_val):
    #set_val
    for i in range(n):
        seg[i+num-1]=init_val[i]    
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res

#####単位元######
ide_ele = 0

#num:n以上の最小の2のべき乗
num =2**(n-1).bit_length()
seg=[ide_ele]*2*num


for i in range(n):
  x=int(input())-1
  update(x,query(max(0,x-k),min(n,x+k+1))+1)
print(seg[0])