akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
    int N, N_hold;
    int i = 1;
    int sum = 0;
    cin >> N;
    N_hold = N;
    while (N > 0) {
        sum += N % 10;
        N /= 10;
        i++;
    }
    if(N_hold % sum == 0) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 384
#include<cstdio>
using ll=long long;
ll a[99999];
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%lld",&a[i]);
    ll half_sum[2]={0,0};
    for(int i=0;i<n;i++)half_sum[i%2]+=a[i];
    ll total=(half_sum[0]+half_sum[1])/2;
    ll tmp=half_sum[0]-total;
    printf("%lld",2*tmp);
    for(int i=0;i<n-1;i++){
        tmp=a[i]-tmp;
        printf(" %lld",2*tmp);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

template <class... Args>
struct tuple_input_impl;
template <std::size_t i, std::size_t... tail>
struct tuple_input_impl<std::index_sequence<i, tail...>>
{
    template <class... Args>
    static void f(std::tuple<Args...>& x)
    {
        std::cin >> std::get<i>(x);
        tuple_input_impl<std::index_sequence<tail...>>::f(x);
    }
};
template <>
struct tuple_input_impl<std::index_sequence<>>
{
    static void f(...) {}
};

template <class... Args>
std::istream& operator>>(std::istream& in, std::tuple<Args...>& x)
{
    tuple_input_impl<std::index_sequence_for<Args...>>::f(x);
    return in;
}
template <class T1, class T2>
std::istream& operator>>(std::istream& in, std::pair<T1, T2>& x) { return in >> x.first >> x.second; }

template <class T>
T read()
{
    T res;
    std::cin >> res;
    return res;
}
template <class T>
std::vector<T> read(std::size_t n)
{
    std::vector<T> res(n);
    for (std::size_t i = 0; i < n; ++i) std::cin >> res[i];
    return res;
}

template <class T>
void out_impl(T&& v) { std::cout << std::forward<T>(v); }
template <class T, class... Args>
void out_impl(T&& v, Args&&... args)
{
    std::cout << std::forward<T>(v) << ' ';
    out_impl(std::forward<Args>(args)...);
}
template <class... Args>
void out(Args&&... args)
{
    out_impl(std::forward<Args>(args)...);
    std::cout << '\n';
}
template <class... Args>
void out_noreturn(Args&&... args) { out_impl(std::forward<Args>(args)...); }

template <class T>
void print(const T& container)
{
    bool first = true;
    for (auto&& x : container) {
        if (!first) std::cout << ' ';
        std::cout << x;
        first = false;
    }
    std::cout << '\n';
}

void prog()
{
    auto s = read<std::string>();
    out(s <= "2019/04/30" ? "Heisei" : "TBD");
}

int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    prog();
    return 0;
}


Measured memory_bytes: 256
import sys
import math
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def prime_factorize(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
        cnt=0
        while temp%i==0:
          cnt+=1
          temp //= i
        arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

def main():
    N = int(readline())
    if N==0 or N==1:
        print('0')
        sys.exit()
    sosu = prime_factorize(N)
    L = len(sosu)
    count = 0
    for i in range(L):
        _, a = sosu[i]
        count += math.floor((math.sqrt(1+8*a)-1)/2)
    print(count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9568
#include"bits/stdc++.h"
using namespace std;
#define LL long long

LL N,M,ans,r,a;

pair<LL, LL>bc;
vector<pair<LL, LL>>BC;
int main() {

	cin >> N>>M;
	M = M / 2;
	if (N < M) {
		cout << N + (M - N) / 2 << endl;
	}
	else {
		cout << M << endl;
	}
	

	return 0;

}


Measured memory_bytes: 256
import numpy as np

n = int(input())

a = list(map(int, input().split()))

a_array = np.array(a)
a_min = np.min(a_array)
a_max = np.max(a_array)
a_med = np.median(a_array)

# print(a_min, a_max, a_med)

sum_array = np.zeros((3, n), dtype = np.int)
# print(sum_array)

opt = False
target = int(a_med)
while not opt:
  sum_array[0, :] = (a_array[:] - (target-1)) ** 2
  sum_array[1, :] = (a_array[:] - (target)) ** 2
  sum_array[2, :] = (a_array[:] - (target+1)) ** 2
  sum = np.sum(sum_array, axis = 1)
  if sum[1] < sum[0] and sum[1] < sum[2]:
    opt = True
  elif sum[0] < sum[1]:
    target -= 1
  else:
    target += 1
  
print(sum[1])

Measured memory_bytes: 12508
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) ((x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(ll a, ll b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmax(T &a, const T &b){ if(a < b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(a > b){ a=b; return 1; } return 0; }

vector<pair<long long, long long> > prime_factorize(long long n) {
  vector<pair<long long, long long> > res;
  for (long long p = 2; p * p <= n; ++p) {
    if (n % p != 0) continue;
    int num = 0;
    while (n % p == 0) { ++num; n /= p; }
    res.push_back(make_pair(p, num));
  }
  if (n != 1) res.push_back(make_pair(n, 1));
  return res;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  ll n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> num(1000005, 0);
  rep(i, 0, n){
    cin >> a[i];
    num[a[i]]++;
  }

  ll ans = 0;
  for(ll i = 0; i < n; i++){
    bool ok = true;
    num[a[i]]--;
    for(ll j = 1; j * j <= a[i]; j++){
      if(a[i] % j) continue;
      if(num[j] > 0){
        ok = false;
        break;
      }
      if(num[a[i] / j]){
        ok = false;
        break;
      }
    }
    if(ok) ans++;
    num[a[i]]++;
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int N, A, B, x;
  cin >> N >> A >> B;
  if (A*N>B) {
    x = B;
    cout << x << endl;
  }
    else if (A*N==B) {
      x = B;
      cout << x << endl;
    }
  else {
      x=A*N;
      cout << x << endl;
    }
}

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

int main(){
    int n;
    cin >> n;
    vector<long long> a(n),ans(n);
    long long even = 0,all = 0;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        all += a[i];
        if(i % 2 == 1)even += a[i]; 
    }
    ans[0] = (all - even * 2) / 2;
    cout << ans[0] * 2 << " ";
    for(int i = 1;i < n;i++){
        ans[i] = a[i - 1] - ans[i - 1];
        cout << ans[i] * 2;
        if(i != n - 1)cout << " ";
        else cout << endl;
    }
}

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

int main(){
 
 int a,b;
 char op;
  
    while(1){
       cin >> a >> op >> b;
        if( op == '?' )break;
        
         if( op == '+' ) cout << a+b << endl;
         else if( op == '-' )cout << a-b << endl;
         else if( op == '*' )cout << a*b << endl;
         else if( op == '/' )cout << a/b << endl;
    }
    
return 0;
}

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

int main(){
  int N, K;
  cin >> N >> K;
  int sum = 0;
  for(int i=0; i<N; i++){
    int x;
    cin >> x;
    sum += 2 * min(x, K-x);
  }
  cout << sum << endl;
}
  

Measured memory_bytes: 256
l = list(map(int, input().split(' ')))
# N = input()
# N = int(input())
K = l[0] #ある連続する K 個の石が黒で塗られており
X = l[1] #座標 Xにある石は黒で塗られている

mi = max(X-K,-1000000)
ma = min(X+K,1000000)
first = 0
for i in range(mi+1,ma):
    if first == 0:
        first=1
    else:
        print(" ",end="")
    print(i,end="")
print()

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#include <cstring>
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
#define mp make_pair
#define full(a) a.begin(), a.end()
#define sz(x) ((int)(x).size())
#define pii pair<int, int>
#define trav(a,x) for (auto& a : x)
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
const ll mod = 998244353;



int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n, k; cin >> n >> k;
    if (n % k == 0) cout << 0;
    else
    {
        if (n > k)
        {
            ll h = n / k;
            n -= (h * k);
        }
        cout << min(n, abs(n - k));
    }
    return 0;
}












Measured memory_bytes: 3140
package main

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for D - Derangement
	var N int
	fmt.Scan(&N)

	sc.Split(bufio.ScanWords)
	p := make([]int, N)
	for i := 0; i < N; i++ {
		p[i] = nextInt()
	}

	var count int
	var temp int
	for i := 0; i < N-1; i++ {
		if p[i] == i+1 {
			count++
			temp = p[i]
			p[i] = p[i+1]
			p[i+1] = temp
		}
	}
	if p[N-1] == N {
		count++
	}
	fmt.Println(count)
}


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

using namespace std;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<int> siz; // siz[i]:siz[root(i)]でその木のサイズ格納

    UnionFind(int N) : par(N),siz(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) {
			par[i] = i;
			siz[i] = 1;
		}
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		siz[ry] += siz[rx];
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

	int size(int x) {
        return siz[root(x)];
    }
};



int main(){

	int n,m,k,a,b;
	cin >>n>>m>>k;

	UnionFind fri(n);

	vector<vector<int>> friended(n);
//	friended.assign(n,vector<int>(0));


	for (int i = 0; i < m; i++){ //friends
		cin >> a >> b;
		a--;
		b--;
		fri.unite(a,b);
		friended[a].push_back(b);
		friended[b].push_back(a);
	}
	for (int i = 0; i < k; i++){ //blocks
		cin >> a >> b;
		a--;
		b--;
		if (!fri.same(a,b)) continue;
		friended[a].push_back(b);
		friended[b].push_back(a);
	}


	for (int i = 0; i < n; i++){ //judge
		
		cout << fri.size(i) - (friended[i].size()) - 1 << " " ;
//		cout << fri.size(i) << ":" <<  friended[i].size() << endl ;
	}
	cout << endl;
	cin >> n;
	return 0;

	
}



Measured memory_bytes: 8440
import java.util.*;
public class Main {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      int c = sc.nextInt();
      int d = sc.nextInt();

      int train;
      int bus;

      if (a <= b) {
         train = a;
      } 
      else {
         train = b;
      }

      if (c <= d) {
         bus = c;
      } 
      else {
         bus = d;
      }
      System.out.println(train + bus);
   }
}

Measured memory_bytes: 21972
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ll N;
  cin >> N;
  map<ll, ll> A;
  REP(i, N) {
    ll t;
    cin >> t;
    A[t] = i + 1;
  }
  for (const auto &p : A)
    cout << p.second << " ";
  cout << endl;
  return 0;
}


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  string s;
  cin >> s;
  if(s=="SUN"){
    cout << "7" << endl;
  }
  else if(s=="MON"){
    cout << "6" << endl;
  }
  else if(s=="TUE"){
    cout << "5" << endl;
  }
  else if(s=="WED"){
    cout << "4" << endl;
  }
  else if(s=="THU"){
    cout << "3" << endl;
  }
  else if(s=="FRI"){
    cout << "2" << endl;
  }
  else if(s=="SAT"){
    cout << "1" << endl;
  }
  
  return 0;
}




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

int main()
{
    ll x;
    cin >> x;
    
    ll ans = (x / 11);
    ans *= 2;
    ll r = x % 11;
    if (r > 0 && r <= 6) {
        ans += 1;
    } else if (r > 6) {
        ans += 2;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
ans = 0
i = 0
while 10 ** (i + 1) <= N:
    i += 1

for k in range(i):
    if k % 2 == 0:
        ans += 10 ** (k + 1) - 10 ** k

if i % 2 == 0:
    ans += N - 10 ** i + 1

print(ans)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;


using namespace std;



void solve()
{
	int K, Q;
	scanf("%d%d", &K, &Q);
	vector<ll> d(K), dd(K), dd0(K), sdd(K+1), sdd0(K + 1);
	int i;
	for (i = 0; i < K; i++) {
		scanf("%lld", &d[i]);
	}
	vector<ll> N(Q), X(Q), M(Q);
	for (i = 0; i < Q; i++) {
		scanf("%lld%lld%lld", &N[i], &X[i], &M[i]);
	}
	int j;
	for (i = 0; i < Q; i++) {
		sdd[0] = 0;
		sdd0[0] = 0;
		for (j = 0; j < K; j++) {
			dd[j] = d[j] % M[i];
			dd0[j] = (dd[j] == 0 ? 1 : 0);
			sdd[j + 1] = sdd[j] + dd[j];
			sdd0[j + 1] = sdd0[j] + dd0[j];
		}
		ll tmp0 = (N[i]-1) / K;
		ll tmp1 = (N[i]-1) % K;
		ll sum = X[i]%M[i] + sdd[K] * tmp0 + sdd[tmp1];
		ll cnt1=sum / M[i];
		ll cnt0 = sdd0[K] * tmp0 + sdd0[tmp1];
		ll ans = N[i] - 1 - cnt1 - cnt0;
		printf("%lld\n", ans);
	}

    return;
}


int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))

#define MOD 1000000007
#define INF 1000000000

ll Q, H, S, D;
ll N;

int main()
{
    cin >> Q >> H >> S >> D >> N;

    ll min_2, min_1, min_05;
    min_05 = min(Q*2, H);
    min_1 = min(min_05*2, S);
    min_2 = min(min_1*2, D);

    ll ans = (N / 2) * min_2;
    if(N % 2 == 1) {
        ans += min_1;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
A,B,C,D = map(int,input().split())
alice = []
bob = []
ans = 0
for i in range(A,B):
  alice.append(i)
for j in range(C,D):
  bob.append(j)
for _ in range(0,100):
  if _ in alice and _ in bob:
    ans += 1
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;

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

ll N,M;
string S,T;

int main(){
    cin>>N>>M>>S>>T;

    ll g=gcd(N,M);
    ll n=min(N,M);
    ll m=max(N,M);
    string s=N<M?S:T;
    string t=N<M?T:S;
    rep(i,g){
        if(s[i*(n/g)]!=t[i*(m/g)]){
            cout<<-1<<endl;
            return 0;
        }
    }

    ll ans=n/g*m;
    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std; 
#define max(a, b) (a < b ? b : a) 
#define min(a, b) ((a > b) ? b : a) 
#define mod 1e9 + 7 
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++) 
#define FORL(a, b, c) for (int(a) = (b); (a) <= (c); (a)++) 
#define FORR(a, b, c) for (int(a) = (b); (a) >= (c); (a)--) 
#define INF 1000000000000000003 
typedef long long int ll; 
typedef vector<int> vi; 
typedef pair<int, int> pi; 
#define F first 
#define S second 
#define pb push_back 
#define POB pop_back 
#define MP make_pair 

int main()

{string a,b;
int c=0;
cin>>a;
cin>>b;
FOR(i,a.size())
{
	if(a[i]!=b[i])
	c++;
}
cout<<c;
  return 0;

}

  



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


int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int N, M; cin >> N >> M;
  
  int k = 1;
  for (int p = 0; p < M; p++) k *= 2;
  cout << k * (1900*M + 100* (N-M)) << endl;

  return 0;
}



Measured memory_bytes: 256
// AtCoder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

// AtCoder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//


#define _USE_MATH_DEFINES
#include<math.h>

//#include<cmath>

#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>



//#include "Ants.h"
using namespace std;
typedef long long ll;
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<n;i++)
#define show(s) cout<<s<<endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define LINF (1000000000000000000ll)

//typedef pair < int, int> P;
ll gcd(ll a, ll b) {//最大公約数を求める///最大公倍数a*b/gcd(a,b)
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcd(ll a, ll b) {//最小公倍数を求める　b=0のときaを返す
	if (b == 0) return a;
	return (a / gcd(a, b)) * b;
}
vector<int> calc(ll num) {
	int dig;
	vector<int>p;
	while (num) {
		dig = num % 10;
		p.push_back(dig);
		num /= 10;
	}
	return p;
}

string S;
int Q, T[200005], F[200005];
char C[200005];
int ts[200005];//ts[i]:i"より"前にあるT[i]=1の数
int main()
{
	cin >> S >> Q;
	rep(i, Q) {
		cin >> T[i];
		if (T[i] == 2) {
			cin >> F[i] >> C[i];
		}
	}
	rep(i, Q) {
		ts[i + 1] = ts[i];
		if (T[i] == 1)ts[i+1]++;
	}
	rep(i, Q) {
		if (T[i] == 2) {
			if (ts[i] % 2 == 1) {
				F[i]--;
			}
			if (F[i] == 1) {
				S.insert(S.begin(), C[i]);
			}
			else {
				S.insert(S.end(), C[i]);
			}
			
		}
	}
	if (ts[Q] % 2 == 1)reverse(S.begin(), S.end());
	cout << S << endl;
	
	
}

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

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mxx=3e5+5;

int main()
{
    fast
    int n,m;
    cin>>n>>m;
    int tot;cin>>tot;
    vector<pair<int,int> > v;
    map<pair<int,int>,int > mp;
    for(int i=0;i<tot;i++)
    {
      int x,y;
      cin>>x>>y;
      mp[{x,y}]=1;
      v.push_back({x,y});
    }

   int row[n+1]={},col[m+1]={};
   int mxr=0,mxc=0;
   int indr,indc;
   for(int i=0;i<tot;i++)
   {
      row[v[i].first]++;
      if(mxr<row[v[i].first]){mxr=row[v[i].first];indr=v[i].first;}
      col[v[i].second]++;
      if(mxc<col[v[i].second]){mxc=col[v[i].second];indc=v[i].second;}
   }
  
   int ans=0;
   for(int i=1;i<=n;i++)
   {
      int val=row[i]+mxc;
      if(mp[{i,indc}])val--;
      ans=max(ans,val);
   }

   for(int i=1;i<=m;i++)
   {
      int val=col[i]+mxr;
      if(mp[{indr,i}])val--;
      ans=max(ans,val);
   }
   
    cout<<ans;
}

Measured memory_bytes: 64244
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    vector<int> a(3), b = {5, 5, 7};
    for(int i = 0; i < 3; i++) {
        cin >> a[i];
    }
    sort(all(a));
    if(a == b) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3572
s = input()

f = 0

for bit in range(1 << 3):
    ans = s[0]
    f = int(s[0])
    for i in range(3):
        if bit&(1 << i):
            f += int(s[i+1])
            ans += "+"
        else:
            f -= int(s[i+1])
            ans += "-"
        ans += s[i+1]
        
    if f == 7:
        ans += "=7"
        print(ans)
        break

Measured memory_bytes: 38384
#include<iostream>
#include<string>
using namespace std;
int main(){
    int i,b,c,cut=0;
    string str1,str,mozi;
    cin >> str >> str1;
        mozi=str+str;
    int a=mozi.find(str1);
    if(a!=-1){
        cut=1;
    }
    if(cut==1){
        cout << "Yes" <<"\n";
    }else
        cout << "No" <<"\n";
return 0;
}

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

#define mod 1000000007

using namespace std;
typedef long long ll; 
 
int main(void){
	
	int N, M;
	ll ans1 = 1, ans2 = 1;
	
	cin >> N >> M;
	
	if(abs(N - M) <= 1){
		for(int i=2; i<=N; i++){
			ans1 *= i;
			ans1 %= mod;
		}
		for(int i=2; i<=M; i++){
			ans2 *= i;
			ans2 %= mod;
		}
		if(N == M)
			cout << (ans1 * ans2 * 2) % mod;
		else
			cout << ans1 * ans2 % mod; 
	}else
		cout << 0;
	
	return 0;
}

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

int main(){
    char s[3];
    int cnta=0,cntb=0,cntc=0;
    cin >> s;
    for(int i=0;i<3;i++){
        if(s[i]=='a'){
            cnta++;
        }else if(s[i]=='b'){
            cntb++;
        }else{
            cntc++;
        }
        if(cnta>1||cntb>1||cntc>1){
            cout << "No" <<endl;
            return 0;
        }
    }
    if(cnta&&cntb&&cntc){
        cout <<"Yes"<<endl;
    }else{
        cout <<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
# coding:utf-8
import math
array = map(int, raw_input().split())
a = array[0]
b = array[1]
C = array[2]
rad = math.radians(C)
S = a * b * math.sin(rad) / 2.0
L = a + b + math.sqrt(math.pow(a,2) + math.pow(b,2) - 2 * a * b * math.cos(rad))
h = b * math.sin(rad)
print S
print L
print h



Measured memory_bytes: 4804
def main():
    t, t_a, a, a_a = list(map(int, input().split()))
    while True:
        a = a - t_a
        if a <= 0:
            print('Yes')
            exit()
        t = t - a_a
        if t <= 0:
            print('No')
            exit()




if __name__ == '__main__':
    main()

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

int N, M, K;
const int modConst = 998244353;

int facMemo[200005];
long long fastExp(int A, int B)
{
	if(B == 0)
		return 1 % modConst;
		
	long long Sqrt = fastExp(A, B / 2), ans = (Sqrt * Sqrt) % modConst;
	if(B % 2 == 1)
		ans *= (long long)A % modConst;
		
	return ans % modConst;
}

long long modInverse(int X)
{
	return fastExp(X, modConst - 2);
}

long long choose(int N, int R)
{
	//return N! / (N - R)! / R!
	long long ans = (facMemo[N] * modInverse(facMemo[N - R])) % modConst;
	ans = (ans * modInverse(facMemo[R])) % modConst;
	
	return ans;
	
}

int main()
{
	scanf("%d%d%d", &N, &M, &K);
	
	facMemo[0] = 1 % modConst;
	for(int i = 1; i <= N; i++)
	{
		long long tmp = (long long)(facMemo[i - 1]) * i;
		facMemo[i] = tmp % modConst;
	}
	
	long long ans = 0;
	for(int i = 0; i <= K; i++)
	{
		//ans += M * choose(N - 1, N - K - 1) * fastExp(M - 1, N - K - 1);
		long long temp = (choose(N - 1, N - i - 1) * fastExp(M - 1, N - i - 1)) % modConst;
		
		temp = (temp * M) % modConst;
		ans += temp;
		
		ans %= modConst;
	}
	
	printf("%lld", ans);
}

Measured memory_bytes: 4536
/*
 * 
 * */

#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

#define f first
#define s second
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define debug(x) cout << #x << ":\t" << x << endl
#define _ << " " <<

#define s_time clock_t time_start = clock()
#define t_time cout << double(clock() - time_start) / 1000 << endl

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

const int N = 3e3 + 3;
const ll M = 1e9 + 7;

int n;
string s;
vector<ll> dp;
ll res;

int main(int argc, char** argv) {
//	mt19937_64 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
//	freopen("in", "r", stdin);
//	freopen("out", "w", stdout);
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	cin >> n >> s;
	dp.pb(1);
	for (int i = 1; i < n; ++i) {
		if (i > 1 && s[i-1] != s[i-2]) reverse(all(dp));
		ll sum = 0;
		for (int j = 0; j < i; ++j) {
			(sum += dp[j]) %= M;
			dp[j] = sum;
		}
		dp.insert(dp.begin(), 0);
	}
	
	res = 0;
	for (auto& v: dp) (res += v) %= M;
	cout << res;
	
	return 0;
}

/*
 * 
 * */


Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

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

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    
    vector<pii> Ans;
    for (int n = 1; n <= (N-1)/4; ++n) {
        Ans.emplace_back(n, N-n);
    }
    for (int n = 1; n <= (N+1)/4; ++n) {
        Ans.emplace_back((N-1)/4 + n, (N-1)/4 + (N+1)/4*2 + 1 - n);
    }
    
    for (int k = 0; k < M; ++k) {
        cout << Ans[k].first << ' ' << Ans[k].second << endl;
    }

    return 0;
}


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

int main() {
	long long x, k, d;
    cin >> x >> k >> d;
    bool b = true;
    if (x < 0) {x = -x; b = false;}
    long long dv = x / d;
    long long r = x % d;
    if (dv >= k) {
    	if (b) cout << abs(x - d * k) << endl;
        else cout << abs(x - d * k) << endl;
   } else {
    	k -= dv;
        k %= 2;
        if (k) {
          if (b) cout << abs(x - d * dv - d) << endl;
          else cout << abs(x - d * dv - d) << endl;
        } else {
          if (b) cout << abs(x - d * dv) << endl;
          else cout << abs(x - d * dv) << endl;
        }
    }
};

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ff first
#define ss second
#define eb emplace_back
#define MP make_pair
#define pb push_back
#define pf push_front
#define ins insert
#define all(v) (v).begin(), (v).end()
#define mset(m,v) memset(m,v,sizeof(m))
#define tr(c,it) for(auto it=c.begin();it!=c.end();it++)
#define fr(i,n) for(lli i=0;i<(n);i++)
#define inc(i,a,b) for(lli i=a;i<=b;i++)
#define dec(i,a,b) for(lli i=a;i>=b;i--)
#define fr2(i,n) for(int i=0;i<(n);i++)
#define inc2(i,a,b) for(int i=a;i<=b;i++)
#define dec2(i,a,b) for(int i=a;i>=b;i--)
#define ymin(a,b)  (a=min((a),(b)))
#define ymax(a,b)  (a=max((a),(b)))
#define sz(x) (lli)(x).size()
typedef long long int lli;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<lli,lli> plli;
typedef vector<lli> vlli;
typedef vector<int> vi;
//typedef  vector<vector<lli> >ncr(1001,vector<lli>(1001,0))
typedef vector<plli> vplli;
long long MOD=1000000007;
double startTime;
double getCurrentTime()
{
	return ((double)clock()-startTime)/CLOCKS_PER_SEC;
}

lli pwr(lli x,lli n)
{
	lli res=1;
	for(; n!=0;n>>=1)
	{
		if(n&1)
			res=(res*x)%MOD;
		x=(x*x)%MOD;
	}
	return res;
}
lli inver(lli num)
{
	return pwr(num,MOD-2);
}
lli findncr(lli n,lli r)
{
	r=min(r,n-r);
	if(n==0||n==1||r==0)
		return 1;
	lli numer=1;
	for(lli i=n;i>=n-r+1;i--)
		numer=(numer*i)%MOD;
	lli den=1;
	for(lli i=2;i<=r;i++)
		den=(den*i)%MOD;
	den=inver(den);
	lli res=(numer*den)%MOD;
	return res;
}
lli gcd(lli a,lli b)
{
	if(b==0)
		return a;
	else
		return gcd(b,a%b);
}
int main()
{
	// 	#ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS
	int n;
	cin>>n;
	vector<double>vec(n+1,0);
	vector<vector<double> >dp(n+1,vector<double>(n+1,0));
	for(int i=1;i<=n;i++)
		cin>>vec[i];
	dp[0][0]=1;
	for(int j=1;j<=n;j++)
	{
		dp[0][j]=(1-vec[j])*dp[0][j-1];
		for(int i=1;i<=j;i++)
		{
			dp[i][j]=vec[j]*dp[i-1][j-1]+(1-vec[j])*dp[i][j-1];
		}
	}
	// for(int i=0;i<=n;i++)
	// {
	// 	for(int j=0;j<=n;j++)
	// 		cout<<dp[i][j]<<" ";
	// 	cout<<endl;
	// }
	double sum=0;
	for(int i=(n+1)/2;i<=n;i++)
	{
	sum+=	dp[i][n];

	}
	cout<<setprecision(9)<<sum<<endl;
}

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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int (i)=0; (i)<n; ++(i))
#define rep1(i,n) for(int (i)=1; (i)<=n; ++(i))
#define repU(i,bottom,ceiling) for(int (i) = (bottom); (i) <= (ceiling); ++(i))
#define repD(i,ceiling,bottom) for(int (i) = (ceiling); (i) >= (bottom); --(i))
#define pub push_back
#define pob pop_back
#define prf printf
#define scf scanf
#define mkp make_pair
#define fir first
#define sec second
#define clr(a) memset((a),0,sizeof(a))

typedef long long ll;
typedef double db;

const vector<pair<int,int>> DIR = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF = -1 + (1<<30);
const int MOD = (int)1e9 + 7;

template<typename T> inline T gcd(T a,T b){ if(a % b){ return gcd(b,a % b); }else{ return b; } }

template<typename T> inline T lcm(T a,T b){ return a / gcd(a,b) * b; }

inline long long Pow(const long long n,long long m,const int mod = MOD){
	long long res = 1,pow = n;
	while(m) {
		if(m & 1) res = (res * pow) % mod;
		pow = (pow * pow) % mod;
		m >>= 1;
	}
	return res;
}

inline vector<long long> Frac(const int range,const int mod = MOD){
	vector<long long> frac;
	frac.push_back(1);
	for(int i = 1; i <= range; ++i) frac.push_back((long long)frac.back() * i % mod);
	return frac;
}

vector<long long> frac;

inline long long Comb(const int n,const int m,const int mod = MOD){
	if(n < m || m < 0) return 0;
	//vector<long long> frac(Frac(n,mod));
	long long rev = Pow((long long)frac[m] * frac[n-m] % mod,mod-2,mod);
	return rev * frac[n] % mod;
}

template<typename T> inline bool v_find(const vector<T> v,const T obj){
	auto itr = find(v.begin(), v.end(), obj);
	size_t index = distance(v.begin(),itr);
	if (index != v.size()) { return true; }
	return false; 
}

template<typename T> inline bool v_erase(vector<T> &v,const T obj){
	auto itr = find(v.begin(), v.end(), obj);
	size_t index = distance(v.begin(),itr);
	if (index != v.size()) {
		v.erase(itr);
		return true;
	}
	return false;	
}

template<class T,class U> inline auto LB(const T v,const U in){ return lower_bound(v.begin(),v.end(),in); }

template<class T,class U> inline auto UB(const T v,const U in){ return upper_bound(v.begin(),v.end(),in); }

inline unsigned long long nextsub(unsigned long long sub){
	unsigned long long tem = sub + (sub & -sub);
	unsigned long long btm = (~(tem) & sub) / (sub & -sub);
	return btm | tem;
}

inline void solve(){
	int n,k,l[51];
	cin>>n>>k;
	rep(i,n) cin>>l[i];
	sort(l,l+n);
	int a=0;
	rep(i,k) a+=l[n-1-i];
	cout<<a;
	return;
}

inline void input(){

	return;
}

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





Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {

	COMinit();

	ll n, k;
	cin >> n >> k;

	ll ans = 0;

	for (int i = 0; i <= min(n, k); i++) {
		ll x = COM(n, i)*COM(n - 1, n - i - 1) % MOD;
		ans = (ans + x) % MOD;
	}

	cout << ans;
	
	system("PAUSE");

	

}


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

const int INF = 2e9;

int main(){
    int n,k;
    cin >> n >> k;
    int ans = 0;
    rep(i,n){
        int a;
        cin >> a;
        if(a >= k) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	string s,t;
	while(cin >> s >> t) {
		int q;
		cin >> q;
		int n = SZ(s);
		int m = SZ(t);
		vector<int> imos1(n+1),imos2(m+1);
		REP(i,n) imos1[i+1] = imos1[i]+(s[i]=='A'?1:-1);
		REP(i,m) imos2[i+1] = imos2[i]+(t[i]=='A'?1:-1);
		REP(k,q){
			int a,b,c,d;
			cin >> a >> b >> c >> d;
			a--; c--;
			int x = imos1[b]-imos1[a];
			int y = imos2[d]-imos2[c];
			x %= 3;
			y %= 3;
			if(x < 0) x += 3;
			if(y < 0) y += 3;
			if(x==y){
				cout << "YES" << endl;
			}else{
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}


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

using namespace std;

typedef long long	ll;

const int N = int(410);
ll pref[N];
ll dp[N][N];
ll a[N];
const ll inf = ll(1e18);

ll sum(int l, int r){
	if(l > r){
		return 0LL;
	}

	return pref[r] - pref[l - 1];
}

ll solve(int i, int j){
	if(i > j){
		return 0LL;
	}

	if(i == j){
//		printf("%d = %lld\n", i, a[i]);
		return 0LL;
	}

	if(i + 1 == j){
//		printf("%d, %d = %lld\n", i, j, a[i] + a[j]);
		return a[i] + a[j];
	}

	ll &ans = dp[i][j];

	if(ans != -1LL){
		return ans;
	}

	ans = inf;

	for(int k = i ; k < j ; k++){
//		printf("%d, %d -> %d, %d + %d, %d = %lld %lld\n", i, j, i, k, k + 1, j, solve(i, k) + solve(k + 1, j) + sum(i, j),sum(i, j));
		ans = min(solve(i, k) + solve(k + 1, j) + sum(i, j), ans);
	}
//	printf("%lld (%d, %d)\n", ans, i, j);

	return ans;
}

int main(){
	int n, k;

	memset(dp, -1LL, sizeof dp);

	scanf("%d", &n);

	for(int i = 1 ; i <= n ; i++){
		scanf("%lld", &a[i]);
		pref[i] = a[i] + pref[i - 1];
	}

	printf("%lld\n", solve(1, n));

	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main()
{
	int N;
	cin>>N;
	for(int i=0;i<N;i++)
	{
		int K, P;
		cin>>K>>P;
		int ans = K%P;
		cout<<(ans==0?P:ans)<<endl;
	}
}

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

int main() {
  int n;
  cin >> n;
  int d[n];
  for(int i=0; i<n; i++) cin >> d[i];

  set<int> values;
  for(int i=0; i<n; i++) values.insert(d[i]);
  cout << values.size() << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int P = 998244353;

ll powmod(ll n, ll k) {
    ll r = 1, t = n % P;
    for (; k != 0; k /= 2) {
        if (k & 1) r = r * t % P;
        t = t * t % P;
    }
    return r;
}
ll inv(ll n) {
    return powmod(n, P - 2);
}

struct A {
    bool operator<(const A& a) const {
        return x < a.x;
    }
    int x, y;
};

struct BIT {
    BIT(int n) : b(n + 1), n(n) {}
    void add(int i, int v) {
        for (int k = i + 1; k <= n; k += k & -k) b[k] += v;
    }
    int sum(int k) {
        int s = 0;
        for (; k > 0; k -= k & -k) s += b[k];
        return s;
    }
    vector<int> b;
    int n;
};

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

    int n;
    cin >> n;

    vector<A> a(n);
    vector<pair<int, int>> p(n);
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        a[i] = { x, 0 };
        p[i] = { y, i };
    }

    sort(p.begin(), p.end());
    for (int i = 0; i < n; i++) {
        a[p[i].second].y = i;
    }
    sort(a.begin(), a.end());

    BIT b0(n), b1(n);
    for (int i = 0; i < n; i++) {
        b1.add(a[i].y, 1);
    }

    vector<int> b(n + 1);
    b[0] = 1;
    for (int i = 0; i < n; i++) {
        b[i + 1] = b[i] * 2 % P;
    }

    ll r = 0;
    for (int i = 0; i < n; i++) {
        b1.add(a[i].y, -1);

        int k00 = b0.sum(a[i].y);
        int k01 = i - k00;
        int k10 = b1.sum(a[i].y);
        int k11 = (n - 1 - i) - k10;

        r += (ll)(b[k11] + b[k00] - 1) * (b[k10] + b[k01] - 1) % P;

        b0.add(a[i].y, 1);
    }

    r = ((ll)b[n] * n - r) % P;
    if (r < 0) r += P;

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 5760
# -*- coding: utf-8 -*-
N="0"+raw_input()
l=len(N)

F=[ 0 for _ in range(l) ] #繰り上がりなし
T=[ 0 for _ in range(l) ] #繰り上がりあり
#初期化
T[0]="N"
x=int(N[l-1])
F[l-1]=x
T[l-1]=10-x

for i in range(l-1,0,-1):
    next_x=int(N[i-1])
    F[i-1]=min(F[i]+next_x, T[i]+next_x+1)
    T[i-1]=min(F[i]+10-next_x, T[i]+10-(next_x+1))

print F[0]


Measured memory_bytes: 86900
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  cout << fixed << setprecision(15);

  ll w, h;
  cin >> w >> h;

  priority_queue<ll, vll, greater<ll>> qx, qy;
  rep(i, w){
    ll p;
    cin >> p;
    qx.push(p);
  }
  rep(i, h){
    ll q;
    cin >> q;
    qy.push(q);
  }

  ll ans = 0;
  ll cx = 0, cy = 0;

  while(!qx.empty() || !qy.empty()){
    bool flag = true; // true -> x
    if(qx.empty()){
      flag = false;
    } else if (qy.empty()){
      // do nothing
    } else {
      if(qx.top() < qy.top()){
        // do nothing
      } else {
        flag = false;
      }
    }
    ll tv;
    if(flag){
      tv = qx.top();
      qx.pop();
      ans += tv*(h + 1 - cy);
      cx++;
    } else {
      tv = qy.top();
      qy.pop();
      ans += tv*(w + 1 - cx);
      cy++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5608
import java.util.Scanner;


	public class Main {
		
		

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
	        
			int w = sc.nextInt();
			int h = sc.nextInt();
			int n = sc.nextInt();
			
			int xi = 0;
			int yi = 0;
			int x;
			int y;
			int a;
			
			for(int i=0;i<n;i++) {
				x = sc.nextInt();
				y = sc.nextInt();
				a = sc.nextInt();
				
				if(a==1) {
					xi = Math.max(xi, x);
				}
				if(a==2) {
					w = Math.min(w, x);
				}
				if(a==3) {
					yi = Math.max(yi, y);
				}
				if(a==4) {
					h = Math.min(h, y);
				}
				
			}
			
			if(w>xi&&h>yi) {
				System.out.println((w-xi)*(h-yi));
			}else {
				System.out.println(0);
			}
		}
	}


Measured memory_bytes: 23764
#include <stdio.h>

int main(){

    int N,b;

    scanf("%d",&N);

    int T[N],i=0,a;

    while(N>i){

        scanf("%d",&T[i]);
        i++;


    }
    i=0;
    a=T[i];

    while(N-1>i){

        if(a>T[i+1]){

            a=a;


        }
        else{

            a=T[i+1];

        }

       i++;

    }

    b=a/2;
    i=0;
    int sum=0;

    while(N>i){

        sum=sum+T[i];
        i++;


    }

    int G;
    G=sum-b;

    printf("%d",G);





return 0;

}



Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

int n, m;
vector<int> e[100000];
bool saw[100000];
int ans[300000];
int st = 150000, en = 150000;

int main() {
    cin >> n >> m;
    rep(i,m) {
        int a, b; cin >> a >> b;
        a--; b--;
        e[a].push_back(b);
        e[b].push_back(a);
    }
    saw[0] = true;
    ans[en++] = 0;
    while (true) {
        int p = ans[en-1];
        bool end = true;
        for (int t: e[p]) {
            if (saw[t]) continue;
            ans[en++] = t;
            saw[t] = true;
            end = false;
            break;
        }
        if (end) break;
    }
    while (true) {
        int p = ans[st];
        bool end = true;
        for (int t: e[p]) {
            if (saw[t]) continue;
            ans[--st] = t;
            saw[t] = true;
            end = false;
            break;
        }
        if (end) break;
    }
    cout << en-st << endl;
    for (int i = st; i < en; i++) {
        cout << ans[i]+1;
        if (i == en-1) cout << endl;
        else cout << " ";
    }
}

Measured memory_bytes: 6784
#include <stdio.h>

int main(void) {
	char S[32];
	char aru[26] = {0};
	int i;
	if (scanf("%31s", S) != 1) return 1;
	for (i = 0; S[i] != '\0'; i++) {
		int idx = S[i] - 'a';
		if (0 <= idx && idx < 26) {
			aru[idx] = 1;
		} else {
			puts("invalid char");
			return 2;
		}
	}
	if (i < 26) {
		int j;
		for (j = 0; j < 26; j++) {
			if (!aru[j]) {
				S[i] = 'a' + j;
				S[i + 1] = '\0';
				puts(S);
				return 0;
			}
		}
		puts("ERROR!");
		return 2;
	} else {
		int aru2 = 0;
		for (i = 25; i >= 0; i--) {
			int idx = S[i] - 'a';
			if (aru2 >> idx) {
				/* 今の文字より後の文字がある */
				int j;
				for (j = idx + 1; j < 26; j++) {
					if ((aru2 >> j) & 1) {
						S[i] = 'a' + j;
						S[i + 1] = '\0';
						puts(S);
						return 0;
					}
				}
				puts("ERROR!!");
				return 2;
			}
			aru2 |= 1 << idx;
		}
		puts("-1");
		return 0;
	}
}


Measured memory_bytes: 1644
#!/usr/bin/env python3
import sys


def solve(N: int):
    if N % 2 == 0:
        print(N)
    else:
        print(2*N)

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940