akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

#define MAX 40

int n, pos, k;
int PRE[MAX];
int IN[MAX];
int POS[MAX];

void Postorder (int l, int r) {
    if (l >= r) return;
    int root = PRE[pos++];
    int target = 0;
    for (int i = 0; i < n; ++i) {
        if (IN[i] == root) {
            target = i;
            break;
        }
    }

    Postorder(l, target);
    Postorder(target + 1, r);
    POS[k++] = root;
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &PRE[i]);
    }
    for (int i = 0; i < n; ++i) {
        scanf("%d", &IN[i]);
    }

    k = pos = 0;
    Postorder(0, n);

    for (int i = 0; i < n; ++i) {
        if (i > 0) printf(" ");
        printf("%d", POS[i]);
    }
    printf("\n");
}

Measured memory_bytes: 2752
from string import ascii_lowercase as asc
n = int(input())
card = []
point = [0,0]
for i in range(n):
	card.append(list(map(str,input().split())))
for k in range(len(card)):
	if card[k][0] == card[k][1]:
		point[0] += 1
		point[1] += 1
	elif card[k][0] == card[k][1][:len(card[k][0])]:
		point[1] += 3
	elif card[k][1] == card[k][0][:len(card[k][1])]:
		point[0] += 3
	else:
		s = 0
		while True:
			if card[k][0][s] == card[k][1][s]:
				s += 1
			else:
				break
		for kk in asc:
			if card[k][0][s] == kk:
				point[1] += 3
				break
			elif card[k][1][s] == kk:
				point[0] += 3
				break
print(" ".join(list(map(str,point))))


Measured memory_bytes: 6876
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
	int i = 0, x;

	while (i <= 10000) {
		scanf("%d", &x);
		if (x == 0) {
			break;
		}
		i++;
		printf("Case %d: %d\n", i, x);
	}
	return 0;
}


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
ll INF = LLONG_MAX;
ll MOD = 1e9+7;

using vc = vector<char>;
using vi = vector<int>;
using vll = vector<ll>;

const ll MAXN = 200002;

vll fact (MAXN);
vll inv (MAXN);
vll invfact (MAXN);

ll choose(ll n, ll k) {
    return fact[n] * invfact[k] % MOD * invfact[n-k] % MOD;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ll H, W, A, B; cin >> H >> W >> A >> B;

    fact[0] = 1;
    FOR(i, 1, MAXN) fact[i] = fact[i-1] * i % MOD;

    inv[1] = 1;
    FOR(i, 2, MAXN) inv[i] = (MOD - (MOD/i) * inv[MOD%i] % MOD) % MOD;

    invfact[0] = 1;
    FOR(i, 1, MAXN) invfact[i] = invfact[i-1] * inv[i] % MOD;

    ll ans = 0;
    ll rekt = 0;
    F0R(i, H - A) {
        ans = (ans + (choose(B + i, B) - rekt) * choose(H - i - 1 + W - B - 1, W - B - 1) % MOD) % MOD;
        rekt += choose(B + i, B) - rekt; 
    }
    cout << (ans + MOD) % MOD<< endl;
}

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

using namespace std;

typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
	
	ll a, b, c;
	cin >> a >> b >> c;
	
	ll x = c % b;
	for (int i = 1; i <= 1000000; i++) {
		if ((a * i % b) == x) {
			cout << "YES" << endl;
			return 0;
		}
	}

	cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int, int> P;
 
int main(){
  int n;
  cin >> n;
  vector<int> a(n-1);
  rep(i, n-1) cin >> a[i];

  vector<int> b(n, 0);
  for(int i=0; i<n-1; i++){  
    b[a[i]-1]++;
  }
  rep(i, n) cout << b[i] << endl;
  return 0;
}

Measured memory_bytes: 4788
#!/usr/bin/env python3
import sys
import math
def combinations_count(n, r):
    if n<r:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def solve(N: int, s: "List[str]"):
    s_dict = {}    
    for i in range(N):
        ss = ''.join(sorted(list(s[i])))
        if s_dict.get(ss) == None:
            s_dict[ss] = 1
        else:
            s_dict[ss] += 1
    answer = 0
    for _,value in s_dict.items():
        answer += combinations_count(value,2)


    print(answer)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, s)

if __name__ == '__main__':
    main()


Measured memory_bytes: 25040
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int ha,ma,h,m,k,i,ans;
    cin>>ha>>ma>>h>>m>>k;
  ans=60-ma+m;
  i=h-ha-1;
  i=i*60;
  ans=ans+i;
  ans=ans-k;
  cout<<ans<<endl;
  return 0;
}


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

int calcGCD(int l, int s){
    int a = s, b = l % s;
    while (b != 0) {
        int t = a;
        a = b;
        b = t % b;
    }
    return a;
}

int main(){
    int x, y; cin >> x >> y;
    if (y > x) swap(x, y);
    cout << calcGCD(x,y) << endl;
}

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

int main()
{
    int n, x, t;
    cin >> n >> x >> t;

    cout << (n + (x - 1)) / x * t << endl;
    return 0;
}


Measured memory_bytes: 3628
package main

import(
    "fmt"
)



func main() {
    var a,b,c,d int
    fmt.Scan(&a,&b,&c,&d)
    ans := "Balanced"
    switch{
        case a+b > c+d:
            ans = "Left"
        case a+b < c+d:
            ans = "Right"
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}


Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });

            var NX= Sarray();
            var N = NX[0];
            var x = NX[1];
            var ai = Sarray();
            Array.Sort(ai);
            var ans = 0;
            for (var i = 0; i < N - 1; ++i)
            {
                if (ai[i] <= x)
                    ++ans;
                x -= ai[i];
            }
            if (x == ai[N - 1])
                ++ans;
            WriteLine(ans);
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13524
#include <algorithm>
#include <iostream>
#include <vector>
#include <functional>
using namespace std;

template<typename Monoid>
struct SegmentTree {
    using F = function<Monoid(Monoid, Monoid)>;
    const F f;
    const Monoid M1;
    int sz;
    vector<Monoid> dat;
    SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
        sz = 1;
        while (sz < n) sz <<= 1;
        dat.assign(sz * 2, M1);
    }
    void set(int k, const Monoid &x) { dat[k + sz] = x; }
    void build() {
        for (int k = sz - 1; k > 0; k--) {
            dat[k] = f(dat[2 * k], dat[2 * k + 1]);
        }
    }
    void update(int k, const Monoid &x) {
        dat[k += sz] = x;
        while (k >>= 1) dat[k] = f(dat[2 * k], dat[2 * k + 1]);
    }
    Monoid get(int a, int b) {  // [a, b)
        Monoid L = M1, R = M1;
        for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
            if (a & 1) L = f(L, dat[a++]);
            if (b & 1) R = f(dat[--b], R);
        }
        return f(L, R);
    }
    Monoid operator[](const int &k) const { return dat[k + sz]; }
    friend ostream& operator<<(ostream& os, SegmentTree<Monoid> &seg) {
        for (int i = 0; i < seg.sz; i++) os << seg[i] << " ";
        return os;
    }
};

int main() {
    const int MAX = 1e5;
    int n; cin >> n;
    vector<int> a(n);
    for (int &ai: a) cin >> ai;
    using P = pair<int, long long>;
    auto f = [](const P &a, const P &b) { return max(a, b); };
    SegmentTree<P> seg(MAX + 1, f, {0, 0});
    for (int ai: a) {
        auto p = seg.get(0, ai);
        seg.update(ai, max(seg[ai], {p.first + 1, p.second + ai}));
    }
    cout << seg.get(0, MAX + 1).second << endl;
    return 0;
}


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

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

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using dijkstra = priority_queue<T, vector<T>, greater<T>>;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define fbo find_by_order  // k th index
#define ook order_of_key   // strictly smaller than k
#define PI acos(-1.0)
#define inf 0x3f3f3f3f
#define max_ull 18446744073709551615
#define max_ll 9223372036854775807
#define lead_zero(x) __builtin_clzll(x)
#define trail_zero(x) __builtin_ctzll(x)
#define total_1s(x) __builtin_popcountll(x)
#define first_1(x) __builtin_ffsll(x)
#define log2_(x) __builtin_clz(1) - __builtin_clz(x)
#define isLeap(x) ((x % 400 == 0) || (x % 100 ? x % 4 == 0 : false))
#define QUERY           \
    int test;           \
    scanf("%d", &test); \
    for (int _T = 1; _T <= test; _T++)
#define FAST ios_base::sync_with_stdio(0), cin.tie(0)
#define all(v) v.begin(), v.end()
#define reunique(v) v.resize(std::unique(all(v)) - v.begin())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define ff first
#define ss second
#define MERGE(v1, v2, v) merge(all(v1), all(v2), back_inserter(v))
#define MP make_pair
#define EB emplace_back
#define read freopen("input.txt", "r", stdin)
#define write freopen("output.txt", "w", stdout)
#define in_range(v, r, l) upper_bound(all(v), r) - lower_bound(all(v), l)
#define LCM(a, b) (a / __gcd(a, b)) * b;

ll rdn(int y, int m, int d) {
    /* Rata Die day one is 0001-01-01 */
    if (m < 3)
        y--, m += 12;
    return 365 * y + y / 4 - y / 100 + y / 400 + (153 * m - 457) / 5 + d - 306;
}
/* Direction arrays */
/*int dx[] = {1,-1,0,0}, dy[] = {0,0,1,-1};                             */  // 4Direction
/*int dx[] = {1,-1,0,0,1,1,-1,-1}, dy[] = {0,0,1,-1,1,-1,1,-1};         */  // 8Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1};     */  // KnightDirection
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1};                */  // HexagonalDirection
/* int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; */

int main() {
    string s;
    cin >> s;
    if (s[0] == '7' || s[1] == '7' || s[2] == '7')
        puts("Yes");
    else
        puts("No");
}


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

int main() {
    int r, c;
    int a[101][101];

    for (int i = 0; i < 101; i++ )
        for (int j = 0; j < 101; j++ ) a[i][j] = 0;

    cin >> r >> c;

    for (int i = 0; i < r; i++ ) {
        for (int j = 0; j < c; j++ ) {
            cin >> a[i][j];
            a[i][c] += a[i][j];
            a[r][j] += a[i][j];
            a[r][c] += a[i][j];
        }
    }

    for (int i = 0; i < r + 1; i++ ) {
        for (int j = 0; j < c + 1; j++ ) {
            if ( j > 0 ) cout << " ";
            cout << a[i][j];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3140
n = gets.to_s.to_i
a = [0] + gets.to_s.split.map{|i| i.to_i }

(n/2).downto(1) do |i|
  s = 0
  i.step(n,i).map{|j| s += a[j] }
  a[i] = s & 1
end

ans = (1..n).select{ |i| a[i] == 1 }
puts ans.size, ans * " "

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

using namespace std;

int main(void){
  int W, H, x, y, r;

  cin >> W >> H >> x >> y >> r;

  if ((x - r >= 0 && x + r <= W) && (y - r >= 0 && y + r <= H)){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  } 
}


Measured memory_bytes: 3112
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0220

"""
import sys
from sys import stdin
input = stdin.readline


def solve(f):
    if f >= 256.0:
        return 'NA'
    f *= 16
    int_f = int(f)
    if f != int_f:
        return 'NA'
    bin_f = bin(int_f)[2:]
    fraction_p = bin_f[-4:]
    integer_p = bin_f[:-4]
    return integer_p.zfill(8) + '.' + fraction_p.zfill(4)


def main(args):
    while True:
        f = float(input())
        if f < 0.0:
            break
        result = solve(f)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 7496
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <stack>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long int ll;

int main(){
	int n;
	cin>>n;
	vector<char> chList(n);
	for(int i = 0; i < n ; i++){
		cin>>chList[i];
	}
	int ans = 0;
	
	int leftWhite = -1;
	int rightRed = -1;
	for(int i = 0; i < n; i++){
		if( chList[i] == 'W'){
			leftWhite = i;
			break;
		}
	}
	for(int i = n-1; i >= 0 ; i--){
		if( chList[i] == 'R'){
			rightRed = i;
			break;
		}
	}
	if( rightRed == -1 || leftWhite == -1){
		cout<<0<<endl;
		return 0;
	}
	while( leftWhite < rightRed){
		chList[leftWhite] = 'R';
		chList[rightRed] = 'W';
		ans++;
		int left = leftWhite;
		leftWhite = -1;
		for(int i = left; i < n; i++){
			if( chList[i] == 'W'){
				leftWhite = i;
				break;
			}
		}
		int right = rightRed;
		rightRed = -1;
		for(int i = right; i >= 0; i--){
			if(chList[i] == 'R'){
				rightRed = i;
				break;
			}
		}
		if( rightRed == -1 || leftWhite == -1) break;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3180
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	int X;
	cin>>X;
	int N1=X/100;
	int N2=X/101;
	int N3=X/102;
	int N4=X/103;
	int N5=X/104;
	int N6=X/105;
	for (int n1=0;n1<=N1;n1++){
		for (int n2=0;n2<=N2;n2++){
			for (int n3=0;n3<=N3;n3++){
				for (int n4=0;n4<=N4;n4++){
					for (int n5=0;n5<=N5;n5++){
						for (int n6=0;n6<=N6;n6++){
							if (100*n1+101*n2+103*n3+104*n4+105*n5==X){
								cout<<1<<endl;
								return 0;
							}
						}
					}
				}
			}
		}
	}
	cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int MAXN=1e7+10;
long long f[MAXN],sum=1;
int main()
{
	int n;
	cin>>n;
	for (int i=2;i<=n;i++) f[i]=2,sum+=2*i;
	for (int i=2;i<=n/2;i++)
	{
		int t=i;
		for (int j=2;j*t<=n;j++) f[j*t]++,sum+=j*t;
	}
	cout<<sum;
    return 0;
}


Measured memory_bytes: 81752
#include<stdio.h>
int main(void){
	int m,f,r;
	
	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1&&f==-1&&r==-1){
			break;
		}
		if(m==-1||f==-1){
			printf("F\n");
		}else if(m+f>=80){
			printf("A\n");
		}else if(m+f>=65&&m+f<80){
			printf("B\n");
		}else if((m+f>=50&&m+f<65)||((m+f>=30&&m+f<50&&r>=50))){
			printf("C\n");
		}else if(m+f>=30&&m+f<50){
			printf("D\n");
		}else if(m+f<30){
			printf("F\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1760
N = int(input())
a = list(map(int, input().split()))
gray = 0
brown = 0
green = 0
water = 0
blue = 0
yellow = 0
orange = 0
red = 0
free = 0
for i in range(N):
  if a[i] < 400: gray += 1
  elif a[i] < 800: brown += 1
  elif a[i] < 1200: green += 1
  elif a[i] < 1600: water += 1
  elif a[i] < 2000: blue += 1
  elif a[i] < 2400: yellow += 1
  elif a[i] < 2800: orange += 1
  elif a[i] < 3200: red += 1
  else: free += 1
cnt = 0
if gray: cnt += 1
if brown: cnt += 1
if green: cnt += 1
if water: cnt += 1
if blue: cnt += 1
if yellow: cnt += 1
if orange: cnt += 1
if red: cnt += 1
cntmax = cnt
if free: cntmax = free + cnt
if not cnt: cnt += 1
print(cnt, cntmax)

Measured memory_bytes: 61960
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;

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

    int h, w;
    cin >> h >> w;

    vector<vector<char>> a(h + 2, vector<char>(w + 2, '#'));
    queue<pair<int, int>> que;
    for (int i = 1; i <= h; i++) {
        string s;
        cin >> s;

        for (int j = 1; j <= w; j++) {
            a[i][j] = s[j - 1];
            if (a[i][j] == '#') {
                que.push(make_pair(i, j));
            }
        }
    }
    que.push(make_pair(-1, -1));

    int cnt = 0;
    while (true) {
        pair<int, int> pos = que.front();
        que.pop();

        if (que.empty()) {
            break;
        } else if (pos.first == -1 && pos.second == -1) {
            que.push(make_pair(-1, -1));
            cnt++;
            continue;
        }

        for (int i = 0; i < 4; i++) {
            if (a[pos.first + dy[i]][pos.second + dx[i]] == '.') {
                a[pos.first + dy[i]][pos.second + dx[i]] = '#';
                que.push(make_pair(pos.first + dy[i], pos.second + dx[i]));
            }
        }
    }

    cout << cnt << endl;
}


Measured memory_bytes: 9488
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll N; cin >> N; vl as(N, 0);
    ll f = 0, t = 0;
    REP(i, N){
        ll a; cin >> a;
        if(a % 4 == 0) f++;
        else if(a % 2 == 0) t++;
    }
    ll idx = 2 * f + t;
    if(t == 0) idx++;
    cout << (idx >= N ? "Yes" : "No") << endstr;
    return 0;
}


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

int main() {
	vector<int> V(26, 0);
	string s;
	while (getline(cin, s)) {
		for (int i = 0; i < s.size(); i++) {
			if (s[i] >= 'A' && s[i] <= 'Z')
				s[i] += 'a' - 'A';
			if (s[i] >= 'a' && s[i] <= 'z')
				V[s[i] - 'a']++;
		}
	}
	for (int i = 0; i < 26; i++)
		cout << (char)('a' + i) << " : " << V[i] << endl;
}



Measured memory_bytes: 3200
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{
  ll sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;

  ll w = tx - sx;
  ll h = ty - sy;

  // phase1
  rep(i,h) cout << "U";
  rep(i,w) cout << "R";

  // phase2
  rep(i,h) cout << "D";
  rep(i,w) cout << "L";

  // phase3
  cout << "LU";
  rep(i,h) cout << "U";
  rep(i,w) cout << "R";
  cout << "RD";

  // phase4
  cout << "RD";
  rep(i,h) cout << "D";
  rep(i,w) cout << "L";
  cout << "LU" << endl;


  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

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

  int n, m, q;
  cin >> n >> m >> q;
  int G[500][500] = {};
  rep(i, m) {
    int l, r;
    cin >> l >> r;
    G[l-1][r-1]++;
  }

  rep(i, 500) {
    rep(j, 500-1) {
      G[i][j+1] += G[i][j];
    }
  }

  rep(i, n) {
    rep(j, n) {
      cerr << G[i][j];
    }
    cerr << endl;
  }

  rep(i, q) {
    int P, Q;
    cin >> P >> Q;
    int ans = 0;
    P--; Q--;
    FOR(i, P, Q+1) {
      ans += G[i][Q];
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
const ll mod = 1e9+7;
const ll INF = 1e18;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define Rep(i,a,n) for (ll i = (a); i < (n); ++i)
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
using Graph = vector<vector<ll>>;
using V = vector<ll>;
using P = pair<ll,ll>;

class mint {
public:
    long long x;
    constexpr mint(long long x=0) : x((x%mod+mod)%mod) {}
    constexpr mint operator-() const { 
      return mint(-x);
    }
    constexpr mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr mint& operator*=(const mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    constexpr mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    constexpr mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    constexpr mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    constexpr mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    constexpr mint inv() const {
        return pow(mod-2);
    }
    constexpr mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    constexpr mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }
};
ostream& operator<<(ostream& os, const mint& m){
    os << m.x;
    return os;
}

long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  ll n;
  cin >> n;
  mint ans = 0;
  ans += modpow(10,n,mod) - 2*modpow(9,n,mod) + modpow(8,n,mod);
  cout << ans << '\n';

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define MAX 100006
int a[MAX],dp[MAX];
signed main()
{
	int n,i;
	cin>>n;
	for(i=1;i<=n;i++)
	{
	cin>>a[i];
	dp[i]=10000000000;
}
	dp[1]=0;
	dp[2]=abs(a[2]-a[1]);
	for(i=3;i<=n;i++)
	dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	cout<<dp[n]<<"\n";
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void) {
    int abc;
    scanf("%d",&abc);
    if (abc <= 111) {
        printf("111\n");
    } else if (abc <= 222) {
        printf("222\n");
    } else if (abc <= 333) {
        printf("333\n");
    } else if (abc <= 444) {
        printf("444\n");
    } else if (abc <= 555) {
        printf("555\n");
    } else if (abc <= 666) {
        printf("666\n");
    } else if (abc <= 777) {
        printf("777\n");
    } else if (abc <= 888) {
        printf("888\n");
    } else if (abc <= 999) {
        printf("999\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<algorithm>
using namespace std;
char str[300];
int p[7][7]={
{12,11,13,0,1,2,3},
{11,10,0,1,9,3,4},
{13,0,14,2,3,15,5},
{0,1,2,3,4,5,6},
{1,9,3,4,8,6,7},
{2,3,15,5,6,16,17},
{3,4,5,6,7,17,18}
};
int main(){
	while(1){
		scanf("%s",str);
		if(str[0]=='#')return 0;
		bool ok=true;
		for(int i=0;i<(1<<19);i++){
			int v=0;
			int d=0;
			for(int j=0;j<7;j++){
				int t=0;
				for(int k=0;k<7;k++)if(i&(1<<p[j][k]))t|=(1<<k);
				if(str[t]=='1')v+=(1<<j);
				if(j==3)d=str[t]-'0';
			}
			if(d==1&&str[v]=='0'){
		//		printf("%d %d 0\n",i,v);
				ok=false;break;
			}
			if(d==0&&str[v]=='1'){
		//		printf("%d %d 1\n",i,v);
				ok=false;break;
			}
		}
		if(ok)printf("yes\n");
		else printf("no\n");
	}
}

Measured memory_bytes: 948
N = int(input())
x =list(map(int, input().split()))

cou = []
for i in range(N):
    cc = 0
    while True:
        if x[i] % 2 == 0:
            x[i] /= 2
            cc+=1
        else:
            cou.append(cc) 
            break   
print(min(cou))

Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = Integer.valueOf(scan.nextLine());
		while (N-- > 0) {
			String[] data = scan.nextLine().split(" ", 0);
			int num[] = new int[3];
			for (int i = 0; i < 3; i++) {
				num[i] = Integer.parseInt(data[i]);
			}
			num = sortInteger(num);
			if (Math.pow(num[0], 2) == Math.pow(num[1], 2) + Math.pow(num[2], 2)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
	public static int[] sortInteger(int[] num) {
		int len = num.length;
		for (int i = 0; i < len; i++) {
			for (int j = i+1; j < len; j++) {
				if (num[i] < num[j]) {
					int tmp = num[i];
					num[i] = num[j];
					num[j] = tmp;
				}
			}
		}
		return num;
	}
}

Measured memory_bytes: 31904
let quick_sort (a : (int * char * int) array) cmp =
  let swap i j = let tmp = a.(i) in a.(i) <- a.(j); a.(j) <- tmp in
  let partition p r =
    let rec exchange = function
      | (i, j) when j = r -> swap i r; i
      | (i, j) when cmp a.(j) a.(r) <= 0 -> swap i j; exchange (i + 1, j + 1)
      | (i, j) -> exchange (i, j + 1) in
    exchange (p, p) in
  let rec doit p r =
    if p < r then begin
      let q = partition p r in
      doit p (q - 1);
      doit q r
    end in
  doit 0 (Array.length a - 1)

let stable_p (a : (int * char * int) array) n =
  let rec doit i =
    if i = n then true
    else if (fun (xi, _, xd) (yi, _, yd) -> xd = yd && xi > yi) a.(i-1) a.(i) then false
    else doit (i + 1) in
  doit 1

let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let () =
  let n = read_int () in
  let read i =
    match split_on_char ' ' (read_line ()) with
    | [c; d] -> (i, c.[0], int_of_string d)
    | _ -> exit 1 in
  let a = Array.init n read in
  quick_sort a (fun (_, _, x) (_, _, y) -> compare x y);
  print_endline (if stable_p a n then "Stable" else "Not stable");
  Array.iter (fun (_, c, d) -> Printf.printf "%c %d\n" c d) a

Measured memory_bytes: 9140
def main():
    n = int(input())
    MOD = 10**9 + 7

    if n == 1:
        ans = 0
    elif n == 2:
        ans = 2
    else:
        ans = pow(10, n, MOD) - 2 * pow(9, n, MOD) + pow(8, n, MOD)
        ans %= MOD
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 9072
<?php
  $ary = explode(" ", trim(fgets(STDIN)));
  if ($ary[0] == $ary[1]) {
    print "a == b";
  } elseif ($ary[0] > $ary[1]) {
    print "a > b";
  } else {
    print "a < b";
  }
?>

Measured memory_bytes: 6536
import java.util.*;

public class Main {
  public static void main(String args[]) {
	Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    sc.close();
    
    String T = "";
    for (int i = 0; i < S.length(); i++) {
      T += "x";
    }
    System.out.println(T);
  }
}

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

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//order_of_key(x) : number of items less than x
//find_by_order(x) : iterator to x

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()
#define pi                  3.14159265359
ll INF=1e18+10;
ll MOD=998244353;
ll mod=1e9+7;

const int N=105;
char a[N][N];

int main()
{
    fastio;
    int n,m;cin>>n>>m;
    ll dp[N][N][2];

    rep(i,0,N)rep(j,0,N)a[i][j]='#';
    a[0][1]=a[1][0]='.';
    rep(i,1,n+1)rep(j,1,m+1)cin>>a[i][j];

    rep(i,0,N)rep(j,0,N)dp[i][j][0]=dp[i][j][1]=1e9;
    dp[1][0][0]=dp[0][1][0]=dp[0][1][1]=dp[1][0][1]=0;

    rep(i,1,n+1)
    {
        rep(j,1,m+1)
        {
            if(a[i][j]=='#')
            {
                dp[i][j][0]=min(dp[i-1][j][0],dp[i-1][j][1]) + (a[i-1][j]=='.');
                dp[i][j][1]=min(dp[i][j-1][1],dp[i][j-1][0]) + (a[i][j-1]=='.');
            }
            else
            {
                dp[i][j][0]=min(dp[i-1][j][0],dp[i-1][j][1]);
                dp[i][j][1]=min(dp[i][j-1][0],dp[i][j-1][1]);
            }
        }
    }
    cout<<min(dp[n][m][0],dp[n][m][1]);
}


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  string s;
  cin >> s;

  long foo = s.size(), bar = 0;

  rep (i, s.size()) {
    if (s[i] == 'A') foo = min(foo, i);
    if (s[i] == 'Z') bar = max(bar, i);
  }

  cout << bar - foo + 1 << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 720
#include<iostream>
#include<algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <sstream>

using namespace std;
typedef long long ll;
int d[10001];
int main() {
	cin.sync_with_stdio(0); cin.tie(0); cout.tie(NULL);
	int n; cin >> n;

	for (ll i = 1; i <= 100; i++) {
		for (ll j = 1; j <= 100; j++) {
			for (ll k = 1; k <= 100; k++) {
				ll x = i * i + j * j + k * k + i * j + j * k + i * k;
				if (x <= 10000) {
					d[x] += 1;
				}
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		cout << d[i] << '\n';
	}



}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD 998244353
template<class T>inline bool chmax(T& a,T b){if (a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if (a>b){a=b;return 1;}return 0;}
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

int main() {
    vector<ll> l;
    vector<ll> r;
    ll n;
    cin >> n;
    for (ll i=0;i<n;i++){
        ll a;
        cin >> a;
        if (i%2){
            l.push_back(a);
        }else{
            r.push_back(a);
        }
    }
    if (n%2==0){
        for (ll i=0;i<l.size();i++){
            cout << l[l.size()-1-i] << " ";
        }
        for (ll i=0;i<r.size();i++){
            cout << r[i] << " ";
        }
    }else{
        for (ll i=0;i<r.size();i++){
            cout << r[r.size()-1-i] << " ";
        }
        for (ll i=0;i<l.size();i++){
            cout << l[i] << " ";
        }
    }
    cout << endl;
    return 0;
}

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

int main(){
  int n, m;
  cin >> n >> m;
  priority_queue<pair<int, int>> a;
  for(int i = 0; i < n; i++){
    int k;
    cin >> k;
    a.push({k, 1});
  }
  for(int i = 0; i < m; i++){
    int b, c;
    cin >> b >> c;
    a.push({c, b});
  }
  
  int cnt = 0;
  long long ans = 0;
  while(cnt < n){
    auto now = a.top();
    a.pop();
    long long plus = now.first, num = now.second;
    num = min(num, (long long)n - cnt);
    cnt += num;
    ans += plus * num;
  }
  
  
  cout << ans << endl;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1000000007;

int main() {
    int N; cin >> N;
    vector<ll> A(N);
    vector<int> color(3, 0);
    for (int i=0; i<N; i++) cin >> A[i];
    ll ans = 3;
    color[0] = 1;
    if (A[0] != 0) ans = 0;
    for (int i=1; i<N; i++) {
        int c = 0;
        bool flag = true;
        for (int j=0; j<3; j++) {
            if (A[i] == color[j]) {
                c++;
                if (flag) {
                    color[j]++;
                    flag = false;
                }
            }
        }
        ans *= c;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#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;

int n, a[200000];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    long long ans = 0;
    for(int i = 1; i < n; i++){
        long long up = max(0, a[i - 1] - a[i]);
        a[i] += up, ans += up;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 4392
#include<bits/stdc++.h>
using namespace std;
#define  mem(a,x) memset(a,x,sizeof(a));
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
int main()
{
    ft
    ll t,i,j,n,m,l,r;
    cin>>n>>m;
    ll a[n+1];
    r=1e9+7;
    mem(a,-1);
    a[0]=1;
    for(i=0;i<m;i++)
    {
        cin>>l;
        a[l]=0;
    }
    for(i=1;i<=n;i++)
    {
        if(a[i]==-1)
        {
            if(i-2>=0)
            {
                a[i]=a[i-1]+a[i-2];
            }
            else
            {
                a[i]=a[i-1];
            }
            a[i]%=r;
        }
    }
    cout<<a[n]<<"\n";
    return 0;
}

Measured memory_bytes: 4440
N = int(input())
b = list(map(int, input().split()))
ans = []
for i in range(N):
    # それぞれの数字の余裕度を計算し、余裕度0で一番後ろのやつをとる
    d = -1
    for j in range(N-i):
        if (j+1)-b[j] == 0:
            d = j
    if d == -1:
        print(-1)
        exit()
    else:
        ans.append(b[d])
        del b[d]
[print(a) for a in ans[::-1]]

Measured memory_bytes: 64116
raw_input = input()
l = raw_input.split()
N = int(l[0])
A = int(l[1])
B = int(l[2])

C = A + B

ans = 0

syou = N // C
amari = N % C

ans = syou * A


if amari <= A:
    ans = ans + amari
    print(ans)
else:
    ans = ans + A
    print(ans)

Measured memory_bytes: 3064
import java.util.*;
import java.io.*;

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

		int a = sc.nextInt();
		int b = sc.nextInt();

		System.out.println((a * b) + " " + ((a + b) * 2));

	}
}

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

int main() {
    long long N, D;
    cin >> N >> D;
    int count = 0;

    for(int i = 0; i < N; i++) {
        long long X, Y;
        cin >> X >> Y;
        if(X * X + Y * Y <= D * D) {
            count++;
        }
    }

    cout << count << endl;
}

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

using namespace std;
#define int long long


#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
#define PI 3.1415926535897932384626433832795
int MOD=1e9+7;
int powmod(int a,int l, int md){int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
typedef long long ll; typedef vector<ll> vi; typedef pair<ll, ll> ii; typedef vector<ii> vii;
#define pb push_back
int __set(int b, int i) {return b|(1<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return ((a%md)*(b%md))%md;}
int addmod(int a, int b, int md) {return (a+b)%md;}
int submod(int a, int b, int md) {return (((a-b)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
// priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
	uniform_int_distribution<int> uid(l, r);
	return uid(rng);
}

int solve(string& s1, string& s2) {
	int ret=-1;
	int ln = min(s1.length(),s2.length());
	for(int i = 0; i < ln; i++) {
		if(s1[i]!=s2[i]) {
			ret=i;
			break;
		}
	}
	if(ret==-1)
		ret=ln;
	return ret/2;
}
signed main(void)
{
	IOS;
	// int n,k,m; cin>>n>>k>>m;
	// int vv=n*m;
	// for(int i = 0; i < n-1; i++) {
	// 	int x; cin>>x;
	// 	vv-=x;
	// }
	// if(vv<=0) {
	// 	cout<<0<<endl;
	// } else if(vv > k) {
	// 	cout<<-1<<endl;
	// } else {
	// 	cout<<vv<<endl;
	// }

	// char c;
	// cin>>c;
	// cout<<(char)(c+1)<<endl;

	int n,m; cin>>n>>m;
	vi ac(n,-1);
	vector<vi> wa(n);
	for(int i = 0; i < m; i++) {
		int p; string w;
		cin>>p>>w;
		if(w=="AC") {
			if(ac[p-1]==-1)
				ac[p-1]=i;
		} else {
			wa[p-1].pb(i);
		}
	}
	int cc=0,pp=0;
	for(int i = 0; i < n; i++) {
		if(ac[i]==-1) {
			continue;
		} else {
			cc++;
			if(sz(wa[i])==0) continue;
			int id = lower_bound(all(wa[i]),ac[i])-wa[i].begin();
			pp += id;
		}
	}
	cout<<cc<<" "<<pp<<endl;
	return 0;
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

int main() {
    ll x;
    cin >> x;
    ll p = 100;
    int cnt = 0;
    while(p < x){
        p += p / 100;
        cnt++;
    }
    cout << cnt << endl;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;

int main()
{
    int n;
    cin >> n;
    deque<int> dq;
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        if(i%2) dq.emplace_back(a);
        else dq.emplace_front(a);
    }
    if(n%2 == 0) reverse(dq.begin(),dq.end());
    for(auto x: dq) cout << x << ' ';
    cout << endl;
    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define forn(i, a, b) for (int i = a; i < b; ++i)
#define SZ(x) int(x.size())
#define pb push_back
#define F first
#define S second
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}

int n, a, b;

int f(int m) {
  int r = 0;
  while (m != 0) {
    r = r + m % 10;
    m = m / 10;
  }
  return r;
}

int main() {
#ifdef LOCAL
  freopen("b.txt", "r", stdin);
// freopen("main.txt", "w", stdout);
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
  ios::sync_with_stdio(0);
  cin.tie(0);
#define endl '\n'
#define dbg(...) 18
#endif
  cin >> n >> a >> b;
  int ans = 0, sum;
  for (int i = 1; i <= n; i++) {
    sum = f(i);
    if (sum >= a && sum <= b) ans += i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3608
#include <iostream>


int main()
{
	int a, h, m, s, remainder;
	std::cin >> a;

	h = a / 3600;
	remainder = a - (h * 3600);

	m = remainder / 60;
	remainder -= m * 60;

	s = remainder;

	printf("%d:%d:%d\n", h, m, s);
	return 0;
}



Measured memory_bytes: 3176
from math import factorial

N = int(input())

def prime_decomposition(n):
  i = 2
  dict = {
    2:0,3:0,5:0,7:0,11:0,13:0,17:0,19:0,23:0,29:0,31:0,37:0,41:0,43:0,47:0,53:0,
    59:0,61:0,67:0,71:0,73:0,79:0,83:0,89:0,97:0
    }
  while i * i <= n:
    while n % i == 0:
      n /= i
      dict[i] = dict[i] + 1
    i += 1
  if n > 1:
    dict[n] = 1
  return dict

def comb(n,r):
  if n >= r:
    return(factorial(n) / (factorial(r) * factorial(n-r)))
  else:
    return 0

cum_dict = {
    2:0,3:0,5:0,7:0,11:0,13:0,17:0,19:0,23:0,29:0,31:0,37:0,41:0,43:0,47:0,53:0,
    59:0,61:0,67:0,71:0,73:0,79:0,83:0,89:0,97:0
    }
for i in range(N+1):
  decomposed = prime_decomposition(i)
  for p in decomposed.keys():
    cum_dict[p] += decomposed[p]

ans = 0
decomposed_list = list(cum_dict.values())

four_ = sum(x >= 4 for x in decomposed_list)
two_three = sum(2<= x < 4 for x in decomposed_list)
ans += comb(four_,3) * 3
ans += two_three * comb(four_,2)

two_twentythree = sum(2 <= x < 24 for x in decomposed_list)
twentyfour_ = sum(24 <= x for x in decomposed_list)
ans += comb(twentyfour_,2) * 2
ans += two_twentythree * twentyfour_

four_thirteen = sum(4 <= x < 14 for x in decomposed_list)
fourteen_ = sum(14 <= x for x in decomposed_list)
ans += comb(fourteen_,2) * 2
ans += four_thirteen * fourteen_

seventyfour_ = sum(74 <= x for x in decomposed_list)
ans += seventyfour_

print(int(ans))

Measured memory_bytes: 3192
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
   
//#include <x86intrin.h>
#include <bits/stdc++.h>   
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, dp[22][(1 << 21)];
vector <int> can[(1 << 21)];
int a[22][22];

inline int add (int a, int b) {
   a += b;
   if (a >= mod) a -= mod;
   return a;
}

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> n;
   for (int i = 1; i <= n; i ++)
      for (int j = 0; j < n; j ++)
         cin >> a[i][j];
   dp[0][0] = 1;
   for (int mask = 0; mask < (1 << n); mask ++)
      for (int i = 0; i < n; i ++)
         if (!(mask & (1 << i)))
            can[mask].pb (i);
   for (int i = 1; i <= n; i ++) {
      for (int mask = 0; mask < (1 << n); mask ++) {
         if (bpp (mask) != i - 1) continue;
         for (auto nxt : can[mask]) {
            if (!a[i][nxt]) continue;
            dp[i][mask | (1 << nxt)]  = add (dp[i][mask | (1 << nxt)], dp[i - 1][mask]);
         }
      }
   }
   cout << dp[n][(1 << n) - 1];
}

int main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}
                          

Measured memory_bytes: 364928
'use strict'
function main(inp) {
  inp = inp.trim().split('\n')
  const N = Number(inp.shift())
  inp = inp[0].split(' ').map(n => Number(n)).sort((a, b) => a - b)

  let list = []
  let ans = 0
  for (let i = 0; i < N - 1; i++) {
    const plus = inp[i+1] + inp[i]
    const minus = inp[i+1] - inp[i] 
    if (i > 0) {
      list[i] = list[i - 1].map(num => {
        if (num > inp[i + 1]) {
          if (num > inp[N - 1]) {
            ans += N - i - 1
          } else {
            let left = i + 1
            let right = N - 1
            let j = Math.floor((right - left) / 2) + left
            while(1) {
              if (num > inp[j] && num <= inp[j+1]) {
                break
              } else if (num > inp[j]) {
                left = j + 1
                j = Math.floor((right - left) / 2) + left
              } else {
                right = j
                j = Math.floor((right - left) / 2) + left
              }
            }
            ans += j - i
          }
        }
        return num + minus
      })
    } else {
      list[i] = []
    }
    list[i].push(plus)
  }
  console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 57532