akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;

ll INF = 114514191919119;

ll a[55], b[55], c[55], d[55];

int main(){

    ll N, M; cin >> N >> M;

    for(ll i = 0; i < N; i++){
        cin >> a[i] >> b[i];
    }

    for(ll i = 0; i < M; i++){
        cin >> c[i] >> d[i];
    }


    for(ll i = 0; i < N; i++){
        ll p = 1;
        ll dis = INF;
        for(ll j = 0; j < M; j++){

            ll tmp = abs(a[i] - c[j]) + abs(b[i] - d[j]);

            if(tmp < dis){
                dis = tmp;
                p = j;
            }
        }
        cout << p + 1 << endl;
    }

}

Measured memory_bytes: 384
#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <assert.h> /*確認*/
#include <ctype.h>  /*文字操作*/
#include <stdbool.h>/*bool型の利用*/

//abc156-1
//date 03/05

int main(void)
{
  int N;
  int R;
  scanf("%d %d", &N, &R);

  if (N < 10) {
    R += 100 * (10 - N);
  }

  printf("%d\n", R);
  return 0;
}


Measured memory_bytes: 128
//ΔAGC026D
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 111;
const int MO = 1e9+7;
const int inf = 2e9;
int mul(int x,int y){
	return (LL)x*y%MO;
}
int fpow(int x,int y=MO-2){
	if(!y)
		return 1;
	LL z=fpow(x,y>>1);
	z=mul(z,z);
	if(y&1)
		return mul(z,x);
	return z;
}
int n,h[N],f[N][N],g[N][N];
void solve(int w,int l,int r){
	int i,j,x=inf,y=0;
	for(i=l;i<=r;i=i+1)
		x=min(x,h[i]),y=max(y,h[i]);
	if(x==y){
		f[l][r]=fpow(2,x-w-1);
		g[l][r]=(fpow(2,r-l+1)-2+f[l][r]*2%MO)%MO;
		return;
	}
	f[l][r]=1;
	g[l][r]=1;
	for(i=l;i<=r;i=i+1){
		if(h[i]==x){
			g[l][r]=mul(g[l][r],2);
			continue;
		}
		for(j=i;j<=r&&h[j+1]>x;j=j+1);
		solve(x,i,j);
		f[l][r]=mul(f[l][r],f[i][j]*2);
		if(i==j)
			g[l][r]=mul(g[l][r],g[i][j]*2);
		else
			g[l][r]=mul(g[l][r],g[i][j]+f[i][j]*2%MO);
		i=j;
	}
	g[l][r]=(g[l][r]-f[l][r]*2%MO+MO)%MO;
	f[l][r]=mul(f[l][r],fpow(2,x-w-1));
	g[l][r]=(g[l][r]+f[l][r]*2%MO)%MO;
	//cout<<l<<' '<<r<<' '<<f[l][r]<<' '<<g[l][r]<<endl;
}
int main()
{
	int i;
	cin>>n;
	for(i=1;i<=n;i=i+1)
		cin>>h[i];
	solve(0,1,n);
	cout<<g[1][n];
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
 
int isPrime(int a)
{
int i;for(i=2; i*i<=a; i++)
 if(a%i==0)
 return 0;
 return (a>1?1:0);
}
 
int main(void)
{
  int n, i, ans=0;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    int num;
    scanf("%d",&num);
    ans += isPrime(num);
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 2064
#include<stdio.h>
#include<math.h>

int main(void){
  int n,ins,counter,total;
  scanf("%d",&n);
  total = 0;
  counter = 0;
  ins = n;
  while(ins!=0){
    total += ins % 10;
    ins = floor(ins/10);
    
    counter++;
  }
  if(n%total==0){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}

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

using namespace std;

long long inf=1000000007;

int main(){
	long long n,k;
	string s;
	cin>>n>>k>>s;
	vector<pair<long long,long long>> line;

	int now;
	int cnt=0;
	for(int i=0;i<n;i++){
		int hoge=s.at(i)-'0';

		if(i==0){
			now=hoge;
			cnt++;
			continue;
		}

		if(now!=hoge){
			line.push_back(make_pair(now,cnt));
			cnt=1;
			now=hoge;
		}else{
			cnt++;
		}
	}
	line.push_back(make_pair(now,cnt));

	long long zero=0;
	vector<long long> Z;

	for(int i=0;i<(int)line.size();i++){
		if(line.at(i).first==0){
			zero++;
			Z.push_back(i);
		}
	}

	if(zero<=k){
		cout<<n<<endl;
		return 0;
	}

	long long ans=0;
	for(int i=0;i<k;i++){
		int pos=Z.at(i);

		if(i==0){
			if(pos>0){
				ans+=line.at(pos-1).second;
			}
		}

		ans+=line.at(pos).second;
		if(pos<(int)line.size()-1){
			ans+=line.at(pos+1).second;
		}
	}

	long long pre=ans;

	for(int i=k;i<(int)Z.size();i++){
		int r=Z.at(i);
		int l=Z.at(i-k);

		pre-=line.at(l).second;
		if(l>0) pre-=line.at(l-1).second;

		pre+=line.at(r).second;
		if(r<(int)line.size()-1) pre+=line.at(r+1).second;

		ans=max(ans,pre);
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 2928
s = input()

f = "keyence"
h = 0
n = len(s)
for i in range(8):

    first = f[:i+1]
    second = f[i+1:]
    check = len(first)
    find1 = s.find(first)
    find2 = s.find(second,n-len(second))

    if i!=7:
        if find1!=0:
            continue

        if find2==-1:
            continue

        if find2+len(second)!=n:
            continue

        else:
            print("YES")
            h = 1
            break

    else:
        if find1 == 0 or find1+len(first) == n :
            print("YES") 
            h = 1
            break



if h == 0:
    print("NO")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;

int main(){
    int n, k;
    cin >> n >> k;
    int ans = 0;
    rep(i, n){
        int h;
        cin >> h;
        ans += (h >= k);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

int n, a, b, c, d;
string s;

int main() {
	cin >> n >> a >> b >> c >> d >> s;
	a--; b--; c--; d--;
	
	bool f = true;
	incID(i, a, b) { f &= (s.substr(i, 2) != "##"); }
	incID(i, c, d) { f &= (s.substr(i, 2) != "##"); }
	
	if(d < c) {
		bool g = false;
		incII(i, b, d) { g |= (s.substr(i - 1, 3) == "..."); }
		f &= g;
	}
	
	cout << (f ? "Yes" : "No") << endl;
	
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl



int main(){
    int w,a,b;
    cin>>w>>a>>b;
    if(a+w>=b && b+w>=a)cout<<0<<endl;
    else if(a>b)cout<<a-b-w<<endl;
    else cout<<b-a-w<<endl;
    return 0;
}


Measured memory_bytes: 256
_, *C = open(0).readlines()
C = set(C)
xs = [" %d\n" % i for i in range(1, 14)]
ans = []
for s in "SHCD":
    for x in xs:
        card = s+x
        if card not in C:
            ans.append(card)
open(1, 'w').writelines(ans)


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

int main() {
#ifdef LOCAL_DEFINE
  //freopen("data.in", "rt", stdin);
  //freopen("data.out", "w", stdout);
  auto _start = chrono::high_resolution_clock::now();
#endif
	
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	string s;
	cin >> s;
	int n = s.length();
	bool ok = s[0] == '1' && s[n - 1] == '0';
	for(int i = 0; i <= n - 2; i++) {
		ok &= s[i] == s[n - 2 - i];
	}
	if(!ok) {
		cout << "-1\n";
	} else {
		vector<int> body;
		for(int i = 0; i < n; i++) {
			if(s[i] == '1') {
				body.push_back(i);
			}
		}
		int k = body.size();
		for(int i = 1; i <= k; i++) {
			cout << i << ' ' << i + 1 << '\n';
		}
		for(int i = 1, x = k + 2; i < k; i++) {
			for(int j = 0; j < body[i] - body[i - 1] - 1; j++) {
				cout << i + 1 << ' ' << x++ << '\n';
			}
		}
	}

#ifdef LOCAL_DEFINE
  auto _end = chrono::high_resolution_clock::now();
  cerr << "elapsed time: " << chrono::duration<double, milli>(_end - _start).count() << " ms\n";
#endif
	return 0;
}

Measured memory_bytes: 1992
function parseInt(x) parse(Int, x) end


nt = readline() |> split |> x -> parseInt.(x)
min = 1001
for i in 1:nt[1]
	ct = readline() |> split |> x -> parseInt.(x)
	if ct[2] <= nt[2] && ct[1] < min
		min = ct[1]
	end
end
if min >= 1001
	print("TLE")
else
	print(min)
end


Measured memory_bytes: 172524
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    int h,n;
    cin >> h >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int sum = accumulate(ALL(a),0);
    if(sum >= h) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main()
{
  int R[200000];
  int n, i, maxv = -1000000000, minv;

  scanf("%d", &n);

  for(i=0;i<n;i++){
    scanf("%d", &R[i]);
  }

  minv = R[0];
  for(i=1;i<n;i++){
    if(maxv < R[i] - minv) maxv = R[i] - minv;
    if(minv > R[i]) minv = R[i];
  }

  printf("%d\n", maxv);

  return 0;
}
  



Measured memory_bytes: 2632
import java.util.*

fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val a = IntArray(N) { if (it == 0) -1 else readLine()!!.toInt() - 1 }
    val children = Array(N) { ArrayList<Int>() }

    for (i in 1 until a.size) {
        children[a[i]].add(i)
    }

    fun dfs(v: Int): Int{
        val depth = ArrayList<Int>()

        for (u in children[v]) {
            depth.add(dfs(u))
        }

        depth.sortByDescending { it }

        return depth.mapIndexed { index, d -> d + index + 1 }.max() ?: 0
    }

    println(dfs(0))
}


Measured memory_bytes: 85444
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
/* Coding Space*/
int main(){
  int n; cin >> n;
  string sn = to_string(n);
  int mid  = 0;
  rep(i,sn.size())
    mid += sn[i] -  '0';
  //cerr << mid << " " << sn<< endl;
  if(n % mid == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
using Yorukatsu017.Questions;
using Yorukatsu017.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Yorukatsu017.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var n = inputStream.ReadInt();
            var s = inputStream.ReadLine();

            yield return s.Contains('Y') ? "Four" : "Three";
        }
    }
}


namespace Yorukatsu017
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace Yorukatsu017.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace Yorukatsu017.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13268
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

const string YES = "Yes";
const string NO = "No";

void solve(string S, string T) {
  bool pred = equal(ALL(S), T.begin());
  cout << (pred ? YES : NO) << endl;
}

int main() {
  string S;
  cin >> S;
  string T;
  cin >> T;
  solve(S, T);
  return 0;
}


Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>
#include<string>
#include<cstring>
#include<cmath>
#include<sstream>
using namespace std;
int  main()
{
	int n;
	cin>>n;
	while(n--)
	{
		string s,t;
		cin>>s>>t;
		int num=0;
		for(int i=0;i<s.size();i++)
		{
			if(s[i]=='m')
			{
				if(i-1>=0&&'2'<=s[i-1]&&s[i-1]<='9')
				{
					num+=1000*(s[i-1]-'0');
				}
				else
				{
					num+=1000;
				}
			}
			else if(s[i]=='c')
			{
				if(i-1>=0&&'2'<=s[i-1]&&s[i-1]<='9')
				{
					num+=100*(s[i-1]-'0');
				}
				else
				{
					num+=100;
				}
			}
			else if(s[i]=='x')
			{
				if(i-1>=0&&'2'<=s[i-1]&&s[i-1]<='9')
				{
					num+=10*(s[i-1]-'0');
				}
				else
				{
					num+=10;
				}
			}
			else if(s[i]=='i')
			{
				if(i-1>=0&&'2'<=s[i-1]&&s[i-1]<='9')
				{
					num+=(s[i-1]-'0');
				}
				else
				{
					num+=1;
				}
			}
		}
		//cout<<num<<endl;
		for(int i=0;i<t.size();i++)
		{
		if(t[i]=='m')
		{
			if(i-1>=0&&'2'<=t[i-1]&&t[i-1]<='9')
			{
				num+=1000*(t[i-1]-'0');
			}
			else
			{
				num+=1000;
			}
		}
		else if(t[i]=='c')
		{
			if(i-1>=0&&'2'<=t[i-1]&&t[i-1]<='9')
			{
				num+=100*(t[i-1]-'0');
			}
			else
			{
				num+=100;
			}
		}
		else if(t[i]=='x')
		{
			if(i-1>=0&&'2'<=t[i-1]&&t[i-1]<='9')
			{
				num+=10*(t[i-1]-'0');
			}
			else
			{
				num+=10;
			}
		}
		else if(t[i]=='i')
		{
			if(i-1>=0&&'2'<=t[i-1]&&t[i-1]<='9')
			{
				num+=(t[i-1]-'0');
			}
			else
			{
				num+=1;
			}
		}
		}
	//cout<<num<<endl;
	string ans;
	stringstream ss;
	if(num/1000>=1)
	{
		if(num/1000>1)
		{
			ss<<num/1000;
			ans+=ss.str();
		}
		ans+='m';
		num%=1000;
	}
	//ss.clear();
	if(num/100>=1)
	{
		if(num/100>1)
		{
			stringstream ss;
			ss<<num/100;
			ans+=ss.str();
		}
		ans+='c';
		num%=100;
	}
	//ss.clear();
	if(num/10>=1)
	{
		if(num/10>1)
		{
			stringstream ss;
			ss<<num/10;
			ans+=ss.str();
		}
		ans+='x';
		num%=10;
	}
	//if(!ss.empty())ss.clear();
	if(num>=1)
	{
		if(num>1)
		{
			stringstream ss;
			ss<<num;
			ans+=ss.str();
		}
		ans+='i';
		//num%=100;
	}
	//ss.clear();
	cout<<ans<<endl;
	}
	return 0;
}

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	int a,b;
	cin >> a >> b;
	if(a == b){
		ANS(a + b);
	}else{
		ANS(max(a, b) * 2 - 1);
	}
	return 0;
}


Measured memory_bytes: 256
x,y = map(int,input().split())
if (x + y) % 3 != 0:
    print(0)
    exit()
if min(x,y) * 2 < max(x,y):
    print(0)
    exit()
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
            result %= (10 ** 9 + 7)

    return result

num = (x + y) // 3
print(cmb(num,min(x,y)-num)%(10 ** 9 + 7))

Measured memory_bytes: 44020
x1, y1, x2, y2 = map(int, input().split())
dx = x2 - x1
dy = y2 - y1
x3 = x2 - dy
y3 = y2 + dx
x4 = x1 - dy
y4 = y1 + dx
print(x3, y3, x4, y4)

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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V)                                                           \
    for (auto v : (V))                                                         \
        cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */

int main() {
    /* code */
    int N, K;
    cin >> N >> K;
    vector<int> Ans(N, -1);
    REP(i, K) {
        int d;
        cin >> d;
        REP(j, d) {
            int hito;
            cin >> hito;
            hito--;
            Ans[hito]++;
        }
    }
    int res = 0;
    for (auto re : Ans) {
        if (re == -1) {
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̒萔 (10��9��)
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() {
    string s, t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;

    if (s == u)
        a--;
    if (t == u)
        b--;

    cout << a << " " << b << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

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

using namespace std;

template <typename T>
class seg {
	T t;
	using N = typename T::N;
	using F = typename T::F;
	vector<N> nt;
	vector<F> ft;
	void eval(int p, int l, int r) {
		if (ft[p] == t.IF)
			return;
		nt[p] = t.FN(ft[p], r - l, nt[p]);
		if (l + 1 < r) {
			t.FF(ft[p], ft[p + 1]);
			t.FF(ft[p], ft[p + (r - l & -2)]);
		}
		ft[p] = t.IF;
	}
	N init(N n, int p, int l, int r) {
		if (l + 1 == r)
			return nt[p] = n;
		int m = (l + r) / 2;
		return nt[p] = t.NN(init(n, p + 1, l, m), init(n, p + (r - l & -2), m, r));
	}
	N upd(int a, int b, F f, int p, int l, int r) {
		eval(p, l, r);
		if (b <= l || r <= a)
			return nt[p];
		if (a <= l && r <= b)
			return t.FN(ft[p] = f, r - l, nt[p]);
		int m = (l + r) / 2;
		return nt[p] = t.NN(upd(a, b, f, p + 1, l, m), upd(a, b, f, p + (r - l & -2), m, r));
	}
	N get(int a, int b, int p, int l, int r) {
		if (b <= l || r <= a)
			return t.IN;
		eval(p, l, r);
		if (a <= l && r <= b)
			return nt[p];
		int m = (l + r) / 2;
		return t.NN(get(a, b, p + 1, l, m), get(a, b, p + (r - l & -2), m, r));
	}
public:
	const int s;
	seg(int s) :s(s), nt(s * 2 - 1, t.IN), ft(s * 2 - 1, t.IF) {}
	seg(int s, N n) :seg(s) {
		init(n, 0, 0, s);
	}
	void upd(int a, int b, F f) {
		upd(a, b, f, 0, 0, s);
	}
	N get(int a, int b) {
		return get(a, b, 0, 0, s);
	}
};
struct L {
	typedef long N, F;
	const N IN = 0;
	const F IF = 0;
	N NN(N m, N n) { return max(m, n); }
	N FN(F f, int, N n) { return f + n; }
	void FF(F f, F &g) { g += f; }
};
vector<pair<int, int>> s[222222];
int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int l, r, a;
		scanf("%d%d%d", &l, &r, &a);
		s[r].emplace_back(l, a);
	}
	seg<L> t(n + 1);
	for (int i = 1; i <= n; i++) {
		t.upd(i, i + 1, t.get(0, i));
		for (auto p : s[i])
			t.upd(p.first, i + 1, p.second);
	}
	cout << t.get(0, n + 1) << endl;
	return 0;
}


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

int main()
{
    int n, rem;
    string res;
    cin >> n;
    rem = n >= 10 ? n % 10 : n;
    
    if(rem == 3)
    {
        cout << "bon" << "\n";
    } else if(rem == 2 || rem == 4 || rem == 5 || rem == 7 || rem == 9)
    {
        cout << "hon" << "\n";
    } else 
    {
        cout << "pon" << "\n";
    }
    return 0;
}

Measured memory_bytes: 3596
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception{
		new Main(new Scanner(System.in), System.out, System.err).exec();
	}
	public final Scanner sc;
	public final PrintStream out, err;
	public Main(final Scanner sc, final PrintStream out, final PrintStream err) {
		this.sc = sc;this.out = out;this.err = err;
	}
	static public final long pair(int a, int b) {return (((long)a) << 32) + b;}
	static public final int getPair1(long v) {return (int)(v >> 32);}
	static public final int getPari2(long v) {return (int)(v & 0xFFFFFFFF);}

	static public final long quad(long a, long b, long c, long d) {
		return ((a&0xFFFF)<< 48) + ((b&0xFFFF)<< 32) + ((c&0xFFFF)<< 16) +(d&0xFFFF);}
	static public final int getQuad1(long v) {return (int)( v >> 48          );}
	static public final int getQuad2(long v) {return (int)((v >> 32) & 0xFFFF);}
	static public final int getQuad3(long v) {return (int)((v >> 16) & 0xFFFF);}
	static public final int getQuad4(long v) {return (int)( v        & 0xFFFF);}

	static public final long record(int e, int m, int i) {
		return quad(-1, e, m, i);
	}
	static public final int re(long record) {
		return getQuad2(record);
	}
	static public final int rm(long record) {
		return getQuad3(record);
	}
	static public final int ri(long record) {
		return getQuad4(record);
	}

	//------------------------------------------

	private int p;
	private int[] inv;
	private int[] fact;
	private int[] finv;
	public final int mod(long v) {
		v %= p;
		return (int)(v < 0 ? v+p : v);
	}
	public final int mul(long a, long b) {
		return mod(a*b);
	}
	public final void initFact(double limit, double p) {
		initFact((int)limit, (int)p);
	}
	public final void initFact(int limit, int p) {
		this.p = p;
		this.inv = new int[limit+1];
		this.fact = new int[limit+1];
		this.finv = new int[limit+1];
		fact[1] = finv[1] = inv[0] = inv[1] = 1;
		for(int i=2;i<=limit;i++) {
			int a = p / i;
			int b = p % i;
			inv[i]  = mul(-a, inv[b]);
			fact[i] = mul(fact[i-1], i);
			finv[i] = mul(finv[i-1], inv[i]);
		}
	}
	public final int comb(int m, int n) {
		return mul(mul(fact[m], finv[n]), finv[m-n]);
	}
	//------------------------------------------
	static long lcm (long a, long b) {
		long temp;
		long c = a;
		c *= b;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return (long)(c/b);
	}

	//------------------------------------------


	public void exec() throws Exception{
		final int X = sc.nextInt();
		int n=0;
		while(true) {
			if(judge(X+n)) {
				out.println(X+n);
				return;
			}
			n++;
		}
	}
	private boolean judge(int x) {
		if(x==2||x==3) {
			return true;
		}
		for(int i=2;i<=x/2;i++) {
			if(x%i==0) {
				return false;
			}
		}
		return true;
	}

}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL<<60;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,m,n) for(int i=m;i<n;i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const ll MOD =10e8+7;

// 配列tmpのstart ~ start+numでの要素を足し合わせる
ll sum(ll start ,ll num){
    return num*(start+start+num-1)/2;
}

int main(){
    ll N,K;
    cin >>N>>K;
    ll ans=0;
    REP2(i,K,N+2){
        ll tmp=sum(N-i+1,i)-sum( 0,i)+1;
        // cout<<i<<" "<<sum(N-i+1,i)<<" "<<sum( 0,i)<<" "<<tmp<<endl;
        // if(ans+tmp<0){
        //     cout<<tmp<<endl;
        //     cout<<i<<ans<<endl;
        //     break;
        // }
        ans+=tmp;
        
    }
    // cout<<MOD<<endl;
    cout<<ans%MOD<<endl;
    
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <cassert>

using namespace std;

int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int count_odd = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x % 2 == 1) {
            count_odd++;
        }
    }
    if (count_odd % 2 == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority queue
#include<deque>//double_ended queue
using namespace std;
int main()
{ 
    int n,k;
    cin>>n>>k;
    //i=bとしてaを考える。最大は(k,n)
    long long int ans=0;
    int q=0;//商
    int r=0;//余り
    for(int i=k+1;i<=n;i++){
        q=n/i;
        r=n%i;
        if(k>0){if(r>=k){ans=ans+r-k+1;}}
        else{ans=ans+r;}
        ans=ans+q*(i-k);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n, m=2;
    string s;
    bool b=true;
    cin>>s;
    n=s.length();
    if(s[0]=='0'||s[n-1]=='1')b=false;
    for(int i=0;i<n-1;i++){
        if(s[i]!=s[n-2-i])b=false;
    }
    if(!b){
        cout<<-1<<endl;
        return 0;
    }
    cout<<"1 2"<<endl;
    for(int i=2;i<n;i++){
        cout<<m<<" "<<i+1<<endl;
        if(s[i-1]=='1'){
            m=i+1;
        }
    }
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
using ll = int;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 3;


void solve() {
    int N; cin >> N;
    vector<int> a(N);

    for (int i = 0; i < N; ++i) cin >> a[i];
    sort(a.begin(), a.end());

    ll ans = 0;
    vector<bool> used(1000010, true);
    for (int i = 0; i < N; ++i){
        if(used[a[i]]){
            if(a[i] != a[i+1])++ans;
            for(int j = 1; j * a[i] < 1000010; ++j){
                used[j * a[i]] = false;
            }
        }
    }
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 4300
#include<bits/stdc++.h>
using namespace std;
 
int main(void){
    int n;cin >> n;
    string s[n];
    map<string,int> mp;

    for (int i=0;i<n;i++){
        string tmp;
        cin >> tmp;
        sort(tmp.begin(), tmp.end());
        mp[tmp]++;
    }


    long long int count = 0;
    for (auto& p:mp){
        int s = p.second;
        count += (long long)s*(s-1)/2;
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 11904
import java.util.*;


public  class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int card_count = sc.nextInt();
        ArrayList<Integer> cards = new ArrayList<Integer>();
        for (int i = 0; i < card_count; i++) {
          cards.add(sc.nextInt());
        }
        Collections.sort(cards, Collections.reverseOrder());
        
        int result = 0;
        for (int i = 0; i < card_count; i++) {
        	if (i % 2 == 0) {
        		result += cards.get(i);
        	} else {
        		result -= cards.get(i);
        	}
        }
        System.out.println(result);
    }
}

Measured memory_bytes: 23508
#include<stdio.h>
#include<string.h>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<iostream>
#include<iomanip>
#include<utility>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define fi first
#define sec second
#define mp make_pair
#define pb push_back
#define rep(a,b,c) for(int a=1;a<=b;a+=c)
#define repp(a,b,c,d) for(int a=b;a<=c;a+=d)

const double PI=acos(-1);
const double EPS=1e-12;
const int MOD=1e9+7;
const int INF=1<<30;


using namespace std;


int main(){
	ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int in;
	cin>>in;
	cout<<(in-2)*180<<endl;
	return 0;
}


Measured memory_bytes: 256
//void __(){
//    ll n,a,b;
//    cin >> n >> a >> b;
//    if(a*b < n || a+b-1 > n){
//        print -1;
//        return;
//    }
//    vi ans;
//    int lo = 0;
//    per(i,a){
//        vi group;
//        int take = min(n-lo-i,b);
//        rep(i,take)
//            group.pb(++lo);
//        reverse(all(group));
//        ans.insert(ans.end(),all(group));
//    }
//    print ans;
//}
//
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define pb push_back
#define REP_ZERO_INT(i,r) for(int i = 0; i < r; ++i)
#define GET_REP_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define rep(...) GET_REP_MACRO(__VA_ARGS__,REP_ANY,REP_INT,REP_ZERO_INT)(__VA_ARGS__)
#define PER_ZERO_INT(i,r) for(int i = r-1; i >= 0; --i)
#define GET_PER_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define per(...) GET_PER_MACRO(__VA_ARGS__,PER_ANY,PER_INT,PER_ZERO_INT)(__VA_ARGS__)
#define all(v) (v).begin(), (v).end()
#define sz(v) ll(v.size())
#define T1 template<typename T> static
using namespace std;
typedef long long ll;
typedef vector<int> vi;
T1 ostream& operator<<(ostream& stream, const vector<T>& t);
T1 istream& read(T, T, istream& = cin);
struct _print {
    string sep,end;
    bool space;
    ostream &stream;
    _print(string _sep=" ",string _end="\n",
            ostream &_stream = cout)
        : sep(_sep),end(_end),space(false),
            stream(_stream) {}
    ~_print() { stream << end; }
    template <typename T>
        _print &operator , (const T &t) {
            if (space) stream << sep;
            space = true;
            stream << t;
            return *this;
        }
};
#define print _print(),
T1 ostream& operator<<(ostream& stream, const vector<T>& t){
    for(int i = 0; i < sz(t); ++i){
        stream << t[i];
        if(i+1 < sz(t))
            stream << ' ';
    }
    return stream;
}
void __(){
    ll n,a,b;
    cin >> n >> a >> b;
    if(a*b < n || a+b-1 > n){
        print -1;
        return;
    }
    vi ans;
    int lo = 0;
    per(i,a){
        vi group;
        int take = min(n-lo-i,b);
        rep(i,take)
            group.pb(++lo);
        reverse(all(group));
        ans.insert(ans.end(),all(group));
    }
    print ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
        __();
}


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

using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i, x) for(int i=0;i<(int)(x);i++)
#define REPS(i, x) for(int i=1;i<=(int)(x);i++)
#define RREP(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i, x) for(int i=((int)(x));i>0;i--)
#define FOR(i, c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i, c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define __builtin_popcount __builtin_popcountll

template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

template<class T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &t) {
    os << "[";
    FOR(it, t) {
        if (it != t.begin()) os << ",";
        os << *it;
    }
    os << "]";
    return os;
}

template<class T>
ostream &operator<<(ostream &os, const set<T> &t) {
    os << "{";
    FOR(it, t) {
        if (it != t.begin()) os << ",";
        os << *it;
    }
    os << "}";
    return os;
}

template<class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &t) { return os << "(" << t.first << "," << t.second << ")"; }

template<class S, class T>
pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) {
    return pair<S, T>(s.first + t.first, s.second + t.second);
}

template<class S, class T>
pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) {
    return pair<S, T>(s.first - t.first, s.second - t.second);
}

const int INF = 1 << 28;
const double EPS = 1e-8;
const int MOD = 1000000007;

int n, m, apply_count, w;

int main(int argc, char *argv[]) {
    cin >> n >> w >> apply_count;
    vi d(n);
    REP(i, n) {
        cin >> d[i];
    }
    int l = -1, r = MOD;
    while(l + 1 < r) {
        int mid = (l+r) / 2;
        if ([&]() {
            for(int low : d) {
                int up = low + mid;
                int small = 0, large = 0;
                int can = 0;
                REP(i, n) {
                    if (d[i] < low) {
                        small = large = 0;
                    } else if(up < d[i]) {
                        large ++;
                    } else {
                        small ++;
                    }
                    if (w <= large + small && small) {
                        can ++;
                        small --;
                    }
                }
                if (apply_count <= can) return true;
            }
            return false;
        }()) r = mid;
        else l = mid;
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
    #include<string>
    #include<vector>
    using namespace std;

    int main() {
        vector<string> w;
        int n;
        bool f = true;

        cin >> n;
        for (int i = 0; i < n; i++) {
            string a;
            cin >> a;
            w.push_back(a);
        }

        char c;
        for (int i = 0; i < n; i++) {
           
            if (i >= 1 && c != w[i].front()) f = false;   
            c = w[i].back();

            for (int j = 0; j < i; j++) 
                if (w[i] == w[j]) f = false;
        }

        if (f) cout << "Yes";
        else cout << "No";
        cout << endl;
    }

Measured memory_bytes: 256
import java.util.*
fun readint()=readLine()!!.toInt()
fun readll()=readLine()!!.toLong()
fun readstring()=readLine()!!
fun readlint()=(readLine()!!.split(" ").map{it.toInt()}).toIntArray()
fun readlll()=(readLine()!!.split(" ").map{it.toLong()}).toLongArray()

fun solve() {
    var A = readll();
    var cur = 2L;
    var ans = 0;
    while (cur * cur <= A) {
        if (A % cur != 0L) {
            cur++;
            continue;
        }
        var cnt = 0;
        while (A % cur == 0L) {
            A /= cur;
            cnt++;
        }
        var nd = 1;
        while(cnt >= nd) {
            ans++;
            cnt -= nd;
            nd++;
        }
    }
    if (A > 1) {
        ans++;
    }
    println(ans)
}
fun main(args: Array<String>) {
    val t = 1;
    repeat(t) {
        solve();
    }
}

Measured memory_bytes: 34500
n=int(input())
a=[]
b=[]


for i in range(n):
    s,p=input().split()
    p=int(p)
    a.append(s)
    b.append(p)

x=list(zip(a,b))

y=sorted(x,key=lambda x:(x[0],-x[1]))

for i in range(n):
    print(int(x.index(y[i]))+1)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a, a+n);
	for(int i = 1; i < n; i++){
		if(a[i] == a[i-1]){
			cout<<"NO"<<endl;
			return 0;
		} 
	}
	cout << "YES"<< endl;
	return 0;
} 

Measured memory_bytes: 1024
from collections import deque

def dfs(n,m):
    d = deque([])
    if n == 1:
        for i in range(1,m+1):
            d.append([i])
        return d
    else:
        dd=dfs(n-1,m)
        for i in range(len(dd)):
            ll=dd.popleft()
            mx=max(ll)
            for j in range(mx,m+1):
                l=ll[:]
                l.append(j)
                d.append(l)
        return d



n,m,q = map(int,input().split())
x=[[0,0,0,0] for _ in range(q)]
cnt=[0 for _ in range(n)]
for i in range(q):
    x[i][0],x[i][1],x[i][2],x[i][3]= map(int,input().split())

dq=dfs(n,m)
ans=0
ok=True
for i in range(len(dq)):
    aa=dq.popleft()
    scr=0
    for a,b,c,d in x:
        if aa[b-1]-aa[a-1]==c:
            scr+=d
    ans=max(ans,scr)

print(ans)

Measured memory_bytes: 29056
import sys
input=sys.stdin.readline
import heapq
n,q=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
L1=[]
for i in range(n):
  L1.append((l[i][0]-l[i][2],1,l[i][2]))
  L1.append((l[i][1]-l[i][2],-1,l[i][2]))
for i in range(q):
  L1.append((int(input()),2,0))
L1.sort()
L2=[]
heapq.heapify(L2)
L3=[]
L3=set(L3)
for i in range(len(L1)):
  if L1[i][1]==1:
    heapq.heappush(L2,L1[i][2])
    L3.add(L1[i][2])
  elif L1[i][1]==-1:
    L3.remove(L1[i][2])
  else:
    while L2 and L2[0] not in L3:
      heapq.heappop(L2)
    if L2:
      print(L2[0])
    else:
      print(-1)

Measured memory_bytes: 179484
#include <bits/stdc++.h>
#define max 1000000
#define pb push_back
#define pairs pair<int, int>
#define vi vector<int>
#define vb vector<bool>
#define vii vector<pairs>
#define lb lower_bound
#define ub upper_bound
#define lli long long int
#define endl '\n'
#define FastInput ios_base::sync_with_stdio(false), cin.tie(NULL);
#define Cases  cout << "Case " << ++Case << ": ";
#define __test int tt; int Case=0; cin >> tt; while(tt--)
#define read(x) freopen(x, "r", stdin)
#define write(x) freopen(x, "w", stdout)
#define InputArray(a,n) for(int i=0;i<n;i++) cin >> a[i];
#define CopyArray(a,temp,n) for(int i=0;i<n;i++) temp[i]=a[i];
#define PrintArray(a,n) for(int i=0;i<n;i++) cout << a[i] << " "; cout << endl;
using namespace std;


int main() {
#ifdef Niloy
	read("input.txt");
	write("output.txt");
#endif

	int n, a, b;
	cin >> n >> a >> b;
	for (int i = a; i <= b; i++) {
		if(i % n == 0) {
			cout << "OK\n";
			return 0;
		}
	}

	cout << "NG\n";

	cerr << "time = " << (clock() / CLOCKS_PER_SEC) << " sec" << '\n';
	return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
 
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#define pb push_back
#define popb pop_back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair 
#define mt make_tuple
#define fi
#define se second
 
#define forz(i,n) for(long long int i=0;i<n;i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0) 
 
using namespace std;

int main()
{
	lli n, m, sum;

	cin >> n>> m;
	
	
	sum = ((n*(n-1))/2) + ((m*(m-1))/2);
	
	cout << sum << endl;
	return 0;
}


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;

int main(){
	int k,n; cin>>k>>n;
	int maxa=0;
	int a[n]={};
	rep(i,n) cin>>a[i];
	rep(i,n-1){
		maxa=max(maxa,a[i+1]-a[i]);
	}
	maxa=max(maxa,k-a[n-1]+a[0]);
	cout<<k-maxa<<endl;
		
}
		
	


Measured memory_bytes: 4348
///******* In the name of Allah *******///

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

//long int ar[10013];
//long int gcd(long int a, long int b)
//{
//    if(b==0)
//        return a;
//    return gcd(b,a%b);
//}
//long int sieve(long long int a)
//{
//    long long int i,j,k = 0;
//    memset(ar,0,sizeof(ar));
//    ar[1] = 1;
//    for(i=2; i<=713; i++)
//    {
//        if(ar[i]==0)
//        {
//            for(j=i+i; j<=713; j+=i)
//            {
//                ar[j] = 1;
//            }
//        }
//    }
//    return ar[a];
//}

void Ok()
{
    long long int a,b,c,d,e,f,g,h,t,i,j,k,l,m,n,odd,even;
    long long int ans_1,ans_2,ans_3,ans_4,cnt_1,cnt_2,cnt_3,Max,Min,flag,temp,sum;
    double aa,bb,cc,dd,ee,ff,gg;
    char aaa[1013],bbb,ccc,ddd;
    string spc,in,store[13];

    for(i=1;i<=5;i++)
    {
        cin>>a;
        if(a==0)
            b = i;
    }
    cout<<b<<endl;

    return;
}

int main()
{
    Ok();

    return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
int main() {
	string S;
	cin>>S;
	string ans="No";
	if(S=="abc"|S=="acb"|S=="bac"|S=="bca"|S=="cab"|S=="cba")ans="Yes";
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int k = scan.nextInt();
        int x = scan.nextInt();
        for(int i = 1; i < 2 * Math.abs(k); i++){
            System.out.print(x - k + i + " ");
        }
    }
}

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


int main() {
    ios::sync_with_stdio(false);
    map<int, ll> cnt;
    int n; cin >> n;
    ll ans = 0;

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

        ans += cnt[i - a];

        cnt[a + i]++;
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 26180
#include <iostream>
#include<algorithm>
#include <stdio.h>
#include <map>
#include <random>
#include <string>
#include<vector>
#include<stack>
#include <cstdlib>


using namespace std;

int main() {
	long long a, b, n,x,f1,f2;
	int ans;
	cin >> a >> b >> n;
	x = min(b - 1, n);

	ans = (a*x) / b - (x / b) * a;
	
	cout << ans;


	return 0;
}


Measured memory_bytes: 3160