akhauriyash/Code-Regression huggingface dataset:
//NAME-ADITYYA OJHA
                                               /*
                                                      GURU(MENTOR)-AARADHYA
                                               */
/*
 *     Heart beats fast
 *         Colors and promises
 *             How to be brave
 *                 How can I love when I am afraid to fall...
                                             (courtesy-amnesiac_dusk)
 */

#include <bits/stdc++.h>
#define ll long long int
#define forin for(int i=0;i<n;i++)
#define pb push_back
#define vx vector<ll> x
#define vy  vector<ll> y
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define  f   first
#define  s   second
#define mod 1000000007
using namespace std;

/*
check for corner cases(for n==1)
 check for int overflow
 run on some sample cases before submitting
*/

/*FERMAT THEOREM

       pow(x,m-1)%m=1 (x and m are co-prime)
*/
/*MODULAR INVERSE

        pow(x,-1)=pow(x,m-2) (x and m are co-prime)
*/

/*
ll  mode(ll x,ll n,ll mod)
{
    if(n==0)return 1%mod;

    ll u=mode(x,n/2,mod);
    u=(u*u)%mod;
    if(n & 1)u=(u*x)%mod;
}
*/


int main()
{


   ll n;
   cin>>n;
   ll z= n+ n*n + n*n*n;
   cout<<z<<endl;












}


Measured memory_bytes: 3596
s = input().strip()
t = input().strip()
ls = len(s)
lt = len(t)

dp = [[0]*(lt+1) for i in range(ls+1)]

for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j]+1
        else:
            dp[i+1][j+1] = max([dp[i+1][j], dp[i][j+1]])

ans = ''
i, j = ls, lt
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1]+ans
        i -= 1
        j -= 1

print(ans)

Measured memory_bytes: 112476
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/quo.hpp
#ifndef QUO_H
#define QUO_H

/*
a == tools:quo(a, b) * b + tools::mod(a, b)
0 <= tools::mod(a, b) < std::abs(b)
*/

namespace tools {
  template <typename T>
  constexpr T quo(const T lhs, const T rhs) {
    return lhs > 0 ? lhs / rhs : rhs > 0 ? -((-lhs - 1 + rhs) / rhs) : (-lhs - 1 + -rhs) / -rhs;
  }
}

#endif

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// lib/mod.hpp
#ifndef MOD_HPP
#define MOD_HPP


/*
a == tools:quo(a, b) * b + tools::mod(a, b)
0 <= tools::mod(a, b) < std::abs(b)
*/

namespace tools {
  template <typename T>
  constexpr T mod(const T lhs, const T rhs) {
    return lhs - quo(lhs, rhs) * rhs;
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::vector<i64> A(N), B(N);
  for (i64 i = 0; i < N; ++i) {
    std::cin >> A[i] >> B[i];
  }

  i64 answer = 0;
  for (i64 i = N - 1; i >= 0; --i) {
    answer += tools::mod(-(A[i] + answer), B[i]);
  }

  std::cout << answer << std::endl;
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>

#define For(i, j, k) for(int i = j; i <= k; i++)

using namespace std;

const int N = 1e5 + 10;

int A[N], B[N], n;

int main(){

	scanf("%d", &n);
	For(i, 1, n) scanf("%d", &A[i]);

	long long d = 0;
	For(i, 1, n){
		scanf("%d", &B[i]);
		if(A[i] > B[i]) d -= A[i] - B[i];
		else d += (B[i] - A[i]) / 2;
	}
	puts(d < 0 ? "No" : "Yes");

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef set<ll> sl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) v.begin(), v.end()
//bool chmin(ll & a, ll  b) { if (b < a) { a = b; return 1; } return 0; }
//bool chmax(ll & a, ll b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N=500010;
ll N, i, ans=0;
int main() {
  cin >> N >> i;
  cout << N-i+1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
double ans=0;
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        double res=1.0/n;
        for(int j=i;j<k;j*=2)
        {
            ans+=res*0.5;
            res*=0.5;
        }
    }
    printf("%.15lf\n",1.0-ans);
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
LL x[50];

int main() {
    LL K;
    scanf("%lld", &K);
    LL rd = K / 50;
    for (int i = 0; i < 50; i++)
        x[i] = 50 - 1 + rd;
    for (int i = 0; i < (K % 50); i++) {
        int idx = 0;
        for (int j = 0; j < 50; j++)
            if (x[j] <= x[idx]) idx = j;
        for (int j = 0; j < 50; j++) {
            if (j == idx) x[j] += 50;
            else x[j]--;
        }
    }
    printf("%d\n", 50);
    for (int i = 0; i < 50; i++)
        printf("%lld ", x[i]);
    puts("");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int x,n;
    cin>>x>>n;
    if(n==0){
        cout<<x;
    }else{
    int arr[n];
    bool visited[102];
    for(int i=0;i<102;i++){
        visited[i]=false;
    }
    for(int i=0;i<n;i++){
        cin>>arr[i];
        visited[arr[i]]=true;
    }
    int a=x-1,b=x+1;
   
    if(!visited[x]){
        cout<<x;
    }else{
        for(int i=0;i<10000;i++){
            if(!visited[a--]){
                cout<<a+1;
                break;
            }
            if(!visited[b++]){
                cout<<b-1;
                break;
            }
        }
    }
    }
    return 0;
}


Measured memory_bytes: 3628
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strings"
)

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	s := io.Next()
	first := s[0]
	for i := 1; i < len(s); i++ {
		if s[i] != first {
			io.Println("Yes")
			return
		}
	}
	io.Println("No")
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 1772
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD (long long)1000000007
using namespace std;

int main(void){
    long long n,m,money=0,amount=0;
    cin >> n >> m;
    vector< pair<long long,long long> > a(n);
    for(int i=0; i<n; i++){
        cin >> a[i].first >> a[i].second;
    }
    sort(a.begin(),a.end());
    for(int i=0; i<n; i++){
        if(amount>=m)break;
        if(a[i].second+amount>m){
            money+=a[i].first*(m-amount);
            amount=m;
        }else {
            amount+=a[i].second;
            money+=a[i].first*a[i].second;
        }
    }
    cout << money << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int n,m;
    while(cin >> n >> m,n){
        vector<vector<int> > v(n,vector<int>(m));
        rep(i,n)rep(j,m)cin >> v[i][j];
        int ans = 0;
        rep(x1,n)rep(y1,m)rep(x2,n)rep(y2,m){
            if(!(x1+1 < x2 && y1+1 < y2))continue;
            int mi = 1e9;
            for(int i = y1; i <= y2; i++){
                mi = min(mi, v[x1][i]);
                mi = min(mi, v[x2][i]);
            }
            for(int i = x1; i <= x2; i++){
                mi = min(mi, v[i][y1]);
                mi = min(mi, v[i][y2]);
            }
            int ma = 0;
            int sum = 0;
            for(int i = x1+1; i < x2; i++)for(int j = y1+1; j < y2; j++){
                ma = max(ma, v[i][j]);
                sum += mi-v[i][j];
            }
            if(mi > ma) ans = max(ans, sum);
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3076
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <queue>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rrep(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef pair<int,int> P;
const int INF = 1000000000;

int main(){
	int n;
	
	while (true){
		scanf("%d",&n);
		if(n==0)break;
		static int scr[10];
		rep(i,10)scr[i]=0;
		char Huda[114];
		int Ba = 0;
		scanf("%s",Huda);
		
		rep(i,100){
			switch(Huda[i]){
				case 'S':
					Ba += scr[i%n] +1;
					 scr[i%n] = 0;
				break;
				case 'M':
					 scr[i%n]++;
				break;
				case 'L':
					scr[i%n]+=Ba + 1;
					Ba = 0;
				break;
			}
		}
	sort(scr,scr+n);
	rep(i,n)printf("%d ",scr[i]);
	printf("%d\n",Ba);
	}
	return 0;
}

Measured memory_bytes: 1048
import sys
import math
import itertools
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]
#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)

a, b, c, d = na()
l = lcm(c, d)

def n(i):
    return b//i - (a - 1)//i

w = b - a + 1
print(w - n(c) - n(d) + n(l))


Measured memory_bytes: 3064
def b():
    N = int(input())
    A = {i:int(input()) for i in range(1,N+1)}
    tmp = 1; times = 0
    for _ in range(N):
        tmp = A[tmp]; times += 1
        if tmp == 2:
            print(times)
            break
        elif tmp == 1:
            print(-1)
            break
    else:
        print(-1)


b()


Measured memory_bytes: 17892
import java.util.Scanner;

public class Main {

    public static void main(String []args){
        Scanner in = new Scanner(System.in);

        long a = in.nextLong();
        long b = in.nextLong();
        long c = in.nextLong();


        if(a==b && b==c)
        {
            System.out.println("No");
        }
        else{
            if(a==b || b==c || a==c)
            {
                System.out.println("Yes");
            }
            else
            {
                System.out.println("No");
            }
        }

    }

}


Measured memory_bytes: 21716
a,b=gets.split.map(&:to_i)
r0=a
r1=b
a0=1
a1=0
b0=0
b1=1
while(r1>0)
    q1=r0/r1
    r2=r0%r1
    a2=a0-q1*a1
    b2=b0-q1*b1
    r0=r1
    r1=r2
    a0=a1
    a1=a2
    b0=b1
    b1=b2
end
puts "#{a0} #{b0}"


Measured memory_bytes: 6872
import java.io.*;

public class Main {

	static char[] key = new char[100];
	static int[] vari = new int[3];
	static int idx;
	static int cnt;
	
	static int formula(){
		
		if(key[idx]=='0'||key[idx]=='1'||key[idx]=='2'){
			return (int)key[idx]-'0';
		}
		else if(key[idx]=='P'){
			return vari[0];
		}
		else if(key[idx]=='Q'){
			return vari[1];
		}
		else if(key[idx]=='R'){
			return vari[2];
		}
		else if(key[idx]=='-'){
			idx++;
			int tmp = formula();
			return 2-tmp;
		}
		else if(key[idx]=='('){
			idx++;
			int tmp1=formula();
			idx++;
			int op = key[idx];
			idx++;
			int tmp2 =formula();
			idx++;
			if(op=='*'){
				if(tmp1==2&&tmp2==2){
					return 2;
				}
				else if(tmp1>=1&&tmp2>=1){
					return 1;
				}
				else{
					return 0;
				}
			}
			else if(op=='+'){
				if(tmp1==0&&tmp2==0){
					return 0;
				}
				else if(tmp1==2||tmp2==2){
					return 2;
				}
				else{
					return 1;
				}
			}
		}
		return -100;
	}
	
	public static void main(String[] args) throws IOException {
		BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));

		while(true){
			String a = stdIn.readLine();
			key = a.toCharArray();
			if(key[0]=='.'){
				return;
			}
			idx=0;
			cnt=0;
			for(int i=0;i<3;i++){
				for(int j=0;j<3;j++){
					for(int k=0;k<3;k++){
						vari[0]=i;
						vari[1]=j;
						vari[2]=k;
						idx=0;
						int result=formula();
						if(result==2){
							cnt++;
						}
					}
				}
			}
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 9356
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,i,j,d=1;
	cin>>n;
	long long a[1000][1000],b[100000];
	for(i=1;i<=2;i++)
	{
		for(j=1;j<=n;j++)
		cin>>a[i][j];
	}
	for(i=1;i<=n;i++)
	{
		b[i]=0;
		for (j=1;j<=i;j++)
		{
			b[i]+=a[1][j];
		}
		for (j=n;j>=i;j--)
		{
			b[i]+=a[2][j];
		}
	}
	sort(b+1,b+1+n);
	cout<<b[n];
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n;
  cin >> n;
  vector<pll> c(n);
  for(ll i=0;i<n;i++) {
    ll a,b;
    cin >> a >> b;
    c[i]={a,b};
  }
  sort(c.rbegin(),c.rend());
  cout << c[0].first+c[0].second << endl;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		String str[] = br.readLine().split(" ");

		int curNum = 1;
		int ans = 0;

		for (int i = 0; i < n; i++) {
			int a = Integer.parseInt(str[i]);
			if (a == curNum) {
				curNum++;
			} else {
				ans++;
			}
		}
		if (ans == n)
			System.out.println(-1);
		else
			System.out.println(ans);
	}
}

Measured memory_bytes: 50524
// https://atcoder.jp/contests/abc173/tasks/abc173_a
#include <bits/stdc++.h>
using namespace std ;
int main() 
{
    long long n ;
    cin >> n ;
    if (n % 1000 == 0) cout << 0 << endl ;
    else cout << 1000 - (n % 1000) << endl ;
    return 0 ;
}
/*  CODED BY:-
 ___________________________________
|                       ___         |
|  /\   /\  \ /  |  |  |___   |__|  |        
| /~~\ /~~\  |   |__|   ___|  |  |  |
|___________________________________|
 
*/

Measured memory_bytes: 3636
// 以下のソースを勉強する.
// zscoder氏.
// https://atcoder.jp/contests/dp/submissions/3938762
#include <bits/stdc++.h>
using namespace std;
const int MOD = (1e9 + 7);

int add(int a, int b){
    a += b;
    while(a >= MOD) a -= MOD;
    return a;
}

int a[25];
int dp[22][(1 << 21) + 5];

int main(){
    
    // 1. 入力情報取得.
    int N;
    scanf("%d", &N);
    for(int i = 0; i < N; i++){
        int b = 0;
        for(int j = 0; j < N; j++){
            int x;
            scanf("%d", &x);
            if(x) b ^= (1 << j);
        }
        a[i] = b;
    }
    // for(int i = 0; i < N; i++) printf("%d\n", a[i]);
    
    // 2. dp更新.
    dp[0][0] = 1;
    for(int i = 1; i <= N; i++){
        for(int j = 0; j < (1 << N); j++){
            if(__builtin_popcount(j) != i) continue;
            for(int k = 0; k < N; k++){
                int k2 = (1 << k);
                if((j & k2) > 0 && (a[i - 1] & k2) > 0){
                    dp[i][j] = add(dp[i][j], dp[i - 1][j ^ k2]);
                    // printf("dp[%d][%d]=%d a[%d]=%d k2=%d\n", i, j, dp[i][j], i - 1, a[i - 1], k2);
                    // printf("__builtin_popcount(%d)=%d\n", j, __builtin_popcount(j));
                }
            }
        }
    }
    // for(int i = 0; i <= N; i++){
    //     for(int j = 0; j < (1 << N); j++) printf("%d ", dp[i][j]);
    //     printf("\n");
    // }
    
    // 3. 出力.
    printf("%d\n", dp[N][(1 << N) - 1]);
    return 0;
}

Measured memory_bytes: 162048
/*!enjoy karo yaar!*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

#include<bits/stdc++.h>
using namespace std;

#define     int             long long int
#define     fast()          ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)          begin(x),end(x)
#define     rz(x)           resize(x)
#define     asn(x,y)        assign(x,y)
#define     mem(a,b)        memset(a,b,sizeof(a))
#define     sz(x)           ((int)(x.size()))
#define     eb              emplace_back
#define     pb              push_back
#define     pf              push_front
#define     pob             pop_back
#define     pof             pop_front
#define     ins             insert
#define     vi              vector<int>
#define     pii             pair<int,int>
#define     mii             map<int,int>
#define     F               first
#define     S               second
#define     makep           make_pair
#define     maket           make_tuple
#define     remax(a,b)      a=max(a,b)
#define     remin(a,b)      a=min(a,b)
#define     bitcount(x)     __builtin_popcountll(x)
#define     iceil(n,x)      (((n)+(x)-1)/(x))
#define     gcd(a,b)        (__gcd((a),(b)))
#define     lcm(a,b)        ((a)*((b)/gcd((a),(b))))
#define     dbug(x)         cout<<#x<<": "<<(x)<<"\n"
#define     flush           fflush(stdout)
#define     show(x)         for(auto zz:x)cout<<zz<<" ";cout<<"\n";
#define     show2(x)        for(auto zz:x)cout<<zz.F<<" "<<zz.S<<"\n";

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const ld pi=acos(-1);
const ll inf=1e18,M=1e9+7;
const int N=1;

set<pii> st,st2;
vector<pii> v;

vi arr(10,0);

int h,w,n;
int cnt=0;

bool valid(int x,int y)
{
    return (1<=x && x+2<=h && 1<=y && y+2<=w);
}

void batao(int x,int y)
{
    if(!valid(x,y))
        return;

    if(st2.find({x,y})!=st2.end())
        return;

    //cout<<x<<" "<<y<<"..\n";

    st2.ins({x,y});

    int res=0;
    for(int i=x;i<=x+2;++i)
    {
        for(int j=y;j<=y+2;++j)
        {
            if(st.find({i,j})!=st.end())
                ++res;
        }
    }

    ++arr[res];
    ++cnt;
}

int dx[]={0,-1,-2,0,-1,-2,0,-1,-2};
int dy[]={0,0,0,-1,-1,-1,-2,-2,-2};

void calc(int x,int y)      // all pos
{
    for(int i=0;i<9;++i)
        batao(x+dx[i],y+dy[i]);     // start index
}

void solve()
{
    cin>>h>>w>>n;

    int x,y;
    for(int i=0;i<n;++i)
    {
        cin>>x>>y;

        st.ins({x,y});
        v.pb({x,y});
    }

    for(int i=0;i<n;++i)
        calc(v[i].F,v[i].S);

    arr[0]=(h-2)*(w-2)-cnt;
    for(auto c:arr)
        cout<<c<<"\n";
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    for(int z=1;z<=t;++z)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}



Measured memory_bytes: 64852
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {
	if (a > b) a = b;
}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {
	if (a < b) a = b;
}
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;

void test() {
	int n = 50;
	vector<int>A(n);
	REP(_,n){
		print_space(A);
		vector<int>B(n);
		REP(i, n) {
			FOR(j, max(0LL, i - A[i]), min(n, i + A[i] + 1)) {
				B[j]++;
			}
		}
		A = B;
	}
}

void solve() {
	int N, K; cin >> N >> K;
	int n = N;
	vector<int>A(n);
	REP(i, N)cin >> A[i];
	vector<int>B(N);
	REP(_,min((ll)61,K)) {
		REP(i, N)B[i] = 0;
		REP(i, n) {
			int l = max(0LL, i - A[i]), r = min(n, i + A[i] + 1);
			B[l]++;
			if (r < n)B[r]--;
		}
		REP(i, n - 1)B[i + 1] += B[i];
		A = B;
	}
	print_space(A);
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	mt.seed((int)(time(0)));
	//REP(_, 10000)test();
	//int q;
	//cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 6368
#include <stdio.h>
#include<string.h>

int main(void){

    char *s1 = "abc";
    char *s2 = "acb";
    char *s3 = "bac";
    char *s4 = "bca";
    char *s5 = "cab";
    char *s6 = "cba";

    char str[8];
    scanf("%s", str);

    if(strcmp(str,s1)==0){
        printf("Yes\n");
    }else if(strcmp(str,s2)==0){
        printf("Yes\n");
    }else if(strcmp(str,s3)==0){
        printf("Yes\n");
    }else if(strcmp(str,s4)==0){
        printf("Yes\n");
    }else if(strcmp(str,s5)==0){
        printf("Yes\n");
    }else if(strcmp(str,s6)==0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int,int>;
const int MOD = 1000000007;

ll factorial(int n) {
    ll x=1;
    for (int i=1; i<=n; i++) {
        x*=i;
        x%=MOD;
    }
    return x;
}

int main() {
    int n,m,maxi;
    cin>>n>>m;
    int diff=abs(n-m);
    ll ans,sum=n+m,temp;
    if (diff>=2) ans=0;
    else if(diff==1) {
        maxi=max(n,m);
        ans=factorial(maxi)*factorial(sum-maxi);
    } else {
        temp=factorial(n);
        ans=2*temp*temp;
    }
    ans%=MOD;
    cout<<ans<<endl;
}   


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main()
{
	FIO;
	int n, k; cin >> n >> k;
	vi v; v.pb(1);

	mk(arr, n + 1, int);

	for (int i = 1; i <= n; ++i)
		cin >> arr[i];

	int cur = arr[1];
	set<int> vis;
	vis.insert(1);

	while (!vis.count(cur))
	{
		v.pb(cur);
		vis.insert(cur);
		cur = arr[cur];
	}

	int id;

	for (int i = 0; i < v.size(); ++i)
	{
		if (cur == v[i])
		{
			id = i;
			break;
		}
	}

	if (k < id)
	{
		cout << v[k] << '\n';
		return 0;
	}

	vi tmp;

	for (int i = id; i < v.size(); ++i)
		tmp.pb(v[i]);

	v = tmp;
	k -= id;

	n = v.size();
	k %= n;

	cout << v[k] << '\n';
	return 0;
}

Measured memory_bytes: 16564
#include <bits/stdc++.h>
using namespace std;

char insert(int bit,int i){
    if(bit&(1<<i)) return '+';
    else return '-';
}

int main(){
    char s[4];
    cin>>s;
    int p=7;
    int n=strlen(s)-1;
    for(int bit=0;bit<(1<<n);bit++){
        int tmp=s[0]-'0';
        for(int i=0;i<n;i++){
            if(bit&(1<<i)){
                tmp+=s[i+1]-'0';
            }else{
                tmp-=s[i+1]-'0';
            }
        }
        if(tmp==p){
            cout<<s[0]<<insert(bit,0)<<s[1]<<insert(bit,1)<<s[2]<<insert(bit,2)<<s[3]<<"=7"<<endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int,int>;
const int MOD = 1000000007;

int main() {
    int x,a,b;
    cin>>x>>a>>b;
    a=abs(x-a),b=abs(x-b);
    if (a<b) cout<<"A"<<endl;
    else cout<<"B"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <utility>
#include <set>
#include <vector>
#include <functional>
#include <map>
#include <queue>
using namespace std;
int main()
{
  int A,B,C,a,b,c,res=0;
  cin>>A>>B>>C; 
  a=max(max(A,B),C),c=min(min(A,B),C),b=A+B+C-a-c;
  b=a-b,c=a-c;
  res+=b;
  c-=b;
  res+=c%2?c/2+2:c/2;
  cout<<res<<endl;
  //system("pause");
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define ll long long int
#define sci(x) scanf("%d",&x);
#define scl(x) scanf("%lld",&x);
#define scd(x) scanf("%lf",&x);
#define pb(x) push_back(x)
#define FasterIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mkp(x,y) make_pair(x,y)
#define pii pair<int , int>

int main()
{
    int l,r,d,cnt=0;
    cin>>l>>r>>d;
    for(int i=l;i<=r;i++)
    {
        if(i%d==0)
            cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3484
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var gx = int.Parse(line[0]);
            var gy = int.Parse(line[1]);
            var p = int.Parse(Console.ReadLine().Trim());
            var map = putMap(p, gx, gy);
            var dp = goDPpre(map, gx, gy);
            goDP(dp, map, gx, gy);
            if (dp[gx, gy] == 0) Console.WriteLine("Miserable Hokusai!");
            else Console.WriteLine(dp[gx, gy]);
        }
    }
    public static int[,] putMap(int p, int gx, int gy)
    {
        var map = new int[gx + 1, gy + 1];
        for (int i = 0; i < p; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var x1 = int.Parse(line[0]);
            var y1 = int.Parse(line[1]);
            var x2 = int.Parse(line[2]);
            var y2 = int.Parse(line[3]);
            if (x1 == x2) map[x1, Math.Max(y1, y2)] -= 1;
            else map[Math.Max(x1, x2), y1] -= 2;
        }
        return map;
    }
    public static void goDP(int[,] dp, int[,] map, int gx, int gy)
    {
        for (int i = 1; i <= gx; i++)
            for (int j = 1; j <= gy; j++)
            {
                if (map[i, j] == 0) dp[i, j] = dp[i - 1, j] + dp[i, j - 1];
                else if (map[i, j] == -1) dp[i, j] = dp[i - 1, j];
                else if (map[i, j] == -2) dp[i, j] = dp[i, j - 1];
                else dp[i, j] = 0;
            }
    }
    public static int[,] goDPpre(int[,] map, int gx, int gy)
    {
        var dp = new int[gx + 1, gy + 1];
        dp[0, 0] = 1;
        for (int i = 1; i <= gx; i++)
            dp[i, 0] = map[i, 0] < 0 ? 0 : dp[i - 1, 0];
        for (int i = 1; i <= gy; i++)
            dp[0, i] = map[0, i] < 0 ? 0 : dp[0, i - 1];
        return dp;
    }
}



Measured memory_bytes: 9204
#include<bits/stdc++.h>
using namespace std;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V))

vector<string> split(string,string);

//template<typename T>
//void swap(T*,T*);
//char ToUpper (char cX) { return toupper(cX); }

int main()
{
    int x,a,b;
    cin >> x >> a >> b;
    if(abs(x - b) > abs(a - x))
        cout << "A";
    else
        cout <<"B";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int mod = ll(1e9 + 7), N = 1e5 + 5;

int call(int n){
    int c=0;
    while(n%2==0){
        c++;
        n=n>>1;
    }
    return c;
}

int main(){

    int n;cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    int s=0;
    for(int i=0;i<n;i++) s+=call(a[i]);
    cout<<s;

}


Measured memory_bytes: 3628
#!/usr/bin/env python3
import sys
import math

def distsq(Y,Z):
    res = 0
    for y,z in zip(Y,Z):
        res += (y-z)**2
    return res

def solve(N: int, D: int, X: "List[List[int]]"):
    res = 0
    for i in range(len(X)-1):
        for j in range(i+1,len(X)):
            d = distsq(X[i],X[j])
            d2 = math.floor(d**0.5)
            if d == d2**2:
                res += 1
    print(res)




# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    X = [ [ int(next(tokens)) for _ in range(D) ] for _ in range(N) ]  # type: "List[List[int]]"
    solve(N, D, X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;

#define MAX 100

int main(){
	int h,w;
	scanf("%d%d",&h,&w);
	int c[26];
	fill(c,c+26,0);
	for(int i=0;i<h;++i){
		for(int j=0;j<w;++j){
			char a;
			cin>>a;
			++c[a-'a'];
		}
	}
	int s=0,o=0;
	for(int k=0;k<26;++k){
		s+=c[k]/4;
		c[k]%=4;
		if(c[k]%2!=0) ++o;
	}
	if(h%2==0&&w%2==0){
		if(4*s==h*w) printf("Yes\n");
		else printf("No\n");
	}else if(h%2==1&&w%2==1){
		if(4*s<(h-1)*(w-1)||o>1){
			printf("No\n");
		}else printf("Yes\n");
	}else{
		if(h%2==1) swap(h,w);//h even
		if(4*s<h*(w-1)||o>0) printf("No\n");
		else printf("Yes\n");
	}
}

Measured memory_bytes: 256
#include<cstdio>
int main(){
    int l,a,b,c,d;
    scanf("%d %d %d %d %d",&l,&a,&b,&c,&d);
    if((a+c-1)/c>(b+d-1)/d) l-=(a+c-1)/c;
    else l-=(b+d-1)/d;
    printf("%d\n",l);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N,K; cin >>N >>K;

  if(K>(N-1)*(N-2)/2) {
    cout << -1 << endl;
    return 0;
  } else {
    int M = (N-1)*(N-2)/2 - K;
    cout << N-1+M << endl;
    for(int i=1;i<N;i++){
      cout << 1 << " " << i+1 << endl;
    }

    int x=2,y=3;
    while (M>0) {
      cout << x << " " << y << endl;
      y++;
      if(y>N){
        x++;
        y=x+1;
      }
      M--;
    }
  }
  return 0;
}


Measured memory_bytes: 256
s = list(input())
ans = [-1,-1]
for i in range(len(s) -1):
    if s[i] == s[i + 1]:
        ans = [i+1,i+2]
for i in range(len(s) -2):
    if s[i] == s[i+2]:
        ans = [i+1,i+3]
print(" ".join(map(str,ans)))

Measured memory_bytes: 71704
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
int main(){
    ios::sync_with_stdio(false);
    int s;
    cin >> s;
    vector<mint> fact(2001);
    fact[0] = 1;
    for(int i = 1; i <= 2000; i++) {
        fact[i] = fact[i-1]*i;
    } 
    mint ans = 0;
    for(int g = 1; g <= s/3; g++) {
        ans += fact[s-3*g+g-1]/(fact[g-1]*fact[s-3*g]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3668
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		FastScanner in = new FastScanner(System.in);
		int a = in.nextInt();
		int b= in.nextInt();
		int c= in.nextInt();
		
		if(c>=a&&c<=b){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
		
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer("");
		}

		public double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		public String next() throws IOException {
			if (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
				return next();
			}
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, k;
  cin >> n >> k;

  vector<int> a(n);
  vector<int> counter(300000, 0);

  int uniqC = 0;

  for (int i = 0; i < n; i++) {
    int ai;
    cin >> ai;

    a[i] = ai;

    if (counter.at(ai) == 0) uniqC++;

    counter.at(ai)++;
  }

  sort(counter.begin(), counter.end());

  int ans = 0;

  int req = uniqC - k;
  for (int i = 0; req > 0; i++) {
    ans += counter.at(i);
    if (counter.at(i) != 0) req--;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2176
/*COMPETITIVE PROGRAMMING C++ TEMPLATE */
 
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <iomanip>
 
#define all(x) x.begin(), x.end()
#define MOD 1000000007
 
const long double PI = 3.141592653589793236L;
 
typedef long long int ll;
typedef long double ld;
 
using namespace std;
 
void solve()
{
    int N;
    cin >> N;

    vector<ll> A(N);
    vector<ll> B(N);

    for(int i = 0; i < N; i++)
    {
        cin >> A[i] >> B[i];
    }

    sort(all(A));
    sort(all(B));

    ld m1 = 0;
    ld m2 = 0;

    if(N & 1)
    {
        m1 = A[N / 2];
        m2 = B[N / 2];
    }
    else {
        m1 = (1.0) * (A[N / 2] + A[(N - 1) / 2]) / 2;
        m2 = (1.0) * (B[N / 2] + B[(N - 1) / 2]) / 2;
    }

    if(N % 2 == 0)
        cout << (ll) (2 * (m2 - m1) + 1) << endl;
    else {
        cout << (ll) (m2 - m1 + 1) << endl;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int T = 1;
    //cin >> T;
    
    while (T--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 6356
#include<iostream>

using namespace std;

int main(){
int a[3];
 for(int i=0;i<3;i++){
 cin>>a[i];
 }
if(a[0]==a[1]&&a[0]==a[2]){
cout<<"No";
  return 0;
}
 if(a[0]!=a[1]&&a[0]!=a[2]&&a[1]!=a[2]){
 cout<<"No";
 return 0;
 }
cout<<"Yes";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>

#define pb push_back
#define rep(i, a, n) for(int (i)=a; (i)<(n); (i)++)
#define FOR(i, n) rep(i, 0, n)
#define F(n) FOR(i, n)
#define FF(n) FOR(j, n)
#define repi(i, a, n) for(int (i)=a; (i)<=(n); (i)++)
#define FORI(i, n) repi(i, 1, n)
#define FI(n) FORI(i, n)
#define FFI(n) FORI(j, n)
#define IN(x) int x; cin>>(x);
#define SIN(x) string x; cin>>(x);
#define INN(x, y) int x, y; cin>>(x)>>(y);
#define INFO(a) cout<<"info "<<a<<endl
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define vpii vector<pair<int, int> >
#define sortv(x) sort((x).begin(), (x).end())
#define sortvd(x) sort((x).begin(), (x).end(), greater<int>())
#define lboundv(x,v) lower_bound((x).begin(),(x).end(),(v))-(x).begin();
#define uboundv(x,v) upper_bound((x).begin(),(x).end(),(v))-(x).begin();
#define ite iterator
#define fi first
#define se second
#define mems(a, v) memset((a), (v), sizeof((a)))
#define lmid(l, r) ((l)+(r)-1)/2
#define rmid(l, r) ((l)+(r))/2+1
#define mp make_pair

typedef long long ll;
typedef long double LD;

using namespace std;

#define N 100005

ll solve(int a) {
    ll ans = 0;
    while(!(a&1)) {ans++; a>>=1;}
    return ans;
}

int main() {
	ios::sync_with_stdio(0);
    IN(n);
    vi a(n);
    F(n) cin>>a[i];
    ll ans=0;
    F(n) {
        ans += solve(a[i]);
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main(){
  
  int N;
  cin >> N;
  
  vector<tuple<string, int, int>> sp(N);
  for(int i = 0; i < N; ++i){
  
    string s;
    int p;
    cin >> s >> p;
    sp.at(i) = make_tuple(s, -p, i+1);
    
  }
  
  sort(sp.begin(), sp.end());
  
  for(int i = 0; i < N; ++i){
  
    cout << get<2>(sp.at(i)) << endl;
  
  }
  
  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int aa[5001], ba[5001];
short dp[5001][5001];

int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	for (int i = 1; i <= a; i++){
		scanf("%d", &aa[i]);
	}
	for (int i = 1; i <= b; i++){
		scanf("%d", &ba[i]);
	}
	
	for (int i = 1; i <= a; i++){
		for (int j = 1; j <= b; j++){
			if (aa[i] == ba[j]){
				dp[i][j] =  dp[i - 1][j - 1] + 1;
			}
			//dp[i][j] = max(dp[i][j], dp[i - 1][j]);
			else dp[i][j] = dp[i - 1][j];
		}
	}
	
	short maxi = 0;
	for (int i = 0; i <= a; i++){
		for (int j = 0; j <= b; j++){
			//printf("%2d", dp[i][j]);
			
			maxi = max(maxi, dp[i][j]);
		}
		//puts("");
	}
	
	printf("%d\n", maxi);
	
	return 0;
}

Measured memory_bytes: 50072
#include<bits/stdc++.h>
using namespace std;
struct pr{int p,y;};

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,m; cin>>n>>m;
	vector<vector<int>>a(n+1);
	vector<pr>b(m);
	for(int i=0;i<m;++i){
		int p,y; cin>>p>>y;
		a.at(p).emplace_back(y);
		b.at(i).p=p,b.at(i).y=y;
	}
	for(auto&&i:a)sort(i.begin(),i.end());
	unordered_map<int,int>mp;
	for(int i=1;i<a.size();++i){
		for(int j=0;j<a.at(i).size();++j){
			mp[a.at(i).at(j)]=j+1;
		}
	}
	for(auto&&i:b)cout<<setfill('0')<<setw(6)<<i.p<<setfill('0')<<setw(6)<<mp.at(i.y)<<"\n"s;
}

Measured memory_bytes: 12196
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include<cstring>
#define max(x,y) x>y?x:y
using namespace std;
const int maxn=1011111;
int f[maxn];
int d[maxn];
int find(int x)
{
    if(f[x]==x)
        return x;
 
    int r=find(f[x]);
    d[x]=d[f[x]]+d[x];
 
    return f[x]=r; 
}
 
 
int fix(int x,int y,int z)
{
    int fx=find(x);
    int fy=find(y);
    if(fx==fy)
        return z==d[y]-d[x];
    f[fy]=fx;
    d[fy]=d[x]+z-d[y];
    return 1;
}
int main()
{
    int n,m;
    int lose=1;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        f[i]=i;
    for(int i=1;i<=m;i++)
    {
        int x,y,z;
        cin>>x>>y>>z;
 
        if(lose)
            lose=fix(x,y,z);
 
    }
 
    if(lose)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



int main(){
    int a,b;
    cin >> a >> b;
    int ans = 0;
    int x = 1;
    while(x<b){
        x+=a-1;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
	int k, x;
	cin >> k >> x;
	long long ans;
	ans = x-(k-1);
	for (int i = 0; i < k*2-1; i++) {
		cout << ans << " ";
		ans++;
	}
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

N = int(input())
T,A = inpl()
HH = inpl()

temp = [[T-0.006*H,i] for i,H in enumerate(HH)]
temp.sort()

ans = -1
MIN = INF
for i,[t,ind] in enumerate(temp):
    if MIN > abs(t-A):
        ans = ind
        MIN = abs(t-A)
print(ans+1)


Measured memory_bytes: 4580
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll, ll>;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0}, dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	ll n;
	cin >> n;
	repl(i, 1, 3501) {
		repl(j, 1, 3501) {
			ll a = i * j * n, b = 4 * i * j - j * n - i * n;
			if (b == 0) continue;
			if (a % b == 0 and a / b > 0) {
				cout << i << " " << j << " " << a / b << endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 1<<29
#define linf (1e16)
#define eps (1e-8)
#define Eps (1e-12)
#define mod 1000000007
#define pi acos(-1.0)
#define phi (1.0+sqrt(5.0))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define pld(a) printf("%.10Lf\n",(ld)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define Unique(v) v.erase(unique(all(v)),v.end())
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<pii> vpi;

bool board[8][8]={};
bool r[8]={},c[8]={},dpos[15]={},dneg[15]={};

void print(){
  FOR(i,0,8){
    FOR(j,0,8){
      cout<< (board[i][j] ? 'Q' : '.');
    }
    cout<<endl;
  }
}

void put(int i){
  if(i==8){
    print();
    return;
  }
  if(r[i])put(i+1);
  else {
    FOR(j,0,8){
      if(c[j] || dpos[i+j] || dneg[i-j+7])continue;
      r[i]=true;c[j]=true;dpos[i+j]=true;dneg[i-j+7]=true;
      board[i][j]=true;
      put(i+1);
      r[i]=false;c[j]=false;dpos[i+j]=false;dneg[i-j+7]=false;
      board[i][j]=false;
    }
  }
}

int main()
{
  int k,a,b;
  cin>>k;
  FOR(i,0,k){
    cin>>a>>b;
    board[a][b]=true;
    r[a]=true;c[b]=true;dpos[a+b]=true;dneg[a-b+7]=true;
  }
  put(0);
  return 0;
}


Measured memory_bytes: 3100