akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 998244353
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
#define uni(q) unique(all(q)),q.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll n; cin >> n;
    vl a(3*n);
    rep(i,3*n) cin >> a[i];
    vl sum(3*n,0);
    multiset<ll> left,right;
    rep(i,n){
        left.insert(a[i]);
        if(i==0){
            sum[i] = a[i];
            continue;
        }
        sum[i] += a[i] + sum[i-1];
    }
    vl L(3*n),R(3*n);
    for(ll i=3*n-1; i>=2*n; i--){
        right.insert(a[i]);
        if(i==3*n-1){
            sum[i] = a[i];
            continue;
        }
        sum[i] += a[i] + sum[i+1];
    }
    L[n-1] = sum[n-1];
    R[2*n] = sum[2*n];
    for(ll i=n; i<2*n; i++){
        auto itr = left.begin();
        if(*itr<a[i]){
            L[i] = L[i-1] + a[i] - *itr;
            left.insert(a[i]);
            left.erase(itr);
        }
        else L[i] = L[i-1];
    }
    for(ll i=2*n-1; i>=n; i--){
        auto itr = right.end();
        itr--;
        if(*itr>a[i]){
            R[i] = R[i+1] + a[i] - *itr;
            right.insert(a[i]);
            right.erase(itr);
        }
        else R[i] = R[i+1];
    }
    /*for(ll i=n-1; i<2*n; i++) cout << L[i] << " ";
    cout << endl;
    for(ll i=n; i<=2*n; i++) cout << R[i] << " ";
    cout << endl;*/
    ll ans = -LINF;
    for(ll i=n-1; i<2*n; i++){
        ans = max(ans, L[i]-R[i+1]);
    }
    cout << ans << endl;
}


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

#define rep(i, n) for(int (i) = 0; i < (n); ++(i))

typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
  int N;
  std::cin >> N;
  std::vector<int> A(N);

  std::map<int, int> C;
  rep(i, N) {
    std::cin >> A[i];
    ++C[A[i]];
  }

  std::map<int, int> D;
  for(int i = 1; i <= N; ++i) {
    ++D[C[i]];
  }

  std::vector<ll> sum_D(N + 1), sum_kD(N + 1);
  sum_D[0] = D[0];
  sum_kD[0] = 0;
  for(int i = 1; i <= N; ++i) {
    sum_D[i] = sum_D[i - 1] + D[i];
    sum_kD[i] = sum_kD[i - 1] + i * D[i];
  }

  std::vector<ll> fs(N + 1);
  for(int X = 1; X <= N; ++X) {
    fs[X] = (sum_kD[X] + (sum_D[N] - sum_D[X]) * X) / X;
  }

  for(int K = 1; K <= N; ++K) {
    int x = 0;
    while(x + 1 <= N && K <= fs[x + 1]) {
      ++x;
    }
    std::cout << x << '\n';
  }

}


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



using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 998244353;




int main() {

	int n;
	cin >> n;
	VI v(n);
	REP(i, n)cin >> v[i];
	int cur = 1;
	int ans = 0;

	REP(i, n) {
		if (v[i] == cur) {
			cur++;
		}
		else {
			ans++;
		}
	}
	if (cur == 1) {
		cout << -1 << endl;
	}
	else {
		cout << ans << endl;
	}
	
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;

int parent(int i)
{
    return i / 2;
}

int right(int i)
{
    return 2 * i + 1;
}

int left(int i)
{
    return 2 * i;
}

void maxHeapify(vector<int>& A, int i)
{
    int l = left(i), r = right(i), largest;
    if (l < A.size() && A.at(l) > A.at(i)) {
        largest = l;
    } else {
        largest = i;
    }
    if (r < A.size() && A.at(r) > A.at(largest)) {
        largest = r;
    }
    if (largest != i) {
        swap(A.at(i), A.at(largest));
        maxHeapify(A, largest);
    }
}

void buildMaxHeap(vector<int>& A)
{
    for (int i = (A.size() - 1)/2; 0 < i; i--) {
        maxHeapify(A, i);
    }
}

int heapExtractMax(vector<int>& A)
{
    int max = A.at(1);
    A.at(1) = A.back();
    A.pop_back();
    maxHeapify(A, 1);
    return max;
}

void heapIncreaseKey(vector<int>& A, int i, int key)
{
    if (key < A.at(i))
        return;
    A[i] = key;
    while (i > 1 && A.at(parent(i)) < A.at(i)) {
        swap(A.at(i), A.at(parent(i)));
        i = parent(i);
    }
}

void insert(vector<int>& A, int key)
{
    A.push_back(INT_MIN);
    heapIncreaseKey(A, A.size() - 1, key);
}

int main()
{
    string command;
    int k;
    vector<int> A;
    A.push_back(INT_MAX);
    while(1) {
        cin >> command;
        if ("insert" == command) {
            cin >> k;
            insert(A, k);
        } else if ("extract" == command) {
            cout << heapExtractMax(A) << endl;
        } else {
            break;
        }
//        cout << "queue";
//        for (auto itr = A.begin(); itr != A.end(); itr++) {
//            cout << " " << *itr;
//        }
//        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 6968
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

typedef long long ll;

int n;
int d1[100010],d2[100010];
vector<int> v[100010];

void dis1(){
    for(int i=0;i<n;i++)d1[i]=INF;

    queue<int> que;
    que.push(0);
    while(!que.empty()){
        int a=que.front();
        que.pop();
        for(int i=0;i<v[a].size();i++){
            if(d1[v[a][i]]==INF){
                que.push(v[a][i]);
                d1[v[a][i]]=d1[a]+1;
            }
        }
    }
}
void dis2(){
    for(int i=0;i<n;i++)d2[i]=INF;

    queue<int> que;
    que.push(n-1);
    while(!que.empty()){
        int a=que.front();
        que.pop();
        for(int i=0;i<v[a].size();i++){
            if(d2[v[a][i]]==INF){
                que.push(v[a][i]);
                d2[v[a][i]]=d2[a]+1;
            }
        }
    }
}

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

    cin>>n;
    for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    dis1();
    dis2();

    int sum_f=0,sum_s=0;
    for(int i=0;i<n;i++){
        if(d1[i]>d2[i])sum_s++;
        else sum_f++;
    }

    if(sum_f>sum_s)cout<<"Fennec"<<endl;
    else cout<<"Snuke"<<endl;

}

Measured memory_bytes: 6656
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;

}

signed main() {
	ll n;

	cin >> n;

	cout << (n - 2) * 180 << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
#define answer(x) cout << (x) << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    string ans;

    if (n % 2 == 0) {
        if (s.substr(0, n / 2) == s.substr(n / 2)) {
            ans = "Yes";
        } else {
            ans = "No";
        }
    } else {
        ans = "No";
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

S_ba = []
S_ab = []
for i in range(N):
    if A[i] < B[i]: S_ba.append(B[i] - A[i])
    elif A[i] > B[i]: S_ab.append(A[i] - B[i])

ans = len(S_ba)
now = 0
rem = sum(S_ba)
S_ab.sort(reverse=True)

for i in range(len(S_ab)):
    if rem <= now: break
    now += S_ab[i]
    ans += 1

if rem > sum(S_ab): print(-1)
else: print(ans)


Measured memory_bytes: 24108
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  ll a, b, c, x, y, ans = 0;
  scanf("%lld%lld%lld%lld%lld", &a, &b, &c, &x, &y);
  ll xxx = MAX(x, y) - MIN(x, y);
  ll ab = a / 2 + b / 2;
  if (ab < c)
    ans += x * a + y * b;
  else
  {
    ans += MIN(x, y) * c * 2;
    if (x > y)
    {
      if (a < c * 2)
        ans += xxx * a;
      else
        ans += xxx * c * 2;
    }
    else
    {
      if (b < c * 2)
        ans += xxx * b;
      else
        ans += xxx * c * 2;
    }
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

long long modpow(long long a, long long b, long long m) {
	long long p = 1, q = a;
	for (int i = 0; i < 32; i++) {
		if ((b / (1LL << i)) % 2 == 1) { p *= q; p %= m; }
		q *= q; q %= m;
	}
	return p;
}

long long Div(long long a, long long b, long long m) {
	return (a * modpow(b, m - 2, m)) % m;
}

long long mod = 1000000007;
long long fact[1 << 21], inv[1 << 21];

void init() {
	fact[0] = 1;
	for (int i = 1; i <= 2000000; i++) fact[i] = (1LL * i * fact[i - 1]) % mod;
	for (int i = 1; i <= 2000000; i++) inv[i] = Div(1, fact[i], mod);
}

long long ncr(int n, int r) {
	if (n < r || r < 0) return 0;
	return (fact[n] * inv[r] % mod) * inv[n - r] % mod;
}

int main() {
	string S; int K; cin >> K >> S; init();
	long long ans = 0;
	for (int i = S.size(); i <= S.size() + K; i++) {
		long long V1 = modpow(25LL, S.size() + K - i, mod);
		long long V2 = ncr(S.size() + K, i);
		ans += V1 * V2;
		ans %= mod;
	}
	cout << (ans + 1LL) % mod << endl;
	return 0;
}

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

int main(){
  int N;
  cin>>N;
  if(N%10==3)
    cout<<"bon"<<endl;
  else if(N%10==0 || N%10==1 || N%10==6 || N%10==8)
    cout<<"pon"<<endl;
  else
    cout<<"hon"<<endl;
}

Measured memory_bytes: 3620
#include <cmath>
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;


//eps??????????????´???????????¨
inline double add(double a, double b){
    return abs(a+b)<(1e-10)*(abs(a)+abs(b)) ? 0.0 : a+b;
}

//double???2?¬????????????????
struct vec{
    long double x,y;
    vec operator-(vec b){
        return (vec){add(x,-b.x),add(y,-b.y)};
    }
    vec operator+(vec b){
        return (vec){add(x,b.x),add(y,b.y)};
    }
    vec operator*(long double d){
        return (vec){x*d,y*d};
    }
    bool operator==(vec b){
        return x==b.x&&y==b.y;
    }
    bool operator!=(vec b){
        return x!=b.x||y!=b.y;
    }
    bool operator<(const vec&r) const{
    return this->x==r.x?this->y<r.y:this->x<r.x;
    }
    long double dot(vec v){//??????
        return add(x*v.x,y*v.y);
    }
    long double cross(vec v){//??????
        return add(x*v.y,-y*v.x);
    }
    long double norm(){//?????????
        return sqrt(x*x+y*y);//???????????????????????¨??????hypot??§?????????????????????
    }
};

//????????¢??°CCW
int ccw(vec& a, vec& b, vec& c){
    vec ab = b-a, ac = c-a;
    double o = ab.cross(ac);
    if(o>0) return 1; //CCW
    if(o<0) return -1; //CW
    if(ab.dot(ac)<0){
        return 2; //C-A-B
    }else{
        if(ab.dot(ab)<ac.dot(ac)){
            return -2; //A-B-C
        }else{
            return 0; //A-C-B
        }
    }
}

//??????
vector<vec> convex_hull(vector<vec>& V){
    vector<vec> C;
    vector<vec>::iterator ite;
    sort(V.begin(),V.end(),[](const vec& a, const vec& b){return a.y==b.y ? a.x < b.x : a.y< b.y;});
    C.push_back(V[0]),C.push_back(V[1]);
    //?????´
    for(int i=2; i<V.size(); i++){
        vec v = V[i];
        while(C.size()>=2&&ccw(C[C.size()-2],C.back(),v)==-1) C.pop_back();
        C.push_back(v);
    }
    //?????´
    for(int i=V.size()-2; i>=0; i--){
        vec v = V[i];
        while(C.size()>=2&&ccw(C[C.size()-2],C.back(),v)==-1) C.pop_back();
        C.push_back(v);
    }
    C.pop_back();
    return C;
}

int main(){
    int n;
    cin >> n;
    vec v;
    vector<vec> V,C;
    while(n--){
        cin >> v.x >> v.y;
        V.push_back(v);
    }
    C=convex_hull(V);
    cout << C.size() << endl;
    for(auto& i : C) cout << i.x << " " << i.y << endl;
    return 0;
}

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

public class Main
{
    public static void main(String [] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        for(int i = 0; i < n; i++)
        {
            System.out.print("ACL");
        }
    }
}


Measured memory_bytes: 32464
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b){
  if (b == 0){
    return a;
  } else {
    return gcd(b, a % b);
  }
}
int dfs(int num, int denom, int prod, int a, int cnt, int prev){
  if (num == 0){
    return 1;
  }
  if (cnt == 1){
    if (num == 1 && prod * denom <= a && denom >= prev){
      return 1;
    } else {
      return 0;
    }
  }
  int ans = 0;
  for (int i = prev; i * prod <= a; i++){
    if (i * num <= cnt * denom){
      int num2 = num * i - denom;
      int denom2 = denom * i;
      if (num2 >= 0){
        int g = gcd(num2, denom2);
        num2 /= g;
        denom2 /= g;
        if (denom2 <= a){
          ans += dfs(num2, denom2, prod * i, a, cnt - 1, i);
        }
      }
    }
  }
  return ans;
}
int main(){
  while (1){
    int p, q, a, n;
    cin >> p >> q >> a >> n;
    if (p == 0 && q == 0 && a == 0 && n == 0){
      break;
    }
    cout << dfs(p, q, 1, a, n, 1) << endl;
  }
}


Measured memory_bytes: 3012
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int find_(int x,vector<int> &v){
    if(v[x]<0) return x;
    v[x]=find_(v[x],v);
    return v[x];
}

int same_(int a,int b,vector<int> &v){
    if(find_(a,v)==find_(b,v)) return 1;
    return 0;
}

void union_(int a,int b,vector<int> &v){
    if(same_(a,b,v)) return;
    int a_p=find_(a,v),b_p=find_(b,v);
    if(a_p>b_p) swap(a_p,b_p);
    v[a_p]+=v[b_p]; v[b_p]=a_p;
}

int main() {
    int n,m,ans=0; cin>>n>>m;
    int a,b; 
    vector<pp> e;
    rep(i,m){
        cin>>a>>b; a--; b--;
        e.push_back(mk(a,b));
    }
    rep(i,m){
        vector<int> v(n,-1);
        rep(j,m){
            if(i==j) continue;
            tie(a,b)=e[j];
            union_(a,b,v);
        }
        tie(a,b)=e[i];
        if(!(same_(a,b,v))) ans++;
    }
    cout<<ans<<endl;
}

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

ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	ll A,B;
	cin>>A>>B;
    ll gcd_ab = gcd(A,B);
    ll ans = 1;
    ll n=2;
    while((double)n<pow(gcd_ab,0.5)){
        if(gcd_ab%n==0){
            ++ans;
            gcd_ab/=n;
            while(gcd_ab%n==0){
                gcd_ab/=n;
            }
        }
        ++n;
    }
    if(gcd_ab!=1) ++ans;
    cout<<ans<<"\n";

	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define faster  ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pb push_back
const double PI = acos(-1.0);
using namespace std;

int main()
{
    faster

    int n,x;
    cin>>n;

    map<int,int> m;
    map<int,int>:: iterator it;

    for(int i=0; i<n; i++)
    {
        cin>>x;
        m[x]++;
    }

    int c=0;

    for(it=m.begin(); it!=m.end(); it++)
    {
        int p=it->first, q=it->second;

        if(p==1)
        {
            if(q==1)
                cout<<1<<endl;
            else
                cout<<0<<endl;
            return 0;
        }

        if(q<=1)
        {
            bool hp=true;

            //cout<<p<<" pp"<<endl;

            for(int i=2; i*i<=p; i++)
            {

                if(i*i==p)
                {

                    if(m[i]!=0)
                    {
                        hp=false;
                        break;
                    }

                    //cout<<i<<" X "<<i<<endl;
                }
                else if(p%i==0)
                {
                    if(m[i]!=0)
                    {
                        hp=false;
                        break;
                    }

                    if(m[p/i]!=0)
                    {
                        hp=false;
                        break;
                    }

                    //cout<<i<<" X "<<p/i<<endl;


                }
            }
            if(hp==true)
                c++;
        }

        //cout<<p<<" ** "<<c<<endl;

    }

    cout<<c<<endl;




    return 0;
}


Measured memory_bytes: 32516
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
//#define INF (INT_MAX/2)
#define EPS (1.0e-8)
//#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


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

    int N; cin >> N;
    vi A(N); REP(i, N) cin >> A[i];

    map<string, int> mp;
    REP(i,N){
        if (1<=A[i] && A[i]<=399) {
            mp["gray"]++;
        } else if (400 <= A[i] && A[i] <= 799) {
            mp["brown"]++;
        } else if (800 <= A[i] && A[i] <= 1199) {
            mp["green"]++;
        } else if (1200 <= A[i] && A[i] <= 1599) {
            mp["light_blue"]++;
        } else if (1600 <= A[i] && A[i] <= 1999) {
            mp["blue"]++;
        } else if (2000 <= A[i] && A[i] <= 2399) {
            mp["yellow"]++;
        } else if (2400 <= A[i] && A[i] <= 2799) {
            mp["orange"]++;
        } else if (2800 <= A[i] && A[i] <= 3199) {
            mp["red"]++;
        } else if (3200 <= A[i]) {
            mp["super"]++;
        }
    }

    int lo = 0, hi = 0;
    if (mp.count("super") > 0) {
        for(auto p : mp) {
            if (p.first == "super") continue;
            lo++;
        }
        if (lo == 0) {
            lo = 1;
            hi = mp["super"];
        } else {
            hi = lo + mp["super"];
        }
    } else {
        for(auto p : mp) {
            lo++;
        }
        hi = lo;
    }

    cout << lo << " " << hi << endl;

    return 0;
}

Measured memory_bytes: 256
from functools import lru_cache
N, K = map(int, input().split())
D = input().split()

O = []
for c in "0123456789":
    if c not in D:
        O.append(c)

# N = 523
# D = 2 3

#@lru_cache()
def func(s, i, over):
    if i == len(s):
        return ""
    # d < N[0] 
    if over:
        return O[0] + func(s, i+1, over=True)
    for d in O:
        if d < s[i]:
            continue
        if s[i] == d:
            return d + func(s, i+1, over=False)
        return d + func(s, i+1, over=True)
    return "10" + func(s, i+1, over=True)

def solve(N, D):
    D = set(list(D))
    while True:
        ok = True
        for c in str(N):
            if c in D:
               ok = False
               break
        if ok:
            return N
        N+=1

print(solve(N, D))
#print(func(str(N), 0, over=False))

Measured memory_bytes: 39280
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#define RG register
#define il inline
#define iter iterator
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
using namespace std;
struct node{
	double val,s,w;
	bool operator <(const node &pp)const{
		return val>pp.val;
	}
}a[5];
void work()
{
	for(int i=1;i<=4;i++)scanf("%lf",&a[i].s);
	int n;
	scanf("%d",&n);
	a[1].w=0.25;a[2].w=0.5;a[3].w=1;a[4].w=2;
	for(int i=1;i<=4;i++)a[i].val=a[i].w/a[i].s;
	sort(a+1,a+5);
	int tmp;long long ans=0;
	for(int i=1;i<=4;i++){
		if(n==0)break;
		if(n>=a[i].w){
			tmp=n/a[i].w;
			ans+=(long long)a[i].s*tmp;
			n-=tmp*a[i].w;
		}
	}
	printf("%lld\n",ans);
}

int main()
{
	work();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <stack>
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
int main(void) {
	int h,n;
	cin >> h >> n;
	int sum_val = 0;
	for (int i = 0;i < n;i++) {
		int a;
		cin >> a;
		sum_val += a;
	}
	if (h <= sum_val)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#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 MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int m1, d1, m2, d2;
  cin >> m1 >> d1 >> m2 >> d2;
  if(m1 == m2) cout << 0 << endl;
  else cout << 1 << endl;
}


Measured memory_bytes: 892
import statistics
m = str(input());

A = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
A.extend(A);
l = [];
for i in range(0,len(m)):
    for j in range(0,26):
        if m[i] == A[j]:
            
            
            l.append(A[j-3]);

print(''.join(l));



Measured memory_bytes: 6868
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;
 
#define Endl endl
 
/*--------------------template--------------------*/
int main() {
    ll a, b;
    cin >> a >> b;
    ans = 0;
    FOR(i, 1, b - a) {
        ans += i;
    }
    ans = ans - a;
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val in = new java.util.Scanner(System.in)
  val H, W = in.nextLong
  val n =
    if (H == 1 || W == 1) 1
    else H * W / 2 + (if (H % 2 == 0 || W % 2 == 0) 0 else 1)
  println(n)
}

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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);


  int n,k;cin>>n>>k;
  int ans=0;
  for(int i=0;i<n;i++){
    int t;cin>>t;
    if(t>=k)ans++;
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 3536
($h, $w)=split / /, <>;
while(<>){
	chomp;
	@{$mat[@mat]}=split //, $_;
}
$flag=0;
for($i=0; $i<$h; $i++){
	for($j=0; $j<$w; $j++){
		if($mat[$i][$j] eq '#'){
			if($mat[$i-1][$j] ne '#' && $mat[$i+1][$j] ne '#' && $mat[$i][$j-1] ne '#' && $mat[$i][$j+1] ne '#'){$flag=1; last;}
		}
	}
	last if $flag;
}
if($flag){print "No\n";}
else{print "Yes\n";}

Measured memory_bytes: 768
import java.util.Arrays;
import java.util.Scanner;

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

	long[] accum;
	long[] S;
	int N, M, L;
	int[] K;

	void solver() {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		M = sc.nextInt();
		L = sc.nextInt();
		K = new int[N];
		S = new long[M];
		for (int i = 0; i < N; i++) {
			K[i] = sc.nextInt() - 1;
		}
		for (int i = 0; i < M; i++) {
			S[i] = sc.nextLong();
		}
		accum = new long[M];
		for (int i = 0; i < M; i++) {
			if (i >= 1)
				accum[i] += accum[i - 1];
			accum[i] += S[i];
		}
		Arrays.sort(K);
		for (int i = 0; i < 2010; i++) {
			for (int j = 0; j < 2010; j++) {
				memo[i][j] = -1;
			}
		}
		System.out.println(dfs(0, 0));

	}

	long dfs(int l, int r) {
		if (l > r) {
			int tmp = l;
			l = r;
			r = tmp;
		}
		int t = Math.max(l, r) + 1;
		if (t == N - 1) {
			return cost(t, l) + cost(t, r);
		}
		if (memo[l][r] != -1)
			return memo[l][r];
		return memo[l][r] = Math.min(cost(t, l) + dfs(t, r), dfs(l, t) + cost(t, r));
	}

	long cost(int l, int r) {
		l = K[l];
		r = K[r];
		if (r < l) {
			int tmp = r;
			r = l;
			l = tmp;
		}
		return Math.abs((accum[r] - accum[l] + S[l]) / L);
	}

	long[][] memo = new long[2010][2010];
}

Measured memory_bytes: 113396
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
	string s;
	int q;
	
	cin >> s;
	cin >> q;
	
	for(int i=0; i<q; ++i){
		string od, p;
		int a, b;
		
		cin >> od >> a >> b;
		if(od=="replace"){
			cin >> p;
			s = s.replace(a, b-a+1, p);
		}
		else if(od=="print"){
			cout << s.substr(a, b-a+1) << endl;
		}
		else if(od=="reverse"){
			string tmp = s.substr(a, b-a+1);
			reverse(tmp.begin(), tmp.end());
			//cout <<"tmp=" << tmp <<endl;
			s = s.replace(a, b-a+1, tmp);	
		}
		
		//cout << s << endl;
		
	}
	return 0;
}

Measured memory_bytes: 1220
from collections import defaultdict as d

n = int(input())
arr = list(map(int, input().split()))

di = d(int)
for i in arr:
	di[i] += 1
	
s = 0
for key, value in di.items():
	s += (value * (value - 1)) // 2

di2 = d(int)

for key, value in di.items():
	nw = (value * (value - 1)) // 2
	x = s - nw
	di2[key] = x + ((value - 1) * (value - 2)) // 2
	
for i in range(n):
	print(di2[arr[i]])

Measured memory_bytes: 35224
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
int n,q;
vector<vector<int> > G(200010);
ll counter[200010];
int dfs1(int x,int p){
    counter[x]+=counter[p];
    for(auto e:G[x]){
        if(e==p)continue;
        dfs1(e,x);
    }
    return 0;
}
int main(){
    cin>>n>>q;
    rep(i,n-1){
        int a,b;cin>>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    rep(i,q){
        int p,x;cin>>p>>x;
        counter[p]+=x;
    }
    dfs1(1,0);
    REP(i,1,n)cout<<counter[i]<<' ';
    cout<<counter[n]<<endl;
}

Measured memory_bytes: 24320
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define Endl endl

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int ceil_(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); }
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * ceil_(a, b)); }
int bpm(int x, unsigned int y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
void cumulative_sum(T &container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}

class BCountBalls {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    int N, A, B;
    cin >> N >> A >> B;
    cout << A * (N / (A + B)) + min(A, N % (A + B)) << endl;
  }
};


signed main() {
  BCountBalls solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


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

int main() {
  string N;
  cin >> N;

  if (N[0] == N[1] && N[1] == N[2] ) {
    cout << "Yes";
  } 

  else if (N[1] == N[2] && N[2] == N[3]) {
    cout << "Yes";
  }
  
  else {
    cout << "No";
  }
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {

	private static void solve(){
		//Implement solution here.
		int n = ni();
		int[] p = na(n);
		int[] q = na(n);
		System.out.println(Math.abs(count(n,p) - count(n,q)));
	}
	
	private static int count(int n, int[] a) {
		int[] factorial = {0,1,2,6,24,120,720,5040};
		int usedcnt = 0;
		boolean[] used = new boolean[n];
		int result = 1;
		for(int ai:a) {
			int cnt = 0;
			used[ai - 1] = true;
			usedcnt++;
			for(int i = 0; i < ai; i++)if(!used[i])cnt++;
			result += cnt * factorial[n - usedcnt];
		}
		return result;
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 22612
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int N;
	long long C;

	
	cin >> N >> C;
	vector<long long>     cw(N + 1);
	vector<long long>  cwRev(N + 1);
	vector<long long>  sumCw(N + 1);
	vector<long long>    acw(N + 1);
	vector<long long> acwRev(N + 1);
	vector<long long> sumAcw(N + 1);
	vector<long long> new_cw(N + 1);
	vector<long long> new_cwRev(N + 1);
	vector<long long> new_acw(N + 1);
	vector<long long> new_acwRev(N + 1);
	vector<long long> x(N);
	vector<long long> v(N);
	for(int i = 0; i < N; i++) {
		cin >> x[i] >> v[i];
	}

	 sumCw[0] = 0;
	    cw[0] = 0;
	 cwRev[0] = 0;
	sumAcw[0] = 0;
	   acw[0] = 0;
	acwRev[0] = 0;
	new_cw[0] = 0;
	new_cwRev[0] = 0;
	new_acw[0] = 0;
	new_acwRev[0] = 0;
	for(int i = 1; i <= N; i++) {
		 sumCw[i] = sumCw[i - 1] + v[i - 1];
		    cw[i] = sumCw[i] - x[i - 1];
		 cwRev[i] = sumCw[i] - 2*x[i - 1];
		sumAcw[i] = sumAcw[i - 1] + v[N - i];
		   acw[i] = sumAcw[i] - (C - x[N - i]);
		acwRev[i] = sumAcw[i] - 2*(C - x[N - i]);
		new_cw[i] = max(new_cw[i - 1], cw[i]);
		new_cwRev[i] = max(new_cwRev[i - 1], cwRev[i]);
		new_acw[i] = max(new_acw[i - 1], acw[i]);
		new_acwRev[i] = max(new_acwRev[i - 1], acwRev[i]);
	}
	
	long long cal = 0;
	for(int div = 0; div <= N; div++) {
		cal = max(cw[div], cal);
		cal = max(cwRev[div] + new_acw[N - div], cal);
		cal = max(acw[div], cal);
		cal = max(acwRev[div] + new_cw[N - div], cal);
	}
	cout << cal << endl;

	/*
	cout << endl;
	cout << "sumcw: " << flush;
	for(int i = 0; i <= N; i++) cout << sumCw[i] << ' ';
	cout << endl;
	cout << "cw: " << flush;
	for(int i = 0; i <= N; i++) cout << cw[i] << ' ';
	cout << endl;
	cout << "cwRev: " << flush;
	for(int i = 0; i <= N; i++) cout << cwRev[i] << ' ';
	cout << endl;
	cout << "sumacw: " << flush;
	for(int i = 0; i <= N; i++) cout << sumAcw[i] << ' ';
	cout << endl;
	cout << "acw: " << flush;
	for(int i = 0; i <= N; i++) cout << acw[i] << ' ';
	cout << endl;
	cout << "acwRev: " << flush;
	for(int i = 0; i <= N; i++) cout << acwRev[i] << ' ';
	cout << endl;
	cout << "new_cw: " << flush;
	for(int i = 0; i <= N; i++) cout << new_cw[i] << ' ';
	cout << endl;
	cout << "new_cwrev: " << flush;
	for(int i = 0; i <= N; i++) cout << new_cwRev[i] << ' ';
	cout << endl;
	cout << "new_acw: " << flush;
	for(int i = 0; i <= N; i++) cout << new_acw[i] << ' ';
	cout << endl;
	cout << "new_acwrev: " << flush;
	for(int i = 0; i <= N; i++) cout << new_acwRev[i] << ' ';
	cout << endl;
	*/

	return 0;
}


Measured memory_bytes: 9600
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<random>
#include<stack>
#include<queue>
#include<bitset>
#include<sstream>

using namespace std;
using ll = long long;


int main(int argc, const char *argv[]){
    int n, m, p;
    vector<int> a,b,c;
    cin >> n >> m >>p;
    for(int i=0;i<m;i++){
        int _a, _b, _c;
        cin >> _a >> _b >> _c;
        a.push_back(_a);
        b.push_back(_b);
        c.push_back(_c);
    }
    vector<ll> node(n,-100000*2*m-1);
    node[0] = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            node[b[j]-1] = max(node[b[j]-1],node[a[j]-1]+c[j]-p);
        }
    }
    ll ans=node[n-1];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            node[b[j]-1] = max(node[b[j]-1],node[a[j]-1]+c[j]-p);
        }
    }
    ll ans1 = node[n-1];
    if(ans1>ans){
        cout << -1 << endl;
        return 0;
    }
    cout << max(ans,ll(0)) << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

int main() {
    ll n;
    cin >> n;
    vector<ll> vec(10000001, 0);
  	for(ll i=1; i<=10000000; i++){
      ll t = i;
      while(t <= 10000000){
       	vec[t]++;
        t += i;
      }
    }
  	ll ans = 0;
  	for(ll i=1; i<=n; i++) ans += i*vec[i];
  	cout << ans << endl; 
    return 0;
}


Measured memory_bytes: 81336
#include<iostream> //头文件，下同
#include<algorithm> 
using namespace std;
int a[110];
int main(){
    int n;
    cin>>n;
    n=n*2; //因为输入的数量是n*2，所以要把n乘2
    for(register int i=1;i<=n;i++){
        cin>>a[i];//输入
    }
    sort(a+1,a+n+1);//排序，上面说原因了
    int sum=0;
    for(register int i=1;i<=n;i+=2){
        sum+=a[i];//把奇数项数字和求出来
    }
    cout<<sum<<endl;//输出
    return 0; //返回 0
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
	int x, y, z;
	cin >> x >> y >> z;
	cout << (x - z) / (y + z) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[105][105],b[105];
int main()
{
	int n,m,c,ans=0,cnt;
	cin>>n>>m>>c;
	for(int i=0;i<m;i++)
        scanf("%d",&b[i]);
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            scanf("%d",&a[i][j]);
    for(int i=0;i<n;i++)
    {
        cnt=0;
        for(int j=0;j<m;j++)
        {
            cnt+=a[i][j]*b[j];
        }
        cnt+=c;
        if(cnt>0)
            ans++;
    }
    cout<<ans<<endl;
	return 0;
}


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

typedef long long ll;
//loop
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//STL
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

//const
#define MOD 1000000007 //10^9+7:合同式の法

//acronym
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

void Main() {
    vector<int> a(3);
    REP(i, 3) {
        cin >> a.at(i);
    }
    sort(ALL(a));
    if (a[0] == 5 && a[1] == 5 && a[2] == 7) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return;
}

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


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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




int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    vector<pair<int, pair<int, int>>> v(m);
    REP(i, m){
        int p, y;
        scanf("%d %d", &p, &y);
        v[i] = {y, {p, i}};
    }
    sort(v.begin(), v.end());
    vector<int> cnt(n + 1, 1);
    vector<pair<int, int>> ans(m);
    REP(i, m){
        int p = v[i].second.first, idx = v[i].second.second;
        ans[idx].first = p;
        ans[idx].second = cnt[p]++;
    }
    REP(i, m){
        printf("%06d%06d\n", ans[i].first, ans[i].second);
    }
}


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

int main(){
    int a,b;
    cin>>a>>b;
    if(a==b){
        for(int i=0;i<a;i++){
        cout<<a;
        }
    }
    else if(a>b){
        for(int i=0;i<a;i++){
           cout<<b; 
        }
    }
   
   else if(a<b){
        for(int i=0;i<b;i++){
           cout<<a; 
        }
    } 
}

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

using namespace std;
typedef         long long int   ll;
#define         MAX         200010
#define         input       freopen("input.txt","r",stdin)
#define         output      freopen("output1.txt","w",stdout)
#define         inf         1000000050

int main(){

    //freopen("input.txt","w",stdout);
    int n;
    cin>>n;
    if(n>=30){
        cout<<"Yes"<<endl;
    }else cout<<"No"<<endl;

    return 0;
}

/**

*/


Measured memory_bytes: 3532
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
ll fact(ll num)
{
	ll ans=1;
	rep(i,1,num+1)
	ans*=i;
	return ans;
}
ld dist(ld a,ld b,ld c,ld d)
{
	ld x=(ld)((c-a)*(c-a));
	ld y=(ld)((d-b)*(d-b));
	x+=y;
	return sqrt(x);
}
int main()
{	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
        ll n;cin>>n;
	vii vv(n+5);
	vi v;

	rep(i,1,n+1)
	v.pb(i);

	rep(i,1,n+1)
	cin>>vv[i].ff>>vv[i].ss;

	ld ans=.00;
	do
	{
		ld curr=0;
		ll ind=v[0];
		pii start={vv[ind].ff,vv[ind].ss};
		rep(i,1,v.size())
		{
			curr+=dist(start.ff,start.ss,vv[v[i]].ff,vv[v[i]].ss);
			start={vv[v[i]].ff,vv[v[i]].ss};
		}	
		ans+=curr;
	}
	while(next_permutation(all(v)));
	 std::cout << std::setprecision(10) <<ans/(ld)fact(n)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAX 1000000000
int dx[] = {1,0,-1,0};
int dy[] = {0,-1,0,1};
const ll INF = 10010010010001;
vector<vector<bool>> graph;
vector<bool> reached;
ll MOD = 1000000007;

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    for(int i=0;i<S.size();i++){
        if(S[i]+N > 90){
            S[i] = char('A'+(S[i]+N-91));
        }
        else{
            S[i] = char(S[i]+N);
        }
    }
    cout << S << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll=long long;  
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,b;
    cin >> n >> a >> b;
    if(a>b){
        cout << 0 << endl;
        return 0;
    }
    
    if(n==1){
        if(a==b)cout << 1 << endl;
        else if(a!=b)cout << 0 << endl;
        return 0;
    }
	

    cout << (b-a)*(n-2)+1 <<endl;
    return 0;
}


Measured memory_bytes: 256
//*Author : Franklin*
#include<bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
const int N = 2e5;
#define deb(x) cout << #x << "=" << x << "\n"
#define debug(a) for(auto &x:a) cout << x << " "
#define debugg(p) for(auto &x:p) cout << "(" << x.first << "," << x.second << ")" << "\n"

int a[100005],b[100005],c[100005];
int dp[100005][3];

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

    int n; scanf("%d",&n);
    for(int i=0; i<n; i++) scanf("%d%d%d",a+i,b+i,c+i);

    for(int i=0; i<n; i++) {
        for(int j=0; j<3; j++) {
            if(i==0) {
                if(j==0) dp[i][j] = a[i];
                else if(j==1) dp[i][j] = b[i];
                else dp[i][j] = c[i];
            }else {
                for(int k=0; k<3; k++) {
                    if(j==k) continue;
                    if(j==0) dp[i][j] = max(dp[i][j],dp[i-1][k]+a[i]);
                    else if(j==1) dp[i][j] = max(dp[i][j],dp[i-1][k]+b[i]);
                    else dp[i][j] = max(dp[i][j],dp[i-1][k]+c[i]);
                }
            }
        }
    }
    int ans = 0;
    ans = max(ans,dp[n-1][0]);
    ans = max(ans,dp[n-1][1]);
    ans = max(ans,dp[n-1][2]);
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 6020
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
long []a=Read.longs();
Console.WriteLine(1+a[0]+a[1]-gcd(a[1],a[0]));
    }
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b) { return a / gcd(a, b) * b; }
    public static string Reverse(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static bool IsPrime(int num)
    {
        if (num < 2) return false;
        else if (num == 2) return true;
        else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2)
        {
            if (num % i == 0)
            {
                // 素数ではない
                return false;
            }
        }

        // 素数である
        return true;
    }
}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long() { return long.Parse(Console.ReadLine()); }
    public static long[] longs() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); }
    public static int Int() { return int.Parse(Console.ReadLine()); }
    public static int[] ints() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define ll long long
using namespace std;
unordered_set<string> S;
int main() {
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        string s;
        cin >> s;
        S.insert(s);
    }
    cout << S.size() << '\n';
    return 0;
}

Measured memory_bytes: 17676
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <random>
#include <stdlib.h>
#include <string>
using namespace std;

#define rep(i, b, e) for(i = b; i < e; ++i)
#define ull unsigned long long int

int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, cnt = 0;
    cin >> n;
    string s;
    
    cin >> s;

    for (int i = 0; i < n - 1; ++i) {
        while (s[i] == s[i + 1]) {
            ++i;
        }
        if (i >= n) break;
        if (s[i] != s[i + 1]) ++cnt;
    }

    if (s[n - 1] != s[n - 2]) ++cnt;
    
    cout << cnt << endl;;

    return 0;
}


Measured memory_bytes: 512