akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e12;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
#define S set<int>
#define itn int

template <typename T>
struct edge {
    int src, to;
    T cost;

    edge(int to, T cost) : src(-1), to(to), cost(cost) {}

    edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

    edge& operator=(const int& x) {
        to = x;
        return *this;
    }

    operator int() const { return to; }
};

template <typename T>
using Edges = vector<edge<T>>;
template <typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template <typename T>
using Matrix = vector<vector<T>>;
int L;
int c(itn a, int b) {
    int aa = a % L;
    int bb = b % L;
    if (b < L) {
        if (aa + bb <= L) {
            return a + b;
        } else {
            return ((a / L + 1) * L) + b;
        }
    } else {
        return ((a / L + 1) * L) + b;
    }
}
template <typename T>
void warshall_floyd(Matrix<T>& g, T INF) {
    for (int k = 0; k < g.size(); k++) {
        for (int i = 0; i < g.size(); i++) {
            for (int j = 0; j < g.size(); j++) {
                if (g[i][k] == INF || g[k][j] == INF)
                    continue;
                g[i][j] = min(g[i][j], c(g[i][k], g[k][j]));
            }
        }
    }
}

int N, M, A[202020], B[202020], C[202020], Q, s[202020], t[202020];

bool dbg = false;
void solve() {
    Matrix<int> mat(N, vector<int>(N, INF));
    FOR(i, 0, N) {
        mat[i][i] = 0;
    }
    FOR(i, 0, M) {
        if (C[i] > L) {
            C[i] = INF;
        }
        mat[A[i]][B[i]] = C[i];
        mat[B[i]][A[i]] = C[i];
    }
    warshall_floyd(mat, INF);
    warshall_floyd(mat, INF);

    FOR(i, 0, Q) {
        if (mat[s[i]][t[i]] == INF) {
            cout << -1 << endl;
        } else {
            int ans = mat[s[i]][t[i]] / L;
            if (mat[s[i]][t[i]] % L > 0) {
                ans++;
            }
            ans--;
            cout << ans << endl;
        }
    }
    /*
    FOR(i, 0, 5) {
        FOR(j, 0, 5)
        cout << i + 1 << " " << j + 1 << " " << mat[i][j] << endl;
    }
    */
}


signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N >> M >> L;
    FOR(i, 0, M) {
        cin >> A[i] >> B[i] >> C[i];
        A[i]--;
        B[i]--;
    }
    cin >> Q;
    FOR(i, 0, Q) {
        cin >> s[i] >> t[i];
        s[i]--;
        t[i]--;
    }
    solve();
    return 0;
}


Measured memory_bytes: 6784
N,K=map(int,input().split())
Array={}
for n in range(0,N):
    a,b=map(int,input().split())
    if a in Array:
        Array[a]+=b
    else:
        Array[a]=b
numbers=sorted(list(Array.keys()))
n=0
k=0
while True:
    k+=Array[numbers[n]]
    if k>=K:
        break
    n+=1
print(numbers[n])


Measured memory_bytes: 11108
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

string s[13];
bool tp[26];
int a[10],b[26];
int main(){
    int n;
    while(cin>>n,n){
        memset(tp,0,sizeof(tp));
        vector<char> vc;
        rep(i,n){
            cin>>s[i];
            if(s[i].size()!=1)tp[s[i][0]-'A']=true;
            rep(j,s[i].size()) vc.pb(s[i][j]);
        }
        sort(vc.begin(),vc.end());
        vc.erase(unique(vc.begin(),vc.end()),vc.end());
        int sz=vc.size();
        vector<int> v;
        rep(i,sz)if(tp[vc[i]-'A']) v.pb(i);
        int cnt=0;
        rep(i,1<<10){
            if(sz!=__builtin_popcount(i)) continue;
            int cur=0;
            rep(j,10)if((i>>j)&1) a[cur++]=j;
            do{
                int sum=0;
                bool flag=false;
                for(auto it:v)if(a[it]==0) flag=true;
                if(flag)continue;
                rep(j,sz)b[vc[j]-'A']=a[j];
                rep(j,n-1){
                    int num=0;
                    rep(k,s[j].size()) num*=10,num+=b[s[j][k]-'A'];
                    sum+=num;
                }
                int num=0;
                rep(k,s[n-1].size()) num*=10,num+=b[s[n-1][k]-'A'];
                if(num==sum) ++cnt;
            }while(next_permutation(a,a+sz));
        }
        cout<<cnt<<endl;
    }
    return 0;
}


Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
int main() {
  int n;
  double ans=0;
  cin>>n;
  vector<double> a(n);
  vector<string> b(n);
  rep(i,n) cin>>a[i]>>b[i];
  rep(i,n){
    if(b[i]=="JPY"){
      ans+=a[i];
    }else{
      ans+=a[i]*380000;
    }
  }
  cout<<ans<<endl;
}


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

int C[3];

double getP() {
  int a = 0;
  int b = 0;
  for(int i = 1; i <= 10; ++i) {
    bool flag = true;
    for(int j = 0; j < 3; ++j) {
      if(i == C[j]) {
	flag = false;
	break;
      }
    }
    if(!flag) continue;
    ++b;
    if(C[0] + C[1] + i <= 20) ++a;
  }
  return (double)a/b;
}

int main() {
  while(cin >> C[0] >> C[1] >> C[2]) cout << (getP() >= 0.5 ? "YES" : "NO") << endl;
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
using namespace std;

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


const int BIG_NUM = 1e8;

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


	if (s.length() <= k) {
		cout << s;
	}
	else {
		cout << s.substr(0,k) << "...";
	}

}

Measured memory_bytes: 3636
a,b = map(int,input().split())

n = max(a,b)
m = min(a,b)

def gcd(n,m):
    l = n % m
    if l == 0:
        return m
    return gcd(m,l)

def lcm(n,m):
    return (n*m) // gcd(n,m)
    
print(lcm(n,m))

Measured memory_bytes: 3060
N = int(input())
lis=[]
for i in range(N):
  lis.append(int(input()))
lis.sort()

m = (N-1)//2
if N%2==1:
  ans1 = sum(lis[0:m+1])*(-2)+sum(lis[m+1:])*2+lis[m]+lis[m-1]
  ans2 = sum(lis[0:m])*(-2)+sum(lis[m:])*2-lis[m]-lis[m+1]
  ans = max(ans1,ans2)
else:
  ans = sum(lis[0:m+1])*(-2)+sum(lis[m+1:])*2+lis[m]-lis[m+1]
print(ans)

Measured memory_bytes: 7512
n = int(input())
h = list(map(int,input().split()))[::-1]
for i in range(n-1):
  if h[i]>=h[i+1]:
    continue
  elif h[i]==h[i+1]-1:
    h[i+1]-= 1
  else:
    print('No')
    break
else:
  print('Yes')

Measured memory_bytes: 14396
//icpc2010dC test using InformationScience2008[3] ite()
a[181],b1[1000000],b2[1000000];
void ite(n){
  int m,k,l,i;
  b1[0] = b2[0] = 0;
  for(m=1;m<=n;m++){
    i = 0;
    k = l = -1;
    for(i=1;i<181;i++){
      if(m >= a[i] && b1[m-a[i]] >= 0 && (k < 0 || b1[m-a[i]] + 1 < k))
        k = b1[m-a[i]] + 1;
      if((a[i]&1) && m >= a[i] && b2[m-a[i]] >= 0 && (l < 0 || b2[m-a[i]] + 1 < l))
        l = b2[m-a[i]] + 1;
    }
    b1[m] = k;
    b2[m] = l;
  }
}

main(n){
	for(n=1;n<181;n++)a[n]=n*(n+1)*(n+2)/6;
	ite(999999);
	for(;scanf("%d",&n),n;)printf("%d %d\n",b1[n],b2[n]);
	exit(0);
}

Measured memory_bytes: 8044
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f(a, b) for (ll i = a; i <= b; i++)
#define pb push_back
#define pf push_front
#define mp make_pair
using namespace std;
#define N 200005
const ll INF = 1000000000000000001;
const ll MOD = 1000000007;

//vector< vector<ll> > g(N);
//vector< pair<ll, pair< ll, ll > > > g(N);
//ll vis[N] = {0}, par[N] = {0}, child[N] = {0},cnt = 0;


void solve(){
    ll x,k,d; cin >> x>> k >> d;
    x = abs(x);
    ll step = x / d;
    if( k <= step){
        cout << abs(x - d*k) ; return;
    } 
    
    k -= x/d;

    if(k % 2 == 0){
        cout << abs(x - (x/d)*d) << '\n';
    }
    else cout << abs(d-(x - (x/d)*d)) << "\n";
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
   //ll t;cin >> t;for(ll index=1; index<=t; index++){
        //cout << "Case #" << index << ": " ;
        solve();
   // }
    return 0;
}

Measured memory_bytes: 3588
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        int[] NW = ReadLineParseIntArray();
        int N = NW[0];
        int W = NW[1];
        long[] dp = Enumerable.Repeat(1L << 60, N * 1000 + 1).ToArray();

        for(int i = 0; i < N; i++)
        {
            int[] wv = ReadLineParseIntArray();
            for (int v = dp.Length - 1; v >= 0; v--)
            {
                if (v >= wv[1])
                    dp[v] = Min(dp[v], dp[v - wv[1]] + wv[0]);
                else
                    dp[v] = Min(dp[v], wv[0]);
            }
        }

        for (int i = dp.Length - 1; i >= 0; i--)
        {
            if(dp[i] <= W)
            {
                WriteLine(i + 1);
                return;
            }
        }

    }

    static int ReadLineParseInt() => int.Parse(ReadLine());
    static int[] ReadLineParseIntArray() => ReadLine().Split(' ').Select(int.Parse).ToArray();
}

Measured memory_bytes: 13664
#include<stdio.h>
#include<algorithm>
#include<utility>
#include<iostream>
#include<string>
#include<vector>
using namespace std;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main()
{
  int n;

  scanf("%d", &n);
  
  vector<pair<int, int> > pairs(n);

  int a, b;

  int sum = 0;
  int ans = 1;

  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a, &b);

    pairs[i].first = a;
    pairs[i].second = b;
  }

  sort(pairs.begin(), pairs.end(), compare_by_b);

  for (int i = 0; i < n; i++) {
    sum += pairs[i].first;

    if (sum > pairs[i].second) {
      ans = 0;
    }
  }

  if (ans == 1) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  
  return 0;
}


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

struct color {
    double l, a, b;

    color() {}
    ~color() {}

    color(double x, double y, double z): l(x), a(y), b(z) {}
};

int N, M;
vector<color> c;
vector<vector<double>> dis;

double dfs(int i, double s, vector<int>& vec) {
    if(vec.size() == M) {
        return s;
    }

    if(i >= N) {
        return 0;
    }

    double ret = 0;

    ret = max(ret, dfs(i + 1, s, vec));

    for(int k = 0; k < vec.size(); ++k) {
        s += dis[i][vec[k]];
    }
    vec.push_back(i);

    ret = max(ret, dfs(i + 1, s, vec));

    vec.pop_back();

    return ret;
}

double solve() {
    dis = vector<vector<double>>(N, vector<double>(N));
    for (int j = 0; j < N; ++j) {
        for (int k = 0; k < N; ++k) {
            dis[j][k] =
                (c[j].l - c[k].l) * (c[j].l - c[k].l)
                + (c[j].a - c[k].a) * (c[j].a - c[k].a)
                + (c[j].b - c[k].b) * (c[j].b - c[k].b);
        }
    }

    vector<int> vic(0);
    return dfs(0, 0, vic);
}

int main() {
    cin >> N >> M;
    c.resize(N);
    for(int j = 0; j < N; ++j) {
        cin >> c[j].l >> c[j].a >> c[j].b;
    }
    printf("%.10lf\n", solve());
    return 0;
}

Measured memory_bytes: 1272
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
int main(){
  int A, B, C, D ,E ,F;
  string S,Sa,Sb,Sc;
  cin >> A >> B;
  bool ans = false;
  if(A % B == 0)ans = true;
if(ans)cout << 0 << endl;
else cout << 1 << endl;
        return 0;
}

Measured memory_bytes: 256
/// However long the night,
///     The dawn will break
/// ICPC next year

#include<bits/stdc++.h>
using namespace std ;
const int N = 2e5+5 ;

int n ,q ,u ,v ,x ;
long long cnt[N] ;
vector<int> adj[N] ;
void dfs(int p,int gp,long long add){
    cnt[p] = add ;
    for(int ch:adj[p]){
        if(ch==gp) continue ;
        dfs(ch,p,add+cnt[ch]);
    }
}
int main(){
    scanf("%d%d",&n,&q);
    for(int i=1;i<n;++i){
        scanf("%d%d",&u,&v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    while(q--){
        scanf("%d%d",&u,&x);
        cnt[u] += x ;
    }
    dfs(1,1,cnt[1]);
    for(int i=1;i<=n;++i)printf("%lld ",cnt[i]);
    return 0;
}


Measured memory_bytes: 24320
N = int(input())
 
#R[0]
minv = int(input())
maxv = -10**12
 
#R[1..N-1]
for j in range(1, N):
    r = int(input())
    maxv = max(maxv, r - minv)
    minv = min(minv, r)
     
print(maxv)


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

ll calc(ll a, ll x)
{
    if (a < 0) return 0LL;
    return a / x + 1LL;
}

int main()
{
    ios::sync_with_stdio(false);
    ll A, B, X;
    cin >> A >> B >> X;
    cout << calc(B, X) - calc(A-1, X) << endl;
}



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

using namespace std;

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e18+7;

signed main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(auto& x : a)
        cin >> x;
    // l: 立っているものの数 0の時はこれが加算される
    vector<ll> l(42, 0);
    for(ll i = 0; i < n; ++i){
        for(ll j = 0; j < 42; ++j){
            if(a[i] & (1LL << j))
                ++l[j];
        }
    }

    auto f = [&](int t){
        int sum = 0;
        for(auto& x : a)
            sum += t ^ x;
        return sum;
    };

    vector<ll> dp(2, -INF);
    dp[1] = 0;
    for(ll i = 41; i >= 0; --i){
        vector<ll> nex(2, -INF);
        if(dp[0] >= 0){
            nex[0] = max(nex[0], dp[0] + (1LL << i) * (n - l[i]));
            nex[0] = max(nex[0], dp[0] + (1LL << i) * l[i]);
            nex[1] = max(nex[1], dp[0] + (1LL << i) * (n - l[i]));
            nex[1] = max(nex[1], dp[0] + (1LL << i) * l[i]);
        }

        if(dp[1] < 0)
            continue;
        // 立てる場合
        if(k & (1LL << i)){
            // 限界まで伸ばす
            nex[1] = max(nex[1], dp[1] + (1LL << i) * (n - l[i]));
            nex[0] = max(nex[0], dp[1] + (1LL << i) * l[i]);
        }else{
            // 立てられない場合
            nex[1] = max(nex[1], dp[1] + (1LL << i) * l[i]);
        }
        dp = move(nex);

    }
    cout << *max_element(dp.begin(), dp.end()) << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int a,b;
    string op;
    cin >> a >> op >> b;
    if(op == "+") cout << a + b << endl;
    else cout << a - b << endl;
}

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

using namespace std;

int main(){
	int w, n;
	int line[30];

	cin >> w;
	cin >> n;

	for(int i = 0; i < 30; i++){
		line[i] = i+1;
	}

	for(int i = 0; i < n; i++){
		int a, b;
		scanf("%d,%d", &a, &b);
		swap(line[a-1], line[b-1]);
	}

	for(int i = 0; i < w; i++){
		cout << line[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1236
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();

    let mut ans = n % 1000;
    ans = 1000 - ans;
    ans = ans % 1000;

    print!("{}", ans);
}


Measured memory_bytes: 2088
#include <stdio.h>
#include <string.h>

int main(void)
{
	int n,a=0,w=0,t=0,r=0,i;
	scanf("%d",&n);
	char s[10];
	for(i=0;i<n;i++){
		scanf("%s",s);
		if(strcmp(s,"AC") == 0) a++;
		if(strcmp(s,"WA") == 0) w++;
		if(strcmp(s,"TLE") == 0) t++;
		if(strcmp(s,"RE") == 0) r++;
	}
	printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n",a,w,t,r);
	return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

int main() {
    #ifdef LOCAL
    assert(freopen("a.in", "r", stdin));
    #else
    #endif
    ll n, a, b;
    cin >> n >> a >> b;
    if (a > b) {
        cout << 0 << '\n';
        return 0;
    }
    if (n == 1) {
        cout << (a == b) << '\n';
        return 0;
    }
    cout << ((n - 1) * b + a) - ((n - 1) * a + b) + 1 << '\n';
}


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 REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

#define INF 1e9

ll GCD(ll x, ll y){
  if(x < y){
    swap(x, y);
  }
  if(y==0){
    return x;
  }
  return GCD(y, x%y);
}
ll LCM(ll x, ll y){
  return x*y /GCD(x, y);
}

int main(){
  ll A, B;
  cin >> A >> B;
  cout << LCM(A, B) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    int a, b;
    cin >> a >> b;
    if (a >= 2*b) cout << a-2*b << '\n';
    else cout << 0 << '\n';
}

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

    //int t; cin >> t; while (t--)
        solve();
}

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cout << setprecision(4) << setiosflags(ios::fixed); // printf("%.4f", x);

    int n;
    cin >> n;

    vector<int> t(n), v(n);
    for (int i = 0; i < n; ++i) cin >> t[i];
    for (int i = 0; i < n; ++i) { cin >> v[i]; v[i] *= 2; }

    int T = 2 * accumulate(t.begin(), t.end(), 0);
    vector<int> ub(T + 1, INT_MAX / 2);

    int x = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < t[i]; ++j) {
            ub[x] = min(ub[x], v[i]);
            ub[x + 1] = min(ub[x + 1], v[i]);
            ub[x + 2] = min(ub[x + 2], v[i]);
            x += 2;
        }
    }

    ub[0] = ub[T] = 0.0;
    for (int i = 1; i < T; ++i) ub[i] = min(ub[i], ub[i - 1] + 1);
    for (int i = T - 1; 0 < i; --i) ub[i] = min(ub[i], ub[i + 1] + 1);

    double len = 0.0;
    for (int i = 1; i <= T; ++i)
        len += max(ub[i - 1], ub[i]) - (ub[i - 1] == ub[i] ? 0.0 : 0.5);

    cout << 0.25 * len << endl;

    return 0;
}


Measured memory_bytes: 384
import numpy as np
N,M=map(int,input().split())
wa=np.zeros(N+1)
ac=np.zeros(N+1)
for _ in range(M):
    p,S=input().split()
    if S=='AC' and ac[int(p)]==0:
        ac[int(p)]+=1
    elif S=='AC' and ac[int(p)]>0:
        pass
    elif ac[int(p)]==0:
        wa[int(p)]+=1
print(int(sum(ac)), int(np.dot(ac>0,wa)))

Measured memory_bytes: 14700
/*
	Copyright: razouq (c)
	Author: Anass BENDARSI
	Date: 06/08/2017 13:29:34
	flamers will **** you
*/
#include<bits/stdc++.h>
//#include<flamers.h>
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define POB pop_back
#define dist(a, b) sqrt(a*a + b*b)
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vipi;
bool compare(pi p1, pi p2){
	 if(1) return true;
	 return false;
}

int main(){
//	freopen("input.in", "r", stdin);
//	freopen("output.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie();
	int h, w;
	cin>>h>>w;
	int n;
	cin>>n;
	int mat[h][w];
	int x;
	int i = 0, j = 0;
	for(int k = 1; k <= n; k++){ // color k
		cin>>x; //repeated x time
		
		while(x--){
			mat[i][j] = k;
			if(j == 0 && i % 2 == 1){
				i++;
			}
			else if(j == w-1 && i % 2 == 0){
				i++;
			}
			else if(i % 2 == 0) j++;
			else j--;
		}
	}
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++) cout<<mat[i][j]<<" ";
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define sc scanf
#define pr printf
#define B break
#define R return
#define C continue
#define pb push_back
using namespace std;
int n,a,m,b,c;
int ans=1e9,w[2000000];
vector <ll> v;
ll d1=0;
map <string,int>M;
int main()
{
    cin>>n;
    for (int i=0;i<n;i++){
        string s;
        cin >>s;
        M[s]++;
    }
    cin >>m;
    for (int i=0;i<m;i++){
        string s;
        cin >>s;
        M[s]--;
    }
    ans=0;
    for (auto pp:M){
        a=pp.S;
        ans=max(a,ans);
    }
    cout <<ans<<endl;
    return 0;
}
// 999999999 1000000000


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  char s[200001], t[200001];
  scanf("%s%s", s, t);

  int i, count=0;
  for(i=0; s[i]!='\0' ; i++){
      if(s[i]!=t[i])
        count++;
  }

  printf("%d\n", count);
  return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this

void solve(){
    ll R,G,B,N; cin>>R>>G>>B>>N;

    map<ll,ll> mm;

    FOR(i,0,3000){
        FOR(j,0,3000){
            ll x = i*R + j*G;
            if(x > N) break;
            mm[x]++;
        }
    }

    ll ans = 0;

    FOR(k,0,3000){
        ll remain = N - k*B;
        if(remain < 0) continue;
        ans += mm[remain];
    }

    cout<<ans<<endl;
}  

signed main(){

   FastRead;    



    ll t;
    t = 1; 
    // cin>>t;
    FOR(i,1,t){
        solve();
    }
}




Measured memory_bytes: 384
#include<cstdio>
using namespace std;
int main(){
    int n,m;
    while(scanf("%d%d",&n,&m),n,m){
        bool stage[1024] = {0};
        int q = 1,x = 1;
        int cnt = 0,q_cnt = 0;
        for(;;){
            for(int i = x;;){
                if(stage[i] == 0)q_cnt++;
                if(q_cnt == m){
                    x = i;
                    q_cnt = 0;
                    break;
                }
                ++i;
                if(i > n)i -= n;
            }
            stage[x] = 1;
            cnt++;
            if(cnt == n-1)break;
        }
        for(int i = 1;i <= n; i++){
            if(stage[i] == 0){
                printf("%d\n",i);
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1024
//#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
//#include <cstdio>
#include <iostream>
#include <algorithm>
//#include <cstdlib>
//#include <cmath>
//#include <cstring>
using namespace std;

int main(void){

	int N;
	// char ;

	cin >> N;

	int i;

	for (i = 0; i < N; i++){
		long long int s, d;
		cin >> s>> d;
		long int result = 0;

		while (s != d){


			if (s % 2 != 0){
				s++;
				result++;
			}
			if (d % 2 != 0){
				d--;
				result++;
			}
			s /= 2;
			d /= 2;
		}
		cout << result << endl;

	}

	return 0;
}

/*
for(i=0;i<N;i++){
cin >> X[i];
}


for(i=0;i<N;i++){
for(j=0;j<N;j++){
cin >> X[i][j];
}
}
*/

Measured memory_bytes: 1168
import math

def factorization(n):
    factor_list = []
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp+1):
        if n % num == 0:
            count = 0
            while n % num == 0:
                count += 1
                n //= num
                
            factor_list.append([num, count])
        
    if n != 1:
        factor = [n, 1]
        factor_list.append(factor)
    #print(n)
    return factor_list
            

def main():
    n = int(input())
    count = 0
    
    factor_list = factorization(n)
    
    for _, exponent in factor_list:
        #exponent = 1
        #n /= factor[0] ** exponent
        #count += 1
        #factor[1] -= exponent
        #exponent += 1
        #print(exponent)
        i = 1
        while exponent >= i:
            #print(factor_list)
            #n /= factor[0] ** exponent
            count += 1
            exponent = exponent - i
            i += 1
    
    print(count)
    return
    
if __name__ == '__main__':
    main()

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

bool digit(char c){
    return c >= '0' && c <= '9';
}

bool solve(string &s, string &t){
    int n = s.size(), m = t.size();
    int i=0,j=0;
    while(i<n && j<m){
        if(digit(s[i]) != digit(t[j])){
            return digit(s[i]);
        }
        if(digit(s[i])){
            ll snum = 0, tnum = 0;
            while(i<n && digit(s[i])){
                snum = snum*10 + s[i]-'0';
                i++;
            }
            while(j<m && digit(t[j])){
                tnum = tnum*10 + t[j]-'0';
                j++;
            }
            if(snum != tnum) return snum < tnum;
            i--; j--;
        }
        else{
            if(s[i] != t[j]) return s[i] < t[j];
        }
        i++; j++;
    }
    return i >= n;
}

int main() {
    int n;
    string s;
    cin >> n >> s;
    for(int i=0;i<n;i++){
        string t;
        cin >> t;
        cout << (solve(s,t) ? '+' : '-') << endl;
    }
    return 0;
}



Measured memory_bytes: 3204
#include<cstdio>
#include<cstring>
char s[100005];
int b[100005],w[100005],pb,pw,ac,turn;
int main(){
	scanf("%s",s);
	int len=strlen(s);
	pb=pw=0;
	for (int i=0; i<len; i++){
		if (s[i]=='B') b[++pb]=i;
		else w[++pw]=i;
	}
	if (b[pb]==len-1) turn = 0;
	else turn = 1;
	ac=0;
	while (pw>0&&pb>0){
		if (turn){
			++ac;
			while (pw>0&&w[pw]>b[pb]) --pw;
			if (!pw) break;
			turn ^=1;
		}
		else{
			++ac;
			while (pb>0&&b[pb]>w[pw]) --pb;
			if (!pb) break;
			turn ^=1;
		}
	}
	printf("%d\n",ac);
	return 0;
}

Measured memory_bytes: 640
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-04-04 20:21:41
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

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

  int k; cin >> k;

  vector<string> v;

  auto rec = [&](const auto& rec, string s) -> void {
    v.emplace_back(s);
    if (s.size() == 11) {
      //return ;
    } else {
      if (s.back() == '0') {
        rec(rec, s + '0');
        rec(rec, s + '1');
      } else if (s.back() == '9') {
        rec(rec, s + '8');
        rec(rec, s + '9');
      } else {
        char c = s.back();
        char pre = (char)(c - 1);
        char nxt = (char)(c + 1);
        rec(rec, s + pre);
        rec(rec, s + c);
        rec(rec, s + nxt);
      }
    }
  };

  rec(rec, "1");
  rec(rec, "2");
  rec(rec, "3");
  rec(rec, "4");
  rec(rec, "5");
  rec(rec, "6");
  rec(rec, "7");
  rec(rec, "8");
  rec(rec, "9");

  sort(all(v), [](const string& x, const string& y){
    if (x.size() == y.size()) {
      return x < y;
    } else {
      return x.size() < y.size();
    }
  });

  //debug(v);

  cout << v[k - 1] << endl;

  return 0;
}

Measured memory_bytes: 42860
#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, sum = 0;
    int x[110];
    cin >> n;
    rep(i, n){
        cin >> x[i];
        sum += x[i];
    }

    int p1 = sum / n;
    int p2 = p1 + 1;
    int ans1 = 0;
    int ans2 = 0;
    rep(i, n){
        ans1 += (x[i]-p1)*(x[i]-p1);
        ans2 += (x[i]-p2)*(x[i]-p2);
    }
    if(ans1 < ans2) cout << ans1 << endl;
    else cout << ans2 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<cmath>
#include<ctime>
#include<locale>
using namespace std;
long long a[1000010];
int main()
{
    long n;
    cin>>n;
    long long z=20000000000;
    long long s=0;
    for(long i=0;i<n;i++)
    {
        //long long x;
        scanf("%lld",&a[i]);
        //q.push(x);
        s+=a[i];
    }
    long long x=0;
    for(long i=0;i<n-1;i++)
    {
        x+=a[i];
        z=min(z,abs(s-x*2));
    }
    cout<<z;
    return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main(void)
{
    int n,i,a,b,c,w[10000];
	while(1){
	    scanf("%d",&n);
		if(n==0) break;
		for(i=0;i<n;i++){
		    scanf("%d %d %d",&a,&b,&c);
			if(a==100||b==100||c==100||(a+b)/2>=90||(a+b+c)/3>=80) w[i]=1;
			else if((a+b+c)/3>=70||(a+b+c)/3>=50&&(a>=80||b>=80)) w[i]=2;
			else w[i]=3;
		}
		for(i=0;i<n;i++){
		    if(w[i]==1) printf("A\n");
		    if(w[i]==2) printf("B\n");
		    if(w[i]==3) printf("C\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2584
///   BISMILLAHIR RAHMANIR RAHEEM
///   ALLAH IS WATCHING ME
///   ALLAH save us from COVID-19.Amin.

///   █▀█─█──█──█▀█─█─█
///   █▄█─█──█──█▄█─█▄█
///   █─█─█▄─█▄─█─█─█─█

///   كُلُّ نَفْسٍ ذَآئِقَةُ الْمَوْت
///   Every soul shall taste death.

/// TODO::

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

///  order_of_key return number of elements less than x.
///  find_by_order return index.

using namespace std;
using namespace __gnu_pbds;


#define MOHAMMAD  ios::sync_with_stdio(0);cin.tie(0);
#define all(x)    (x).begin(), (x).end()
#define AE        cout << fixed << setprecision(10);

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; // 8-direction.......
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[]= {1,-1,0,0}; // 4-direction...........
int dy4[]= {0,0,1,-1};

typedef tree< int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

//debug
template<typename F,typename S>ostream&operator<<(ostream&os,const pair<F,S>&p){return os<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&v){os<<"{";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<*it;}return os<<"}";}
template<typename T>ostream&operator<<(ostream&os,const set<T>&v){os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<",";os<<*it;}return os<<"]";}
template<typename T>ostream&operator<<(ostream&os,const multiset<T>&v) {os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<*it;}return os<<"]";}
template<typename F,typename S>ostream&operator<<(ostream&os,const map<F,S>&v){os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<it->first<<" = "<<it->second;}return os<<"]";}
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu(){cerr << endl;}
template<typename T>void faltu(T a[],int n){for(int i=0;i<n;++i)cerr<<a[i]<<' ';cerr<<endl;}
template<typename T,typename...hello>void faltu(T arg,const hello&...rest){cerr<<arg<<' ';faltu(rest...);}
//#else
//#define dbg(args...)
//***********************************************  The END **********************************************************************************************************************************
using ll = long long;
const ll N = 1e5 + 200;
const ll INF = 1e18;

ll dp[N + 1] , n , a[N] , k;

ll recur ( ll idx ){
   // dbg ( idx );
  // if( cover==n-1 ) return 0;

   if(idx==n) return 0;
   if(idx>n) return INF;


   ll &ret = dp[idx];
   if(~ret) return ret;


   ll mn = INF;

   for ( ll i = 1 ; i<=k ; ++i )
   mn = min ( mn , abs(a[idx] - a[idx+i]) + recur ( idx + i ) );

   return ret = mn;

}


int main()
{

  MOHAMMAD

  memset ( dp , -1 , sizeof dp );

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

  for ( ll i = n ; i<=n+k ; i++ ) a[i] = a[n-1];

  cout << recur ( 0 );


}


/*





  Alhamdulillah
*/



Measured memory_bytes: 12916
#include <iostream>
#define ffor(a, b, c) for (int a=b; a<=c; a++)
using namespace std;

int n, k, h[100007], dp[100007];

int main() {
	cin>>n>>k;
	ffor (i, 1, n) cin>>h[i];
	dp[1]=0;
	ffor (i, 2, n) {
		dp[i] = (1<<31)-1;
		ffor (j, 1, k) {
			if (i-j>0) dp[i] = min(dp[i], dp[i-j]+abs(h[i]-h[i-j]));
		}
	}
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
using namespace std;
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define sq(a) (a)*(a)
#define rev(s) reverse(s.begin(),s.end())
#define end_program(s) cout << s <<endl;return 0
int kai_size = 120001;
vel kai(kai_size, 1);
vel ink(kai_size, 1);
vel dist;
int RE() {
	vel v(3, 2);
	return v.at(4); 
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; }
	return ans % p;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, kai_size-1) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, kai_size) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p; ans *= ink[n - r]; ans %= p;
	return ans;
}
vel dis(int mid1, vvel &way) {
	int n = way.size();
	vel dist(n, -1); dist[mid1] = 0;
	queue<int> q;
	q.push(mid1);
	while (!q.empty()) {
		int st = q.front(); q.pop();
		rep(i, way[st].size()) {
			int to = way[st][i];
			if (dist[to] == -1) {
				dist[to] = dist[st] + 1;
				q.push(to);
			}
		}
	}
	return dist;
}
pin most_far(int now, int n, vvel &way) {
	vel dist1 = dis(now, way);
	pin ans = mkp(-1, 0);
	rep(i, n) {
		if (dist1[i] > ans.first) { ans = mkp(dist1[i], i); }
	}
	return ans;
}

int per(int a, int b) {
	int ans = a % b;
	if (ans < 0) { ans += b; }
	return ans;
}
V<pin> uni(V<pin> &v) {
	sor(v);
	V<pin> ans(1, v[0]);
	for (int i = 1; i < v.size(); i++) {
		if (v[i] != v[i-1]) { ans.push_back(v[i]); }
	}
	v = ans;
	return v;
}
int s_gcd(int a, int b) {
	if (b == 0) { return a; }
	return s_gcd(b, a%b);
}
int gcd(int a, int b) {
	if (a < b) { swap(a, b); }
	return s_gcd(a, b);
}
int solve(V<pin> &lis, vel &xx,int sum1) {
	int n = xx.size();
	bool fla=true;
	bool flb=true;
	veb used(n, false);
	int sum = 0;
	bool fl = false;
	for (auto x : xx) {
		pin smt = lis[x];
		int num = smt.second%n;
		fl =fl or used[num];
		used[num] = true;
		sum += smt.first;
		if (smt.second < n) { flb = false; }
		else { fla = false; }
	}
	if (fla || flb || fl) { return sum; }
	return sum1;
}
signed main() {
	int n; cin >> n;
	V<pin> lis(2 * n);
	int sum = 0;
	rep(i, n) {
		int a, b; cin >> a >> b;
		lis[i] = mkp(a,i);
		lis[i + n] = mkp(b, i+n);
		sum += a + b;
	}
	sor(lis);
	veb used(n, false);
	int ans = sum;
	vel xx(n);
	rep(i, n) {
		xx[i] = i;
	}
	mmin(ans, solve(lis, xx,sum));
	xx[n - 1] = n;
	mmin(ans, solve(lis, xx,sum));
	xx[n - 1] = n + 1;
	mmin(ans, solve(lis, xx,sum));
	xx[n - 1] = n;
	xx[n - 2] = n - 1;
	mmin(ans, solve(lis, xx,sum));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    rep(i,m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
    }

    int s, t;
    cin >> s >> t;
    s--; t--;
    vector<vector<int>> dist(n, vector<int>(3, -1));
    queue<P> q;
    dist[s][0] = 0;
    q.push(P(s,0));
    while(!q.empty()){
        int p = q.front().first;
        int d = q.front().second;
        q.pop();
        for(int v: g[p]){
            int dd = (d + 1) % 3;
            if (dist[v][dd] != -1) continue;
            q.push(P(v,dd));
            dist[v][dd] = dist[p][d] + 1;
        }
    }
    int ans = dist[t][0];
    if (ans != -1) ans /= 3;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 13928
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
	int N, dummy;
	scanf("%d", &N) + 1;

	int tmp1, tmp2;
    int ans = 0; 
	for (int i = 0; i < N; i++) {
		dummy = scanf("%d", &tmp1);
      int cnt = 0;
      while ((tmp1 & 1) == 0) {
        cnt++;
        tmp1 >>= 1;
      }
		ans += cnt;
	}
	
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<pair<int,ll>>>;
using pp=pair<ll,pair<ll,ll>>;
#define MAX 1000000
#define MOD 1000000007
#define INF 1000000000000000000

vector<int> parent;
int find(int x){
  int y=parent[x];
  while(y!=parent[y]){
    y=find(y);
  }
  return parent[x]=y;
}

void unite(int a,int b){
  int x=find(a);
  int y=find(b);
  if(x!=y){
    parent[x]=y;
  }
}

int main(){
  int N,Q;
  cin>>N>>Q;

  parent.resize(N);
  for(int i=0;i<N;i++){
    parent[i]=i;
  }

  for(int i=0;i<Q;i++){
    int t,u,v;
    cin>>t>>u>>v;
    if(t==0){
      unite(u,v);
    }else{
      if(find(u)==find(v)){
        cout<<1<<endl;
      }else{
        cout<<0<<endl;
      }
    }
  }
}


Measured memory_bytes: 3916
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  cout << (pow(N, 3)) << endl;

}

Measured memory_bytes: 384
#![allow(clippy::many_single_char_names)]
#[allow(unused_imports)]
use proconio::{
    input,
    marker::{Chars, Usize1},
};

fn main() {
    input!(n: u32, x: u32, t: u32);
    println!("{}", (n + x - 1) / x * t);
}


Measured memory_bytes: 2132
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N_MAX = 205;
int N,L;

void input() {
	cin >> N >> L;
}

void solve() {
	int sum = 0;
	int key = 1000;
	for(int i=0;i<N;i++) {
		sum += ( L + i);
		if(abs(key) > abs(L+i)) {
			key = L+i;
		}
	}
	cout << sum-key << endl;
}

int main() {
	input();
	solve();
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <vector>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;

char buf[100000+10];

int main(void) {
  scanf("%s", buf);
  int n = strlen(buf);
  int cs[2] = {};
  REP(i, n) {
    cs[buf[i]-'0']++;
  }
  cout << min(cs[0], cs[1]) * 2 << endl;
  return 0;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
 
int main() {
 int A,B,C,k,l;
 cin>>A>>B>>C;
 k=B;
 B=A;
 A=k;
 k=C;
 C=A;
 A=k;
 
 cout<<" "<<A<<" "<<B<<" "<<C<<endl;
 return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    vector<int>rating(9,0);
    for(int i=0;i<n;i++){
        if(v[i]>=1&&v[i]<=399){
            rating[0]++;
        }
        else
        if(v[i]>=400&&v[i]<=799){
            rating[1]++;
        }
        else
        if(v[i]>=800&&v[i]<=1199){
            rating[2]++;
        }
        else
        if(v[i]>=1200&&v[i]<=1599){
            rating[3]++;
        }
        else
        if(v[i]>=1600&&v[i]<=1999){
            rating[4]++;
        }
        else
        if(v[i]>=2000&&v[i]<=2399){
            rating[5]++;
        }
        else
        if(v[i]>=2400&&v[i]<=2799){
            rating[6]++;
        }
        else
        if(v[i]>=2800&&v[i]<=3199){
            rating[7]++;
        }
        else{
            rating[8]++;
        }
    }
    int sum1=0;
    for(int i=0;i<8;i++)
    {
        if(rating[i]>=1){
            sum1++;
        }
    }
    int min=sum1;
    int max=sum1;
    if(sum1==0){
        max+=rating[8];
        if(rating[8]>0)
            min++;
    }else{
        max+=rating[8];
    }
    cout<<min<<" "<<max;
}

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

int main() {
  double w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << w * h / 2.0;
  cout << " ";
  cout << (w / 2.0 == x && h / 2.0 == y ? 1 : 0) << endl;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
H = list(map(int, input().split()))

del_ = []

for m in range(M):
    A, B = map(int, input().split())
    if H[A-1] < H[B-1]:
        del_.append(A)
    elif H[A-1] > H[B-1]:
        del_.append(B)
    else:
        del_.append(A)
        del_.append(B)
print(N - len(list(set(del_))))





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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if (A + B > C + D) {
    cout << "Left" << endl;
  }
  else if (A + B == C + D) {
    cout << "Balanced" << endl;
  }
  else if (A + B < C + D) {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s;
bool ans=true;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>s;
	for (int i=0;i<s.size();++i)
		if ((i+1)%2==0)
		{
			if (s[i]=='L' || s[i]=='U' || s[i]=='D') continue;
			else
			{
				ans=false;
				break;
			}
		}
		else
		{
			if (s[i]=='R' || s[i]=='U' || s[i]=='D') continue;
			else
			{
				ans=false;
				break;
			}
		}
	if (ans) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

std::string S, T;
ll ans;

int main()
{
  std::cin >> S >> T;

  rep( i, S.size() )
    ans += S[i]==T[i];

  std::cout << ans << std::endl;

  return 0;
}

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

int main(){
  char c;
  cin >> c;
  
  if (c=='a'||c=='e'||c=='i'||c=='o'||c=='u'){
    cout << "vowel" << endl;
  }
  
  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes) if b else print(no)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx
# from bisect import bisect_left,bisect_right

s=s0()
t=s0()
p0(s==t[:-1])

Measured memory_bytes: 9020