akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
using namespace std;

int main(){
    int n; cin >> n;
    double x, ans = 0;
    string u;
    while(n--){
        cin >> x >> u;
        if(u == "JPY"){
            ans += x;
        }
        else {
            ans += x * 380000;
        }
    }
    cout << setprecision(15) << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <climits>
#include <map>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;

int main() {
	int N, M;

	scanf("%d %d", &N, &M)+1;

	map<ll, ll> mll;

	ll tmp1, tmp2;
	for (int i = 0; i < N; i++) {
		scanf("%lld %lld", &tmp1, &tmp2)+1;
		mll[tmp1] += tmp2;
	}

	ll count = 0;
	ll cost = 0;
	for (auto itr = mll.begin(); ; itr++) {
		auto value = itr->first;
		auto amount = itr->second;
		if (count + amount >= M) {
			cost += (M - count) * value;
			break;
		} else {
			cost += amount * value;
			count += amount;
		}
	}

	printf("%lld\n", cost);

	return 0;
}


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

int main(){
  int X,t;
  cin >> X >> t;
  cout << max(X-t,0) << endl;
  return 0;

}


Measured memory_bytes: 256
#include <stdio.h>


using namespace std;

typedef long long ll;

int gcd(int x,int y) {
        return y > 0 ? gcd(y,x % y) : x;
}
int main() {

        int a,b;
        while(~scanf("%d%d",&a,&b)) {
            printf("%d ",gcd(a,b));
            printf("%lld\n",(ll)a / gcd(a,b) * b);
        }

}

Measured memory_bytes: 1024
p[]={-1,0,1,-2,2,-2,2,-2,2,-1,0,1};
P[]={-2,-2,-2,-1,-1,0,0,1,1,2,2,2};
s[]={-1,0,1,-1,0,1,-1,0,1};
S[]={-1,-1,-1,0,0,0,1,1,1};
m[10],M[10];
int D(x,y,d,n){
int i=0,j;
for(;i<12;i++)for(j=0;j<9;j++)if(
	x+p[i]==m[d%n]+s[j]&&y+P[i]==M[d%n]+S[j]&&
	0<=x+p[i]&&x+p[i]<10&&
	0<=y+P[i]&&y+P[i]<10
){
	if(d==n-1||D(x+p[i],y+P[i],d+1,n))return 1;
	break;
}
return 0;
}
main(X,Y,n,i,x,y){for(;scanf("%d%d%d",&X,&Y,&n)>2;puts(D(X,Y,0,n)?"OK":"NA"))for(i=0;i<n;i++)scanf("%d%d",m+i,M+i);exit(0);}

Measured memory_bytes: 584
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007

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; }

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}


long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0;true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

//ここまでライブラリ
//ここから本文

long long int tpimin(vector<int> a) {
	int MIN = 1000000000;
	int number = 0;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
		number = i;
	}
	return number;
}
int main() {
	int n, q;
	cin >> n >> q;
	string s;
	cin >> s;
	vector<int> a(n+1);
	for (int i = 0; i < n-1; i++) {
		if (s.at(i) == 'A' && s.at(i + 1) == 'C') a.at(i+1)++;
		a.at(i + 2) = a.at(i+1);
	}

	for (int i = 0; i < q; i++) {
		int l, r;
		cin >> l >> r;
		cout << a.at(r - 1) - a.at(l - 1) << endl;
	}
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, ans = 0;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        ans += abs(a - b) + 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/// --- In the name of ALLAH --- ///


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


typedef long long              ll;
typedef vector<int>            vi;
typedef vector<ll>             vl;
typedef vector<vi>             vvi;
typedef vector<vl>             vvl;
typedef pair<int,int>          pii;
typedef pair<double, double>   pdd;
typedef pair<ll, ll>           pll;
typedef vector<pii>            vii;
typedef vector<pll>            vll;
typedef double                 dl;

#define endl                   '\n'
#define PB                     push_back
#define F                      first
#define S                      second
#define all(a)                 (a).begin(),(a).end()
#define rall(a)                (a).rbegin(),(a).rend()
#define sz(x)                  (ll)x.size()
#define wt                     ll t; cin>>t; while(t--)
#define input(a,n)             for(int i=0;i<n;i++) cin>>a[i];

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;


#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))
#define mod 10000007
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

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


const ll mx=1e9;



//q=51;

//ll b[q+1][q+1];


 main()
{
    optimize();
    int n,m,x,y,i,j=0;
    cin>>n>>m>>x>>y;
    int a[n+1],b[m+1];
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=1;i<=m;i++)
        cin>>b[i];
    sort(a+1,a+n+1);
    sort(b+1,b+m+1);
    if(b[1]<=a[n])
    {
        cout<<"War"<<endl;
        return 0;
    }
    else
    {
        for(i=a[n]+1;i<=b[1];i++)
        {
            if(i>x&&i<=y)
            {

                cout<<"No War"<<endl;
                return 0;
            }
        }
    }
    cout<<"War"<<endl;





    return 0;
}






























































































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

using namespace std;

int main(){

  int n;

  cin >> n;

  vector<int> team(n+1,0);
  
  for(int i = 0;i < n*(n-1)/2;++i){
    int x,y;
    int px,py;

    cin >> x >> y >> px >> py;

    if(px > py){
      team[x] += 3;
    }
    else if(px < py){
      team[y] += 3;
    }
    else if(px == py){
      team[x]++;
      team[y]++;
    }
    
  }

  
  
  int max = (n-1)*3;
  int rank = 1;
  vector<int> team_rank(n+1);
  
  for(int i = max;i >= 0;--i){
    int cnt = 0;
    for(int j = 1;j <= n;++j){
      if(team[j] == i){
	team_rank[j] = rank;
	cnt++;
      }
    }
    rank += cnt;
  }

  for(int i = 1;i <= n;++i)
    cout << team_rank[i] << endl;
  
}



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

int main(){
  int x, y;
  cin >> x >> y;
  bool f = false;
  rep(i,100) {
    rep(j,100) {
      if(i+j==x && i*2+j*4 == y) f = true;
    }
  }
  cout << (f? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3632
package main

import "fmt"

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

func main() {
	var n, m, x int
	fmt.Scan(&n, &m, &x)
	as := make([]int, m)
	for i := range as {
		fmt.Scan(&as[i])
	}

	var cost_r, cost_l int
	for _, a := range as {
		if a < x {
			cost_r++
		} else {
			cost_l++
		}
	}

	fmt.Println(min(cost_l, cost_r))
}


Measured memory_bytes: 512
#include<cstdio>

int main(){
    int a,b;
	scanf("%d%d",&a,&b);
	if(a<b){
		printf("a < b\n");
	}
	if(a>b){
		printf("a > b\n");
	}
	if(a==b){
		printf("a == b\n");
	}
}

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

int main() {
    int r,g,b;
    cin >> r >> g >> b;
    if((g*10+b)%4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

using namespace std;

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

	vector<long long> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}

	long long Xor = 0;
	for(int i = 2; i < n; ++i) {
		Xor ^= a[i];
	}

	long long S = a[0] + a[1];
	long long x = 0;
	long long y = 0;
	long long must = 0;

	for(int i = 62; i >= 0; --i) {
		if(Xor >> i & 1) {
			must += 1LL << i;
		}
	}

	for(int i = 60; i >= 0; --i) {
		if(!(Xor >> i & 1)) {
			if(x + y + 2LL * (1LL << i) + must <= S) {
				x += 1LL << i;
				y += 1LL << i;
			}
		}
	}

	for(int i = 62; i >= 0; --i) {
		if(Xor >> i & 1) {
			if(x + (1LL << i) <= a[0]) {
				x += 1LL << i;
			} else {
				y += 1LL << i;
			}
		}
	}

	if(x <= 0 || y <= 0 || x + y != S || (x ^ y) != Xor || x > a[0]) {
		cout << -1 << '\n';
	} else {
		cout << a[0] - x << '\n';
	}

	return 0;
}

Measured memory_bytes: 3632
import math
a, b, c, d=map(int, input().split())
#aとbの間の cの倍数の数
if a%c==0:
  abc=b//c-a//c+1
else:
  abc=b//c-a//c  
  
#aとbの間の dの倍数の数
if a%d==0:
  abd=b//d-a//d+1
else:
  abd=b//d-a//d
#aとbの間の cdの倍数の数
e=(c*d)//math.gcd(c, d)
if a%e==0:
  abcd=b//e-a//e+1
else:
  abcd=b//e-a//e

print(b-a+1-(abc+abd-abcd))


Measured memory_bytes: 61756
using System;
using System.IO;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

partial class Solver
{
    public void Run()
    {
        var S = nl();
        var C = nl();

        var SwithS = Math.Min(S, C / 2);

        S -= SwithS;
        C -= SwithS * 2;

        var SwithoutS = C / 4;

        cout.WriteLine(SwithS + SwithoutS);
    }
}

// PREWRITEN CODE BEGINS FROM HERE
partial class Solver : Scanner
{
    public static void Main(string[] args)
    {
        new Solver(Console.In, Console.Out).Run();
    }

    private readonly TextReader cin;
    private readonly TextWriter cout;

    public Solver(TextReader reader, TextWriter writer)
        : base(reader)
    {
        this.cin = reader;
        this.cout = writer;
    }
    public Solver(string input, TextWriter writer)
        : this(new StringReader(input), writer)
    {
    }

    private int ni() { return NextInt(); }
    private int[] ni(int n) { return NextIntArray(n); }
    private long nl() { return NextLong(); }
    private long[] nl(int n) { return NextLongArray(n); }
    private double nd() { return NextDouble(); }
    private string ns() { return Next(); }
    private string[] ns(int n) { return NextArray(n); }
}

public class Scanner
{
    private TextReader Reader;
    private Queue<string> TokenQueue = new Queue<string>();
    private readonly CultureInfo ci = CultureInfo.InvariantCulture;

    public Scanner()
        : this(Console.In)
    {
    }

    public Scanner(TextReader reader)
    {
        this.Reader = reader;
    }

    public int NextInt() { return int.Parse(Next(), ci); }
    public long NextLong() { return long.Parse(Next(), ci); }
    public double NextDouble() { return double.Parse(Next(), ci); }
    public string[] NextArray(int size)
    {
        var array = new string[size];
        for (int i = 0; i < size; i++) array[i] = Next();
        return array;
    }
    public int[] NextIntArray(int size)
    {
        var array = new int[size];
        for (int i = 0; i < size; i++) array[i] = NextInt();
        return array;
    }

    public long[] NextLongArray(int size)
    {
        var array = new long[size];
        for (int i = 0; i < size; i++) array[i] = NextLong();
        return array;
    }

    public string Next()
    {
        if (TokenQueue.Count == 0)
        {
            if (!StockTokens()) throw new InvalidOperationException();
        }
        return TokenQueue.Dequeue();
    }

    public bool HasNext()
    {
        if (TokenQueue.Count > 0)
            return true;
        return StockTokens();
    }

    private bool StockTokens()
    {
        while (true)
        {
            var line = Reader.ReadLine();
            if (line == null) return false;
            var tokens = line.Trim().Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            if (tokens.Length == 0) continue;
            foreach (var token in tokens)
                TokenQueue.Enqueue(token);
            return true;
        }
    }
}


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

#define MAX 5012

int n;
int k;

vector<int> v;

bool dp[MAX][MAX];
bool rdp[MAX][MAX];


vector<int> ud;
vector<int> up;

bool pr[MAX];
bool nex[MAX];

int im[MAX];


int main(){
	cin >> n >> k;
	long long int S = 0;
	for (int i = 0; i < n; i++){
		int a;
		scanf("%d", &a);
		if (a < k){
			ud.push_back(a);
		}
		else{
			up.push_back(a);
		}
		S += a;
	}
	if (S < k){
		cout << n << endl;
		return 0;
	}
	int ans = 0;
	dp[0][0] = true;
	for (int i = 0; i < ud.size(); i++){
		for (int j = 0; j <= k; j++){
			if (dp[i][j]){
				if (j + ud[i] <= k){
					dp[i + 1][j + ud[i]] = true;
				}
				dp[i + 1][j] = true;
			}
		}
	}
	rdp[ud.size()][0] = true;
	for (int i = ud.size(); i >= 1; i--){
		for (int j = 0; j <= k; j++){
			if (rdp[i][j]){
				if (j + ud[i-1] <= k){
					rdp[i - 1][j + ud[i-1]] = true;
				}
				rdp[i - 1][j] = true;
			}
		}
	}
	for (int i = 0; i < ud.size(); i++){
		for (int j = 0; j <= k; j++){
			pr[j]=(dp[i][j]);
			nex[j]=(rdp[i + 1][j]);
			im[j] = nex[j];
			if (j)im[j] += im[j - 1];
		}
		int need = k - ud[i];//need ~ k-1
		bool ok = false;
		for (int j = 0; j <= k-1; j++){
			if (pr[j]){
				int lef = need - j;
				int rig = k - 1 - j;
				lef = max(lef, 0);
				int F = im[rig];
				if (lef)F -= im[lef - 1];
				if (F){
					ok = true;
				}
			}
		}
		if (ok==false){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 49280
import java.util.Scanner;

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

        boolean[] d = new boolean[10];

        for(int i=0; i<k; i++) {
            d[in.nextInt()] = true;
        }

        loop:
        for(; n<99999; n++) {
            for(int i=1; i<=10000; i*=10) {
                if(n < i) break;
                int l = (n % (i * 10)) / i;
                if(d[l]) {
                    continue loop;
                }
            }
            break;
        }

        System.out.println(n);

        in.close();
    }
}


Measured memory_bytes: 9552
#include<iostream>
using namespace std;
int main(){
	 double   a ,b;
	cin>>a>>b;
if((a>=1)&&(b>=1)&& (b<=10^100))
	if(a>b)
	cout<<"GREATER";
	else if (a<b)
	cout<<"LESS";
	else cout<<"EQUAL";
	return 0 ;
}

Measured memory_bytes: 256
def yoko():
    for h, line in enumerate(L):
        if line[q-1:q-1+p] != [' ']*p:
            h = h-1
            break
    for w in range(q-1, (q-1+p-1)+1):
        L[h][w] = '#'
    check(h, 1)
    
def tate():
    for h, line in enumerate(L):
        if line[q-1] != ' ':
            h = h-1
            break
    for i in range(h-p+1, h-p+1+p):
        L[i][q-1] = '#'
    check(h-p+1, p)

def check(h, _h):
    c = 0
    while c < _h:
        if L[h] == ['#']*5:
            del L[h]
        else:
            h += 1
        c += 1
     
def add():
    c = 0
    for line in L:
        if line == [' ']*5:
            c += 1
        else:
            break
    for i in range(5-c):
        L.insert(0, [' ']*5)
        
def result():
    ans = 0
    for line in L:
        for v in line:
            if v == '#':
                ans += 1
    else:
        print ans

while True:
    n = input()
    if n == 0: break
    L = [[' ']*5 for i in range(5)]
    for i in range(n):
        d, p, q = map(int, raw_input().split())
        if d == 1:
            yoko()
        else:
            tate()
        add()
    else:
        result()

Measured memory_bytes: 4796
//I_love_coding...
//I_will_win
//I_can_win
//I_must_win
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
/*
1)Substring : 
string s;
	cin>>s;
	string s1 = s.substr(1,4);
    cout<<s1<<"\n";

2)Vector-with-pairs : - 
 vector< pair <ll,ll> > v; 
   
    v.push_back( make_pair(x,y) );
    
    
    sort(v.begin(),v.end(),compare);
    
    cout<<v[i].first<<" "<<v[i].second<<"\n";
    
    bool compare(const pair<ll,ll>&p1, const pair<ll,ll>&p2)
{
    if(p1.first < p2.first) return true;
        if(p1.first == p2.first) return p1.second < p2.second;
        return false;
}



3)Binary-search-on-normal-vector :-
 
vector<ll> a1;
auto mg = upper_bound(a1.begin(),a1.end(),100);
auto kf = mg - a1.begin();
ll ram=kf;//returns__the index of number slightly greater than 100 in array/.
		  //cout<<ram<<"\n";
ll lol = a1[ram] ; 

4)Binary-Search-on-vectors-of-vectors....
///vector<vector<ll>> a1;
//a1[x].push_back(y); //RAM-RAM!!!!

auto mg = upper_bound(a1[i].begin(),a1[i].end(),100);
		  auto kf = mg - a1[i].begin();
		  ll ram=kf;
		  //cout<<ram<<"\n";
		  ll lol = a1[i][ram] ; //returns__the index of number slightly greater than 100 in array"i"/.
		  //cout<<ram<<"\n";
5)Binary-exponentiation:-->
calculates : x^n%M
long long int me(long long int x,long long int n,long long int M)
{
 long long int result=1;
    while(n>0)
    {
        if(n%2==1)
            result=(result*x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}


calculates : (1/(a^b))%M;
ll modInverse(ll A,ll B,ll M)
{
    ll k=B*(M-2);
    return me(A,k,M);
}



6)Calculating factorial and inverse factorial : 
vector<ll> fact;
vector<ll> invfact;
void computefactorial(ll n,ll p)
{
    fact.resize(n+1); 
    invfact.resize(n+1);
    fact[0]=1;
    for(ll i=1;i<=n;i++)
    {
        fact[i]=i*fact[i-1];
        fact[i]%=p;
    }
    invfact[n]=modInverse(fact[n],1,p);
    for(ll i=n-1;i>=0;i--){
        invfact[i]=(i+1)*invfact[i+1];
        invfact[i]%=p;
    }
}

7)Computing nCr

ll nCr(ll n, ll r, ll p) 
{ 
return (  ((fact[n]*invfact[r])%p) * (invfact[n-r]%p) ) % p; 
}


8)Binary-format-of-the-given-number :- 



for (int i = 31; i >= 0; i--) 
{ 
        int k = n >> i; 
        if (k & 1) 
            cout << "1"; 
        else
            cout << "0"; 
} 


*/
int main()
{
	ios_base::sync_with_stdio(false) ; 
	cin.tie(NULL);
        cout.tie(NULL);
        ll x;
        cin>>x;
        map<ll,pair<ll,ll>> a1;
        	ll i=-500;
        	while(i<=500)
        	{
        		
        		ll x=i*i*i*i*i;
        	
        			//cout<<x;
        		//cout<<"\n";
        		ll j=-500;
        		while(j<=500)
        		{
        	ll y = j*j*j*j*j;		
        			
        	ll gm = x - y ; 
        	
        	
        			if(gm>=1)
        			{pair<ll,ll> ram ;
        			ram.first = i ;
        			ram.second = j ;
        				a1[gm]=ram ;
        				
        			}
        			
        			j++;
        		}
        		
        		i++;
        	}
        		
       pair<ll,ll> seeta ; 
       seeta=a1[x];
       cout<<seeta.first<<" "<<seeta.second ;  				
	return 0;
}

/*

31250000000000

*/


Measured memory_bytes: 19312
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

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)*}
    };
}

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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        a: [i64; n],
    }
    let cnt = a.iter().filter(|&x| x < &0).count();
    let a_min = a.iter().map(|&x| x.abs()).min().unwrap();

    let a_sum = a.iter().map(|&x| x.abs()).sum::<i64>();

    println!(
        "{}",
        if cnt % 2 == 0 {
            a_sum
        } else {
            a_sum - a_min * 2
        }
    );
}


Measured memory_bytes: 4352
from bisect import bisect_left,bisect_right
n=int(input())
a=sorted(list(map(int,input().split())))
b=list(map(int,input().split()))
c=sorted(list(map(int,input().split())))
ans=0
for i in b:
    ans+=bisect_left(a,i)*(n-bisect_right(c,i))
print(ans)

Measured memory_bytes: 29436
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		char[] s = sc.next().toCharArray();
		int N = 0, W = 0, S = 0, E = 0;
		
		for (int i = 0; i < s.length; i++) {
			switch (s[i]) {
				case 'N':
					N++;
					break;
				case 'W':
					W++;
					break;
				case 'S':
					S++;
					break;
				case 'E':
					E++;
					break;
			}
		}
		
		if (((N == 0 && S == 0) || (N > 0 && S > 0)) && ((W == 0 && E == 0) || (W > 0 && E > 0))) {
			out.println("Yes");
		} else {
			out.println("No");
		}
		
		out.flush();
	}
	
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	
	private byte readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	
	private boolean isPrintableChar(int c) {
		return '!' <= c && c <= '~';
	}
	
	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}
	
	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}
	
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		byte b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
}

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

int main()
{
   int a,b,c;
   cin >> a >> b >> c;
   int x=0,y=0;
   if (a ==5){
      x++;
   }
   if(a==7){
      y++;
   }
   if (b ==5){
      x++;
   }
   if(b==7){
      y++;
   } 
   if (c ==5){
      x++;
   }
   if(c==7){
      y++;
   }
   if(x==2 && y==1){
      cout << "YES"<<endl;
   }else{
      cout << "NO"<<endl;
   }
}



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

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




using namespace std;
int main() {

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

	for (int i = 0; i < n; i++) {
		if (i%2)t -= r[i];
		else t += r[i];

	}

	cout << t << endl;


	
	return 0;
}

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

int main(){
	int n, k, i;
	cin >> n;
	char s[n+1];
	for(i=1; i<=n; i++){
		cin >> s[i];
	}
	cin >> k;
	
	for(i=1; i<=n; i++){
		if(s[i]!=s[k])	s[i] = '*';
	}
	
	for(i=1; i<=n; i++){
		cout << s[i];
	}cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main(){
  string s;
  cin >> s;
  if(s[0] >= 'A' && s[0] <= 'Z'){
    cout << 'A' << endl;
  }
  else if(s[0] >= 'a' && s[0] <= 'z'){
    cout << 'a' << endl;
  }
  return 0;
}

Measured memory_bytes: 3596
using System;
using System.Collections.Generic;
public class Aprob {
    public static void Main() {
        string[] readSome = new string[3];
        readSome = Console.ReadLine().Split(' ');
        int W = int.Parse(readSome[0]);
        int a = int.Parse(readSome[1]);
        int b = int.Parse(readSome[2]);
        int c1 = b - (a + W);
        int c2 = a - (b + W);
        if (c1 <= 0 & c2 <= 0) {
            Console.WriteLine(0);
        } else {
            Console.WriteLine(Math.Max(c1,c2));
        }
    }
}

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

int N;
const int MOD = 998244353;
const int MAX_N = 1.0e5 + 10;
int D[MAX_N];

ll pow_mod(ll n, ll k, ll mod) {
    if (k == 0) return 1;
    else if (k % 2 == 1) {
        return pow_mod(n, k-1, mod) * n % mod;
    }
    else {
        ll tmp = pow_mod(n, k/2, mod);
        return tmp * tmp % mod;
    }
}

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

    if (D[0] != 0) cout << 0 << endl;
    else {
        ll d[MAX_N];
        memset(d, 0, sizeof(d));
        
        for (int i = 0; i < N; i++) {
            d[D[i]]++; 
        }

        if (d[0] != 1) {
            cout << 0 << endl; 
        }
        else {
            ll ans = 1;
            ll cnt = 1;
            for (int i = 1; i < N; i++) {
                ans = (ans * (ll)pow_mod(d[i-1], d[i], MOD) ) % MOD;
                cnt += d[i];
                if (d[i] == 0 && cnt < N) {
                    ans = 0;
                    break;
                } 
            }

            cout << ans % MOD << endl;
            
        }

    }  

    return 0;
}


Measured memory_bytes: 1408
//make sure to make new file!
import java.io.*;
import java.util.*;

public class Main{
   
   public static void main(String[] args)throws IOException{
      BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out);
      
      long n = Long.parseLong(f.readLine());
      
      long answer = 0L;
      
      for(long k = 1; k <= n; k++){
         for(long j = 1; j <= n; j++){
            for(long h = 1; h <= n; h++){
               answer += gcd(gcd(k,j),h);
            }
         }
      }
      
      out.println(answer);
      
      

      
      
      
      
      
      out.close();
   }
   
   public static long gcd(long a, long b){
      if(a==0) return b;
      if(b==0) return a;
      
      if(a==b) return a;
      
      if(a > b)return gcd(a%b,b);
      return gcd(a,b%a);
   }
      
}

Measured memory_bytes: 33380
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

// i: index, n: size, a: start, b: end
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

// x: container(array, vector etc..)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define MAXR 100000 //10^5

#define PB push_back
#define MP make_pair
#define F first
#define S second

signed main() {
  int n, m, c;
  cin >> n >> m >> c;
  int b[m];
  FOR(i, 1, m) {
    cin >> b[i];
  }
  int count = 0;
  int a[n][m];
  FOR(i, 1, n) {
    int sum = 0;
    FOR(j, 1, m) {
      cin >> a[i][j];
      sum += a[i][j] * b[j];
    }
    if (sum + c > 0) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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

    template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

//const int mod = 1e9+7;
const int mod = 2;

const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
const long double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899;
int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};

const int MAX = 1123456;

long long fac[MAX], finv[MAX], inv[MAX];

LL COM(int n, int k){
    if((n&k) == k) {
        return 1;
    }else{
        return 0;
    }

}

bool odd_check(const VL& A){
    int sz = SZ(A);
    LL acc = 0;
    REP(i,sz){
        if(A[i] == 0 or A[i] == 2) continue;

        acc += COM(sz-1,i);
        acc %= mod;
    }
    if(acc == 1) return true;
    else return false;

}

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    int N; cin >> N;
    string S; cin >> S;
    VL A(N);
    REP(i,N){
        A[i] = S[i] - '0';
        A[i]--;
    }


    if(odd_check(A)){
        cout << 1 << endl;
        return 0;
    }

    bool oex = false;
    REP(i,N){
        if(A[i] == 1) oex = true;
    }
    if(oex){
        cout << 0 << endl;
        return 0;
    }

    REP(i,N){
        A[i] /= 2;
    }
    
    if(odd_check(A)){
        cout << 2 << endl;
        return 0;
    }else{
        cout << 0 << endl;
    }


}

Measured memory_bytes: 9244
import math
import copy
import sys
import fractions
# import numpy as np
# import statistics
import decimal
import heapq
import collections
import itertools
import bisect

# from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputIntList():
    outputDataList = []
    inputData = input().split()
    outputDataList = [int(n) for n in inputData]

    return outputDataList


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===


n = int(input())

ans = 0
for i in range(1, n+1):
    if i%3 != 0 and i%5 != 0:
        ans+=i

print(ans)


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

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<LL> VI;
typedef unsigned long long ULL;

#define MP make_pair
#define PB push_back
#define FOR(i, a, b) for (LL i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)a.size()
#define f first
#define s second
#define FILL(a, b) memset(a, b, sizeof(a))
#define mytype __int128

const int MAX = 200*1000 + 7;
const int INF = 1000*1000*1000;
const LL LINF = 1LL*INF*INF;
const int MOD = INF + 7;
const double PI = acos(-1.);

LL a[MAX][2];
LL na[2][MAX];

int main()
{
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	FOR(j,0,2)
		FOR(i,0,n)
			cin >> a[i][j];

	LL ans = 0;
	FOR(bit,0,30)
	{
		FOR(j,0,2)
		{
			FOR(i,0,n)
				na[j][i] = a[i][j] & ((1<<(bit+1))-1);
			sort(na[j], na[j]+n);
		}
		LL tmp = 0;
		FOR(i,0,n)
		{
			int ind1 = lower_bound(na[1], na[1]+n, (1LL<<(bit)) - na[0][i]) - na[1];
			int ind2 = lower_bound(na[1], na[1]+n, (1LL<<(bit+1)) - na[0][i]) - na[1];
			int ind3 = lower_bound(na[1], na[1]+n, (1LL<<bit)+ (1LL<<(bit+1)) - na[0][i]) - na[1];
			int ind4 = lower_bound(na[1], na[1]+n, (1LL<<(bit+1)) + (1LL<<(bit+1)) - na[0][i]) - na[1];
			tmp += ind2-ind1 +ind4-ind3;
		}
		if(tmp%2)
			ans += (1<<bit);
	}
	cout << ans;
	return 0;
}




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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll GCD(ll A, ll B){
  if (A < B) swap(A, B);
  while (A % B != 0){
    A %= B; swap(A, B);
  }
  return B;
}

ll LCM(ll A, ll B){
  ll G = GCD(A, B);
  return A / G * B;
}

int main(){
  ll A, B, C, D;
  cin >> A >> B >> C >> D;

  ll ans = B / C - (A - 1) / C;
  ans += B / D - (A - 1) / D;

  ll L = LCM(C, D);
  ans -= B / L - (A - 1) / L;

  cout << (B - A + 1) - ans << endl;

  return 0;
}


Measured memory_bytes: 3548
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define dump(x) cout << #x << " = " << (x) << endl;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  double W, H, x, y;
  cin >> W >> H >> x >> y;
  double ans = W / 2 * H;
  cout << setprecision(10) << ans << ' ';
  if(W / 2 == x && H / 2 == y) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
INF = float("inf")
cnt = 0
def merge(A, left, mid, right):
    global cnt
    L = A[left: mid] + [INF]
    R = A[mid: right] + [INF]
    i = j = 0
    limit = mid - left
    for k in range(left, right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            cnt += limit - i
            A[k] = R[j]
            j += 1
def mergeSort(A, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        mergeSort(A, left, mid)
        mergeSort(A, mid, right)
        merge(A, left, mid, right)
n = int(input())
S = list(map(int, input().split()))
mergeSort(S, 0, n)
print(cnt)



Measured memory_bytes: 27476
import java.util.Scanner;

public class Main {
  final static long MOD = 1_000_000_007;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    sc.close();
    System.out.println(solve(n));
  }

  static long solve(long n){
    if(n == 1){
      return 0;
    } else if(n == 2){
      return 2;
    }
    long ans = 0;
    long all = myPow(10l, n);
    long ans1 = myPow(9l, n);
    long ans2 = myPow(8l, n);
    ans = (all + MOD - ans1 + MOD - ans1 + ans2) % MOD;
    return ans;
  }

  static long myPow(long x, long n) {
    long answer = 1l;
    while (n > 0) {
      if((n & 1) == 1){
        answer = answer * x % MOD;
      }
      x = x * x % MOD;
      n >>= 1;
    }
    return answer;
  }
}


Measured memory_bytes: 35824
import sys
def gcd(a,b):
    if a<b:
        t = a
        a = b
        b = t
    while b != 0:
        temp = b
        b = a%b
        a = temp
    return a

for i in sys.stdin:
    a,b = map(int, i.split())
    g = gcd(a,b)
    print(g, a*b//g)

Measured memory_bytes: 7636
import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as C

readInteger' = fst.fromJust.C.readInteger
readLnInteger = map readInteger'.C.words<$>C.getLine
readCsInteger n = concat<$>replicateM n readLnInteger

x ? (a,b) = if x then a else b

main = do
 [x] <- readLnInteger
 print $ solve x

solve x = count 0 100 x

count year temp goal
 | temp >= goal = year
 | otherwise = count (year + 1) (interested temp) goal

interested n = (n*101)`div`100


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

int main(){
    int n,k;
    cin >>n >> k;
    vector<double> p(n);
    vector<double> q(n+1);

    for(int i=0;i<n;i++){
        cin >>p[i];
        p[i]=(p[i]+1.0)/2.0;
        //cout << p[i]<<endl;
    }
    q[0]=0.0;
    for(int i=1;i<q.size();i++){
        q[i]=q[i-1]+p[i-1];
        //cout << q[i]<<endl;
    }
    double max_=0.0;
    for(int i=k;i<q.size();i++){
        max_=max(q[i]-q[i-k],max_);
    }
    //for(int i=0.00000;i<n;i++) cout << q[i]<<endl;
    sort(q.begin(),q.end(),std::greater<double>());

    cout <<std::fixed << std::setprecision(15) << max_ <<endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <math.h>
using namespace std;
typedef long long ll;

int main() {
	string a;
	cin >> a;
	for (int i = 0; i < a.size(); ++i) {
		if (a[i] != 'x')
			a[i] = 'x';
		cout << a[i];
	}
	return 0;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n; std::cin >> n;
  vi cnt(9);
  rep(i, n) {
    int a; std::cin >> a;
    int idx = a / 400;
    if (idx >= 8) idx = 8;
    cnt[idx]++;
  }
  int ans = 0;
  rep(i, 8) ans += (cnt[i] > 0);
  std::cout << max(1, ans) << " " << ans+cnt[8] << "\n";
}


Measured memory_bytes: 256
#include<iostream>
#include <regex>
using namespace std;
int main(){
  string c;
  cin>>c;
  regex re("[aouie]");
  if(regex_match( c, re )){
    cout << "vowel" << endl;
  }
    else{
      cout << "consonant" << endl;
    }
    return 0;
  }

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

#define ll long long
#define ld long double
#define db double
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(v) for(int i=0;i<_sz(v);i++)
#define rep1(i,b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)
#define tc int tt=1;cin>>tt;while(tt--)

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr<<name<<" : "<<arg1<<nl;
}
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)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble
    string s;
    cin>>s;
    int n=_sz(s)-1;
    if(s[n]=='3'){
        cout<<"bon";
    }else if(s[n]=='0'||s[n]=='1'||s[n]=='6'||s[n]=='8'){
        cout<<"pon";
    }
    else cout<<"hon";
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    string s;
    cin >> s;
    int n = s.length();
    map<char, int> m;
    REP(i,n){
        m[s[i]]++;
        if (i>=2){
            if (m[s[i]]>1){
                cout << i-1 << " " << i+1 << endl;
                return 0;
            }
            m[s[i-2]]--;
        }
    }

    if (s[0] == s[1]){
        cout << "1 2" << endl;
        return 0;
    }

    cout << "-1 -1" << endl;

    return 0;
}


Measured memory_bytes: 512
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#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>
 
using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl
 
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);}
 
// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

ll pow_mod(ll a, ll b, ll mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }

  ll 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;
}

ll pnum(ll n,ll x){
  if(n==0){
    return 1;
  }

  if(x<=1){
    return 0;
  }
  
  if(x<=(1ll<<(n+1))-2){
    return pnum(n-1,x-1);
  }

  if(x==(1ll<<(n+1))-1){
    return pnum(n-1,x-2)+1;
  }

  if(x<=(1ll<<(n+2))-4){
    return pnum(n-1,(1ll<<(n+1))-3)+1+pnum(n-1,x-((1ll<<(n+1))-1));
  }

  if(x==(1ll<<(n+2))-3){
    return 2*pnum(n-1,(1ll<<(n+1))-3)+1;
  }
}

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

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

  std::cout<<pnum(n,x);

  return 0;
}

Measured memory_bytes: 256
#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=1;i<=(n);i++)
typedef long long ll;
typedef pair<int,int> pii;

ll table[10][10];


int main(){
    int n;
    cin>>n;
    REP(i,n){
        int a=i;
        while(a>=10) a/=10;
        table[a][i%10]++;
        
    }
    ll ans=0;
    rep(i,10){
        rep(j,10){
            ans+=table[i][j]*table[j][i];
        }
    }
  
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static long level[];
	static long p[];

	public static long burger(int n, long x) {
		if(n == 0) {
			if (x < 1)
				return 0;
			else return 1;
		}
		
		
		
		if (1 + level[n - 1] >= x)
			return burger(n - 1, x - 1);
		else 
			return 1 + p[n - 1] + burger(n - 1, x - 2 - level[n - 1]);
	}

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

		int n;
		long x;
		n = sc.nextInt();
		x = sc.nextLong();

		sc.close();

		level = new long[n + 1];
		p = new long[n + 1];

		level[0] = 1;
		p[0] = 1;

		for (int i = 1; i <= n; ++i) {
			level[i] = 2 * level[i - 1] + 3;
			p[i] = 2 * p[i - 1] + 1;
		}

		long count = burger(n, x);

		System.out.println(count);

	}
}


Measured memory_bytes: 22740
#include<iostream>
using namespace std;
int main()
{
    string s;
    cin >> s;
    int a;
    if(s == "000"){
      a = 0;
    }else if(s == "100" || s == "010" || s == "001"){
      a = 1;
    }else if(s == "101" || s == "110" || s == "011"){
      a = 2;
    }else{
      a = 3;
    }
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 256