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

#define MEM(a, b) memset(a, b, sizeof a);
#define REP(i, k) for(int i = (0); i < (k); i++ )
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)

#define ALL(cont) cont.begin(), cont.end()
#define RALL(cont) cont.begin(), cont.end()
#define FOREACH(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define INF (int)INT_MAX
#define EPS (int)1e-9
#define PI acos(-1)
#define MOD 1000000007

#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

typedef long L;
typedef unsigned long UL;
typedef long long LL;
typedef unsigned long long ULL;

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

void solve(__attribute__((unused)) int tc = 0) {
    int n, m, q;
    cin >> n >> m >> q;
    LL arr[1000][1000];
    MEM(arr, 0);

    REP(_, m) {
        int l, r;
        cin >> l >> r;
        arr[l][r]++;
    }

    FOR(i, 1, n) FOR(j, 1, n) arr[i][j] += arr[i][j - 1];
    FOR(i, 1, n) FOR(j, 1, n) arr[i][j] += arr[i - 1][j];
    
    REP(_, q) {
        int l, r;
        cin >> l >> r;
        cout << arr[r][r] + arr[l - 1][l - 1] - arr[l - 1][r] - arr[r][l - 1] << endl;
    }
    return;
}

int main() {
#ifdef FILE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    /*int TC;
      cin >> TC;
      REP(tc, TC) {
      solve(tc);
      }*/
    solve();
#ifdef TIME
    cout << "Execution time(second) : " << int(clock() * 1000.0 / CLOCKS_PER_SEC) << " ms" << endl;
#endif
}


Measured memory_bytes: 8704
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

N = Int()
S = input()

ans = [0]*8
ans[0] = 1
D = {'R':1, 'G':2, 'B':4}

for i in range(N):
    #print(ans)
    for j in range(8):
        k = 7-j
        if k|D[S[i]] != k:
            ans[k|D[S[i]]] += ans[k]
#print(ans)
tmp = 0
for i in range(N):
    for j in range(1,N):
        if i+2*j < N:
            if S[i]!=S[i+j] and S[i] != S[i+2*j] and S[i+j] != S[i+2*j]:
                tmp += 1
print(ans[7]-tmp)

Measured memory_bytes: 68304
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    N = NI()
    A = sorted(NLI())
    if N % 2:
        for i in range(N):
            if i % 2 == 0 and A[i] == i:
                continue
            elif i % 2 == 1 and A[i] == i + 1:
                continue
            else:
                print(0)
                exit()
        print(pow(2, (N//2), MOD))

    else:
        for i in range(N):
            if i % 2 == 0 and A[i] == i + 1:
                continue
            elif i % 2 == 1 and A[i] == i:
                continue
            else:
                print(0)
                exit()
        print(pow(2, (N//2), MOD))


if __name__ == "__main__":
    main()

Measured memory_bytes: 20800
import sys
import numpy as np
from itertools import combinations
sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int():
    return int(input())

def map_int_input():
    return map(int, input())

MII = map_int_input

def MII_split():
    return map(int, input().split())

def MII_to_index():
    return map(to_index, input())

def MII_split_to_index():
    return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs():
    return list(map(int, input()))

LII = list_int_inputs

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

# 2次元リスト化
def LII_2D(rows_number):
    return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number):
    return [LII_split() for _ in range(rows_number)]

N, M, X = MII_split()

books = []
# prices = []
for i in range(N):
    book = LII_split()
    # prices.append(book[0])
    books.append(book)

# books = sorted(books.items(), key=lambda x: sum(x[1]), reverse=True)
# chosen_books = []
# is_chosen = [False for _ in range(N)]
price = 0
min_price = -1
for i in range(N):  # i = 選ぶ本の個数-1

    for tmp_books in combinations(books, i + 1):
        algo_skills = np.array([0 for _ in range(M)])
        price = 0
        for skills in tmp_books:
            algo_skills += np.array(skills[1:])
            price += skills[0]
        if np.all(algo_skills >= X):
            if min_price == -1 or price < min_price:
                min_price = price

print(min_price)

Measured memory_bytes: 27248
from collections import Counter


def read():
    N = int(input())
    S = []
    for i in range(N):
        s = input()
        S.append(s)
    return N, S

def solve(N, S):
    return len(Counter(S))


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("{}".format(outputs))


Measured memory_bytes: 38760
# coding: utf-8
# Your code here!
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n=int(input())
if n==1:
    print(0)
    exit()
a=factorization(n) 

count=0
for i in range(len(a)):
    j=1
    while 1:
        a[i][1]=a[i][1]-j

        count+=1
        if a[i][1]<0:
            a[i][1]=a[i][1]+j
            count-=1
            break
        elif a[i][1]==0:
            break
        j+=1
print(count)
        

Measured memory_bytes: 9496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(void){
	ll a,b; cin>>a>>b;
	if((a-b)%2==0){
		cout<<(a+b)/2<<endl;
	}else{
		cout<<"IMPOSSIBLE"<<endl;
	}
	
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
int main()
{
    using namespace std;
    int X;
    long i, j;
    cin >> X;
    for (i = -120; i <= 120; i++)
    {
        for (j = -120; j < i; j++)
        {
            if (static_cast<long>(pow(i, 5)) - static_cast<long>(pow(j, 5)) == X)
            {
                cout << i << ' ' << j << endl;
                return 0;
            }
        }
    }
}

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

int main() {
    vector<int> n(3);
    cin >> n[0] >> n[1] >> n[2];
    sort(n.begin(), n.end());
    int ans = n[2] * 10 + n[1] + n[0];
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	int a[5];
	int i;
	int g,t,p;
	
	for(;;)
	{
		
		g=t=p=0;
		
		for(i=0;i<5;i++)
		{
			cin >> a[i] ;
			if(a[0]==0)
				break;
			if(a[i]==1)
				g=1;
			if(a[i]==2)
				t=1;
			if(a[i]==3)
				p=1;
		}
		if(a[0]==0)
			break;
		
		
		if(g==1 && t==1 && p==1 || g+t+p==1)
		{
			for(i=0;i<5;i++)
			 cout << "3" << endl;
		}
		else if(g==1 && t==1)
		{
			for(i=0;i<5;i++)
			{
					cout << a[i] << endl;
			}
		}
		else if(t==1 && p==1)
		{
			for(i=0;i<5;i++)
			{
				if(a[i]==2)
					cout << "1" << endl;
				else
					cout << "2" << endl;
			}
		}
		else if(g==1 && p==1)
		{
			for(i=0;i<5;i++)
			{
				if(a[i]==1)
					cout << "2" << endl;
				else
					cout << "1" << endl;
			}
		}
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n,m;cin>>n>>m;
  vector<P> ng(m);
  rep(i,m){
    cin>>ng[i].second>>ng[i].first;
  }
  sort(ng.begin(),ng.end());
  int last=0;
  int res=0;
  rep(i,m){
    if(ng[i].second>=last){
      last=ng[i].first;
      res++;
    }
  }
  cout<<res<<endl;
  
  return 0;
}


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

int main(){
    while(true){
        int x, y;
        cin >> x >> y;

        if(x == 0 && y == 0){
            break;
        }
        else{
            vector<string> v(x);
          for(int i = 0; i < x; i++){
            for(int j = 0; j < y; j++){
                if(i % 2 == 0){
                    if(j % 2 == 0){
                        v[i] += "#";
                    }
                    else{
                        v[i] += ".";
                    }
                }
                else{
                    if(j % 2 == 0){
                        v[i] += ".";
                    }
                    else{
                        v[i] += "#";
                    }
                }
            }
            cout << v[i] << endl;
            if(i == x - 1){
                cout << endl;
            }
          } 
        }     
    }
}


Measured memory_bytes: 3132
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

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

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

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll ans = 0;
    rep(i,n) {
        ans = gcd(ans, a[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long;

const int MOD = 1000000007;

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	vector<ll> sum(N, 0);
	for (int i = 0; i < N - 1; i++) {
		sum[i + 1] = sum[i] + A[N - 1 - i];
		sum[i + 1] %= MOD;
	}
	ll ans = 0;
	for (int i = 0; i < N - 1; i++) {
		ans += (A[i] * sum[N - 1 - i]) % MOD;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;

int main() {
  
  int n;
  cin >> n;
  vec2 a(n);
  for(int i = 0; i < n; i++) cin >> a.at(i);

  for(int i =0; i < n; i++) {
    if(a.at(i) == "Y") {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}

Measured memory_bytes: 256
//Program.cpp
//Author : Aaryan Srivastava 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#define pb push_back
#define popb pop_back
#define ull unsigned long long  
#define beg begin
#define mp make_pair
#define pii pair<int, int>
#define piii pair<pii,int>
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define ff first
#define ss second 
#define fill(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
using ll = long long;
#define int ll
const int N = 1e5 + 5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace std;
#ifdef AaryanS
#define mycout cout
#define mycerr cerr 
#endif

#ifndef AaryanS
#define mycout if(false) cout
#define mycerr if(false) cerr
#define AaryanS 0 
#endif

template <typename T> void max_self(T &a, T b) {a = max(a,b) ;}
#define debug(x) mycerr << #x << " "  << x << endl ;

void solve()
{
	int n ;
	cin >> n ;
	std::vector<double> p(n+1);
	repA(i,1,n)
		cin >> p[i] ;
	vector<vector<double >> dp(n+1,vector<double>(n+1,0.0));	
	dp[1][1] = p[1] ;
	dp[1][0] = (1-p[1]);
	repA(coins_tossed,1,n){
		repA(num_heads,0,coins_tossed){
			if(coins_tossed == 1){
				mycout << dp[coins_tossed][num_heads] << " " ;
				continue ;
			}
			dp[coins_tossed][num_heads] = (1-p[coins_tossed])*dp[coins_tossed-1][num_heads] ;
			if(num_heads)
				dp[coins_tossed][num_heads] +=  p[coins_tossed]*dp[coins_tossed-1][num_heads-1] ;
			mycout << dp[coins_tossed][num_heads] << " "; 		
		}
		mycout << endl ;
	}
	double ans = 0.0 ;
	repA(i,(n+1)/2,n){ 
		ans += dp[n][i] ;
	}	
	cout << std::fixed << setprecision(15) << ans ;
}   

     
int32_t main(int32_t argc, char *argv[])
{
    double t1 = clock() ;
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, tt = 0;
   // cin >> TC ;
    while(tt++ < TC)
    {
        //cout << "Case " << t << ":\n" ;
        solve();
    }
    mycerr << "Time : " << 1000 *(clock() - t1)/CLOCKS_PER_SEC << " ms\n" ;
    return 0;
}

Measured memory_bytes: 70784
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        a: u64, b: u64, t: u64
    }
    println!("{}", t / a * b);
}

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

int main() {
  int N, L;
  cin >> N >> L;

  vector<int> v(N + 1);
  int idx = 1;
  int taste = pow(10, 9);
  for (int i = 1; i <= N; i++) {
    v[i] = L + i - 1;
    if (abs(v[i]) < taste) {
      taste = abs(v[i]);
      idx = i;
    }
  }
  int sum = accumulate(v.begin() + 1, v.end(), 0);
  cout << sum - v[idx] << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
 
//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
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 A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end


 
int main(){
  int n,m; scanf("%d%d",&n,&m);
  vector<P> a(n);
  rep(i,0,n)scanf("%d%d",&a[i].first,&a[i].second);
  sort(ALL(a));
  priority_queue<int> pq;
  ll ans=0,idx=0;
  rrep(i,m-1,-1){
    while(idx<n&&a[idx].first+i<=m){
      pq.push(a[idx].second); idx++;
    }
    if(pq.size()){
      int add=pq.top(); pq.pop();
      ans+=add;
    }
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 2428
/*input
141421 35623
*/
/*

**************************
*						 *
* AUTHOR :: knight_coder *
*						 *
**************************

*/
#include<bits/stdc++.h>
#define lld          long long int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<lld,lld>
#define msi         map<string,lld>
#define mis         map<lld, string>
#define mpi         map<pair<lld ,lld >,lld >
#define pii         pair<lld,lld>
#define vi          vector<lld>
#define vpi 		vector<pii>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (lld)x.size()
#define hell        1000000007
#define rrep(i,m,n)	for(lld i=m;i>=n;i--)
#define rep(i,m,n)	for(lld i=m;i<n;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define pr(x) 		cout<< x << " ";
#define pre(x)		cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; 
//change null_type to get ordered_map
#define N  100005
#define DEC(N)	cout << std::fixed; cout << setprecision(N);
void solve()
{
	lld ans=0;
	lld n,k;
	cin >> n >> k;
	rep(i,k,n+2){
		ans+=((n*i)%hell-(i*(i-1+hell))%hell+1+hell)%hell;
		ans%=hell;
	}
	cout << ans << endl;
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	//cin>>tests;
	while(tests--)
	{
		solve();
	}
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <string>
#include <climits>
#include <map>
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;

int main()
{

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll test;
    cin >> test;
    map<string, int> mp = {{"AC", 0}, {"WA", 0}, {"TLE", 0}, {"RE", 0}};
    while(test--) {
      string s;
      cin >> s;
      mp[s] += 1;
    }

    cout << "AC" << " x "  << mp["AC"] << endl;
    cout << "WA" << " x "  << mp["WA"] << endl;
    cout << "TLE" << " x "  << mp["TLE"] << endl;
    cout << "RE" << " x "  << mp["RE"] << endl;
    //
    // for(auto i: mp) {
    //   cout << i.first << " x " << i.second << endl;
    // }
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define prime 31
#define mp make_pair
#define INF 1000000000
#define mod 1000000007
#define fi first
#define se second
int main()
{
	string s,t;
	cin>>s>>t;
	ll ans=INF;
	for(ll i=0;i<=s.length()-t.length();i++)
	{
		ll k=0,ans1=0;
		for(ll j=i;j<i+t.length();j++)
		{
			if(s[j]!=t[k])
			ans1++;
			k++;
		}
	//	cout<<ans1<<endl;
		ans=min(ans,ans1);
	}
	cout<<ans<<endl;
}

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

int main(){
  int n,m;
  cin>>n;
  vector<string>blue(n);
  for(int i=0;i<n;i++){
    cin>>blue.at(i);
  }
  cin>>m;
  vector<string>red(m);
  for(int i=0;i<m;i++){
    cin>>red.at(i);
  }

  int max=0;
  string v;
  for(int i=0;i<n;i++){
    int u=0;
    v=blue.at(i);
    for(int j=0;j<n;j++){
      if (v==blue.at(j))u++;
    }
    for(int j=0;j<m;j++){
      if(v==red.at(j)) u--;
    }
    if(u>max)max=u;
  }

  cout<<max<<endl;
}

Measured memory_bytes: 3620
n = int(input())
h = list(map(int, input().split()))
node = [0] * n
for i in range(n):
  if i == 0:
    node[i] = 0
  elif i == 1:
    node[i] = abs(h[i] - h[i-1])
  else:
    a = abs(h[i] - h[i-1]) + node[i-1]
    b = abs(h[i] - h[i-2]) + node[i-2]
    if a < b:
      node[i] = a
    else:
      node[i] = b
    
print(node[n-1])
#print(node)
  

Measured memory_bytes: 20468
#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int n,ave=0,cost=0;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
        ave+=a[i];
    }
    ave=round((float)ave/n);
    for(int i=0;i<n;i++){
        cost+=pow(ave-a[i],2);
    }
    cout << cost << endl;
}


Measured memory_bytes: 256
N, M, K = map(int, input().split())
A = []
t = 0
for n in map(int, input().split()):
  if t + n > K:
    break
  t += n
  A.append(n)
N = len(A)
A = iter(A[::-1])
diff, top, i = 0, 0, 0
for m in map(int, input().split()):
  if t + m <= K:
    t += m
    diff += 1
  else:
    if i >= N:
      break
    for n in A:
      i += 1
      diff -= 1
      t -= n
      if t + m <= K:
        t += m
        diff += 1
        break
  if diff > top:
    top = diff
print(N+top)

Measured memory_bytes: 112908
import scala.io.StdIn


object Main extends App {
  val Array(x, a)  = StdIn.readLine.split(" ").map(_.toInt)

  def solve(x: Int, a: Int) : Int  = {
    if (x < a) 0 else 10
  }
  println(solve(x, a))

}
  



Measured memory_bytes: 27204
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N,M;
  cin >> N >> M;
  if(M%2==1){M-=1;}
  long long count=0;
  if(N>=M/2){cout << M/2 << endl;}
  else{
    count+=N;
    M-=2*N;
    count+=M/4;
    cout << count << endl;
  }
}

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

using namespace std;

class Stack
{
public:
	Stack()
	{
		m_capacity = 10;
		m_size = 0;
		m_pArray = new int[m_capacity];
	}

	~Stack()
	{
		if(m_pArray) delete[] m_pArray;
	}

	void Push(int value)
	{
		if (m_size >= m_capacity)
		{
			m_capacity *= 2;
			int* pNewArray = new int[m_capacity];
			memcpy(pNewArray, m_pArray, sizeof(int) * m_size);
			delete[] m_pArray;
			m_pArray = pNewArray;
		}
		m_pArray[m_size++] = value;
	}

	void Pop()
	{
		--m_size;
	}

	const int Top()
	{
		return m_pArray[m_size - 1];
	}

	int Size() const { return m_size; }

private:
	int* m_pArray;
	int m_capacity;
	int m_size;
};

int main()
{
	Stack values;
	string str;
	while (cin >> str)
	{
		if (str != "+" && str != "-" && str != "*")
			values.Push(atoi(str.c_str()));
		else
		{
			const int v2 = values.Top(); values.Pop();
			const int v1 = values.Top(); values.Pop();
			if (str == "+") values.Push(v1 + v2);
			else if (str == "-") values.Push(v1 - v2);
			else if (str == "*") values.Push(v1 * v2);
		}
		if (getchar() == '\n') break;
	}

	cout << values.Top() << endl;

	return 0;
}


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

int main()
{
    char buffer[256];
    int n;
    int i;
    char animal[2][101];
    int taro, hanako, judge;
    taro = 0;
    hanako = 0;
    
    fgets(buffer, 256, stdin);
    sscanf(buffer, "%d", &n);
    for(i=0;i<n;i++)
    {
        fgets(buffer, 256, stdin);
        sscanf(buffer, "%s %s", animal[0], animal[1]);
        judge = strcmp(animal[0], animal[1]);
        if(judge > 0)
        {
            taro+=3;
        }
        else if(judge == 0)
        {
            taro++;
            hanako++;
        }
        else
        {
            
            hanako+=3;
        }
    }
    printf("%d %d\n", taro, hanako);
    
    return(0);
}


Measured memory_bytes: 2100
l = [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]
K = int(input())
print(l[K-1])

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

int N, M;
vector<ll> A;
priority_queue<int> C;
map<int, int> B;

int main()
{
    A.reserve(100005);

    cin >> N >> M;
    for (int i = 0; i < N; i++) {
        ll ai;
        cin >> ai;
        A.push_back(ai);
    }

    for (int i = 0; i < M; i++) {
        int bi, ci;
        cin >> bi >> ci;

        if (B.count(ci)) {
            B[ci] += bi;
        } else {
            B.insert(make_pair(ci, bi));
        }

        C.push(ci);
    }

    sort(A.begin(), A.end());
    for (int i = 0; i < N; i++) {
        if (!C.empty() && A[i] < C.top()) {
            A[i] = C.top();
            B[C.top()]--;
            if (B.at(C.top()) == 0) {
                int tmp = C.top();
                do {
                    tmp = C.top();
                    C.pop();
                } while (!C.empty() && C.top() == tmp);
            }
        }
    }

    ll ans = 0;
    for (int ai : A) {
        ans += ai;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6136
import java.util.*;
public class Main {
	public static void main(String[] args){		
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		sc.close();
				
		boolean flag = false;
		for(int i = 0;i<=a;i = i+4){
			for(int j = 0;j<=a;j = j+7){
				if(i+j == a){
					flag = true;
				}
			}
		}
		
		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23764
#include<stdio.h>
#include<math.h>

int main()
{
    int n=0 ;
    int i=0 ;
    double x[1001] = {0.0} ;
    double y[1001] = {0.0} ;
    double D=0.0;
    double p=1.0 ;
    double cmp=0.0 ;

    scanf("%d" ,&n) ;

    for (i=0 ;i < n ;i++)
    {
        scanf("%lf" ,&x[i]) ;
    }
    for (i=0 ;i < n ;i++)
    {
        scanf("%lf" ,&y[i]) ;
    }

    for (p=1 ;p <= 3 ;p++)
    {
        cmp=0.0 ;
        D=0.0 ;
        for (i=0 ;i < n ;i++)
        {
            cmp += pow( fabs( x[i] - y[i]) ,p) ;
        }
        D = pow( cmp ,1 / p) ;

        printf("%f\n" ,D) ;
    }

    D=0 ;
    for (i=0 ;i < n ;i++)
    {
        D = fmax(D ,fabs(x[i] - y[i])) ;
    }
    printf("%f\n" ,D) ;

    return 0 ;
}

Measured memory_bytes: 736
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1e9+7;

void solve()
{
	ll n;
	cin>>n;
	ll a[n];
	ll sum=0;
	for(ll i=0;i<n;i++)
		cin>>a[i],sum+=a[i];
	ll m;
	cin>>m;
	while(m--)
	{
		ll p,x;
		cin>>p>>x;
		p--;
		cout<<sum-a[p]+x<<endl;;
	}
	return;
}

int main()
{
        fast;
        ll q;
        q=1;
        // cin>>q;
        while(q--)
        	solve();
        
        return 0;
}

Measured memory_bytes: 3596
import java.util.*;

import static java.lang.System.*;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int N = ni();
        int[] V = niarr(N);
        int[] C = niarr(N);

        int ans = 0;
        for(int i = 0; i < N; i++){
            if(V[i] > C[i]){
                ans += V[i] - C[i];
            }
        }
        out.println(ans);
    }

    static int ni() {
        return sc.nextInt();
    }

    static long nl() {
        return sc.nextLong();
    }

    static String ns() {
        return sc.next();
    }

    static int[] niarr(int N) {
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
        }
        return a;
    }

    static long[] nlarr(int N) {
        long[] a = new long[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextLong();
        }
        return a;
    }
}

Measured memory_bytes: 23124
#include<stdio.h>
int main(void){
  long long int x,sum=0,money=100;
  scanf("%lld",&x);
  while(1){
    money*=1.01;
	sum+=1;
    if(money>=x){
      break;
    }
  }
  printf("%lld\n",sum);
  return 0;
}

Measured memory_bytes: 1736
#include<stdio.h>
#include<string.h>
#define length 100000
typedef struct{
  char name[10];
  int time;
}Q;
Q q[100000],im;
int head,tail,num,t,totaltime;

void enqueue(Q x){
  q[tail]=x;
  tail=(tail+1)%length;
}
Q dequeue(){
  Q tmp;
  tmp=q[head];
  head=(head+1)%length;
  return tmp;
}

int main(){
  int i;
  //入力
  scanf("%d%d",&num,&t);
  for(i=1;i<=num;i++)
    scanf("%s%d",&q[i].name,&q[i].time);

  /* for(i=1;i<=num;i++)printf("enq %s %d\n",q[i].name,q[i].time); */
  head=1;
  tail=num+1;
  //ループ
  while(num!=0){
  /* for(i=0;i<20;i++){ */
    im=dequeue();
     /* printf("deq %s %d\n",im.name,im.time); */
    if(im.time>t){
      im.time=im.time-t;//-
      totaltime+=t;//total
      /* printf("enq %s %d\n",im.name,im.time); */
      enqueue(im);
    }
    else if(im.time>0){
      totaltime+=im.time;//total
      im.time=0;//-
      num--;//num-
      printf("%s %d\n",im.name,totaltime);
    }
  }
  return 0;
}



Measured memory_bytes: 3308
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *					# ll = deepcopy(l)
from heapq import *					# heappush(hp,x)
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize				# minn = -maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *				# pre = [0] + list(accumulate(l))
from decimal import Decimal 		# a = Decimal(a)	# use this for math questions
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(l):
	n = len(l)
	

N = int(stdin.readline())
l = list(map(int, stdin.readline().rstrip().split()))
q = int(input())
s = sum(l)
d = dict(Counter(l))
for qq in range(q):
	b,c = list(map(int, stdin.readline().rstrip().split()))
	if(b not in d):
		print(s)
	else:
		s += d[b]*(c-b)
		if(c in d):
			d[c] += d[b]
		else:
			d[c] = d[b]
		d[b] = 0
		print(s)



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

using namespace std;

int main()
{
    int N; cin >> N;
    string S; cin >> S;
    
    int lcnt = 0;
    for (int i = N - 1; i >= 0; --i) {
        if (S[i] == ')') lcnt++;
        else if (lcnt > 0) lcnt--;
    }
    
    int rcnt = 0;
    for (int i = 0; i < N; ++i) {
        if (S[i] == '(') rcnt++;
        else if (rcnt > 0) rcnt--;
    }
    
    for (int i = 0; i < lcnt; ++i) cout << '(';
    cout << S;
    for (int i = 0; i < rcnt; ++i) cout << ')';
    cout << endl;
}

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

 using namespace std;

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


Measured memory_bytes: 256
/*..........AAKASH GOYAL............*/
/*............DAIICT................*/

#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")

#include <bits/stdc++.h>
using namespace std;

#define    int                      long long int

#define    f(i,j,n)                 for(int i = j; i <= n; i++)
#define    r(i,n,j)                 for(int i = n; i >= j; i--)
#define    mod                      1000000007
#define    speed                    ios_base::sync_with_stdio(false);
#define    upp                      cin.tie(NULL);
#define    pb                       push_back
#define    mp                       make_pair
#define    T                        int tt; cin >> tt; while(tt--)
#define    ff                       first
#define    ss                       second
#define    all(container)           container.begin() , container.end()
#define    sz(container)            (int)container.size()
#define    pii                      pair <int , int>
#define    ppl                      pair <int , pii>               
#define    sp(x)                    setprecision(x)


int32_t main()
{
    speed upp
    int n,x,ff=0;
    set<int>s;
    cin>>n;
    f(i,1,n)
    {
        cin>>x;
        if(s.find(x)!=s.end())
            ff=1;
        s.insert(x);
    }
    if(ff)
        cout<<"NO";
    else
        cout<<"YES";
}

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

int main() {
  int a,b,price;
  cin>>a>>b;
  for(int i =0;i<1253;i++){
    if(int(i*0.08)==a&&int(i*0.1)==b){
      price=i;
      break;
    }
    price=-1;
  }
  cout<<price<<endl;
}



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

using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())

int dp[3100][3100] = { 0 };
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s,t;
	cin >> s >> t;
	for (size_t i = 0; i < s.size(); ++i) {
		for (size_t j = 0; j < t.size(); ++j) {
			if (s[i] == t[j])chmax(dp[i + 1][j + 1], dp[i][j] + 1);
			chmax(dp[i + 1][j + 1], dp[i+ 1][j]);
			chmax(dp[i + 1][j + 1], dp[i][j + 1]);
		}
	}

	string ans = "";
	int i = (int)s.size();
	int j = (int)t.size();
	while (i > 0 && j > 0) {
		if (dp[i][j] == dp[i - 1][j]) {
			--i;
		}
		else if (dp[i][j] == dp[i][j-1]) {
			--j;
		}
		else {
			ans = s[i - 1] + ans;
			--i;
			--j;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  for(int i=0;i<n;i++){
    cin >> h.at(i);
  }
  
  int ans = 0;
  
  for(int i=0;i<n;i++){
    int k = 0;
    for(int j=i;j<n-1;j++){
      if(h.at(j) >= h.at(j+1)){
        k++;
      }
      else {
        ans = max(ans,k);
        i = j;
        break;
      }
      
      if(j == n-2){
        ans = max(ans,k);
        i = n-2;
        break;
      }
      
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = 3.141592653589793;

int main(){

    int A,B,H,M;
    cin >> A >> B >> H >> M;
    double x1,x2,y1,y2;
    x1 = A * cos(2*pi*(H*60+M)/720.0);
    y1 = A * sin(2*pi*(H*60+M)/720.0);
    x2 = B * cos(2*pi*M/60.0);
    y2 = B * sin(2*pi*M/60.0);
  
    cout << fixed << setprecision(15) << sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) << endl;



}

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

int main() {
    int same[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    int x, y;
    cin >> x >> y;
    if (same[x] == same[y]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


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

int main(){
    int n, a, b;
    cin >> n >> a >> b;

    int cnt[3] = {};
    int p;
    for(int i = 0; i < n; i++){
        cin >> p;
        if(p <= a)  cnt[0]++;
        else if(p > b)  cnt[2]++;
        else            cnt[1]++;
    }

    cout << *min_element(cnt, cnt+3) << endl;

    return 0;
}

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

const int N = 1e5 + 5;
int n, cnt[N];
int ans;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		int x; cin >> x; 
		if (x > n) { ++ans; continue; }
		++cnt[x];
	}
	for (int i = 1; i <= n; ++i) {
		if (cnt[i] > i) ans += cnt[i] - i;
		else if (cnt[i] < i) ans += cnt[i];
	}

	cout << ans << endl;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))

int main(){
	double s;
	scanf("%lf",&s);
	//引き返さないなら√2倍が最大で、それが達成できる
	//│＼
	//│　＼
	//└──
	//引き返すのは、x軸方向の移動が1未満のときで、このとき1にできる
	//そうなるのはy軸方向の移動がfloor(s)であることが必要
	int t=s;
	printf("%.9f",max(s*sqrt(2),sqrt(s*s-t*t)<1?t+1:0));
}



Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 
  long long L, R;
  cin >> L >> R;
  
  int solve=1e7;
  int calc;
  
  if(R-L>=2019){
    cout << 0 << endl;
    return 0;  
  }
  
  for (long long i=L; i<=R-1; i++){
    
    for(long long j=i+1; j<=R; j++){
         
      calc = (i*j)%2019;
      solve = min (solve, calc);
    
    }
  
  }
  
  cout << solve << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    string s;cin>>s;
    string t="AKIHABARA";
    if(s.size()>t.size())return cout<<"NO" , 0;
    for(ll i=0;i<(ll)t.size();i++){
        if(s.size()<i+1){
            if(t[i]=='A')continue;
            cout<<"NO";
            return 0;
        }

        if(s[i]==t[i])continue;
        if(t[i]!='A')return cout<<"NO" , 0;

        s = s.substr(0,i) + "A" + s.substr(i);
    }
    cout<<"YES";
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static long gcd(long n, long m){
        if(m < n){
            return gcd(m,n);
        }
        if(n==0){
            return m;
        }
        return gcd(n, m%n);
    }
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        long A = scanner.nextLong();
        long B = scanner.nextLong();
        long C = scanner.nextLong();
        long D = scanner.nextLong();

        long lcmCD = C * D / gcd(C,D);

        long divC = Math.floorDiv(B, C) - Math.floorDiv(A-1, C);
        long divD = Math.floorDiv(B, D) - Math.floorDiv(A-1, D);
        long divCD = Math.floorDiv(B, lcmCD) - Math.floorDiv(A-1, lcmCD);
        long undiv = B - A + 1 - divC - divD + divCD;

        System.out.println(undiv);
    }
}

Measured memory_bytes: 23764
/*
                                             ::                     ::
                                             ':                     :
                                              :.                    :
                                           ;' ::                   ::  '
                                          .'  ';                   ;'  '.
                                         ::    :;                 ;:    ::
                                         ;      :;.             ,;:     ::
                                         :;      :;:           ,;"      ::
                                         ::.      ':;  ..,.;  ;:'     ,.;:
                                          "'"...   '::,::::: ;:   .;.;""'
                                              '"""....;:::::;,;.;"""
                                          .:::.....'"':::::::'",...;::::;.
                                         ;:' '""'"";.,;:::::;.'""""""  ':;
                                        ::'         ;::;:::;::..         :;
                                       ::         ,;:::::::::::;:..       ::
                                       ;'     ,;;:;::::::::::::::;";..    ':.
                                      ::     ;:"  ::::::"""'::::::  ":     ::
                                       :.    ::   ::::::;  :::::::   :     ;
                                        ;    ::   :::::::  :::::::   :    ;
                                         '   ::   ::::::....:::::'  ,:   '
                                          '  ::    :::::::::::::"   ::
                                             ::     ':::::::::"'    ::
                                             ':       """""""'      ::
                                              ::                   ;:
                                              ':;                 ;:"


                                                     P_r_A_d_Y
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define mod 1000000007
#define inf 1e18
const int N = 300005;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
void cs(int &x)
{
  cout << "Case #" << x << ": ";
}
bool cmp(int a, int b)
{
  return a > b;
}
int32_t main()
{
  fastIO;
  // int t;cin>>t;
  // int x=1;
  // while(t--)
  // {
  int n,k; cin >> n >> k;
  vector<int>v(n);
  for (int i = 0; i < n; i++)
    cin >> v[i];
  int l = 1, h = *max_element(v.begin(), v.end());
  while (l < h)
  {
    int mid = l + (h - l) / 2;
    int p = 0;
    for (auto i : v)
      p += (i - 1) / mid;

    if (p <= k)
      h = mid;
    else
      l = mid + 1;
  }

  cout << l << endl;




  //}
  return 0;
}

Measured memory_bytes: 4712
fun main() = Thread(null, ::abc171c, "(^o^)", 128 * 1024 * 1024).apply { start() }.join()

@OptIn(ExperimentalStdlibApi::class)
fun abc171c() {
    val n = readLine()!!.toLong()

    var length = 1
    var p = 26L
    var indexOfN = n
    var before = 0L
    while (p < indexOfN) {
        indexOfN -= p
        before += p
        p *= 26
        length++
    }

    val answer = StringBuilder()
    var currN = indexOfN - 1

    repeat(length) {
        val rem = currN % 26
        answer.append(rem.toChar() + 'a'.toInt())
        currN /= 26
    }

    println(answer.reversed())
}


Measured memory_bytes: 35888
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  
  for (int i = 0; i < n-1; i++) {
	for(int j = i+1; j < n; j++) {
    	if(vec[i] < vec[j]){
        	int tmp = vec[i];
          	vec[i] = vec[j];
          	vec[j] = tmp;
        }
    }
  }
    
  int a = 0;
  int b = 0;
  for(int i = 0; i < n; i++){
    if(i % 2 == 0) {
      a += vec[i];
    } else {
      b += vec[i];
    }
  }
  cout << a-b << endl;
}


Measured memory_bytes: 764
#include <iostream>
const int N = 2e5 + 7;

int p[N];
int main (void) {
  int n;
  std::cin >> n;
  int minn = 2e5 + 1, cnt = 0;
  for (int i = 1; i <= n; ++i) {
    std::cin >> p[i];
    if (p[i] < minn)
      ++cnt, minn = p[i];
  }
  std::cout << cnt;
  return 0;
}

Measured memory_bytes: 1024
/*-------------------------------*
| Name: Ayush Kumar              |
| Site: CSES                     |
| Email: ayushkr667@gmail.com    |
*-------------------------------*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define INF (ll) 1e18
const double PI = 3.141592653589793238460;
vector<int> arr[100001];
int max_edge[100001];
int dfs(int node)
{
    if(max_edge[node] != -1)
    {
        return max_edge[node];
    }

    int temp = 0;
    vector<int>:: iterator it;
    for(it = arr[node].begin(); it!=arr[node].end(); it++)
    {
        temp = max(temp, dfs(*it));
    }

    max_edge[node] = 1 + temp;
    return max_edge[node];
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, m;   cin>>n>>m;
    while (m--)
    {
        int a, b;   cin>>a>>b;    arr[a].pb(b);
    }
    memset(max_edge, -1, sizeof(max_edge));

    int vertices  = 0;

    for (int i = 1; i <= n; i++)
    {
        vertices = max(vertices, dfs(i));
    }
    cout<<vertices-1;
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    int ans = 0;
    vector<int> a(3); 
    rep(i, n){
        if (s[i][0] == 'B' && s[i][s[i].size() - 1] == 'A') a[0]++;
        else if (s[i][0] == 'B') a[1]++;
        else if (s[i][s[i].size() - 1] == 'A') a[2]++;
        rep(j, s[i].size() - 1){
            if (s[i][j] == 'A' && s[i][j + 1] == 'B')
                ans++;
        }
    }
    if (a[0]) ans += a[0] - 1;
    if (a[0] && a[1]) ans++;
    if (a[0] && a[2]) ans++;
    if (a[0] && a[1] && a[2]) ans += min(a[1], a[2]) - 1;
    else if (a[1] && a[2]) ans += min(a[1], a[2]);
    cout << ans << endl;
}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		double r = sc.nextDouble();
		double p = 3.14159265359;

		System.out.println(String.format("%.6f", r * r * p) + " " + String.format("%.6f", 2 * r * p));

	}

}



Measured memory_bytes: 28256
#include <iostream>
#include <vector>
#include <utility>
#include <numeric>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <deque>
#include <queue>
#include <map>
#include <chrono>

using namespace std;
using ll = long long;


int main() {
	ll N, M;
	cin >> N >> M;
	ll g = M / N;
	if (g * g > M) {
		ll s = M / g + 1;
		if (M % g == 0) {
			--s;
		}
		for (ll i = s; i <= M / 2; ++i) {
			if (M % i == 0) {
				cout << M / i << endl;
				return 0;
			}
		}
		cout << 1 << endl;
	}
	else {
		for (ll i = g; i != 0; --i) {
			if (M % i == 0) {
				cout << i << endl;
				return 0;
			}
		}
	}

}


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

int main()
{

    int n;
    cin>>n;
    int h[n];
    int ans[n];
    for(int i=0; i<n; i++)
    {      
        cin>>h[i];
    }
    ans[0]=0;
    ans[1]=abs(h[0]-h[1]);
    for(int i=2; i<n; i++)
    {
        ans[i]=min(ans[i-1]+abs(h[i]-h[i-1]),ans[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<ans[n-1];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n,m;
vi a,b,c;
vvi g;

void dfs(int v,vi& d){
	b[v]++;
	d.push_back(a[v]);
	for(auto i:g[v]) if(!b[i]) dfs(i,d);
}

int main(){
	cin>>n>>m;
	a=b=vi(n);
	g=vvi(n);
	ll res=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		res+=a[i];
	}
	for(int i=0;i<m;i++){
		int s,t;
		cin>>s>>t;
		g[s].push_back(t);
		g[t].push_back(s);
	}
	int t=-1;
	for(int i=0;i<n;i++) if(!b[i]){
		t++;
		vi d;
		dfs(i,d);
		sort(d.begin(),d.end());
		for(int j=1;j<d.size();j++) c.push_back(d[j]);
	}
	if(!t){
		cout<<0<<endl;
		return 0;
	}
	t=n-2*t;
	if(t<0) cout<<"Impossible"<<endl;
	else{
		sort(c.rbegin(),c.rend());
		for(int i=0;i<t;i++) res-=c[i];
		cout<<res<<endl;
	}
}

Measured memory_bytes: 7676
#include<iostream>
using namespace std;
int main() {
	int i;
	char a[4];
	cin >> a;
	if (((a[0] == a[1]) && (a[1] == a[2])) || ((a[2] == a[1]) && (a[3] == a[2]))) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256