akhauriyash/Code-Regression huggingface dataset:
N = gets.to_i
s = N.times.map { gets.chomp }
M = gets.to_i
t = M.times.map { gets.chomp }

result =
s.uniq.map do |sn|
  s.count(sn) - t.count(sn)
end

puts result.max < 0 ? 0 : result.max


Measured memory_bytes: 1788
#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    string s,t;cin >> s >> t;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}



Measured memory_bytes: 3628
times = int(input())
count = 0
import math

def isPrime(x):
    d = 3
    if x == 2:
        return True
    if x%2 == 0:
        return False
    while d <= math.sqrt(x):
        if x%d == 0:
            return False
        d += 2
    return True
    
for i in range(times):
    num = int(input())
    if isPrime(num) == True:
        count += 1

print(count)


Measured memory_bytes: 5676
#include <stdio.h>
 
int main(void)
{
    int trump[4][13], No;
    int n, i, j;
    char suit;    
 
    for(i=0;i<4;i++){
        for(j=0;j<13;j++){
            trump[i][j] = 0;
        }
    }
 
    scanf("%d", &n);
 
    for(i=0;i<n;i++){
        scanf("%s %d", &suit, &No);
         
        if(suit == 'S'){
            trump[0][No-1] = 1;
        }
        if(suit == 'H'){
            trump[1][No-1] = 1;
        }
        if(suit == 'C'){
            trump[2][No-1] = 1;
        }
        if(suit == 'D'){
            trump[3][No-1] = 1;
        }        
    }
 
    for(i=0;i<4;i++){
        for(j=0;j<13;j++){
            if(trump[i][j] == 0){
                if(i == 0){
                    printf("S %d\n", j+1);
                }     
                if(i == 1){
                    printf("H %d\n", j+1);
                }     
                if(i == 2){
                    printf("C %d\n", j+1);
                }     
                if(i == 3){
                    printf("D %d\n", j+1);
                }     
            }
        }
    }   
    return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	string s; cin >> s;
	ll S = 0, T = 0;
	ll ans = 0;
	for(ll i = 0; i < s.size(); ++i){
		(s[i] == 'S' ? S : T)++;
		if(S < T){
			ans++;
			T--;
		}
	}
	cout << ans * 2 << endl;
	return 0;
}

Measured memory_bytes: 640
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()
ans = 0
wl = [1 for i in range(k)] + [0 for j in range(n-k)]
for i in range(n):
    if i < k:
        if t[i] == 'r':
            ans += p
        elif t[i] == 's':
            ans += r
        else:
            ans += s
    else:
        if t[i] != t[i-k]:
            wl[i] = 1
            if t[i] == 'r':
                ans += p
            elif t[i] == 's':
                ans += r
            else:
                ans += s
        elif wl[i-k]:
            continue
        else:
            wl[i] = 1
            if t[i] == 'r':
                ans += p
            elif t[i] == 's':
                ans += r
            else:
                ans += s

print(ans)


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

int main()
{
  int a,b,c,d,x,y;
  cin>>a>>b>>c>>d;
  x=c-a;
  y=d-b;
  cout<<c-y<<" "<<d+x<<" "<<a-y<<" "<<b+x<<endl;
}

Measured memory_bytes: 3612
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include <vector>
using namespace std;
int main() {
	int n, a, sum = 0, ans = 0; cin >> n;
	int test[123456] = { 0 };
	for (int h = 0; h < n; h++) {
		cin >> a; 
		if (a <= 100000) {
			test[a]++;
			sum++;
		}
	}
	ans += n - sum;
	for (int h = 0; h < 100000; h++) {
		if (test[h] < h) {
			ans += test[h];
		}
		if (test[h] > h) {
			ans += test[h] - h;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 768
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let [n, m] = nextIntArray()
    let arr = []
    for(let i = 0 ;i < n; i++){
      arr.push([0,0])
    }
    while(hasNext()){
        let tmp = nextIntArray()
        if(tmp[0] == 1){
            arr[tmp[1]-1][0] = 1
        }
        if(tmp[0] == n){
            arr[tmp[1]-1][1] = 1
        }
        if(tmp[1] == 1){
            arr[tmp[0]-1][0] = 1
        }
        if(tmp[1] == n){
            arr[tmp[0]-1][1] = 1
        }
    }
    for(let el of arr){
        if(el[0] == 1 && el[1] == 1){
            console.log("POSSIBLE")
            return
        }
    }
    console.log("IMPOSSIBLE")
}
Main()



Measured memory_bytes: 95268
#include <cstdio>
using namespace std;

int main() {
    long long k, a, b;
    scanf("%lld%lld%lld", &k, &a, &b);
    if (k + 1 <= a) {
        printf("%lld", k + 1);
    }
    else {
        if (b - a > 2) {
            long long rest_op = k - a + 1;
            printf("%lld", 1ll * (rest_op >> 1) * (b - a) + (rest_op & 1) + a);
        } else {
            printf("%lld", k + 1);
        }
    }
    putchar('\n');
}

Measured memory_bytes: 256
def main():
    A, B = input().split()

    A = int(A)

    B_spl = B.split('.')
    L = len(B_spl[1])  # 小数部分の桁数, int化前に桁を調べる必要がある(末尾に0が続くケース)
    B_int, B_frac = map(int, B_spl)  # 整数部分, 小数部分

    ans = (A * B_int) + (A * B_frac) // pow(10, L)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9096
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int a, b;
	cin >> a >> b;
	if(a <= 0 && b >= 0){
		cout << "Zero" << endl;
		return 0;
	}
	if(a < 0 && b < 0){
		if((b - a - 1) % 2 == 0) cout << "Positive" << endl;
		else cout << "Negative" << endl;
		return 0;
	}
	if(a > 0 && b > 0){
		cout << "Positive" << endl;
		return 0;
	}
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
n, m = [ int(v) for v in input().split() ]
switch_list = []
for i in range(m):
	switch_list.append([ int(v)-1 for v in input().split() ][1:])
p_list = [ int(v) for v in input().split() ]


def switch_check(inlist):
	ans = 0
	p_list2 = [ [inlist[j] for j in switch_list[i] ].count("1")%2  for i in range(m) ]
	if  p_list2 == p_list:
		ans = 1
	return ans

sumans = 0

for i in range(2**n):
	s = (n-len(bin(i))+2)*"0" +bin(i)[2:]
	sumans  += switch_check(s)

print(sumans)


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  string ans;
  for(char c : s){
     if(c+n<='Z')
     ans+=c+n;
     else 
     ans+='A'+n-('Z'-c)-1;
  }
  cout << ans << endl;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



int main() {
    li n, m, d;
    cin >> n >> m >> d;

    li delimiter = n * n;

    li res = 0;

    if (d == 0) {
        res = (m - 1) * n;
    } else {
        res = (m - 1) * (n - d) * 2;
    }



    printf("%.12f\n", res * 1.0 / delimiter);
    return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int
var t float64

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	m := n * (n - 1)
	edges := make([][]int, m)
	ins := make([]int, m)
	for i := 0; i < n; i++ {
		a := intScanner() - 1
		for j := 1; j < n-1; j++ {
			b := intScanner() - 1
			x := larger(i, a)*(n-1) + smaller(i, a)
			y := larger(i, b)*(n-1) + smaller(i, b)
			edges[x] = append(edges[x], y)
			ins[y]++
			a = b
		}
	}
	depth := make([]int, m)
	q := make([]int, 0, m)
	for i := 0; i < m; i++ {
		if ins[i] == 0 {
			q = append(q, i)
		} else {
			depth[i] = -1
		}
	}
	for len(q) != 0 {
		idx := q[0]
		q = q[1:]
		for _, v := range edges[idx] {
			ins[v]--
			if ins[v] == 0 {
				q = append(q, v)
				depth[v] = depth[idx] + 1
			}
		}
	}
	ans := 0
	for _, v := range depth {
		if v >= 0 {
			ans = larger(ans, v+1)
		} else {
			ans = -1
			break
		}
	}
	fmt.Println(ans)
}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

template<typename T>
struct SegmentTree {
    using F = function<T(T, T)>;

    SegmentTree(F func, T id)
            : merge(func), identity(id) {}

    void init(ll n) {
        offset = 1;
        while (offset < n)
            offset <<= 1;
        node.assign(offset << 1, identity);
    }

    void build(const vector<T> &v) {
        int n = static_cast<int>(v.size());
        init(n);
        for (int i = 0; i < n; ++i) {
            node[offset + i] = v[i];
        }
        for (int i = offset - 1; i >= 0; --i) {
            node[i] = merge(node[(i << 1) | 0], node[(i << 1) | 1]);
        }
    }

    void set(int index, T value) {
        index += offset;
        node[index] = value;
        while (index >>= 1) {
            node[index] = merge(node[(index << 1) | 0], node[(index << 1) | 1]);
        }
    }

    //! [left, right]
    T get(int left, int right) {
        left += offset;
        right += offset + 1;

        T val = identity;
        while (left < right) {
            if (left & 1)
                val = merge(val, node[left++]);
            if (right & 1)
                val = merge(val, node[--right]);

            left >>= 1;
            right >>= 1;
        }
        return val;
    }

    T identity;
    F merge;
    vector<T> node;
    int offset;
};

ll H[200005];
ll A[200005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> H[i];
    }
    REP(i, N) {
        cin >> A[i];
    }
    SegmentTree<ll> seg([](ll a, ll b) { return std::max(a, b); }, 0);
    seg.init(N + 5);
    REP(i, N) {
        ll m = seg.get(0, H[i]);
        seg.set(H[i], m + A[i]);
    }

    cout << seg.get(0, N) << endl;
    return 0;
}

Measured memory_bytes: 7552
#include<bits/stdc++.h>
#define PI 3.141592653589
#define ll long long
using namespace std;

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

  ll a = n % k;
  
  ll b =abs(a - k);
  ll c = abs(b -k);

  ll ans = min(b, c);

  cout << ans;



}
    




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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef long double LD;
typedef pair<LD, LD> PLDLD;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()

const double eps=1e-5;
const LL INF=1e15;

int main()
{
    int n,m;
    cin>>n>>m;
    vector<int> cnt(n);
    REP(i,m)
    {
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        cnt[a]++;
        cnt[b]++;
    }

    bool ans=1;
    REP(i,n)
    {
        if(cnt[i]%2==1)
            ans=0;
    }
    if(ans)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}

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

int main(){
  int a = 0; int b = 0; int c = 0;
  cin >> a >> b >> c;
  if(a < b){
   if(b < c){
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }

    else {
      cout << "No" << endl;
    }

  return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI = acos(-1);
const ll MOD = 1000000007;

int main() {
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  int ans = 0;
  if (a[0] % 2 == a[1] % 2 && a[1] % 2 == a[2] % 2) {
    sort(a.begin(),a.end());
    ans = (a[2]*2 - a[0] - a[1]) / 2;
  } else {
    for (int i = 0; i < 3; i++) {
      if (a[i] % 2 == (a[0] + a[1] + a[2]) % 2) {
        a[i]--;
        sort(a.begin(),a.end());
        ans = (a[2]*2 - a[0] - a[1]) / 2 + 1;
        break;
      }
    }
  }
  
  cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <iostream>

int main(void) {
	long long k, a, b, ans = 0;
	std::cin >> k >> a >> b;
	if (1 + k < a || a + 2 >= b)
		ans = 1 + k;
	else {
		k -= a - 1;
		if (k & 1)
			ans = 1;
		ans += a + (b - a) * (k >> 1);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long num[26] = {0},c = 0;
    char pr[5] = {'A','C','H','M','R'};
    string s;
    int n;
    cin>>n;
    for(int i = 0;i < n;i ++)
    {
        cin>>s;
        num[s[0] - 'A'] ++;
    }
    for(int i = 0;i < 3;i ++)
    {
        for(int j = i + 1;j < 4;j ++)
        {
            for(int k = j + 1;k < 5;k ++)
            {
                c += num[pr[i] - 'A'] * num[pr[j] - 'A'] * num[pr[k] - 'A'];
            }
        }
    }
    cout<<c;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func count(d int) int {
	cnt := 0
	for {
		if d%2 != 0 {
			break
		}
		cnt++
		d >>= 1
	}
	return cnt
}

func main() {
	var n int
	var d int
	fmt.Scanf("%d", &n)
	cnt := math.MaxInt64
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &d)
		ccnt := count(d)
		if ccnt < cnt {
			cnt = ccnt
		}
	}
	fmt.Printf("%d", cnt)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
//#define int long long
typedef pair<int,int> ii;
typedef tuple<int,int,int> iii;
#define ll long long
#define iiMPQ priority_queue<ii,vector<ii>,greater<ii> >
#define MPQ priority_queue<int,vector<int>,greater<int> >
#define PQ priority_queue<int>
#define iiPQ priority_queue<ii>
#define US unordered_set<int>
#define UMS unordered_multiset<int>
#define UM unordered_map<int>
#define iiUS unordered_set<ii>
#define ST stack<int>
#define MS multiset<int>
#define scan1(n) cin>>n
#define scan2(a,b) cin>>a>>b
#define scan3(a,b,c) cin>>a>>b>>c
#define print(n) cout<<n
#define println(n) cout<<n<<"\n"
#define vi vector<int>
#define vii vector<ii>
#define viii vector<iii>
#define fi first
#define se second
#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,s,e) for(int i=s;i<e;++i)
#define REPS(i,s,e,st) for(int i=s;i<e;i+=st)
#define rep(i,n) for(int i=n-1;i>=0;--i)
#define repr(i,s,e) for(int i=s;i>=e;--i)
#define reps(i,s,e,st) for(int i=s;i>=e;i-=st)
#define SET(arr,k) memset(arr,k,sizeof arr)
#define speed ios::sync_with_stdio(0); cin.tie(0);
#define mp make_pair
#define pb push_back
#define Qu queue
#define Vt vector
#define Dq deque
#define prints(n) cout << n << " ";

void m1(){
  int x; cin >> x;
  if(x >= 1800) cout << 1;
  else if(x >= 1600) cout << 2;
  else if(x >= 1400) cout << 3;
  else if(x >= 1200) cout << 4;
  else if(x >= 1000) cout << 5;
  else if(x >= 800) cout << 6;
  else if(x >= 600) cout << 7;
  else cout << 8;
}



/* 
void m2(){
  int t; scan1(t);
  while(t--) m1();
}
*/
 
signed main(){
  speed;
  //freopen("in.txt","r",stdin);
  m1();
  //m2();
}

Measured memory_bytes: 3648
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
s = str(N)
x = 0
for c in s:
    x += int(c)
if N%x == 0:
    print('Yes')
else:
    print('No')

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

int main(){
    int n,nums[101];cin>>n;
    for(int i=0;i<n;i++)cin>>nums[i];
    int ans=0;
    for(int i=1;i<n;i++){
        if(nums[i]==nums[i-1])ans++,nums[i]=102;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import fractions
m = list(map(int,input().split()))
c=[]
c.append(m[2])
c.append(m[3])
f=fractions.gcd(m[3],m[2])
p=(m[3]*m[2])// f
c.append(p)
         
a=[]
a.append(m[0]-1)
a.append(m[1])

d=[]
for i in range(3):
    for j in range(2):
        d.append(a[j]//c[i])
        
x = m[0]-1 - d[0]-d[2]+d[4]
y = m[1] - d[1]-d[3]+d[5]
print(int(y-x))        


Measured memory_bytes: 5048
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int M = Integer.parseInt(sc.next());
    
    int[][] val = new int[M][3];
    for(int i = 0; i < M; i++){
      val[i][0] = Integer.parseInt(sc.next());
      val[i][1] = Integer.parseInt(sc.next());
      val[i][2] = i;
    }
    Arrays.sort(val, (a, b) -> Integer.compare(a[1], b[1]));
    
    String[] ans = new String[M];
    int[] count = new int[N+1];
    for(int i = 0; i < M; i++){
      int a = val[i][0];
      count[a]++;
      ans[val[i][2]] = String.format("%06d%06d", a, count[a]);
    }
    
    for(int i = 0; i < M; i++){
     System.out.println(ans[i]); 
    }
  }
}


Measured memory_bytes: 111808
s = input()
t = input()
S = len(s)
T = len(t)
dp=[[-1]*(T+1) for _ in range(S+1)]

for i in range(S+1):
    for j in range(T+1):
        if i==0 or j==0:
            dp[i][j] = 0

#まずは求める部分文字列の長さを求める
for i in range(1, S+1):
    for j in range(1, T+1):
        if s[i-1]==t[j-1]:
            dp[i][j] = dp[i-1][j-1]+1
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])

#print(dp[-1][-1])
ans=""
i=S
j=T
while  dp[i][j]!=0:
    if s[i-1]==t[j-1]:
        ans = s[i-1]+ans
        i-=1
        j-=1
    else:
        if dp[i][j]==dp[i-1][j]:
            i-=1
        else:
            j-=1

print(ans)



Measured memory_bytes: 112476
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int a,b,c,max=0,min=0,bet,les,ch1=0,ch2=0;
  vector<int> ayaku;
  vector<int> byaku;
  while(cin>>a>>b){
    bet=a%b;
    if(bet!=0)
      les=b%bet;
    if(bet==0)
      max=b;
    else if(les==0)
      max=bet;
    else{
      for(;;){
	ch1=bet%les;
	if(ch1==0){
	  max=les;
	  break;
	}
	bet=les;
	les=ch1;
      }
    }
    min=(a/max)*b;
    cout<<max<<" "<<min<<endl;
  }
  return 0;
}

Measured memory_bytes: 3028
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))


N = int(input())
a = LI()


ans = 0
for i in range(N):
    if i % 2 == 0 and a[i] % 2 == 1:
        ans += 1
print(ans)

Measured memory_bytes: 10728
#include<stdio.h>

int main(void)
{
	int i,x;
	for(i=1; ;i++)
		{scanf("%d",&x);
			if(x==0)break;
			printf("Case %d: %d\n",i,x);
			if(x<=10000 && x>=1)continue;
		}
return 0;
}


Measured memory_bytes: 2044
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long K = sc.nextLong();

		ArrayManager am = new ArrayManager();

		for(int i = 0; i < N; i++){
			int a = sc.nextInt();
			int b = sc.nextInt();
			am.insert(a, b);
		}
		sc.close();

		System.out.println(am.getKthSmallestNumber(K));
	}

}

class ArrayManager{
	private TreeMap<Integer, Long> map;

	ArrayManager(){
		map = new TreeMap<Integer, Long>();
	}

	void insert(int a, int b){
		//既に挿入済みの値ならbだけ増加
		if(map.containsKey(a)){
			map.put(a, map.get(a) + b);
		}
		//初めて挿入
		else{
			map.put(a, (long)b);
		}
	}

	//k番目に小さい数を返す
	int getKthSmallestNumber(long k){
		int ret; //探索済みの最大値
		long cur = 0; //探索済みのインデックス
		for(Entry<Integer, Long> e: map.entrySet()){
			ret = e.getKey();
			cur += e.getValue();
			if(cur >= k){
				return ret;
			}
		}
		return -1;
	}
}


Measured memory_bytes: 96452
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
using namespace std;

#define ll long long int

const int MOD = 1000000007;

int main() {

	int x;
	
	cin >> x;

	if (x < 1200)cout << "ABC" << endl;
	else cout << "ARC" << endl;

	return 0;
}

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

using namespace std;
int p[10000];

int main() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);

    int n, k, sum = 0;
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> p[i];
    }
    sort(p, p + n);
    for (int i = 0; i < k; ++i) {
        sum += p[i];
    }
    cout << sum << endl;

}

Measured memory_bytes: 3636
var std = process.stdin;
std.resume();
std.setEncoding('utf8');
std.on('data', function (chunk) {
    var r = chunk.replace(/\n/, '');
    console.log((r * r * Math.PI).toFixed(6) + " " + 
                (2 * r * Math.PI).toFixed(6));
});

Measured memory_bytes: 15664
#include <fstream>
#include <iostream>

// BE CAREFUL WITH HASH TABLE & UNORDERED MAP
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;

#define MOD 998244353
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = (b-1); i >= (a); i--)
#define RF0(i,b) RFO(i,0,b)
#define lli long long int
#define pii pair<int,int>
#define add(a,b) ((int) (((lli) (a) + (b))%MOD))
#define mul(a,b) ((int) (((lli) (a) * (b))%MOD))
#define PB emplace_back

// ifstream cin ("cinput.in");
// ofstream cout ("coutput.out");

int N, S, a;
int dp [3000][3001] = {{0}};
// Helper Functions

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> S;
    int pw = 1;
    int minv = 499122177;
    F0R(i,N-1) pw = mul(pw, 2);
    
    F0R(i,N) {
        cin >> a;
        if (a <= S) dp[i][a] = pw;
        if (!i) {
            continue;
        }
        FOR(j,1,S+1) {
            dp[i][j] = add(dp[i][j], dp[i-1][j]);
            if (j-a >= 0) dp[i][j] = add(dp[i][j], mul(dp[i-1][j-a], minv));
        }
    }
    cout << dp[N-1][S] << '\n';
}

Measured memory_bytes: 38780
a,b,k=map(int,input().split())
while(k>0):
  if a%2==1:
    a-=1
  b+=a/2
  a-=a/2
  k-=1
  if k==0:
    break
  if b%2==1:
    b-=1
  a+=b/2
  b-=b/2
  k-=1
print(int(a),int(b))

Measured memory_bytes: 3064
{-# LANGUAGE BangPatterns, MagicHash #-}
import Control.Monad
import Control.Applicative
import Data.List
import Data.Maybe
import Data.Bits
import qualified Data.IntMap.Strict as M
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as V
import Data.Vector.Unboxed ((!))
import Data.Tuple
import Data.Ord (Down(..))
import Data.Coerce
                                 
query :: Int -> [(Int,Int)] -> Int
query n =
  snd
  . V.ifoldl' (\(x,cnt) a b -> let x' = min b x
                               in if x'-1 == a
                                  then (n,cnt+1)
                                  else (x',cnt)) (n,0)
  . V.init . V.accum min (V.replicate n n)
     
main :: IO ()
main = do
  [n,m] <- map read . words <$> getLine
  ls <- map ((\[x,y] -> (x-1,y-1)) . unfoldr (B.readInt . B.dropWhile (== ' ')))
          . B.lines
        <$> B.getContents
  putStrLn $ show $ query n ls


Measured memory_bytes: 5116
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>

typedef long long int ll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;

	int c = b - a;
	int n = 0;
	FOR(i, c, 1)
	{
		n += i;
	}
	cout << n - a;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int b = sc.nextInt();
        int c = sc.nextInt();
        int a = sc.nextInt();
        
        System.out.println(a + " " + b + " " + c);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;
using ll = long long;

struct eratosthenes
{
    int n;
    vector<int> f;
    vector<pair<int, int>> primes;

    eratosthenes(int n) : f(n + 1)
    {
        ll i, j;
        f[0] = f[1] = -1;
        for (i = 2; i <= n; i++)
        {
            if (!f[i])
            {
                f[i] = i;
                primes.push_back(make_pair(i, 0));
                for (j = i * i; j <= n; j += i)
                {
                    if (!f[j])
                    {
                        f[j] = i;
                    }
                }
            }
        }
    }

    // vector<int> genosis(int x)
    // {
    //     vector<int> g;

    //     while (x != 1)
    //     {
    //         g.push_back(f[x]);
    //         x /= f[x];
    //     }

    //     return g;
    // }

    vector<pair<int, int>> genosiscount(int x)
    {
        vector<pair<int, int>> gc;
        vector<int> g ;

        while (x != 1)
        {
            g.push_back(f[x]);
            x /= f[x];
        }

        if (g.empty() == 1)
        {
            return {};
        }

        gc.push_back(make_pair(f[x], 0));

        for (auto &i : g)
        {
            if (gc.back().first == i)
            {
                gc.back().second++;
            }
            else
            {
                gc.push_back(make_pair(i, 1));
            }
        }

        return gc;
    }
};

ll power(ll x, ll y)
{
    ll ans = 1;
    while (y)
    {
        if (y & 1)
            ans = (ans * x) % 1000000007;
        x = (x * x) % 1000000007;
        y >>= 1;
    }
    return ans;
}

int main(void)
{
    eratosthenes a(1e6 + 1);
    int N;
    int A[10010];
    int i, j;
    ll ans = 0;
    ll lcm = 1;

    cin >> N;

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

        for (auto &j : a.genosiscount(A[i]))
        {
            for (auto &k : a.primes)
            {
                if (j.first == k.first && j.second > k.second)
                {
                    k.second = j.second;
                }

                if (j.first < k.first)
                {
                    break;
                }
            }
        }
    }

    for (auto &x : a.primes)
    {
        lcm = lcm * power(x.first, x.second) % 1000000007;
    }

    for (i = 0; i < N; i++)
    {
        ll add = lcm * power(A[i], 1000000005) % 1000000007;
        ans = (ans + add) % 1000000007;
    }

    cout << ans << endl;
}

Measured memory_bytes: 5368
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>
#include <bitset>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

long long int rev_mod(long long int num){
	long long int pow_num = MOD - 2;
	long long int mod_num = MOD;
	long long int pow_cur = num;
	long long int ret = 1;
	while(pow_num > 0){
		if(pow_num % 2 == 1){
			ret *= pow_cur;
			ret %= mod_num;
		}
		pow_cur *= pow_cur;
		pow_cur %= mod_num;
		pow_num /= 2;
	}
	return ret;
}

vector<int> E[210000];
vector<int> sz[210000];
long long int p2[210000], p2m[210000];
long long int N;

int func(int pos, int pre){
	int ret = 1;
	for(int i = 0; i < E[pos].size(); i++){
		int to = E[pos][i];
		if(to == pre){
			continue;
		}
		sz[pos][i] = func(to, pos);
		ret += sz[pos][i];
	}
	return ret;
}

void func2(int pos, int pre, int cost){
	for(int i = 0; i < E[pos].size(); i++){
		int to = E[pos][i];
		if(to == pre){
			sz[pos][i] = cost;
		}else{
			func2(to, pos, N - sz[pos][i]);
		}
	}
}

int main(){
	p2[0] = p2m[0] = 1;
	for(int i = 1; i < 210000; i++){
		p2[i] = p2[i - 1] * 2 % MOD;
		p2m[i] = p2m[i - 1] * rev_mod(2) % MOD;
	}
	cin >> N;
	for(int i = 0; i < N - 1; i++){
		int A, B;
		cin >> A >> B;
		E[A].push_back(B);
		sz[A].push_back(0);
		E[B].push_back(A);
		sz[B].push_back(0);
	}
	long long int ans = 0;
	func(1, -1);
	func2(1, -1, 0);
	for(int i = 1; i <= N; i++){
		long long int S = p2[N - 1] + (MOD - 1);
		S %= MOD;
		for(int num : sz[i]){
			S += MOD - (p2[num] - 1);
			S %= MOD;
			//cout << p.first << " " << p.second << endl;
		}
		ans += S;
		ans %= MOD;
	}
	ans *= p2m[N];
	ans %= MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 36992
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
    for(auto &e:t) fill_v(e,v);
}

int main() {
  int n, t; cin >> n >> t;
  vector<int> a(n);
  REP(i, n) cin >> a[i];

  int m = 0, da = 0, cnt = 0;
  for(int i = n-1; i >= 0; i--){
    if(a[i] > m){
      m = a[i];
    } else {
      if(da < m - a[i]){
        da = m - a[i];
        cnt = 1;
      } else if(da == m - a[i]){
        cnt++;
      }
    }
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 640
def mi(): return map(int,input().split())
def lmi(): return list(map(int,input().split()))
def ii(): return int(input())
def isp(): return input().split()

n=int(input())
ans=[]
while n>0:
  n-=1
  remain=n%26
  ans.append(remain)
  n=(n)//26
  
ans.reverse()
aa=[]
for i in ans:
  aa_=chr(ord('a')+i)
  aa.append(aa_)
  
print(''.join(aa))

Measured memory_bytes: 9156
#include<stdio.h>
int main() {
	int i,j,k,a,b,c,sum;
	scanf("%d %d %d %d %d %d", &i,&j,&k,&a,&b,&c);
	sum=(i*1)+(j*5)+(k*10)+(a*50)+(b*100)+(c*500);
	if (sum < 1000) {
		printf("%d\n",0);
	}
	else if(sum >= 1000) {
		printf("%d\n", 1);
	}
	return 0;
}


Measured memory_bytes: 2732
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}
int main() {
	ll N; cin >> N;
	ll a[N + 100];
	for (ll i = 0; i < N; i++)
		cin >> a[i];
	map<ll, ll>mp;
	for (ll i = 0; i < N; i++)
		mp[a[i]]++;
	ll ans = 0;
	for (auto p: mp) {
		int x = p.first;
		int n = p.second;
		if (n < x) ans += n;
		else ans += n - x;
	}
	cout << ans << endl;
	}




Measured memory_bytes: 7040
X = int(input())
ans = 0
if X >= 1800:
  ans = 1
elif X >= 1600:
  ans = 2
elif X >= 1400:
  ans = 3
elif X >= 1200:
  ans = 4
elif X >= 1000:
  ans = 5
elif X >= 800:
  ans = 6
elif X >= 600:
  ans = 7
else:
  ans = 8

print(ans)

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

int main(){
  int n;
  cin>>n;
  vector<int> a(13,0);
  a[0]++;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    if(x==0){
      cout<<0<<endl;
      return 0;
    }
    a[x]++;
  }
  for(int i=0;i<13;i++){
    if(a[i]>2){
      cout<<0<<endl;
      return 0;
    }
  }
  vector<int> s;
  vector<int> tmp;
  for(int i=0;i<13;i++){
    if(a[i]==1)tmp.push_back(i);
    if(a[i]==2){
      s.push_back(i);
      s.push_back(24-i);
    }
  }

  //for(int i=0;i<s.size();i++)cout<<s[i]<<endl;

  int ans=0;

  for(int i=0;i<(1<<tmp.size());i++){
    vector<int> cans=s;
    for(int j=0;j<tmp.size();j++){
      if(i&(1<<j)){
        cans.push_back(tmp[j]);
      }else{
        cans.push_back(24-tmp[j]);
      }
    }
    sort(cans.begin(),cans.end());
    int anstmp=24;
    for(int j=1;j<cans.size();j++){
      anstmp=min(anstmp,abs(cans[j-1]-cans[j]));
      anstmp=min(anstmp,abs(24-cans[j]));
    }
    if(anstmp>12)anstmp=24-anstmp;
    ans=max(ans,anstmp);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int data[501][501];
  int n,m;
  int a,b;
  int i,j,count;
  int f[501];
  
  while(1){
    count = 0;
    for(i = 0; i < 501; i++){
      for(j = 0; j < 501; j++){
	data[i][j] = 0;
	f[j]=0;
      }
    }
    scanf("%d %d",&n,&m);
    if(n == 0 && m == 0)
      break;
    for( i = 0; i < m; i++){
      scanf("%d %d",&a,&b);
      data[a][b] = 1;
      data[b][a] = 1;
    }
    
    for(i = 1; i <= n; i++){
      if(data[1][i] == 1){
	f[i]=1;
	for(j = 2; j <= n; j++){
	  if(data[i][j] == 1 && data[1][j] != 1)
	    f[j]=1;
	}
      }
    }

    /*for(i = 1; i <= n; i++) {
      f[i] += data[1][i];
      if(f[i] >= 1) {
	for(j = 2; j <= n; j++) {
	  f[j] += data[i][j];
	}
      }
      }*/

    for(i=2;i<=n;i++){
	count += f[i];
    }
    printf("%d\n",count);
  }
  return 0;
}     

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) std::cin>>(P)
#define IN2(P1,P2) std::cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) std::cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) UP(I,0,N) std::cin>>V[I]
#define OUT(P) std::cout<<P<<std::endl
#define OUT2(P1,P2) std::cout<<P1<<" "<<P2<<std::endl
#define OUT3(P1,P2,P3) std::cout<<P1<<" "<<P2<<" "<<P3<<std::endl
#define OUTS(I,N,V) UP(I,0,N) std::cout<<V[i]<<std::endl
#define ALL(C) (C).begin(),(C).end()
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using namespace std;
using namespace __gnu_pbds;
int D,G;
int p[11],c[11];
int i,j,k;
int ans=INT_MAX;
int mask,num,s,rest_max,s1,need;
inline void solve(){
  IN2(D,G);
  REP(i,D)IN2(p[i],c[i]);
  for(mask=0;mask<(1<<D);++mask){
    s=0,num=0,rest_max=-1;
    REP(i,D){
      if(mask>>i&1){
        s+=100*(i+1)*p[i]+c[i];
        num+=p[i];
      }else{
        rest_max=i;
      }
    }
    if(s<G){
      s1=100*(rest_max+1);
      need=(G-s+s1-1)/s1;
      if(need>=p[rest_max]){
        continue;
      }
      num+=need;
    }
    ans=min(ans,num);
  }
  OUT(ans);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include<set> 
#include<math.h>
#define pai arccos(-1);
#define keta(n) cout << fixed << setprecision((n));
#define ll long long;
int main(){
  int n;
  cin>>n;
  vector<string> s(n);
  rep(i,n)cin>>s[i];
  int a=0,b=0,c=0,d=0;
  rep(i,n){
    if(s[i]=="AC")a++;
    else if(s[i]=="WA")b++;
    else if(s[i]=="TLE")c++;
    else if(s[i]=="RE")d++;
  }
  char t='x' ;
  cout<<"AC"<<" "<<t<<" "<<a<<endl;
  cout<<"WA"<<" "<<t<<" "<<b<<endl;
  cout<<"TLE"<<" "<<t<<" "<<c<<endl;
  cout<<"RE"<<" "<<t<<" "<<d<<endl;
    
    
  

}


Measured memory_bytes: 6428
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair <int, int>;
const int N = 60 + 10;
const ll mod = 1e9 + 7;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a[2][60] = {0};
	int n;
	cin >> n;
	ll ans = 0;
	while (n--)
	{
		ll x;
		cin >> x;
		bitset <60> y(x);
		for (ll i = 0; i < 60; ++i)
		{
			int t = y[i];
			ans = (ans + (a[1 - t][i]) * ((1ll << i) % mod) % mod) % mod;
			++a[t][i];
		}
	}
	cout << ans;
}


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)
#define all(x) (x).begin(), (x).end()
const ll MOD = 1000000007;


class WeightedUnionFind {
    vector<int> parent, rank, diff_weight;

public:
    WeightedUnionFind(int size) {
        parent = rank = diff_weight = vector<int>(size, 0);
        rep(i, size) parent[i] = i;
    }

    int root(int x) {
        if (parent[x] == x) return x;
        int r = root(parent[x]);
        diff_weight[x] += diff_weight[parent[x]];
        return parent[x] = r;
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    int weight(int x) {
        root(x);
        return diff_weight[x];
    }

    int diff(int x, int y) {
        return weight(y) - weight(x);
    }

    void unite(int x, int y, int w) {
        w += weight(x) - weight(y);
        x = root(x); y = root(y);
        if (x == y) return;
        if (rank[x] < rank[y]) {
            swap(x, y);
            w = -w;
        }
        if (rank[x] == rank[y]) rank[x]++;
        parent[y] = x;
        diff_weight[y] = w;
    }
};


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

    int n, m; cin >> n >> m;
    WeightedUnionFind uf(n + 1);
    rep(i, m) {
        int l, r, d; cin >> l >> r >> d;
        if (uf.same(l, r)) {
            if (d != uf.diff(l, r)) {
                cout << "No\n";
                return 0;
            }
        }
        else uf.unite(l, r, d);
    }
    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 1536
#include<iostream>
#include<cstdio>
using namespace std;
string s;
int flag;
char c[2];
int main(){
	cin>>s;
	c[0]='h'; c[1]='i';
	for(int i=0;i<s.size();++i){
		if(s[i]!=c[i%2]){
			flag=1;
			break;
		}
	}
	if(!flag&&s.size()%2==0) printf("Yes");
	else printf("No");
	return 0;
}

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

using namespace std;

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

main(){
  int n; cin >> n;
  int arr[n];
  map<int,int> even;
  map<int,int> odd;
  for(int i=0;i<n;i++){
    cin >> arr[i];
    if(i%2==0){
      if(even.find(arr[i])==even.end()) even[arr[i]] = 1;
      else even[arr[i]]++;
    }else{
      if(odd.find(arr[i])==odd.end()) odd[arr[i]] = 1;
      else odd[arr[i]]++;
    }
  }
  vector<pii> e, o;
  for(auto it = even.begin();it!=even.end();it++){
    int a = it->second, b = it->first;
    e.push_back(pii(a,b));
  }
  for(auto it = odd.begin();it!=odd.end();it++){
    int a = it->second, b = it->first;
    o.push_back(pii(a,b));
  }
  sort(e.begin(),e.end());
  sort(o.begin(),o.end());
  // for(int i=0;i<e.size();++i){
  //   cout << e[i].first << " " << e[i].second << endl;
  // }
  // cout << "----------------------" << endl;
  // for(int i=0;i<o.size();++i){
  //   cout << o[i].first << " " << o[i].second << endl;
  // }
  // cout << "----------------------" << endl;
  int ans = 1<<30;
  int n1 = e.size(), n2 = o.size();
  //cout << e[n1-1].second <<  " " << o[n2-1].second << endl;    
  //cout << e[n1-1].first <<  " " << o[n2-1].first << endl;  
  if(e[n1-1].second != o[n2-1].second) ans = min(ans,n - e[n1-1].first - o[n2-1].first);
  ans = min(ans,n - e[n1-1].first);
  ans = min(ans,n - o[n2-1].first);
  if(n2>1 and (e[n1-1].second != o[n2-2].second)) ans = min(ans,n - e[n1-1].first - o[n2-2].first);
  if(n1>1 and (e[n1-2].second != o[n2-1].second)) ans = min(ans,n - e[n1-2].first - o[n2-1].first);
  if(n1>1 and n2>1 and (e[n1-2].second != o[n2-2].second)) ans = min(ans, n - e[n1-2].first - o[n2-2].first);
  cout << ans << endl;
}

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

int main(){
  
  int s; cin >> s;
  
  vector<int> a(1000001);
  
  a[0] = s;
  
  for(int i=1 ; i < 1000001; i++){
    if(a[i-1] % 2 == 0){
      a[i] = a[i-1]/2;
    }
    else if(a[i-1] % 2 == 1){
      a[i] = 3*a[i-1] + 1;
    }
    
    for(int j = i; j >= 0 ; j--){
      if(i != j && a[i] == a[j]){
        cout << i+1 << endl;
        goto OUT;
      }
      
    }
  }
  
  OUT:
  return 0;
  
}

Measured memory_bytes: 4096
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define eps 1e-8
#define fo(i,l,r) for(int i=l;i<=r;i++)
#define of(i,l,r) for(int i=l;i>=r;i--)
#define fe(i,u) for(int i=head[u];i;i=e[i].next)
using namespace std;
typedef long long ll;
inline int rd()
{
    int x=0,f=1;
    char ch=getchar();
    for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
    for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
    return x*f;
}
const int N=200010,mod=1000000007;
int n,a[N],b[N],fac[8010],rfac[8010],ans=0;
int f[4010][4010];
 
inline int pls(int a,int b){return a+b>=mod?a+b-mod:a+b;}
inline int mns(int a,int b){return a<b?a-b+mod:a-b;}
inline int mul(int a,int b){return (ll)a*b%mod;}
inline int pwr(int x,int k){int res=1;for(;k;k>>=1,x=mul(x,x))if(k&1)res=mul(res,x);return res;}
inline int _inv(int x){return pwr(x,mod-2);}
inline int C(int n,int m){return n<m?0:mul(fac[n],mul(rfac[m],rfac[n-m]));}
 
int main()
{
    #ifndef ONLINE_JUDGE
    #endif
    fac[0]=1;fo(i,1,8001)fac[i]=mul(fac[i-1],i);
    rfac[8001]=_inv(fac[8001]);
    of(i,8001,1)rfac[i-1]=mul(rfac[i],i);
    n=rd();
    fo(i,1,n)a[i]=rd(),b[i]=rd(),f[2000-a[i]][2000-b[i]]=pls(f[2000-a[i]][2000-b[i]],1);
//  f[0][0]=1;
    fo(i,0,4000)fo(j,0,4000){
        if(i)f[i][j]=pls(f[i][j],f[i-1][j]);
        if(j)f[i][j]=pls(f[i][j],f[i][j-1]);
    }
//  cout<<f[3][3]<<endl;
    fo(i,1,n)ans=pls(ans,f[2000+a[i]][2000+b[i]]);
//  fo(i,1,n)cout<<f[2000+a[i]][2000+b[i]]<<' ';cout<<endl;
    fo(i,1,n)ans=mns(ans,C((a[i]+b[i])<<1,a[i]<<1));
    ans=mul(ans,rfac[2]);
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 64640
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int c = scan.nextInt();
    int x = 0;
    for( int i = a ; i <= b ; i++ ){
      if( (c % i) == 0 ){
        x++;
      }
     }
     System.out.println(x);
  }
 }

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

using namespace std;
using Int = long long;

signed main(){
    Int a, b;
    cin >> a >> b;

    if (a > b && (a - b) % 2 == 0){
        cout << (a - b) / 2 + b << endl;
    } else if ((b - a) % 2 == 0){
        cout << (b - a) / 2 + a << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define files(name) name!=""?freopen(name".in","r",stdin),freopen(name".out","w",stdout):0
#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define elif else if
#define mp make_pair
#define pb push_back
#define fir first
#define sec second

using namespace std;
#define int long long

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

const int arr=2e5+10;
const int ar=2e3+10;
const ld pi=acos(-1);
const ld eps=1e-10;
const ll md=1e9+7;

///---program start---///

const int N=50*50+10;

int dp[51][2*N];
const int ZERO=N/2;

void inc(int& a,int b)
{
    a+=b;
}

int a[arr];

main()
{
    #ifdef Barik
        files("barik");
        freopen("debug.txt","w",stderr);
    #endif

    int n,A;
    cin>>n>>A;
    for (int i=0;i<n;i++){
        cin>>a[i];
        a[i]-=A;
    }
    dp[0][ZERO+0]=1;
    for (int i=0;i<n;i++){
        for (int j=0;j<2*N;j++){
            if (dp[i][j]){
                inc(dp[i+1][j],dp[i][j]);
                inc(dp[i+1][j+a[i]],dp[i][j]);
            }
        }
    }
    cout<<dp[n][ZERO+0]-1<<"\n";
}


Measured memory_bytes: 896