akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    set<string> se;
    rep(i,n) {
        string s;
        cin >> s;
        se.insert(s);
    }
    cout << se.size() << endl;
}

Measured memory_bytes: 19272
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
   
    int N, C;
    cin >> N >> C;
    
    int D[C][C];
    rep(i, C) rep(j, C) cin >> D[i][j];
    
    int table[3][30] = {0};
    rep(i, N) rep(j, N) {
        int c;
        cin >> c;
        c--;
        table[(i + 1 + j + 1) % 3][c]++;
        
    }
    
    vector<vector<pii> > v(3);
    rep(i, 3) rep(j, C) { // 余りiのグループで色jに揃えたときのcost
        int sum = 0; // 500とも1000かかる
        rep(k, C) {
            sum += table[i][k] * D[k][j];
        }
        v[i].eb(pii{sum, j});
    }
    
    rep(i, 3) sort(all(v[i]));
    
    /*
    rep(i, 3) {
        cout << endl;
        rep(j, sz(v[i])) cout << v[i][j].F << " " << v[i][j].S << endl;
    }
    cout << endl;
    */
    
    int ans = inf;
    rep(i, 3) rep(j, 3) rep(k, 3) {
        if (v[0][i].S != v[1][j].S && v[1][j].S != v[2][k].S && v[2][k].S != v[0][i].S) {
            
            chmin(ans, v[0][i].F + v[1][j].F + v[2][k].F);
            // out(ans << " " << i << " " << j << " " << k);
        }
    }
    
    out(ans);
}




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

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        boolean[] isSafe = new boolean[n+1];

        Arrays.fill(isSafe,true);
        for(int i = 0; i < m; i++) {
            isSafe[sc.nextInt()] = false;
        }

        long[] dp = new long[n+1];
        Arrays.fill(dp,0);

        dp[0] = 1;
        if(isSafe[1]) dp[1] = 1;

        for(int i = 2; i <=n; i++) {
            if(isSafe[i-1]) dp[i] += dp[i-1];
            if(isSafe[i-2]) dp[i] += dp[i-2];
            dp[i] %= 1000000007;
        }

        System.out.println(dp[n]);
    }
}


Measured memory_bytes: 47492
nsets = []
nset = []

while True:
    nset = list(map(int, input().split()))
    if nset[0] == 0 and nset[1] == 0:
        break
    nsets.append(nset)
    nset = []

for i in range(len(nsets)):
    nums = nsets[i]
    if nums[0] > nums[1]:
        print("{} {}" .format(nums[1], nums[0]))
    else:
        print("{} {}" .format(nums[0], nums[1]))


Measured memory_bytes: 5980
#include<cstdio>
#include<cstring>

char str[2*100000];

int main(){
  long long int m;
  m = scanf("%s", str);
  if(m <= 0)
    return 1;
  
  long long int l = strlen(str);
  long long int black = 0, ans = 0;
  
  for(int i = 0; i < l; i++){
    if(str[i] == 'B')
      black++;
    else
      ans += black;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n,k;
	cin>>n>>k;
	int ans=0;
	int a[n];
	for (int i=0; i<n; i++)
	{
		cin>>a[i];
		if (a[i]>=k)
		{
			ans++;
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;

int main() {
	int a[7][2] = {};

	for (int i = 0; i < 7; i++) {
		cin >> a[i][0] >> a[i][1];
	}

	for (int i = 0; i < 7; i++) {
		cout << a[i][0] - a[i][1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;
import java.util.Stack;

public class Main {

    private static final int N = 100;
    static Scanner scanner = new Scanner(System.in);
    static int[][] Mat = new int[N][N];
    static int[] Start = new int[N];
    static int[] Finish = new int[N];
    static int[] Next = new int[N];
    static int[] Color = new int[N];

    static int n;
    static int time = 1;



    public static void main(String[] argss){

        graph_input();
        for (int i = 0; i < n; i++) {
            if (Color[i] == 0)
                dfs(i);
        }
        print_answer();
    }

    public static void print_answer() {
        for (int i = 0; i < n; i++) {
            System.out.print((i+1) + " ");
            System.out.print(Start[i] + " ");
            System.out.print(Finish[i] + "\n");
        }
    }

    public static void dfs(int u) {
        for (int i = 0; i < n; i++) {
            Next[i] = 0;
        }
        Stack<Integer> stack = new Stack<>();
        int v;

        stack.push(u);
        Start[u] = time++;
        Color[u] = 1;

        while (!stack.empty()){
            u = stack.peek();
            v = next_vertex(u);

            if (v != -1){
                if (Color[v] == 0){
                    Color[v] = 1;
                    Start[v] = time++;
                    stack.push(v);
                }
            }
            else {
                Color[u] = 2;
                stack.pop();
                Finish[u] = time++;
            }
        }
    }

    public static int next_vertex(int u) {
        for (int v = Next[u]; v < n; v++) {
            Next[u] = v + 1;
            if (Mat[u][v] == 1)
                return v;
        }
        return -1;
    }

    public static void graph_output() {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                System.out.print(Mat[i][j]);
                if (j != n - 1)
                    System.out.print(" ");
            }
            System.out.print("\n");
        }
    }

    public static void graph_input() {

        n = scanner.nextInt();

        int u, k, v;
        for (int i = 0; i < n; i++) {
            u = scanner.nextInt();
            k = scanner.nextInt();
            for (int j = 0; j < k; j++) {
                v = scanner.nextInt();
                Mat[u-1][v-1] = 1;
            }
        }
    }
}

Measured memory_bytes: 28396
/*Arnab's Code
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define vll vector<ll>
#define vii vector<int>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define take(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define takes(a,n,st) for(ll i=st;i<n+st;i++)cin>>a[i]
ll sum(ll a[],ll n,ll s){ for(ll i=0;i<n;i++)s+=a[i]; return s;}
#define mod 1000000009
ll power(ll x, ll y, ll p)  {  
    ll res = 1;  
    x = x % p;   
    if (x == 0) return 0;  
    while (y > 0){  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}
char s[4];
void solve(){
	cin>>s;
	if(s[0]=='R' and s[1]=='R' and s[2]=='R')
		cout<<3;
	else if(s[0]=='S' and s[1]=='S' and s[2]=='S')
		cout<<0;
	else if(s[0]=='R' and s[1]=='R' and s[2]=='S')
		cout<<2;
	else if(s[0]=='S' and s[1]=='R' and s[2]=='R')
		cout<<2;
	else
		cout<<1;
	return;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ll t,T;
//	cin>>T;
	T=1;
	for(t=1;t<=T;t++){
//		cout<<"Case #"<<t<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 3596
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    int N;
    ll X;
    in2(N, X);

    vll L(N);
    rep(i, N) in(L[i]);

    vll D(N + 1);
    rep(i, N) D[i + 1] = D[i] + L[i];

    int count = 0;
    rep(i, D.size())
    {
        if (D[i] <= X) count++;
    }

    outl(count);

    return 0;
}

Measured memory_bytes: 3664
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
// bool operator<(const pair<int, int> &a, const pair<int, int> &b)
// {
//     if (a.first == b.first)
//         return a.second < b.second;
//     return a.first < b.first;
// };

/*unsigned int xor128(void)
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
unsigned int xor128rnd(unsigned int m)
{
    return xor128() % m;
}*/

/*bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return a.second < b.second;
    }
    return a.first < b.first;
}*/

int N, H, W;
ll A[100010], B[100010];
vector<pair<ll, ll>> v1;
vector<ll> v2;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(12);

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

    ll t = 0;
    for (int i = 0; i < N; ++i)
    {
        t += v1[i].first - v1[i].second;
        if (v1[i].first - v1[i].second > 0)
            v2.push_back(v1[i].first - v1[i].second);
    }
    if (t < 0)
    {
        cout << -1 << endl;
        return 0;
    }
    sort(v2.begin(), v2.end(), greater<int>());

    int idx = 0, cnt = 0;
    for (int i = 0; i < N; ++i)
    {
        t = v1[i].first - v1[i].second;
        //cout << t << endl;
        if (t < 0)
        {
            t *= -1;
            if (v2[idx] - t > 0)
            {
                v2[idx] -= t;
            }
            else
            {
                while (t > 0)
                {
                    if (t - v2[idx] < 0)
                    {
                        v2[idx] -= t;
                        break;
                    }
                    t -= v2[idx];
                    idx++;
                }
            }
            cnt++;
        }
    }
    if (cnt == 0)
    {
        cout << 0 << endl;
        return 0;
    }
    else
        cout << idx + cnt + 1 << endl;
    return 0;
}

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

num = [0]*(max(A)+2)

for i in A:
    num[i] += 1
m = max(A)
ans = 0
for i in range(0,max(A)+2):
    if i == 0:
        tmp = num[i] + num[i+1]
    elif i == m+1:
        tmp = num[i-1] + num[i]
    else:
        tmp = num[i-1] + num[i] + num[i+1]
    ans = max(ans,tmp)

print(ans)

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

namespace ABC088D
{
    class Program
    {
        public static void Main(string[] args)
        {
            var input = Console.ReadLine().Split();
            var H = int.Parse(input[0]);
            var W = int.Parse(input[1]);
            
            var S = new string[H];
            for (var i = 0; i < H; i++) S[i] = Console.ReadLine();

            Func<int, int, bool> isInside = (x, y) => 0 <= x && x < W && 0 <= y && y < H;
            var dx = new[] {0, 1, 0, -1};
            var dy = new[] {1, 0, -1, 0};
            var dl = 4;
            
            var dist = new int[H, W];
            for (var i = 0; i < H; i++)
            for (var j = 0; j < W; j++)
            {
                dist[i, j] = int.MaxValue;
            }
            dist[0, 0] = 0;

            var que = new Queue<int>();
            que.Enqueue(0);
            que.Enqueue(0);

            while (que.Count > 0)
            {
                var x = que.Dequeue();
                var y = que.Dequeue();
                
                for (var i = 0; i < dl; i++)
                {
                    var nx = x + dx[i];
                    var ny = y + dy[i];

                    if (isInside(nx, ny) && S[ny][nx] == '.' && dist[ny, nx] > dist[y, x] + 1)
                    {
                        dist[ny, nx] = dist[y, x] + 1;
                        que.Enqueue(nx);
                        que.Enqueue(ny);
                    }
                }
            }

            if (dist[H - 1, W - 1] == int.MaxValue) Console.WriteLine(-1);
            else Console.WriteLine(S.Sum(str => str.Count(c => c == '.')) - dist[H - 1, W - 1] - 1);
        }
    }
}

Measured memory_bytes: 11456
// https://atcoder.jp/contests/abc126/tasks/abc126_c
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
    double n, k;
    cin >> n >> k;
    double answer = 0.0;
    for (int i = 1; i <= n; i++)
    {
        double this_prob = 1.0 / n;
        int this_score = i;
        while (this_score < k)
        {
            this_score *= 2;
            this_prob /= 2;
        }
        answer += this_prob;
    }
    // cout << answer << endl;
    printf("%.12f\n", answer);
    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    unordered_map<string, bool> siritori;
    string before;
    string now;
    for (int i=0; i<N; i++) {
        if (i == 0) {
            cin >> now;
            before = now;
        } else {
            cin >> now;
            // cout << "before.back:" << before.back() << " now.front:" << now.front() << "\n";
            if (before.back() != now.front()) {
                cout << "No";
                return 0;
            }
            before = now;
        }
        // cout << "b:" << before << " n:" << now << "\n";
        if (siritori.count(now) != 0) {
            cout << "No";
            return 0;
        } else {
            siritori[now] = true;
        }
    }
    cout << "Yes";

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include<vector>
using namespace std;
int main(){

  int N;
  cin>>N;
  vector<int>H(N);
  for(int i=0;i<=N-1;i++){
  
    cin>>H[i];
  }
  int ans=0;
  int max=0;
  for(int i=0;i<=N-2;i++){
  
    if(H[i]>=H[i+1])max++;
    else{
      if(max>ans)ans=max;
      max=0;
    }
  }
  if(max>ans)ans=max;
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3764
#include<stdio.h>

int main(){
		int i,ans=0,n,max=0;
		long long h[100000];
		scanf("%d",&n);
		for(i=0;i<n;i++)scanf("%lld",&h[i]);
		for(i=1;i<n;i++){
				if(h[i-1]>=h[i])ans++;
				else ans=0;
				if(max<ans)max=ans;
		}
		printf("%d\n",max);
		return 0;
}


Measured memory_bytes: 896
package main

import (
	"fmt"
	"strconv"
)

// Dice サイコロ構造体
type Dice struct {
	val []int
}

// NewDice サイコロ構造体の生成
func NewDice() *Dice {
	dice := new(Dice)
	dice.val = make([]int, 7)

	return dice
}

// Throw サイコロを振る
func (d Dice) Throw(direction string) {

	tmp := 0

	switch direction {
	case "N":
		tmp = d.val[6]
		d.val[6] = d.val[5]
		d.val[5] = d.val[1]
		d.val[1] = d.val[2]
		d.val[2] = tmp
		break
	case "E":
		tmp = d.val[6]
		d.val[6] = d.val[3]
		d.val[3] = d.val[1]
		d.val[1] = d.val[4]
		d.val[4] = tmp
		break
	case "S":
		tmp = d.val[6]
		d.val[6] = d.val[2]
		d.val[2] = d.val[1]
		d.val[1] = d.val[5]
		d.val[5] = tmp
		break
	default:
		tmp = d.val[6]
		d.val[6] = d.val[4]
		d.val[4] = d.val[1]
		d.val[1] = d.val[3]
		d.val[3] = tmp
		break
	}
}

// Slide サイコロをスライドさせる
func (d Dice) Slide(direction string) {

	tmp := 0

	switch direction {
	case "L":
		tmp = d.val[2]
		d.val[2] = d.val[3]
		d.val[3] = d.val[5]
		d.val[5] = d.val[4]
		d.val[4] = tmp
		break
	default:
		tmp = d.val[2]
		d.val[2] = d.val[4]
		d.val[4] = d.val[5]
		d.val[5] = d.val[3]
		d.val[3] = tmp
		break
	}
}

func (d Dice) isFrontDirection(a, b int) bool {

	pattern := [][]int{{1, 2}, {2, 6}, {6, 5}, {5, 1}, {2, 4}, {4, 5}, {5, 3}, {3, 2}}

	for _, v := range pattern {

		if d.val[v[0]] == a && d.val[v[1]] == b || d.val[v[1]] == a && d.val[v[0]] == b {
			return true
		}

	}

	return false

}

func (d Dice) isFrontDirectionW(a, b int) bool {

	pattern := [][]int{{1, 2}, {2, 6}, {6, 5}, {5, 1}}

	for _, v := range pattern {

		if d.val[v[0]] == a && d.val[v[1]] == b {
			return true
		}

	}

	return false

}

func (d Dice) isFront(a, b int) bool {
	return d.val[1] == a && d.val[2] == b
}

func (d Dice) changeFront(a, b int) {

	for i := 0; i < 4; i++ {
		if d.isFrontDirection(a, b) {
			break
		}
		d.Slide("L")
	}

	for i := 0; i < 4; i++ {

		if d.isFrontDirectionW(a, b) {
			break
		}

		d.Throw("W")

	}

	for i := 0; i < 4; i++ {
		if d.isFront(a, b) {
			break
		}

		d.Throw("S")
	}

}

func main() {

	n := 0

	fmt.Scan(&n)

	dices := make([]Dice, n)

	for i := 0; i < n; i++ {
		dices[i] = *NewDice()
		fmt.Scan(&dices[i].val[1], &dices[i].val[2], &dices[i].val[3], &dices[i].val[4], &dices[i].val[5], &dices[i].val[6])

	}

	a, b := dices[0].val[2], dices[0].val[1]

	for _, v := range dices {
		v.changeFront(a, b)
	}

	m := map[string]int{}

	for _, v := range dices {

		key := strconv.Itoa(v.val[1]) + strconv.Itoa(v.val[2]) + strconv.Itoa(v.val[3]) + strconv.Itoa(v.val[4]) + strconv.Itoa(v.val[5]) + strconv.Itoa(v.val[6])

		m[key]++

	}

	c := false

	for _, v := range m {
		if v > 1 {
			c = true
			break
		}
	}

	if c {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}



Measured memory_bytes: 1172
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  string S;
  cin >> S;
  
  int n = S.size(), ans = 0;
  for(int i = 0;i < n;i++){
    int cnt = 0;
    for(int j = i;j < n;j++){
      char b = S.at(j);
      if(b == 'A' || b == 'C' || b == 'G' || b == 'T') ans = max(ans, ++cnt);
      else break;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;

int main(void){
    long X = 33;
    cin >> X;
    for(long i = 1; i < 10000000; i++){
        if(X % i == 0){
            for(int j =  1000; j >= -1000; j--){
                long B = j;
                long A = B + i;
                if(X == pow(A,5) - pow(B,5)){
                    cout << A << " " << B << endl;
                    return 0;
                }else if( X ==  pow(B,5) - pow(A,5)){
                    cout << B << " " << A << endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4028
void main() {
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.range;

  int h, w;
  rd(h, w);
  auto c = new char[][](h, w);
  iota(0, h).each!((i) => (c[i] = readln.chomp.to!(char[])));

  auto cc = new char[][](h, w);
  foreach (i; 0 .. h) {
    foreach (j; 0 .. w) {
      if (c[i][j] == '.') {
        int n = 0;
        foreach (dy; [-1, 0, 1]) {
          foreach (dx; [-1, 0, 1]) {
            if (dy == 0 && dx == 0)
              continue;
            auto ni = i + dy, nj = j + dx;
            if (ni < 0 || ni >= h || nj < 0 || nj >= w)
              continue;
            if (c[ni][nj] == '#') {
              n++;
            }
          }
        }
        cc[i][j] = (n + '0').to!(char);
      } else {
        cc[i][j] = '#';
      }
    }
  }
  writefln("%(%(%c%)\n%)", cc);
}

void rd(T...)(ref T x) {
  import std.stdio : readln;
  import std.string : split;
  import std.conv : to;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sumA = sum(A)
sumB = sum(B)
if sumA < sumB:
  print('-1')
  exit()

D = [a - b for a, b in zip(A, B)]
over0s = []
sumMinus = 0
ans = 0
for d in D:
  if d < 0:
    ans += 1
    sumMinus += d
  else:
    over0s.append(d)
over0s.sort()
while sumMinus < 0:
  ans += 1
  sumMinus += over0s.pop()
print(ans)

Measured memory_bytes: 18356
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main() {
	int N, K;
	cin >> N >> K;
	priority_queue<pair<int, int>> greatest;
	priority_queue<pair<int, int>, vector<pair<int, int>>, std::greater<pair<int, int>>> smallest;

	int longest_increasing = 0;
	int last = 0;
	int identical = 0;

	for (int i = 0; i < K; i++) {
		int tmp;
		cin >> tmp;
		if (tmp > last) {
			longest_increasing++;
		}
		else {
			longest_increasing = 1;
		}
		last = tmp;
		greatest.emplace(make_pair(tmp, i));
		smallest.emplace(make_pair(tmp, i));
	}
	int result = 1;
	if (longest_increasing >= K) {
		identical++;
	}
	for (int i = K; i < N; i++) {
		int tmp;
		cin >> tmp;
		if (tmp > last) {
			longest_increasing++;
		}
		else {
			longest_increasing = 1;
		}
		last = tmp;
		bool is_smallest = true;
		bool is_greatest = true;
		while (greatest.top().second < i - K) {
			greatest.pop();
		}
		while (smallest.top().second < i - K) {
			smallest.pop();
		}
		if (smallest.top().second != i - K) {
			is_smallest = false;
		}
		greatest.emplace(make_pair(tmp, i));
		smallest.emplace(make_pair(tmp, i));
		if (greatest.top().second != i) {
			is_greatest = false;
		}
		if (!is_smallest || !is_greatest) {
			// cerr << i << endl;
			result++;
			if (longest_increasing >= K) {
				identical++;
			}
		}
	}
	cout << result - max(0, identical - 1) << endl;
}

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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

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

Measured memory_bytes: 3652
N, M = map(int, input().split())
like = [0] * (M + 1)
for _ in range(N):
    KA = list(map(int, input().split()))
    for i in range(1, len(KA)):
        like[KA[i]] += 1
like.sort(reverse=True)
ans = 0
for i in range(M + 1):
    if like[i] == N:
        ans += 1
    else:
        break
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define endl "\n"
typedef long long ll;

const int BIG_NUM = 1e9;

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

    int a, b, c;
    cin >> a >> b >> c;
    if(a == b && b != c) {
        cout << "Yes";
    } else if(b == c && c != a) {
        cout << "Yes";
    } else if(c == a && a != b) {
        cout << "Yes"; 
    } else {
        cout << "No";
    }
    return 0;
}



Measured memory_bytes: 3512
n = gets.to_i
ds = gets.chomp.split(" ").map(&:to_i)
if ds.sort[ds.length / 2] == ds.sort[ds.length / 2 - 1]
    puts 0
    exit
end

puts (ds.sort[ds.length / 2]) - (ds.sort[ds.length / 2 -1] + 1) + 1

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

using ll = long long; using vi = vector<int>; using vll = vector<ll>;
using vvi = vector<vi>; using vvll = vector<vll>;
const int MOD = 1e9 + 7;
const int INF = numeric_limits<int>::max();
const ll INF_MAX = numeric_limits<ll>::max();

int main() {
  int n; cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  // pattern 1 -1 1 -1
  int sum = 0;
  ll cnt_a = 0;
  for (int i = 0; i < n; ++i) {
    sum += arr[i];
    if (i % 2 == 0 and sum < 1) {
      cnt_a += (1 - sum);
      sum = 1;
    }
    if (i % 2 == 1 and sum > -1) {
      cnt_a += (sum + 1);
      sum = -1;
    }
  }
  // pattern -1 1 -1 1
  sum = 0;
  ll cnt_b = 0;
  for (int i = 0; i < n; ++i) {
    sum += arr[i];
    if (i % 2 == 1 and sum < 1) {
      cnt_b += (1 - sum);
      sum = 1;
    }
    if (i % 2 == 0 and sum > -1) {
      cnt_b += (sum + 1);
      sum = -1;
    }
  }
  cout << min(cnt_a, cnt_b) << endl;
}


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

int main() {
  
  int n,y;
  cin >> n >> y;
  
  for ( int i = 0; i <= 2000; i++){
    for ( int j = 0; j <= 2000; j++){
      if ( y == 10000 * i + 5000 * j + 1000 * ( n - i - j ) && n - i - j >= 0 ){
        cout << i << ' ' << j << ' ' << n - i - j << endl;
        return 0;
      }
    }
  }
  
  cout << "-1 -1 -1" << endl;
  
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) FOR(i,0,n)
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

ll a,b,c,x,y;


int main(){
  cin>>a>>b>>c>>x>>y;

  ll sum=0;

  if(a+b>c*2){
    int z = min(x,y);
    sum+=z*c*2;
    x-=z;
    y-=z;
  }

  sum+=min(c*2,a)*x;
  sum+=min(c*2,b)*y;

  cout<<sum<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18,MOD = 1e9 + 7;
const int INT_INF = 1e9,INT_MOD=1e9+7;
#define rep(i, N) for(ll i = 0; i < N; i++)
#define REP(i, n) for(int i = 0; i <= n; i++)
#define rrep(i,n) for(int i=n;i>0;i--)
#define RREP(i,n) for(int i=n;i>=0;i--)
typedef pair<int, int> Pi;
typedef pair<double, double> P;
signed main(){
    int n;cin>>n;
    char s[n+1],t[n+1];
    rep(i,n) cin>>s[i];
    rep(i,n) cin>>t[i];
    rep(i,n)cout<<s[i]<<t[i];
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

const unsigned gaps[] = {1,8,23,77,281,1073,4193,16577,65921,262913,1050113};
// generated from pow(4,i)+3*pow(2,i-1)+1 (prefixed with 1)

inline unsigned insertion_sort(unsigned a[], unsigned n, unsigned gap){
  unsigned i,count = 0;
  for(i = gap; i < n; i++){
    unsigned v = a[i];
    int j = i - gap;
    while(j >= 0 && a[j] > v){
      a[j+gap] = a[j];
      j -= gap;
      count++;
    }
    a[j+gap] = v;
  }
  return count;
}

inline void shell_sort(unsigned a[], unsigned n){
  int i;
  unsigned gap_num = 0;
  while(gaps[++gap_num] < n);
  gap_num--;

  unsigned count = 0;
  for(i = gap_num; i >= 0; i--) count += insertion_sort(a,n,gaps[i]);

  printf("%u\n",(gap_num+1));

  for(i = gap_num; i; i--) printf("%u ",gaps[i]);
  printf("%u\n",gaps[0]);

  printf("%u\n",count);
}

int main(){
  unsigned n,i;
  scanf("%u",&n);
  unsigned* a = (unsigned*)malloc(sizeof(unsigned)*n);
  for(i = 0; i < n; i++) scanf("%u",&a[i]);
  shell_sort(a,n);
  for(i = 0; i < n; i++) printf("%u\n",a[i]);
  free(a);
  return 0;
}

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

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

	int n, s[100], sum = 0;
	bool nya = 1;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> s[i];
		sum += s[i];
		if(s[i] % 10 != 0) nya = 0;
	}

	if(nya){
		cout << 0 << endl;
		return 0;
	}
	if(sum % 10 != 0){
		cout << sum << endl;
		return 0;
	}

	sort(s, s+n);

	for(int i = 0; i < n; i++){
		if((sum-s[i]) % 10 != 0){
			cout << sum - s[i] << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  double tmp[4]={0.2,0.6,1.1,3};
  int out[2][4]={0};
  double in[2];
  while(cin>>in[0]>>in[1])
    rep(j,2)rep(i,4)if(in[j]<tmp[i]){out[j][i]++;break;}

  for(int i=3;i>=0;i--)cout<<out[0][i]<<" "<<out[1][i]<<endl;

}

Measured memory_bytes: 1224
from collections import deque
def readinput():
    n=int(input())
    nList=[]
    for _ in range(n+1):
        nList.append([])
    edges=[]
    for _ in range(n-1):
        a,b=map(int,input().split())
        edges.append((a,b))
        nList[a].append(b)
        #nList[b].append(a)
    return n,nList,edges

def bfs(s,nList):
    #print(nList)
    WHITE=0
    GRAY=1
    BLACK=2
    status=[WHITE]*(n+1)
    parent=[0]*(n+1)
    color=[0]*(n+1)
    maxcolor=0
    Q=deque([])
    Q.append(s)
    while(len(Q)>0):
        u=Q.popleft()
        usedcolor=color[u]
        col=1
        for t in nList[u]:
            if status[t]==WHITE:
                status[t]=GRAY
                parent[t]=u
                if col==usedcolor:
                    col+=1
                color[t]=col
                Q.append(t)
                col+=1
        maxcolor=max(maxcolor,col-1)
        status[u]=BLACK
        #print(u,usedcolor)
    return color, maxcolor


def main(n,nList,edges):
    color, maxcolor=bfs(1,nList)
    print(maxcolor)
    for a,b in edges:
        print(color[b])

if __name__=='__main__':
    n,nList,edges=readinput()
    main(n,nList,edges)


Measured memory_bytes: 33640
/*
ID: espr1t
TASK: 
KEYWORDS: 
*/

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
FILE* in = stdin; FILE* out = stdout;

const int MAX = 100001;

int n, q;
int a[MAX];
long long all[MAX];
long long odd[MAX];
long long even[MAX];

long long getSum(long long arr[MAX], int idx1, int idx2) {
    if (idx1 <= 0)
        return arr[idx2];
    return arr[idx2] - arr[idx1 - 1];
}

int findIdx(int val) {
    int left = 0, right = n - 1;
    while (left <= right) {
        int mid = (left + right) / 2;
        a[mid] < val ? left = mid + 1 : right = mid - 1;
    }
    return left;
}

long long eval(int x) {
    int where = -1, next = -1;
    long long sum0 = 0, sum1 = 0;

    int left = 0, right = 1000000000;
    while (left <= right) {
        int mid = (left + right) / 2;
        int idxL = findIdx(x - mid); if (idxL < 0 || a[idxL] < x - mid) idxL++;
        int idxR = findIdx(x + mid); if (idxR >= n || a[idxR] > x + mid) idxR--;
        int cnt0 = n - idxR - 1;
        int cnt1 = idxR - idxL + 1;
        if (cnt1 <= 0) {
            left = mid + 1;
            continue;
        }
        if (cnt1 == cnt0 + 1 && x - a[idxL] <= a[idxR] - x) {
            idxR--;
            cnt1--, cnt0++;
        }
        if (cnt0 == cnt1 || cnt0 == cnt1 + 1) {
//            fprintf(stderr, "Here with [%d, %d]\n", idxL, idxR);
            sum0 = getSum(all, idxR + 1, n - 1);
            sum1 = getSum(all, idxL, idxR);
            where = idxL - 1, next = (cnt0 == cnt1 ? 0 : 1);
            break;
        }
        cnt1 > cnt0 ? right = mid - 1 : left = mid + 1;
    }
    if (next == -1) {
        where = n - 1, next = 0;
    }
    
//    fprintf(stderr, "where = %d, next = %d, sum0 = %lld, sum1 = %lld\n", where, next, sum0, sum1);

    if (where >= 0) {
        sum0 += ((next ^ (where % 2)) == 0) ? getSum(even, 0, where) : getSum(odd, 0, where);
        sum1 += ((next ^ (where % 2)) == 1) ? getSum(even, 0, where) : getSum(odd, 0, where);
    }
    return sum0;
}

int main(void) {
	// in = fopen("D.in", "rt");
	
	fscanf(in, "%d %d", &n, &q);
	for (int i = 0; i < n; i++)
	    fscanf(in, "%d", &a[i]);
	sort(a, a + n);
	
	all[0] = a[0], odd[0] = 0, even[0] = a[0];
	for (int i = 1; i < n; i++) {
	    all[i] = all[i - 1] + a[i];
	    odd[i] = odd[i - 1] + (i % 2 ? a[i] : 0);
	    even[i] = even[i - 1] + (i % 2 ? 0 : a[i]);
    }
	
	for (int i = 0; i < q; i++) {
	    int x;
	    fscanf(in, "%d", &x);
	    fprintf(out, "%lld\n", eval(x));
    }
	
	return 0;
}

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

using namespace std;

#define rep(i,m,n) for(int i=m;i<n;i++)
#define repr(i,m,n) for(int i=n-1;i>=m;i--)

int main(){
 int n;
   cin >> n;
 vector<int> b(n),res;
  rep(i,0,n) cin >> b[i];
   
  
  repr(i,0,n){
    bool flag=true;
    int index;
    repr(j,0,i+1){
     if(b[j]==j+1) {
       res.push_back(b[j]);
       index=j;
         flag=false;
         break;
     }
     }
    
    if(flag) { cout << -1 << endl;
             return 0;
             }
    else {
     rep(j,index,i) b[j]=b[j+1];
       b[i]=0;
    }
    
  
  }
    
  repr(i,0,res.size()) cout << res[i] << endl;
  
 
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    char color[10];
    int a;

    while (1)
    {
        scanf("%d",&a);
        scanf("%s",color);
        if(2800 <= a && a < 5000)
            break;
    }

    if(a >= 3200){
        printf("%s",color);
  
    }else{
        printf("red\n");
    }
    

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <queue>
#include <algorithm>
#include <string>

using namespace std;

int sum=0,max_sum=0;
void dfs(int data,int depth,int n,int m,int q,vector<long int> &A,vector<int>& a,vector<int>& b,vector<int>& c,vector<int>& d){
  if(depth>n){
    sum=0;
    for(int i=0;i<q;i++){
      if(A[b[i]-1]-A[a[i]-1]==c[i]){
        sum+=d[i];
      }
    }
    if(sum>max_sum) max_sum=sum;
    for(int i=0;i<n;i++){
      //cout<<A[i]<<" ";
    }
    //cout<<sum<<endl;
    return;
  }
  for(int i=data;i<=m;i++){
    A[depth-1]=i;
    dfs(i,depth+1,n,m,q,A,a,b,c,d);
  }
}

int main(){
  long int n,m,q;cin>>n>>m>>q;
  vector<int> a(q),b(q),c(q),d(q);
  for(int i=0;i<q;i++){
    cin>>a[i]>>b[i]>>c[i]>>d[i];
  }
  vector<long int> A(n);
  
  dfs(1,1,n,m,q,A,a,b,c,d);
  
  cout<<max_sum;      
    
  
  
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

int gcd( int n, int m ) {
	if ( m == 0 ) {
		return n;
	}
	return gcd( m, n % m );
}

bool solve( string &str ) {
	if ( str[0] == 't' ) {
		str = str.substr( 4 );
		return false;
	}
	str = str.substr( 5 );
	return true;
}


int main() {
	int h, w;
	while ( ~scanf( "%d %d", &h, &w ) && h && w ) {
		int ans_h = 200, ans_w = 200;
		for ( int i = 1; i <= 150; i++ ) {
			for ( int j = i + 1; j <= 150; j++ ) {
				if ( ( sq( h ) + sq( w ) < sq( i ) + sq( j ) || ( sq( h ) + sq( w ) == sq( i ) + sq( j ) && h < i ) ) && sq( i ) + sq( j ) < sq( ans_h ) + sq( ans_w ) ) {
					ans_h = i;
					ans_w = j;
					break;
				}
			}
		}
		printf( "%d %d\n", ans_h, ans_w );
	}
	return 0;
}

Measured memory_bytes: 1188
import collections
import bisect

n,m=map(int,input().split())
p=[[int(j) for j in input().split()] for i in range(m)]
a=collections.defaultdict(list)
for x,y in sorted(p):
  a[x]+=[y]
for x,y in p:
  z=bisect.bisect(a[x],y)
  print("%06d%06d"%(x,z))

Measured memory_bytes: 81032
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59


int main(){
    ll i,j;
    ll n;
    cin>>n;
    ll a[n+1],b[n];
    for(i=0;i<=n;i++) cin>>a[i];
    for(i=0;i<n;i++) cin>>b[i];

    ll ans=0;
    for(i=0;i<n;i++){
        if(a[i]>b[i]) ans+=b[i];
        else {
            ans+=a[i];
            b[i]-=a[i];
            ans+=min(a[i+1],b[i]);
            a[i+1]-=min(a[i+1],b[i]);
        }
    }
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define avg(a,b) ((a)+(b))/2
#define push push_back
#define pop pop_back
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b)
{
    return ((a%b)+b)%b;
}
bool prime[200001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=200000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=200000; i += p) 
                prime[i] = false; 
        } 
    } 
    return;
}
ll powe[60];
void power()
{
    powe[0]=1;
    REP(i,1,15)
    {
        powe[i]=2*powe[i-1];
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
} 
ll fact[100005];
void factorial()
{
    fact[0]=1;
    REP(i,1,100002)
    {
        fact[i]=mymod(i*fact[i-1], num);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   string s;
   cin>>s;
   REP(i,0,s.size())
   {
	   cout<<"x";
   }
   
	return 0;
}

Measured memory_bytes: 256
// 貪欲法

// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int D;
int c[26];
int s[366][26];
int last[26];

int main() {
    fastio();

    cin >> D;
    forn(i, 26) cin >> c[i];
    forn1(i, D) forn(j, 26) cin >> s[i][j];

    forn1(i, D) {
        ll v = LLONG_MIN;
        int ans = -1;

        forn(j, 26) {
            ll x = s[i][j];
            forn(k, 26) {
                if (k != j) {
                    x -= (i - last[k]) * c[k];
                }
            }

            if (v < x) {
                v = x;
                ans = j;
            }
        }

        last[ans] = i;
        cout << ans + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
#define st first
#define nd second

using ll = long long ;
using namespace std;
using pii = pair<int,int>;
char c[20];
int main(){
	set<string> ss;
	int n;
	scanf("%d", &n);
	while(n--){
		scanf("%s", c);
		string s = c;
		ss.insert(s);
	}
	printf("%d", (int)ss.size());
}

Measured memory_bytes: 19384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int R;
    cin >> R;
    if(R<1200) cout << "ABC" << endl;
    else if(R<2800) cout << "ARC" << endl;
    else cout << "AGC" << 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;

int main(){
    int h, w;
    cin >> h >> w;
    vector<string> c(h);
    rep(i, h) cin >> c[i];
    rep(i, h) {
        cout << c[i] << endl;
        cout << c[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
X,Y = map(int,input().split())

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

ans = Base_10_to_n(X, Y)
print(len(ans))

Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int a,b,x,y,cnt,i,w;
	while(1){
		scanf("%d%d",&a,&b);
		if(a==0&&b==0) break;
		if(a<b){
			x=b; y=a;
		}
		else{
			x=a; y=b;
		}
		cnt=0;
		while(y!=0){
			x%=y;
			w=x;
			x=y;
			y=w;
			cnt++;
		}
		printf("%d %d\n",x,cnt);
	}
	return 0;
}

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

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

int main() {
	REP(i, 9) {
		string name;
		int num = 0, total = 0;
		int in;
		cin >> name;
		cin >> in;
		num += in; total += 200 * in;
		cin >> in;
		num += in; total += 300 * in;
		
		cout << name << " " << num << " " << total << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1204
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define rnt re int
#define re register
#define I inline int
#define V inline void
#define isnum(ch) ('0'<=ch&&ch<='9')
#define FOR(i,a,b) for(rnt i=a;i<=b;i++)
#define ROF(i,a,b) for(rnt i=a;i>=b;i--)
#define gc (_op==_ed&&(_ed=(_op=_buf)+fread(_buf,1,100000,stdin),_op==_ed)?EOF:*_op++)
char _buf[100000],*_op(_buf),*_ed(_buf);
I getint(){
	rnt _s=0;re char _ch=gc;
	while(!isnum(_ch))_ch=gc;
	while(isnum(_ch))_s=_s*10+_ch-48,_ch=gc;
	return _s;
}
V input(){
	
}
V init(){
	
}
V work(){
	
}
int main(){
	int n;
	cin>>n;
	cout<<(n-1)/2;
//	freopen("test.in","r",stdin);
//	freopen(".out","w",stdout);
//	input();
//	init();
//	work();
	return 0;
}

Measured memory_bytes: 256