akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    
    int mouth = 1;
    int count = 0;
    
    for(int i=0;i<100;i++){      
      if(mouth<B){
        mouth += A-1;
        count++;
      }else{
        break;
      }
    }
     System.out.println(count);
  }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int k;
    cin >> k;
    ll ans = 0;
    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= k; j++) {
            for (int l = 1; l <= k; l++) {
                ans += gcd(i, gcd(j, l));
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<set>
#include<vector>
using namespace std;
#define PI acos(-1.0)
#define pppp cout<<endl;
#define EPS 1e-8
#define LL long long
#define ULL unsigned long long     //1844674407370955161
#define INT_INF 0x3f3f3f3f      //1061109567
#define LL_INF 0x3f3f3f3f3f3f3f3f //4557430888798830399
// ios::sync_with_stdio(false);
// 那么cin, 就不能跟C的 scanf，sscanf, getchar, fgets之类的一起使用了。
const int dr[]= {0, 0, -1, 1, -1, -1, 1, 1};
const int dc[]= {-1, 1, 0, 0, -1, 1, -1, 1};
int read()//输入外挂
{
    int ret=0, flag=0;
    char ch;
    if((ch=getchar())=='-')
        flag=1;
    else if(ch>='0'&&ch<='9')
        ret = ch - '0';
    while((ch=getchar())>='0'&&ch<='9')
        ret=ret*10+(ch-'0');
    return flag ? -ret : ret;
}
int main()
{
    LL n;
    LL a,b;
    scanf("%lld%lld%lld",&n,&a,&b);
    LL tem;
    LL sum=0;
    cin>>tem;
    for(int i=2; i<=n; i++)
    {
        LL x;
        scanf("%lld",&x);
        sum+=min((x-tem)*a,b);
        tem=x;
    }
    printf("%lld\n",sum);
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (s, t) = readLine()!!.split(' ')
    val (a, b) = readLine()!!.split(' ').map { it.toInt() }
    val u = readLine()!!

    println("${if (s == u) a - 1 else a} ${if (t == u) b - 1 else b}")
}


Measured memory_bytes: 36344
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <stack>
#include <vector>
#include <algorithm>
#include <set>
#include <deque>
#include <utility>
#include <chrono>
#include <sstream>
#include <iomanip>
#define INF 1 << 30
#define MOD 1000000007;
#define pi 3.14159265358979
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r) for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r) for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define D(x) cout << x << endl
#define d(x) cout << x
#define all(x) (x).begin(), (x).end()
#define pub(x) push_back(x)
#define pob() pop_back()
#define puf(x) push_front(x)
#define pof() pop_front()
#define mp(x, y) make_pair((x), (y))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }
static const int dx[] = {0, 0, 1, -1};
static const int dy[] = {-1, 1, 0, 0};

int main() { 
  ll a, b, x;
  cin >> a >> b >> x;
  if (a == 0) {
    D(b / x + 1);
  } else {
    D(b / x - (a - 1) / x);
  }
  return 0;
}



Measured memory_bytes: 256
import sys

from collections import deque
# q = deque(); q.append(x); q.appendleft(x); q.pop() -> x; q.popleft() -> x
from collections import defaultdict
# d = defaultdict(lambda: []); d[key] -> []
import heapq
# hq = []; heapq.heappush(hq, x); heapq.heappop(hq) -> x; heapq.heappushpop(hq, x) -> x
import bisect
# i = bisect.bisect_left([1,2,3,4], 1.5); i = bisect.bisect_right([4,3,2,1], 1.5)

#import numpy as np
#from scipy.misc import comb

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    PY = ii2nnn(M)
    dic = defaultdict(lambda: [])
    for i, (p, y) in enumerate(PY):
        dic[p].append((i, p, y))
    li = []
    for ipy in dic.values():
        ipy.sort(key=lambda v: v[2])
        for j, (i, p, y) in enumerate(ipy):
            li.append((i, p, j+1))
    li.sort(key=lambda v: v[0])
    for i, p, j in li:
        print('%06d%06d' % (p, j))

main()


Measured memory_bytes: 114012
//嘘っぽいのに通ってたやつでいこう

#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

char cn[100000], *ci = cn, c;
const char* owa = cn + 100000;
inline char getcha() {
	if (ci == owa) {
		fread(cn, 1, 100000, stdin);
		ci = cn;
	}
	return *ci++;
}

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


	fread(cn, 1, 100000, stdin);
	int N = 0;
	while ((c = getcha()) >= '0') N = N * 10 + c - '0';
	int sL[1001] = {}, sR[1001] = {};
	pair<int, int> RR[500], LL[500];
	int rr = 0, ll = 0;
	int tot = 0;
	rep(i, N) {
		int l = 0, r = 0;
		while ((c = getcha()) >= '(') {
			if (c == '(') r++;
			else {
				if (r > 0) r--;
				else l++;
			}
		}
		tot += r - l;
		if (l < r) {
			if (l <= 1000) sR[l] += r;
			else RR[rr++] = { l,r };
		}
		else {
			if (r <= 1000) sL[r] += l;
			else LL[ll++] = { r,l };
		}
	}

	if (tot != 0) {
		printf("No");
		return 0;
	}

	sort(RR, RR + rr);
	sort(LL, LL + ll);

	int OK = 1;
	int k = 0;
	rep(i, 1001) {
		if (sR[i]) {
			if (k < i) OK = 0;
			k += sR[i];
		}
	}
	rep(i, rr) {
		if (k < RR[i].first) OK = 0;
		k += RR[i].second - RR[i].first;
	}
	k = 0;
	rep(i, 1001) {
		if (sL[i]) {
			if (k < i) OK = 0;
			k += sL[i];
		}
	}
	rep(i, ll) {
		if (k < LL[i].first) {
			OK = 0;
		}
		k += LL[i].second - LL[i].first;
	}

	if (OK) printf("Yes");
	else printf("No");

	Would you please return 0;
}

Measured memory_bytes: 1692
while True:
    H,W = map(int, input().split())
    if H == 0 and W == 0: break
    for j in range(H):
        for i in range(W):
            if (i + j)%2 == 0:
                print("#", end="")
            else:
                print(".", end="")
        print()
    print()




Measured memory_bytes: 7008
import math

A,B,H,M = map(int, input().split())

tan = H * 30 + M * 0.5
tyo = M * 6
C2 = 0

kaku = abs(tan - tyo)

if kaku > 180 :
    kaku = 360 - kaku 

if kaku == 180 :
    print(A + B)

elif kaku == 0 :
    print(abs(B - A))

else:
    C2 = A**2 + B**2 - 2*A*B*math.cos(math.radians(kaku))
    print(math.sqrt(C2))

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

using namespace std;

typedef long long LL;

const int N = 100010;

int n, a[N];

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

    cout << a[n - 1] - a[0] << endl;

    return 0;
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    vec b;
    sort(all(a));
    int nim=0;
    if(a[0]%2==1) nim^=a[0];
    rep(i,n-1){
        if((a[i+1]-a[i])%2==1) nim^=a[i+1];
    }
    // cout<<nim<<endl;

    if(nim==0) cout<<"second"<<endl;
    else cout<<"first"<<endl;
    
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N=sc.nextLong(),X=sc.nextLong();
		long res=0L;

		for(long i=0L; i<N;i++) {
			long x1=sc.nextLong();
			long d1=Math.abs(x1-X);
			res=gcd(res,d1);
		}
		System.out.println(res);
	}

	public static long gcd(long n,long m) {
		if(n<m) {
			return gcd(m,n);
		}
		if(m==0) {
			return n;
		}
		return gcd(m,n%m);
	}
}

Measured memory_bytes: 47404
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

int main() {
    set<int> se;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        se.insert(x);
    }
    cout << se.size() << endl;
    return 0;
}



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

#pragma GCC optimuze("Ofast")
#pragma GCC optimuze("03")
#pragma GCC optimuze("unroll-loops")

#define F first
#define S second
#define pb push_back
#define llong long long
#define ld long double
#define int llong
#define endl '\n'

using namespace std;

const int N = 3e3 + 5;
const int M = 2e3 + 5;
const int MOD = 1e9 + 7;
const int rx[] = {1, 0, -1, 0};
const int ry[] = {0, 1, 0, -1};

int dp[N][N];
int s[N][N];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef ARINOCHKA
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    freopen(".in", "r", stdin);
//    freopen(".out", "w", stdout);
#endif // ARINOCHKA

    int n;
    cin >> n;
    vector <int> a;
    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        a.pb(x);
        dp[i][1] = x;
    }

    for(int i = 0; i < n; i++) {
        s[i][1] = a[i];
        for(int j = 1; j <= n; j++) {
            if (i + j >= n) break;
            s[i][j + 1] = s[i][j] + a[i + j];
        }
    }

//    for(int i = 0; i < n; i++){
//        for(int j = 0; j <= n; j++){
//            cout << s[i][j] << ' ';
//        }
//        cout << endl;
//    }



    for(int l = 2; l <= n; l++) {
        for(int i = 0; i < n; i++) {
//            if (l + i >= n) continue;
            dp[i][l] = max(s[i][l] - dp[i + 1][l - 1], s[i][l] - dp[i][l - 1]);
        }
    }

//    cout << s << endl;
    cout << -s[0][n] + 2 * dp[0][n] << endl;




    return 0;


}


Measured memory_bytes: 141312
n=int(input())
h=[int(i) for i in input().split()][::-1]
c=-1
maxc=-1

v = float("-inf")
i=0
while i<n:
    if h[i]>=v:
        c+=1
        v=h[i]
        i+=1
    else:
        maxc=max(c, maxc)
        c=-1
        v=float("-inf")
    # print(i, v, h[i])
maxc=max(c, maxc)
print(maxc)

Measured memory_bytes: 14252
fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => {
            get().parse::<$t>().unwrap()
        };
        () => {
            get!(i64)
        };
    }

    let s = get!(String);
    let v = s.chars().collect::<Vec<char>>();

    println!(
        "{}",
        if v[2] == v[3] && v[4] == v[5] {
            "Yes"
        } else {
            "No"
        }
    );
}


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

int main(void) {
  long long N;
  long long r;
  cin >> N;
  string ans = "";
  if (N == 0) {
    cout << 0 << endl;
    return 0;
  }

  do {
    r = N % (-2);
    N /= -2;
    if (r == -1) {
      r = 1;
      N++;
    }
    ans = to_string(r) + ans;
  } while (!(N == 0 || N == 1));
  ans = to_string(N) + ans;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: u64 = itr.next().unwrap().parse().unwrap();
    let k: u64 = itr.next().unwrap().parse().unwrap();

    if n == 1 && k == 1 {
        println!("1");
    } else if n == 1 {
        println!("{}", k - 2);
    } else if k == 1 {
        println!("{}", n - 2);
    } else {
        println!("{}", (n - 2) * (k - 2));
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define REP(i, l, r) for (int i=(l); i<(r); ++i)
#define RREP(i, r, l) for (int i=(r); i>(l); --i)
#define CASET int _T; cin >> _T; REP(caset, 0, _T)
#define print(x) cout << to_string(x) << '\n'
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vvi vector<vi>
#define vvb vector<vb>
#define pii pair<int,int>
#define t3i tuple<int,int,int>
#define mii map<int,int>
#define sq(x) (x)*(x)
#define inv(x) powa(x, MOD-2)
 
long long INF = 1LL<<60;
long long MOD = 998244353;

string to_string(char &c) {string x(1, c); return x;}
string to_string(const char s[]) {return (string)s;}
string to_string(string &s) {return s;}
string to_string(vb &v) {string res; for (const bool &x : v) res += to_string(x) + ' '; return res;}
template <class C> string to_string(C &v) {string res; for (auto &x : v) res += to_string(x) + ' '; return res;}
template <typename A, typename B> istream &operator>>(istream &is, pair<A, B> &pr) {is >> pr.first >> pr.second; return is;}
template <typename A> istream &operator>>(istream &is, vector<A> &v) {for (auto &x : v) is >> x; return is;}
ostream &operator<<(ostream &os, char &c) {os << (char)c; return os;}
ostream &operator<<(ostream &os, const char s[]) {os << (string)s; return os;}
ostream &operator<<(ostream &os, string &s) {for (char &c : s) os << (char)c; return os;}
template <typename A, typename B> ostream &operator<<(ostream &os, pair<A, B> pr) {os << '(' << pr.first << ", " << pr.second << ')'; return os;}
ostream &operator<<(ostream &os, vb &v) {
    bool first = true;
    os << '[';
    for (const bool &x : v) {
        if (!first) os << ", ";
        first = false;
        os << x;
    }
    os << ']';
    return os;
}
template <class C> ostream &operator<<(ostream &os, C &v) {
    bool first = true;
    os << '[';
    for (auto &x : v) {
        if (!first) os << ", ";
        first = false;
        os << x;
    }
    os << ']';
    return os;
}
string bin_string(int x) {
    const int d = 3;
    string res(d, ' ');
    REP(i, 0, d) res[d-1-i] = '0'+(x>>i & 1LL);
    return res;
}
int powa(int base, int exp) {
    int res = 1;
    while (exp) {
        if (exp&1) res = res*base % MOD;
        base = base*base % MOD;
        exp >>= 1;
    }
    return res;
}

int n;
vvi a;
vvi dp(51, vi(1<<18, -1));

int solve(int t, int u, int mask) {
    if (mask==0) dp[u][mask] = 0;
    if (dp[u][mask] == -1) {
        dp[u][mask] = INF;
        REP(card, 0, n) if (mask>>card&1LL) {
            int cardval = a[(card+t)%2][card];
            if (cardval < u) continue;
            int dist = 0;
            REP(i, 0, card) if (mask>>i&1LL) ++dist;
            dp[u][mask] = min(dp[u][mask], dist + solve(t+1, cardval, mask^(1<<card)));
        }
    }
    return dp[u][mask];
}

main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    
    cin >> n;
    a.assign(2, vi(n));
    cin >> a;

    int res = INF;
    REP(u, 1, 51) res = min(res, solve(0, u, (1<<n)-1));
    if (res==INF) cout << -1;
    else cout << res;
}

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

char M[4][8][8];

void rotate90AndDisp(int k) {
  for(int i=0;i<8;i++) {
    for(int j=0;j<8;j++) {
      M[k+1][i][j] = M[k][7-j][i];
      cout<<M[k+1][i][j];
    }
    cout<<endl;
  }
}

int main() {
  
  for(int i=0;i<8;i++) for(int j=0;j<8;j++)cin>>M[0][i][j];

  for(int k=0; k<3; k++) {
    cout<<90*(k+1)<<endl;
    rotate90AndDisp(k);
  }
  
  return 0;
}

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

#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
//#include <list>
#include <iomanip>
//#include <stdlib.h>
//#include <cctype>

using namespace std;

#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t

int main() {
    Int ans=0;
    string s,t,u;
    cin>>s>>t;
    for (int i = 0; i < s.length(); ++i) {
        if(s[i]!=t[i])ans++;
    }
    cout<<ans;






    cout<<endl;
    return 0;
}



Measured memory_bytes: 3912
/*input
ABC
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=1e6+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define MP make_pair
ll mult(ll a,ll b){
    ll res=0LL;
    while(b){
        if(b&1) res=(res+a)%MOD;
        a=(a+a)%MOD;
        b>>=1;
    }
    return res%MOD;
}
ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
int main(){
    ios::sync_with_stdio(false),cin.tie(0);
    string s;
    cin>>s;
    if(s=="ABC") cout<<"ARC";
    else cout<<"ABC";
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

main(){
  int n, w;
  while(1){
    cin >> n >> w;
    if(n==0 && w==0) break;

    int in[100];
    int max=-1;
    for(int i=0;i<n;i++){
      cin >> in[i];
      if(max<in[i]) max=in[i];
    }

    int data[10];
    int size=max/w+1;
    for(int i=0;i<size;i++) data[i]=0;
    for(int i=0;i<n;i++){
      data[(in[i]/w)]++;
    }
    int s=-1;
    for(int i=0;i<size;i++){
      if(s<data[i]) s=data[i];
    }
    //printf("%d\n", s);
    double ans=0.01;
    double t=1;
    for(int i=0;i<size;i++){
      ans+=t*(double)data[i]/s;
      t-=(double)1.0/(size-1);
    }

    printf("%.10f\n", ans);
  }
  return 0;
}

Measured memory_bytes: 0
/*
               ██████  ██████
               ██   ██ ██   ██
 Author ->     ██████  ██   ██
               ██      ██   ██
               ██      ██████
 
        nik is love.
        nik is motivation.
        Ek modulus aapki jindagi barbaad kar sakti hai
        Watch for integer overflows.
        A dream doesn't become reality through magic; it takes sweat, determination and hard work" — Colin Powell
 */
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional>
#define mp                    make_pair
#define pb                    push_back
#define ll                    long long
#define ss                       second
#define ff                        first
#define fr(i,a,b)   for(ll i=a;i<b;i++)
#define f(i,n)                fr(i,0,n)
#define rf(i,b,a) for(ll i=b-1;i>=a;i--)
#define r(i,n)                rf(i,n,0)
#define eps                   0.000000001
#define sz(a)                int((a).size())
#define all(c)               (c).begin(),(c).end()
#define tr(c,i)              for(typeof(c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x)         ((c).find(x) != (c).end())
#define cpresent(c,x)        (find(all(c),x) != (c).end())
#define pi                   pair<int,int>
#define pll                  pair < ll , ll >
#define endl                 '\n'
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef vector< int > vi;
typedef vector< vi > vvi;
int dx[8]={1,-1,0,0,-1,-1,1,1};
int dy[8]={0,0,-1,1,-1,1,-1,1};
const ll inf=1000000007;
vector<int> adj[200010],val(200010,0),vis(200010,0);
int myrandom (int i) { return std::rand()%i;}
//using namespace __gnu_pbds;
//typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> special_map;
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //ifstream fin;
    //ofstream fout;
    //fin.open("input.txt");
    //fout.open("output.txt");
    //clock_t launch=clock();
    string s;
    cin>>s;
    if((int)s.length()%2)
    {
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=0;i<(int)s.length();i++)
    {
        if(i%2)
        {
            if(s[i]!='i')
            {
                cout<<"No"<<endl;
                return 0;
            }
        }
        else
        {
            if(s[i]!='h')
            {
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    //clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
}


Measured memory_bytes: 6528
#include <iostream>
using namespace std;
using ull = unsigned long long;
ull solve(ull* b, int n) {
    for (int j = 60, i0 = 0; j >= 0; j--) {
        for (int i = i0; i < n; i++) {
            if ((b[i] >> j) & 1) {
                swap(b[i], b[i0]);
                for (int m = 0; m < n; m++)
                    if (m != i0 && ((b[m] >> j) & 1)) b[m] ^= b[i0];
                i0++;
                break;
            }
        }
    }
    ull a = 0;
    for (int i = 0; i < n; i++) a ^= b[i];
    return a;
}

int main() {
    int n; cin >> n;
    ull a[n]; for (int i = 0; i < n; i++) cin >> a[i];
    ull A = 0;
    for (ull x : a) A ^= x;
    for (ull &x : a) x &= ~A;
    cout << solve(a, n) * 2 + A << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N=2050;
vector<int> E[N];
int dep[N],hal,cnt1,cnt2;
void DFS(int u,int p,int d){
	if(d<=hal)cnt1++;
	if(d==hal+1)cnt2++;
	for(int v:E[u])if(v!=p)DFS(v,u,d+1);
}
int main(){
	int n,k;
	scanf("%i %i",&n,&k);
	for(int i=1,u,v;i<n;i++)scanf("%i %i",&u,&v),E[u].pb(v),E[v].pb(u);
	hal=k/2;
	int ans=n;
	for(int cen=1;cen<=n;cen++){
		cnt1=0;
		int mx=0;
		for(int sub:E[cen]){
			cnt2=0;
			DFS(sub,cen,1);
			mx=max(mx,cnt2);
		}
		ans=min(ans,n-cnt1-(k%2==1?mx:0)-1);
	}
	printf("%i\n",ans);
	return 0;
}

Measured memory_bytes: 512
N = int(input())
Z = 1000
D = [[0]*(Z+1) for i in range(Z+1)]
for i in range(N):
    x1, y1, x2, y2 = map(int, input().split())
    D[y1][x1] += 1
    D[y1][x2] -= 1
    D[y2][x1] -= 1
    D[y2][x2] += 1
for i in range(Z):
    for j in range(Z):
        D[i][j+1] += D[i][j]
for j in range(Z):
    for i in range(Z):
        D[i+1][j] += D[i][j]
print(max(max(d) for d in D))



Measured memory_bytes: 45316
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;


int main(){
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    vector<ll> dp(n, 1e9);
    dp[0] = 0;

    for(int i=1;i<n;i++){
        dp[i] = min(dp[i], dp[i-1]+abs(h[i]-h[i-1]));
        for(int j=1;j<k;j++){
            if(i>j) dp[i] = min(dp[i], dp[i-j-1]+abs(h[i]-h[i-j-1]));
        }
    }

    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
    int n,m,x,y;
    cin >> n >> m >> x >> y;
    vector<int> a(n),b(m);
    rep(i,n)cin >> a[i];
    rep(i,m)cin >> b[i];
    bool flag = 0;
    for(int i=x+1;i<=y;i++){
        bool fflag = 1;
        rep(j,n){
            if(a[j]>=i)fflag = 0;
        }
        rep(j,m){
            if(b[j]<i)fflag = 0;
        }
        if(fflag)flag = 1;
    }
    if(flag){
        cout << "No War" << endl;
    }else{
        cout << "War" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def solve(l:list):
    count = 0
    for a, b in zip(l, sorted(l)):
        if a != b:
            count += 1
    print("YES") if count <= 2 else print("NO")
    return

def main():
    input()
    l = list(map(int, input().split(" ")))
    solve(l)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main() {
    int n, m, p, y;
    scanf("%d%d", &n, &m);
    vector< vector<int> > c(n + 1);
    vector< pair<int, int> > d(m);
    for (int i = 0; i < m; ++i) {
        scanf("%d%d", &p, &y);
        c.at(p).push_back(y);
        d.at(i) = {p, y};
    }
    for (int i = 0; i <= n; ++i) sort(c.at(i).begin(), c.at(i).end());
    for (int i = 0; i < m; ++i) printf("%06d%06d\n", d.at(i).first, lower_bound(c.at(d.at(i).first).begin(), c.at(d.at(i).first).end(), d.at(i).second) - c.at(d.at(i).first).begin() + 1);
    return 0;
}


Measured memory_bytes: 7680
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll n;
int main(){
	cin >> n;

	cout << "ABC" << n << endl;
	return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/abc068/tasks/arc079_a

import itertools
import collections
import bisect

def main():
    N, M = map(int, input().split())

    src = {}
    A = []
    B = []
    for _ in range(M):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)

        if a == 1:
            src[b] = 1

    for i in range(M):
        if A[i] in src and B[i] == N:
            print("POSSIBLE")
            exit()

    print("IMPOSSIBLE")


if __name__ == '__main__':
    main()


Measured memory_bytes: 26280
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set,multiset
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
using namespace std;

const long long INF = 4000000000000000001;
const int inf = 1001001001;
const int MOD = 1000000007;
typedef pair<long long,long long> P;

void chmax(long long &a,long long b){if(a < b) a = b;}
void chmin(long long &a,long long b){if(a > b) a = b;}

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //When end-of-a bit is 1, times simple N.
    if (M & 1) res = (res * N) % MOD;
    return res %= MOD;
}
long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}



int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int N;cin >> N;
    vector<long long> retu(N+1);
    for(int i = 0;i<N+1;i++) cin >> retu.at(i);
    if(N == 0){
        if(retu.at(0) == 1) cout << 1 << endl;
        if(retu.at(0) != 1) cout << -1 << endl;
        return 0;
    }
    long long beki2 = 1;
    for(int i = 0;i<N+1;i++){
        if(beki2 > 100000000){
            break;
        }
        if(retu.at(i) > beki2){
            cout << -1 << endl;
            return 0;
        }
        beki2 *= 2;
    }
    if(retu.at(0)+retu.at(1) > 1 && N != 1){
        cout << -1 << endl;
        return 0;
    }
    vector<long long> rui(N+2);
    for(int i = 0;i<N+1;i++){
        rui.at(i+1) = rui.at(i)+retu.at(i);
    }
    long long ans = 1;
    long long prvF = 0,prvC = 1;
    if(retu.at(0) == 1) prvF = 1,prvC = 0;
    for(int i = 1;i<=N;i++){
        
        if(prvC > rui.at(N+1)-rui.at(i)){
            cout << -1 << endl;
            return 0;
        }
        long long nowF = retu.at(i);
        long long nowC = 2*prvC-nowF;
        if(nowC < 0){
            cout << -1 << endl;
            return 0;
        }
        if(prvC > nowF+nowC || nowF+nowC > 2*prvC){
            cout << -1 << endl;
            return 0;
        }
        if(nowC > rui.at(N+1)-rui.at(i+1)){
            nowC = rui.at(N+1)-rui.at(i+1);
        }
        ans += nowF+nowC;
        prvF = nowF;prvC = nowC;
        //cout << i << " " << nowF << " " << nowC << " " << ans << endl;
    }
    cout << ans << endl;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

const int N_MAX = 100005;

ll inv[N_MAX],fac[N_MAX],finv[N_MAX];
void make(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<N_MAX;i++){
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        fac[i]=fac[i-1]*(ll) i%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}

ll Combination(ll C, ll D){
    if(C<D) return 0;
    return fac[C]*(finv[D]*finv[C-D]%mod)%mod;
}

int main(){
    make();
    int n;
    cin >> n;
    int a[n+1];
    REP(i, n+1) cin >> a[i];
    int hash[n+1];
    memset(hash, -1, sizeof(hash));
    int s, t;
    REP(i, n+1){
        if(hash[a[i]]==-1) hash[a[i]] = i;
        else{
            s = hash[a[i]];
            t = i;
        }
    }
    for(int k=1;k<=n+1;k++){
        ll res = Combination(n+1, k);
        res -= Combination(n-t+s, k-1);
        if(res<0) res+=mod;
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 4352
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N,A,B=get_i
if (B-A).even?
    puts "Alice"
else
    puts "Borys"
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define double long double
using namespace std;
const int N=200005;
struct node{
	int x,y;
	bool operator <(const node &a)const{
		return x<a.x;
	}
}a[N];
int q[N],t;
int sx,sy,tx,ty;
int find(int k){
	int l=1,r=t+1;
	while (l<r){
		int mid=(l+r)/2;
		if (k<q[mid]) r=mid;
		else l=mid+1;
	}
	return l;
}
void add(int k){
	int x=find(k);
	q[x]=k; t=max(t,x);
}
int main(){
	scanf("%d%d%d%d",&sx,&sy,&tx,&ty);
	if (sx>tx) swap(sx,tx),swap(sy,ty);
	int num,n=0; scanf("%d",&num);
	while (num--){
		int x,y;
		scanf("%d%d",&x,&y);
		if (x>=sx&&x<=tx) a[++n]=(node){x,y};
	}
	sort(a+1,a+n+1);
	if (sy<ty){
		for (int i=1;i<=n;i++)
			if (a[i].y>=sy) add(a[i].y);
	}
	else{
		swap(sy,ty);
		for (int i=n;i;i--)
			if (a[i].y>=sy) add(a[i].y);
	}
	int k=find(ty)-1;
	int v=k>=min(tx-sx,ty-sy)+1;
	double pi=acos(-1);
	printf("%.15Lf\n",(tx+ty-sx-sy)*100.0+k*(5.0*pi-20.0)+v*5.0*pi);
} 

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <algorithm>

using namespace std;
typedef vector< pair<char, int> > Trump;

namespace {
	void BubbleSort(Trump& t, int N)
	{
		bool flag = true;
		while (flag)
		{
			flag = false;
			for (int i = N - 1; i > 0; --i)
				if (t[i].second < t[i - 1].second)
					swap(t[i], t[i - 1]), flag = true;
		}
	}

	void SelectionSort(Trump& t, int N)
	{
		for (int i = 0; i < N; ++i)
		{
			int min = i;
			for (int j = i; j < N; ++j)
				if (t[j].second < t[min].second)
					min = j;

			if (i != min)
				swap(t[i], t[min]);
		}
	}
}

int main()
{
	int N;
	cin >> N;
	cin.ignore();

	string s;
	getline(cin, s);

	istringstream is(s);
	Trump t;
	for (int i = 0; i < N; ++i)
	{
		is >> s;
		t.push_back(pair<char, int>(s[0], s[1] - '0'));
	}

	Trump bt = t;
	BubbleSort(bt, N); // stable

	for (int i = 0; i < N; ++i)
	{
		cout << bt[i].first << bt[i].second;
		i < N - 1 ? cout << " " : cout << endl;
	}
	cout << "Stable" << endl;

	Trump st = t;
	SelectionSort(st, N); // Not stable
	bool isStable = true;
	for (int i = 0; i < N; ++i)
		if (st[i] != bt[i])
			isStable = false;

	for (int i = 0; i < N; ++i)
	{
		cout << st[i].first << st[i].second;
		i < N - 1 ? cout << " " : cout << endl;
	}
	cout << (isStable ? "Stable" : "Not stable") << endl;

	return 0;
}

Measured memory_bytes: 1236
S = input()
T = input()


def check(A, B):
    alphabets = "abcdefghijklmnopqrstuvwxyz"
    d = {c: None for c in alphabets}
    for i in range(len(A)):
        if d[A[i]] is None:
            d[A[i]] = B[i]
        elif d[A[i]] != B[i]:
            return False
    return True


print("Yes" if check(S, T) and check(T, S) else "No")


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
 
int N, K;
int dp[2010][2010];
 
int count(int y1, int x1, int y2, int x2) {
  if (y1 < 0 || y1 >= 2 * K || y2 < 0 || y2 >= 2 * K) {
    return 0;
  }
  if (x1 < 0 || x1 >= 2 * K || x2 < 0 || x2 >= 2 * K) {
    return 0;
  }
  if (y1 > y2 || x1 > x2) {
    return 0;
  }
  int res = dp[y2][x2];
  if (y1 > 0) {
    res -= dp[y1-1][x2];
  }
  if (x1 > 0) {
    res -= dp[y2][x1-1];
  }
  if (y1 > 0 && x1 > 0) {
    res += dp[y1-1][x1-1];
  }
  return res;
}
 
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    int x, y;
    char c;
    cin >> x >> y >> c; 
    if (c == 'W') {
      x += K;
    }
    x %= 2 * K;
    y %= 2 * K;
    dp[y][x] += 1;
  }
  for (int y = 0; y < 2 * K; y++) {
    for (int x = 0; x < 2 * K; x++) {
      if (y > 0) {
        dp[y][x] += dp[y-1][x];
      }
      if (x > 0) {
        dp[y][x] += dp[y][x-1];
      }
      if (y > 0 && x > 0) {
        dp[y][x] -= dp[y-1][x-1];
      }
    }
  }
  int res = 0;
  for (int y1 = 0; y1 + K - 1 < 2 * K; y1++) {
    for (int x1 = 0; x1 + K - 1 < 2 * K; x1++) {
      int y2 = y1 + K - 1, x2 = x1 + K - 1;
      int cnt = 0;
      cnt += count(y2 + 1, x1, 2 * K - 1, x2);
      cnt += count(y1, x2 + 1, y2, 2 * K - 1);
      cnt += count(0, x1, y1 - 1, x2);
      cnt += count(y1, 0, y2, x1 - 1);
      res = max(res, cnt);
      res = max(res, N - cnt);
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 16000
#include <bits/stdc++.h>
using namespace std;
int main(){
    string a, b, c;
    cin >> a >> b >> c;
    a.at(0) += ('A' - 'a');
    b.at(0) += ('A' - 'a');
    c.at(0) += ('A' - 'a');
    cout << a.at(0) << b.at(0) << c.at(0) << endl;
}

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

typedef long long ll;

int main() {
    ll N;
    cin >> N;

    vector<ll>a(N+1, 1);
    ll ans = 1;
    for (ll i = 2; i <= N; i++) {
        ll j = 1;
        while (true) {
            if (i * j <= N) {
                a[i*j]++;
            } else {
                break;
            }
            j++;
        }
        ans += a[i]*i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 81400
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int a,b;
    cin >> a >> b;
    int x=min(a,b);
    int y=max(a,b);
    rep(i,y) cout << x;
    cout << endl;



}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstring>
#include <fstream>
using namespace std;
const int N = 50000;
bool prime[N+1];

void make_prime(void)
{
	int i,j;
	memset (prime, true , sizeof(prime ) );

	prime[0] = false;
	prime[1] = false;

	for (j = 0; j <= N; ++j){
		if (prime[j]){
			int p = j;
			for (i = 2*p; i <= N; i += p ){
				if (prime[i] ){
					prime[i] = false;
				} // end if
			} // end for
		} // end if	
	} // end for
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.goldbach", "r", stdin);
	string str = "";
	make_prime();

	while (getline (cin, str ) ){
		int n;
		stringstream ss(str);
		ss >> n;
		if (n == 0 ){
			break;
		} // end if
		int res = 0;
		int i;

		for (i = 2; i <= n/2; ++i){
			if (prime[i] && prime[n-i] ){
				++res;
			} // end for
		} // end for
		cout << res << endl;
	} // end loop
		
	return 0;
}

Measured memory_bytes: 980
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int N, ans, BA, XA, BX; string s;
int main() {
  cin >> N;
  for(int i = 0; i < N; ++i) {
    cin >> s;
    int slen = s.size();
    for(int j = 0; j < slen-1; ++j) {
      if(s[j] == 'A' && s[j+1] == 'B') ++ans;
    }
    if(s[0] == 'B') {
      if(s[slen-1] == 'A') ++BA;
      else ++BX;
    } else if(s[slen-1] == 'A') {
      ++XA;
    }
  }
  if(XA+BX > 0) ans += BA+min(XA, BX);
  else ans += max(BA-1, 0);
  cout << ans << endl;
}

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

using namespace std;

int main() {
    while(true) {
        string str;
        getline(cin, str);
        if(str == "") break;

        for(int i = 0; i < str.size(); ++i)
            if(islower(str[i])) str[i] = toupper(str[i]);
        cout << str << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <map>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;
typedef std::pair<std::string,double> P;

int N, M;
int a[1100], b[1100], c[1100], dist[101][101];
string s;
void solve(){
    for(int i=0; i<M; ++i) {
        cin >> a[i] >> b[i] >> c[i]; // a: from, b: to, c コスト
        a[i]--; b[i]--;
    }
    
    for(int i=0; i<N; ++i){
        for(int j=0; j<N; ++j){
            if(i==j){
                dist[i][j]=0;
            }else{
                dist[i][j]=INF;
            }
        }
    }
    
    for(int i=0; i<M; ++i){
        dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
        dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
    }
    
    for(int i=0; i<N; ++i){
        for(int j=0; j<N; ++j){
            for(int k=0; k<N; ++k){
                dist[j][k]=min(dist[j][k], dist[j][i]+dist[i][k]);
            }
        }
    }
    int ans=M;
    for(int i=0; i<M; ++i){
        bool flag = false;
        for(int j=0; j<N; ++j) if(dist[j][a[i]]+c[i]==dist[j][b[i]]) flag = true;
        if(flag) ans-=1;
    }
    cout << ans << endl;
}
int main() {
    cin >> N >> M;
    solve();
	return 0;
}

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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
 
typedef long long ll;
using namespace std;
 
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;

  if(a*b > c*d){
    printf("%d\n", a*b);
  }
  else printf("%d\n", c*d);
  return 0;
}

Measured memory_bytes: 384
// inputに入力データ全体が入る
function Main(input) {
	// お姉ちゃんが言った言葉を受け取る
	var tmp = input.split(" ");
    // 問題文に合わせて「箱」を用意する
    // 文字列から10進数に変換するときはparseIntを使います
	var A  = parseInt(tmp[0], 10);
  	var op = tmp[1];
  	var B  = parseInt(tmp[2], 10);
    // 出力
  	if (op == '+') {
      console.log(A + B);
    } else if (op == '-') {
      console.log(A - B);
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29520
// AUTHOR : UTKARSH CHAUHAN

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

#define ff              first
#define ss              second
#define int             long long
#define rep(i, j, k)    for(int i = (j); i < (int)k; ++i)
#define rrep(i, k, j)   for(int i = (int)k - 1; i >= (j); --i)
#define pb              push_back
#define mp              make_pair
#define pii             pair<int, int>
#define endl            "\n"
#define vi              vector<int>
#define mii             map<int, int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int, vi, greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x, y)        fixed << setprecision(y) << x
#define mk(arr, n, type)type *arr = new type[n];
#define w(x)            int x; cin >> x; while(x--)
#define PI              3.14159265358979323846264338327950L
#define span(a)         begin(a), end(a)
#define parent(i)       (i >> 1)
#define left(i)         (i << 1)
#define right(i)        (left(i) | 1)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());


// int gcd (int a, int b) {
//   if (b == 0) return a;
//   else return gcd (b, a % b);
// }
// int gcd(int a, int b, int& x, int& y) {
//   if (b == 0) {
//     x = 1;
//     y = 0;
//     return a;
//   }
//   int x1, y1;

//   int d = gcd(b, a % b, x1, y1);
//   x = y1;
//   y = x1 - y1 * (a / b);
//   return d;
// }
// int lcm (int a, int b)  {
//   return a / gcd(a, b) * b;
// }
// int fact (int n){
//   if (n == 0) return 1 ;
//   else return n * fact(n - 1);
// }

// bool isPrime(int x) {
//   for (int d = 2; d * d <= x; d++) if (x % d == 0) return false;
//   return true;
// }

// int divisor(int number)
// {
//         int i;
//         for (i = 2; i <= sqrt(number); i++)
//         {
//                 if (number % i == 0)
//                 {
//                        return number/i;
//                 }
//         }
//         return 1;
// }

void c_p_c()
{
      ios_base::sync_with_stdio(0);
      cin.tie(0);cout.tie(0);
}


void solve()
{
      string s; cin >> s;
      if (s[0] == 'R' and s[1] == 'R' and s[2] == 'R')
      {
            cout << 3 << endl;
            return;
      }

      if ((s[0] == 'R' and s[1] == 'R') or (s[1] == 'R' and s[2] == 'R'))
      {
            cout << 2 << endl;
            return;
      }

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

}
int32_t main()
{
     // c_p_c();
      //w(x)
      solve();
      return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<map>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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

string S;
ll N,ans=0;
map<string,int> m;

int main(){
    cin>>N;
    rep(i,N){
        cin>>S;
        sort(S.begin(),S.end());
        ans+=m[S]++;
    } 
    out(ans);
    
}


Measured memory_bytes: 11136
import java.util.*;
import static java.lang.System.*;

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int N = sc.nextInt();
    int rank[] = new int[9];
    for(int i=0; i<N; i++){
      int a = sc.nextInt();
      if(a < 3200) rank[a / 400]++;
      else rank[8]++;
    }
    int min = 0;
    for(int i=0; i<8; i++){
      if(rank[i] > 0) min++;
    }
    int max = min + rank[8];
    if(min == 0){
      min = 1;
      max = rank[8];
    }
    out.println(min + " " + max);
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}

Measured memory_bytes: 22228
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define ld long double
#define oo 2e18
#define OS tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 1e5 + 5;
int n, m, H[N];
bool v[N];

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        cin >> H[i];
    }
    for (int i = 0; i < m; i++) {
        int u, v1;
        cin >> u >> v1;
        if (H[u] >= H[v1]) {
            v[v1] = 1;
        }
        if (H[v1] >= H[u]) {
            v[u] = 1;
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (v[i]) ans++;
    }
    cout << n - ans;
    return 0;
}

Measured memory_bytes: 4044