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

Fixed submission:
def gcd(m,n):
    x=max(m,n)
    y=min(m,n)
    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z


N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])
z_list=list(set(y_list))
if len(z_list)==1:
    print(z_list[0])

else:
    for i in range(len(z_list)-1):
        z_list[i+1]=gcd(z_list[i],z_list[i+1])
    print(z_list[-1])

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

N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])
z_list=list(set(y_list))
gcd = functools.reduce(math.gcd, z_list)
print(gcd)

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

N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])


gcd = functools.reduce(math.gcd, y_list)
print(gcd)

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

N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])
z_list=list(set(y_list))
if len(z_list)==1:
    print(z_list[0])
else:
    gcd = functools.reduce(math.gcd, z_list)
    print(gcd)

Buggy submission (verdict: Runtime Error):

import math
N,X=map(int,input().split())
x_list=list(map(int,input().split()))
x_list.append(X)
x_list.sort()
y_list=[]
for i in range(N):
    y_list.append(x_list[i+1]-x_list[i])
z_list=list(set(y_list))


if len(z_list)==1:
    print(z_list[0])
else:
    out=math.gcd(z_list[0], z_list[1])
    if len(z_list)>=3:
        for i in range(len(z_list)-3):
            out=math.gcd(out, z_list[i+2])
    print(out)
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=xprint((a-1)*(b-1))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
print((a-1)*(b-1))
Problem p03281 (python)

Fixed submission:
N=int(input())
count=0
if N>=195:
    print(5)
elif N>=189:
    print(4)
elif N>=165:
    print(3)
elif N>=135:
    print(2)
elif N>=105:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import sympy

N=int(input())
count=0
if N==195:
    print(5)
elif N==189:
    print(4)
elif N==165:
    print(3)
elif N==135:
    print(2)
elif N==105:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import sympy

N=int(input())
count=0
for i in range(N):
    if sympy.divisor_count(i+1)==8 and (i+1)%2==1:
        count+=1
    else:
        continue

print(count)

Buggy submission (verdict: Runtime Error):
import sympy

N=int(input())
count=0
for i in range(N):
    if sympy.divisor_count(i+1)==8 and (i+1)%2==1:
        count+=1

print(count)

Buggy submission (verdict: Runtime Error):
import sympy

N=int(input())
count=0
for i in range(N):
    if sympy.divisor_count(i+1)==8 and (i+1)%2==1:
        count+=1
input(count)
Problem p04001 (python)

Fixed submission:
s = input()
n = len(s) - 1
ans = 0
for bit in range(1 << n):
    now = 0
    for i in range(bit):
        if bit & (1 << i):
            ans += int(s[now : i + 1])
            now = i + 1
    ans += int(s[now : len(s)])
print(ans)

Buggy submission (verdict: Runtime Error):
// https://atcoder.jp/contests/arc061/tasks/arc061_a
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string S;
  cin >> S;

  ll ans = 0;
  int m = S.size() - 1;

  rep(bit, 1 << m) {
    ll cur = S[0] - '0';
    rep(i, m) {
      if (bit & (1 << i)) {
        ans += cur;
        cur = 0;
      }
      cur = cur * 10 + S[i + 1] - '0';
    }
    ans += cur;
  }
  cout << ans << endl;
  return 0;
}
Problem p02731 (python)

Fixed submission:
L = int(input())

ans = (L/3)**3
print(ans)

Buggy submission (verdict: Runtime Error):
L = int(input().split())

ans = (L/3)**3
print(ans)
Problem p02830 (python)

Fixed submission:
N = int(input())
S, T = input().split()
ans = ""
for i in range(N):
  ans = ans + S[i:i+1] + T[i:i+1]
  
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(nput())
S, T = input().split()
ans = ""
for i in range(N):
  ans = ans + S[i:i+1] + T[i:i+1]
  
print(ans)
Problem p02848 (python)

Fixed submission:
N = int(input())
S = input()

ANS = ""

for MOJI in S:
  i = ord(MOJI) + N
  if i > 90:
    i = i - 26
  ANS = ANS + chr(i)

print(ANS)

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

ANS = ""

for MOJI in S:
  i = ord(MOJI) + N
  if i > 90:
    i = i - 26
  ANS.append(chr(i))
Problem p02952 (python)

Fixed submission:
N = int(input())

# 1 <= N <= 10**5 = 100,000

if N <= 99:
  print(min(N, 9))
elif N <= 9999:
  ans = 9 + (min(N, 999) - 99)
  print(ans)
else:
  ans = 9 + 900 + (min(N, 99999) - 9999)
  print(ans)

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

# 1 <= N <= 10**5 = 100,000

if N <= 9:
  print(N)
elif N <= 999:
  ans = 9 + (N - 99)
  print(ans)
elif N <= 99999:
  ans = 9 + 900 + (N - 9999)
  print(ans)
else:
  print(90909
Problem p02993 (python)

Fixed submission:
S = input()

s = list(S)

if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print("Bad")
else:
  print("Good")

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

s = list(S)

if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print("Bad")
else:
  print("Good")

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

if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print("Bad")
else:
  print("Good")
Problem p03037 (python)

Fixed submission:
N, M = map(int, input().split())

L = []
R = []
for i in range(M):
  a, b = map(int, input().split())
  L.append(a)
  R.append(b)

minmin = max(L)
maxmax = min(R)

ans = maxmax - minmin + 1
if ans < 0:
  ans = 0
print(ans)

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

L = []
R = []
for i in range(M):
  a, b = map(int, input().split())
  L.append(a)
  R.append(b)

min = min(L)
max = max(R)

ans = max(0, max - min + 1)
print(ans)
Problem p02658 (python)

Fixed submission:
 
N = int(input())
A_list = list(map(int, input().split()))

ans = 1
if 0 in A_list:
    ans = 0
else:
    for l in A_list:

        if ans > (10**18):
            ans = -1
            break
        else:
            ans *= l

if ans > (10**18):
    ans = -1
print(ans)

Buggy submission (verdict: Runtime Error):
def multi(L):
  ans = 0
  for l in L:
  	if ans <=10**18:
      ans *= l
    else:
      ans = -1
      break
      
   return ans

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

print(multi(A_list))
Problem p02684 (python)

Fixed submission:
N, K = map(int, input().split())
A_list = [-1] + list(map(int, input().split()))
out_loop = [1]
flag = [0, 1] + [0]* (N - 1)
a = A_list[1]
while flag[a] == 0:
    out_loop.append(a)
    flag[a] = 1
    a = A_list[a]
    

        
if K <= (len(out_loop) - 1):
    print(out_loop[K])
else:
    loop = out_loop[out_loop.index(a):]
    k = K - (len(out_loop) - 1)
    k %= len(loop)
    print(loop[k - 1])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A_list = list(map(int, input().split()))
out_loop = [1]
flag = [0, 1] + [0]* (N - 1)

for a in A_list:
    if flag[a] == 0:
        out_loop.append(a)
    else:
        loop = out_loop[out_loop.index(a):]
        
if K <= (len(out_loop) - 1):
    print(out_loop[K])
else:
    k = K - len(out_loop) - 1
    k %= len(loop)
    print(loop[k - 1])
Problem p02760 (python)

Fixed submission:
A_list1 = list(map(int, input().split()))
A_list2 = list(map(int, input().split()))
A_list3 = list(map(int, input().split()))

bingo = [A_list1, A_list2, A_list3, [A_list1[0], A_list2[1], A_list3[2]], [A_list1[2], A_list2[1], A_list3[0]], [A_list1[0], A_list2[0], A_list3[0]], [A_list1[1], A_list2[1], A_list3[1]], [A_list1[2], A_list2[2], A_list3[2]]]

N = int(input())

b_list = [int(input()) for _ in range(N)]

ans = "No"
for b in bingo:
    c = 0
    for B in b:
        if B in b_list:
            c += 1
    if c == 3:
        ans = "Yes"
        break

print(ans)

Buggy submission (verdict: Runtime Error):
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
d = [[0]*3]*3
for i in range(3):
  for j in range(3):
    b = int(input())
    if A[i][j] == b:
      d[i][j] = 1

ans = "No"

for i in range(3):
  if sum(d[i]) == 3:
    ans = "Yes"
    break
  if sum([D[i] for D in d]) == 3:
    ans = "Yes"
    break
if sum([d[i][i] for i in range(3)]) == 3:
  ans = "Yes"

if sum([d[i][2 - i] for i in range(3)]) == 3:
  ans = "Yes"
  
print(ans)
Problem p02796 (python)

Fixed submission:
N = int(input())
MAX_list = []
ans = 0
A = -10**9-2

for _ in range(N):
    X, L = map(int, input().split())
    MAX_list.append(((X + L), (X - L)))
MAX_list = sorted(MAX_list)

for m, l in MAX_list:
    if l >= A:
        ans += 1
        A = m

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
MAX_list = []
ans = 0
A = -10**9

for _ in range(N):
    X, L = map(int, input().split())
    MAX_list.append((X + L - 1), (X - L + 1))
MAX_list = sorted(MAX_list)

for m, l in MAX_list:
    if l > A:
        ans += 1
        A = m

print(ans)
Problem p02797 (python)

Fixed submission:
N, K, S = map(int, input().split())

ans = [S]*K
if S == 10**9:
    #最大値の時に制限の値を超えないように
    ans += [1]*(N - K)   
else:
    ans += [S+1]*(N - K)
ans = list(map(str, ans))

print(" ".join(ans))

Buggy submission (verdict: Runtime Error):
N, K, S = map(int, input())

ans = [S]*K
ans += [S+1]*(N - K)

print(ans)
Problem p02927 (python)

Fixed submission:
M, D = map(int, input().split())
m_list = {m for m in range(1, M + 1)}
ans = 0
 
for d in range(11, D+1):
  d_10 = int(d/10)
  d_1 = d - (d_10 * 10)
  if (d_10 < 2) or (d_1 < 2):
    continue
  else:
    if (d_10 * d_1) in m_list:
      ans += 1
      
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
count = 0
ans = 1
m = 10**9 + 7
 
for i in range(N):
  if S[2*i] == "W":
    ans = (ans * ((2*i) - (count*2)))%m
    count += 1
  if S[2*i + 1] == "B":
    ans = (ans * ((2*i + 1) - (count*2)))%m
    count += 1
 
if count != N:
  print(0)
else:
  for o in range(1, N+1):
    ans *= o
    ans %= m
  print(ans % m)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
count = 0
ans = 1
m = 10**9 + 7
 
for i in range(N):
  if S[2*i] == "W":
    ans = ans * ((2*i) - (count*2))%m
    count += 1
  if S[2*i + 1] == "B":
    ans = ans * ((2*i + 1) - (count*2))%m
    count += 1
 
if count != N:
  print(0)
else:
  for o in range(1, N+1):
    ans *= o
    ans %= m
  print(ans % m)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
count = 0
ans = 1
m = 10**9 + 7
 
for i in range(N):
  if S[2*i] == "W":
    ans *= ((2*i) - (count*2))%m
    count += 1
  if S[2*i + 1] == "B":
    ans *= ((2*i + 1) - (count*2))%m
    count += 1
 
if count != N:
  print(0)
else:
  for o in range(1, N+1):
    ans *= o
    ans %= m
  print(ans % m)

Buggy submission (verdict: Runtime Error):
M, D = map(int, input().split())
m_list = {m for m in range(1, M + 1)}
ans = 0

for d in range(11, D+1):
  d_10 = int(d/10)
  d_1 = d - (d_10 * 10)
  if (d_10 < 2) or (d_1 < 2):
    continue
  elif:
    if (d_10 * d_1) in m_list:
      ans += 1
      
print(ans)
Problem p02928 (python)

Fixed submission:
def tasu(a):
  out = (a*(a-1))//2 + a
  return out%(10**9 + 7)
    
  
N, K = map(int, input().split())
A_list = list(map(int, input().split()))
count = 0
count1 = 0

for i in range(N):
  for j in range(N):
    if i == j:
      continue
    elif (i<j) & (A_list[i] > A_list[j]):
      count += 1
    elif (i>j) & (A_list[i] > A_list[j]):
      count1 += 1

ans = (tasu(K) * count) + (tasu(K-1) * count1) 
print(ans%(10**9 + 7))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A_list = list(map(int, input().split()))
same = 0
diff = 0

for i in range(N):
  for j in range(N):
    if N[i] > N[j]:
      if i < j:
        same += 1
        diff += 1
      elif i>j:
        diff += 1

ans = (same*K) + (diff*((K * (K-1))//2))
print(ans%(10**9 + 7))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

def tasu(a):
  if a == 1:
    return 1
  else:
    return a + tasu(a-1)
  
N, K = map(int, input().split())
A_list = list(map(int, input().split()))
count = 0

for i in range(N):
  for j in range(N):
    if i == j:
      continue
    elif (i<j) & (A_list[i] > A_list[j]):
      count += tasu(K)
    elif (i>j) & (A_list[i] > A_list[j]):
      count += tasu(K - 1)
print(count%(10**9 + 7))
Problem p02929 (python)

Fixed submission:
N = int(input())
S = input()
count = 0
ans = 1
m = 10**9 + 7
 
for i in range(N):
  if S[2*i] == "W":
    ans = ans * ((2*i) - (count*2))%m
    count += 1
  if S[2*i + 1] == "B":
    ans = ans * ((2*i + 1) - (count*2))%m
    count += 1
 
if count != N:
  print(0)
else:
  for o in range(1, N+1):
    ans *= o
    ans %= m
  print(ans % m)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
count = 0
ans = 1
m = 10**9 + 7
 
for i in range(N):
  if s[2*i] == "W":
    ans *= (i - (count*2))
    count += 1
  if s[2*i + 1] == "B":
    ans *= (i - (count*2))
    count += 1
if count != N:
  print(0)
else:
  for o in range(1, N+1):
    ans *= o
    ans %= m
  print(ans %= m)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
count = 0
ans = 1
m = 10**9 + 7
 
for i, s in enumerate(S):
  if ((s == "W") & (i%2 == 0)) or ((s == "B") & (i%2 == 1)):
    ans *= (i - (count*2))
    count += 1
if count != N:
  print(0)
else:
  for o in range(1, N+1):
    ans *= o
    ans %= m
  print(ans %= m)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit((10 ** 5) * 2)
 
def kai(a):
  if a == 1:
    return 1
  else:
    return a*kai(a-1)
  
N = int(input())
S = input()
count = 0
ans = 1
 
for i, s in enumerate(S):
  if ((s == "W") & (i%2 == 0)) or ((s == "B") & (i%2 == 1)):
    ans *= (i - (count*2))
    count += 1

other = N - count
if other != 0:
  ans *= (kai(other*2)//(2**other))
 
print((ans*kai(N))%(10**9 + 7))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit((10 ** 5) * 2)
 
def kai(a):
  if a == 1:
    return 1
  else:
    return a*kai(a-1)
  
N = int(input())
S = input()
count = 0
ans = 1
 
for i, s in enumerate(S):
  if ((s == "W") & (i%2 == 0)) or ((s == "B") & (i%2 == 1)):
    ans *= (i - (count*2))
    count += 1

other = N - count
if other != 0:
  ans *= (kai(other*2)//(2**other))
 
print(kai(ans)%(10**9 + 7))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit((10 ** 5) * 2)

def kai(a):
  if a == 1:
    return 1
  else:
    return a*kai(a-1)
  
N = int(input())
S = input()
count = 0
ans = 1

for i, s in enumerate(S):
  if ((s == "W") & (i%2 == 0)) or ((s == "B") & (i%2 == 1)):
    ans *= (i - (count*2))
    count += 1

other = N - count
ans *= (kai(other*2)//(2**other))

print(kai(ans)%(10**9 + 7))
Problem p02972 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
for i in range(N//2+1, 0, -1):
  sum = 0
  for o in range(1, (N//i)+1):
    sum += A[i*o-1]
  A[i-1] = sum%2
  
print(A.count(1))
ans = [str(q) for q,w in zip(range(1, N+1), A) if w == 1]
print(" ".join(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
for i in range(N//2, -1, -1):
  sum = 0
  for o in range(1, (N//o)+1):
    sum += A[i*o-1]
  A[i] = sum%2
  
print(A.count(1))
ans = [str(q) for q,w in zip(range(N), A) if w == 1]
print(" ".join(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A_0 = A[0]
for i in range(N, 0, -1):
    ans = A[i-1]
    for o in range(1, int(i ** 0.5) + 1):
        if i%o == 0:
            A[o-1]  = (A[o-1] + ans)//2
            if o != i//o:
                A[(i//o) - 1] = (A[(i//o) - 1] + ans)//2
if ans[0] != A_0:
    print(-1)
else:
    print(ans.count(1))
    [print(q) for q, w in zip(range(1, N+1), ans) if w == 1]

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A_0 = A[0]
for i in range(N, 0, -1):
    ans = A[i-1]
    for o in range(1, int(i ** 0.5) + 1):
        if i%o == 0:
            A[o-1]  = (A[o-1] + ans)//2
            if o != i//o:
                A[(i//o) - 1] = (A[(i//o) - 1] + ans)//2
 
if ans[0] != A_0:
    print(-1)
else:
    print(ans.count(1))
    [print(q) for q, w in zip(range(1, N+1), ans) if w == 1]
Problem p02981 (python)

Fixed submission:
N, A, B = map(int, input().split())
print(min(A*N, B))

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input.split())
print(min(A*N, B))
Problem p02996 (python)

Fixed submission:

N = int(input())
count = 0
D = 0
task = [list(map(int, input().split())) for _ in range(N)]
task = sorted(task, key = lambda x:x[1])
for i in range(N):
  count += task[i][0]
  if count > task[i][1]:
    print("No")
    D = 1
    break
if D== 0:
  print("Yes")

Buggy submission (verdict: Runtime Error):
ソースコード 

Copy
Copy
N = int(input())
count = 0
D = 0
task = [list(map(int, input().split())) for _ in range(N)]
task = sorted(task, key = lambda x:x[1])

for i in range(N):
  count += task[i][0]
  if count > task[i][1]:
    print("No")
    D = 1
    break
if D== 0:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
A_list = []
B_list = []
count = 0
D = 0
for i in range(N):
  A,B = map(int, input().split())
  A_list.append(A)
  B_list.append(B)
c = zip(A, B)
c.sort(key = itemgetter(1))
A, B = zip(*c)
for o in range(N):
  count += A[i]
  if count > B[i]:
    print("No")
    D = 1
    break
if D== 0:
  print("Yes")
Problem p03029 (python)

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

Buggy submission (verdict: Runtime Error):
A, P = map(int, input().split())
print((A*3 + p)//2)
Problem p03035 (python)

Fixed submission:
A, B = map(int, input().split())
if A>=13:
  print(B)
elif 6<=A<=12:
  print(B//2)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input.split())
if A>=13:
  print(B)
elif 6<=A<=12:
  print(B//2)
else:
  print(0)
Problem p03076 (python)

Fixed submission:
B = [int(input()) for _ in range(5)]
A = [10-int(str(B[i])[-1]) for i in range(5) if str(B[i])[-1] != "0"]
if len(A) != 0:
	A.remove(max(A))
print(sum(B)+sum(A))

Buggy submission (verdict: Runtime Error):
B = [int(input()) for _ in range(5)]
A = [10-int(str(B[i])[-1]) for i in range(5) if str(B[i])[-1] != "0"]
A.remove(max(A))
print(sum(B)+sum(A))

Buggy submission (verdict: Runtime Error):
B = [int(input()) for _ in range(5)]
A = [str(B[i])[-1] for i in range(5)]
temp = A
last = A.index(min(temp.remove("0")))
diff = [10-int(A[o]) for o in range(5) if (A[o] != "0") and o != last]
print(sum(B)+sum(diff))
Problem p03085 (python)

Fixed submission:
star = {"A":"T",
        "T":"A",
        "C":"G",
        "G":"C"}
print(star[input()])

Buggy submission (verdict: Runtime Error):
import sys
N,Q = map(int,sys.stdin.readline().rstrip().split())
S = sys.stdin.readline().rstrip()
for _ in range(Q):
  l,r  = map(int,sys.stdin.readline().rstrip().split())
  print(S[l-1:r].count("AC"))
  del l
  del r
Problem p03105 (python)

Fixed submission:
A, B, C = map(int,input().split())
print(min(B//A,C))

Buggy submission (verdict: Runtime Error):
A, B, C = map(int(),input().split())
print(min(B//A,C))
Problem p03106 (python)

Fixed submission:
def gcd(a,b):
  return [i for i in range(1,min(a,b)+1) if a%i == 0 and b%i == 0]
   
A, B, K = map(int, input().split())
ans = gcd(A,B)
print(ans[-1*K])

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  return [i for i in range(1,min(a,b)+1) if a%i == 0 and b%i == 0]
   
A, B, K = map(int, input().split())
ans = gcd(A,B)
print(ans[K+1])
Problem p02646 (python)

Fixed submission:
import sys

A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if V <= W:
  print('NO')
  sys.exit()
if 0 < abs((B-A))/(V-W) <= T:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
import sys

A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if V <= W:
  print('NO')
  sys.exit()
if 0 < abs((B-A)//(V-W)) <= T:
  print('YES')import sys

A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if V <= W:
  print('NO')
  sys.exit()
t= abs(B-A)%(V-W)
if 0 < abs((B-A)//(V-W)) <= T:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
import sys

A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if V == W:
  print('NO')
  sys.exit()
t= (B-A)%(V-W)
if t == 0 abs(B-A)//(V-W) <= T::
  print('YES')
else:
  print('NO')
Problem p02702 (python)

Fixed submission:
S = input()

p = 2019
N = len(S)
t = [0]*(N+1)
for i in range(N-1,-1,-1):
  k = (int(S[i]) * pow(10,N-i-1,p))%p
  t[i] = (t[i+1]+k)%p
t= t[:N]
cnt = [0]*p
for i in range(N):
  cnt[t[i]]+=1
ans = 0
for i in range(p):
  m = cnt[i]
  if i == 0 and m > 0:
    ans +=  (m*(m+1))//2
  else:
    ans += (m*(m-1))//2
print(ans)

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

p = 2019
N = len(S)
t = [0]*(N+1)
for i in range(N-1,-1,-1):
  k = (int(S[i]) * pow(10,N-i-1,p))%p
  t[i] = (t[i+1]+k)%p
t= t[:N]
cnt = [0]*p
for i in range(N):
  cnt[t[i]]+=1 
ans = cnt[0]
for i in rxange(1,p):
  m = cnt[i]
  ans += (m*(m-1))//2
print(ans)
Problem p02742 (python)

Fixed submission:
h,w = (int(x) for x in input().split())


num  = 1
if h != 1 and w != 1:
    num = ((w // 2) + (w % 2))*( (h // 2) + ( h% 2) ) + ((w // 2) + (w % 2)-(w%2))*( (h // 2) + (h%2) -(h%2)) 
print(num)

Buggy submission (verdict: Runtime Error):
h,w = (int(x) for x in input().split())



if h != 1 and w != 1:
    num = ((w // 2) + (w % 2))*( (h // 2) + ( h% 2) ) + ((w // 2) + (w % 2)-(w%2))*( (h // 2) + (h%2) -(h%2)) 
print(num)
Problem p02756 (python)

Fixed submission:
from collections import deque

s = input()
d = deque()
header = 1
for i in s:
    d.append(i)
q = int(input())
for i in range(q):
        data = input().split()
        if len(data) == 1 :
            header *= -1
        else:
            f = int(data[1])
            c = data[2]
            if header == 1:
                if f == 1:
                    d.appendleft(c)
                else:
                    d.append(c)
            else:
                if f == 1:
                    d.append(c)
                else:
                    d.appendleft(c)
                
if header == -1:
    d.reverse()

s = list(d)
s = "".join(s)



print(s)

Buggy submission (verdict: Runtime Error):
from collections import deque

s = input()
d = deque()
for i in s:
    d.append(i)
q = int(input())
for i in range(q):
    data = input().split()
    if len(data) == 1:
      if len(d) != 1:
        tmp1 = d.pop()
        tmp2 = d.popleft()
        d.appendleft(tmp1)
        d.append(tmp2)
      else:
        f = int(data[1])
        c = data[2]
        if f == 1:
          d.appendleft(c)
        else:
          d.append(c)
            
s = list(d)
s = "".join(s)
print(s)
Problem p02784 (python)

Fixed submission:
H,N = (int(x) for x in input().split())
a = list(map(int,input().split()))

if sum(a) >= H:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
H,N = (int(x) for x in input().split())
a = list(map(int,input(),split()))

if sum(a) >= H:
  print('Yes')
else:
  print('No')
Problem p02818 (python)

Fixed submission:
A,B,K = (int(x) for x in input().split())

if A > K:
  print(A-K,B)
  
elif A+B>K:
  print(0,B-K+A)
else:
  print(0,0)

Buggy submission (verdict: Runtime Error):
A,B,K = (int(x) for x in input().split())

if A > K:
  print(A-K+B)
  
elif A+B>K
  print(B-K-A)
else:
  print(0)
Problem p02848 (python)

Fixed submission:
N = int(input())
S = list(input())

for i in range(len(S)):
  S[i] = chr(65+(ord(S[i])-65+N)%26)

    
print("".join(map(str,S)))

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

for i in range(len(S)):
  S[i] = chr(65+(ord(S[i])-64)%(26-N))

    
print("".join(map(str,S)))