akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A = [int(_) for _ in input().split()]
flag = True
for a in A:
    if a % 2 == 1:
        continue
    if a % 3 == 0 or a % 5 == 0:
        continue
    flag = False
    break
if flag:
    print('APPROVED')
else:
    print('DENIED')


Measured memory_bytes: 2940
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <map>
#include <math.h>
#include <algorithm> // std::sort, std::min
#include <iomanip> // std::setprecision
#include <cmath> // std::ceil
#include <numeric> // std::gcd
#include <limits> // std::numeric_limits<long int>::max()

using namespace std;
typedef long long ll;
#define INF 1999999999
#define MODA 1000000007 

template<typename T>
T powint (const T& x, const T& y) {
  T ret = 1;
  for(int i=0; i<y; ++i) ret *= x;
  return ret;
}

int main() {
  ll N, M;
  cin >> N >> M;
  vector<int> p(M);
  vector<string> S(M);
  for(int i=0; i<M; ++i) cin >> p[i] >> S[i];

  vector<bool> ACflag(N+1, false);
  vector<ll> WAcount(N+1, 0);
  ll WAsum = 0;
  ll ACsum = 0;

  for(int i=0; i<M; ++i) {
    if(S[i] == "WA" && !ACflag[p[i]]) {
      WAcount[p[i]]++;
    }
    else if (S[i] == "AC" && !ACflag[p[i]]) {
      WAsum += WAcount[p[i]];
      ACsum++;
      ACflag[p[i]] = true;
    }
  }
  cout << ACsum <<" "<< WAsum << endl;
  return 0;
}



Measured memory_bytes: 6912
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
// euclidean
int gcd(int x,int y) {
  if(x<y)swap(x,y);
  if (y==0) {
    return x;
  } else {
    x %= y;
    gcd(x,y);
  }
}

signed main() {
  int x,y; cin>>x>>y; cout<<gcd(x,y)<<endl;
}



Measured memory_bytes: 3096
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    vector<ll> A(N), B(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    ll asum = 0, bsum = 0;
    rep(i, N) asum += A[i];
    rep(i, N) bsum += B[i];
    ll diff = bsum - asum;
    if(diff < 0) {
        output("No");
        return 0;
    }
    ll trials = 0;
    rep(i, N) {
        if(A[i] < B[i]) {
            trials += (B[i] - A[i] + 1) / 2;
        }
    }
    if(trials > diff) {
        output("No");
    }
    else {
        output("Yes");
    }
    
    return 0;
}


Measured memory_bytes: 384
def p(dice, k):
    times = 0
    score = dice
    while score < k:
        score *= 2
        times += 1

    return 1/(2**times)


n, k = map(int, input().split())
prob = 0.0
for i in range(1, n+1):
    prob += (1.0 / n) * p(i, k)

print(prob)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int ans=0;
  for(int i=1;i<=n;i++)
  {
    string a=to_string(i);
    if(a.length()%2==1)
    {
       ans++; 
    }
  }
  cout<<ans;
  return 0;
}
#include<bits/stdc++.h>

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int A[101][101],r,c,i,j,sum,total=0;

  scanf ("%d%d",&r,&c);

  for (i=0;i<r;i++)
    for (j=0;j<c;j++)
      scanf ("%d",&A[i][j]);

  for (j=0;j<c;j++){
    sum = 0;
      for (i=0;i<r;i++){
        sum += A[i][j];
        total += A[i][j];
    }
      A[i][j] = sum;
  }

 for (i=0;i<r;i++){
    sum = 0;
    for (j=0;j<c;j++){
      sum += A[i][j];
    }
    A[i][j] = sum;
  }

  A[r][c] = total;
  for (i=0;i<=r;i++){
    for (j=0;j<c;j++){
      printf ("%d ",A[i][j]);
    
    }
      printf ("%d\n",A[i][j]);
  }
  
  return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define cer(x) cerr << x <<endl
#define ALL(a) (a).begin(),(a).end()
#define MOD 1e9+7
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main()
{
	string s; cin >> s;
	string ans = s.substr(0, 4) + " " + s.substr(4, 8);
	co(ans);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N, T;
	cin >> N >> T;
	int t[200000];
	rep(i, N) cin >> t[i];

	ll kotae = T;
	rep(i, N - 1) {
		kotae += min(T, t[i + 1] - t[i]);
	}
	co(kotae);

	Would you please return 0;
}

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


int Ns[310000];

typedef std::pair<int,int> PII;

// max p;


PII Mxa[310000],Mxb[310000];

void Addp(int p,PII ad)
{
	if(ad==Mxa[p]||ad==Mxb[p])
		return;
	if(ad>Mxa[p])
	{
		Mxb[p]=Mxa[p];
		Mxa[p]=ad;
	}
	else if(ad>Mxb[p])
		Mxb[p]=ad;
}

void Input()
{
	scanf("%d",&N);
	int wi;
	for(wi=0;wi<(1<<N);++wi)
	{
		scanf("%d",Ns+wi);
		Mxa[wi]=make_pair(Ns[wi],wi);
		Mxb[wi]=make_pair(-100000000,0);
	}
	int wia;
	for(wi=1;wi<(1<<N);++wi)
		for(wia=0;wia<N;++wia)
			if(wi&(1<<wia))
			{
				Addp(wi,Mxa[wi&(~(1<<wia))]);
				Addp(wi,Mxb[wi&(~(1<<wia))]);
			}
}

int max(int a,int b){return a>b?a:b;}

void AC()
{
	int Mx=-100000000;
	int wi;
	for(wi=1;wi<(1<<N);++wi)
		printf("%d\n",Mx=max(Mx,Mxa[wi].first+Mxb[wi].first));
}

int main()
{
	Input();
	AC();
	return 0;
}

Measured memory_bytes: 8576
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

#define F first
#define S second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int a, b, c;
    cin >> a >> b >> c;
    bool flag = false;
    for (int i = 0; i < b; i++) {
        if (a * (i + 1) % b == c) {
            flag = true;
            break;
        }
    }
    
    if (flag) {
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
using LL = long long;

LL gcd(LL a, LL b) {
    return b == 0 ? a : gcd(b, a % b);
}

int main() {
    LL A, B, C, D;
    cin >> A >> B >> C >> D;

    LL L = C * D / gcd(C, D);

    A--;
    LL ans = B - A;

    ans = ans - B / C - B / D + B / L;
    ans = ans + A / C + A / D - A / L;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

vector<int> g[111111];
int n;

P dfs(int x,int r) {
  P p=P(1,1);
  for(int i=0; i<g[x].size(); i++) {
    int y=g[x][i];
    if(y==r) continue;
    P q=dfs(y,x);
    p.F*=q.S;
    p.F%=MAX;
    p.S*=q.F+q.S;
    p.S%=MAX;
  }
  return p;
}

void Main() {
  R n;
  rep(i,n-1) {
    int x,y;
    cin >> x >> y;
    x--,y--;
    g[x].pb(y);
    g[y].pb(x);
  }
  P p=dfs(0,-1);
  pr((p.F+p.S)%MAX);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 12928
package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	p := make([]float64, n)
	for i := range p {
		fmt.Scan(&p[i])
	}

	idx := make([]float64, 0, k)
	maxIdx := make([]float64, k)
	var max, sum float64
	for i := 0; i < n; i++ {
		sum += p[i]
		idx = append(idx, p[i])
		if len(idx) > k {
			sum -= idx[0]
			idx = idx[1:]
		}
		if len(idx) == k {
			if max < sum {
				max = sum
				copy(maxIdx, idx)
			}
		}
	}

	sum = 0.0
	for _, v := range maxIdx {
		sum += expectation(v)
	}
	fmt.Printf("%.12f\n", sum)
}

func expectation(p float64) float64 {
	var sum float64
	for i := 1.0; i <= p; i++ {
		sum += i
	}
	return sum / p
}


Measured memory_bytes: 8832
/**
 *    author: apurba_debnath
**/
#include <bits/stdc++.h>


#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;


using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int s, w;
    cin >> s >> w;
    if (s > w) cout << "safe";
    else cout << "unsafe";

    return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		int[] a = new int[200001];
		int[] d = new int[200001];
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int n = sc.nextInt();
		for (int i = 0; i < n;i++) {
			a[i] = sc.nextInt();
		}
		int max = 0;
		for (int i = 1; i < n;i++) {
			d[i] = a[i]-a[i-1];
			if (max < d[i]) {
				max = d[i];
			}
		}
		int d0= a[0]+k-a[n-1];
		if (max < d0) {
			max = d0;
		}
		sc.close();
		System.out.println(k-max);
	}
}


Measured memory_bytes: 79668
import math 
N,K=map(int,input().split())
A=[int(x) for x in input().split()]
A=sorted(A)
left=0
right=max(A)
mid=max((left+right)//2,1)

while(right-left>=1):
    numofcut=0
    
    for i in range(N):
        numofcut+=math.ceil(A[i]/mid)-1
    #print(numofcut)
    if numofcut>K:
        left=mid+1
    else:
        right=mid
    mid=max((left+right)//2,1)
    if mid==1:
        break
print(mid)

Measured memory_bytes: 30988
// https://atcoder.jp/contests/abc153/tasks/abc153_c

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N, K;
  cin >> N >> K;

  if (K >= N) drop(0);

  VL hs(N);
  rep(i, N) cin >> hs[i];

  sort(all(hs));

  ll res = 0;
  rep(i, N - K) {
    res += hs[i];
  }

  drop(res);
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	double n;
	cin >> n;
	rep(i, 50000) {
		if (floor((double)i * 1.08) == n)return cout << i << endl,0;
	}
	cout << ":(" << endl;
}




Measured memory_bytes: 256
//Keep calm and carry on..

/*  Problem :
    URL :

*/

#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;


# define fast           ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
# define pb             push_back
# define pi             3.1415926535897932384626
# define mod            1000000007
# define endl          '\n'
# define DEBUG          false
# define F              first
# define S              second
# define loop1(i,a,b)   for(ll i = a; i<b; i++)
# define loop2(i,a,b)   for(ll i = b-1; i>=a; i--)
# pragma GCC optimize "trapv"

 int main(){
     fast;
     string s;  cin>>s;
     int l =s.size();
      if(s[l-1] == 's')cout<<s<<"es";
      else cout<<s<<"s";

     return 0;
}



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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = 10000000000;
/****** define constant end ********/


/****** define variable start ******/
ll a,b;
/******* define variable end *******/

ll solve(){
    cin >> a >> b;
    if(a < b){
        REP(i, b){
            cout << a;
        }
    }else{
        REP(i, a){
            cout << b;
        }
    }
    cout << endl;
    return 0;
}
int main(){
    //clock_t start = clock();
    cout << std::fixed << std::setprecision(10);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll end_solve = solve();
    /*
    clock_t end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    printf("time %lf[ms]\n", time);
    */
    return (int)end_solve;
}


Measured memory_bytes: 256
import java.io.*;
public class Main {

	static int n, m;
	static int[] dx = {0,0,-1,1}, dy = {-1,1,0,0};
	static boolean[][] check, map;

	private static int dfs(int y, int x) {
		int ret = 0;
		for (int d = 0 ; d < 4 ; d++) {
			int tx = x + dx[d];
			int ty = y + dy[d];
			if (tx < 0 || ty < 0 || tx >= m || ty >= n || !map[ty][tx] || check[ty][tx]) {
				continue;
			}
			check[ty][tx] = true;
			ret = Math.max(ret, 1 + dfs(ty, tx));
			check[ty][tx] = false;
		}
		return ret;
	}

	public static void main(String[] args) throws IOException {
		BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		while (true) {
			m = Integer.valueOf(s.readLine());
			n = Integer.valueOf(s.readLine());
			if (m == 0 && n == 0) break;
			map = new boolean[n][m];
			for (int i = 0 ; i < n ; i++) {
				String[] data = s.readLine().split(" ");
				for (int j = 0 ; j < m ; j++)
					map[i][j] = Integer.valueOf(data[j]) == 1;
			}
			int max = 0;
			for (int i = 0 ; i < n ; i++) {
				for (int j = 0 ; j < m ; j++) {
					if (map[i][j]) {
						check = new boolean[n][m];
						max = Math.max(max, dfs(i, j));
					}
				}
			}
			out.println(max);
		}
		out.flush();
	}
}

Measured memory_bytes: 11000
#include<iostream>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    double a[3],b[3];
    cin >>a[0]>>a[1]>>a[2]>>b[0]>>b[1]>>b[2];
    double dis = (a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]);
    if((a[2]+b[2])*(a[2]+b[2]) < dis){cout <<"0"<<endl;}
    else{
      if((a[2]-b[2])*(a[2]-b[2]) > dis){
	if(a[2]>b[2]){cout <<"2"<<endl;}
	else{cout <<"-2"<<endl;}
      }
      else{cout <<"1"<<endl;}
    }
  }
  return 0;
}

Measured memory_bytes: 1224
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int n = cin.Int();
			var counts = cin.ArrayInt(n).GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());

			if (counts.Count > 2) {
				Console.WriteLine("No");
				return;
			}

			if (counts.Count == 2) {
				var keys = counts.Keys.OrderBy(x => x).ToArray();
				int key1 = keys[0];
				int key2 = keys[1];
				if (key2 - key1 != 1) {
					Console.WriteLine("No");
					return;
				}

				if (counts[key1] <= key1 && (key2 - counts[key1]) <= counts[key2] / 2) {
					Console.WriteLine("Yes");
					return;
				} else {
					Console.WriteLine("No");
					return;
				}
			} else {
				int key = counts.Keys.First();
				if (key <= counts[key] / 2 || key == counts[key] - 1) {
					Console.WriteLine("Yes");
					return;
				} else {
					Console.WriteLine("No");
					return;
				}
			}
		}
	}

	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private string[] buf_;
		private int index_;
		Func<string> reader_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 35504
#include <bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define debug(var) std::cout << #var << " : " << var << std::endl;
using ll = long long;
using ull = unsigned long long;
ll mod = 1e9 + 7;


int main(){


	ll L, R; std::cin >> L >> R;
	R = std::min(R, L + 4038);

	ll ans = LLONG_MAX;
	for(ll i = L; i <= R; i++){
		for(ll j = L; j <= R; j++){
			if(i >= j)continue;
			ans = std::min(ans, (i * j) % 2019);
		}
	}

	std::cout << ans;

	
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <tuple>
#include <climits>

using namespace std;


int main() {
    long long n;
    cin>>n;
    for (int i=1; i<=3500; i++) {
        for (int j=1; j<=3500; j++) {
            long long a = n * i * j, b = 4 * i * j - n * (i + j);
            if (b > 0 && a % b == 0) {
                cout<<i<<" "<<j<<" "<<a / b<<endl;
                return 0;
            }
        }
    }
}

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

using ll = long long;
#define repi(n) for (int i = 0; i < (n); i++)
#define repj(n) for (int j = 0; j < (n); j++)
#define repk(n) for (int k = 0; k < (n); k++)
#define repl(n) for (int l = 0; l < (n); l++)
#define rep(i, n) for (int i = 0; (i) < (n); i++)
#define repr(i, a, b) for (auto i = (a); i < (b); i++)
#define repv(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = max((t), (v)))
#define updatemin(t, v) (t = min((t), (v)))
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
ll modpow(ll a, ll b, ll m) {
  ll re = 1, k = 1;
  while (k <= b) {
    if (b & k) {
      re *= a;
      re %= m;
    }
    k = k << 1;
    a *= a;
    a %= m;
  }
  return re;
}
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}

int main() {
  int n;
  cin >> n;
  vector<ll> h(n);
  repi(n) cin >> h[i];
  int re = 0, re0 = 0;
  repr(i, 1, n) {
    if (h[i] <= h[i - 1]) {
      re0++;
      updatemax(re, re0);
    } else {
      re0 = 0;
    }
  }
  cout << re << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include<iomanip>
using namespace std;
const int maxn = 555;


int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	int d=max(a,b);
	d=max(d,c);
	int sum=a+b+c-d;
	int k;
	scanf("%d",&k);
	int cc=d;
	for(int i=1;i<=k;i++){
		cc=cc*2;
	}
	printf("%d\n",sum+cc);

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
typedef long long int ll;
#define MOD 1000000007
#define fo(i,k,n) for(i=k;i<=n;i++)
#define endl '\n'
ll dp[101][100001];
//memoisation
ll knapsnack(ll* w,ll* v,ll n,ll mw){
	if(dp[n][mw]>-1) return dp[n][mw];
	if(n==0) return 0;//no item left
	if(mw==0) return 0;//no more capacity
	ll op1 = knapsnack(w,v,n-1,mw);
	ll op2 = LLONG_MIN;
	if(w[n-1]<=mw) op2 = v[n-1]+knapsnack(w,v,n-1,mw-w[n-1]);
	return dp[n][mw]=max(op1,op2);
}
//tabulation
ll knapsnacki(ll* w,ll* v,ll n,ll mw){
	ll i,j;
	fo(i,0,mw) dp[0][i]=0;
	fo(i,0,n) dp[i][0]=0;
	fo(i,1,n){
		fo(j,1,mw){
			dp[i][j] = dp[i-1][j];
			if(w[i-1]<=j) dp[i][j] = max(dp[i][j],v[i-1]+dp[i-1][j-w[i-1]]);
		}
	}
	return dp[n][mw];
}
//tabulation memory optimised
ll knapsnacki2(ll* w,ll* v,ll n,ll mw){
	ll i,j;
	ll dp2[2][mw+1];
	fo(i,0,mw) dp2[0][i]=0;
	dp2[1][0]=0;
	ll idx=1;
	fo(i,1,n){
		fo(j,1,mw){
			dp2[idx][j] = dp2[idx^1][j];
			if(w[i-1]<=j) dp2[idx][j] = max(dp2[idx][j],v[i-1]+dp2[idx^1][j-w[i-1]]);
		}
		idx^=1;
	}
	return dp2[idx^1][mw];
}
//for large weights
ll dpi3[100001][101];
ll knapsnacki3(ll* w,ll* v,ll n,ll mw){
	ll i,j;
	for(i=0;i<=n;i++) dpi3[0][i]=0;
	for(i=1;i<=100000;i++) dpi3[i][n]=mw+1;
	for(i=1;i<=100000;i++){
		for(j=n-1;j>=0;j--){
			dpi3[i][j] = dpi3[i][j+1];
			if(i-v[j]>=0) dpi3[i][j] = min(dpi3[i][j],w[j]+dpi3[i-v[j]][j+1]);
		}
	}
	ll ans = 0;
	for(i=0;i<=100000;i++) if(dpi3[i][0]>0&&dpi3[i][0]<=mw) ans = max(ans,i);
	return ans;
}
void solve(){
	ll i,j,n,mw;
	cin>>n>>mw;
	ll* w = new ll[n];
	ll* v = new ll[n];
	fo(i,0,n-1){
		cin>>w[i]>>v[i];
	}
	memset(dp,-1,sizeof(dp));
	cout<<knapsnacki3(w,v,n,mw)<<endl;
	//cout<<knapsnacki2(w,v,n,mw)<<endl;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll t;
	t=1;//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll, ll> Pll;
typedef pair<int, Pii > P1;

#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define mp1(a,b,c) P1(a,P(b,c))
#define get_arsize(a) (sizeof(a)/sizeof(a[0]))

const ll MOD = 1000000007;
const double EPS = 1e-10;
const int MAX = 200000;

int main() {
  int k, a, b;
  cin >> k >> a >> b;
  if (k == 1) {
    cout << "OK" << endl;
    return 0;
  }
  if (b/k - a/k || a%k == 0 || b%k == 0) {
    cout << "OK" << endl;
  } else {
    cout << "NG" << endl;
  }
  return 0;
}


Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;

//http://agc009.contest.atcoder.jp/tasks/agc009_a
//ABC009-A-Multiple Array
class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("3");
            WillReturn.Add("3 5");
            WillReturn.Add("2 7");
            WillReturn.Add("9 4");
            //7
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("7");
            WillReturn.Add("3 1");
            WillReturn.Add("4 1");
            WillReturn.Add("5 9");
            WillReturn.Add("2 6");
            WillReturn.Add("5 3");
            WillReturn.Add("5 8");
            WillReturn.Add("9 7");
            //22
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        var AList = new List<int>();
        var BList = new List<int>();

        int[] wkArr = { };
        Action<string> SplitAct = pStr =>
            wkArr = pStr.Split(' ').Select(X => int.Parse(X)).ToArray();

        foreach (string EachStr in InputList.Skip(1)) {
            SplitAct(EachStr);
            AList.Add(wkArr[0]);
            BList.Add(wkArr[1]);
        }

        long PushCnt = 0;

        for (int I = AList.Count - 1; 0 <= I; I--) {
            long ModVal = (AList[I] + PushCnt) % BList[I];
            if (ModVal == 0) continue;
            PushCnt += BList[I] - ModVal;
        }
        Console.WriteLine(PushCnt);
    }
}


Measured memory_bytes: 17296
import java.util.Scanner;

public class Main {
	
	private static final String KEYENCE = "keyence";
	private static final String YES = "YES";
	private static final String NO = "NO";

	public static void main(String[] args) {
		new Main().execute();
	}

	public void execute() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		
		for(int i=0, len = KEYENCE.length(); i<=len; i++) {
			String s1 = KEYENCE.substring(0,i);
			String s2 = KEYENCE.substring(i);
			if(s.startsWith(s1) && s.endsWith(s2)) {
				System.out.println(YES);
				return;
			}
		}
		System.out.println(NO);
		sc.close();
	}

}


Measured memory_bytes: 21844
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = println(solve(new Scanner(System.in)))

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val A = sc.nextInt
    val B = sc.nextInt

    Array(A + B, A - B, A * B).max.toString
  }
}


Measured memory_bytes: 27324
a,b,c,x,y = list(map(int, input().split()))

if a + b < 2*c :
    print(x*a + y*b)
else :
    if x >= y :
        if a >= 2*c:
            print(y*2*c + (x-y)*2*c)
        else :
            print(y*2*c + (x-y)*a)

    else :
        if b >= 2*c:
            print(x*2*c + (y-x)*2*c)
        else:
            print(x*2*c + (y-x)*b)




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

int main() {
  long long int A,B;
  cin >> A >> B ;
  long long int i =A;
  long long int count =0;
  
 while(i<=B){
   i = 2*i;
   count +=1;
 }
  
  cout << count << endl;
   

}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;
 
int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			if(n==i*j){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;

const int N=2e5+20,MOD=1e9+7;

int n,a[N];
long long s,ans;

int mul(int a,int b)
{
	b%=MOD;
	if(b<0) b+=MOD;
	return (1ll*a*b)%MOD;
}

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

	s%=MOD;
	for(int i=0;i<n;i++)
	{
		ans+=mul(a[i],s-a[i]);
		ans%=MOD;

		s-=a[i];
		s%=MOD;
		if(s<0) s+=MOD;
	}

	cout<<ans;
}

Measured memory_bytes: 4444
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MAXL=15;
char S[MAXL];
ll ans=0;
int len;

void DFS(int x,ll sum) {
	if(x==len) {
		ans+=sum;
		return;
	}
	ans+=sum*(1ll<<(len-x-1));
	DFS(x+1,S[x]-'0');
	DFS(x+1,sum*10+(S[x]-'0'));
}

int main() {
	scanf("%s",S);
	len=strlen(S);
	DFS(1,S[0]-'0');
	cout << ans << endl;
	return 0;
}


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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(a) (a).begin(),(a).end()

using ll = long long;

ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}

int main(){
  int p, q;
  cin>>p>>q;
  int g = gcd(q, p);
  q /= g;
  int res = 1;
  for (int i = 2; i*i <= q; ++i) {
    if (q % i == 0) {
      res *= i;
      while (q % i == 0) {
        q /= i;
      }
    }
  }
  if (q > 1) res *= q;
  if (res > 1) {
    cout << res << endl;
  } else {
    cout << 2 << endl;
  }
  return 0;
}

Measured memory_bytes: 3092
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);


vector<int> ps;
void init(int sup) {
	vector<bool> isp(sup + 1,true);
	for (int i = 2; i <= sup; i++) {
		if (!isp[i])continue;
		ps.push_back(i);
		for (int j = 2 * i; j <= sup; j += i) {
			isp[j] = false;
		}
	}
}
ll calc(ll n, ll m) {
	if (m == 0)return n;
	return calc(n, m - 1) + calc(n / ps[m-1], m - 1);
}


void solve() {
	int n; cin >> n;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	int ans = 0;
	int pre = 0;
	rep(i, n) {
		//cout << i << " " << ans<<" "<<pre << "\n";
		int t = 1;
		int tmp = 0;
		while (2 * t <= a[i]) {
			t *= 2; tmp++;
		}
		if (t == a[i]) {
			if (pre < tmp) {
				ans += tmp - pre;
			}
			pre = tmp;
		}
		else {
			if (pre < tmp + 1) {
				ans += tmp + 1 - pre;
				pre = tmp + 1;
			}
			else {
				pre = tmp;
			}
		}
	}
	cout << ans << "\n";
}




signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init_f();
	//init();
	solve();
	stop
		return 0;
}


Measured memory_bytes: 640
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        s: Chars
    };

    let head2 = s
        .iter()
        .take(2)
        .map(|&ch| ch.to_digit(10).unwrap() as usize)
        .fold(0, |acc, x| acc * 10 + x);
    let tail2 = s
        .iter()
        .skip(2)
        .map(|&ch| ch.to_digit(10).unwrap() as usize)
        .fold(0, |acc, x| acc * 10 + x);
    let ok_yymm = (1..=12).contains(&tail2);
    let ok_mmyy = (1..=12).contains(&head2);
    let res = match (ok_yymm, ok_mmyy) {
        (true, true) => "AMBIGUOUS",
        (true, _) => "YYMM",
        (_, true) => "MMYY",
        _ => "NA",
    };
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2184
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    i32 X;
    cin >> X;
    i32 rank = 1;
    for (i32 i = 1800; i >= 400; i -= 200) {
        if (X >= i) {
            cout << rank << endl;
            return;
        }
        rank++;
    }
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//string型文字列をint型整数にして返す
int str_to_num(string s) {return atoi(s.c_str());}
//約数の総数を返す
int count_divisor(int n){int c[n/2] = {1}; int n_half = n/2; for(int i=2;i<n_half;i++){if(n%i==0){n /= i;c[i]+=1;i--;if(n>1) continue;else break;}  }int r = 1;for(int i=2;i<n_half;i++){r *= c[i];}return r;}
//各桁の数の和を返す
int dig_num(int n){return (n<10) ? n: dig_num(n/10) + n%10;}

int dig_ord(int n){return (n<10) ? 1: dig_ord(n/10) + 1;}

int main(){
  int N; cin >> N;
  bool kuku = false;
  for(int i=1;i<10;i++){
    if(N%i==0){
      if(N/i<10){
        kuku = true;
        break;
      }
    }
  }
  if(kuku) cout << "Yes\n";
  else cout << "No\n";
}
  

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int d[5];
    int a[5];
    int t = 0;
    int m = 9;
    int f = 1;
    for (int i=0; i < 5; i++){
        cin >> d[i];
        a[i] = d[i]%10;
        if ((a[i]>0)&&(a[i]<m)) {
            m = a[i];
        }
    }
    for (int i=0; i < 5; i++){
        if ((a[i]==m)&&(f==1)){
            t+=d[i];
            f = 0;
            continue;
        }
        if (a[i] == 0) {
            t+=d[i];
            continue;
        } else {
            t+=(d[i]+(10-a[i]));
            continue;
        }
    }
    cout << t << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int A = a * b;
  int C = c * d;
  if (A > C)
  {
    cout << A << endl;
  }
  else
  {
    cout << C << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<utility>
#include<algorithm>

using namespace std;

int main(){
 int n;
  cin >> n;
  
  string s;
  int p;
  
  pair<pair<string,int>,int> t[n];
  
  for(int i=0;i<n;i++){
   cin >> s >> p;
    t[i]=make_pair(make_pair(s,-1*p),i+1);
  }

  sort(t,t+n);
  
  for(int i=0;i<n;i++) cout << t[i].second << endl;

}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e18;


int main(){
    ll n;
    cin >> n;
    vector<ll> a(3*n),r(n+1),l(n+1);
    priority_queue<ll> p2;
    priority_queue<ll,vector<ll>,greater<ll>> p1;
    rep(i,3*n){
        cin >> a[i];
    }
    rep(i,n){
        p1.push(a[i]);
        l[0]+=a[i];
    }
    rep(i,n){
        p1.push(a[n+i]);
        ll be=p1.top();
        p1.pop();
        l[i+1]=l[i]+a[n+i]-be;
        //cout << l[i+1] << endl;
    }
    rep(i,n){
        
        p2.push(a[3*n-1-i]);
        r[0]+=a[3*n-1-i];
    }
    rep(i,n){
        p2.push(a[2*n-1-i]);
        ll be=p2.top();
        p2.pop();
        r[i+1]=r[i]+a[2*n-1-i]-be;
        //cout << r[i+1] << endl;
    }
    ll ans=-INF;
    rep(i,n+1){
        ans=max(ans,l[i]-r[n-i]);
        //cout << ans << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 9536
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
void swap(int *x,int *y){int tmp=*x;*x=*y;*y=tmp;}
int asc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return -1;else if(x==y)return 0;else return 1;}

int n, m, q;
int make_indexes(int *a, int n){
    for(int i=n-1;i>=0;i--){
        if(a[i]<m){
            a[i]++;
            for(int j=i+1;j<n;j++){
                a[j]=a[i];
            }
            return 0;
        }
    }
    return 1;
}

int main(){
    scanf("%d%d%d",&n,&m,&q);
    int a[100],b[100],c[100],d[100];
    for(int i=0;i<q;i++){
        scanf("%d%d%d%d",&a[i],&b[i],&c[i],&d[i]);
    }

    int x[20];for(int i=0;i<n;i++)x[i]=1;
    int flg=0;
    int ans=0;
    int sum =0;
    while(1){
        sum=0;
        //for(int i=0;i<n;i++)printf("%d ",x[i]);
        //printf("\n");
        flg = 0;
        if(!flg){
            for(int i=0;i<q;i++){
                if(x[b[i]-1]-x[a[i]-1]==c[i]){
                    sum+=d[i];
                }
            }
        }
        if(sum>ans){
            ans=sum;
        }
        if (make_indexes(x, n)){
            break;
        }
    }

    printf("%d\n",ans);
}


Measured memory_bytes: 1736
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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

	int n,m;
  cin>>n>>m;
  int c=0;
  rep(i,n){
    int a;cin>>a;
    if(m<=a)c++;
  }
  cout<<c<<endl;
}


Measured memory_bytes: 256
A, B, C = map(int, input().split())
a = abs(((A//2) * B * C) - ((A - A//2) * B * C))
b = abs(((B//2) * A * C) - ((B - B//2) * A * C))
c = abs(((C//2) * B * A) - ((C - C//2) * B * A))
print(min(a,b,c))

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>

typedef  long long ll;
#define mop 1000000007
using namespace std;

long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x); // 再帰的に解く
    y -= a / b * x;
    return d;
}

// 負の数にも対応した mod (a = -11 とかでも OK)
inline long long mod(long long a, long long m) {
    return (a % m + m) % m;
}

// 逆元計算 (ここでは a と m が互いに素であることが必要)
long long modinv(long long a, long long m) {
    long long x, y;
    extGCD(a, m, x, y);
    return mod(x, m); // 気持ち的には x % m だが、x が負かもしれないので
}

unsigned long long nCr(long n, long r) {
    unsigned long long ans = 1;
    for (long i = 1 ; i < r + 1; ++i) {
        ans = (ans * (n-i+1) % mop) * modinv(i, mop) % mop;
    }
    return ans;
}

int main() {
    

    ll n,k;
    cin >> n >> k;
    vector <ll> a;
    for(ll i=0;i<n;i++){
        ll tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    sort(a.begin(), a.end());

    ll ans = 0;
    if(k == 1){
        cout << 0 << endl;
    }else {
        ll tmpncr = 0;
        for (ll i = 0; i < n - k + 1; i++) {
            if (i == 0) {
                tmpncr = nCr(n, k - 1);
            }
            tmpncr = tmpncr * (n - i - k + 1) % mop;
            tmpncr = tmpncr * modinv(n - i, mop) % mop;
            ll tmp = a[i] * tmpncr % mop;
            ans -= tmp;
            ans %= mop;
        }
        for (ll i = n - 1; i >= k - 1; i--) {
            if (i == n - 1) {
                tmpncr = nCr(n, k - 1);
            }
            tmpncr = tmpncr * (n - (n - 1 - i) - k + 1) % mop;
            tmpncr = tmpncr * modinv(n - (n - i - 1), mop) % mop;
//            cout << tmpncr << endl;
            ll tmp = a[i] * tmpncr % mop;
            ans += tmp;
            ans %= mop;
        }
        cout << mod(ans, mop) << endl;
    }



}

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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    int H, W, D;
    std::cin >> H >> W >> D;

    vector<pair<int, int>> table(H * W + 1);
    REP(hi, H) {
        REP(wi, W) {
            int a;
            std::cin >> a;
            table[a] = make_pair(hi, wi);
        }
    }

    auto calc_L1 = [](const pair<int, int>& l, const pair<int, int>& r) -> ll {
                       return abs(l.first - r.first) + abs(l.second - r.second);
                   };

    vector<vector<ll>> sum_table(D, vector<ll>(1, 0));
    REP(i, D) {
        auto& prev = table[i];
        for(int j = i + D; j <= H * W; j += D) {
            sum_table[i].push_back(sum_table[i].back() + calc_L1(table[j], prev));
            prev = table[j];
        }
    }

    int Q;
    std::cin >> Q;

    REP(i, Q) {
        int l, r;
        std::cin >> l >> r;
        auto mod = l % D;
        std::cout << sum_table[mod][r / D] - sum_table[mod][l / D] << "\n";
    }

    return 0;
}


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

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
ll lcm(ll a, ll b)
{
    if (gcd(a,b) != 1) {
        return b * (a / gcd(a, b));
    }else{
        return b * a;
    }
}

int main() {
    ll A,B;
    cin >> A >> B;
    cout << lcm(A,B) << endl;
}


Measured memory_bytes: 3608