akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define vpush(a,x) a.push_back(x);
#define _GLIBCXX_DEBUG
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;
    vector<string> s(100);
    cin>>h>>w;
    rep(i,h){
        cin>>s[i];
    }
    int max=0;
    rep(i,h){
        rep(j,w){
            int count[25][25]={};
            bool flag[25][25]={};
            tuple<int,int,int> u;
            queue<tuple<int,int,int> >que;
            if(s[i][j]!='#'){
                get<0>(u)=i;
                get<1>(u)=j;
                get<2>(u)=0;
                que.push(u);
                while(!que.empty()){
                    u=que.front(); que.pop();
                    int nh=get<0>(u),nw=get<1>(u);
                    if(nh<0 || nh>=h || nw<0 || nw>=w){
                        continue;
                    }
                    if(s[nh][nw]=='#'){
                        continue;
                    }
                    if(flag[nh][nw]){
                        continue;
                    }
                    count[nh][nw]=get<2>(u);
                    flag[nh][nw]=true;
                    que.push(make_tuple(nh+1,nw,get<2>(u)+1));
                    que.push(make_tuple(nh,nw+1,get<2>(u)+1));
                    que.push(make_tuple(nh-1,nw,get<2>(u)+1));
                    que.push(make_tuple(nh,nw-1,get<2>(u)+1));
                }
                rep(i,h){
                    rep(j,w){
                       chmax(max,count[i][j]);
                    }
                }
            }
        }
    }
    cout<<max<<'\n';
    return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
ULL gcd(ULL a, ULL b){ if(b){ return gcd(b, a%b); }else{ return a; } }

int main(){
ULL K, i, j, k, ans=0; cin >> K;
for(i=1;i<=K;i++){for(j=1;j<=K;j++){for(k=1;k<=K;k++){
ans+=gcd(gcd(i,j),k);
}}}  
cout << ans << "\n";
}

Measured memory_bytes: 3636
n, m = map(int, input().split())
p = [0]*m
s = [0]*m

for i in range(m):
    p[i], s[i] = input().split()
    p[i] = int(p[i])

ac_cnt = 0
wa_cnt = 0
ac_list = [0] * n
wa_list = [0] * n

for i in range(m):
    if ac_list[p[i] - 1] == 0:
        if s[i] == "WA":
            # wa_cnt += 1
            wa_list[p[i] - 1] += 1
        else:
            ac_list[p[i] - 1] = 1
            ac_cnt += 1
            wa_cnt += wa_list[p[i] - 1]


print(ac_cnt, wa_cnt)

Measured memory_bytes: 14836
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
typedef long long ll;
char g[120][120];
bool used[120][120];
int h, w;
int cnt[120];
int main() {
    scanf("%d%d", &h, &w);
    for(int i = 1; i <= h; ++i) {
        scanf("%s", g[i]+1);
    }
    for(int i = 1; i <= h; ++i) {
        for(int j = 1; j <= w; ++j) {
            cnt[ g[i][j] - 'a']++;
        }
    }
    priority_queue<int>que;
    for(int i = 0; i < 26; ++i)
        que.push(cnt[i]);
    //cout << que.top();
    int mh = h/2;
    int mw = w/2;
    int sum = mh*mw;

    for(int i = 1; i <= sum; ++i) {
        int o = que.top();
        que.pop();
        if(o >= 4) {
            o -= 4;
            que.push(o);
        }
        else {
            printf("No");
            return 0;
        }
    }
    if((h&1) && (w&1)) {
        //cout << "---";
        for(int i = 1; i <= (h + w - 2)/2; ++i) {
            int o = que.top();
            que.pop();
            if(o >= 2) {
                o -= 2;
                que.push(o);
            }
            else {
                printf("No");
                return 0;
            }
        }

    }
    else if(h&1) {
        for(int i = 1; i <= w/2; ++i) {
            int o = que.top();
            que.pop();
            if(o >= 2) {
                o -= 2;
                que.push(o);
            }
            else {
                printf("No");
                return 0;
            }
        }
    }
    else if(w&1) {
        for(int i = 1; i <= h/2; ++i) {
            int o = que.top();
            que.pop();
            if(o >= 2) {
                o -= 2;
                que.push(o);
            }
            else {
                printf("No");
                return 0;
            }
        }
    }
    printf("Yes");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n;
    cin >> n;
    vector<P> a;
    rep(i, n){
        int x;
        cin >> x;
        a.push_back(make_pair(x, i+1));
    }
    sort(a.begin(), a.end());
    rep(i, n){
        cout << a[i].second << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 4316
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string>
#include<map>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
 
using namespace std;

int main(){
    ll N, D;    cin >> N >> D;
    D = D*D;
    int cnt=0;
    for(int i=0; i<N; i++){
        ll x, y;    cin >> x >> y;
        if(x*x + y*y <= D)  cnt++;
    }
    cout << cnt;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define lint long long int
using namespace std;
int main() 
{
	lint k=0;
	lint a=0;
	lint b=0;
	lint flag=0;
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
	{
		if(i%k==0)
		{
			flag=1;
		}
	}
	if(flag)
	{
		cout<<"OK"<<endl;
	}
	else
	{
		cout<<"NG"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3636
#define DEBUG 0
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T>using numr=std::numeric_limits<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll LLINF = 1e16;
const int MOD = 1000000007;
const int MOD2 = 998244353;
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#if DEBUG
#define debug(...)\
    do {\
        std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        std::cerr << std::noboolalpha;\
    } while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
    { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
os << "{";
    for (auto it = v.begin(); it != v.end(); it++)
        {os << (it != v.begin() ? "," : "") << *it;}
    return os << "}";
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int x;
    cin >> x;
    int ans = 0;
    while(x/500 > 0){
        x -= 500;
        ans += 1000;
    }
    while(x/5 > 0){
        x -= 5;
        ans += 5;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 3512
N,M,L = map(int,input().split())
INF = (500, 10**9)
dist = [[INF if i != j else (0,0) for i in range(N)] for j in range(N)]
edge = [[] for i in range(N)]
for i in range(M):
	A,B,C = map(int,input().split())
	if C <= L:
		edge[A-1].append((B-1, C))
		edge[B-1].append((A-1, C))

import heapq as hq
for i in range(N):
	searched = [False for j in range(N)]
	n = i
	while n != None:
		searched[n] = True
		for e in edge[n]:
			if searched[e[0]]:
				continue
			d = dist[i][n]
			n2, d2 = e[0], e[1]
			if d[1] + d2 > L:
				new_d = (d[0] + 1, d2)
			else:
				new_d = (d[0], d[1] + d2)
			dist[i][n2] = min(dist[i][n2], new_d)
		n = None
		m = INF
		for j in range(N):
			if not searched[j] and dist[i][j] < m:
				n = j
				m = dist[i][j]


Q = int(input())
for q in range(Q):
	s,t = map(int,input().split())
	print(dist[s-1][t-1][0] if dist[s-1][t-1] != INF else -1)


Measured memory_bytes: 68952
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int N,T;
    cin >> N >> T;
    int c,t;
    int cost = 1001;
    rep(i,N){
        cin >> c >> t;
        if(t <= T){
            cost = min(cost,c);
        }
    }
    if(cost == 1001) cout << "TLE" << endl;
    else cout << cost << endl;


    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	//0137
	static class MiddleSquare_Method {
		void print_randomNum() {
			int inputNum = Integer.parseInt(sc.nextLine());
			int[] initialValue = new int[inputNum];
			for(int i=0; i<inputNum; i++) {
				initialValue[i] = Integer.parseInt(sc.nextLine());
			}
			for(int i=0; i<inputNum; i++) {
				System.out.println("Case " + (i+1) + ":");
				int squareNum = 0;
				for(int j=0; j<10; j++) {
					squareNum = (int) Math.pow(initialValue[i], 2);
					squareNum = squareNum / 100;
					initialValue[i] = squareNum % 10000;
					System.out.println(initialValue[i]);
				}
			}
		}
	}

	public static void main(String[] args) {
		MiddleSquare_Method msm = new MiddleSquare_Method();
		msm.print_randomNum();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#include<string>
using namespace std;
typedef long long ll;
typedef long double lb;
typedef vector<int,vector<int>> vec;
typedef pair<int,int> P;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out  << "\n";
#define all(vec) vec.begin(),vec.end()
#define mod 1000000007
const int INF = 1e9;

typedef tuple<ll, ll, ll> T;

int main(){
  int N,a,b,c;cin>>N;
  vector<ll> A[N],B[N],C[N];
  vector<T> vec,vec2;
  REP(i,0,N){
    cin>>a>>b>>c;
    T t=make_tuple(a,b,c);
    if(c>0){vec.emplace_back(t);}
    else{vec2.emplace_back(t);}
  }


  REP(i,0,101)REP(j,0,101){
    ll height=get<2>(vec[0])+abs(get<0>(vec[0])-i)+abs(get<1>(vec[0])-j);
    bool flg =true;
    REP(k,1,vec.size()){
      //print(height<<"?=?"<<get<2>(vec[k])+abs(get<0>(vec[k])-i)+abs(get<1>(vec[k])-j))
      if(height!=get<2>(vec[k])+abs(get<0>(vec[k])-i)+abs(get<1>(vec[k])-j)){
        flg=false;
      }
    }
    REP(k,0,vec2.size()){
      if(height>abs(get<0>(vec2[k])-i)+abs(get<1>(vec2[k])-j)){
        flg=false;
      }
    }
    if(!flg)continue;
    else{
      print(i<<" "<<j<<" "<<height)
      return 0;
    }
  }

  print(get<0>(vec[0])<<" "<<get<1>(vec[0])<<" "<<get<1>(vec[0]))
  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < n; i++)
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

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

    double ans = 0.0;
    for (int i = 1; i <= n; i++) {
        double p = 1.0;
        for (int score = i; score < k; score *= 2) {
            p/=2;
        }
        ans += p/n;
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;


int main() {
  ll N;
  cin >> N;
  vll A(N);
  ll sum=0;
  repeat(i,N){
    cin >> A[i];
    sum += A[i];
  }
  if(sum % (N*(N+1)/2) != 0){
    cout << "NO" << endl;
    return 0;
  }
  ll bigN=2*(1e9/N+1)*N;
  ll K = sum/(N*(N+1)/2);
  ll xsum=0;
  ll dif = 0;
  repeat(i,N){
    if(i>0 && (dif-(A[(i+1)%N] - A[i])+bigN)%N != 0){
      cout << "NO" << endl;
      return 0;
    }
    dif = A[(i+1)%N] - A[i];
    if(dif > K || (K-dif)%N != 0){
      cout << "NO" << endl;
      return 0;
    }
    ll x = (K-dif)/N;
    xsum += x;
  }
  if(xsum != K){
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 1024
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::input;
use proconio::marker::{Bytes, Chars};
use std::collections::*;

fn main() {
    input! {
        k:i64,
        s:Chars,
    }
    let n = s.len();
    let modulo = 1e+9 as i64 + 7;
    let comb = CombinationMod::new(n + k as usize, modulo);
    let n = n as i64;
    let ans = (0..=k)
        .map(|i| {
            let mut res = 1;
            res = res * modpow(25, k - i, modulo) % modulo;
            res = res * modpow(26, i, modulo) % modulo;
            res = res * comb.query(n + k - i - 1, n - 1) % modulo;
            res
        })
        .fold(0, |acc, a| (acc + a) % modulo);
    println!("{}", ans);
}

fn modpow(a: i64, x: i64, m: i64) -> i64 {
    if x == 0 {
        1
    } else if x % 2 != 0 {
        a * modpow(a, x - 1, m) % m
    } else {
        let half = modpow(a, x / 2, m);
        half * half % m
    }
}

struct CombinationMod {
    fac: Vec<i64>,
    inv: Vec<i64>,
    inv_fac: Vec<i64>,
    modulo: i64,
}
impl CombinationMod {
    pub fn new(size: usize, modulo: i64) -> CombinationMod {
        let mut fac = vec![1; size + 1];
        let mut inv = vec![1; size + 1];
        let mut inv_fac = vec![1; size + 1];
        for i in 2..=size {
            fac[i] = fac[i - 1] * i as i64 % modulo;
            inv[i] = modulo - inv[modulo as usize % i] * (modulo / i as i64) % modulo;
            inv_fac[i] = inv_fac[i - 1] * inv[i] % modulo;
        }
        CombinationMod {
            fac: fac,
            inv: inv,
            inv_fac: inv_fac,
            modulo: modulo,
        }
    }
    fn query(&self, n: i64, r: i64) -> i64 {
        self.fac[n as usize] * self.inv_fac[r as usize] % self.modulo
            * self.inv_fac[(n - r) as usize]
            % self.modulo
    }
    fn inverse(&self, n: i64) -> i64 {
        self.inv[n as usize]
    }
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;

#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    string s, t; cin >> s >> t;
    reverse(all(s));
    if(s == t) cout << "YES" << endl;
    else cout << "NO" << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7680
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
#include <map>
#include <numeric>

#define ll long long
using namespace std;
static ll imin = std::numeric_limits<ll>::min();
static ll imax = std::numeric_limits<ll>::max();
#define rep(i, n) for(int i = 0; i<n; ++i)
#define rep1(i, n) for(int i = 1; i<n; ++i)
#define debug(x) cout << #x << ":" << x << "\n";
#define all(v) v.begin(), v.end()

template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(int i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  os << std::endl;
  return os;
}


#ifndef BOOST_TEST_MAIN
int main(int const argc, char const** argv){
  ll a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  ll usec = 0;
  if(x > y){
    usec = c * y * 2 + a * (x - y);
  }else{
    usec = c * x * 2 + b * (y - x);
  }
  // debug(a * x + b * y);
  // debug(usec);
  // debug(c * max(x, y));
  cout << min({
               a * x + b * y,
               usec,
               c * max(x, y) * 2
    });
  
}
#endif




Measured memory_bytes: 256
#include<stdio.h>
int main(){
	char a[8],c;
	scanf("%s",a);
	for(int i=0;i<3;i++)
	for(int j=0;j<3-i;j++)
	if(a[j]<a[j+1])
	{
	c=a[j];
	a[j]=a[j+1];
	a[j+1]=c;
    }
if(a[0]==a[1]&&a[2]==a[3]&&a[0]!=a[2]&&a[0]!=a[3])
	printf("Yes\n");
	else
	printf("No\n");
	return 0;
}


Measured memory_bytes: 888
// 2011/01/05 Tazoe

#include <iostream>
#include <iomanip>
using namespace std;

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

		int tab[11][11];
		for(int i=0; i<n; i++)
			for(int j=0; j<n; j++)
				cin >> tab[i][j];

		for(int i=0; i<n; i++){
			tab[i][n] = 0;
			for(int j=0; j<n; j++)
				tab[i][n] += tab[i][j];
		}

		for(int j=0; j<n+1; j++){
			tab[n][j] = 0;
			for(int i=0; i<n; i++)
				tab[n][j] += tab[i][j];
		}

		for(int i=0; i<n+1; i++){
			for(int j=0; j<n+1; j++)
				cout << setw(5) << tab[i][j];
			cout << endl;
		}
	}

	return 0;
}

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

typedef long long s64;
#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=2e5+5;
char s[N];
int cnt[26];
int main()
{
	//freopen("1.in","r",stdin);
	scanf("%s",s+1);
	int n=strlen(s+1);
	rep(i,1,n)++cnt[s[i]-'a'];
	s64 sum=0;
	rep(i,0,25)sum+=(s64)cnt[i]*(cnt[i]+1)/2;
	cout<<(s64)n*(n+1)/2-sum+1;
}

Measured memory_bytes: 384
a,b=input().split()
a=int(a)
b=int(b)
ans=0
for i in range(a,b+1):
    a=i//10000
    b=i//1000%10
    c=i//100%10
    d=i//10%10
    e=i%10
    if a==e and b==d:
        ans+=1
print(ans)

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<endl
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
//#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const int INF = 1e9;
int dx[4] = { 0,0,-1,1 }, dy[4] = { 1,-1,0,0 };

int H, W;
int dp[303][303];
vector<int>v[2][303];
int calc(const string &S,const string &T) {
	REP(i, 2)REP(j, H)v[i][j].clear();
	REP(i, H) {
		FOR(j, i, H) {
			if (S[i] == T[j]) {
				v[0][j - i].push_back(H - i - 1);
			}
		}
	}
	REP(j, H) {
		FOR(i, j, H) {
			if (T[j] == S[i]) {
				v[1][i - j].push_back(H - j - 1);
			}
		}
	}
	REP(i, H + 1) {
		REP(j, H + 1)dp[i][j] = INF;
	}
	dp[0][0] = 0;
	REP(i, H + 1)REP(j, H + 1) {
		if (i >= j) {
			int cnt = 0;
			REP(k, v[0][i - j].size()) {
				if (i <= v[0][i - j][k])cnt++;
			}
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + cnt);
			dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + cnt);
		}
		else {
			int cnt = 0;
			REP(k, v[1][j - i].size()) {
				if (j <= v[1][j - i][k])cnt++;
			}
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + cnt);
			dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + cnt);
		}
	}
	return dp[H][H];
}
char C[303][303];
string S[303];
void solve() {
	cin >> H >> W;
	REP(i, H)REP(j, W) {
		cin >> C[i][j];
		S[j] += C[i][j];
	}
	ll ans = 0;
	REP(j, W - 1) {
		//print(calc(S[j], S[j + 1]));
		ans += calc(S[j], S[j + 1]);
	}
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;cin>>q;
	//while(q--)
	solve();
}




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

int main(){
    int N,M,X,ans1=0,ans2=0;
    cin>>N>>M>>X;
    vector<int> A(M);
    for(int i=0;i<M;i++){
        cin>>A.at(i);
        if(X<A.at(i)){
            ++ans2;
        }else if(A.at(i)<X){
            ++ans1;
        }
    }
    cout<<min(ans1,ans2)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
// bool debug=false;

/*---------------------------------------------------*/

int main() {
  string S;
  cin >> S;
  int cnt = 0;
  for(int i = 0; i < S.size(); i++) if(S[i] == 'x') cnt++;
  if(8 <= cnt) cout << "NO" << endl;
  else cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin    );
	freopen("output.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	string s = "";
	while (n--)
		s += "ACL";
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3516
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
map<char,ll> mp;
int main(){
int n,m,q;
cin>>n>>m>>q;
vector<vector<int>>root(n,vector<int>(n,0)),sum(n+1,vector<int>(n+1,0));
for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    root.at(a).at(b)++;
}
for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        sum.at(i+1).at(j+1)=sum.at(i+1).at(j)+root.at(i).at(j);
    }
}
for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        sum.at(j+1).at(i+1)+=sum.at(j).at(i+1);
    }
}
//cout<<sum.at(n).at(n)<<endl;
vector<int> ans;
for(int t=0;t<q;t++){
  int l,r;
  cin>>l>>r;
 // l--;r--;
 int res=sum.at(r).at(r)-sum.at(r).at(l-1)-sum.at(l-1).at(r)+sum.at(l-1).at(l-1);
ans.push_back(res);
}
for(int i=0;i<ans.size();i++)cout<<ans.at(i)<<endl;
}


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

int main()
{
    int N;
    cin >> N;
    vector<int> A,nums;
    for(int a =0;a < N;a++){
        int b;cin >> b;
        A.push_back(b);
    }
    for(int a:A){
        int b = 0;
        while(a % 2 == 0){
            a = a / 2;
            b++;
        }
        nums.push_back(b);
    }
    std::sort(nums.begin(),nums.end());
    int a = 0;
    int b = 0;
    int c = 0;
    for(int num:nums){
        if(num == 0)a++;
        if(num == 1)b++;
        if(num >= 2)c++;
    }
    if(b != 0)a++;
    /*
    for(int a:nums){
        cout<<a<<" ";
    }
    cout<<endl;
    //cout<< a<<" "<<b<<" "<<c<<endl;
    */
    cout<<(a-1 <= c?"Yes":"No")<<endl;
    return 0;
}


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

#define rep(i, s, n) for (Int i = s; i < (Int)(n); i++)
#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
double EPS = 1e-10;
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    Int n;
    cin >> n;
    vector<Int> a(n);
    rep(i, 0, n) cin >> a[i];
    sort(all(a));
    a.push_back(INF);
    Int res = 0;
    rep(i, 0, n - 1) rep(j , i + 1, n) {
        Int x1 = upper_bound(all(a), a[i] - a[j]) - a.begin();
        Int x2 = upper_bound(all(a), a[j] - a[i]) - a.begin();
        Int x3 = lower_bound(all(a), a[i] + a[j]) - a.begin();
        Int add = x3 - max(x1, x2);
        //cout << i << " " << j << " " << max(x1, x2) << " " << x3 << endl;
        if (max(x1, x2) <= i and i < x3) add--;
        if (max(x1, x2) <= j and j < x3) add--;
        res += max(add, (Int)0);
    }
    dump(res / 3);
    return 0;
}

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


// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int strtoint(char s){
  return (int(s-'0'));
}
char changeS(char alpha){
  if(0x41 <= alpha and alpha <= 0x5A)return (alpha + 0x20);
  else if(0x61 <= alpha and alpha <= 0x7A)return (alpha - 0x20);
  return alpha;
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }



int main(){
  string s;
  cin >> s;
  rep(i,s.size()){
    if(s[i] == ',')s[i] = ' ';
    cout << s[i];
  }
  cout << endl;
}


Measured memory_bytes: 256
n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())
count = 0
checked = [False]*len(a)
button = 1
while True:
    count += 1
    button = a[button-1]
    if button == 2:
        print(count)
        break
    if checked[button-1]:
        print(-1)
        break
    checked[button-1] = True


Measured memory_bytes: 7668
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using ll = long long;
#define ull unsigned ll
#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ppi pair<int, pii>
#define mt make_tuple
#define eb emplace_back
using namespace std;

const ll N = 1e5 + 5, mod = 1e9 + 7;
const ll inf = 1e9;
vi a(N);
void solve(){
    ll n, ans = 0;
    cin >> n;
    vi a(n + 5);
    for(ll i = 1; i <= n; i++){
        for(ll j = i; j <= n; j += i){
            a[j]++;
        }
        ans += a[i] * i;
    }
    cout << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);//cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll t,p;
    t=1;
    //cin>>t;
    for(p=1;p<=t;p++){
        solve();
    }
    return 0;
}


Measured memory_bytes: 42796
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

int N, K; ll A[15];

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


  ll ans = INF;
  for (int i = 0; i < pow(2, N); i++){
    int num = i, cnt = 0;
    ll Cost = 0, Highest = 0;
    for (int j = 0; j < N; j++){
      if (num % 2 != 0){
        cnt++;
        if (Highest < A[j]){
          Highest = A[j];
        }else{
          Cost += Highest - A[j] + 1;
          Highest++;
        }
      }else{
        Highest = max(Highest, A[j]);
      }
      num /= 2;
    }
    if (cnt >= K) ans = min(Cost, ans);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
using namespace std;
using ulong = unsigned long;
using ll = long long;

void out(int last, int n){
	for(int i=1;i<last;i++){
		cout << i << endl;
	}
	for(int i=n-1;i>=last;i--){
		cout << i << endl;
	}
}

int main(){
	int n, l;
	cin >> n >> l;
	int prev;
	cin >> prev;
	for(int i=1;i<n;i++){
		int a;
		cin >> a;
		if(prev + a >= l){
			cout << "Possible" << endl;
			out(i, n);
			return 0;
		}
		prev = a;
	}
	cout << "Impossible" << endl;
	return 0;
}


Measured memory_bytes: 888
#include<iostream>  
#include<algorithm>  
#include<cstring>  
#include<cstdio>  
  
using namespace std;

const int inf = 0x3f3f3f3f;

struct node
{
    int u,v;
};
node e[200050];
int head[100050],vis[100050],tr[100050],a[100050];
int cnt;
int n,m;

void addedge(int u,int v)
{
    e[cnt].v=v;
    e[cnt].u=head[u];
    head[u]=cnt++;
}

int findx(int x)
{
    if(tr[x]==x) return x;
    return tr[x]=findx(tr[x]);
}
void merge(int u, int v)  
{
    int fx=findx(u);
    int fy=findx(v);
    if(tr[fy]!=fx)
        tr[fy]=fx;
}
void dfs(int u)
{  
    vis[u]=1;  
    for(int i=head[u];i!=-1;i=e[i].u)
    {  
        int v=e[i].v;
        if(!vis[v])
        {
            tr[v]=cnt;
            dfs(v);
        }
    }
}
void init()
{
    cnt=0;
    memset(head,-1,sizeof(head));
    memset(vis,0,sizeof(vis));
    for(int i=0;i<n;i++) tr[i]=i;
}
int main()  
{
    init();
    scanf("%d%d",&n,&m); 
    for(int i=1;i<=n;++i)
        scanf("%d",&a[i]);
    for(int i=0;i<m;++i)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        addedge(x,y);
        addedge(y,x);
    }
    int ans=0;
    cnt=1;
    for(int i=1;i<=n;++i)
    {
        if(!vis[i])
        {
            tr[i]=cnt;
            dfs(i);
            cnt++;
        }
        if(tr[a[i]]==tr[i])
            ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 4352
s = gets.chomp.split("/").map(&:to_i)
if s[0] <= 2019 then
  if s[1] <= 4 then
    if s[2] <= 30 then
      print "Heisei"
    else
      print "TBD"
    end
  else
    print "TBD"
  end
else
  print "TBD"
end

Measured memory_bytes: 1788
# -*- coding: utf-8 -*-
"""
Created on Thu May  3 19:22:34 2018
ALDS-1-5-C
@author: maezawa
"""
cnt = 0
n = int(input())
a = list(map(int, input().split()))

def merge_sort(a, left, right):
    #global cnt
    #cnt += 1
    if left+1 < right:
        mid = (left+right)//2
        merge_sort(a, left, mid)
        merge_sort(a, mid, right)
        merge(a, left, mid, right)

def merge(a, left, mid, right):
    global cnt
    n1 = mid - left
    n2 = right - mid
    
    l = a[left:mid].copy()
    r = a[mid:right].copy()
    
    l.append(10**10)
    r.append(10**10)
    i = 0
    j = 0
    
    for k in range(left, right):
        cnt += 1
        if l[i] <= r[j]:
            a[k] = l[i]
            i += 1
        else:
            a[k] = r[j]
            j += 1
            
merge_sort(a, 0, len(a))
print(a[0], end='')
for i in range(1,len(a)):
    print(' {}'.format(a[i]), end='')
print()
print(cnt)
    


Measured memory_bytes: 61660
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
using namespace std;
#define mp make_pair
#define sc second
#define fs first
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ABS(a) (((a)>0)?(a):(-(a)))
typedef long long LL;
typedef pair < int , int > pii;
int n,m,k,d,t,a[200005],b[600005];
int main(){
	int xb,x2;
	scanf("%d",&n);
	for(xb=0;xb<n;xb++){
		scanf("%d",&a[xb]);
	}
	int l=300000;
	int r=299999;
	bool cur=1;
	for(xb=0;xb<n;xb++){
		
		if(cur){
			b[++r]=a[xb];
		}
		else b[--l]=a[xb];
		cur=!cur;
	}
	if(cur){
		for(xb=l;xb<=r;xb++){
			printf("%d ",b[xb]);
		}
	}
	else{
		for(xb=r;xb>=l;xb--){
			printf("%d ",b[xb]);
		}
	}
	return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	map<string,ll>ch;
	ll ans=0;
	for(ll i=0;i<n;i++){
		string t;
		cin>>t;
		ch[t]++;
		ans=max(ans,ch[t]);
	}
	for(auto itr=ch.begin();itr!=ch.end();itr++){
		string t=itr->first;
		ll num=itr->second;
		if(ans==num){
			cout << t<<endl;
		}
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 19228
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {

  i64 A, B;
  cin >> A >> B;
  cout << 6 - A - B << endl;

  return 0;
}


Measured memory_bytes: 764
n=int(input())
l=[]
if n==1:
  print(1)
else:
  for i in range(n):
    x,y=map(int,input().split())
    l.append([x,y])

  dic={}
  for i in range(n):
    for j in range(n):
      if i==j:
        continue
      dx,dy = l[j][0]-l[i][0],l[j][1]-l[i][1]
      if (dx,dy) not in dic:
        dic[dx,dy]=1
      else:
        dic[dx,dy]+=1

  dic=sorted(dic.items(),key=lambda x:x[1],reverse=True)
  print(n-dic[0][1])


Measured memory_bytes: 9420
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
const LL MOD=1000000007;
LL dp[2005][2005],n,k,fac[4000005],inv[4000005];
LL QuickPow(LL x,LL p)
{
	LL base=x,ans=1;
	while(p)
	{
		if(p&1)	ans*=base,ans%=MOD;
		p>>=1;
		base*=base;
		base%=MOD;
	}
	return ans;
}
LL C(LL n,LL m){return fac[m]*inv[n]%MOD*inv[m-n]%MOD;}
int main(){
	fac[0]=1;
	scanf("%lld %lld",&n,&k);
	if(k==1)	return puts("1")&0;
	for(LL i=1;i<=n*k;++i)	fac[i]=fac[i-1]*i%MOD;
	inv[n*k]=QuickPow(fac[n*k],MOD-2);
	for(LL i=n*k-1;~i;--i)	inv[i]=inv[i+1]*(i+1)%MOD;
	for(LL i=0;i<=n;++i)	dp[i][0]=1;
	for(LL i=1;i<=n;++i)
	{
		for(LL j=1;j<=i;++j)
		{
			dp[i][j]=(dp[i-1][j]+dp[i][j-1]*(n-j+1)%MOD*C(k-2,n*k-i-(j-1)*(k-1)-1)%MOD)%MOD;
		}
	}
	printf("%lld\n",dp[n][n]);
	return 0;
}

Measured memory_bytes: 88328
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n, m; cin>>n>>m;
    vector<int> p(m);
    vector<string> s(m);
    for(int i=0; i<m; i++) cin>>p[i]>>s[i];

    vector<int> FA(100010, 0);
    vector<int> AC(100010, 0);
    for(int i=m-1; i>=0; i--){
        if(s[i] == "AC"){
            FA[p[i]] = i;
            AC[p[i]] = 1;
        }
    }

    int WA = 0;
    for(int i=0; i<m; i++){
        if(s[i] == "WA"){
            if(i < FA[p[i]]) WA++;
        }
    }

    cout << accumulate(AC.begin(), AC.end(), 0) << " " << WA << endl;

    return 0;
}

Measured memory_bytes: 6912
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	private long f(int x) {
		long res = 0;
		while(x % 2 == 0) {
			x /= 2;
			res++;
		}
		return res;
	}

	private long gcd(long x, long y) {
		if(y == 0) return x;
		return gcd(y, x % y);
	}

	private long lcm(long x, long y) {
		return x / gcd(x,y) *  y;
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int a[]=new int[n];
		for(int i=0; i<n; i++) {
			a[i]=sc.nextInt();
		}
		for(int i=0; i<n; i++) {
			a[i] /= 2;
		}
		long t = f(a[0]);
		for(int i=0; i<n; i++) {
			if(t != f(a[i])) {
				System.out.println(0);
				sc.close();
				return;
			}
		}
		long l=1;
		for(int i=0; i<n; i++) {
			l = lcm(l, a[i]);
		}
		if(l>m) {
			System.out.println(0);
			sc.close();
			return;
		}
		long ans = m/l;
		ans = (ans+1)/2;
		System.out.println(ans);

		sc.close();
	}
}


Measured memory_bytes: 50620
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <queue>

#define MAXCHAR 255

using namespace std;


int main()
{
	string s;
	string t;
	int a;
	int b;
	string u;
	cin >> s >> t >> a >> b >> u;

	if (u == s)
	{
		a--;
	}
	else
	{
		b--;
	}

	cout << a <<" "<< b << endl;

	return 0;
}

Measured memory_bytes: 256
//i ll be the king
#include<bits/stdc++.h>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define rep(n) for(ll i2=0;i2<n;i2++)
#define vmp(v,a,b) v.push_back(make_pair(a,b))
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define aset(a,n,k) for(ll i3=0;i3<n;i3++)a[i3]=k; 	
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define f first
#define s second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;

int main()
{
	sync;
	ll n,arr[5];
	cin>>n;
	input(arr,(ll)5);
	sort(arr,arr+5);
	ll tim=4+ceil(n/(double)arr[0]);
	cout<<tim;
}

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

using namespace std;
using ll=long long;

void solve() {
    int n; cin >> n;
    string s; cin >> s;
    ll res = 0;
    ll r=0,g=0,b=0;
    for (char c:s) {
        if (c=='R')r++;
        if (c=='G')g++;
        if (c=='B')b++;
    }
    res = r*g*b;
    for (int i = 0; i < n; i++) {
        char c = s[i];
        for (int d = 1; i-d >= 0 && i+d < n; d++) {
            if (s[i-d]!=c && s[i+d]!=c && s[i-d]!=s[i+d]) --res;
        }
    }
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
int main() {
    long N,K;
    cin>>N>>K;
    
    string S;
    cin>>S;
    
    for(int i=0;i<N;i++){
        if(i+1==K) cout<<(char)(S.at(i)+32);
        else cout<<S.at(i);
    }
    cout<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define MAX int(7.5*1e6)
using namespace std;

int main(){
  int n, m;
  while(1) {
    scanf("%d %d\n", &m, &n);
    if(n == 0)break;
    vector<bool> isBoring(MAX, false);
    for (;n != 0; n--) {
      while(isBoring[m]) m++;
      for (int j = m; j < MAX; j+=m) isBoring[j] = true;
    }
    while(isBoring[++m]);
    std::cout << m << std::endl;
  }
  return 0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int N; cin >> N;
  map<int, int> m;
  rep(i, N) {
    int d; cin >> d;
    m[d]++;
  }
  int M; cin >> M;
  bool yes = 1;
  rep(i, M) {
    int t; cin >> t;
    if (m[t]) {
      m[t]--;
    } else {
      yes = 0;
    }
  }
  cout << (yes ? "YES\n" : "NO\n");
}


Measured memory_bytes: 9600
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
   int  sum=0;
    cin>>n;
    int l[2*n];
    for(int i=0;i<2*n;i++)
    {
        cin>>l[i];
    }
    sort(l,l+2*n);
    for(int i=0;i<2*n;i+=2)
    {
        sum=sum+l[i];
    }
    cout<<sum;
    
}

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

int main() {
  int n;
  cin >> n;
  rep(x,50000){
      if(x*108/100 == n) {
        cout << x << endl;
        break;
      }
      else if(x*108/100 < n && n < (x+1)*108/100){
          cout << ":(" << endl;
          break;
      }
  }
}

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

using namespace std;

typedef long long ll;

int N, A[2005], pref[2005];

bitset<4000005> num[2];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	for (int i = 1; i <= N; ++i){
		cin >> A[i];
		pref[i] = pref[i-1] + A[i];
	}
	num[0][0] = 1;
	for (int i = 1; i <= N; ++i){
		num[i&1] = (num[(i-1)&1] | (num[(i-1)&1] << A[i]));
	}
	for (int i = (pref[N]+1)/2; i <= pref[N]; ++i){
		if (num[N&1][i]){
			cout << i << '\n';
			cout << flush;
			//for (int i = 0; i < 1e9; ++i){for (int j = 0; j < 1e9; ++j){}}
			return 0;
		}
	}
}

Measured memory_bytes: 2688
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <unordered_map>
#include <list>
#include <queue>
#include <functional>

using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector<list<int>> dayjob(M + 1);

	for (int i = 0; i < N; i++)
	{
		int A, B;
		cin >> A >> B;
		if (A < M + 1)
		{
			dayjob[A].push_back(B);
		}
	}

	int ans = 0;
	// priority_queue<int, std::vector<int>, std::greater<int> > q;
	priority_queue<int> q;

	for (int remain = 1; remain <= M; remain++)
	{
		for (auto && i : dayjob[remain])
		{
			q.push(i);
		}
		if (!q.empty())
		{
			ans += q.top();
			q.pop();
		}
	}

	cout << ans << endl;

	return 0;
}


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

int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<int>> data(H, vector<int>(W, -1));

    queue<pair<int, int>> que;

    vector<pair<int, int>> diff;
    diff.emplace_back(0,1);
    diff.emplace_back(1,0);
    diff.emplace_back(0,-1);
    diff.emplace_back(-1,0);

    for(int i=0; i<H; i++)
    {
        for(int j=0; j<W; j++)
        {
            char temp;
            cin >> temp;
            if(temp == '#')
            {
                // 黒マスは初期値: 0
                data[i][j] = 0;
                que.emplace(i, j);
            }
            else
            {
                // 白マスは-1
                data[i][j] = -1;
            }
        }
    }

    while(!que.empty())
    {
        auto cur = que.front();
        que.pop();

        // 現在のカーソル位置の上下左右を新たにカーソル位置とする
        for(auto it=diff.begin(); it!=diff.end(); it++)
        {
            // 境界値チェック
            int nx = cur.first + it->first;
            int ny = cur.second + it->second;
            if(nx < 0 || nx >=H || ny < 0 || ny >= W)
                continue;

            if(data[nx][ny] == -1)
            {
                data[nx][ny] = data[cur.first][cur.second] + 1;
                que.emplace(nx, ny);
            }
        }
    }

    int max = 0;
    for(auto it_H : data)
    {
        for(auto it : it_H)
        {
            if(max < it)
            {
                max = it;
            }
        }
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 12432
a, b, k = map(lambda x: int(x), input().split(' '))

def gcd(a, b):
  cand = a % b
  if cand == 0:
    return b
  else:
    return gcd(b, cand)

gcd_res = 0
if a < b:
  gcd_res = gcd(b, a)
else:
  gcd_res = gcd(a, b)

count = 1
for i in reversed(range(1, 101)):
  if (gcd_res % i) == 0:
    if count == k:
      print(i)
      break
    count += 1


Measured memory_bytes: 3060