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

Fixed submission:
from sys import stdin

ntree = []
ans = []


n, q = [int(x) for x in stdin.readline().rstrip().split()]

for i in range(n):
    ntree.append([])
    ans.append(0)

for i in range(n-1):
  a, b = [int(x) for x in stdin.readline().rstrip().split()]
  ntree[a-1].append(b)

for i in range(q):
  p, x = [int(x) for x in stdin.readline().rstrip().split()]
  ans[p-1] += x

for i in range(n):
    for j in range(len(ntree[i])):
       ans[ntree[i][j]-1] += ans[i]

print(' '.join([str(n) for n in ans]))

Buggy submission (verdict: Runtime Error):
from sys import stdin

ntree = []
ans = []


def culceach(n, sum):
    ans[n-1] += sum
    for i in range(len(ntree[n-1])):
        culceach(ntree[n-1][i], ans[n-1])

def addnum(p, x):
    ans[p-1] += x

#    for i in range(len(ntree[p-1])):
#        addnum(ntree[p-1][i], x)

n, q = [int(x) for x in stdin.readline().rstrip().split()]

for i in range(n):
    ntree.append([])
    ans.append(0)

for i in range(n-1):
  a, b = [int(x) for x in stdin.readline().rstrip().split()]
  ntree[a-1].append(b)

for i in range(q):
  p, x = [int(x) for x in stdin.readline().rstrip().split()]
  addnum(p,x)

culceach(1, 0)

print(' '.join([str(n) for n in ans]))

Buggy submission (verdict: Runtime Error):
from sys import stdin

ntree = []
ans = []


def addnum(p, x):
    ans[p-1] += x
    for i in range(len(ntree[p-1])):
        addnum(ntree[p-1][i], x)

n, q = [int(x) for x in stdin.readline().rstrip().split()]

for i in range(n):
    ntree.append([])
    ans.append(0)

for i in range(n-1):
  a, b = [int(x) for x in stdin.readline().rstrip().split()]
  ntree[a-1].append(b)


for i in range(q):
  p, x = [int(x) for x in stdin.readline().rstrip().split()]
  addnum(p,x)

print(' '.join([str(n) for n in ans]))
Problem p03049 (python)

Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
ans=0
ba=0
bx=0
xa=0
for i in range(n):
  s = stdin.readline().rstrip()
  for j in range(len(s)-1):
    if s[j] == 'A' and s[j+1] == 'B':
      ans +=1
  if( s[0] == 'B' and s[-1] == 'A' ):
    ba +=1
  elif s[0] == 'B':
    bx +=1
  elif s[-1] == 'A':
    xa +=1

ans += min(xa,bx)
if ba>0:
  ans += (ba-1)
  if (xa+bx)!=0:
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin
n = int(stdin.readline().rstrip())
ans=0
ba=0
bx=0
xa=0
for i in range(n):
  s = stdin.readline().rstrip()
  for j in range(len(s)-1):
    if s[j] == 'A' and s[j+1] == 'B':
      ans +=1
  if( s[0] == 'B' and s[-1] == 'A' ):
    ba +=1
  elif s[0] == 'B':
    bx +=1
  elif s[-1] == 'A':
    xa +=1

ans += min(xa,bx)
if ba>0:
  ans += (ba-1)
  if and xa!=0 and xa!=bx:
    ans += 1

print(ans)
Problem p03061 (python)

Fixed submission:
from sys import stdin

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

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))

left = []
right = []

for i in range(n):
  if(i==0):
    before = an[i]
  else:
    before = gcd(before, an[i])
  left.append(before)

for i in range(n):
  if(i==0):
    before = an[n-1-i]
  else:
    before = gcd(before, an[n-1-i])
  right.append(before)

max = 0
for i in range(n):
  if(i==0):
    before = right[n-2];
  elif(i==(n-1)):
    before = left[n-2];
  else:
    before = gcd(left[i-1],right[n-2-i])
  if(max < before ):
    max = before

print(max)

Buggy submission (verdict: Runtime Error):
from sys import stdin

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

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))

left = []
right = []

for i in range(n):
  if(i==0):
    before = an[i]
  else:
    before = gcd(before, an[i])
  left.append(before)

for i in range(n):
  if(i==0):
    before = an[n-1-i]
  else:
    before = gcd(before, an[n-1-i])
  right.append(before)

max = 0
for i in range(n):
  if(i==0):
    before = right[n-2];
  elif(i==(n-1)):
    before = left[n-2];
  else:
    before = gcd(left[i-1],right[n-2-i])
  max = max(before,max)

print(max)
Problem p03062 (python)

Fixed submission:
from sys import stdin

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))

m = []
p = []
z = 0

for i in range(n):
  if(an[i]<0):
    m.append(an[i])
  if(an[i]>0):
    p.append(an[i])
  if(an[i]==0):
    z=1

if ( z==1 ):
  ans = sum(p) - sum(m)
elif ( len(m) == 0):
    ans = sum(p)
else:
  if ( len(p) == 0):
    if ( len(m)%2 == 0):
      ans = - sum(m)
    else:
        minm = -max(m)
        ans = -sum(m) - (minm*2)
  else:
    if ( len(m)%2 == 0):
      ans = sum(p) - sum(m)
    else:
      minm = 0
      if ( min(p) < (-max(m)) ):
        minm = min(p)
      else:
        minm = -max(m)
      ans  = sum(p) - sum(m) - (minm*2)

print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))

m = []
p = []
z = 0

for i in range(n):
  if(an[i]<0):
    m.append(an[i])
  if(an[i]>0):
    p.append(an[i])
  if(an[i]==0):
    z=1

if ( z==1 ):
  ans = sum(p) - sum(m)
else:
  if ( len(m) == 0):
    ans = sum(p)
  else:
    if ( len(m)%2 == 0):
      ans = sum(p) - sum(m)
    else:
      minm = 0
      if ( min(p) < (-max(m)) ):
        minm = min(p)
      else:
        minm = -max(m)
      ans  = sum(p) - sum(m) - (minm*2)

print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))

m = []
p = []
z = 0

for i in range(n):
  if(an[i]<0):
    m.append(an[i])
  if(an[i]>0):
    p.append(an[i])
  if(an[i]==0):
    z=1

if ( z==1 ):
  ans = sum(p) - sum(m)
else:
  if ( len(m)%2 == 0):
    ans = sum(p) - sum(m)
  else:
    minm = 0
    if ( min(p) < (-max(m)) ):
      minm = min(p)
    else:
      minm = -max(m)
    ans  = sum(p) - sum(m) - (minm*2)

print(ans)
Problem p02802 (python)

Fixed submission:
n, m = map(int, input().split())
li = []
for i in range(m):
  li.append(list(input().split()))
li_a = [0 for i in range(n)]
li_b = [0 for i in range(n)]
a = 0
b = 0
for j in range(m):
  if li[j][1] == "WA":
    li_b[int(li[j][0])-1] += 1
  elif li[j][1] == "AC" and li_a[int(li[j][0])-1] == 0:
    a += 1
    b += li_b[int(li[j][0])-1]
    li_a[int(li[j][0])-1] += 1
print(a, b)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
li = []
for i in range(m):
  li.append(list(input().split()))
li_a = [0 for i in range(n)]
li_b = [0 for i in range(n)]
a = 0
b = 0
for j in range(m):
  if li[j][1] == "WA":
    li_b[int(li[j][0])] += 1
  elif li[j][1] == "AC" and li_a[int(li[j][0])] == 0:
    a += 1
    b += li_b[int(li[j][0])]
    li_a[int(li[j][0])] += 1
print(a, b)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
li = []
for i in range(m):
  li.append(list(input().split()))
li_a = [0 for i in range(m)]
li_b = [0 for i in range(m)]
a = 0
b = 0
for j in range(m):
  if li[j][1] == "WA":
    li_b[int(li[j][0])] += 1
  elif li[j][1] == "AC" and li_a[int(li[j][0])] == 0:
    a += 1
    b += li_b[int(li[j][0])]
    li_a[int(li[j][0])] += 1
print(a, b)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
li = []
for i in range(m):
  li.append(list(input().split()))
li_a = [0 for i in range(m)]
li_b = [0 for i in range(m)]
a = 0
b = 0
for j in range(m):
  if li[j][1] == "WA":
    li_b[int(li[j][0])] += 1
  elif li[j][1] == "AC" and li_a[j] == 0:
    a += 1
    b += li_b[int(li[j][0])]
    li_a[int(li[j][0])] += 1
print(a, b)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
li = []
for i in range(m):
  li.append(list(input().split()))
li_a = [0 for i in range(m)]
li_b = [0 for i in range(m)]
a = 0
b = 0
for j in range(m):
  if li[j][1] == "WA":
    li_b[int(li[j][0])] += 1
  elif li[j][1] == "AC" and li_a[j] == 0:
    a += 1
    b += li_b[int(li[j][0])]
    li_a[j] += 1
print(a, b)
Problem p02885 (python)

Fixed submission:
a,b=map(int,input().split())
if a >= 2*b:
  print(a-2*b)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
li =list(input().split())
a=0
for i in range(n-1):
  if li[i] == li[i+1]:
    a += 1
print(n-a)

Buggy submission (verdict: Runtime Error):
n = int(input())
li =list(input().split())
for i in range(n-1):
  if li[i] == li[i+1]:
    li.remove(li[i])
print(len(li))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input()split())
if a >= 2*b:
  print(a-2*b)
else:
  print(0)
Problem p02887 (python)

Fixed submission:
n = int(input())
li =list(input())
a=0
for i in range(n-1):
  if li[i] == li[i+1]:
    a += 1
print(n-a)

Buggy submission (verdict: Runtime Error):
n = int(input())
li =list(input())
for i in range(n-1):
  if li[i] == li[i+1]:
    li.remove(li[i])
print(len(li))

Buggy submission (verdict: Runtime Error):
n = int(input())
li =list(input())
for i in range(n-1):
  if li[i] == li[i+1]:
    li.remove(li[i])
print(len(li))

Buggy submission (verdict: Runtime Error):
n = int(input())
li =list(input().split())
for i in range(n-1):
  if li[i] == li[i+1]:
    li.remove(li[i])
print(len(li))

Buggy submission (verdict: Runtime Error):
n = int(input())
li =list(input().split())
for i in range(n):
  if li[i] == li[i+1]:
    li.remove(li[i])
print(len(li))
Problem p02898 (python)

Fixed submission:
N, K = map(int, input().split())
li = list(map(int, input().split()))
ans = 0
for i in range(N):
  if li[i] >= K:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = list(map(int, input().split())
ans = 0
for i in range(len(l)):
     if l[i] >= K
         ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = list(map(int, input().split())
ans = 0
for i in range(len(l)):
     if l[i] >= K
         ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = list(map(int, input().split())
ans = 0
for i in l:
     if i >= K
         ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = list(map(int, input().split())
ans = 0
while max(l) <= K:
         l.remove(max(l))
         ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = list(map(int, input().split())
ans = 0
while True:
  if max(l) >= K:
    l.remove(max(l))
    ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = [input() for i in range(N+1)]
ans = 0
while True:
  if max(l) >= K:
    l.remove(max(l))
    ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = [map(int, input().split())]
ans = 0
while max(l)<K:
  if max(l) >= K:
    l.remove(max(l))
    ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = [map(int, input().split())]
ans = 0
while True:
  if max(l) >= K:
    l.remove(max(l))
    ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = []
l += map(int, input().split())
ans = 0
while True:
  if max(l) >= K:
    l.remove(max(l))
    ans += 1
    
print(ans)
Problem p02918 (python)

Fixed submission:
N, K = map(int, input().split())
li = list(input())
a = 0
b = 0
for i in range(N-1):
  if li[i] == li[i+1]:
    b += 1
  else:
    a += 1
for j in range(K):
  if a >= 2:
    a -= 2
    b += 2
  elif a == 1:
    a -= 1
    b += 1
  else:
    break
print(b)

Buggy submission (verdict: Runtime Error):
for i in range(N-1):
  if li[i] == li[i+1]:
    b += 1
  else:
    a += 1
for j in range(K):
  if a >= 2:
    a -= 2
    b += 2
  elif a == 1:
    a -= 1
    b += 1
  else:
    break
print(b)
Problem p02923 (python)

Fixed submission:
n = int(input())
li = list(map(int, input().split()))
li_a = []
for i in range(n-1):
  if li[i] < li[i+1]:
    li_a.append(i+1)
if len(li_a) == 1:
  print(n - li_a[0] - 1)
elif len(li_a) == 0:
  print(n-1)
else:
  li_b = []
  for j in range(len(li_a)-2):
    li_b.append(li_a[j+1]-li_a[j]-1)
  li_b.append(n - li_a[-1] - 1)
  print(max(li_b))

Buggy submission (verdict: Runtime Error):
n = int(input())
li = list(map(int, input().split()))
li_a = []
for i in range(n-1):
  if li[i] < li[i+1]:
    li_a.append(i+1)
if len(li_a) == 1:
  print(n - li_a[0] - 1)
else:
  li_b = []
  for j in range(len(li_a)-2):
    li_b.append(li_a[j+1]-li_a[j]-1)
  li_b.append(n - li_a[-1] - 1)
  print(max(li_b))

Buggy submission (verdict: Runtime Error):
n = int(input())
li = list(map(int, input().split()))
li_a = []
for i in range(n-1):
  if li[i] < li[i+1]:
    li_a.append(i+1)
if len(li_a) == 1:
  print(n - li_a[0] - 1)
else:
  li_b = []
  for j in range(len(li_a)-2):
    li_b.append(li_a[j+1]-li_a[j]-1)
  li_b.append(n - li_a[-1] - 1)
  print(max(li_b))
print(li_a)

Buggy submission (verdict: Runtime Error):
n = int(input())
li = list(map(int, input().split()))
li_a = []
for i in range(n-1):
  if li[i] >= li[i+1]:
    li_a.append(i)
li_b = []
for j in range(len(li_a)-2):
  li_b.append(li_a[j+1]-li_a[j])
li_b.append(li_a[0])
li_b.append(n - li_a[-1])
print(max(li_b))
Problem p02958 (python)

Fixed submission:
N = int(input())
li_p = list(map(int, input().split()))
li_a = sorted(li_p)
#print(li_a)
#print(li_p)
a = 0
for i in range(N):
  if li_p[i] != li_a[i]:
    a += 1
    
if a <= 2:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N = int(input())
li_p = list(map(int, input().split()))
li = set(li_p)
li_a = []
li_b = []
for i in range(N):
  if li_p[i] != li[i]:
    li_a.append(li_p[i])
    li_b.append(li[i])
    if len(li_a) == 2:
      if li_a[0] == li_b[1]:
        print("YES")
      else:
        print("NO")
    elif len(li_a) > 2:
      print("NO")
    elif len(li_a) == 0:
      print("YES")
Problem p02981 (python)

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

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
li = []
for i in range(L, R+1):
  li.append(i%2019)
#print(li)
a = min(li)
li.remove(min(li))
b = min(li)
li.remove(min(li))
print(a*b)

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

Fixed submission:
L, R = map(int, input().split())
li = []
li_a =[]
if R-L+1 >= 2019:
  print(0)
else:
  for i in range(L, R+1):
    li.append(i%2019)
  for x in li:
    for y in li:
      if x != y:
        li_a.append((x*y)%2019)
  print(min(li_a))

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
li = []
for i in range(L, min(L+4038, 2000000000, R)):
  li.append(i%2019)
a = min(li)
li.remove(min(li))
b = min(li)
li.remove(min(li))
print(a*b)
Problem p03000 (python)

Fixed submission:
n, x = map(int, input().split())
li = list(map(int, input().split()))
li.append(0)
a = 0
i = 0
while a <= x and i < n+1:
  a += li[i]
  i += 1
print(i)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
li = list(map(int, input().split()))
a = 0
i = 0
while a < x and i < n+1:
  a += li[i]
  i += 1
if a == x:
  i += 1
print(i)
Problem p03001 (python)

Fixed submission:
W, H, x, y = map(int, input().split())
if x == W/2 and y == H/2:
  print(str((H*W)/2) + " " + "1")
else:
  print(str((H*W)/2) + " " + "0")

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())
a = x*H
b = y*W
if x != 0 and x != W and y != 0 and y != H:
  if a < b:
    print(str(a) + " " + str(0))
  elif b < a:
    print(str(b) + " " + str(0))
  else:
    print(str(a) + " " + str(1))
else:
  print(str((H*W)/2) + " " + 0)
Problem p03162 (python)

Fixed submission:
n = int(input())
li = []
for i in range(n):
  a = list(map(int, input().split()))
  li.append(a)
dp = []
for i in range(n):
  dp.append([0 for j in range(3)])
dp[0][0] = li[0][0]
dp[0][1] = li[0][1]
dp[0][2] = li[0][2]
for i in range(1, n):
  dp[i][0] = li[i][0] + max(dp[i-1][1], dp[i-1][2])
  dp[i][1] = li[i][1] + max(dp[i-1][0], dp[i-1][2])
  dp[i][2] = li[i][2] + max(dp[i-1][0], dp[i-1][1])
print(max(dp[n-1][0], dp[n-1][1], dp[n-1][2]))

Buggy submission (verdict: Runtime Error):
n = int(input())
li = []
for i in range(n):
  a = list(map(int, input().split()))
  li.append(a)
dp = []
for i in range(3):
  dp.append([0 for j in range(n)])
dp[0][0] = li[0][0]
dp[0][1] = li[0][1]
dp[0][2] = li[0][2]
for i in range(1, n):
  dp[i][0] = li[i][0] + max(dp[i-1][1], dp[i-1][2])
  dp[i][1] = li[i][1] + max(dp[i-1][0], dp[i-1][2])
  dp[i][2] = li[i][2] + max(dp[i-1][0], dp[i-1][1])
print(max(dp[n-1][0], dp[n-1][1], dp[n-1][2]))

Buggy submission (verdict: Runtime Error):
n = int(inut())
li = []
for i in range(n):
  a = list(map(int, input().split()))
  li.append(a)
dp = []
for i in range(3):
  dp.append([0 for j in range(n)])
dp[0][0] = li[0][0]
dp[0][1] = li[0][1]
dp[0][2] = li[0][2]
for i in range(1, n):
  dp[i][0] = li[i][0] + max(dp[i-1][1], dp[i-1][2])
  dp[i][1] = li[i][1] + max(dp[i-1][0], dp[i-1][2])
  dp[i][2] = li[i][2] + max(dp[i-1][0], dp[i-1][1])
print(max(dp[n][0], dp[n][1], dp[n][2]))
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):
N = int(input())
li = list(map(int, input().split()))
a = 0
while any(j % 2 == 0 for j in li):
  for i in range(N):
    if li[i]%2 == 0:
      li[i] = li[i]/2
      a += 1
      break
print(a)
Problem p03651 (python)

Fixed submission:
import fractions

def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def ris(): return list(input())
def pli(a): return "".join(list(map(str, a)))


n, k = rli()
a = rli()
if(max(a) < k):
    print("IMPOSSIBLE")
else:
    g = a[0]
    for i in a[1:]:
        g = fractions.gcd(g, i)
    if(k % g == 0):
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import math

def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def ris(): return list(input())
def pli(a): return "".join(list(map(str, a)))


n, k = rli()
a = rli()
if(max(a) < k):
    print("IMPOSSIBLE")
else:
    g = a[0]
    for i in a[1:]:
        g = math.gcd(g, i)
    if(k % g == 0):
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def ris(): return list(input())
def pli(a): return "".join(list(map(str, a)))

import math

n, k = rli()
a = rli()
if(max(a) < k):
    print("IMPOSSIBLE")
else:
    g = a[0]
    for i in a[1:]:
        g = math.gcd(g, i)
    if(k % g == 0):
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
Problem p03795 (python)

Fixed submission:
N = int(input())
dis = (N//15)*200
print(N*800-dis)

Buggy submission (verdict: Runtime Error):
N = int(input())
t = list(input())
Ans = ['n' for _ in t]

def judge(prevSW, SW, ox):
    if SW == 'S':
        if ox == 'o':
            return prevSW
        else:
            if prevSW == 'S':
                return 'W'
            else: return 'S'
    elif SW == 'W':
        if ox == 'x':
            return prevSW
        else:
            if prevSW == 'S':
                return 'W'
            else: return 'S'

def decideorder(startSW):
    Ans[1] = startSW
    for i in range(2,N):
        Ans[i] = judge(Ans[i-2], Ans[i-1], t[i-1])


Ans[0] = 'S'
decideorder('S')
if judge(Ans[-1], Ans[0], t[0]) is Ans[0]:
    print("".join(Ans))
else:
    decideorder('W')
    if judge(Ans[-1], Ans[0], t[0]) is Ans[0]:
        print("".join(Ans))
    else:
        Ans[0] = 'W'
        decideorder('S')
        if judge(Ans[-1], Ans[0], t[0]) is Ans[0]:
            print("".join(Ans))
        else:
            decideorder('W')
            if judge(Ans[-1], Ans[0], t[0]) is Ans[0]:
                print("".join(Ans))
            else:
                print(-1)
Problem p03962 (python)

Fixed submission:
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def ris(): return list(input())
def pli(): return "".join(list(map(str, ans)))

print(len(set(rli())))

Buggy submission (verdict: Runtime Error):
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def ris(): return list(input())
def pli(): return "".join(list(map(str, ans)))

print(len(set(rli()))
Problem p04029 (python)

Fixed submission:
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))

n = ri()
print(n*(n+1)//2)

Buggy submission (verdict: Runtime Error):
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))

n = ri()
print(n(n+1)/2)
Problem p02945 (python)

Fixed submission:
A,B=map(int,input().split())
print(max(A-B,A+B,A*B))

Buggy submission (verdict: Runtime Error):
A,B=map(int,input())
print(max(A-B,A+B,A*B))
Problem p02995 (python)

Fixed submission:
import fractions

A,B,C,D=map(int,input().split())
lcm=int(C*D/(fractions.gcd(C,D)))

if B//lcm==0:
    num_CD=0
else:
    num_CD=B//lcm-(A-1)//lcm


if B//C==0:
    num_C=0
else:
    num_C=B//C-(A-1)//C



if B//D==0:
    num_D=0
else:
    num_D=B//D-(A-1)//D


ans=B-A+1-num_C-num_D+num_CD


print(int(ans))

Buggy submission (verdict: Runtime Error):
import math

A,B,C,D=map(int,input().split())
lcm=int(C*D/math.gcd(C,D))

if B//lcm==0:
    num_CD=0
else:
    num_CD=B//lcm-math.ceil(A/lcm)+1


if B//C==0:
    num_C=0
else:
    num_C=B//C-math.ceil(A/C)+1



if B//D==0:
    num_D=0
else:
    num_D=B//D-math.ceil(A/D)+1


ans=B-A+1-num_C-num_D+num_CD


print(int(ans))

Buggy submission (verdict: Runtime Error):
A,B,C,D=map(int,input().split())
lcm=int(C*D/math.gcd(C,D))

if B//lcm==0:
    num_CD=0
else:
    num_CD=B//lcm-math.ceil(A/lcm)+1


if B//C==0:
    num_C=0
else:
    num_C=B//C-math.ceil(A/C)+1



if B//D==0:
    num_D=0
else:
    num_D=B//D-math.ceil(A/D)+1


ans=B-A+1-num_C-num_D+num_CD


print(int(ans))
Problem p02999 (python)

Fixed submission:
X,A=map(int,input().split())
if X<A:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate 
N,K=map(int,input().split())
a=[int(i) for i in input().split()]
b=list(reversed(a))
b_sum=list(accumulate(b))
num=0
for i in range(len(b_sum)):
    if b_sum[i]<K:
        num+=1

ans=0
for i in range(N-num):
    b=a[i:]
    c=list(accumulate(b))
    c.reverse()
    for j in range(len(c)):
        if c[j]>=K:
            ans+=1
        else:
            break

print(ans)

Buggy submission (verdict: Runtime Error):
X,A=map(int,input())
if X<A:
    print(0)
else:
    print(10)
Problem p03086 (python)

Fixed submission:
S=input()
list = [-1]
list2 = []

for i in range(len(S)):
    if S[i] != 'A' and S[i] != 'T' and S[i] != 'G' and S[i] != 'C':
        list.append(i)

list.append(len(S))

i=0
while i<len(list)-1:
    list2.append(list[i+1]-list[i]-1)
    i += 1

for i in range(len(list2)):
    for j in range(i,len(list2)):
        if list2[i]<list2[j]:
            temp = list2[i]
            list2[i] = list2[j]
            list2[j] = temp
            
print(list2[0])

Buggy submission (verdict: Runtime Error):
S=input()
list = [-1]
list2 = []

for i in range(len(S)):
    if S[i] != 'A' and S[i] != 'T' and S[i] != 'G' and S[i] != 'C':
        list.append(i)
i=0
while i<len(list)-1:
    list2.append(list[i+1]-list[i]-1)
    i += 1

for i in range(len(list2)):
    for j in range(i,len(list2)):
        if list2[i]<list2[j]:
            temp = list2[i]
            list2[i] = list2[j]
            list2[j] = temp

print(list2[0])
Problem p03106 (python)

Fixed submission:
import fractions

A,B,K=map(int,input().split())

p=fractions.gcd(A,B)

count=1

ans=p

for i in reversed(list(range(1,p))):
    if p%i==0:
        count+=1
        ans=i
    if count==K:
        break

print(ans)

Buggy submission (verdict: Runtime Error):
import math

A,B,K=map(int,input().split())

p=math.gcd(A,B)

count=1

ans=p

for i in reversed(list(range(1,p))):
    if p%i==0:
        count+=1
        ans=i
    if count==K:
        break

print(ans)