akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define pi pair<ll, ll>
#define PI 3.141592653589793238462643383279502884L
#define mp make_pair
#define pb push_back
#define fall(i, a, b) for (int i = a; i < b; i++)
#define sz(x) (ll) x.size()
#define all(x) x.begin(), x.end()
#define ed cout << "ed";
ll M = 1e9 + 7;


ll poow(ll a, ll b, ll m)
{

    if (b % 2 == 0)
        return (((ll)pow(a, b / 2) % m) * ((ll)pow(a, b / 2) % m)) % m;
    else
        return (((ll)pow(a, (b - 1) / 2) % m) * ((ll)pow(a, (b + 1) / 2) % m)) % m;
}

bool subsum(ll ar[], ll s, ll n)
{
    if (n == 0 && s != 0)
        return false;
    else if (s <= 0)
        return true;

    else if (ar[n - 1] > s)
        return subsum(ar, s, n - 1);
    else
        return (subsum(ar, s - ar[n - 1], n - 1) || subsum(ar, s, n - 1));
}
int binarySearch(int arr[], int l, int r, int x)
{
    if (r >= l)
    {
        int mid = l + (r - l) / 2;

        if (arr[mid] == x)
            return mid;

        if (arr[mid] > x)
            return binarySearch(arr, l, mid - 1, x);

        return binarySearch(arr, mid + 1, r, x);
    }

    return -1;
}
int main()
{
    fio;
    bool b=false;
   ll a,i,j,c;
    cin>>a;
    ll cnt=0;
    for(i=1;i*i<=a;i++)
    {
        if(a%i==0 )
            {if(i*i==a)
            cnt++;
else
    cnt+=2;}
    }
    if(cnt==2)
        cout<<"1";
    else{int f=sqrt(a);
        ll isPrime[f+1]={0};
        isPrime[0]=0;
        isPrime[1]=1;
        for(i=2;i*i<=f;i++)
        {
            if(isPrime[i]==0)
                for(j=i*i;j<=f;j+=i)
            isPrime[j]=1;
        }
        vector<int> v;
        for(i=2;i<=f;i++)
        {if(isPrime[i]==0)
            v.push_back(i);
        }
         map<int,int> fre;
        for(i=0;i<v.size();i++)
        {
            while(a%v[i]==0)
            {fre[v[i]]++;
                a=a/v[i];
            }
        }
        if(a>1)c=1;
        else c=0;
        for(auto i=fre.begin();i!=fre.end();i++)
        {
            int in=1;
            int sum=1;
            while(sum<=(i->second))
            {
            in++;
                c++;
               sum+=in;
            }
        }

        cout<<c;
    }
    return 0;
}




Measured memory_bytes: 11712
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for(int i = l; i <= r; i++){
        if(i % d == 0)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;

int main() {
    double a, b;
    cin >> a >> b;
    printf("%d %d %.8f\n", int(a / b), int(a) % int(b), a / b);
}


Measured memory_bytes: 3292
I=1000000007
n=int(input())
s=["A","C","G","T"]
List=["AGCA","AGCC","AGCG","AGCT","ACGA","ACGC","ACGG","ACGT","GACA","GACC","GACG","GACT","AAGC","CAGC","GAGC","TAGC","CACG","AACG","TACG","AGAC","CGAC","GGAC","TGAC","ATGC","AGGC","AGTC"]
dp=[[0]*(64) for i in range(n-2)]
for i in range(64):
    if i not in {6,9,33}:
        dp[0][i]=1
if n==3:
    print(61)
else:
    for i in range(n-3):
        for a in range(len(s)):
            for b in range(len(s)):
                for c in range(len(s)):
                    for d in range(len(s)):
                        if s[a]+s[b]+s[c]+s[d] not in List:
                            dp[i+1][b*16+c*4+d]=(dp[i+1][b*16+c*4+d]+dp[i][a*16+b*4+c])%I

    print(sum(dp[-1])%I)

Measured memory_bytes: 3188
import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {

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

	Scanner sc = new Scanner(System.in);

	void run() {
		int n = sc.nextInt();
		
		for(int i = 0 ; i < n ; i++){
			String input = sc.next();
			
			System.out.println(solve(input));
		}
		
	}
	
	int solve(String input){
		if(!input.startsWith("[")){
			return (Integer.valueOf(input)+1)/2 ;
		}
		
		int depth = 0;
		StringBuilder buf = new StringBuilder();
		LinkedList<Integer> mins = new LinkedList<Integer>(); 
		for(char ch:input.toCharArray()){
			if(ch == '['){
				if(depth == 0){
					buf = new StringBuilder();
				}else{
					buf.append(ch);
				}
				depth++;
			}else if(ch == ']'){
				depth--;
				if(depth == 0){
					mins.add(solve(buf.toString()));
				}else{
					buf.append(ch);
				}
			}else {
				buf.append(ch);
			}
		}
		Collections.sort(mins);
		int ans = 0;
		
		for(int i = 0 ; i < (mins.size()+1)/2;i++){
			ans += mins.get(i);
		}
		return ans;
		
	}
	
}



Measured memory_bytes: 51760
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <algorithm>
#include <numeric>
long long int power(long long int base, int exp) {
	switch (exp) {
	case 0: return 1;
	case 1: return base;
	default: return power(base, exp & 1) * power(base * base, exp >> 1);
	}
}
static std::string old_password;
static long long int old;
long long int diff(const long long int new_value) {
	return std::min(std::abs(old - new_value), power(10, old_password.size()) - std::abs(old - new_value));
}
long long int new_password(const long long int new_temp, const long long int digit, int used) {
	if (digit == 0) {
		return new_temp;
	}
	std::vector<int> suspects(10); std::iota(suspects.begin(), suspects.end(), 0);
	suspects.erase(std::remove_if(suspects.begin(), suspects.end(), [used](int i) {return (used & (1 << i)) != 0; }), suspects.end());
	std::sort(suspects.begin(), suspects.end(), [new_temp, digit](int i, int j) {return diff(new_temp + digit * i) > diff(new_temp + digit * j); });
	long long int max_value = new_password(new_temp + digit * suspects.front(), digit / 10, used | (1 << suspects.front()));
	for (auto i = 1; i < 3 && i < suspects.size(); ++i) {
		const auto temp = new_password(new_temp + digit * suspects[i], digit / 10, used | (1 << suspects[i]));
		if (diff(max_value) < diff(temp) || (diff(max_value) == diff(temp) && temp < max_value)) {
			max_value = temp;
		}
	}
	return max_value;
}
int main() {
	std::cin >> old_password;
	old = std::stoll(old_password);
	auto result_value = new_password(0, power(10, old_password.size() - 1), 0);
	std::string result(old_password.size(), '0');
	for (int i = old_password.size() - 1; i >= 0; --i) {
		result[i] = '0' + result_value % 10;
		result_value /= 10;
	}
	std::cout << result << std::endl;
}


Measured memory_bytes: 3212
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<cstring>
#include<vector>
#include<stack>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<iomanip>
#include<functional>
#include<unordered_map>
#define io ios::sync_with_stdio(false),cin.tie(0)
#define inf 0x3f3f3f3f
#define ll long long
#define P pair<int,int>
#define lc rt*2
#define rc rt*2+1
const int maxn = 1e5 + 10;
const int mod = 1e9 + 7;
const double PI = 3.1415926536;

using namespace std;
int a[] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };

int main()
{
	io;
	int n;
	cin >> n;
	cout << a[n - 1];
	return 0;
}

Measured memory_bytes: 256
#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--)
using namespace std;
typedef long long ll;

int main(){
    int x, a, b;
    cin >> x >> a >> b;
    if (a >= b) cout << "delicious" << endl;
    else if (a + x >= b) cout << "safe" << endl;
    else cout << "dangerous" << endl;
}

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

using s64 = long long;

int main() {
  int n, extra;
  cin >> n >> extra;
  vector<int> cost(n);
  for (int i = 0; i < n; ++i) {
    cin >> cost[i];
  }

  vector<vector<int>> low(n);
  for (int i = 0; i < n; ++i) {
    low[i].resize(n);
    low[i][i] = cost[i];
    for (int k = 1; k < n; ++k) {
      int j = (i + k) % n;
      low[i][j] = min(low[i][(j + n - 1) % n], cost[j]);
    }
  }

  s64 answer = accumulate(cost.begin(), cost.end(), 0ll);
  for (int i = 1; i < n; ++i) {
    s64 current = (s64)i * extra;
    for (int r = 0; r < n; ++r) {
      current += low[(r + n - i) % n][r];
    }
    answer = min(answer, current);
  }
  cout << answer << endl;

  return 0;
}

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

int n,m, ans = 0;
vector<vector<int>> connect_mat(12, vector<int>(12, 0));


int main(){
    // input
    cin >> n;
    vector<int> A(n);
    vector<vector<int>> x(n), y(n);
    int tmp_x, tmp_y;
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
        for (int j = 0; j < A[i]; j++)
        {
            cin >> tmp_x >> tmp_y;
            x[i].push_back(tmp_x-1);
            y[i].push_back(tmp_y);
        }
    }
    
    // bit全探索
    int ans = 0;
    for (int bit = 0; bit < (1 << n); bit++)
    {   
        int size_shoujiki = bitset<15>(bit).count();
        if (ans >= size_shoujiki) {
            continue;
        }
        vector<int> B(n,0);
        for (int i = 0; i < n; i++)
        {
            if (bit & (1 << i)){
                B[i] = 1;
            }
        }

        // 矛盾がないか確かめる
        bool ok = true;
        for (int i = 0; i < n && ok; i++)
        {
            if (B[i] == 0) // 不親切な人の証言は無視
            {
                continue;
            }
            for (int j = 0; j < A[i] && ok; j++)
            {
                if (B[x[i][j]] != y[i][j])
                {
                    ok = false;
                    break;
                }
            }
        }

        if (ok)
        {
            ans = size_shoujiki;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
string n,m;
void Main(){
    cin>>n>>m;

    cout<<m<<n<<endl;
}
int main(){
    Main();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=a;i--)
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define de(x) cout << #x << "=" << x << endl
#define dd(x) cout << #x << "=" << x << " "
#define pw(x) (1ll<<(x))
#define pq priority_queue
#define endl "\n"
int main()
{
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if(s.size()%2!=0){
    	cout <<"No";
    	return 0;
	} 
	for(int i=0;i<s.size();i++){
		if(i%2==0 && s[i]!='h'){
			cout <<"No";
			return 0;
		}
		if(i%2==1 && s[i]!='i'){
			cout <<"No";
			return 0;
		}
	}   
	cout <<"Yes";
    return 0;
}


Measured memory_bytes: 256
/*
   AUTHOR :- Gaurang_Kothiya
   
   Quote:-" Great things never come from comfort zones."                                                                                                                
*/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>
 
using namespace std;
using namespace __gnu_pbds;  

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> data_set; 
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long  
#define ld long double
#define f(i,x,n) for(ll i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(ll i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()
#define b_s(a,b)   binary_search( all(a),b)
#define lb(v,n)  lower_bound(all(v) ,n )
#define ub(v,n)  upper_bound( all(v) , n)
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define RE rend()
#define RB rbegin()
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846
#define MOD 1000000007


void Solve()
{
	string s;
	cin>>s;
	
	if(s=="ABC")cout<<"ARC";
	else cout<<"ABC";
	
}

signed main() 
{
	speed		
	
	int q=1;
	//cin>>q;
	
	while(q--)
	Solve();
	
	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
}

 
 

Measured memory_bytes: 3604
using System;
namespace ConsoleApplication1{
    class Program{
        static void Main(string[] args){
            int n = int.Parse(Console.ReadLine());
            double px,py,r;
            for(int i=0;i<n;i++){
                String[] str = Console.ReadLine().Split();
                double x1 = double.Parse(str[0]);
                double y1 = double.Parse(str[1]);
                double x2 = double.Parse(str[2]);
                double y2 = double.Parse(str[3]);
                double x3 = double.Parse(str[4]);
                double y3 = double.Parse(str[5]);
                px=((2*(y2-y1))*(x1*x1-x3*x3+y1*y1-y3*y3)-(2*(y3-y1))*(x1*x1-x2*x2+y1*y1-y2*y2))/
((2*(x2-x1))*(2*(y3-y1))-(2*(x3-x1))*(2*(y2-y1)));
                py=((x1*x1-x2*x2+y1*y1-y2*y2)*(2*(x3-x1))-(x1*x1-x3*x3+y1*y1-y3*y3)*(2*(x2-x1)))/
((2*(x2-x1))*(2*(y3-y1))-(2*(x3-x1))*(2*(y2-y1)));
                r=Math.Sqrt((x1-px)*(x1-px)+(y1-py)*(y1-py));
                Console.WriteLine("{0:f3} {1:f3} {2:f3}",px,py,r);
            }
        }
    }
}

Measured memory_bytes: 5724
/*input
20 3
5 10 15
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define ld long double
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


ll power(ll a,ll m,ll mod){
	ll ans=1;
	while(m){
		if(m%2){
			ans*=a;
			ans%=(mod);
		}
		a=(a*a)%(mod);
		m>>=1;
	}
	return ans;
}


void init(ll* a,ll n,ll val){
	for(ll i=0;i<n;i++)
		a[i]=val;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);	
	ll t=1,i,j;
	ll k,n;
	cin>>k>>n;
	ll a[n+2];
	rep(i,0,n)cin>>a[i];
	ll ans=LLONG_MAX;
	rep(i,1,n){
		ll k1=k-abs(a[i]-a[i-1]);
		ans=min(ans,k1);
	}
	ans=min(ans,a[n-1]-a[0]);
	cout<<ans<<endl;
	return 0;
}




Measured memory_bytes: 1792
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

typedef struct{
  double x;
  double y;
}xy;

void kock( int, xy, xy );

int main()
{
  xy p1, p2;
  int n;

  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;

  scanf("%d", &n);
  printf("%.8f %.8f\n", p1.x, p1.y);
  kock( n, p1, p2 );
  printf("%.8f %.8f\n", p2.x, p2.y);

  return 0;
}



void kock( int n, xy p1, xy p2 )
{
  xy s, t, u;
  
  if( n == 0 ) return;

  //p1, p2 から s,t,u を 計算
  
  s.x = ((2*p1.x)+(1*p2.x)) / 3;
  s.y = ((2*p1.y)+(1*p2.y)) / 3;
  t.x = ((1*p1.x)+(2*p2.x)) / 3;
  t.y = ((1*p1.y)+(2*p2.y)) / 3;
  
  u.x = (t.x-s.x)*cos(M_PI/3.0) - (t.y-s.y)*sin(M_PI/3.0) + s.x;
  u.y = (t.x-s.x)*sin(M_PI/3.0) + (t.y-s.y)*cos(M_PI/3.0) + s.y;
  

  kock(n-1, p1, s);
  printf("%.8f %.8f\n", s.x, s.y);
  kock(n-1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  kock(n-1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  kock(n-1, t, p2);

}



Measured memory_bytes: 2108
#include <iostream>
using namespace std;
int a[100]={11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,881,911,941,971,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381,1451,1471,1481,1511,1531,1571,1601,1621,1721,1741,1801,1811,1831};
int n;
int main() {
	cin>>n;
	for(int i=0;i<n;i++)cout<<a[i]<<' ';
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try(Scanner scn = new Scanner(System.in)) {
            int sum = Math.min(Math.min(scn.nextInt(), scn.nextInt()), scn.nextInt()) - 50;
            System.out.println(sum += Math.min(scn.nextInt(), scn.nextInt()));
        }
    }
}

Measured memory_bytes: 26200
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n,m;
    cin >> n;
    intl p[n];
    cin(i,p);
    sort(p, p + n,greater<>());
    intl cnt = p[0]/2;
    repi(i,1,n)cnt += p[i];
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define mod 1000000007
#define pb push_back
typedef long long ll;
typedef long double ld;
#define FOR(i,n) for(i=0;i<n;i++)
#define FORE(i,n) for(i=0;i<=n;i++)
 
 
ll gcd(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
   
}
    
 
ll maxl(ll a,ll b){
    if(a>b)return a;
    return b;
}
 
ll minl(ll a,ll b){
    if(a>b)return b;
    return a;
}
 
ll mod = 1000000007;
 
ll mulmod(ll a, ll b,ll c){ 
    ll res = 0; 
    a = a % c; 
    while (b > 0){ 
        if (b % 2 == 1){ 
            res = (res + a) % c;
        }
        a = (a * 2) % c; 
        b /= 2; 
    } 
    return res % c; 
}
 
int binarySearch(int arr[], int l, int r, int x) 
{ 
    if (r >= l) { 
        int mid = l + (r - l) / 2; 
        if (arr[mid] == x) 
            return mid; 
        if (arr[mid] > x) 
            return binarySearch(arr, l, mid - 1, x); 
        return binarySearch(arr, mid + 1, r, x); 
    } 
    return -1; 
} 

int a[100005];
int tree[200005];

void build(int st,int low,int high){
    if(low==high){
        tree[st] = a[high]%2;
        return;
    }
    int mid = low+(high-low)/2;
    build(2*st,low,mid);
    build(2*st+1,mid+1,high);
    tree[st] = tree[2*st]+tree[2*st+1];
}

void update(int st,int start,int end,int ind,int val){
    if(start==end){
        tree[st] = val%2;
        return;
    }
    int mid = start+(end-start)/2;
    if(ind<=mid){
        update(2*st,start,mid,ind,val);
    }
    else update(2*st+1,mid+1,end,ind,val);
    tree[st] = tree[2*st]+tree[2*st+1];
}

int query(int st,int start,int end,int low,int high){
    if(start>high || end<low)return 0;
    int mid = start + (end-start)/2;
    if(start==low && end==high){
        return tree[st];
    }
    if(low>mid)return query(2*st+1,mid+1,end,low,high);
    if(high<=mid)return query(2*st,start,mid,low,high);
    return query(2*st,start,mid,low,mid)+query(2*st+1,mid+1,end,mid+1,high);
}

int digit(int a){
    int ans = 0;
    while(a!=0){
        ans++;
        a/=10;
    }
    return ans;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    ll ans = 0;
    for(int i=1;i<=n;i++){
        ans+=digit(i)%2;
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
data = input().split()
 
n = int(data[0])
m = int(data[1])
 
pro = [int(s) for s in input().split()]
 
vote = 0
for i in pro:
  vote += i
 
s_pro = sorted(pro, reverse=True)

if s_pro[m - 1] < vote * 1 / (4 * m):
  print("No")
else:
  print("Yes")

Measured memory_bytes: 3064
using System;

namespace arc088a
{
    class Program
    {
        static void Main(string[] args)
        {
            ulong[] read = Array.ConvertAll(Console.ReadLine().Split(),ulong.Parse);
            ulong X = read[0];
            ulong Y = read[1];
            // double res = Math.Log10(Y/X)/Math.Log10(2);
            // long resi = (long)res+1;
            long resi = 0;
            while(X<=Y){
                X *= 2;
                resi++;
            }
            Console.WriteLine(resi);
        }
    }
}

Measured memory_bytes: 13140
n = int(input())
xs = []
ys = []
for _ in range(n):
    x, y = map(int, input().split())
    xs.append(x + y)
    ys.append(x - y)
xs.sort()
ys.sort()
ans = max(xs[-1] - xs[0], ys[-1] - ys[0])
print(ans)


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

using ll=long long;

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//(x,y) int型配列x[y]の受け取り

int fact(int x){
  if (x == 1) return 1;
  return x*fact(x-1);
}//(x) x!

int div1(ll x){
  return x%1000000007;
}

main(){
    int n=in();
    string s,abc="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    cin >> s;
    for (int i=0;i<s.size();i++){
        int m;
        for (m=0;true;m++) if (s[i]==abc[m]) break;
        s[i]=abc[(m+n)%26];
    }
    cout << s << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> a;
	for(int i=0;i<n;i++)
	{
		int q;
		cin>>q;
		a.push_back(q);
	}
	vector<int> b=a;
	sort(a.begin(),a.end());
	int t1=a[n-1];
	int t2=a[n-2];
	for(int i=0;i<n;i++)
	{
		if(b[i]==t1)
		{
			cout<<t2<<endl;
		}
		else
		{
			cout<<t1<<endl;
		}
	}
}

Measured memory_bytes: 3316
n, m = list(map(int, input().split()))

dic = {k: 0 for k in range(n)}
for _ in range(m):
    a, b = list(map(int, input().split()))
    dic[a-1] += 1
    dic[b-1] += 1

for key in sorted(dic.keys()):
    print(dic[key])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define fr(i,a,b) for(int i=(a);i<(b);i++)
#define frd(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll;
#define int long long
#define pii pair<int,int>
#define mp make_pair
#define IOS cin.tie(NULL),ios_base::sync_with_stdio(false),cout.tie(NULL);
#define pb push_back
#define sz(a) a.size()
#define all(x) x.begin(),x.end()
#define endl '\n'
#define fi first
#define se second




void solve(){
  string s;
  cin >> s;
  if(s=="ABC"){
    cout << "ARC" <<endl;
    return;
  }
  cout << "ABC" << endl;



}





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


Measured memory_bytes: 3652
N = int(input())

import collections
l = []
for n in range(N):
  S = input()
  l.append(S)

c = collections.Counter(l)


print("AC x " + str(c['AC']))
print("WA x " + str(c['WA']))
print("TLE x " + str(c['TLE']))
print("RE x " + str(c['RE']))

Measured memory_bytes: 16652
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n = ri()
    la = rli()
    lb = []
    for i, a in enumerate(la):
        lb.append((a, i))
    lb.sort()
    print(" ".join(map(str, [e[1]+1 for e in lb])))


if __name__ == '__main__':
    main()


Measured memory_bytes: 28132
#include<bits/stdc++.h>
#include<map>
#include<set>
using namespace std;
int main () {
  int N;
  cin >> N;
  map<string, int>ca;
  set<string>ke;
  for (int i = 0; i < N; i ++) {
    string S;
    cin >> S;
    ke.insert(S);
    ca[S] ++;
  }
  int M;
  cin >> M;
  for (int i = 0; i < M; i ++) {
    string S;
    cin >> S;
    ca[S] --;
  }
  int ans = 0;
  for (auto str = ke.begin(); str != ke.end(); ++ str) {
    ans = max(ans, ca[*str]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
/*
ID: hafiz.i1
TASK: milk2
LANG: C++
*/
#include<bits/stdc++.h>

#define ll long long
#define debug(x) cout<<x<<"DE"<<endl;

using namespace std;



int main()
{
//    freopen("milk2.in", "r", stdin);
//    freopen("milk2.out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m,s=0;
    cin>>n>>m;map<ll,ll>f;
    for(int i=1;i<=n;i++){
        ll k,a;
        cin>>k;
        for(int j=1;j<=k;j++){
            cin>>a;f[a]++;
            if(i==n&&f[a]==n)s++;
        }
    }
    cout<<s;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) ll(i.size())
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#ifdef tmd
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

template<class T> inline bool cmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool cmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MOD=1000000007;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll MAXN=1e5+5;
const ll MAXLG=__lg(MAXN)+2;

string a;
/********** Main()  function **********/
int main()
{
  IOS();
  cin>>a;
  if(a.size() & 1)reverse(ALL(a));
  cout<<a<<endl;
  return 0;
}


Measured memory_bytes: 768
/* ex 7_1
   terakura */

#include <stdio.h>
#include <math.h>

typedef struct point{
    int x_elem;
    int y_elem;
}point;


//bを中心として90度回転
point shift_point(point a, point b){
    point c;
    c.x_elem = (a.x_elem - b.x_elem)*(0) + (a.y_elem - b.y_elem)*(-1)*(-1) + b.x_elem; //(a.x_elem - b.x_elem)*(cos(-π/2)) + (a.y_elem - b.y_elem)*(-1)*(sin(-π/2)) + b.x_elem
    c.y_elem = (a.x_elem - b.x_elem)*(-1) + (a.y_elem - b.y_elem)*(0) + b.y_elem;  //(a.x_elem - b.x_elem)*(sin(-π/2)) + (a.y_elem - b.y_elem)*(cos(-π/2)) + b.y_elem

    return c;
}


int main(void){

    point a, b, c, d;
    scanf("%d %d %d %d", &a.x_elem, &a.y_elem, &b.x_elem, &b.y_elem);

    c = shift_point(a, b);
    d = shift_point(b, c);

    printf("%d %d %d %d\n", c.x_elem, c.y_elem, d.x_elem, d.y_elem);

    return 0;

}


Measured memory_bytes: 1732
n,m = map(int,input().split())
base = [list(map(int,input().split())) for i in range(m)]
judge = list(map(int,input().split()))
ans = 0

for i in range(2**n):
  count = [0] * m
  sign = 0
  for j in range(n):
    if (i >> j) & 1:
      for k in range(m):
        for l in range(base[k][0]):
          if (j+1) == base[k][l+1]:
            count[k] = count[k] + 1
  
  for j in range(m):
    if (count[j]%2 != judge[j]):
      sign = 1
      break

  if sign == 0:
    ans = ans + 1
  
print(ans)

Measured memory_bytes: 43120
#include<bits/stdc++.h>
using namespace std;
const int inf = 1e9 +7, N = 350;

#define gc getchar
#define inc(i, x, y) for (int i = x; i <= y; ++i)
#define dec(i, x, y) for (int i = x; i >= y; --i)

bool chkmin(int &x, int y) { return (x > y) ? x = y, 1 : 0; }

int rd() {
	int ret = 0; bool fl = 0; char ch = 0;
	while (!isdigit(ch)) fl |= (ch == '-'), ch = gc();
	while (isdigit(ch)) ret = (ret << 1) + (ret << 3) +(ch ^ 48), ch = gc();
	return fl ? -ret : ret;
}

bool vis[N];
int n, m, ans, fp[N], cnt[N], a[N][N];

int chk(int x) {
	int fl = 1;
	inc(i, 1, n) fp[i] = 1;
	memset(vis, 0, sizeof(vis));
	while (fl) {
		memset(cnt, 0, sizeof(cnt));
		inc(i, 1, n) {
			while (vis[a[i][fp[i]]]) fp[i]++;
			if (fp[i] > m) return inf;
			cnt[a[i][fp[i]]]++;
		}
		fl = 0;
		inc(i, 1, m) {
			if (cnt[i] > x) {
				fl = 1;
				vis[i] = 1;
			}
		}
	}
	int ret = 0;
	inc(i, 1, m) if (cnt[i]) ret = max(ret, cnt[i]);
	return ret;
}

int main() {
		n = rd(), m = rd(), ans = inf;
		inc(i, 1, n) inc(j, 1, m) a[i][j] = rd();
		int l = 1, r = n;
		while (l <= r) {
			int mid = l + r >> 1, tmp = chk(mid);
			if (chkmin(ans, tmp)) r = tmp - 1;
			else l = mid + 1;
		}
		printf("%d\n", ans);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main(void){
	ll x; cin >> x;
	ll d = x / 11;
	d *= 2;
	ll amari = x % 11;
	// printf("%lld %lld \n", d, amari);
	if(1 <= amari && amari <= 6) d++;
	else if(6 < amari)d += 2;
	printf("%lld\n", d);
	return 0;
}

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


  1 3 6 10 15
    snow<-|^ + (15 - 10 ) -15

*/
int main()
{

    unsigned long long a, b, x=0;

    cin>>a>>b;
    int i = 1;
    while(i<=(b-a))
    {
        x+=i;
        i++;
    }
    cout<<x-b<<endl;

}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = do
	[ n, m ] <- readInts
	print $ ( n * ( n - 1 ) + m * ( m - 1 ) ) `div` 2

Measured memory_bytes: 380
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ul;
#define all(x) (x).begin(), (x).end()
#define pi 3.1415926536

struct TreeNode {
    int val;
    TreeNode* left;
    TreeNode* right;

    TreeNode(int x): val(x), left(NULL), right(NULL){}
};

struct ListNode {
    int val;
    ListNode* next;

    ListNode(int x): val(x), next(NULL){}
};

int nxt(){
    int x;
    cin>>x;
    return x;
}

ll nxtLong(){
    ll x;
    cin>>x;
    return x;
}

string nxtStr(){
    string x;
    cin>>x;
    return x;
}

char nxtChar(){
    char x;
    cin>>x;
    return x;
}

double nxtDouble(){
    double x;
    cin>>x;
    return x;
}

ld nxtLDouble(){
    ld x;
    cin>>x;
    return x;
}

TreeNode* makeTree(int n){
    queue<TreeNode*> tree_nodes;
    TreeNode* root;
    if(n){
        root = new TreeNode(nxt());
        tree_nodes.push(root);
    }else{
        return NULL;
    }
    while(!tree_nodes.empty()){
        TreeNode* node = tree_nodes.front();
        tree_nodes.pop();
        bool left;
        cin>>left;
        if(left){
            node->left = new TreeNode(nxt());
            tree_nodes.push(node->left);
        }
        bool right;
        cin>>right;
        if(right){
            node->right = new TreeNode(nxt());
            tree_nodes.push(node->right);
        }
    }
    return root;
}

ListNode* makeLinkedList(int n){
    ListNode* list = new ListNode(0);
    ListNode* dummy = list;

    for(int i=0;i<n;++i){
        list->next = new ListNode(nxt());
        list = list->next;
    }

    return dummy->next;
}

void solve(){
    int n = nxt();

    vector<int> ans(10050);

    for(int i=1;i<1105;++i){
        for(int j=1;j<1105;++j){
            for(int k=1;k<1105;++k){
                ll v = (ll)i*(ll)i + (ll)j*(ll)j + (ll)k*(ll)k + (ll)i*(ll)j + (ll)j*(ll)k + (ll)k*(ll)i;
                if(v < 10050){
                    ans[v]++;
                }
            }
        }
    }
    for(int i=1;i<=n;++i){
        cout<<ans[i]<<endl;
    }
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout<<fixed<<setprecision(9);
    //ll t;
    //cin>>t;
    //while(t--){
    //    solve();
    //}
    solve();
    return 0;
}


Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a,a+3);
    cout << a[0] << " " << a[1]<< " "  << a[2] << endl;
    
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 100100100100100100;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

ll dp[50][510][510];

int main(){
    ll N,MA,MB;
    cin >> N >> MA >> MB;
    rep(i,50) rep(j,510) rep(k,510) dp[i][j][k] = INF;
    dp[0][0][0] = 0;
    rep(i,N){
        ll a,b,c;
        cin >> a >> b >> c;
        rep(j,410){
            rep(k,410){
                dp[i+1][j+a][k+b] = min(dp[i][j+a][k+b],dp[i][j][k] + c);
                dp[i+1][j][k] = min(dp[i][j][k],dp[i+1][j][k]);
            }
        }
    }
    ll ans = INF;
    rep(i,410) rep(j,410){
        if(i * j == 0) continue;
        if(i * MB == j * MA) ans = min(ans,dp[N][i][j]);
    }
    if(ans == INF){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }
}


Measured memory_bytes: 101888
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////

bool prime(ll i) {
	if (i == 1) { return 0; }

	for (ll j = 2; j < i; j++) {
		if (i%j == 0) { return 0; }
	}
	return 1;
}



int main() {

	ll N;
	cin >> N;

	ll ans = 1;

	for (ll i = 2; i <= N; i++) {
		if (prime(i) == 0) { continue; }

		ll t = 0;
		for (int k = N/i; k > 0; k /= i) {
			t += k;
		}

		ans = ans * (t+1)%MOD;
	}

	cout << ans;
	

	system("PAUSE");
}


Measured memory_bytes: 504
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<stdio.h>
#include<time.h>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	while(true) {
	int a, b;
	char op;

	cin>>a>>op>>b;		if(op == '?') break;
	switch(op) {
		case '+': cout<<a + b<<endl; break;
		case '-': cout<<a - b<<endl; break;
		case '*': cout<<a * b<<endl; break;
		case '/': cout<<a / b<<endl; break;
	}
	}
}

Measured memory_bytes: 3056
def counting_sort(ary, bry, k):
    cry = [0 for i in range(k)]

    for j in range(n):
        cry[ary[j]] += 1

    for i in range(1, k):
        cry[i] = cry[i] + cry[i - 1]

    for j in range(n - 1, -1, -1):
        bry[cry[ary[j]] - 1] = ary[j]
        cry[ary[j]] -= 1

if __name__ == '__main__':
    n = int(input())
    ary = [int(_) for _ in input().split()]
    bry = [0 for i in range(n)]
    counting_sort(ary, bry, 10 ** 5)
    print(*bry)



Measured memory_bytes: 224244
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 0
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int n,ans;
string s[211111];
signed main(){
	set<string> se;
	cin>>n;
	rep(i,n){
		cin>>s[i];
		se.insert(s[i]);
	}
	cout<<se.size()<<endl;
	
}

Measured memory_bytes: 25820
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, count=0, max=0;
    cin >> n;
    vector<int> h(n), com(n-1);
    for(int i=0; i<n; i++) cin >> h[i];
    
    for(int i=0; i<n-1; i++) {
        if(h[i] >= h[i+1]) {
            count++;
        } else {
            count = 0;
        }
        
        if(max < count) {
            max = count;
        }
    }
    
    cout << max << endl;
    
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int num = 0;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    int l,r;
    cin >> l >> r;
    
    num += r - (l - 1);
  }
  
  cout << num << endl;
}

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

int main() {
	char a[3];
	int t = 0;
    scanf("%s", a);
	for (int i = 0; i < 3; i++) {
		int n = strncmp(&a[i], "o", 1);
		//printf("%d\n", n);
		if (n == 0) {
			t++;
			//printf("%d\n", t);
		}
		else {
		//	printf("continue?\n");
			continue;
		}
	}
	printf("%d\n", 700 + (100 * t));
}

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

using namespace std;


#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),v).end()

#define PB(a) push_back(a)
#define MOD 1000000007

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

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

  int n;cin>>n;
  for(int i=0;i<n;i++){
      int f=0,s=0,t=0,out=0,point=0;
      string st;
      while(cin>>st){
          if(st=="HIT"){
              if(t) point++;
              if(s) t=1;
              if(f) s=1;
              f=1;
          }
          else if(st=="HOMERUN"){
              point+=(f+s+t+1);
              f=0;s=0;t=0;
          }
          else{
              out++;
              if(out==3){
                  cout<<point<<endl;
                  break;
              }
          }
      }
  }
  
}

Measured memory_bytes: 3036
#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());const int D=4,dx[]={+1,0,-1,0},dy[]={0,+1,0,-1};

const int N=1e5+5;
struct edge{
    int x,y,w;
}es[N];
vector<int> g[N];
int go(int v,int i){return v^es[i].x^es[i].y;}
int p[N],tot[N],a[N],ok[N],u[N];
int get(int x){return x==p[x]?x:(p[x]=get(p[x]));}
void join(int x,int y){
    x=get(x);y=get(y);
    if(x^y){
        p[y]=x;
        tot[x]+=tot[y];
    }
}
void dfs(int v,int x){
    if(u[v])return;
    u[v]=1;
    for(int i:g[v]){
        int to=go(v,i);
        if(es[i].w<=x){
            ok[i]=1;
            if(!u[to])dfs(to,x);
        }
    }
}
int32_t main(){
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;++i){
        cin>>a[i];
        p[i]=i;
        tot[i]=a[i];
    }
    forn(i,m)cin>>es[i].x>>es[i].y>>es[i].w;
    sort(es,es+m,[](const edge&p1,const edge&p2){return p1.w<p2.w;});
    forn(i,m){
        g[es[i].x].pb(i);
        g[es[i].y].pb(i);
    }
    forn(i,m){
        join(es[i].x,es[i].y);
        ok[i]=tot[get(es[i].x)]>=es[i].w;
    }
    int ans=0;
    for(int i=m-1;i>=0;--i){
        if(ok[i])dfs(es[i].x,es[i].w);
        else ans++;
    }
    cout<<ans<<'\n';

    return 0;
}


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

using namespace std;

vector<set<int>> gs(200001);
int main()
{
    int n; cin >> n;

    vector<int64_t> ns(n);
    for (auto& v: ns) cin >> v;
    
    for(int i = 0; i < n; i++) {
        gs[ns[i]].insert(i);
    }

    vector<int64_t> dp(n);
    dp[n - 1] = 1;
    for (int i = n - 2; 0 <= i; i--) {
        int64_t v = ns[i];
        auto it = gs[v].find(i);
        assert(it != gs[v].end());
        it++;
        if (it == gs[v].end()) {
            dp[i] = dp[i+1];
        }
        else if (*it == i + 1) {
            dp[i] = dp[i+1];
        }
        else {
            dp[i] = dp[i+1] + dp[*it];
            dp[i] %= 1000000007;
        }
    }

    cout << dp[0] << endl;

    return 0;
}

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

using namespace std;


int a[200005];
int main() {
    int n;
    int k;
    cin>>n>>k;
    for (int t=0; t<n; t++)cin>>a[t];
   for (int i=0; i<n-k; i++){
       if (a[i]<a[i+k]){
           cout<<"Yes"<<endl;
       }
       else {
        cout<<"No"<<endl;
           
       }
   
   }
   
   
   
   
    return 0;
    
}

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

using namespace std;
#define ll long long 
int main() {
int x;
cin>>x;
string h;
cin>>h;
for(int i=1;i<x;i++)
if(h.substr(0,i)==h.substr(i,x))
return cout<<"Yes",0;
cout<<"No"<<endl;
   
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<cstdlib>

using namespace std;

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

int main(){
    long int n;
    cin >> n;
    string s;
    cin >> s;
    long int r[n];
    long int g[n];
    long int b[n];
    r[0] = 0;
    g[0] = 0;
    b[0] = 0;
    if (s[0] == 'R'){
        r[0]++;
    }else if (s[0] == 'G'){
        g[0]++;
    }else{
        b[0]++;
    }    

    rep(i, n-1){
        r[i+1] = r[i];
        g[i+1] = g[i];
        b[i+1] = b[i];
        if (s[i+1] == 'R'){
            r[i+1]++;
        }else if (s[i+1] == 'G'){
            g[i+1]++;
        }else{
            b[i+1]++;
        }
    }
    long int ans = 0;
    long int sm;
    for (long int i = 0; i < n - 2; i++){
        for (long int j = i + 1; j < n - 1; j++){
            if (s[i] == s[j]) continue;
            if ((s[i] == 'R' && s[j] == 'G') || (s[i] == 'G' && s[j] == 'R')){
                sm = b[n-1] - b[j-1];
                if (j + (j - i) <= n - 1){
                    if (s[j+(j-i)] == 'B'){
                        sm--;
                    }
                }
            }else if ((s[i] == 'B' && s[j] == 'G') || (s[i] == 'G' && s[j] == 'B')){
                sm = r[n-1] - r[j-1];
                if (j + (j - i) <= n - 1){
                    if (s[j+(j-i)] == 'R'){
                        sm--;
                    }
                }
            }else if ((s[i] == 'B' && s[j] == 'R') || (s[i] == 'R' && s[j] == 'B')){
                sm = g[n-1] - g[j-1];
                if (j + (j - i) <= n - 1){
                    if (s[j+(j-i)] == 'G'){
                        sm--;
                    }
                }
            }
            // cout << sm << endl;
            ans += sm;
        }   
    }
    // rep(i, n) cout << r[i] << " " << g[i] << " " << b[i] << endl;
    cout << ans << endl;
}

Measured memory_bytes: 3268