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

Fixed submission:
[n,x]=[int(i) for i in input().split()]
l=[int(x) for x in input().split()]
a=1
su=0

for i in l:
    
    if su>x:
        
        break
    su+=i
    if su<=x:
        a+=1
   

print(a)

Buggy submission (verdict: Runtime Error):
[n,x]=[int(x) for x in input().split()]
l=[int(x) for x in input().split()]
k=0
count=0
for i in range(n+1):
  if k<=x:
    count+=1
  k+=l[i]
print(count)
Problem p02975 (python)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
 
res = "No"
a_set = list(set(a))
 

 
if len(a_set) == 3:
    if a_set[0] ^ a_set[1] == a_set[2]:
        if a.count(a_set[0]) == a.count(a_set[1]) and a.count(a_set[0]) == a.count(a_set[2]):
            res = "Yes"
if len(a_set) == 1:
    if a_set[0] == 0:
        res = "Yes"
if len(a_set) == 2:
    if 0 in a_set:
        if N%3 == 0 and a.count(0) == N/3:
            res = "Yes"
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
 
res = "No"
a_set = list(set(a))
 
a_set = [i for i in a_set if i != 0]
 
if len(a_set) == 3:
    if a_set[0] ^ a_set[1] == a_set[2]:
        if a.count(a_set[0]) == a.count(a_set[1]) and a.count(a_set[0]) == a.count(a_set[2]):
            res = "Yes"
if len(a_set) == 0:
    if a_set[0] == 0:
        res = "Yes"
print(res)
Problem p02981 (python)

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

train = A*N
taxi  = B

if taxi < train:
    print(taxi)
else:
    print(train)

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

if L-R > 672:
    print(0)
else:
    minMod = 100000000
    for i in range(L,R):
        for j in range(i+1,R+1):
            tmp = (i*j)%2019
            if minMod > tmp:
                minMod = tmp
            elif tmp == 0:
                minMod = 0 
                break
    print(minMod)

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

if L-R > 672:
    print(0)
else:
    minMod = 100000000
    for i in range(L,R):
        for j in range(i+1,R+1):
            tmp = (i*j)%2019
            if minMod > tmp:
                minMod = tmp
    print(minMod)
Problem p02983 (python)

Fixed submission:
L,R = map(int,input().split())

if R-L > 672:
    print(0)
else:
    minMod = 2019
    for i in range(L,R):
        for j in range(i+1,R+1):
            tmp = (i*j)%2019
            if tmp == 0:
                minMod = 0
                break
            minMod = min(tmp,minMod)
    print(minMod)

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

if L-R > 2018:
    print(0)
else:
    minMod = 100000000
    for i in range(L,R):

        for j in range(i+1,R+1):
   
            if tmp == 0:
      			minMod = tmp
        		break
    		elif minMod > (i*j)%2019:
                minMod = (i*j)%2019
        	
    print(minMod)

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

if L-R > 672:
    print(0)
else:
    minMod = 100000000
    for i in range(L,R):
        for j in range(i+1,R+1):
            tmp = (i*j)%2019
            if minMod > tmp:
                minMod = tmp
            elif tmp == 0:
                minMod = 0 
                break
    print(minMod)

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

if L-R > 672:
    print(0)
else:
    minMod = 100000000
    for i in range(L,R):
        for j in range(i+1,R+1):
            tmp = (i*j)%2019
            if minMod > tmp:
                minMod = tmp
                
            elif tmp == 0:
                minMod = 0 
                break
    print(minMod)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

N = int(input())
L,R = map(int,input().split())

if L-R > 672:
    print(0)
else:
    minMod = 100000000
    for i in range(L,R):
        for j in range(i+1,R+1):
            tmp = (i*j)%2019
            if minMod > tmp:
                minMod = tmp
                
            elif tmp == 0:
                minMod = 0 
                break
    print(minMod)

Buggy submission (verdict: Runtime Error):

N = int(input())
L,R = map(int,input().split())

if L-R > 672:
    print(0)
else:
    minMod = 100000000
    for i in range(L,R):
        for j in range(i+1,R+1):
            tmp = (i*j)%2019
            if minMod > tmp:
                minMod = tmp
                
            else if tmp == 0:
                minMod = 0 
                break
    print(minMod)
Problem p03129 (python)

Fixed submission:
N,K = map(int,input().split())
N = (N+1)//2
 
if N >= K:
  res = "YES"
else:
  res = "NO"

print(res)

Buggy submission (verdict: Runtime Error):
#失恋してメンタル死んでるのでコードもシンデマス

dic = {}
key = []
item = []

for i in range(3):
    a,b = map(int,input().split())
    dic[a] = b
    key.append(a)
    item.append(b)

for i in key:
    flag = True
    tmp_key = key
    tmp_item = item
    
    a = i
    while flag:
        if a in key:
          a = dic[a]
            tmp_key.remove(a)
            tmp_item.remove(dic[a])
            
        else:
            flag = False
        
    if len(tmp_item) == 0 and len(tmp_key) == 0:
        res = "YES"
        res_flag = False
if res_flag:
  res = "NO"

print(res)
Problem p03579 (python)

Fixed submission:
from collections import deque
from collections import defaultdict
from collections import Counter

N,M = list(map(int,input().split()))
G = defaultdict(set)

color = [0 for i in range(N+1)]

for _ in range(M):
    A,B = map(int,input().split())
    G[A].add(B)
    G[B].add(A)

color[1] = 1
que = deque([1])
concatenation = False

while len(que):
    p = que.popleft()
    for q in list(G[p]):
        if color[q] == 0:
            color[q] = -color[p]
            que.append(q)
        elif color[q] == color[p]:
            concatenation = True
            break
    
if concatenation:
    print(int(N*(N-1)/2-M))
else:
    B = Counter(color)[1]
    W = Counter(color)[-1]
    print(B*W-M)

Buggy submission (verdict: Runtime Error):
from collections import Counter
from collections import defaultdict 

N,M = map(int,input().split())
dict = defaultdict(set)

for i in range(M):
    a,b = list(map(int,input().split()))  
    
    dict[a].add(b)
    dict[b].add(a)



color = [0 for i in range(N+1)]
res = True

def dfs(v,c,queue=[]):
    u'''
    v : 現在のグラフの頂点
    c : 現在参照するフラグ,1=>-1=>1と使うので渡す必要がある
    queue : 探索したグラフの頂点を入れていく
    res : global変数を使いたくないが,再帰のreturnがよくわからないのでとりあえず
    '''

    global color
    global res 
    queue.append(v)
    
    for i in list(dict[v]):
        if color[i] == c:#隣の頂点が同じ値を与えられている際Falseを返す
            res = False
        elif i not in queue:#探索済みでなければ再帰する

            color[i] = c*-1#0ならcとは異なる値を格納
            dfs(i,-c,queue)#引数に-cとすることで,cが1=>-1=>1を繰り返す


color[1] = 1#始点色分けする
dfs(1,1)

if res:
    counter = Counter(color)
    B = counter[1]
    W = counter[-1]
    print(B*W-M)

else:
    print(int(N*(N-1)/2 - M))
Problem p03601 (python)

Fixed submission:
A,B,C,D,E,F = list(map(int,input().split()))
A = 100*A
B = 100*B

a = int(F/A)
b = int(F/B)

hoge = 0

water = [[0 for i in range(a+1)]for i in range(b+1)]
sugar = [[0 for i in range(a+1)]for i in range(b+1)]

noudo = [[0 for i in range(a+1)]for i in range(b+1)]

for i in range(a+1):
    for j in range(b+1):
        if A*i+B*j < F:
            water[j][i] = A*i+B*j
       


        c = int(E*water[j][i]/(100*C))
        d = int(E*water[j][i]/(100*D))
        for k in range(c+1):
            for m in range(d+1):
                if C*k+D*m <= F-water[j][i]  and C*k+D*m <= E*water[j][i]/100:
                    sugar[j][i] = max(sugar[j][i],C*k+D*m)

for i in range(a+1):
    for j in range(b+1):
        if water[j][i] != 0 and sugar[j][i] != 0:
            noudo[j][i] = sugar[j][i]/(water[j][i]+sugar[j][i])
        if hoge <= noudo[j][i]:
            res_i = i
            res_j = j
            hoge = noudo[j][i]

print(water[res_j][res_i]+sugar[res_j][res_i],sugar[res_j][res_i])

Buggy submission (verdict: Runtime Error):
A,B,C,D,E,F = list(map(int,input().split()))
A = 100*A
B = 100*B

a = int(F/A)
b = int(F/B)


hoge = 0

dp = [[0 for i in range(a+1)]for i in range(b+1)]
Na = [[0 for i in range(a+1)]for i in range(b+1)]
noudo = [[0 for i in range(a+1)]for i in range(b+1)]

for i in range(a+1):
    for j in range(b+1):
        if A*i+B*j < F:
            dp[i][j] = A*i+B*j
        c = int(E*dp[i][j]/(100*C))
        d = int(E*dp[i][j]/(100*D))
        for k in range(c+1):
            for m in range(d+1):
                if C*k+D*m <= F-dp[i][j]  and C*k+D*m < E*dp[i][j]/100:
                    Na[i][j] = max(Na[i][j],C*k+D*m)

for i in range(a+1):
    for j in range(b+1):
        if dp[i][j] != 0 and Na[i][j] != 0:
            noudo[i][j] = Na[i][j]/(dp[i][j]+Na[i][j])
        if hoge <= noudo[i][j]:
            res_i = i
            res_j = j
            hoge = noudo[i][j]

print(dp[res_i][res_j]+Na[res_i][res_j],Na[res_i][res_j])
Problem p03628 (python)

Fixed submission:
N = int(input())
S1 = list(input())
S2 = list(input())
i = 0


if S1[i] != S2[i]:
    res = 6
    i+=2
    rear = 1
else :
    res = 3
    i+=1
    rear = 0

while i != N:
    if S1[i] != S2[i]:
        if rear == 1:
            res *= 3
        else:
            res *= 2
        rear = 1
        i += 2

    else:
        if rear == 0:
            res *= 2
        i += 1
        rear = 0


print(res%1000000007)

Buggy submission (verdict: Runtime Error):
N = int(input())
S1 = list(input())
S2 = list(input())
i = 0


if S1[i] != S2[i]:
    res = 6
    i+=2
    rear = 1
else :
    res = 3
    i+=1
    rear = 0

while i != (N-1):
    if S1[i] != S2[i]:
        if rear == 1:
            res *= 3
        else:
            res *= 2
        rear = 1
        i += 2

    else:
        if rear == 0:
            res *= 2
        i += 1
        rear = 0


print(res%1000000007)

Buggy submission (verdict: Runtime Error):
N = int(input())
S1 = list(input())
S2 = list(input())
i = 0


if S1[i] != S2[i]:
    res = 6
    i+=2
    rear = 1
else :
    res = 3
    i+=1
    rear = 0

while i != (N-1):
    if S1[i] != S2[i]:
        if rear == 1:
            res *= 3
        else:
            res *= 2
        rear = 1
        i += 2

    else:
        if rear == 0:
            res *= 2
        i += 1
        rear = 0
    print(i)

print(res)
Problem p03632 (python)

Fixed submission:
A,B,C,D = list(map(int,input().split()))


if A < C:
  a = C
else:
  a = A

if B < D:
  b = B
else:
  b = D
  
if B <= C or D <= A:
  res = 0
else:
  res = (b-a)
  
print(res)

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

if B<C:
    res = 0
else:
    res = min(B,D) - max(A<C)
print(res)

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


if A < C:
  a = C
else:
  a = A

if B < D:
  b = B
else:
  b = D
  
if B =< C or D =< A:
  res = 0
else:
  res = (b-a)
  
print(res)
Problem p03635 (python)

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

print((n-1)*(m-1))

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


ans = set(S[0])

for j in range(1,N):
    ans = ans & set(S[j])

print(str(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
one = 0
four = 0
two = 0

for j in range(N):

  if a[j]%2 == 1:
    one += 1
  elif a[j]%4 == 0:
    four += 1
  else :
    two +=1

  
if one =< four:
  print('Yes')
else :
  if two == 0:
    if four == one-1:
      print('Yes')
    else :
      print("No")
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
one = 0
four = 0
two = 0

for j in range(N):

  if a[j]%2 == 1:
    one += 1
  elif a[j]%4 == 0:
    four += 1
  else :
    two +=1

print("Yes" if four >= one or (four == one - 1 and two == 0) else "No")

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
one = 0
four = 0
two = 0

for j in range(N):

  if a[j]%2 == 1:
    one += 1
  elif a[j]%4 == 0:
    four += 1
  else :
    two +=1

  
if one <= four:
  print('Yes')
else :
  if two == 0:
    if four >= (one+1):
      print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
one = 0
four = 0
two = 0

for j in range(N):

  if a[j]%2 == 1:
    one += 1
  elif a[j]%4 == 0:
    four += 1
  else :
    two +=1

  
if one <= four:
  print('Yes')
else :
  if two == 0:
    if four == (two+1):
      print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
Kisuu = 0
YonBaisuu = 0
NiBaisuu = 0

for j in range(N):

  if a[j]%2 == 1:
    Kisuu += 1
  elif a[j]%4 == 0:
    YonBaisuu += 1
  else :
    NiBaisuu +=1

  
if Kisuu <= YonBaisuu:
  print('Yes')
else :
  if NiBaisuu == 0:
    if YonBaisuu >= (Kisuu+1):
      print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
Kisuu = 0
YonBaisuu = 0
NiBaisuu = 0

for j in range(N):

  if a[j]%2 == 1:
    Kisuu += 1
  elif a[j]%4 == 0:
    YonBaisuu += 1
  else :
    NiBaisuu +=1

  
if Kisuu <= YonBaisuu:
  print('Yes')
else :
  if NIBaisuu == 0:
    print('Yes')
  else:
    print('No')
Problem p03636 (python)

Fixed submission:
S = input()

S_list = list(S)
Len= len(S)
queue = []

queue.append(S_list[0])
queue.append(str(Len-2))
queue.append(S_list[Len-1])

print("".join(queue))

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

print(S[:1] + str(len(S}-2) + S[-1:])
Problem p03638 (python)

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


space = []
mass = [[0 for i in range(M)] for j in range(H)]
count = 0


for i in range(N):
    for j in range(a[i]):
        space.append(i+1)  



for k in range(H):
    for n in range(M):
        mass[k][n] = str(space[count])
        count += 1

for l in range(H):
  if l%2 == 1:
      mass[l].reverse()


for x in range(H):
  print(" ".join(mass[x]))

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


fill_space = []
mass = [[0 for i in range(M)] for j in range(H)]
count = 0


for i in range(N):
    for j in a[j]:
        fill_space.append(j+1)  

for k in range(H):
    for n in range(M):
        mass[k][n] = fill_space[count]
        count += 1

for l in range(H):
  if l%2 == 1:
      mass[l].reverse()

for x in range(H):
    for y in range(M):
        print(mass[x][y])
    print("\n")

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


fill_space = []
mass = [[0 for i in range(M)] for j in range(H)]
count = 0


for i in range(N):
    for j in a[j]:
        fill_space.append(j+1)  

for k in range(H):
    for n in range(M):
        mass[k][n] = fill_space[count]
        count += 1

for l in range(H):
  if l%2 == 1:
      print(mass[l][::-1])
  else:
      print(mass[l])
Problem p03643 (python)

Fixed submission:
N = int(input())
print ('ABC%d' %N)

Buggy submission (verdict: Runtime Error):
def solve():
  N = input()
  
  print ('ABC') + N

if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
input_N = input()
if 100>input_N and 900<input_N;
  sys.exit()

print ('ABC') + input_N

Buggy submission (verdict: Runtime Error):
input_N = input('>>'  )

print ('ABC') + input_N
Problem p03645 (python)

Fixed submission:
import sys 

N,M  = map(int,input().split())
     
a = [[0 for i in range(2)] for j in range(M)]
b = [] 
c = []

for i in range(M):
  a[i][0] , a[i][1] = map(int,input().split())
  first, second = a[i][0],a[i][1]
  if first == 1:
    b.append(second)
  if second == N:
    c.append(first)

b_set = set(b)
c_set = set(c)

if list(b_set & c_set) is None or len(list(b_set & c_set)):
  res = ('POSSIBLE')
else:
  res = ('IMPOSSIBLE')

print(res)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
des = [0]*(n+1)
a = 1

for i in range(0,m):
  b = (list(map(int,input().split()))
  if b[0] == 1:
    des[b[1]] += 1
    if des[b[1]] == 2:
      print('possible')
      a = 0
      break
    
    if b[1]  == n:
      des[b[0]] += 1
      if des[b[0]] == 2:
        print ('possible')
        a = 0
        break
if a:
  print('impossible')

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
des= [0]*(n+1)
a = 1
for i in range(0, m):
    b = (list(map(int, input().split())))
    if b[0] == 1:
    	des[b[1]] += 1
    	if des[b[1]] == 2:
    		print('POSSIBLE')
    		a = 0
    		break
    if b[1] == n:
    	des[b[0]] += 1
    	if des[b[0]] == 2:
    		print('POSSIBLE')
    	        a = 0
    		break
    		
if a:
    print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
    n, m = map(int, input().split())
    des= [0]*(n+1)
    a = 1
    for i in range(0, m):
    	b = (list(map(int, input().split())))
    	if b[0] == 1:
    		des[b[1]] += 1
    		if des[b[1]] == 2:
    			print('POSSIBLE')
    			a = 0
    			break
    	if b[1] == n:
    		des[b[0]] += 1
    		if des[b[0]] == 2:
    			print('POSSIBLE')
    			a = 0
    			break
    		
    if a:
    	print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
# coding: utf-8
     
    N, M = tuple(map(int, input().split()))
     
    graph = [ [] for i in range(N+1)]
    for i in range(M):
        a, b = tuple(map(int, input().split()))
        graph[a].append(b)
        graph[b].append(a)
     
    res = "IMPOSSIBLE"
    for i in range(2, N):
        if 1 in graph[i] and N in graph[i]:
            res = "POSSIBLE"
     
    print(res)
Problem p03722 (python)

Fixed submission:
class BellmanFord:
    def __init__(self, graph, num_v, start_point):
        """
        graph : [[a1,b1,c1],[a2,b2,c2],‥]みたいな3次元配列のリスト,a1からb1までのコストはc1
        num_v :頂点の数
        start_point :スタート地点(a1)
        """
        self.num_v = num_v
        self.graph = graph
        self.start_point = start_point
 
 
    def execute(self):
        dist = [-1*float("inf") for _ in range(self.num_v)]
        dist[self.start_point] = 0

        negative = [False for _ in range(self.num_v)]

        for i in range(self.num_v - 1):
            for start, end, cost in self.graph:
                if dist[end] < dist[start] + cost:
                    dist[end] = dist[start] + cost

        for i in range(self.num_v):
            for start, end, cost in self.graph:
                if dist[end] < dist[start] + cost:
                    dist[end] = dist[start] + cost
                    negative[end] = True
                if negative[start]:
                    negative[end] = True
        return dist, negative

N,M = map(int,input().split())
T = [[int(_) for _ in input().split()] for i in range(M)]
 
E = []
for a, b, c in T:
    E.append((a - 1, b - 1, c))

bellman = BellmanFord(E, N, 0)
result, negative = bellman.execute()
 
if negative[-1]:
    print("inf")
else:
    print(result[-1])

Buggy submission (verdict: Runtime Error):
class BellmanFord:
    def __init__(self, graph, num_v, start_point):
        """
        graph : [[a1,b1,c1],[a2,b2,c2],‥]みたいな3次元配列のリスト,a1からb1までのコストはc1
        num_v :頂点の数
        start_point :スタート地点(a1)
        """
        self.num_v = num_v
        self.graph = graph
        self.start_point = start_point
 
 
    def execute(self):
        dist = [float("inf") for _ in range(self.num_v)]
        dist[self.start_point] = 0

        negative = [False for _ in range(self.num_v)]

        for i in range(self.num_v - 1):
            for start, end, cost in self.graph:
                if dist[end] > dist[start] + cost:
                    dist[end] = dist[start] + cost

        #負の経路がないなら|V-1|以上の繰り返しで最短経路の更新は行われない、負の経路の検出
        for i in range(self.num_v):
            for start, end, cost in self.graph:
                if dist[end] > dist[start] + cost:
                    dist[end] = dist[start] + cost
                    negative[end] = True
                if negative[start]:
                    negative[end] = True
        return dist, negative
 
N,M = map(int,input().split())
T = [[int(_) for _ in input().split()] for i in range(M)]

E = []
for a, b, c in T:
    E.append((a - 1, b - 1, c))

bellman = BellmanFord(graph, n, 0)
result, negative = bellman.execute()
 
if negative[-1]:
    print("inf")
else:
    print(-result[-1])
Problem p03761 (python)

Fixed submission:
N = int(input())
S = []
for i in range(N):
    S.append(list(input()))
queue = []
len = len(S[0])

for j in range(len):
    flag = [0 for m in range(N)]
    for k in range(1,N):
        if S[0][j] in S[k]:
            flag[k] = 1
            S[k].remove(S[0][j])
            
    if sum(flag) == N-1:
        queue.append(S[0][j])

queue = sorted(queue)
res = "".join(queue)
        
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
    S.append(input())
queue = []
S0len = len(S[0])

for j in range(S0len):
    flag = [0 for m in range(N-1)]
    for k in range(1,N):
        if S[0][j] in S[k]:
            flag[k] = 1
            
    if sum(flag) == N-1:
        queue.append(S[0][j])

queue = sorted(queue)
res = "".join(queue)
        
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
    S.append(input())
queue = []
S0len = len(S[0])

for j in range(S0len):
    flag = [0 for m in range(S0len)]
    for k in range(1,N):
        if S[0][j] in S[k]:
            flag[k] = 1
            
    if sum(flag) == N-1:
        queue.append(S[0][j])

queue = sorted(queue)
res = "".join(queue)
        
print(res)
Problem p03747 (python)

Fixed submission:
N, L, T = map(int, input().split())
n = [list(map(int, input().split())) for _ in range(N)]
t = [X + (0, T, -T)[W] for X, W in n]
l = sorted(i % L for i in t)
s = sum(i // L for i in t) % N
for i in l[s:] + l[:s]: print(i)

Buggy submission (verdict: Runtime Error):
N, L, T = map(int, input().split())
n = [[*map(int, input().split())] for _ in range(N)]
t = [X + (0, T, -T)[W] for X, W in n]
x = sorted(i % L for i in t)
s = sum(i // L for i in t) % N
for i in x[s:] + x[:s]: print(i)
Problem p03337 (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().split())

print(max(A+B,A-B,A*B)
Problem p03390 (python)

Fixed submission:
from math import sqrt

Q = int(input())

for i in range(Q):
    A,B = map(int, input().split())
    m=A*B

    C = int(sqrt(m))
    if C*C==m:
        C=C-1

    if A==B or B==A+1:
        ans = 2*A-2
    elif A==B+1:
        ans = 2*B-2
    elif C*(C+1)<m:
        ans = 2*C-1
    else:
        ans = 2*C-2
    print(ans)

Buggy submission (verdict: Runtime Error):
from math import sqrt

Q = int(input())

for i in range(Q):
    A,B = map(int, input().split())
    m=A*B
    if A==B or B==A+1:
        ans = 2*A-2
    elif A==B+1
        ans = 2*B-2

    C = int(sqrt(m))
    if C*C==m:
        C=C-1

    if C*(C+1)<m:
        ans = 2*C-1
    else:
            ans = 2*C-2
    print(ans)

Buggy submission (verdict: Runtime Error):
from math import sqrt

Q = int(input())

for i in range(Q):
    A,B = map(int, input().split())
    m=A*B
    if A==B or B=A+1:
        ans = 2*A-2
    elif A=B+1
        ans = 2*B-2

    C = int(sqrt(m))
    if C*C==m:
        C=C-1

    if C*(C+1)<m:
        ans = 2*C-1
    else:
            ans = 2*C-2
    print(ans)