akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
int n,t=1,u=4;
int main(){
	scanf("%d", &n);
	for(;t*2<=n;t*=2);
	if(t==n) return 0*puts("No");
	puts("Yes");
	printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n",n+1,n+1,n+2,n+2,n+3);
	for(;u<n;u+=2) printf("%d %d\n%d 1\n1 %d\n%d %d\n", u+1,u,u,u+n+1,u+n+1,u+n);
	if(n==u) printf("%d %d\n%d %d\n", n,u^t,t+1+n,n*2);
}

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

#define M 1000000007
#define maxn 200005

#define bitk(a, i) ((a >> i)&1)

using namespace std;
typedef long long ll;

int mul(int a, int b) {
  return int(ll(a) * ll(b) % M);
}

int norm(int a) {
  a = mul(a, 1);
  return (a < 0 ? a + M : a);
}

int n;

int a[maxn], b[maxn];
int cnt[maxn];

int h[maxn];
int p[maxn];

int get(int i) {
  if (i == 0) return h[n - 1];
  return norm(mul(norm(h[n - 1] - mul(h[i - 1], p[n - i])), p[i]) + h[i - 1]);
}

void solve(int k, int ok) {
  int H = 0;
  for (int i = 0; i < n; ++i)
    H = norm(mul(H, 2) + bitk(b[i], k));

  h[0] = bitk(a[0], k) ^ ok;
  for (int i = 1; i < n; ++i)
    h[i] = mul(h[i - 1], 2) + (bitk(a[i], k) ^ ok);

  for (int i = 0; i < n; ++i)
    if (get(i) == H)
      cnt[i] ++;
}

int main(){
  #define TASK "ABC"
 // freopen(TASK".inp", "r", stdin); freopen(TASK".out", "w", stdout);
  ios_base::sync_with_stdio(0);

  cin >> n;

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

  for (int i = 0; i < n; ++i)
    cin >> b[i];

  p[0] = 1;

  for (int i = 1; i <= n; ++i)
    p[i] = mul(p[i - 1], 2);

  for (int i = 0; i < 30; ++i) {
    solve(i, 0);
    solve(i, 1);
  }

  for (int i = 0; i < n; ++i)
    if (cnt[i] == 30)
      cout << i << ' ' << (b[0] ^ a[i]) <<  '\n';

  return 0;
}


Measured memory_bytes: 7424
#include "bits/stdc++.h"

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=n-1;i>=m;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-9

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

typedef long long ll;
using namespace std;


pair<string,int> convert(string s, int l) {
	FOR(i, s.size(), l) s = '0' + s;
	vector<char> v(l);
	REP(i, l) v[i] = s[i];
	sort(ALL(v));
	int amin = 0;
	RREP(i, l) amin += (v[i]-'0') * int(pow(10, l-i-1));

	sort(ALL(v), greater<char>());
	int amax = 0;
	RREP(i, l) amax += (v[i]-'0') * int(pow(10, l-i-1));
	int a = amax - amin;
	string ret = "";
	int tmp = a;
	REP(i, l) {
		ret = char(tmp%10+int('0'))+ret;
		tmp /= 10;
	}
	return{ ret,a };
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int i, j;
	while (1) {
		string s;
		int l;
		cin >> s >> l;
		if (!l) break;
		vector<string> v;
		v.push_back(s);
		while (1) {
			string t = convert(s, l).first;
			int ans = convert(s, l).second;
			v.push_back(t);
			REP(k, v.size() - 1) {
				if (v[k] == t) {
					j = k;
					i = v.size();
					cout << j << " " << ans << " " << i - j-1 << endl;
					goto hoge;
				}
			}
			s = t;
		}
	hoge:;
	}
	return 0;
}

Measured memory_bytes: 3352
#include<bits/stdc++.h>
using namespace std;
const int INF=2E5;
typedef pair<int,int> Pair;

int main(){
    vector<Pair> B;
    vector<Pair> R;
    int N;
    cin >> N;
    int tmp,tmp2;
    for(int i=0;i<N;i++){
        cin >> tmp >> tmp2;
        R.push_back(Pair(tmp,tmp2));
    }
    for(int i=0;i<N;i++){
        cin >> tmp >> tmp2;
        B.push_back(Pair(tmp,tmp2));
    }
    sort(
        B.begin(),
        B.end(),
        [](const Pair& x, const Pair& y){return x.first < y.first;}
    );
    sort(
        R.begin(),
        R.end(),
        [](const Pair& x, const Pair& y){return x.first < y.first;}
    );
    int pd[110]={0};
    int ix=INF;
    int ans=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(R.at(j).first > B.at(i).first)break;
            if(R.at(j).second < B.at(i).second){
                if(ix==INF && pd[j]==0) ix=j;
                else if(pd[j]==0){
                    if(R.at(j).second > R.at(ix).second) ix=j;
                }
            }
        }
        if(ix!=INF){
            pd[ix]=1;
            ix=INF;
            ans++;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
Q, H, S, D = gets.chomp.split(' ').map(&:to_i)
N = gets.chomp.to_i

unit_min = [Q * 4, H * 2, S].min
double_min = [Q * 8, H * 4, S * 2, D].min

a = (N / 2)*double_min
print "#{a + (N % 2) * unit_min}"

Measured memory_bytes: 1788
#include <stdio.h>

int gcd(int x,int y){int z;while(y!=0){z=x%y;x=y;y=z;}return x;}

int main(void) {
	int w,h,g,c;
	scanf("%d%d%d",&w,&h,&c);
	g=gcd(w,h);
	printf("%d\n",w*h*c/(g*g));
	return 0;
}

Measured memory_bytes: 1860
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define rep(i, n) for(int i=0; i<n; ++i)
#define REP(i, n) for(int i=1; i<=n; ++i)
#define all(obj) (obj).begin(), (obj).end()
const int inf = 1e9;
const ll INF = 1e18;
const ll MOD = 1e9+7;
const ll MAX = 1e9+7;

int main(){
    int x, n, tmp; cin >> x >> n;
    set<int> p;
    rep(i, n){
        cin >> tmp;
        p.insert(tmp);
    }
    bool found = false;
    int change = -1;
    while(!found){
        if(p.count(x) == 0){
            found = true;
            cout << x << endl;
        }
        else{
            x += change;
            if(change > 0) change = (change + 1)*(-1);
            else change = (change - 1)*(-1);
        }
    }
    return 0;
}

Measured memory_bytes: 3636
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[]ss = S.toCharArray();
        ArrayList<Integer>ans  = new ArrayList<>();
     
        for(int i=0; i<S.length()-2; i++) {
        int A = (ss[i]-48)*100 +(ss[i+1]-48)*10+ (ss[i+2]-48);
        int a = 753 - A;
        	
		a = Math.abs(a);
		ans.add(a);
        }    
        Collections.sort(ans);
        
            System.out.println(ans.get(0));
    }
}

Measured memory_bytes: 35688
#ABC088C
C = []
for i in range(3):
    C.append(list(map(int, input().split())))

for i in range(2):
    for j in range(2):
        if C[i][j]-C[i][j+1]!=C[i+1][j]-C[i+1][j+1] or C[i][j]-C[i+1][j]!=C[i][j+1]-C[i+1][j+1]:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
long long n,j,i,a[100001];
int main()
{
	pair<int, int>x[100001];
	
	cin >>n;
	
	for (i=1; i<=n; i++)
	{
	cin >>a[i];
	x[i].first=a[i];
	x[i].second=i;
	}
	
	sort(x+1, x+1+n);
	
	for (i=1; i<=n; i++)
	cout <<x[i].second<<" ";
	
	cout <<endl;

	return 0;
}

Measured memory_bytes: 2432
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
SA = set(A)
CA = Counter(A)

if len(SA) == 1 and list(SA)[0] == 0:
    print("Yes")
    exit()

if len(SA) == 2 and 0 in SA and CA[0] * 3 == N:
    print("Yes")
    exit()

for v in CA.values():
    if 3 * v != N:
        break
else:
    a, b, c = CA.keys()
    if a ^ b ^ c == 0:
        print("Yes")
        exit()

print("No")

Measured memory_bytes: 20888
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

immutable limit = 55555;

void main() {
    int N; scan(N);
    auto primes = eratos(limit + 1);
    auto b = primes.filter!(x => x % 10 == 3).array;
    writefln("%(%s %)", b.take(N).array);
    //writeln(b);
    //writeln(b.length);
}

int[] eratos(int N) {
    auto s = new bool[](N);
    s[] = 1;
    s[0] = s[1] = 0;

    for (int p = 2; p*p < N; p++) {
        if (s[p]) {
            for (int q = p*p; q < N; q += p) {
                s[q] = 0;
            }
        }
    }

    return iota(N).filter!(i => s[i]).array;
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 380
$n = gets.to_i
INF = 1 << 30
$m = Array.new($n){ Array.new }
$n.times do
  l = gets.split.map(&:to_i)
  (1..l[1]).each{ |i| $m[l[0]] << [l[2*i],l[2*i+1]] }
end
$n.times{ |i| $m[i].sort! }

def dijkstra(x)
  cost = Array.new($n, INF)
  cost[x] = 0
  used = Array.new($n)
  while true
    m = INF
    $n.times{ |i| m = cost[i] if !used[i] && m > cost[i] }
    break if m == INF 
    $n.times do |i|
      if m == cost[i]
        used[i] = true
        $m[i].each do |r|
          u, w = r
          if cost[i] + w < cost[u]
            cost[u] = cost[i] + w
          end
        end
      end
    end
  end
  cost
end
ret = dijkstra(0)
ret.each_index{ |i| puts "#{i} #{ret[i]}" }

Measured memory_bytes: 46220
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pa;
typedef unsigned int uint;
typedef unsigned long long ull;
int main() {
	int n, k,a[1005];
	cin >> n>>k;
	for (int i = 0; i < n; i++)cin >> a[i];
	sort(a, a + n);
	int sum=0;
	for (int i = 0; i < k; i++)sum += a[i];
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main (){
  int n,count;
  cin >> n;
  vector<int>a(n);
  for (int i=0;i<n;i++)
    cin >> a.at(i);
  sort (a.begin(),a.end());
  cout <<a.at(n/2)-a.at(n/2-1)<< endl;
}


Measured memory_bytes: 640
n=int(input())
l=list(map(int,input().split()))
sl=sum(l)
if sl%(n*(n+1)//2):
    print("NO")
    quit()
t=sl//(n*(n+1)//2)
x=0
for i in range(n):
    if (l[i-1]-l[i]+t)%n or (l[i-1]-l[i]+t)//n<0:
        print("NO")
        quit()
    else:
        x+=(l[i-1]-l[i]+t)//n
if t==x:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 14252
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 r;
int main() {
  cin >> r;
  cout << 3 * r * r << endl;
  return 0;
}


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

int n, m;
int u[100], v[100], w[100];

void add(int x, int y, int z)
{
	++m; 
	u[m] = x, v[m] = y, w[m] = z;
}
int main()
{
	int L, b[30] = {0}, k = 0;
	cin >> L;
	while (L) b[k++] = L&1, L >>= 1;
	n = 1, m = 0; 
	int x = 1;
	for (int i = k-2; i >= 0; --i)  
	{
		add(n, n+1, 0);
		add(n, n+1, x);
		x <<= 1;
		++n;
		if (b[i]) add(1, n, x), x++;
	}
	assert(n<=20 && m <= 60);
	printf("%d %d\n", n, m);
	for (int i = 1; i <= m; ++i)
		printf("%d %d %d\n", u[i], v[i], w[i]);
  	return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())

if k == 0:
    ans = n**2
    print(ans)
    exit()

ans = 0
for b in range(1, n+1):
    if b <= k:
        continue
    q, r = divmod(n, b)
    if r < k:
        ans += ((b-1)-k+1)*q
    else:
        ans += ((b-1)-k+1)*q + r-k+1
print(ans)


Measured memory_bytes: 39408
import java.util.*;

import sun.font.TrueTypeFont;

import static java.lang.System.out;

public class Main{
   public static Scanner sc = new Scanner(System.in);
   public static void main(String args[]){
      // String str = sc.next();
      // int i = str.split("x").length;
      // out.println(700 + i * 100);

      int A = sc.nextInt();
      int B = sc.nextInt();
      int C = sc.nextInt();
      int X = sc.nextInt();
      int Y = sc.nextInt();

      int result =  A * X + B * Y;
      
      int dife = Math.abs(X-Y);//差
      int min = Math.min(X,Y);//小さいほう
      int result2 = 0;
      if ( X > Y){
         result2 = C * 2 * min;
         result2 +=  Math.min(dife * A , dife * C * 2);
      }else {
         result2 = C * 2 * min ;
         result2 +=  Math.min(dife * B , dife * C * 2);
      }
      out.println(Math.min(result,result2));
   }

}

Measured memory_bytes: 21844
// Created by AboAbdoMC
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long

using namespace std;
using namespace __gnu_pbds;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const int OO = 1e9+7;
const int MOD = 1e9+7;
const int N = 1e5+7;

int a[N];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;cin >> n;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    int ans = 0;
    rep(i,n)
    {
    	if (i == 0) a[i] = 0;
    	else if (v[i] <= v[i-1]) a[i] = a[i-1]+1;
    	else a[i] = 0;
    	ans = max(ans,a[i]);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 1024
// Try AtCoder
// author: Leonardone @ NEETSDKASU

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 n = get!();
    let m = get!();
    let s = get().as_bytes();
    let t = get().as_bytes();
    
    if s[0] != t[0] {
        println!("-1");
        return;
    }
    let gcd = gcd(n, m);
    let lcm = (n / gcd) * (m / gcd) * gcd;
    
    let mut xs = vec![];
    for i in 0..s.len() {
        let j = (lcm / n) as usize * i;
        let c = s[i];
        xs.push((j, c));
    }
    for i in 0..t.len() {
        let j = (lcm / m) as usize * i;
        let mut lp = 0;
        let mut rp = xs.len();
        while lp < rp {
            let hp = (lp + rp) / 2;
            if xs[hp].0 < j {
                lp = hp + 1;
            } else {
                rp = hp;
            }
        }
        if lp < xs.len() && xs[lp].0 == j && xs[lp].1 != t[i] {
            println!("-1");
            return;
        }
    }
    
    println!("{}", lcm);
    
    
}

fn gcd(a: i64, b: i64) -> i64 {
    fn _gcd(x: i64, y: i64) -> i64 {
        if x == 0 { y } else { _gcd(y % x, x) }
    }
    if a < b { _gcd(a, b) } else { _gcd(b, a) }
}

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

ll W, H, x, y;

int main(){
  cin >> W >> H >> x >> y;
  cout << W * H / 2.0 << " ";
  if( x == W/2.0 && y == H/2.0) {
    cout << 1<<endl;
  }else{
    cout << 0<<endl;
  }

}


Measured memory_bytes: 256
A = STDIN.gets.chomp.split('')
B = STDIN.gets.chomp.split('')
C = STDIN.gets.chomp.split('')

shifted = A.shift
while true do
  if shifted == 'a'
    if A.size == 0
      puts 'A'
     break
    end
    shifted = A.shift
  elsif shifted == 'b'
    if B.size == 0
      puts 'B'
      break
    end
    shifted = B.shift
  elsif shifted == 'c'
    if C.size == 0
      puts 'C'
      break
    end
    shifted = C.shift
  end
end


Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>
#include <queue>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;


// a,bの最小公倍数
ll lcm(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll gcd(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}
// MOD
ll modadd(ll a, ll b){return (a%MOD+b%MOD+MOD)%MOD;}
ll modmul(ll a, ll b){return a%MOD*b%MOD%MOD;}
ll modexp(ll a, ll n){if(n==0)return 1; if(n%2==0){ll e=modexp(a,n/2); return modmul(e,e);} return modexp(a,n-1)*a%MOD;}
ll modinv(ll n){return modexp(n%MOD,MOD-2);}
ll modfact(ll n){ll res=1; for (int i=1; i <= n; ++i){res *= i; res %= MOD;} return res;}
ll modncr(ll n, ll r){ll numer=1;ll denom=1;for(int i=1;i<=r;++i){numer=modmul(numer,n-r+i);denom=modmul(denom,i);}return modmul(numer, modinv(denom));}


int main(){


   int n;
   cin >> n;
   ll a[n];
   rep(i,n) cin >> a[i];


   rep(i,n) a[i] *= -1;
   sort(a, a+n);
   rep(i,n) a[i] *= -1;

   ll e = 0;
   ll ee = 0;
   bool stage = true;
   rep(i,n-1) {
       if (stage) {
           if (a[i] == a[i+1]) {
               e = a[i];
               ++i;
               stage = false;
               if (i == n) break;
           }
       }
       else {
           if (a[i] == a[i+1]) {
               ee = a[i];
               break;
           }
       }
   }

    if (ee == 0) cout << 0 << endl;
    else cout << e * ee << endl;



}



//              g++ -std=c++1z



Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class Main
{
	public static void main( String[] args ) throws IOException
	{
		Reader.init(System.in);
		long n = Reader.nextLong();
		String num = String.valueOf(n);
		long res = 0;
		for ( int i = 0 ; i < num.length() ; i++ )
		{
			res = res + Character.getNumericValue(num.charAt(i));
		}
		//System.out.println(res+" RESULT ");
		if ( n%res == 0 )
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
	}
}

/** Class for buffered reading int and double values */
class Reader 
{
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) 
    {
        reader = new BufferedReader(new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) 
        {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
	
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
    
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
}

Measured memory_bytes: 22484
import java.util.Scanner;

public class Main {

	static double avg( int num, int member[] ) {
		double avg = 0;
		int sum = 0;

		for ( int i = 0 ; i < num ; i++ ) {
			sum += member[i];
		}

		avg = (double)sum / (double)num;

		return avg;
	}

	static double std_dev( int num, int member[], double avg ) {
		double std_dev = 0;

		for ( int i = 0 ; i < num ; i++ ) {
			std_dev += Math.pow( ( member[i] - avg ), 2 );
		}

		std_dev =  Math.sqrt( std_dev / num );

		return std_dev;
	}

	public static void main(String[] args) {

		int student_num = 0;
		int[] score;
		double score_avg = 0;
		double std_dev = 0.0;

		Scanner sc= new Scanner( System.in );

		while( true ) {

			student_num = sc.nextInt();

			if( student_num == 0) {
				break;
			}

			score = new int[student_num];

			for ( int i = 0; i < student_num ; i++ ) {
				score[i] = sc.nextInt();
			}

			score_avg = avg( student_num, score );

			std_dev = std_dev( student_num, score, score_avg );

			System.out.println( std_dev );
		}
		sc.close();
	}
}


Measured memory_bytes: 31288
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <list>
#include <set>
#include <map>
#define F first
#define S second
#define pb push_back
#define sz(c) (int)c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vLL vector<LL>
using namespace std;
typedef long long LL;
int v[205][205][2];
vector<vector<int>> a(205, vint(205));
int dp(int i, int j, int n, int m, int c)
{
    int k = 0;
    if (v[i][j][c] != -1)
    {
        return v[i][j][c];
    }
    if (a[i][j] != c)
    {
        k = 1;
    }
    if (i < n && j < m)
    {
        return v[i][j][c] = min(dp(i, j + 1, n, m, a[i][j]), dp(i + 1, j, n, m, a[i][j])) + k;
    }
    else if (j < m)
    {
        return v[i][j][c] = dp(i, j + 1, n, m, a[i][j]) + k;
    }
    else if (i < n)
    {
        return v[i][j][c] = dp(i + 1, j, n, m, a[i][j]) + k;
    }
    else
    {
        return v[i][j][c] = k;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            char e;
            cin >> e;
            if (e == '.')
                a[i][j] = 0;
            else
                a[i][j] = 1;
        }
    }
    for (int i = 1; i <= 101; i++)
    {
        for (int j = 1; j <= 101; j++)
        {
            for (int k = 0; k <= 1; k++)
            {
                v[i][j][k] = -1;
            }
        }
    }
    cout << ceil((double)dp(1, 1, n, m, 0) / 2) << "\n";
    return 0;
}

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

int array[20];
int n;

void bubbleSort()
{
  int flag = 1;
  int tmp;
  while (flag)
  {
    flag = 0;
    for (int i = 0; i < n - 1; i++)
    {
      if (array[i] > array[i + 1])
      {
        tmp = array[i + 1];
        array[i + 1] = array[i];
        array[i] = tmp;
        flag = 1;
      }
    }
  }
}

int main()
{
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
  {
    scanf("%d", &array[i]);
  }
  bubbleSort();
  int sum = 0;
  for (int i = 0; i < n - 1; i++)
  {
    sum += array[i];
  }
  if (sum > array[n - 1])
  {
    printf("Yes\n");
  }
  else
  {
    printf("No\n");
  }
}


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

int main() {
    vector<int> a(9);
    rep(i,3) cin >> a[i*3] >> a[i*3+1] >> a[i*3+2];
    int n;
    cin >> n;
    rep(i,n) {
        int b;
        cin >> b;
        rep(j, 9) if (a[j] == b) a[j] = 0;
    }
    string ans = "No";
    rep(i,3) {
        auto start = next(a.begin(),i*3);
        int sumVer = accumulate(start,next(start, 3),0);
        int sumHor = a[i] + a[i+3] + a[i+6];
        if (sumVer == 0 || sumHor == 0) {
            ans = "Yes";
            break;
        }
    }
    if (ans == "No") {
        int sum1, sum2;
        sum1 = a[0]+a[4]+a[8];
        sum2 = a[2]+a[4]+a[6];
        if (sum1 == 0 || sum2 == 0) ans = "Yes";
    }
    cout << ans << endl;
    return 0;
}

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

signed main(void)
{
	int n, m, tmp, cnt;
	cin >> n >> m;
	vector<P> vec(m);
	rep(i, m) cin >> vec[i].second >> vec[i].first;
	sort(vec.begin(), vec.end());
	cnt = 0;
	tmp = -1;
	rep(i, m)
	{
		if (tmp <= vec[i].second)	
		{
			cnt++;
			tmp = vec[i].first;
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 4032
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

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; }
template<class T>
inline T GCD(T a, T b) { return b ? GCD(b, a % b) : a; }
template<class T>
inline T LCM(T a, T b) { return (a + (b - 1)) / b; }
template<class T>
inline T round_int(T a, T b) {return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int main() {
	ll n, k;
	cin >> n >> k;

	ll sum = 0;
	for (int b = 1; b <= n; ++b) {
		sum += max(0LL, b - k) * (n / b) + max(0LL, n % b - k + 1);
	}
	if (k == 0) sum = n * n;
	cout << sum << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>
#include <numeric>
#include <vector>

using bint = boost::multiprecision::cpp_int;

int main()
{
    int N, x;
    std::cin >> N >> x;
    std::vector<bint> a;
    for (int i = 0; i < N; i++) {
        bint a_;
        std::cin >> a_;
        a.emplace_back(a_);
    }
    bint max = 0;
    for (const auto& a_e : a) {
        max += a_e;
    }
    if (max == x) {
        std::cout << N << std::endl;
        return 0;
    }

    std::sort(a.begin(), a.end());
    bint sum = 0;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        sum += a.at(i);
        if (sum > x) {
            break;
        }
        ans = i + 1;
    }
    if (ans == N) {
        ans = N - 1;
    }
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<algorithm>
#include<utility>
#include<vector>
#include<climits>
#include<queue>
#include<random>

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

using namespace std;

string s;
int k;
int cnt;

int main(int argc, char const *argv[]) {
    cin >> s >> k;
    // cout << s << endl;
    // cout << k << endl;
    for(int i=0;i<s.size();i++){
        if(s[i] == '1'){
            cnt++;
        }else{
            break;
        }
    }
    if(k <= cnt){
        cout << '1' << endl;
    }else
        cout << s[cnt] << endl;

    return 0;
}


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

#ifndef _WIN32
    #define getchar getchar_unlocked
#endif

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
//#define int LLI
#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define F1(i,n) FOR(i,1,n)

typedef long long LLI;
typedef unsigned long long LLU;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<LLI, LLI> pll;
typedef vector<int> vi;

#ifdef ONLINE_JUDGE
ostream cnull(NULL);
#define cerr cnull
#endif

template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',') cerr<<*sdbg++;
  cerr<<"="<<h<<",";
  _dbg(sdbg+1, a...);
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define dbgV(R) {cerr << #R << "=["; for(int e : R) cerr << e << ", "; cerr << "E]\n";}
#define dbgA(R, n) {cerr << #R << "=["; for(int i = 0; i <= n; ++i) cerr << R[i] << ", "; cerr << "E]\n";}
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int MX = 1007, bits = 42;
int a[MX];
int liczek[bits];
vector<LLI> pairs;

void usun(LLI x){
	for(int i = 0; i < bits; ++i)
		if((1ll<<i) & x) --liczek[i];
}

int32_t main()
{
    boost;
    int n, k; cin >> n >> k;
    F1(i, n) cin >> a[i];
    F1(i, n){
		LLI zumo = 0; 
		FOR(j, i, n){
			zumo += a[j];
			pairs.PB(zumo);
			for(int l = 0; l < bits; ++l)
				if((1ll<<l) & zumo) ++liczek[l];
		}
	}
	LLI ans = 0;
	for(int i = 41; i >= 0; --i){
		if(liczek[i] >= k){
			ans += (1ll<<i);
			for(int j = 0; j < SZ(pairs); ++j){
				if(((1ll<<i) & pairs[j]) == 0){
					usun(pairs[j]);
					swap(pairs[j], pairs.back());
					pairs.pop_back();
					--j;
				}
			}
		}
	}
	cout << ans;
}


Measured memory_bytes: 6128
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt() * 2;
        int x = sc.nextInt();
        int y = sc.nextInt();

        long ans = Long.MAX_VALUE;

        for (int i = 0; i < x + y; i++) {
            long value = c * i + Math.max(0, (x - i) * a) + Math.max(0, (y - i) * b);
            if (value < ans) {
                ans = value;
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define rlp(i,a,b) for(int i=a;i>b;i--)
#define ft first
#define sd second
#define pii pair<int,int>
#define all(vect) vect.begin(),vect.end()
#define rall(vect) vect.rbegin(),rend() 
const int num = 200001;
typedef long long ll;
int main()
{
	ll a,b,k;
	cin >> a >> b >> k;
	if(a<=k)
	{
		ll left = k-a;
		cout << 0 << " " << max(b-left,0ll) << "\n";
	}	
	else
	{
		cout << a-k << " " << b << "\n";
	}



	return 0;
}

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



int main(){
  ll mod=1e9+7;

  ll n;
  std::cin >> n;

  ll sum=1;

  ll cntNo09=1;
  ll cntNo0=1;

  for (int i = 1; i <= n ; i++) {
    sum*=10; sum%=mod;
    cntNo09*=8; cntNo09%=mod;
    cntNo0*=9; cntNo0%=mod;
  }


  sum=(sum-cntNo0*2+cntNo09)%mod;
  if(sum<0)sum+=mod;
  std::cout << sum << '\n';



  return 0;
}


Measured memory_bytes: 3628
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
//#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<list>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<setprecision(20)
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1e9+7;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
//llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int i,j,n;cin>>n;
	int A[100];
	for(i=0;i<n;i++){cin>>A[i];}
	for(i=0;i<n;i++){
		for(j=i;j>0&&A[j-1]>A[j];j--){swap(A[j-1],A[j]);}
		for(j=0;j<n;j++){
			cout<<A[j];
			if(j+1<n){cout<<" ";}else{cout<<endl;}
		}
	}
	return 0;
}


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

int main() {
    int n; 
    cin >> n;
    
    
    /*for (int i = 0;i < n; i++) {
        a.at(i) = i;
    }
    */
    int res = 1;
    while (res*2 <= n) res *=2;

    
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class A_170_Five_Variables
    {
        // https://atcoder.jp/contests/abc170/tasks/abc170_a
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var x = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            if (x[0] == 0)
            {
                int result = 1;
                Console.WriteLine(result);
            }
            else if (x[1] == 0)
            {
                int result = 2;
                Console.WriteLine(result);
            }
            else if (x[2] == 0)
            {
                int result = 3;
                Console.WriteLine(result);
            }
            else if (x[3] == 0)
            {
                int result = 4;
                Console.WriteLine(result);
            }
            else if (x[4] == 0)
            {
                int result = 5;
                Console.WriteLine(result);
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28164
#include <iostream>

using namespace std;

int main(void){
	int a,b,c; cin >> a >> b >> c; cin.ignore();
	if(a==b && b==c) cout << 1 << endl;
	else if(a==b || b==c || a==c) cout << 2 << endl;
	else cout << 3 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

#define N 105000

using namespace std;

main(){
  bool data[N];
  for(int i=0;i<N;i++){
    if(i%2==0) data[i]=false;
    else data[i]=true;
  }
  data[1]=false;
  data[2]=true;

  for(int i=3;i<N;i+=2){
    if(data[i]){
      for(int j=i+i;j<N;j+=i){
	data[j]=false;
      }
    }
  }

  int ans[10000];
  for(int i=0, j=0;i<N;i++){
    if(data[i]){
      ans[j++]=i;
      if(j==10000) break;
    }
  }

  while(1){
    int n;
    cin >> n;
    if(n==0) break;

    long long sum=0;
    for(int i=0;i<n;i++){
      sum+=ans[i];
    }

    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>

using namespace std;

// i個目までみたとき、jが作れるか？
bool dp[200][11000];
int main()
{
  int N; cin >> N;
  vector<int> s(N);
  for (int i = 0; i < N; i++) cin >> s[i];
  dp[0][0] = true;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= 10000; j++) {
      dp[i + 1][j] |= dp[i][j];
      dp[i + 1][j + s[i]] |= dp[i][j];
    }
  }

  int ans = 0;
  for (int j = 0; j <= 10000; j++) {
    if (dp[N][j] && j % 10 > 0) ans = j;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

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

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

void solve() {
  LL a, b, c, d;
  cin >> a >> b >> c >> d;
  LL sumb = (b-b/c + b-b/d) - (b-b/lcm(c,d));
  // cout << b-b/c << endl;
  // cout << b-b/d << endl;
  // cout << b-b/d << endl;
  LL suma = ((a-1)-(a-1)/c + (a-1)-(a-1)/d) - ((a-1)-(a-1)/lcm(c,d));
  cout << sumb - suma << endl;
}

int main() {
	solve();
	return 0;
}


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

int main(void){
  int N;
  long long ans = 1;
  long long Max = 1e18;
  bool ng = false;
  cin >> N;
  long long A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
    if(0 == A[i]){
      cout << 0 << endl;
      return 0;
    }
    if(ng || Max/ans < A[i]){
      ng = true;
    }
    ans *= A[i];
  }
  if(ng) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4384
N, C, K = map(int, input().split())
T = sorted([int(input()) for i in range(N)])
b = 0
i = 0
n = 1
t = T[0]
while i < N - 1:
    if n == C:
        b += 1
        n = 1
        i += 1
        t = T[i]
        if i == N - 1:
            b += 1
            break
        else:
            continue
    if t + K < T[i + 1]:
        b += 1
        n = 1
        i += 1
        t = T[i]
        if i == N - 1:
            b += 1
            break
        else:
            continue
    n += 1
    i += 1
    if i == N - 1:
        b += 1
        break

print(b)

Measured memory_bytes: 8280
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_set>
using namespace std;
typedef unsigned long long ll;
constexpr ll MOD = 1000000007;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; i++){
     cin >> A[i]; 
  }
  double sum = 0;
  for(int i = 0; i < N; i++){
    sum += 1.0/(double)A[i];
  }
  cout << 1.0/(double) sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include"iostream"
#include"fstream"

using namespace std;

int main(){

	ifstream fin;
	ofstream fout;

	fin.open("input.txt");
	fout.open("output.txt");

	int m,n; 							//inputする変数
	int a[6],b[6];						//inputする配列(一桁ずつ)
	int c[21] = { 0 };					//a[]からb[]を引いた結果
	int log = 10, tmp, i, j, k = 0;		//制御用
	bool finish = false;				//breakフラグ

	while (true){
		cin >> m >> n;
//		cout << "fin >>" << m << " " << n << endl<<endl;
		if (n == 0 && m == 0)break;		//最後まで来たらbreak

		for (i = 0; i < 6; i++)a[i] = b[i] = 0;
		for (i = 0; i < 20; i++)c[i]= 0;
		log = 10;
		k = 0;

		for (i = 0; i < n; i++){//a[]に値を代入
			a[i] = m%log / (log/10);
			b[i] = a[i];
			log *= 10;
		}

		while (true){

			if (m == 0 && n == 1){
			//	fout << 0 << " " << 0 << " " << 1 << endl;
				cout << 0 << " " << 0 << " " << 1 << endl;
				finish = true;
			}

			for (i = n; i > 0; i--){//a[]を最大に(bubble sort)
				for (j = 0; j < i - 1; j++){
					if (a[j] < a[j + 1]){
						tmp = a[j];
						a[j] = a[j + 1];
						a[j + 1] = tmp;
					}
				}
			}
			for (i = 6; i > 0; i--){//b[]を最小に(bubble sort)
				for (j = 0; j < i - 1; j++){
					if (b[j] > b[j + 1]){
						tmp = b[j];
						b[j] = b[j + 1];
						b[j + 1] = tmp;
					}
				}
			}
			log = 1;//初期化
			for (i = n; i > 0; i--){
				c[k] += a[i - 1] * log;
				log *=10;
			}
//			cout << "a[ ] : " << c[k] << endl;

			c[k] -= b[0] * 100000 + b[1] * 10000 + b[2] * 1000 + b[3] * 100 + b[4] * 10 + b[5];

//			cout << "b[ ] : " << b[0] * 100000 + b[1] * 10000 + b[2] * 1000 + b[3] * 100 + b[4] * 10 + b[5] << endl;

//			cout << "c["<<k<<"] : " << c[k] << endl;

			if (c[k] == m){
			//	fout << 0 << " " << c[k] << " " << k+1 << endl;
				cout << 0 << " " << c[k] << " " << k+1 << endl;
				finish = true;
			}
			if (finish == false){
				for (i = 0; i < k; i++){
					if (c[k] == c[i]){
			//			fout << i+1 << " " << c[k] << " " << k - i << endl;
						cout << i+1 << " " << c[k] << " " << k - i << endl;
						finish = true;
					}
				}
			}
//			cout << "閑話休題" << endl;

			for (i = 0; i < 6; i++)a[i] = b[i] = 0;//初期化
			log = 10;//初期化

			for (i = 0; i < n; i++){//a[]に値を代入
				a[i] = c[k]%log / (log / 10);
				b[i] = a[i];
				log *= 10;
			}
			k++;
			if (k > 20 || finish == true){
				finish = false;
				break;
			}
		}
	}
	return 0;
}

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

int main(){
    string s; cin >> s;

    long long cnt =0;
    long long ans = 0;
    int flg =false;
    for(int i=0; i<s.length(); i++){
        if(s.at(i)=='B'){
            cnt++;
        }else{
            ans += cnt;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3760
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);

	int a,b,c,k;
	cin >> a >> b >> c >> k;
	int res = 0;
	if (k <= a) {
		cout << k << endl;
	} else {
		k -= a;
		res += a;
		if (k <= b) {
			cout << res << endl;
		} else {
			k -= b;
			res = res - k;
			cout << res << endl;
		}
	}
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define fi first
#define se second
#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 srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  cout<<c-min(c,a-b)<<endl;;
  return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

/*
  UnionFind Tree
*/
class UnionFind {
    private: 
        vector<int> par;
        vector<int> rank;
        vector<int> cnt;
    
    public:
        UnionFind(int n);
        int find(int x);
        void unite(int x, int y);
        bool same(int x, int y);
        int count(int x);
        void printStatus();
};

UnionFind::UnionFind(int n) {
    for (int i = 0; i < n; i++) {
        par.push_back(i);
        rank.push_back(0);
        cnt.push_back(1);
    }
}
int UnionFind::find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
}
void UnionFind::unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rank[x] < rank[y]) {
        cnt[y] += cnt[x];
        par[x] = y;
    } else {
        cnt[x] += cnt[y];
        par[y] = x;
        if (rank[x] == rank[y]) rank[x]++;
    }
}
bool UnionFind::same(int x, int y) {
    return find(x) == find(y);
}
int UnionFind::count(int x) {
    return cnt[find(x)];
}
void UnionFind::printStatus() {
    printf("----------------\n");
    for (int i = 0; i < par.size(); i++) {
        printf("[node %d]: parent = %d, rank = %d, count = %d\n", i, par[i], rank[i], cnt[i]);
    }
}

int main() {

    int N, M;
    cin >> N >> M;
    vector<vector<int>> L(M);
    rep(i,N) {
        int K, l;
        cin >> K;
        rep(j,K) {
            cin >> l;
            l--;
            L[l].push_back(i);
        }
    }

    UnionFind tree(N);

    rep(i,M) {
        if (L[i].size() <= 1) continue;
        rep(j,L[i].size()-1) tree.unite(L[i][j], L[i][j + 1]);
    }

    cout << (tree.count(0) == N ? "YES" : "NO") << endl;
    
    return 0;
}

Measured memory_bytes: 7844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF=9e+7;

int main(){
    ll N,K;cin >> N >> K;
    vector<vector<ll> > s(N);

    for(ll i=0;i<N;++i){
        ll t,d;cin >> t >> d;--t;
        s[t].push_back(d);
    }

    //ネタ毎においしさ基礎ポイントで降順にソート
    for(auto& v: s){
        sort(v.begin(),v.end(),greater<ll>());
        if(v.empty())v.push_back(-INF);
    }
    //ネタのおいしさ基礎ポイントの最大値でソート
    sort(s.begin(),s.end(),[&](vector<ll> a, vector<ll> b){
        return a[0] > b[0];});

    ll cur=0;
    priority_queue<ll> que;
    //K種類選ぶ
    for(ll i=0;i<K;++i){
        cur+=s[i][0];
        for(ll j=1;j<s[i].size();++j){
            que.push(s[i][j]);
        }
    }
    for(ll i=K;i<N;++i){
        for(int j=0;j<s[i].size();++j){
            que.push(s[i][j]);
        }
    }

    ll res=cur+K*K;
    for(ll i=K-1;i>=1;--i){
        ll v=s[i][0];
        ll w=que.top();
        if(v<w){
            que.pop();cur+=w;
            que.push(v);cur-=v;
        }
        res=max(res,cur+i*i);
    }
    cout << res << endl;
}

Measured memory_bytes: 8696