akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define MAX 100005
#define INFTY 1000000000
typedef struct{
  char c;
  int  n;
}card;

void merge(card *a,int left,int mid,int right){
  int n1,n2;
  card l[MAX/2],r[MAX/2];
  int i,j,k;

  n1 = mid-left;
  n2 = right-mid;
  for(i=0;i<n1;i++) l[i] = a[left+i];
  for(i=0;i<n2;i++) r[i] = a[mid+i];
  l[n1].n = INFTY;
  r[n2].n = INFTY;
  i=0;
  j=0;
  
  for(k=left;k<right;k++){
    if(l[i].n<=r[j].n){
      a[k] = l[i];
      i++;
    }
    else{
      a[k] = r[j];
      j++;
    }
  }
}

void mergeSort(card *a, int left, int right){
  int mid;

  if(left+1<right){
    mid = (left+right)/2;
    mergeSort(a, left, mid);
    mergeSort(a, mid, right);
    merge(a, left, mid, right);
  }
}

int partition(card *a,int p,int r){
  int x;
  int i,j;
  card temp;
  
  x = a[r].n;
  i = p-1;
  for(j=p;j<r;j++){
    if(a[j].n<=x){
      i++;
      temp = a[i];
      a[i] = a[j];
      a[j] = temp;
    }
  }
 temp = a[i+1];
 a[i+1] = a[r];
 a[r] = temp;
 
  return i+1;
}

void quickSort(card *a, int p, int r){
  int q;
  
  if(p<r){
    q = partition(a,p,r);
    quickSort(a,p,q-1);
    quickSort(a,q+1,r);
  }
}

int main(){
  card a[100005],b[100005];
  int n,left,right,flag=0;
  int i;
  
  scanf("%d",&n);
  left = 0;
  right = n;
  for(i=0;i<n;i++){
    scanf("%s %d",&a[i].c,&a[i].n);
    b[i] = a[i];
  };
  quickSort(a,0,n-1);
  mergeSort(b,left,right);
  for(i=0;i<n;i++){
    if(a[i].c != b[i].c){
      flag = 1;
      printf("Not stable\n");
      break;
    }
  }
  if(flag == 0) printf("Stable\n");
  for(i=0;i<n;i++){
    printf("%c %d\n",a[i].c,a[i].n);
  }
  
  return 0;
}





Measured memory_bytes: 4056
def resolve():
    '''
    code here
    '''

    N, M, X = [int(item) for item in input().split()]
    data = [[int(item) for item in input().split()] for _ in range(N)]

    cost = 10**9

    for i in range(2**N):
        temp_point = [0 for _ in range(M)]
        temp_cost = 0
        for j in range(N):
            if ((i >> j) & 1):
                for k, v in enumerate(data[j][1:]):
                    temp_point[k] += v
                temp_cost += data[j][0]

        is_flag = True
        for temp_p in temp_point:
            if temp_p < X:
                is_flag = False
                break
        
        if is_flag:
            cost = min(cost, temp_cost)

    if cost == 10**9:
        print(-1)
    else:
        print(cost)

if __name__ == "__main__":
    resolve()


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

using namespace std;

#define FOR(i, j, k) for(int i = j; i <= k; i++)
#define SZ 100010
#define PB push_back
#define MEM(n, val) memset((n), val, sizeof(n))
#define INF 1000000000
#define F first
#define S second
#define MP make_pair
#define LL long long

int n;
LL k, ara[SZ];
LL val = 0LL;


void func(int pos, bool chk)  {
    if(pos < 0) {
        return;
    }
    int zero = 0;
    int one = 0;
    FOR(i, 0, n - 1)   {
        if(ara[i] & (1LL << pos))    {
            one++;
        }
        else    {
            zero++;
        }
    }

    if(chk == 0)    {
        if((k & (1LL << pos)) == 0)    {
            func(pos - 1, 0);
        }
        else    {
            if(zero > one)    {///place 1
                val = val | (1LL << pos);
                func(pos - 1, 0);
            }
            else    {
                func(pos - 1, 1);
            }

        }
    }
    else    {
        ///you can place anything
        if(zero > one)    {///place 1
            val = val | (1LL << pos);
        }
        func(pos - 1, 1);
    }
}

int main()  {
//    freopen("in.txt", "r", stdin);
    cin >> n >> k;
    FOR(i, 0, n - 1)   {
        cin >> ara[i];
    }
    func(61, 0);

//    cout << "val : " << val << "\n";

    LL ans = 0;
    FOR(i, 0, n - 1)   {
        ans += (val ^ ara[i]);
    }
    cout << ans;
    return 0;
}
/**
*/


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	cout << fixed << setprecision(9);
	
	int n; cin>>n;
	ll a[n+1]={0};
	//for(auto it:a) cout<<it; cout<<endl;
	int b[n];
	for(int i=0;i<n;i++)
	{
	    cin>>b[i]; a[b[i]]++;
	}
	ll ans=0;
	for(int i=1;i<=n;i++)
	{
	    ans+=( a[i]*(a[i]-1) )/2;
	}
	//cout<<ans<<endl;
	for(int i=0;i<n;i++)
	{
	    //if(a[b[i]]>1)
	    //{
	        cout<<ans - a[b[i]] + 1<<'\n';
	    //}
	    //else cout<<0<<'\n';
	}
	
	return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <limits>

using namespace std;

int main()
{
    int N,a;
    long long sum[200001] = {};
    long long min_num = 2 * pow(10, 9.0);

    cin >> N;

    for (int i = 1; i <= N; i++) {
        cin >> a;
        sum[i] = sum[i - 1] + a;
    }
    
    for ( int i = 1; i < N; i++) {
        min_num = min(min_num, abs(sum[N] - sum[i] - sum[i]));
    }
    cout << min_num << '\n';

}

Measured memory_bytes: 1792
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)

MOD = 1000000007  # type: int

def gcd(a, b):
    return a if b == 0 else gcd(b, a % b)

def solve(N: int, A: "List[int]", B: "List[int]"):
    s = {}
    for i in range(N):
        if A[i] == 0 and B[i] == 0:
            a, b = 0, 0
        elif A[i] == 0:
            a, b = 0, 1
        elif B[i] == 0:
            a, b = 1, 0
        else:
            g = gcd(A[i], B[i])
            a, b = A[i] // g, B[i] // g
        k = (a, b)
        if not k in s:
            s[k] = 0
        s[k] += 1
    count = 0
    checked = set()
    cums = []
    #print(s)
    for (a, b), cnt in s.items():
        if (a, b) in checked:
            continue
        checked.add((a, b))
        tmp = 0
        if a == 0 and b == 0:
            count += cnt
            #cum = cnt + 1
            #cums.append(cum)
            #count += cnt + tmp
            continue
        if (-b, a) in s and (-b, a) not in checked:
            tmp += s[(-b, a)]
            checked.add((-b, a))
        if (b, -a) in s and (b, -a) not in checked:
            tmp += s[(b, -a)]
            checked.add((b, -a))
        if tmp > 0:
            cum = pow(2, cnt, MOD) + pow(2, tmp, MOD) - 1
            cum %= MOD
            cums.append(cum)
            count += cnt + tmp
    #print(cums, count)
    ret = pow(2, (N - count), MOD)
    for cum in cums:
        ret *= cum
        ret %= MOD
    if (0, 0) in s:
        ret += s[(0, 0)]
    ret -= 1
    ret %= MOD
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int()] * (N)  # type: "List[int]"
    B = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, A, B)

if __name__ == '__main__':
    main()


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

int main(){
    string s;
    cin >> s;
    if (s.front() == s.back()){
        if ((int)s.size() % 2 == 0) cout << "First" << endl;
        else cout << "Second" << endl;
    }
    else {
        if ((int)s.size() % 2 == 0) cout << "Second" << endl;
        else cout << "First" << endl;
    }
}

Measured memory_bytes: 512
import java.util.Scanner;

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


        int a = sc.nextInt();
        int b = sc.nextInt();

        if(a>=13){
            System.out.println(b);
        } else if(a>=6 && a<=12) {
            System.out.println(b/2);
        }else if(a<=5){
            System.out.println(0);
        }

        sc.close();
    }
}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;

// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;
long long stuff[401][401];
long long sums[401][401];
int main ()
{
  prep();
  int n, c;
  cin >> n >> c;
  int a[n];
  int b[n];
  for (int i=0; i<n; i++){
      cin >> a[i];
  }
  for (int i=0; i<n; i++){
      cin >> b[i];
  }
  
  for (int i=1; i<=400; i++){
      long long cur = 1;
      for (int j=0; j<=400; j++){
          sums[i][j] = (cur+sums[i-1][j])%mod;
          cur *= i;
          cur %= mod;
      }
  }
  stuff[n][0] = 1;
  for (int i=n-1; i>=0; i--){
      int cura = a[i];
      int curb = b[i];
      for (int j=0; j<=c; j++){
          // make the jth one
          for (int k=0; k<=j; k++){
              int rem = j-k;
              long long summ = mymod(sums[curb][k]-sums[cura-1][k]);
              stuff[i][j] += mymod(summ*stuff[i+1][rem]);
              stuff[i][j] %= mod;
          }
      }
  }
 
  cout << stuff[0][c];
  return 0; 
}

Measured memory_bytes: 2816
/*
 * author: calgagi
 *         Calvin Gagliano 
 */
#include <bits/stdc++.h>

using namespace std;

#define long long long
#define double double double
#define ulong unsigned long long
#define ii pair<int, int>
#define ll pair<long long, long long>
#define ar array
#define f first
#define s second

int n;
const int MAX_N = 8;
vector<int> fact(MAX_N+1, 1);

int get_order(vector<int>& a) {
    int ans = 1;
    vector<bool> used(n+1, 0);

    for (int i = 0; i < n; i++) {
        for (int j = 1; j < a[i]; j++) {
            if (!used[j]) {
                ans += fact[n - (i+1)];
            }
        }
        used[a[i]] = 1;
    }
    
    return ans;
}

void solve() {
    cin >> n;
    vector<int> p(n), q(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> q[i];
    }

    int a = get_order(p);
    int b = get_order(q);

    cout << abs(a - b) << endl;

    return;
}

int main() {
    ios_base::sync_with_stdio(false);  
    cin.tie(NULL);
    srand(chrono::steady_clock::now().time_since_epoch().count()); 

    fact[0] = 0;
    for (int i = 2; i <= MAX_N; i++) {
        fact[i] = fact[i-1] * i;
    }
    
    int t = 1;
    /* cin >> t; */
    while (t--) {
        solve();
    }

    return 0;
}


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

int main(){
  int64_t n,m;
  cin >> n >> m;
  vector<pair<int64_t,int64_t>>mise(n);
  for(int i=0;i<n;i++)
    cin >> mise.at(i).first >> mise.at(i).second;
  sort(mise.begin(),mise.end());
  int64_t ans=0,s=0;
  {int64_t i=0;
  while(s<m){
    if(m-s<mise.at(i).second){
      ans+=mise.at(i).first*(m-s);
      s+=m-s;
    }else{
      ans+=mise.at(i).second*mise.at(i).first;
      s+=mise.at(i).second;
    }
    i++;
  }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4836
#include <bits/stdc++.h>
#define inf (int)1e9
using namespace std;

long long a;
string b;

long long solve();

int main() {
  cin >> a >> b;
  cout << a * ((b[0] - '0') * 100 + (b[2] - '0') * 10 + b[3] - '0') / 100
       << endl;
  return 0;
}


Measured memory_bytes: 3632
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int maxn = 101, maxw = 1e5+1;
long long  w[maxn], v[maxn], dp[maxn][maxw];

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int N, W;
    cin>>N>>W;
    for(int i= 0; i < N; i++)cin>>w[i]>>v[i];
    
    for(int i = 0; i < N; i++)
        for(int j = 0; j <= W; j++){
            if(j<w[i]){
                dp[i+1][j] = dp[i][j];
            }else{
                dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i]);
            }
        }
    cout<<dp[N][W]<<endl;
    return 0;
}





Measured memory_bytes: 78336
import heapq

N, M = map(int, input().split())
A = list(map(lambda x: -int(x), input().split()))

heapq.heapify(A)

for i in range(M):
    min_a = heapq.heappop(A)
    heapq.heappush(A, -(-min_a//2))

print(-sum(A))

Measured memory_bytes: 20408
#include <iostream>
#include <algorithm>

using namespace std;

int n, m, a, b, r;

int main()
{
	cin >> n >> m;

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

		m += a - b;

		r = max(r, m);

		if (m < 0) { cout << 0 << endl; return 0; }
	}

	cout << r << endl;

	return 0;
}

Measured memory_bytes: 3096
#include "iostream"
#include "cmath"
#include "algorithm"
using namespace std;

int n, ma, mi;
long long sum;
int a[10010];

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

		cin >> a[i];

	}
	
	ma = a[0];
	mi = a[0];

	for (int i = 0; i < n; i++) {
		
		sum += a[i];
		ma = max(ma, a[i]);
		mi = min(mi, a[i]);

	}

	cout << mi <<" "<< ma << " "<< sum << endl;
	
	return 0;
}

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

int main(){
  int N,i;
  cin >> N;
  int A[N],B[N],C[N-1];
  for(i=0;i<N;i++){
    cin >> A[i];
  }
  for(i=0;i<N;i++){
    cin >> B[i];
  }
  for(i=0;i<N-1;i++){
    cin >> C[i];
  }
  
  int filled=0;
  
  for(i=0;i<N;i++){
    filled+=B[A[i]-1];
    if(i<N-1&&A[i+1]-A[i]==1){
      filled+=C[A[i]-1];
    }
  }
  
  cout << filled << endl;
  return 0;
}

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

#define M_PI 3.14159265358979323846264338327950288
using namespace std;

typedef long double LD;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

int NN = 200005;
class SegmentTree {
    vector<int> data;
public:
    SegmentTree() {
        data = vector<int>(4*NN,0);
    }

    void update(int a, int v, int i = 1, int l = 0, int r = NN) {
        if (a < l || a >= r) return;
        if (a == l && (r-l) == 1) {
            data[i] += v;
            return;
        }
        int mid = l + (r - l) / 2;
        update(a, v, 2*i, l, mid);
        update(a, v, 2*i+1, mid, r);
        data[i] = max(data[2*i], data[2*i+1]);
    }

    int query(int a, int b, int i = 1, int l = 0, int r = NN) {
        if (b <= l || a >= r) return 0;
        if (a <= l && r <= b) return data[i];
        int mid = l + (r - l) / 2;
        return max(query(a,b,2*i,l,mid),query(a,b,2*i+1,mid,r));
    }

};

int main() {
#ifdef LOCAL_PROJECT
    freopen("input.txt", "r", stdin);
#endif
    int x1, y1, x2, y2, N, x, y;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    scanf("%d", &N);
    if (x1 > x2) {
        swap(x1, x2);
        swap(y1, y2);
    }
    vector<PII> pts, pty;
    unordered_map<int, int> M;
    for(int i = 0; i < N; i++) {
        scanf("%d %d", &x, &y);
        if (x < min(x1, x2) || x > max(x1, x2) || y < min(y1,y2) || y > max(y1,y2)) continue;
        pts.push_back(PII(x,y));
        pty.push_back(PII(y,x));
    }
    sort(pts.begin(), pts.end());
    if (y2 >= y1) {
        sort(pty.begin(), pty.end());
    } else {
        sort(pty.begin(), pty.end(), greater<PII>());
    }
    int L = pts.size();
    for(int i = 0; i < L; i++) M.insert(PII(pty[i].first, i+1));
    SegmentTree st;
    for(int i = 0; i < L; i++) {
        // cerr << M[pts[i].second] << "," << st.query(0, M[pts[i].second]) << endl;
        st.update(M[pts[i].second], st.query(0, M[pts[i].second])+1);
    }
    long double res = 100.0 * (max(y1,y2) - min(y1,y2) + max(x1,x2) - min(x1,x2));
    int qqq = st.query(0, NN);
    res = res + (5 * M_PI - 20) * qqq;
    if ((qqq-1) == min((max(y1,y2) - min(y1,y2)), max(x1,x2) - min(x1,x2))) res = res + 5 * M_PI;
    cout << fixed << setprecision(16) << res << endl;
    return 0;
}


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

using namespace std;

int main()
{
    int n;
    long long int sum=0;
    cin >> n;
    int a[n+1],b[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++){
        long long int temp=min(a[i],b[i]);
        sum+=temp;
        a[i]=a[i]-temp;
        b[i]=b[i]-temp;
        temp=min(a[i+1],b[i]);
        sum+=temp;
        a[i+1]=a[i+1]-temp;
    }
    cout << sum;

    return 0;
}


Measured memory_bytes: 1024
s=input()
a=(len(s)-2)//2
flag=False
for i in range(a+1):
  if s[i]!=s[-1-i]:
    break
  if s[i]!=s[a-i]:
    break
  if i==a:
    flag=True
if flag:
  print("Yes")
else:
  print("No")

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

int main(){
    int n;
    cin>>n;
    vector<long long int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n-1;i++){
        if(a[i] == a[i+1]){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
}

Measured memory_bytes: 1792
n,a,b,c,d = map(int,input().split())
s = input()
stone = False
space = False
cnt = 0
if c < d:
  for i in range(a,d-1):
    if s[i] == '#' and stone:
      print('No')
      exit()
    elif s[i] == '#':
      stone = True
    elif stone:
      stone = False
  print('Yes')
else:
  for i in range(a,c-1):
    if s[i] == '#' and stone:
      print('No')
      exit()
    elif s[i] == '#':
      stone = True
      cnt = 0
    elif s[i] == '.':
      stone = False
      if d >= i >= b-2:
        cnt += 1
      if cnt == 3:
        space = True
  if space == False:
    print('No')
    exit()
  print('Yes')

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;

int main(void){
  int x; cin >> x;
  if(((x/100)*5)>=(x%100)) puts("1");
  else puts("0");
}


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

using namespace std;

int N;
vector<int> a;

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

	for(int i = 0;i < N;++i){
		int t;
		scanf("%d", &t);
		a.push_back(t);
	}

	sort(a.begin(), a.end());
	a.push_back(-1);

	int t = a[0], c = 1, ret = 0;
	for(int i = 1;i <= N;++i){
		if(t != a[i]){
			if(c > t){
				ret += c - t;
			}else if(c < t){
				ret += c;
			}
			c = 0;
		}
		t = a[i];
		++c;
	}

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


Measured memory_bytes: 892
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		int N = Integer.parseInt(in.readLine());
		long[] a = new long[N];
		String[] tokens = in.readLine().split(" ");
		boolean allZero = true;
		for (int i = 0; i < N; ++i) {
			a[i] = Long.parseLong(tokens[i]);
			if (a[i] != 0L) {
				allZero = false;
			}
		}
		long value = 0L;
		for (int i = 0; i < N; ++i) {
			value = value ^ a[i];
		}
		if (allZero) {
			System.out.println("Yes");
		} else if ((value == 0) && (N % 3 == 0)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


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

#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

void solve(){
	int n, k;
	cin >> n >> k;
	int h[n];
	for(auto &x : h) cin >> x;
	int dp[n]; //dp[i] = The minimum cost when you stop at i-th stone
	dp[0] = 0; //Standing on the First stone do not cost anything
	for(int i = 1;i < n;i++){
		dp[i] = 1e18;
		for(int j = 1;j <= k;j++){
			if(i-j>=0) dp[i] = min(dp[i], dp[i-j] + abs(h[i]-h[i-j]));
		}
	}
	cout << dp[n-1] << "\n";
}

signed main(){
	fastio
	int t = 1;
	//cin >> t;
	while(t--) solve();
}

Measured memory_bytes: 5156
#include <bits/stdc++.h>
using namespace std;
#define y1 cgbngfgn
#define pb push_back
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fir first
#define m_p make_pair
#define sec second
#define files(name) freopen(name".dat","r",stdin); freopen (name".sol","w",stdout);
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#define time pdojegoritg
typedef long long ll;
typedef long double ld;
const int arr=500000;
short int dp[5010][5010];
signed main()
{
    string a,b;
    cin>>a>>b;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    if (a>=b)
        cout<<"No"<<'\n'; else
        cout<<"Yes"<<'\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <ctime>
#include <vector>
#include <climits>
#include <algorithm>
#include <random>
#include <cstring>
#include <cstdio>
#include <map>
#include <set>
#include <bitset> 
#include <queue>
#define inf 0x3f3f3f3f
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define rep(i, a, n) for(register int i = a; i <= n; ++ i)
#define per(i, a, n) for(register int i = n; i >= a; -- i)
//#define ONLINE_JUDGE
using namespace std;
typedef long long ll;
const int mod=1e9+7;
template<typename T>void write(T x)
{
    if(x<0)
    {
        putchar('-');
        x=-x;
    }
    if(x>9)
    {
        write(x/10);
    }
    putchar(x%10+'0');
}
 
template<typename T> void read(T &x)
{
    x = 0;char ch = getchar();ll f = 1;
    while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
    while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;};
ll ksm(ll a,ll n){//看是否要mod 
	ll ans=1;
	while(n){
		if(n&1) ans=(ans*a)%mod;
		a=a*a%mod;
		n>>=1;
	}
	return ans%mod;
}
//==============================================================



int main()
{
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	//===========================================================
	string str;
    cin>>str;
    if(str[0]<='z'&&str[0]>='a'){
        puts("a");
    }
    else{
        puts("A");
    }
	//===========================================================
	return 0;
}

Measured memory_bytes: 3620
# B
N = int(input())
A, B = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]
#print(N,A,B)#
P.sort()
#print(P)#

for i in range(N):
    if P[i]>A: break
a = i # A 以下の枚数
for i in range(a,N):
    if P[i]>B: break
else:
    i = N
b = i - a # A+1以上B以下の枚数
c = N - i
#print(a,b,c)#
#count = min(a+1, b-a+1, N-b)
count = min(a, b, c)
print(count)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const double PI  =3.141592653589793238463;
long long MOD = 1000000007;
int stringToInteger(string x){
    int gg=0;
    stringstream geek(x);
    geek >> gg;
    return gg;
}

ll powmod(ll a,ll b,ll m)
{
    ll ans=1;
    while(b>0){ if(b%2)
        {ans*=a; ans%=m;}
         b/=2; a=a*a; a=a%m;
        }
        return ans%m;
}
ll gcd(ll a,ll b)
{

    return __gcd(a,b);
}
ll mulmod(ll a,ll b,ll m)
{  ll ans=0;
    a %=m;
    while (b>0)
    {       if(b&1) ans = (ans + a) % m;
        a = (a * 2)%m;
        b /= 2;
    }
    return ans % m;
}


ll f[5000001];

ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a;
 while(b > 0)
 	{
 		if(b%2 == 1)
 	{
 		x=(x*y);
 		if(x>MOD) x%=MOD;
 	}
 	y = (y*y);
 	if(y>MOD) y%=MOD;
 	b /= 2;
 	}
 return x;
}

/* Modular Multiplicative Inverse
 Using Euler's Theorem
 a^(phi(m)) = 1 (mod m)
 a^(-1) = a^(m-2) (mod m) */
ll InverseEuler(ll n, ll MOD)
{
 return pow(n,MOD-2,MOD);
}

ll C(ll n, ll r, ll MOD)
{

 return (f[n]*((InverseEuler(f[r], MOD) * InverseEuler(f[n-r], MOD)) % MOD)) % MOD;
}

int main()
{
 ll n,m;
 cin>>n>>m;
 vector<int>divisors;
     for(int i=1;i*i<=m;i++)
	{
		if(m%i==0)
		{
			divisors.pb(i);
			if(i*i!=m) divisors.pb(m/i);
		}
	}
	sort(divisors.begin(),divisors.end());
	int l = divisors.size()-1;
	for(int i=l;i>=0;i--)
    {

        if((m/divisors[i])>=n)
        {
            cout<<divisors[i]<<endl;
            break;
        }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <utility>
#include <fstream>

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; }
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353;
constexpr int MAX = 5000000;

struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string s; cin >> s;
	int n = s.size();
	vector<vector<mint>> dp(n + 1, vector<mint>(4));
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {

		if (s[i] == '?') {
			for (int j = 0; j < 3; j++) {
				dp[i + 1][j + 1] += dp[i][j];
			}
			for (int j = 0; j < 4; j++) dp[i + 1][j] += dp[i][j] * 3;
		}
		else {
			for (int j = 0; j < 4; j++) dp[i + 1][j] += dp[i][j];
			if (s[i] == 'A') {
				dp[i + 1][1] += dp[i][0];
			}
			else if (s[i] == 'B') {
				dp[i + 1][2] += dp[i][1];
			}
			else if (s[i] == 'C') {
				dp[i + 1][3] += dp[i][2];
			}
		}
	}
	cout << dp[n][3].x << "\n";
}

Measured memory_bytes: 10288
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>

//#include<bits/stdc++.h>




using namespace std;
int main() {

	vector<int>r;;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		r.push_back(t);
	}
	sort(r.begin(), r.end());
	int ans = 1;

	for (int i = 0; i < n - 1; i++) {
		if (r[i] != r[i + 1])ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#define LOCAL
#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(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 100001;
static const ll MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool int_ceil(T a, T b) { T res = a / b; if(a % b != 0) res++; return res; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	string str[4] = {"dream", "dreamer", "erase", "eraser"};
	string s; cin >> s;
	string res = "";
	rrep(i, s.size()){
		res.insert(res.begin(), s[i]);
		rep(j, 4){
			if(str[j].size() != res.size()) continue;
			if(str[j] == res) {
				res.clear();
				break;
			}
		}
	}

	if(res.empty()){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}

	return 0;
}


Measured memory_bytes: 3656
n,m=map(int,input().split())
a=list(map(int,input().split()))
rep=[]
for i in range(m):
    b,c=map(int,input().split())
    rep.append([c,b])
rep.sort(reverse=True)
Card=[0]*n
cnt=0
fg=0
while fg<n and cnt<m:
    tt=0
    while tt<rep[cnt][1] and fg+tt <n :
        Card[fg+tt]=rep[cnt][0]
        tt+=1
    fg+=tt
    cnt+=1

a.sort()
ans=[]
for i in range(n):
    ans.append(max(a[i],Card[i]))

print(sum(ans))

Measured memory_bytes: 25664
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    while(cin>>s)
    {
        int is_c=0,flag=1;
        if(s[0]!='A')
            flag=0;
        if(s[1]>='A'&&s[1]<='Z')
            flag=0;
        for(int i=2;i<s.size()-1;i++)
            if(s[i]=='C')
            is_c++;
            else if(s[i]>='A'&&s[i]<='Z')
            flag=0;
        if(s[s.size()-1]>='A'&&s[s.size()-1]<='Z')
            flag=0;
        if(flag&&is_c==1)
            cout<<"AC\n";
        else
            cout<<"WA\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int c[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }
    for(int i = 0; i < 2; i++){
        int c0 = c[i][0] - c[i+1][0], c1 = c[i][1] - c[i+1][1], c2 = c[i][2] - c[i+1][2];
        if(!(c0 == c1 && c1 == c2)){
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i = 0; i < 2; i++){
        int c0 = c[0][i] - c[0][i+1], c1 = c[1][i] - c[1][i+1], c2 = c[2][i] - c[2][i+1];
        if(!(c0 == c1 && c1 == c2)){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main() {
    int K, X;
    cin >> K >>X;
    for (int i = X - K + 1; i <= X + K - 1; i++)
    {
        cout << i;
        if (i != X + K -1)
        {
            cout << " ";
        }
        
    }
    cout << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
if 104 >= n:
    print(0)
    exit()
ans = 0
for i in range(105,n+1,2):
    l1 = [0]*(i+1)
    count = 1
    for j in range(2,i+1):
        if i % j == 0:
            while i % j == 0:
                l1[j] += 1
                i //= j
    for k in l1:
        count *= (k+1)
    if count == 8:
        ans += 1

print(ans)

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<unordered_set<int>> graph(n, unordered_set<int>());
  for (int i = 0; i < m; i++) {
    int a, b; cin >> a >> b; a--; b--;
    graph[a].insert(b);
    graph[b].insert(a);
  }
  int bridges = 0;
  vector<int> stack(0);
  for (int i = 0; i < n; i++) {
    if (graph[i].size() == 1) stack.push_back(i);
  }
  while (!stack.empty()) {
    int x = stack.back(); stack.pop_back();
    for (auto y : graph[x]) {
      bridges++;
      graph[y].erase(x);
      if (graph[y].size() == 1) stack.push_back(y);
    }
  }
  cout << bridges << '\n';
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws java.io.IOException {
        Scanner sc = new Scanner(System.in);
        while (true) {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < 8; i++) {
                sb.append(sc.nextLine());
            }
            sb.append("0110");
            String str = sb.toString();
            if (str.split("1111").length == 2)
                System.out.println("C");
            else if (str.split("11")[1].length() == 6)
                System.out.println("A");
            else if (str.split("11")[1].length() == 7)
                System.out.println("E");
            else if (str.split("11")[1].length() == 5)
                System.out.println("G");
            else if (str.split("1")[1].length() == 6)
                System.out.println("D");
            else if (str.split("11").length == 3)
                System.out.println("F");
            else
                System.out.println("B");
            if (sc.hasNext())
                sc.nextLine();
            else
                break;

        }
    }
}

Measured memory_bytes: 12000
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    IN(ll, M);
    IN(ll, K);
    AIN(ll, A, N);
    AIN(ll, B, M);
    vi acc(M + 1);
    REP(i, M)
    {
        acc[i + 1] = acc[i] - B[i];
    }
    SORT(acc);
    ll ans = acc.end() - lower_bound(ALL(acc), -K) - 1;
    ll s = 0;
    REP(i, N)
    {
        s += A[i];
        if (s <= K)
        {
            ll d = acc.end() - lower_bound(ALL(acc), -(K - s)) - 1;
            CH(max, ans, i + 1 + d);
        }
    }
    OUT(ans);
}

Measured memory_bytes: 8008
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int n;
    cin >> n;

    vector <int> A, odd;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        A.push_back(a);
        if (i % 2 == 0) {
            odd.push_back(a);
        }
    }

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

    int ans = 0;
    for (int i = 0; i < odd.size(); i++) {
        int pos = lower_bound(A.begin(), A.end(), odd[i]) - A.begin();
        if (pos % 2 == 1) ans++;
    }

    cout << ans << "\n";
    return 0;
}

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

//.define
// #define FILE_IN_OUT
#define RET(_x)    return cout << (_x) << '\n', 0;
#define all(_obj)  (_obj).begin(), (_obj).end()
#define loop(_n)   for (int i = 0; i < (_n); ++i)
#define sz(_obj)   static_cast<int>((_obj).size())
#ifdef SHJ_LOCAL
#define debug(_x)  std::cerr << (#_x) << " = " << (_x) << '\n' << std::flush;
#else
#define debug(_x)  {}
#endif
#define endl "\n"
template<typename P, typename Q>
P CeilDiv(P _dividend, Q _divider) {
    return static_cast<P>((_dividend - 1LL + _divider) / _divider);
}
template<typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
    for (Tp current = _begin; current != _end; ++current) {
        std::cout << *current << _delim;
    }
    std::cout << '\n';
}

//.constant
using ll  = long long;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);

//.data

//.code
int main() {
#ifdef FILE_IN_OUT
    std::ifstream cin ("input.txt",  std::ios::in);
    std::ofstream cout("output.txt", std::ios::out);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif

    int n, x, t;
    cin >> n >> x >> t;
    cout << CeilDiv(n, x) * t << endl;

#ifdef FILE_IN_OUT
    cin.close();
    cout.close();
#endif
    return 0;
}

Measured memory_bytes: 3648
def main():
    white, black = [int(e) for e in input().split()]

    w = 100
    h = 50

    line = [0] * w
    field = [list(line) for _ in range(h)]

    white -= 1

    if white > 0:
        black -= 1

        for y in range(0, h, 2):
            for x in range(0, w, 2):
                field[y][x + 1] = field[y + 1][x] = field[y + 1][x + 1] = 1
                white -= 1
                if white == 0:
                    break
            if white == 0:
                break

    if black > 0:
        for y in range(24, h, 2):
            for x in range(0, w, 2):
                field[y][x] = 1
                black -= 1
                if black == 0:
                    break
            if black == 0:
                break

    print('{} {}'.format(h, w))
    for line in field:
        print(''.join(['#' if c else '.' for c in line]))


if __name__ == '__main__':
    main()


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

typedef pair<int,int> P;

int H,W;
char Data[1001][1001];

int bfs()
{
	queue<P> que;
	int left = H * W ;
	int newtarget = 0 ;

	for( int h = 0; h < H; h++ ){
		for( int w = 0; w < W; w++ ){
			if( Data[h][w] == '#'){
				que.push( P(h,w));
				left-- ;
				newtarget++;
			}
		}
	}

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

	int count = 0 ;
	while( left > 0 ){
		count++ ;
		int target = newtarget ;
		newtarget = 0 ;
		for( int i = 0; i < target; i++ ){
			P p = que.front();
			que.pop();
			int h = p.first ;
			int w = p.second ;

			for( int dir = 0; dir < 4; dir++ ){
				int hh = h + dx[dir] ;
				int ww = w + dy[dir] ;

				if( hh >= 0 && ww >= 0 && hh < H && ww < W ){
					if( Data[hh][ww] == '.' ){
						Data[hh][ww] = '#' ;
						left--;
						newtarget++ ;
						que.push(P(hh,ww));
					}
				}
			}
		}
	}
	return count ;
}

int main()
{
	cin >> H >> W;
	for( int i = 0; i < H; i++ ){
		cin >> Data[i];
	}
	int ans = bfs() ;
	cout << ans << endl ;
}


Measured memory_bytes: 9360
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=input.split("\n");
var len=Arr.shift()-0;
var n=[];
for(var i=0;i<=len;i++)n[i]=0;
for(var i=0;i<Arr.length;i++){
   var v=Arr[i].split(" ").map(Number);
   var a=[v[0],v[2]];
   var b=[v[1],v[3]];
   if(a[1]>b[1])n[a[0]]+=3;
   if(a[1]<b[1])n[b[0]]+=3;
   if(a[1]==b[1]){
      n[a[0]]++;
      n[b[0]]++;
   }
}
n.shift();
var nn=n.slice();
nn.sort(function(a,b){return b-a;});
n.forEach(function(v){
   console.log(nn.indexOf(v)+1);
});

Measured memory_bytes: 11196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int vv(int a,int b){
    if(a%b==0){
        return a/b;
    }
    else{
        return a/b+1;
    }
}

int main() {
    //ios_base::sync_with_stdio(false);
    //cout<<setprecision(17);
    int a,b;
    cin>>a>>b;
    if(a==1&&b==1){
        cout<<1<<" "<<2<<endl;
        cout<<"#.";
        return 0;
    }
    int a0=a-1;
    int b0=b-1;
    cout<<2*vv(a-1,49)+1+2*vv(b-1,49)+1<<" "<<99<<endl;
    for(int i=0;i<vv(a-1,49);i++){
        for(int j=0;j<99;j++){
            cout<<"#";
        }
        cout<<endl;
        for(int j=0;j<99;j++){
            if(j%2==0||a0<=0){
                cout<<"#";
            }
            else{
                cout<<".";
                a0--;
            }
        }
        cout<<endl;
    }
    for(int i=0;i<99;i++){
        cout<<"#";
    }
    cout<<endl;
    for(int i=0;i<vv(b-1,49);i++){
        for(int j=0;j<99;j++){
            cout<<".";
        }
        cout<<endl;
        for(int j=0;j<99;j++){
            if(j%2==0||b0<=0){
                cout<<".";
            }
            else{
                cout<<"#";
                b0--;
            }
        }
        cout<<endl;
    }
    for(int i=0;i<99;i++){
        cout<<".";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)
#define REPO(i, n) for (ll i = 1; i <= n; i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(), n.end()
#define MOD 1000000007
#define P pair<ll, ll>


#define PP pair<P, char>

ll n;
vector<PP> s;
vector<ll> RtD[400500], LtD[400500], RtU[400500], LtU[400500];
ll ans = INF;
void solve1(char a, char b){
    ll f = -1;
    REP(i, n){
        ll x = s[i].first.first, y = s[i].first.second;
        if(s[i].second == b and f != -1){
            ans = min(ans, abs(f - y) * 5);
        }
        if(s[i].second == a){
            f = y;
        }
        if(x != s[i + 1].first.first){
            f = -1;
        }
    }
}

ll T1(ll a, ll b){
    return 200000 + a - b;
}
ll T2(ll a, ll b){
    return a + b;
}
int main() {
    cin >> n;
    s.resize(n);
    REP(i, n){
    cin >> s[i].first.first >> s[i].first.second >> s[i].second;
    }
    // UD
    sort(ALL(s));
    s.push_back(PP(P(INF, INF), INF));
    solve1('U', 'D');
    s.pop_back();
    REP(i, n){
        swap(s[i].first.first, s[i].first.second);
    }
    //RL
    sort(ALL(s));
    s.push_back(PP(P(INF, INF), INF));
    solve1('R', 'L');
    s.pop_back();
    REP(i, n){
        swap(s[i].first.first, s[i].first.second);
    }
    //add
    REP(i, n){
        ll x = s[i].first.first, y = s[i].first.second;
        if(s[i].second == 'R'){
            RtD[T1(x, y)].push_back(-y);
            RtU[T2(x, y)].push_back(y);
        }
        if(s[i].second == 'L'){
            LtD[T2(x, y)].push_back(-y);
            LtU[T1(x, y)].push_back(y);
        }
    }
    REP(i, 400100){
        RtD[i].push_back(INF);
        LtD[i].push_back(INF);
        RtU[i].push_back(INF);
        LtU[i].push_back(INF);
        sort(ALL(RtD[i]));
        sort(ALL(LtD[i]));
        sort(ALL(RtU[i]));
        sort(ALL(LtU[i]));
    }
    ///*
    //solve
    REP(i, n){
        ll x = s[i].first.first, y = s[i].first.second;
       // cout << x << " " << y << " " << s[i].second<< endl;
        if(s[i].second == 'D'){
            ll a1 = *upper_bound(ALL(RtD[T1(x, y)]), -y);
            //cout << a1 << "!!!!"<< endl;
            if (a1 != INF) ans = min(ans, abs(a1 + y) * 10);
            ll a2 = *upper_bound(ALL(LtD[T2(x, y)]), -y);
            //cout << a2 << "!"<< endl;
            if (a2 != INF) ans = min(ans, abs(a2 + y) * 10);
        }
        if(s[i].second == 'U'){
            ll a1 = *upper_bound(ALL(RtU[T2(x, y)]), y);
            //cout << a1 << "!!!"<< endl;
            if (a1 != INF) ans = min(ans, abs(a1 - y) * 10);
            ll a2 = *upper_bound(ALL(LtU[T1(x, y)]), y);
            //cout << a2 << "!!"<< endl;
            if (a2 != INF) ans = min(ans, abs(a2 - y) * 10);
        }
    }
    //*/
    if(ans == INF){
        cout << "SAFE" << endl;
        return 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 97700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i,m,n) for(ll i = (m); i < (n); i++)
#define all(v) v.begin(), v.end()
#define print(x) cout << (x) << endl
//宣言
double R,PI = 6.28318530717958623200;

int main() {
    cin >> R;

    cout << R*PI << endl;
    return 0;
}


Measured memory_bytes: 3788
#include <iostream>
#include<cstdio>
const int N = 200000 + 10;

int n, x;
int ans[N];

int main() {
	scanf("%d%d", &n, &x);
	if (x == 1 || x == 2 * n - 1) return puts("No"), 0;
	puts("Yes");
	ans[n] = x;
	static bool flag[N];
	flag[x] = true;
	if (x > 2)
	{
		ans[n - 1] = 1;
		ans[n + 1] = 2 * n - 1;
		ans[n + 2] = 2;
		flag[1] = flag[2] = flag[2 * n - 1] = true;
	}
	else
	{
		ans[n - 1] = 2 * n - 1;
		ans[n + 1] = 1;
		ans[n + 2] = 2 * n - 2;
		flag[1] = flag[2 * n - 2] = flag[2 * n - 1] = true;
	}
	for (int i = 1, j = 1; i < 2 * n; ++i) {
		if (!ans[i]) {
			while (flag[j]) ++j;
			ans[i] = j;
			flag[j] = true;
		}
	}
	for (int i = 1; i < 2 * n; ++i) printf("%d\n", ans[i]);
	return 0;
}

Measured memory_bytes: 2432
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

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

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

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */

int main() {
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    int mx = 0;
    chmax(mx, 10 - ((a%10 != 0) ? a % 10:10));
    chmax(mx, 10 - ((b%10 != 0) ? b % 10:10));
    chmax(mx, 10 - ((c%10 != 0) ? c % 10:10));
    chmax(mx, 10 - ((d%10 != 0) ? d % 10:10));
    chmax(mx, 10 - ((e%10 != 0) ? e % 10:10));
    int ans =0;
    ans += a / 10 * 10 + (a % 10 == 0 ? 0 : 10);
    ans += b / 10 * 10 + (b % 10 == 0 ? 0 : 10);
    ans += c / 10 * 10 + (c % 10 == 0 ? 0 : 10);
    ans += d / 10 * 10 + (d % 10 == 0 ? 0 : 10);
    ans += e / 10 * 10 + (e % 10 == 0 ? 0 : 10);
    ans -= mx;
    cout <<ans << endl;
}



Measured memory_bytes: 256