akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

void rec(vector<vector<int>>&e,vector<bool>&vis,vector<bool>&co,int&w,int&b,int i,bool c,bool&F,bool f=true){
    if(vis[i]){
        if(f&&co[i]!=c) F=true;
        return;
    }
    vis[i]=true;
    co[i]=c;
    if(c) ++w;
    else ++b;
    for(auto&j:e[i]) rec(e,vis,co,w,b,j,!c,F);
}

class EIndependence {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int n,m,a,b,w;
        in>>n>>m;
        vector<vector<bool>> v(n,vector<bool>(n,true));
        fr(i,m){
            in>>a>>b;
            --a,--b;
            v[a][b]=false;
            v[b][a]=false;
        }
        fr(i,n) v[i][i]=false;
        vector<vector<int>> e(n);
        vector<bool> vis(n),co(n);
        fr(i,n) fr(j,n) if(i!=j&&v[i][j]) e[i].emplace_back(j);
        bool F=false;
        vector<int> v2;
        fr(i,n){
            rec(e,vis,co,w=0,b=0,i,false,F,false);
            if(F){
                out<<-1<<endl;
                return;
            }
            if(b!=w) v2.emplace_back(abs(b-w));
        }
        vector<vector<bool>> vb(v2.size()+1,vector<bool>(2*n+1));
        vb[0][n]=true;
        fr(i,v2.size()) fr(j,2*n+1) if(vb[i][j]) vb[i+1][j+v2[i]]=vb[i+1][j-v2[i]]=true;
        int an=INT_MAX;
        fr(j,2*n+1) if(vb[v2.size()][j]) an=min(an,abs(j-n));
        int a1=(an+n)/2,a2=(n-an)/2;
        out<<a1*(a1-1)/2+a2*(a2-1)/2<<endl;
    }
};

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


Measured memory_bytes: 3328
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func popCount(X []byte) int {
	cnt := 0
	for _, v := range X {
		if v == '1' {
			cnt++
		}
	}
	return cnt
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	N := getInt()
	X := []byte(getString())

	popcount := popCount(X)
	popcount1 := popcount - 1
	popcount0 := popcount + 1

	mod1 := 0
	mod0 := 0
	for i := 0; i < N; i++ {
		if popcount1 != 0 {
			mod1 = mod1*2 + int(X[i]-'0')
			mod1 %= popcount1
		}
		mod0 = mod0*2 + int(X[i]-'0')
		mod0 %= popcount0
	}

	f := make([]int, 220000)
	popcnt := make([]int, 220000)
	onePow2 := make([]int, 220000)
	zeroPow2 := make([]int, 220000)
	f[0] = 0
	onePow2[0] = 1
	zeroPow2[0] = 1
	for i := 1; i < 220000; i++ {
		popcnt[i] = popcnt[i/2] + i%2
		f[i] = f[i%popcnt[i]] + 1

		onePow2[i] = 1
		zeroPow2[i] = 1
		if popcount1 != 0 {
			onePow2[i] = onePow2[i-1] * 2 % popcount1
		}
		zeroPow2[i] = zeroPow2[i-1] * 2 % popcount0
	}

	for i := N - 1; i >= 0; i-- {
		if X[N-1-i] == '1' {
			if popcount1 != 0 {
				next := mod1
				next -= onePow2[i]
				next %= popcount1
				if next < 0 {
					next += popcount1
				}
				out(f[next] + 1)
			} else {
				out(0)
			}
		} else {
			next := mod0
			next += zeroPow2[i]
			next %= popcount0
			out(f[next] + 1)
		}
	}
}


Measured memory_bytes: 11012
import java.util.Scanner;

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

    int n = sc.nextInt();

    if (n / 100 == 7 || n % 10 == 7 || (n / 10) % 10 == 7) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }
}


Measured memory_bytes: 27068
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<int> A(N);

    int i;
    for(i=0;i<N;i++){
        cin >> A.at(i);
    }

    int size = A.at(0);
    int64_t ans = 0;

    for(i=1;i<N;i++){
        if(size > A.at(i)){
            ans += size - A.at(i);
        }else{
            size = A.at(i);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 4020
a=int(input())
s=list(map(int,input().split()))
count=0
good=0
for i in s:
    if i%2==0:
        count+=1
        if i%3==0 or i%5==0:
            good+=1
if good==count:
    print('APPROVED')
else:
    print('DENIED') 



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

double mydist(vector<double> A, vector<int> B){
    return sqrt(pow(A[0] - B[0], 2) + pow(A[1] - B[1], 2));
}

vector<vector<double>> func(vector<int> A, vector<int>B, double M){
    vector<vector<double>> ret(2, vector<double>(2));

    vector<double> AB(2);
    AB[0] = (B[0] - A[0]) / 2.0;
    AB[1] = (B[1] - A[1]) / 2.0;
    double ABD = sqrt(pow(AB[0], 2) + pow(AB[1], 2));

    if(ABD > M){
        ret[0][0] = -9999;
        return ret;
    }

    vector<double> ABX(2);
    ABX[0] = AB[1];
    ABX[1] = -AB[0];
    double ABXD = sqrt(pow(ABX[0], 2) + pow(ABX[1], 2));

    double D = sqrt(M * M - ABD * ABD);

    ret[0][0] = (double)A[0] + AB[0] + D * ABX[0] / ABXD;
    ret[0][1] = (double)A[1] + AB[1] + D * ABX[1] / ABXD;

    ret[0][0] = (double)A[0] + AB[0] - D * ABX[0] / ABXD;
    ret[0][1] = (double)A[1] + AB[1] - D * ABX[1] / ABXD;

    return ret;
}

int main(){
    int N;
    cin >> N;
    
    vector<vector<int>> co(N, vector<int>(2));
    rep(i, N){
        cin >> co[i][0] >> co[i][1];
    }

    double L = 0;
    double R = 708;
    while(R - L > 0.0000000001){
        double M = (L + R) / 2;
        // cout << M << endl;
        bool ok = false;
        for(int i = 0;i < N - 1;i++){
            for(int j = i + 1;j < N;j++){
                vector<vector<double>> cen(2);
                cen = func(co[i], co[j], M);
                bool allin[2] = {true, true};
                if(cen[0][0] == -9999){
                    allin[0] = false;
                    allin[1] = false;
                }

                for(int k = 0;k < N;k++){
                    if(k == i || k == j) continue;
                    if(allin[0] && mydist(cen[0], co[k]) > M){
                        allin[0] = false;
                    }
                    if(allin[1] && mydist(cen[1], co[k]) > M){
                        allin[1] = false;
                    }
                    if(!allin[0] && !allin[1]){
                        break;
                    }
                }
                if(allin[0] || allin[1]){
                    // cout << cen[0][0] << ", " << cen[0][1] << endl;
                    // cout << cen[1][0] << ", " << cen[1][1] << endl;
                    ok = true;
                    break;
                }
            }
            if(ok) break;
        }
        if(ok){
            R = M;
        }else{
            L = M;
        }
    }
    std::cout<<std::fixed<<std::setprecision(10);
    cout << (L + R) / 2 << endl;

    // cout << L << ", " << R << endl;



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;


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

    vector<int> v(n);
    rep(i, n) cin >> v[i];
    sort(rall(v));

    ll ans = v[0];

    int p = 1;
    int cnt = 0;
    rep(i, n-2){
        ans += v[p];
        cnt++;
        if(cnt == 2){
            cnt = 0;
            p++;
        }
    }

    cout << ans << endl;
}

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

int main(){
    int ans = 0;
    int n, k;
    cin >> n >> k;
    
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }
    sort(vec.begin(),vec.end());
    for (int i = 0; i < k; i++) {
        ans += vec.at(i);
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
H, W, N, *L = map(int, open(0).read().split())
dic = {}
for a, b in zip(*[iter(L)]*2):
  for i in range(a-2,a+1):
    for j in range(b-2,b+1):
      if 0<i and i+2<=H and 0<j and j+2<=W:
        dic[i*W+j] = dic.get(i*W+j,0)+1
ans = [0]*10
ans[0] = (W-2)*(H-2)
for k in dic.keys():
  ans[dic[k]] += 1
  ans[0] -= 1
print('\n'.join(map(str,ans)))

Measured memory_bytes: 115468
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<stdio.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define scanl(a) scanf("%lld",&a)
#define scanii(a,b) scanf("%d%d",&a,&b)
#define scaniii(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scanll(a,b) scanf("%lld%lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define scani(a) scanf("%d",&a)
#define clr(a) memset(a,0,sizeof(a))
#define clr_(a) memset(a,-1,sizeof(a))
#define pb(a) push_back(a)
#define pii pair<int,int>
#define sqr(a) a*a
#define eps 1e-9
#define inf INT_MAX
#define pi acos(-1.0)
#define ff first
#define ss second
#define INF (ll)1e18
#define m_p make_pair
#define vsort(v) sort(v.begin(),v.end())
#define all(v) v.begin(),v.end()
#define UNIQUE(X) sort(all(X)) X.resize( unique( all(X)) - X.begin() )
int fx[]={0,0,-1,1,-1,1,1,-1};
int fy[]={1,-1,0,0,1,1,-1,-1};
ll lcm(ll a,ll b){return (a/__gcd(a,b))*b;}
ll bigmod(ll a,ll p,ll mod){ll ans=1;while(p){if(p&1)ans=ans*a%mod;a=a*a%mod;p>>=1;}return ans;}
ll power(ll x,ll n){if(n==0)return 1;else if(n%2==0){ll y=power(x,n/2);return y*y;}else return x*power(x,n-1);}
struct point{double x,y;point(){}point(double xx,double yy){x=xx;y=yy;}};
inline double Distance(point  a,point b){return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}
#ifdef shaft
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " is " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cerr.write(names, comma - names) << " is " << arg1 <<endl;
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
const int N=(int)1e6;
const ll mod=(ll)1e9+7;
int main()
{
    //ios_base::sync_with_stdio(0);cin.tie(0);
    #ifdef shaft
        //freopen("in.txt","r",stdin);
        ///freopen("out.txt","w",stdout);
    #endif ///shaft
    int n ;
    scani(n);
    ll x = 2 , y = 1;
    for(int i = 2 ; i <= n ; i++){
        ll temp = x + y;
        x = y;
        y = temp;
    }
    printf("%lld\n",y);
    return 0;
}



Measured memory_bytes: 256
def main():
    num, t = map(int, input().split())
    data = list(map(int, input().split()))

    ans = 1
    min_data = data[0]
    max_sa = 0

    for i in range(1, num):
        now_sa = data[i] - min_data
        if now_sa > max_sa:
           ans = 1
           max_sa = now_sa
        elif now_sa == max_sa:
            ans += 1
        min_data = min(min_data, data[i])

    print(ans)




if __name__ == '__main__':
    main()


Measured memory_bytes: 62960
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    i32 A, B, H, M;
    cin >> A >> B >> H >> M;
    f64 deg = abs(H * 30 + (M / 2.0) - M * 6);
    f64 rad = PI * deg / 180.0;
    cout << sqrt(A * A + B * B - 2 * A * B * cos(rad)) << endl;
}


Measured memory_bytes: 4220
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    set<char> s;
    int n   ;cin >> n;
    char c;
    for (int i = 0; i < n; i++) {
        cin >> c;
        s.insert(c);
    }

    if (s.size() == 3)
        cout << "Three" << endl;
    else 
        cout << "Four" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
const int P=2e5;
const int Q=2e5+2;
#define FOR(i,a,b) for (i = (a); i < (b); i++)
#define ROF(i,a,b) for (i = (a); i > (b); i--)
int k,x;
using namespace std;
int main()
{
    cin>>k>>x;
    if(k*500<x) cout<<"No";
    else cout<<"Yes";
    return 0;
}


Measured memory_bytes: 256
"use strict";
const main = arg => {
  arg = arg.split('\n')[0].split('');
  let output = '';
  arg.forEach((t) => {
    if( t==0 || t==1 ){
    	output += t;
    } else {
    	output = output.slice(0,-1);
    }
  });
  console.log(output);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
#include<bits/stdc++.h>
#define ll          long long
using namespace std;
string s[1005];
int vis[1005][1005];
int n,m;
int fx[]={1,-1,0,0};
int fy[]={0,0,-1,1};
int chk(int x,int y){
	if(vis[x][y])return 0;
	if(x<0||y<0||x>n-1||y>m-1)return 0;
	if(s[x][y]=='#')return 0;
	return 1;	
}
void bfs(){
	queue<pair<int,int>> q;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(s[i][j]=='#'){
				q.push({i,j});
				vis[i][j]=1;
			}
		}
	}
	while(!q.empty()){
		pair<int,int> p=q.front();
		q.pop();
		int x=p.first,y=p.second;
		for(int i=0;i<4;i++){
			if(chk(fx[i]+x,fy[i]+y)){
				q.push({fx[i]+x,fy[i]+y});
				vis[fx[i]+x][fy[i]+y]=vis[x][y]+1;
			}
		}
	}
}
int main(){
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>s[i];
	bfs();
	int mx=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			mx=max(mx,vis[i][j]);
		}
	}
	cout<<mx-1<<endl;
}

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

typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;

const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);

#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define ull unsigned long long
#define deb(x )     cerr << #x << " = "<< x << endl;
#define endl    "\n"
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(y))
#define all(x) (x).begin(), (x).end()
#define bitcount(x) __builtin_popcount(x)
#define cps CLOCKS_PER_SEC
#define verify(x) if(x >= MOD) x -= MOD;

inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void print_case(int tn) {cout<<"Case #"<<tn<<": ";}

template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;

template<typename T>
using maxpq = priority_queue<T>;
/*----------------------------------------------------------------------*/

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    string s; cin>>s;
    cout<<s.substr(0, 3);

    return 0;
}

Measured memory_bytes: 3628
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

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

	int N, D, A;
	cin >> N >> D >> A;

	vector<pair<int, int>> XH(N);
	for (int i = 0; i < N; i++) cin >> XH[i].first >> XH[i].second;
	sort(XH.begin(), XH.end());

	for (int i = 0; i < N; i++) {
		XH[i].second = (XH[i].second + A - 1) / A;
	}

	queue<pair<lint, lint>> que;
	lint ans = 0;
	lint now = 0;
	for (int i = 0; i < N; i++) {

		while (!que.empty() && que.front().first < XH[i].first) {
			now -= que.front().second;
			que.pop();
		}

		lint sub = XH[i].second - now;
		if (sub > 0) {
			ans += sub;
			now = XH[i].second;
			que.emplace(XH[i].first + 2 * D, sub);
		}

		DMP(ans, now);

	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 3456
#coding:utf-8
N = int(input())
S = input()
lb = 0
lw = 0
rb = S.count("#")
rw = S.count(".")
ans = lb + rw
for i in range(N):
    if S[i] == "#":
        lb += 1
        rb -= 1
    else:
        lw += 1
        rw -= 1
    ans = min(ans,lb+rw)
print (ans)


Measured memory_bytes: 3500
def insertionSort(a, n):
    trace(a, n)
    for i in range(1, n):
        v = a[i]
        j = i - 1
        while j >= 0 and a[j] > v:
            a[j+1] = a[j]
            j -= 1
        a[j+1] = v
        trace(a, n)


def trace(a, n):
    output = ''
    for i in a:
        if i == a[n-1]:
            output += str(i)
        else:
            output += str(i) + ' '
    print(output)

n = int(input())
a = list(map(int, input().split()))
insertionSort(a, n)


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

typedef long long int lli;
#define pb push_back
#define gcd __gcd
#define MOD 1000000007
#define mod2 998244353
#define forz(i,n) for(long long int i=0;i<n;i++)
char A[51][51];
set<pair<lli,lli>> s1,s2;
set<pair<lli,lli>>::iterator i1,i2;

lli mod(lli a){
    if(a<0) return -1*a;
    return a;
}

bool comp(pair<lli,lli> a,pair<lli,lli> b){
    return 0;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli t=1,u,j;
    //cin>>t;
    for(u=1;u<=t;u++){
        lli n,m,i,j,p=0,c,q=0,k,a,b,x,y,ne=0,p1=0,p2=0,p3=0,p4=0,q1=0;
        cin>>n;
        string A[n];
        for(i=0;i<n;i++){
            cin>>A[i];
            if(A[i]=="AC") p1++;
            if(A[i]=="WA") p2++;
            if(A[i]=="TLE") p3++;
            if(A[i]=="RE") p4++;
        }
        cout<<"AC x "<<p1<<endl;
        cout<<"WA x "<<p2<<endl;
        cout<<"TLE x "<<p3<<endl;
        cout<<"RE x "<<p4<<endl;
    }
}

Measured memory_bytes: 6780
#include<bits/stdc++.h>
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int unsigned long long
#define MAX 200000
#define endl "\n"
using namespace std;

int32_t main() {
  ios;
  int t = 1;
  // cin>>t;
  while(t--) {
    vector<int> primes;
    bool prime[MAX+1];
    memset(prime,true,sizeof(prime));
    prime[0] = prime[1] = false;
    for(int i = 2;i*i <= MAX;i++) {
      if(prime[i]) {
        for(int j = i*i;j <= MAX;j+=i)
          prime[j] = false;
      }
    }
    for(int i = 0;i <= MAX;i++)
      if(prime[i])
        primes.push_back(i);
    int x;
    cin>>x;
    auto ptr = lower_bound(primes.begin(),primes.end(),x);
    cout<<*ptr;
    cout<<endl;
  }
  return 0;
}

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

int main() {
int N, X; cin >> N >> X;
vector<int> D(N + 1);
D[0] = 0;
for (int i = 0; i < N; ++i) {
int x; cin >> x;
D[i + 1] = D[i] + x;
}
int ans = 0;
for (int i = 0; i <= N; ++i) {
 if (D[i] <= X) {
ans++;}
}
cout << ans << endl;
return 0;
 }

Measured memory_bytes: 256
/**
        Bismilla- hir rahma-nir rahi-m
    @uthor Md Hasibur Rahman (Evan)
                JKKNIU
*/


#include<bits/stdc++.h>
#define         ll              long long
#define         FI              freopen("input.txt","r",stdin)
#define         FO              freopen("output.txt","w",stdout)
#define         PrintCase(i)    printf("Case %d: ",i)
#define         sc(a)           scanf("%d",&a)
#define         scl(a)          scanf("%lld",&a)
#define         rep(i,n)        for(int i=0;i<n;i++)
#define         pb              push_back
#define         MAX             1000000
#define         fast            ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define			endl			"\n"


using namespace std;

bool isPrime(ll a)
{
    for(ll i=2;i*i<=a;i++)
        if(a%i==0)
            return false;
    return true;
}






bool isPowerOfTwo(ll a)
{
    if(a==1)
        return true;
    if(a&1)
        return false;
    while(a)
    {
        a/=2;
        if(a!=1 && a&1)
            return false;
        if(a==1)
            return true;
    }
    return true;
}




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



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



ll power(ll base, ll exponent)
{
    ll ans = 1;
    for(ll i=1;i<=exponent;i++)
        ans*=base;
    return ans;
}




bool isPowerOfX(ll x, ll value)
{
    if(value==1)
        return true;
    while(value)
    {
        value/=x;
        if(value%x && value!=1)
            return false;
    }
    return true;
}





int main()
{
    fast;
    ll n,x,t;
    cin>>n>>x>>t;
    ll ans = t;
    ans*=(n/x);
    n%x==0?cout<<ans<<endl : cout<<ans+t <<endl; 
    return 0;
}


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

void bubbleSort(int a[], int n){
    int count = 0;
    for(int i = 0; i < n; i++){
        int j = n - 1;
            while(j>0){
                if(a[j] < a[j-1]){
                    int tmp = a[j];
                    a[j] = a[j-1];
                    a[j-1] = tmp;
                    count ++;
                }
                j--;
            }
    }
    for (int i = 0; i<n; i++) {
        if (i>0) cout << ' ';
        cout << a[i];
    }
    cout << endl;
    cout << count << endl;
}

int main(){
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i<n; i++) cin >> a[i];
    bubbleSort(a,n);
    return 0;
}


Measured memory_bytes: 3116
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
using namespace std;
#define ul unsigned long long

#define rup(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define rdn(i, a, b) for(int (i) = (a); (i) > (b); (i)--)

int main() {
	int a, b;
	cin >> a >> b;
	int sum = a + b;
	if (a % 3 == 0 || b%3==0||sum%3==0) {
		cout << "Possible";

	}
	else {
		cout << "Impossible";
	}

	return 0;
}





Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int n;
  cin>>n;
  vector<long long int> a(n);
  for(long long int i=0; i<n; i++){
    cin>>a.at(i);
  }
  long long int ans=0;
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());

  ans+=a.at(0);
  long long int count=1;
  bool flag=false;
  for(long long int i=1; i<n-1; i++){
    if(flag){
      ans+=a.at(count);
      flag=false;
      count++;
    }else{
      ans+=a.at(count);
      flag=true;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4844
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let a: i32 = sc.read();
    let b: i32 = sc.read();

    let ret: i32 = *vec![1,2,3].iter().find(|&&x| x != a && x != b).unwrap();
    println!("{}", ret);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);
impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
from collections import deque

K = int(input())
queue = deque([n for n in range(1, 10)])

res = None
cnt = 0
while True:
    x = queue.popleft()
    cnt += 1
    if cnt == K:
        res = x
        break
    xmod10 = x % 10
    if xmod10 != 0:
        queue.append(10*x+(xmod10-1))
    queue.append(10*x+xmod10)
    if xmod10 != 9:
        queue.append(10*x+(xmod10+1))

print(res)


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

using namespace std;
using ll = long long;

const int maxn = 1e5+10;
const int INF = 1e9+10;

vector<int> g[maxn];
int p[maxn][3];

void bfs(int x){
	queue<pair<int,int>> q;
	q.push({x,0});
	p[x][0] = 0;
	while(!q.empty()){
		int nxt = q.front().first;
		int moves = q.front().second;
		q.pop();
		for(int i=0;i<g[nxt].size();++i){
			int v = g[nxt][i];
			if(p[nxt][moves]+1 < p[v][(moves+1)%3]){
				p[v][(moves+1)%3] = p[nxt][moves]+1;
				q.push({v,(moves+1)%3});
			}
		}
	}
}

void init(){
	for(int i=0;i<maxn;++i)
		for(int j=0;j<3;++j)
			p[i][j] = INF;
}

void solve(){
	int n,m,s,t;
	init();
	cin >> n >> m;
	for(int i=1;i<=m;++i){
		int u,v;
		cin >> u >> v;
		g[u].push_back(v);
	}
	cin >> s >> t;
	bfs(s);
	if(p[t][0] == INF){
		cout << -1 << '\n';
	}
	else{
		cout << p[t][0]/3 << '\n';
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	//cin >> t;
	while(t--){ 
		solve();
	}
	return 0;
}

Measured memory_bytes: 7168
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cctype>
#include <bits/stdc++.h>
#include <queue>

using namespace std;
// for loop
#define F(i, L, R) for(long i = L; i < R; i++)
#define FE(i, L, R) for(long i = L; i <= R; i++)
// for (reversed)
#define FR(i, L, R) for(long i = L; i > R; i--)
#define FRE(i, L, R) for(long i = L; i >= R; i--)

// data types
#define Int long
#define ul unsigned long
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned shoft

// vectors
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> ii;
#define ALL(c) (c).begin(),(c).end()
#define last(vec) vec.size()-1
#define lastEle(vec) vec[last(vec)]
#define pb push_back
#define InputV(a, n) F(i,0,n){long l; cin >> l; a.pb(l);}

// debug
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a, L, R) FE(i, L, R) cout << a[i] << (i==R?'\n':' ')
#define printAF(a, L) printA(a, 0, L-1)
#define printV(a) printA(a, 0, a.size()-1)

// utils
#define char2int(c) (c-'0')
#define bit(x, i) (x&(1<<i))
#define space ' '
#define PI 3.14159265358979323


#define TST 0

int main() {
#if TST==1
    ifstream in ("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int x;
    cin >> x;
    if(x >= 30){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

#if TST==1

#endif
}



Measured memory_bytes: 3600
lines = readlines(chomp: true).map{|line| line.split(' ').map(&:to_i)}

k = lines[0][0]
a = lines[1][0]
b = lines[1][1]

answer = "NG"

for i in a..b do
  if i % k == 0 then
    answer = "OK"
    break
  end
end

  print answer

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

using namespace std;

typedef long long ll;

const int maxn = 50, inf = 1e9 + 100;

int a[26];

int main(){
    #ifdef ONPC
    ifstream cin("a.in");
    ofstream cout("a.out");
    #else
    //ifstream cin("a.in");
    //ofstream cout("a.out");
    #endif // ONPC
    ios::sync_with_stdio(0);
    int n;
    for (int i = 0; i < 26; i++)
        a[i] = inf;
    cin >> n;
    for (int i = 0; i < n; i++){
        string s;
        cin >> s;
        int b[26];
        memset(b, 0, sizeof(b));
        for (int j = 0; j < s.length(); j++)
            b[s[j] - 'a']++;
        for (int j = 0; j < 26; j++)
            a[j] = min(a[j], b[j]);
    }
    for (int i = 0; i < 26; i++)
        for (int j = 0; j < a[i]; j++)
            cout << (char)(i + 'a');
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define ll long long
#define ld long double
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)

#define xx first
#define yy second
#define mp make_pair
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define pdd pair<double,double>
#define ALL(v) (v).begin(), (v).end()

const ll MOD=1e9+7; ;
const ll inf=1e18;

#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;
#define put(x) cout<<#x<<" = "<<x<<endl;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

ll power(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a);
        n>>=1;
        a=(a*a);
    }
    return ans;
}


ll powerMod(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%MOD;
        n/=2;
        a=(a*a)%MOD;
    }
    return ans;
}

ll powerMod1(ll a,ll n,ll mod){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%mod;
        n>>=1;
        a=(a*a)%mod;
    }
    return ans;
}

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

ll sumdigit(ll n){
    ll sum=0;
    while(n){
        sum+=n%10;
        n=n/10;
    }
    return sum;
}

ll countSetBit(ll a){
    return __builtin_popcount(a);
}
ll countBit(ll a){
    ll sum=0;
    while(a){
        sum++;
        a>>=1;
    }
    return sum;
}

ll length(ll a){
    ll ans=0;
    while(a){
        ans++;
        a=a/10;
    }
    return ans;
}

bool isVowel(char c){
	if(c=='a' or c=='e' or c=='i' or c=='o' or c=='u')
		return true;
	return false;
}

int main()
{
    fast;
    ll t;
    //cin>>t;
    t=1;
    while(t--){
          ll n,k;
          cin>>n>>k;
          ll a[n];
          ld e[n];
          for(int i=0;i<n;i++){
            cin>>a[i];
            e[i] = ((double)(a[i]*(a[i]+1))/2)/a[i];
          }
          ld cur_max=0;
          ld res=0;

          for(int i=0;i<k;i++)
            cur_max+=e[i];
          res=cur_max;
          for(int i=k;i<n;i++){
            cur_max-=e[i-k];
            cur_max+=e[i];
            res=max(res,cur_max);
          }
          cout<<fixed<<setprecision(10)<<res;
    }
    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <numeric>
#include <bitset>
#include <stack>
#include <cstring>
using namespace std;

const int INF = 1 << 30;
const double EPS = 1e-10;

vector<int> reverse(int l, int r, const vector<int>& A)
{
  vector<int> ret = A;
  for (int i = 0; i <= (r-l)/2; ++i)
    swap(ret[l+i], ret[r-i]);
  return ret;
}

void solve(const int N, const vector<int>& v, map<vector<int>, int>& dp)
{
  queue<vector<int> > que;
  que.push(v);
  dp[v] = 0;
  for (int i = 0; i < 4; ++i) {
    queue<vector<int> > next;
    while (!que.empty()) {
      const vector<int> q = que.front();
      que.pop();
      
      for (int j = 0; j < N; ++j) {
        for (int k = j+1; k < N; ++k) {
          vector<int> qq = reverse(j, k, q);
          if (dp.find(qq) == dp.end()) {
            dp[qq] = i+1;
            next.push(qq);
          }
        }
      }
    }
    swap(que, next);
  }
}

int main()
{
  int N;
  while (cin >> N) {
    vector<int> A(N);
    for (int i = 0; i < N; ++i)
      cin >> A[i];

    map<vector<int>, int> sdp, rdp;
    solve(N, A, sdp);
    sort(A.begin(), A.end());
    solve(N, A, rdp);

    int ans = N-1;
    for (map<vector<int>, int>::iterator it = sdp.begin(); it != sdp.end(); ++it) {
      if (rdp.find(it->first) != rdp.end())
        ans = min(ans, it->second+rdp[it->first]);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 97376
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;

bool ps1(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first昇順
	return forall_a_in_P.first < forall_b_in_P.first;
}
bool ps2(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first降順
	return forall_a_in_P.first > forall_b_in_P.first;
}
bool ps3(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second昇順
	return forall_a_in_P.second < forall_b_in_P.second;
}
bool ps4(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second降順
	return forall_a_in_P.second > forall_b_in_P.second;
}

int main()
{
	int h,w;
	cin>>h>>w;
	int n;
	cin>>n;
	vector<int>a(n);
	rep(i,n)cin>>a[i];
	vector<vector<int>>c(h,vector<int>(w));
	int rw=0,cl=0;
	bool right=true;
	rep(i,n){
		int len=a[i];
		while(len!=0){
			c[rw][cl]=i+1;
			if(cl==w-1&&right){
				right=false;
				rw++;
			}else if(cl==0&&!right){
				rw++;
				right=true;
			}else if(right){
				cl++;
			}else if(!right){
				cl--;
			}
			len--;
		}
	}
	rep(i,h)rep(j,w){
		cout<<c[i][j];
		if(j!=w-1){
			cout<<" ";
		}else{
			cout<<endl;
		}
	}
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
inline int_fast64_t read(){int_fast64_t x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
inline string read_s(){string s="";char c=getchar();while(c<'!'||c>'~'){c=getchar();}while(c>='!'&&c<='~'){s+=c;c=getchar();}return s;}
void Main(){
    string S = read_s(), T = read_s();
    map<char, int> MS, MT;
    int len = S.size();
    for (int i = 0; i<len; i++) {
        if (!MS[S[i]]) MS[S[i]] = i+1;
    }
    for (int i = 0; i<len; i++) {
        if (!MT[T[i]]) MT[T[i]] = i+1;
    }
    for (int i = 0; i<len; i++) {
        if (MS[S[i]] != MT[T[i]]) {
            printf("No\n");
            return;
        }
    }
    printf("Yes\n");
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << x << '\n'

typedef long long int ll;
typedef pair<int, int> P;

const long long INF = 3e18 + 12;
const int inf = 1e9;

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

  ll n;
  cin >> n;

  ll res = 0;
  rep(i, inf + 1) {
    if (n < i * i) {
      break;
    }
    res = i * i;
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int n,a[100005],l;
int main()
{
	scanf("%d%d",&n,&l);for(int i=1;i<=n;++i) scanf("%d",&a[i]);
	for(int i=1;i<n;++i) if(a[i]+a[i+1]>=l) {
		puts("Possible");
		for(int j=1;j<i;++j) printf("%d\n",j);
		for(int j=n-1;j>=i+1;--j) printf("%d\n",j);
		printf("%d",i);
		return 0;
	}
	puts("Impossible");
	return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, P> PP;

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

int n;
ll z,w;
ll a[2000];
ll ans;

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

	cin>>n>>z>>w;
	REP(i,n) cin>>a[i];

	ans=abs(a[n-1]-w);

	if(n>1) ans=max(ans,abs(a[n-1]-a[n-2]));
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>

#define ll long long
#define rep(i,n) for(int i=0; i<(n); ++i)
#define P std::pair<std::string,int>

bool compare(P x, P y){
    if(x.second == y.second)
        return x.first < y.first;
    return x.second > y.second;
}

int main(){
    int n; std::cin >> n;
    std::map<std::string, int> mp;
    rep(i,n){
        std::string s; std::cin >> s;
        ++mp[s];
    }
    std::vector<P> vec;
    for(auto m : mp)
        vec.push_back(P(m.first,m.second));
    std::sort(vec.begin(),vec.end(),compare);

    int cnt = vec[0].second;
    for(auto v : vec)
        if(cnt == v.second)
            std::cout << v.first << std::endl;

    return 0;
}

Measured memory_bytes: 29388
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(void){
  int N,C,K;
  cin>>N>>C>>K;
  vector<int> T(N);
  for(int i=0;i<N;i++){
      cin>>T[i];
  }
  sort(T.begin(),T.end());
  int waiting_last=T[0],waiting_num=1,bus=0;
  for(int i=1;i<N;i++){
      waiting_num+=1;
      if(waiting_num>C||T[i]-waiting_last>K){
          bus+=1;
          waiting_num=1;
          waiting_last=T[i];
      }
  }
  cout<<bus+(waiting_num?1:0)<<endl;
  return 0;
}


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

#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
#define CININIT cin.tie(0),ios::sync_with_stdio(false)
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

constexpr ll mod = 1e9+7;

int main(){
    CININIT;
    ll W,H;cin>>W>>H;
    vector<pii> p(H+W);
    vi pp(W),qq(H);
    rep(i,H+W){
        int a;cin>>a;
        if(i<W){
            p[i] = pii(a,0);
        }else{
            p[i] = pii(a,1);
        }
    }
    sort(ALL(p));

    ll numh = 0;
    ll numw = 0;
    ll ans = 0;
    for(int i=0;i<H+W;i++){
        if(p[i].second==0){
            ll num = H+1-numh;
            ans += num * p[i].first;
            numw++;
        }else{
            ll num = W+1-numw;
            ans += num * p[i].first;
            numh++;
        }
    }
    cout << ans << endl;
}


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

using namespace std;

#define ft first
#define sd second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define boost ios_base::sync_with_stdio(false), cin.tie(NULL)
#define inp freopen("code.in", "r+", stdin)
#define out freopen("code.out", "w+", stdout)
#define debug(os, var)                                     \
    (os) << "DBG: " << __FILE__ << "(" << __LINE__ << ") " \
         << #var << " = [" << (var) << "]" << endl

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long long int ll;

int main()
{
    boost;
    //inp;
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i < n; i++)
        ans += (ceil(n / (double)i)) - 1;
    cout << ans << endl;
}

Measured memory_bytes: 3608
#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
  long long x = 1;
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P=std::pair<long long,long long>;

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

  ll n,k;
  std::cin>>n>>k;

  std::vector<std::vector<ll>> graph(n);
  rep(i,0,n-1){
    ll a,b;
    std::cin>>a>>b;
    a--;b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  if(k%2==0){
    ll ans=MOD;
    rep(i,0,n){
      std::vector<ll> visit(n,0);
      visit[i]=1;
      ll cnt=0;
      auto dfs=[&](auto f,ll v,ll d)->void{
        if(d>k/2)cnt++;
        for(auto e:graph[v]){
          if(visit[e])continue;
          visit[e]=1;
          f(f,e,d+1);
        }
      };
      dfs(dfs,i,0);
      chmin(ans,cnt);
    }
    std::cout<<ans<<"\n";
  }else{
    ll ans=MOD;
    rep(i,0,n){
      for(auto j:graph[i]){
        ll cnt=0;
        std::vector<ll> visit(n,0);
        visit[i]=1;
        visit[j]=1;
        auto dfs=[&](auto f,ll v,ll d)->void{
          if(d>k/2)cnt++;
          for(auto e:graph[v]){
            if(visit[e])continue;
            visit[e]=1;
            f(f,e,d+1);
          }
        };
        dfs(dfs,i,0);
        dfs(dfs,j,0);
        chmin(ans,cnt);
      }
    }
    std::cout<<ans<<"\n";
  }

  return 0;
}


Measured memory_bytes: 512
import itertools
n,m,q=map(int,input().split())
a=[]
b=[]
c=[]
d=[]
for _ in range(q):
    li=list(map(int,input().split()))
    a.append(li[0])
    b.append(li[1])
    c.append(li[2])
    d.append(li[3])

#print(a,b,c,d)

h=list(itertools.combinations_with_replacement(range(1,m+1),n))
#print(h)
#print(len(h))

max_score=0
for j in range(len(h)):
    score=0
    for i in range(q):
        if h[j][b[i]-1]-h[j][a[i]-1]==c[i]:
            score+=d[i]
    max_score=max(max_score,score)

print(max_score)
    


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

int main() {
  string s;
  cin >> s;
  int n;
  cin>>n;
  vector<int> type(n);
  vector<int> zengo(n);
  vector<char> plus(n);
  
  for(int i=0; i<n; i++){
    cin >> type[i];
    if(type [i]==2) cin >> zengo[i] >> plus[i];
  }
  
  int count=0;
  vector<char> mae(0);
  vector<char> ato(0);
  
  for(int i=0; i<n; i++){
    if(type[i]==1) count++;
    else{
      if(count%2==0){
        if(zengo[i]==1) mae.push_back(plus[i]);
        else ato.push_back(plus[i]);
      }
      else{
        if(zengo[i]==1) ato.push_back(plus[i]);
        else mae.push_back(plus[i]);
      }
    }
  }
  
  int a=mae.size();
  int b=s.size();
  int c=ato.size();
  
  if(count%2==0){
    reverse(begin(mae),end(mae));
    for(int i=0; i<a; i++) cout << mae[i];
    for(int i=0; i<b; i++) cout << s[i];
    for(int i=0; i<c; i++) cout << ato[i];
    cout << endl;
  }
  else{
    reverse(begin(s),end(s));
    reverse(begin(ato),end(ato));
    for(int i=0; i<c; i++) cout << ato[i];
    for(int i=0; i<b; i++) cout << s[i];
    for(int i=0; i<a; i++) cout << mae[i];
    cout << endl;
  }
}

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

int main() {
  int a;
  cin >> a;
  double c[a];
  string b[a];
  double ans;
  for(int i = 0;i < a;i++){
    cin >> c[i];
    cin >> b[i];
    if(b[i] == "JPY"){
      ans += c[i];
    }else{
      ans += c[i]*380000;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256