message
stringlengths
2
48.6k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
318
108k
cluster
float64
8
8
__index_level_0__
int64
636
217k
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains 2 apartments, every other fl...
instruction
0
90,333
8
180,666
Tags: implementation, math Correct Solution: ``` import math n1 = int(input()) for _ in range(n1): n2 = input() l = [int(item) for item in n2.split()] n,x = l[0],l[1] if n<=2 : print(1) else : print(1+math.ceil((n-2)/x)) ```
output
1
90,333
8
180,667
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains 2 apartments, every other fl...
instruction
0
90,334
8
180,668
Tags: implementation, math Correct Solution: ``` t=int(input()) for i in range(t): n,x=map(int,input().split()) print(max(0,(n-3)//x+1)+1) ```
output
1
90,334
8
180,669
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains 2 apartments, every other fl...
instruction
0
90,335
8
180,670
Tags: implementation, math Correct Solution: ``` #codeforces div-2 round 668 '''for i in range(int(input())): n=int(input()) arr=[int(i) for i in input().split()] print(*arr[::-1])''' '''for i in range(int(input())): n=int(input()) arr=[int(i) for i in input().split()] run=0 for i in ran...
output
1
90,335
8
180,671
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains 2 apartments, every other fl...
instruction
0
90,336
8
180,672
Tags: implementation, math Correct Solution: ``` for _ in range(int(input())): sim=2 n,x=map(int, input().split()) if n<=sim: print(1) else: while n>sim: sim+=x print(int((sim-2)/x+1)) ```
output
1
90,336
8
180,673
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains 2 apartments, every other fl...
instruction
0
90,337
8
180,674
Tags: implementation, math Correct Solution: ``` for _ in range(int(input())): n,x=map(int,input().split()) if n<=2: print(1) else: n-=2 s=n/x if int(s)!=s: s=int(s)+1 print(int(s)+1) ```
output
1
90,337
8
180,675
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains 2 apartments, every other fl...
instruction
0
90,338
8
180,676
Tags: implementation, math Correct Solution: ``` import math n1=int(input()) for x in range(n1): n2=input().split(" ") a=int(n2[0]) b=int(n2[1]) if(a<=2): print(1) else: print(1+math.ceil((a-2)/b)) ```
output
1
90,338
8
180,677
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains 2 apartments, every other fl...
instruction
0
90,339
8
180,678
Tags: implementation, math Correct Solution: ``` def read_int(): return int(input()) def read_ints(): return map(int, input().split(' ')) t = read_int() for case_num in range(t): fn = 1 cnt = 2 n, x = read_ints() if n <= 2: print(1) else: while cnt < n: c...
output
1
90,339
8
180,679
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the fi...
instruction
0
90,340
8
180,680
Yes
output
1
90,340
8
180,681
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the fi...
instruction
0
90,341
8
180,682
Yes
output
1
90,341
8
180,683
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the fi...
instruction
0
90,342
8
180,684
Yes
output
1
90,342
8
180,685
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the fi...
instruction
0
90,343
8
180,686
Yes
output
1
90,343
8
180,687
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the fi...
instruction
0
90,344
8
180,688
No
output
1
90,344
8
180,689
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the fi...
instruction
0
90,345
8
180,690
No
output
1
90,345
8
180,691
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the fi...
instruction
0
90,346
8
180,692
No
output
1
90,346
8
180,693
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. There is only one entrance in Petya's house and the distribution of apartments is the following: the fi...
instruction
0
90,347
8
180,694
No
output
1
90,347
8
180,695
Provide tags and a correct Python 3 solution for this coding contest problem. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinct planks can have distinct heights. <image> Fe...
instruction
0
90,451
8
180,902
Tags: brute force, dp Correct Solution: ``` # cf 363 B 1200 n, k = map(int, input().split()) A = [*map(int, input().split())] wsz = 0 wsum = 0 min_ = float("inf") mini = 0 for i in range(len(A)): wsum += A[i] wsz += 1 if wsz > k: wsum -= A[1 + i - wsz] wsz -= 1 if wsum < min_ and wsz ==...
output
1
90,451
8
180,903
Provide tags and a correct Python 3 solution for this coding contest problem. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinct planks can have distinct heights. <image> Fe...
instruction
0
90,452
8
180,904
Tags: brute force, dp Correct Solution: ``` a,b=map(int,input().split());c=list(map(int,input().split()));s=k=sum(c[:b]);j=0 for i in range(1,a-b+1): n=s-c[i-1]+c[i+b-1] if k>n:j=i;k=n s=n print(j+1) ```
output
1
90,452
8
180,905
Provide tags and a correct Python 3 solution for this coding contest problem. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinct planks can have distinct heights. <image> Fe...
instruction
0
90,453
8
180,906
Tags: brute force, dp Correct Solution: ``` n, k = [int(i) for i in input().split()] #int(input()) arr = [int(i) for i in input().split()] acc = 0 for i in range(n): acc += arr[i] arr[i] = acc arr = [0] + arr min_idx = 0 min_br = arr[-1] + 1 for i in range(n-k+1): if arr[k+i] - arr[i] < min_br:...
output
1
90,453
8
180,907
Provide tags and a correct Python 3 solution for this coding contest problem. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinct planks can have distinct heights. <image> Fe...
instruction
0
90,454
8
180,908
Tags: brute force, dp Correct Solution: ``` import os import sys from collections import Counter from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mod...
output
1
90,454
8
180,909
Provide tags and a correct Python 3 solution for this coding contest problem. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinct planks can have distinct heights. <image> Fe...
instruction
0
90,455
8
180,910
Tags: brute force, dp Correct Solution: ``` n,k=map(int,input().split()) l=list(map(int,input().split())) dp=[0]*(n+1) for i in range(n): dp[i+1]=dp[i]+l[i] mn=999999999 ans=-1 for i in range(k,n+1): if(dp[i]-dp[i-k]<mn): mn=dp[i]-dp[i-k] ans=i-k+1 print(ans) ```
output
1
90,455
8
180,911
Provide tags and a correct Python 3 solution for this coding contest problem. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinct planks can have distinct heights. <image> Fe...
instruction
0
90,456
8
180,912
Tags: brute force, dp Correct Solution: ``` n,k = map(int,input().split()) lis = list(map(int,input().split())) ans=[] mi=sum(lis[:k]) su=mi ind=0 for i in range(k,n): su+=lis[i] su-=lis[i-k] if su<mi: ind=i-k+1 mi=su print(ind+1) ```
output
1
90,456
8
180,913
Provide tags and a correct Python 3 solution for this coding contest problem. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinct planks can have distinct heights. <image> Fe...
instruction
0
90,457
8
180,914
Tags: brute force, dp Correct Solution: ``` n,k=map(int,input().split()) a=list(map(int,input().split())) c=[0]*len(a) c[0]=a[0] for i in range(1,n): c[i]=c[i-1]+a[i] mini=c[k-1] h=1 #print(mini) for i in range(k,n): t=mini #print('i',i) mini=min(mini,c[i]-c[i-k]) #print(c[i]-c[i-k]) # print(mini) if mini!=t: h...
output
1
90,457
8
180,915
Provide tags and a correct Python 3 solution for this coding contest problem. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinct planks can have distinct heights. <image> Fe...
instruction
0
90,458
8
180,916
Tags: brute force, dp Correct Solution: ``` n,k=map(int,input().split()) l=list(map(int,input().split())) s=0 d=[0] for i in l: s+=i d.append(s) prev=float('inf') idx=-1 for i in range(k-1,n): s=d[i+1]-d[i-k+1] #print(i,i-k+1,s,d[i+1],d[i-k+1]) if prev>s: prev=s idx=i+1-k+1 print(idx) ```
output
1
90,458
8
180,917
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinc...
instruction
0
90,459
8
180,918
Yes
output
1
90,459
8
180,919
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinc...
instruction
0
90,460
8
180,920
Yes
output
1
90,460
8
180,921
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinc...
instruction
0
90,461
8
180,922
Yes
output
1
90,461
8
180,923
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinc...
instruction
0
90,462
8
180,924
Yes
output
1
90,462
8
180,925
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinc...
instruction
0
90,463
8
180,926
No
output
1
90,463
8
180,927
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinc...
instruction
0
90,464
8
180,928
No
output
1
90,464
8
180,929
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinc...
instruction
0
90,465
8
180,930
No
output
1
90,465
8
180,931
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one after another from left to right. The height of the i-th plank is hi meters, distinc...
instruction
0
90,466
8
180,932
No
output
1
90,466
8
180,933
Provide tags and a correct Python 3 solution for this coding contest problem. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very bored, so you want ...
instruction
0
90,490
8
180,980
Tags: combinatorics, dp Correct Solution: ``` import sys input=sys.stdin.readline def solve(n,st,k): mod=10**9+7 dp=[0]*(n+1) pre=[0]*(n+1) dp[st]=1 for t in range(k): pre[0]=0 for i in range(1,n+1): pre[i]=pre[i-1]+dp[i] pre[i]%=mod for i in range(1,n...
output
1
90,490
8
180,981
Provide tags and a correct Python 3 solution for this coding contest problem. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very bored, so you want ...
instruction
0
90,491
8
180,982
Tags: combinatorics, dp Correct Solution: ``` def solve(n, st, k): MOD = int(1e9 + 7) dp = [0] * (n + 1) prefix_sum = [0] * (n + 1) dp[st] = 1 for times in range(k): prefix_sum[0] = 0 for i in range(1, n + 1): prefix_sum[i] = prefix_sum[i - 1] + dp[i] if prefi...
output
1
90,491
8
180,983
Provide tags and a correct Python 3 solution for this coding contest problem. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very bored, so you want ...
instruction
0
90,492
8
180,984
Tags: combinatorics, dp Correct Solution: ``` def solve(n, st, k): MOD = int(1e9 + 7) prev = [0] * (n + 1) current = [0] * (n + 1) prefix_sum = [0] * (n + 1) prev[st] = 1 for times in range(k): prefix_sum[0] = 0 for i in range(1, n + 1): prefix_sum[i] = prefix_sum[i -...
output
1
90,492
8
180,985
Provide tags and a correct Python 3 solution for this coding contest problem. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very bored, so you want ...
instruction
0
90,493
8
180,986
Tags: combinatorics, dp Correct Solution: ``` #!/usr/bin/env python3 import io import os import sys input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline def printd(*args, **kwargs): #print(*args, **kwargs, file=sys.stderr) #print(*args, **kwargs) pass def get_str(): return input().decode().str...
output
1
90,493
8
180,987
Provide tags and a correct Python 3 solution for this coding contest problem. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very bored, so you want ...
instruction
0
90,494
8
180,988
Tags: combinatorics, dp Correct Solution: ``` from sys import stdin #parser def parser(): return map(int, stdin.readline().split()) #Guardando el valor de 10^9+7 div=pow(10,9)+7 #Recibiendo los valores de n,a,b,k de la entrada n,a,b,k=parser() #Actualizando los valores de a,b y n if a>b: a=n-a+1 n=n-b ...
output
1
90,494
8
180,989
Provide tags and a correct Python 3 solution for this coding contest problem. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very bored, so you want ...
instruction
0
90,495
8
180,990
Tags: combinatorics, dp Correct Solution: ``` def solve(n, st, k): MOD = int(1e9 + 7) dp = [0] * (n + 1) prefix_sum = [0] * (n + 1) dp[st] = 1 for times in range(k): prefix_sum[0] = 0 for i in range(1, n + 1): prefix_sum[i] = prefix_sum[i - 1] + dp[i] if prefi...
output
1
90,495
8
180,991
Provide tags and a correct Python 3 solution for this coding contest problem. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very bored, so you want ...
instruction
0
90,496
8
180,992
Tags: combinatorics, dp Correct Solution: ``` #!/usr/bin/env python3 import io import os import sys input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline def printd(*args, **kwargs): #print(*args, **kwargs, file=sys.stderr) #print(*args, **kwargs) pass def get_str(): return input().decode().str...
output
1
90,496
8
180,993
Provide tags and a correct Python 3 solution for this coding contest problem. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very bored, so you want ...
instruction
0
90,497
8
180,994
Tags: combinatorics, dp Correct Solution: ``` #!/usr/bin/env python3 import io import os import sys input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline def printd(*args, **kwargs): #print(*args, **kwargs, file=sys.stderr) #print(*args, **kwargs) pass def get_str(): return input().decode().str...
output
1
90,497
8
180,995
Provide tags and a correct Python 2 solution for this coding contest problem. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very bored, so you want ...
instruction
0
90,498
8
180,996
Tags: combinatorics, dp Correct Solution: ``` from sys import stdin, stdout from collections import Counter, defaultdict from itertools import permutations, combinations raw_input = stdin.readline pr = stdout.write def in_num(): return int(raw_input()) def in_arr(): return map(int,raw_input().split()) def...
output
1
90,498
8
180,997
Provide tags and a correct Python 2 solution for this coding contest problem. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very bored, so you want ...
instruction
0
90,499
8
180,998
Tags: combinatorics, dp Correct Solution: ``` from sys import stdin, stdout from collections import Counter, defaultdict from itertools import permutations, combinations raw_input = stdin.readline pr = stdout.write def in_num(): return int(raw_input()) def in_arr(): return map(int,raw_input().split()) def...
output
1
90,499
8
180,999
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the f...
instruction
0
90,500
8
181,000
Yes
output
1
90,500
8
181,001
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the f...
instruction
0
90,501
8
181,002
Yes
output
1
90,501
8
181,003
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the f...
instruction
0
90,502
8
181,004
Yes
output
1
90,502
8
181,005
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the f...
instruction
0
90,503
8
181,006
Yes
output
1
90,503
8
181,007
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the f...
instruction
0
90,504
8
181,008
No
output
1
90,504
8
181,009
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the f...
instruction
0
90,505
8
181,010
No
output
1
90,505
8
181,011
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the f...
instruction
0
90,506
8
181,012
No
output
1
90,506
8
181,013
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the f...
instruction
0
90,507
8
181,014
No
output
1
90,507
8
181,015
Provide tags and a correct Python 3 solution for this coding contest problem. There are famous Russian nesting dolls named matryoshkas sold in one of the souvenir stores nearby, and you'd like to buy several of them. The store has n different matryoshkas. Any matryoshka is a figure of volume out_i with an empty space ...
instruction
0
91,004
8
182,008
Tags: binary search, combinatorics, data structures, dp, shortest paths, sortings Correct Solution: ``` from sys import stdin, stdout mod = 10**9+7 n = int(input()) dolls = [] for i in range(n): o, i = map(int, stdin.readline().split()) dolls.append((o, i)) dolls.sort() dolls = [(i, o) for (o, i) in dolls] ...
output
1
91,004
8
182,009