akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <ctime>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long double LD;
typedef long long LL;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#ifdef LOCAL
#define DEBUG(x) { cerr << "# " << #x << ": " << x << endl;}
#else
#define DEBUG(x)
#endif
mt19937_64 mt(time(0));
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/
const int MAXN = 512;
int mat[MAXN][MAXN], n;
bool emp[MAXN][MAXN];
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

void update(int i, int j) {
  for (int k = 0; k < 4; k++) {
    int a = i + dx[k];
    int b = j + dy[k];
    if (a < 0 || b < 0 || a >= n || b >= n) continue;
    int val = mat[i][j] + (1 - emp[a][b]);
    if (mat[a][b] > val) {
      mat[a][b] = val;
      update(a, b);
    }
  }
}





int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cout.precision(10); cout << fixed;
#ifdef LOCAL
  freopen("../test.txt", "r", stdin);
    // freopen("../output.txt", "w", stdout);
#endif
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      mat[i][j] = min(i+1, n-i);
      mat[i][j] = min(mat[i][j], min(j+1, n-j));
    }
  }
  int val, ret = 0;
  for (int k = 0; k < n*n; k++) {
    cin >> val;
    val--;
    int i = val / n;
    int j = val % n;
    emp[i][j] = true;
    mat[i][j]--;
    update(i, j);
    ret += mat[i][j];
  }
  cout << ret << '\n';






/*---------------------------------------Coding Space End------------------------------------------*/
#ifdef LOCAL
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#endif
  return 0;
}
/* author:  txingml */
/* picture is from hamayanhamayan(CF handle) */


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

using namespace std;

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

void insertion_sort(vector<int> &A, int n, int g, int &cnt){
  int j = 0;

  //先頭からgずつ挿入ソート
  for(int i = g; i < n; i++){
    int v = A.at(i);
    j = i - g;

    while((j >= 0)&&(A[j]>v)){
      A.at(j+g) = A.at(j);
      j = j - g;
      ++cnt;
    }
    A.at(j+g) = v;
  }
}

void shell_sort(vector<int> &A, int n){
  int cnt = 0;
  int m=0, al = 0;
  vector<int> G(0);
  while(al < n){
    al++;
    G.emplace_back(al);
    al *= 3;
    m++;
  }

  reverse(G.begin(), G.end());
  rep(i, m){
    insertion_sort(A, n, G.at(i), cnt);
  }
  //ここから本来いらない
  cout << m << endl;
  rep(i,m){
    cout << G.at(i);
    if(i != m-1){
      cout << " ";
    }
  }
  cout << endl;

  cout << cnt << endl;
}

int main(){
  int n;
  cin >> n;

  vector<int> A(n);

  rep(i,n){
    cin >> A.at(i);
  }

  shell_sort(A, n);

  rep(i, n){
    cout << A.at(i) << endl;
  }

}



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

using ll = long long;


ll foo(ll a, ll b) {
  if(a == b) return (a-1)<<1;
  ll s = a*b-1;
  ll sq = sqrt(s);
  ll ret = (sq-1)*2;
  if (a <= sq-1) ret--;
  for(ll l = sq; l<=sq+1;l++){
    if(l == a) continue;
    ll r = s/l;
    if(r == b) r--;
    if(r < sq) break;
    ret++;
  }
  return ret;
}

int main() {
  int n;
  scanf("%d",&n);
  while(n--) {
    int a,b;
    scanf("%d%d",&a,&b);
    if(a>b) swap(a,b);
    printf("%lld\n",foo(a,b));
  }
}


Measured memory_bytes: 256
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }

char s[11], t[12];
int main(void){
	int n=nextstr(s);
	int m=nextstr(t);
	puts(strncmp(s,t,n)?"No":"Yes");
}


Measured memory_bytes: 1556
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll inf = (1LL<<59);

int main(){
    int N, C; cin >> N >> C;
    ll cost[C+1][C+1];
    for(int i=1; i<=C; i++) for(int j=1; j<=C; j++) cin >> cost[i][j];

    ll color[N+1][N+1];
    map<int, int> mp0, mp1, mp2;
    for(int i=1; i<=N; i++) for(int j=1; j<=N; j++){
        cin >> color[i][j];
        if((i+j)%3 == 0) mp0[color[i][j]]++;
        if((i+j)%3 == 1) mp1[color[i][j]]++;
        if((i+j)%3 == 2) mp2[color[i][j]]++;
    }

    ll ans = inf;
    for(int i=1; i<=C; i++){
        for(int j=1; j<=C; j++){
            if(i == j) continue;
            for(int k=1; k<=C; k++){
                if(i == k) continue;
                if(j == k) continue;

                ll tmp = 0;
                for(int l=1; l<=C; l++){
                    tmp += cost[l][i]*mp0[l];
                    tmp += cost[l][j]*mp1[l];
                    tmp += cost[l][k]*mp2[l];
                }

                ans = min(ans, tmp);
            }
        }
    }

    cout << ans << endl;
}

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<int, int>;
const int MOD = 998244353;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

struct mint {
  ll v;
  mint(ll v = 0) : v((v % MOD + MOD) % MOD) {}
  mint pow(ll t) const;
  mint inv() const;
};
mint& operator+=(mint& a, mint b) { return a = a.v + b.v; }
mint& operator-=(mint& a, mint b) { return a = a.v - b.v; }
mint& operator*=(mint& a, mint b) { return a = a.v * b.v; }
mint operator+(mint a, mint b) { return a += b; }
mint operator-(mint a, mint b) { return a -= b; }
mint operator*(mint a, mint b) { return a *= b; }
mint operator-(mint a) { return (mint)0 - a; }
mint& operator/=(mint& a, mint b) { return a *= b.inv(); }
mint operator/(mint a, mint b) { return a /= b; }
mint mint::pow(ll t) const {
  if (!t) return 1;
  mint a = pow(t >> 1);
  a *= a;
  if (t & 1) a *= *this;
  return a;
}
mint mint::inv() const { return pow(MOD - 2); }
bool operator==(mint a, mint b) { return a.v == b.v; }
bool operator!=(mint a, mint b) { return a.v != b.v; }
istream& operator>>(istream& os, mint& a) { return (os >> a.v); }
ostream& operator<<(ostream& os, const mint& a) { return (os << a.v); }

void solve() {
  int n, k;
  cin >> n >> k;
  vector<mint> a(n);
  vector<P> p(k);
  rep(i, k) cin >> p[i].first >> p[i].second;
  rep(i, k) p[i].second++;
  mint now = 0;
  rep(i, n) {
    now += a[i];
    if (i == 0) {
      rep(j, k) {
        if (i + p[j].first < n)
          a[i + p[j].first] += 1;
        if (i + p[j].second < n)
          a[i + p[j].second] -= 1;
      }
    } else {
      rep(j, k) {
        if (i + p[j].first < n)
          a[i + p[j].first] += now;
        if (i + p[j].second < n)
          a[i + p[j].second] -= now;
      }
    }
    dump(now, a);
  }
  cout << now << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

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

main(){
    int x;
    cin >> x;
    if( x==1 ) cout << 0 << endl;
    else cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 3616
import itertools
import math
N = int(input())
p = []
for i in range(N):
    x, y = map(int, input().split())
    p.append([x, y])
ans = 10000
if len(p) >= 3:
    S = list(itertools.combinations(p,3))
    for X in S:
        ok = True
        a = X[0][0]
        b = X[0][1]
        c = X[1][0]
        d = X[1][1]
        e = X[2][0]
        f = X[2][1]
        if (a-c)*(b-f) == (a-e)*(b-d):
            continue
        py = ((e-a)*(a**2+b**2-c**2-d**2)-(c-a)*(a**2+b**2-e**2-f**2))/(2*(e-a)*(b-d)-2*(c-a)*(b-f))
        if c == a:
            px = (2*(b-f)*py-(a**2+b**2-e**2-f**2))/(2*(e-a))
        else:
            px = (2*(b-d)*py-(a**2+b**2-c**2-d**2))/(2*(c-a))
        r = math.sqrt((px-a)**2+(py-b)**2)
        for Y in p:
            if not (r+0.000001)**2 >= (px-Y[0])**2 + (py-Y[1])**2:
                ok = False
        if ok:
            ans = min(ans, r)
T = list(itertools.combinations(p,2))
for X in T:
    a = X[0][0]
    b = X[0][1]
    c = X[1][0]
    d = X[1][1]
    ok = True
    px = (a+c)/2
    py = (b+d)/2
    r = math.sqrt((px-a)**2+(py-b)**2)
    for Y in p:
        if not (r+0.000001)**2 >= (px-Y[0])**2 + (py-Y[1])**2:
            ok = False
    if ok:
        ans = min(ans, r)
print(ans)

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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int M = (1e9)+7;
const int N = 1e6+5;

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        int n;
        cin>>n;
        int ans = 1000 - (n%1000);
        if(ans == 1000)ans = 0;
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <cmath>
#include <vector>

inline int functional(int x){
	return x*x;
}

int main(void){
	int buf;
	int x_max = 600;
	std::vector<int> d;

	while(std::cin >> buf){
		d.push_back(buf);
	}
	
	int sum;
	for(int i = 0; i < (int)d.size(); ++i){
		sum = 0;
		for(int j = 0; j < x_max; j += d[i]){
			sum += d[i]*functional(j);
		}
		std::cout << sum << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1216
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        N: usize,
        M: usize,
        edges: [(usize1, usize1); M],
    }

    let mut union_find = UnionFind {
        parent: (0..N).collect(),
        size: vec![1; N],
    };


    let mut closed = N*(N-1)/2;
    let mut output: Vec<usize> = Vec::with_capacity(M);

    for (a, b) in edges.into_iter().rev() {
        output.push(closed);
        let root_a = union_find.root(a);
        let root_b = union_find.root(b);
        if root_a != root_b {
            closed -= union_find.size[root_b] * union_find.size[root_a];
            union_find.parent[root_a] = root_b;
            union_find.size[root_b] += union_find.size[root_a];
        }
    }

    for c in output.into_iter().rev() {
        println!("{}", c);
    }
}

struct UnionFind {
    parent: Vec<usize>,
    size: Vec<usize>,
}

impl UnionFind {
    fn root(&mut self, v: usize) -> usize {
        let mut parent_v = self.parent[v];
        loop {
            if parent_v == self.parent[parent_v] {
                break;
            } else {
                parent_v = self.parent[parent_v];
            }
        }
        self.parent[v] = parent_v;
        parent_v
    }
}


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

using namespace std;
using ll = long long;
using edge = struct {int to; ll cost;};

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
#define INF (1 << 29)


//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);

void solve(){
    int n;
    cin >> n;
    vector<int> a(n+2, 0);
    int sum = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        sum += abs(a[i] - a[i-1]);
    }
    sum += abs(a[n] - a[n+1]);
    for(int i = 1; i <= n; i++){
        int ans = sum - abs(a[i-1] - a[i]) - abs(a[i] - a[i+1]) + abs(a[i-1] - a[i+1]);
        cout << ans << "\n";
    }
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 1664
#include <iostream>

using namespace std;

void swap(int *nx, int *ny)
{
    int temp = *nx;
    *nx = *ny;
    *ny = temp;
}

void sort3(int *n1, int *n2, int *n3)
{
    if (*n1 > *n2) swap(n1, n2);
    if (*n2 > *n3) swap(n2, n3);
    if (*n1 > *n2) swap(n1, n2);
}

int main(int argc, char const *argv[]) {
  int a, b, c;

  int count = 0;

  cin >> a >> b >> c;

  while (a != b or a != c) {
    count++;
    sort3(&a, &b, &c);

    if (c-b == c-a) {
      b++;
      a++;
    } else {
      a += 2;
    }
  }


  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        // 主処理
        String splitS = s.replace("LR", "L,R");
        String[] arr = splitS.split(",");
        Deque<Integer> deque = new ArrayDeque<>();
        for (int i = 0; i < arr.length; i++) {
            int countL = arr[i].replace("R", "").length();
            int count = arr[i].length();
            if (count % 2 == 1 && countL % 2 == 1) {
                deque.add(count / 2);
                deque.add((int) Math.ceil(count / 2.0));
            } else {
                deque.add((int) Math.ceil(count / 2.0));
                deque.add(count / 2);
            }
        }

        // 出力
        for (int i = 0; i < s.length() - 1; i++) {
            if (s.charAt(i) == 'R' && s.charAt(i + 1) == 'L') {
                System.out.print(deque.poll() + " ");
                if (i != s.length() - 2) {
                    System.out.print(deque.poll() + " ");
                } else {
                    System.out.println(deque.poll());
                }
                i++;
            } else {
                System.out.print("0 ");
            }
            if (i == s.length() - 2) {
                System.out.println("0");
            }
        }
    }
}


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

long long exgcd(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1, y = 0;
        return a;
    } else {
        long long r = exgcd(b, a % b, x, y);
        long long t = x;
        x = y;
        y = t - a / b * y;
        return r;
    }
}

int main() {
    long long n;
    cin >> n;
    if (n == 1) printf("1\n"), exit(0);
    long long ans = LLONG_MAX;
    if (n & 1) ans = n - 1;
    else ans = 2 * n - 1;
    n *= 2;
    auto chk = [&](long long x) {
        long long y = n / x;
        if (x == 1 || y == 1 || __gcd(x, y) > 1)
            return;
        long long t1, t2;
        assert(exgcd(x, y, t1, t2) == 1);
        t1 *= -1, t2 *= -1;
        if (t1 > 0) ans = min(ans, t1 * x);
        if (t2 < 0) ans = min(ans, -t2 * y - 1);
    };
    for (long long i = 1; i * i <= n; i++) {
        if (!(n % i)) {
            chk(i), chk(n / i);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3676
<?php
  fscanf(STDIN,"%d%d%d%d", $a,$b,$c,$d);
  function gcd($m, $n){
      if($n > $m) list($m, $n) = array($n, $m);
      while($n !== 0){
          $tmp_n = $n;
          $n = $m % $n;
          $m = $tmp_n;
      }
      return $m;
  }

  function lcm($m, $n){
      return $m * $n / gcd($m, $n);
  }
  
  $cd = lcm($c,$d);
  
  $a--;
  if($c>$b && $d>$b){
      echo $b-$a;
      exit;
  }
  
  $count1 = intdiv($b,$c)-intdiv($a,$c);
  $count2 = intdiv($b,$d)-intdiv($a,$d);
  $count3 = intdiv($b,$cd)-intdiv($a,$cd);
  echo $b-$a-$count1-$count2+$count3;

Measured memory_bytes: 4604
#include<stdio.h>

int main(void){
    int N,i;
    double x;
    char u[4];
    double ans = 0.0;
    scanf("%d",&N);
    for (i=0;i<N;i++){
        scanf("%lf %s",&x,u);
        if(u[0] == 'J'){
            ans += x;
        }else{
            ans += x*380000.0;
        }
    }
    printf("%f",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;

using namespace std;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
const int MOD = 998244353;

template <typename T>
void read(vector<T>& a) {
    for (auto &v : a)
        cin >> v;
}

int a[100];
int n;

ll test(int p){
    ll ans = 0;
    for (int i= 0; i< n; i++)
        ans += 1ll * (a[i] - p) * (a[i] - p);
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie();
    cin >> n;
    ll s = 0;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        s += a[i];
    }
    int m = ld(s)/n;
    ll ans = INF;
    for (int i = m-1; i <= m + 1; i++)
        ans = min(ans, test(i));
    cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define F first
#define S second
#define pss pair<string,string>
#define pcc pair<char,char>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define piii pair<int,pii>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define vs vector<string>
#define vl vector<ll>
#define vs vector<string>
#define vll vector<pll>
#define vss vector<pss>
#define vcc vector<pcc>
#define MP make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=n-1;i>=0;i--)
#define Very_fast std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const int N = 1e5+5;
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
inline ll gcd(ll a,ll b){if(b==0)return a;else return gcd(b,a%b);}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll lowbit(ll x){return (x&-x);}
inline ll kissme(ll x,ll y)
{
	ll res=1;
	if(x==0)return 1;
	if(x==1)return y;
	res=kissme(x/2,y);
	res=res*res%mod;
	if(x%2==1)res=res*y%mod;
	return res;
}
int n,x[N];
int main()
{
	Very_fast;
	cin>>n;
	for(int i=0;i<n;i++)cin>>x[i];
	int ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(x[i]==x[j])continue;
			for(int k=j+1;k<n;k++)
			{
				if(x[i]==x[k]||x[j]==x[k])continue;
				if((max(x[i],max(x[j],x[k]))<x[i]+x[j]+x[k]-max(x[i],max(x[j],x[k]))))
				{
					ans++;
				}
			}
		}
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

inline void Boost() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}
typedef long long int ll;
typedef long double ld;

const int NMax = 1e5 + 50;
const int LIM = 1e9;

struct op {
	int l, r, d;
};

int pos[NMax];
op v[2 * NMax];
vector < pair < int, int > > G[NMax];

int main() {
	Boost();

	int n, m;
	cin >> n >> m;

	for(int i = 1; i <= n; ++i) pos[i] = -1;

	for(int i = 1; i <= m; ++i) {
		cin >> v[i].l >> v[i].r >> v[i].d;
		G[v[i].l].push_back({v[i].r, v[i].d});
		G[v[i].r].push_back({v[i].l, -v[i].d});
	}

	for(int i = 1; i <= n; ++i) {
		if(pos[i] != -1) continue;
		queue < int > Q;
		Q.push(i);

		while(!Q.empty()) {
			int node = Q.front(); Q.pop();
			if(pos[node] == -1) pos[node] = LIM;

			for(auto it: G[node]) {
				if(pos[it.first] == -1) {
					pos[it.first] = pos[node] + it.second;
					Q.push(it.first);
				}
			}
		}
	}

	// for(int i = 1; i <= n; ++i) cout << pos[i] << " ";
	// cout << endl;

	for(int i = 1; i <= m; ++i) {
		if(pos[v[i].r] - pos[v[i].l] != v[i].d) {
			cout << "No";
			exit(0);
		}
	}

	cout << "Yes";
	return 0;
}

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

long long int N;

struct StrangeBank{
    int val[101010];
    int c[12] = {1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049};

    constexpr StrangeBank() : val(){
        val[0] = 0;
        for(int i = 1, j = 1; i < 101010; ++i){
            val[i] = 9999999;
            while(j < 12 && c[j] <= i)++j;
            for(int k = 0; k < j; ++k){
                val[i] = min(val[i], val[i - c[k]] + 1);
            }
        }
    }
};

constexpr StrangeBank sb = StrangeBank();

int main(){
    scanf("%lld", &N);
    cout << sb.val[N] << endl;
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  for(int i = 0;i < s.size();i++){
    if(s[i]-'0' == 7){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <stack>
using namespace std;

int main(void) {
  string str; cin >> str;
  stack<char> st;
  for (auto c : str) {
    if (st.empty()) st.push(c);
    else {
      if (st.top() == 'S' && c == 'T') st.pop();
      else st.push(c);
    }
  }
  cout << st.size() << endl;
  return 0;
}


Measured memory_bytes: 644
s = list(input())
t = list(input())
x = list(set(s))
y = list(set(t))
a = []
b = []

for i in range(len(set(s))):
    a.append(s.count(x[i]))
    
for j in range(len(set(t))):
    b.append(t.count(y[j]))
    
a.sort()
b.sort()

if a == b:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 6704
#include <iostream>
#include <algorithm>

using namespace std;

long long A[1000], B[1000];

int main(){
  int i,N,M,j,a,b,f;
  cin >> N >> M;
  for (i=0;i<N;++i) {
    cin >> A[i];
  }
  for (i=0;i<M;++i) {
    cin >> B[i];
  }
  j=M*N;
  sort(A,A+N);
  sort(B,B+M);
  a=N-1;
  b=M-1;
  long long s=1,p=1000000007,s0;
  while (j>0) {
    f=0;
    s0=1;
    if (A[a]==j) {
      a--;
      f=1;
    } else {
      s0*=(N-1)-a;
    }
    if (B[b]==j) {
      b--;
      f=1;
    } else {
      s0*=(M-1)-b;
    }
    if (f==0) {
      s0-=N*M-j;
    }
    s*=s0;
    s=s%p;
    //cout << s << endl;
    j--;
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 384
#include<cstdio>

typedef long long LL;

const int mod=1e9+7;
const int N=1e6+10;

LL qpow(int a,int b){
    LL res=1;
    LL t=a;
    while(b){
        if(b&1) res=res*t%mod;
        t=t*t%mod;
        b>>=1;
    }
    return res%mod;
}

int main(){
    int n;
    scanf("%d",&n);
    LL ans=qpow(10,n)-2*qpow(9,n)+qpow(8,n);
    ans%=mod;
    if(ans<0) ans+=mod;
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
static const int mod = 1000000007;

int N,M;
vector<P1> interval[305];
int dp[305][305][305];
//[最後に塗ったRの場所][最後に塗ったGの場所][最後に塗ったBの場所]

int ans;

bool check(int color[]){
    sort(color,color+3);
    int r = color[2];
    for(auto c : interval[r]){
        int l = c.first,x =c.second;
        if(x == 1){
            if(color[0]>=l||color[1]>=l||r-l+1<1)return false;
        }
        else if(x == 2){
            if(color[0]>=l||color[1]<l||r-l+1<2)return false;
        }
        else if(x == 3){
            if(color[0]<l||r-l+1<3)return false;
        }
    }
    return true;
}

signed main(){
    cin>>N>>M;
    for(int i=0;i<M;++i){
        int l,r,x;
        cin>>l>>r>>x;
        interval[r].PB(P1(l,x));
    }
    dp[1][0][0] = 1;
    dp[0][1][0] = 1;
    dp[0][0][1] = 1;
    for(int R=0;R<=N;++R){
        for(int G=0;G<=N;++G){
            for(int B=0;B<=N;++B){
                if(R!=0&&G!=0&&R==G)continue;
                if(R!=0&&B!=0&&R==B)continue;
                if(G!=0&&B!=0&&G==B)continue;
                int c[] = {R,G,B};
                if(!check(c))dp[R][G][B]=0;
                int nc = max(R,max(G,B));
                dp[nc+1][G][B]+=dp[R][G][B]%mod;
                dp[R][nc+1][B]+=dp[R][G][B]%mod;
                dp[R][G][nc+1]+=dp[R][G][B]%mod;
            }
        }
    }
    for(int i=0;i<N;++i)for(int j=0;j<N;++j){
        ans+=dp[N][i][j]+dp[i][N][j]+dp[i][j][N];
        ans%=mod;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 221440
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
#define INF           1e9
#define INFL          static_cast<lint>(INF)
#define REP(i,n)      for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)     for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPI(i,ini,n) for(lint i=(ini),i##_len=(n);i<i##_len;++i)
#define REPC(i,obj)   for(auto i:obj)
#define R_UP(a,b)     (((a)+(b)-1)/(b))
#define ALL(obj)      (obj).begin(),(obj).end()
int main()
{
	int n = in(), q = in();
	vector<list<int>>L(n);
	REP(i, q)
	{
		int t, x, s;
		switch (in())
		{
		case 0:
			t = in(), x = in();
			L[t].push_back(x);
			break;
		case 1:
			t = in();
			if (L[t].size() != 0)
			{
				auto itr = L[t].begin();
				REP(j, L[t].size())
				{
					if (j != 0)cout << ' ';
					cout << *itr++;
				}
			}
			cout << endl;
			break;
		case 2:
			s = in(), t = in();
			L[t].splice(L[t].end(), move(L[s]));
			break;
		}
	}
}


Measured memory_bytes: 18708
import sys
import math
N, D = map(int, sys.stdin.readline().split())
L = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
#print(L)
cnt = 0
for i in range(N-1):
    for ie in range(i+1, N):
        tmp = 0
        for j in range(D):
            tmp +=(L[i][j] - L[ie][j])**2
        if math.sqrt(tmp) == int(math.sqrt(tmp)):
            cnt +=1
print(cnt)

Measured memory_bytes: 3064
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args){
		Scanner buf = new Scanner(System.in);
		int n;
		boolean judge;
		BigInteger s1,s2;
		BigInteger sum;
		n = buf.nextInt();
		while(n > 0){
			judge = false;
			s1 = buf.nextBigInteger();
			s2 = buf.nextBigInteger();
			sum = s1.add(s2);
			if(s1.toString().length() > 80 || s2.toString().length() > 80){
				System.out.println("overflow");
				judge = true;
			}
			else if(sum.toString().length() > 80){
				System.out.println("overflow");
				judge = true;
			}
			if(!judge) System.out.println(sum);
			n--;
		}
	}
}

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

using ll = long long;
#define pb push_back
#define f first
#define s second
int dp[1000000];
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i = 0; i < n; i++){
        cin >> h[i];
        dp[i] = 1e9;
    }
    
    dp[0] = 0;
    for(int i = 0; i < n; i++){
        for(int j = 1; j <= k; j++){
            if(i+j<n)
            dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j] - h[i]));
        }
    }
    cout << dp[n-1];
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;

int main() {
	int N,C,K;
	cin >> N >> C >> K;
	int elt = 0;
	int rideCnt = 0;
	int ans = 0;
	int T[100010];
	REP(i, N) cin >> T[i];
	sort(T, T + N);
	elt = T[0];
	REP(i, N) {
		if (rideCnt < C && T[i] - elt <= K) {
			rideCnt++;
		}
		else {
			rideCnt = 1;
			elt = T[i];
			ans++;
		}
	}
	cout << ++ans << endl;
	return 0;
}


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

bool    CMP(vector<int> &A, vector<int> &B) {
        if (A.at(1) == B.at(1)) return A.at(0) > B.at(0);
        else return A.at(1) < B.at(1);
}

int     main() {
        int N, M;
        cin >>N >>M;
        vector<vector<int>> A(N, vector<int> (2, 0));
        for (int i=0; i<N; i++) {
                cin >>A.at(i).at(1) >>A.at(i).at(0);
        }
        sort(A.begin(), A.end(), CMP);
        priority_queue<int> Q;
        long S=0;
        int j=0;
        for (int i=1; i<=M; i++) {
                while ((j<N)&&(A.at(j).at(1)<=i)) {
                        Q.push(A.at(j).at(0));
                        j++;
                }
                if (!Q.empty()) {
                        S += Q.top();
                        Q.pop();
                }
        }
        cout <<S <<endl;
        return 0;
};

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long INF=INT_MAX/4;
const long long MOD=998244353;
const double EPS=1e-14;
const bool DEBUG=false;

const string YES = "YES";
const string NO = "NO";
const string Yes = "Yes";
const string No = "No";

template<class T>
void debug(T head){
    if(DEBUG){
        cout<<head<<endl;
    }
}

template <class Head, class... Body>
void debug(Head head, Body... body){
    if(DEBUG){
        cout<<head<<" ";
        debug(body...);
    }
}

/////
void answer(){
    long N, K;
    cin>>N>>K;
    vector<int> L(K), R(K);
    vector<long> dp(N+1, 0), csum(N+1, 0);
    for(int i=0; i<K; ++i){
        cin>>L[i]>>R[i];
    }

    dp[0] = 0;
    dp[1] = 1;
    csum[0] = 0;
    csum[1] = dp[1];
    for(int i=2; i<=N; ++i){
        for(int j=0; j<K; ++j){
            dp[i] += csum[max(0, i-L[j])] - csum[max(0, i-R[j]-1)] + MOD;
            debug(i-L[j], csum[max(0, i-L[j])], i-R[j]-1, csum[max(0, i-R[j]-1)]);
        }
        dp[i] %= MOD;
        csum[i] = (csum[i-1] + dp[i]) % MOD;
        // for(auto x : dp){
        //     cout<<x<<" ";
        // }
        // cout<<endl;
        // for(auto x : csum){
        //     cout<<x<<" ";
        // }
        // cout<<endl;
    }

    cout<<dp[N]<<endl;

    return;
}

/////

int main(int argc, char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.precision(16);

    answer();

    return 0;
}


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

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

int MOD = 1e9 + 7;
int INF = 1e9;
// ll INF = 1e18;

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

int n, d[105];
string s;

int get(string s, char c){
	int ok = 1; for(int i=0;i<s.size();i++) if(s[i] != c) ok = 0;
	if(ok) return 0;
	string t;
	for(int i=0;i+1<s.size();i++){
		if(s[i+1] == c)
			t.push_back(c);
		else
			t.push_back(s[i]);
	}
	return get(t, c) + 1;
}

int solve(){
	cin >> s; n = s.size();
	int mn = INF;
	for(char c='a';c<='z';c++) mn = min(mn, get(s, c));
	cout << mn << endl;
	return 0;
}

int main(){
	ios::sync_with_stdio(0);
	// int t; cin >> t; while(t--)
	solve();
	// cout << (solve() ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n = int(input())
a = [[0] for _ in range(2)]
for i in range(2):
    a[i] = list(map(int,input().split()))

ans = 0

for i in range(n):
    candy = 0
    candy += sum(a[0][:i+1])
    candy += sum(a[1][i:])
    ans = max(ans,candy)

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  map <string,int> mp;
  vector <string> ans;
  int maxi=0;
  for (int i=0;i<n;i++)
  {
    string s;
    cin>>s;
    mp[s]++;
    maxi=max(maxi,mp[s]);
  }
  for (auto x: mp)
  {
    if (x.second==maxi)
    {
      ans.push_back(x.first);
    }
  }
  for (auto x:ans)
    cout<<x<<endl;
}
  


Measured memory_bytes: 26868
#include <bits/stdc++.h>
using namespace std;
int r;
double s;
int main()
{
   cin>>r;
   s=r*2.0*3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725;
  cout<<fixed<<setprecision(3)<<s<<endl;
	return 0;
}

Measured memory_bytes: 3748
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int count = 0;

		for(int i = a; i <= b; i++){
			if( c % i == 0){
				count++;
			}
		}
		System.out.println(count);
	}
}



Measured memory_bytes: 26244
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void doIt() {
		int cho = 0;
		int hishi = 0;
		while(true){
			try{
				String str[] = sc.nextLine().split(",");
				int a = Integer.parseInt(str[0]);
				int b = Integer.parseInt(str[1]);
				int c = Integer.parseInt(str[2]);
				if(a * a + b * b == c * c)cho++;
				if(a == b)hishi++;
			}catch(Exception g){
				System.out.println(cho);
				System.out.println(hishi);
				System.exit(0);
			}
		}
	}
    public static void main(String[] args) {
    	new Main().doIt();
    }
}

Measured memory_bytes: 17160
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {
	long long int n;
	cin >> n;
	long long int a[5];
	long long int min = 0;
	for (int i=0; i < 5; i++) {
		cin >> a[i];
		if (i == 0)min = a[i];
		if (a[i] < min) {
			min = a[i];
		}
	}
	long long int r = 0;
	if (n % min == 0)r = n / min;
	else r = n / min + 1;
	cout << r + 4;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int t=1,n,k,x,y;
    while(t--)
    {
        long long int s=0,d,e;
        cin>>n;
        int a[n];
        unordered_map<int,int>m;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            m[a[i]]++;
            s=s+a[i];
        }
        cin>>k;
        while(k--)
        {
            cin>>x>>y;
            d=m[x];
            e=m[y];
            s=s-d*x;
            s=s+d*y;
            m[y]=e+d;
            m[x]=0;
            cout<<s<<endl;
        }
    }

}


Measured memory_bytes: 7436
import sys

s = raw_input()
l = ['dreameraser', 'dreamerase', 'eraser', 'dreamer', 'dream', 'erase']

flag = True
while flag:
    if len(s) == 0:
        print 'YES'
        sys.exit()
    for w in l:
        if s.find(w) == 0:
            s = s[len(w):len(s)]
            break
    else:
        flag = False
print 'NO'


Measured memory_bytes: 2820
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

from heapq import heapify, heappop, heappush, heappushpop
 
 
class PriorityQueue:
    def __init__(self, heap):
        '''
        heap ... list
        '''
        self.heap = heap
        heapify(self.heap)
 
    def push(self, item):
        heappush(self.heap, item)
 
    def pop(self):
        return heappop(self.heap)
 
    def pushpop(self, item):
        return heappushpop(self.heap, item)
 
    def __call__(self):
        return self.heap
 
 
heap = []  # ヒープといっても順序を工夫したただのリスト
 
q = PriorityQueue(heap)
q.push((-(A[0] + B[0] + C[0]), 0, 0, 0))
 
considered = set()
ans = []
for k_th in range(1, K+1):
    heap_max, i, j, k = q.pop()
    ans.append(-heap_max)
    for di, dj, dk in zip([1, 0, 0], [0, 1, 0], [0, 0, 1]):
        i_new, j_new, k_new = i + di, j + dj, k + dk
        if i_new >= X or j_new >= Y or k_new >= Z:
            continue
        if (i_new, j_new, k_new) in considered:
            continue
        considered.add((i_new, j_new, k_new))
        q.push((-(A[i_new] + B[j_new] + C[k_new]), i_new, j_new, k_new))
 
 
print(*ans, sep='\n')


Measured memory_bytes: 5236
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define gsort(x) sort(x, x+n, greater<ll>()); 
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sync2 cout<<fixed<<setprecision(10)
const ll inf=1e9+7;
#define pi 3.14159265358979323846
#define REP(i,j,n) for (int i = (int)j; i <=(int)n; i++)
#define REPD(i,n,j) for (int i = (int)n; i>=(int)j; i--)
#define all(vv) vv.begin(),vv.end()
//priority_queue <int, vector<int>, greater<int>> mnheap;

ll arr[8];
const ll MOD=998244353;
int main()
{
    sync;
    int n;
    cin>>n;
    string st;
    cin>>st;
    ll ans=1;
    int i=0;
    int bit;
    arr[0]=n;
    while(i<3*n)
    {
        if(st[i]=='R')
        {
            bit=1;
        }
        if(st[i]=='G')
        {
            bit=2;
        }
        if(st[i]=='B')
        {
            bit=4;
        }
        for(int j=7;j>=0;j--)
        {
            if(bit&j)continue;
            if(arr[j])
            {
                ans=(ans*arr[j])%MOD;
                arr[j]--;
                arr[j|bit]++;
                break;
            }
        }
        i++;
    }
    cout<<ans<<endl;
}
/*
3
RRRGGGBBB
*/

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

int main() {
  int N;
  cin >> N;
  int p[N];
  for (int i = 0; i < N; i++) {
    cin >> p[i];
  }
  sort(p, p+N);
  cout << (p[N/2]-p[N/2-1]) << endl;
  return 0;
}


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

const int MAXN = 3e5 + 6.66;
int arr[MAXN];
int pre[MAXN];
int suf[MAXN];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int n; cin >> n;
  for(int i = 0; i < n; i++) {
    char ch; cin >> ch;
    arr[i] = ch == 'E';
  }
  pre[0] = arr[0], suf[n - 1] = arr[n - 1];
  for(int i = 1; i < n; i++)
    pre[i] = pre[i - 1] + arr[i], suf[n - 1 - i] = suf[n - i] + arr[n - i - 1];
  int mn = 1e9 + 7;
  for(int i = 0; i < n; i++)
    mn = min(mn, i - (i > 0 ? pre[i - 1] : 0) + suf[i + 1]);
  cout << mn << endl;
  return 0;
}


Measured memory_bytes: 3840
#include<iostream>
#include<cstdio>
using namespace std;
const int N=100010;
int a[N][4],f[N][4];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d%d",&a[i][1],&a[i][2],&a[i][3]);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=3;j++){
			for(int k=1;k<=3;k++){
				if(k!=j) f[i][j]=max(f[i][j],f[i-1][k]+a[i][j]);
			}
		}
	}
	printf("%d\n",max(f[n][1],max(f[n][2],f[n][3])));
} 

Measured memory_bytes: 3328
H, W = gets.split.map(&:to_i)
S = readlines.map(&:chomp)
require 'pp'

@m = ['#' * (W + 2)] + S.map{|l| ("#" + l + "#")} + ['#' * (W + 2)]

def bfs
  q = [[[1, 1]]]
  v = Array.new(H + 2){Array.new(W + 2, false)}
  while !q.empty?
    p = q.shift
    i, j = p.last
    [[1, 0], [-1, 0], [0, 1], [0, -1]].each do |di, dj|
      i1, j1 = i + di, j + dj
      next if @m[i1][j1] != '.' || v[i1][j1]
      return p.length + 1 if [i1, j1] == [H, W]
      v[i1][j1] = true
      q << (p + [[i1, j1]])
    end
  end
  false
end

a = bfs
puts a ? S.inject(0){|s, l| s + l.count('.')} - a : -1

Measured memory_bytes: 2812
import java.util.Scanner;

public class Main {
    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args){
        char[] s = stdIn.next().toCharArray();
        char[] t = stdIn.next().toCharArray();

        int counter = 0;
        int n = s.length;
        for(int i=0; i<n; i++){
            if(s[i] != t[i])
                counter++;
        }

        System.out.println(counter);
    }
}


Measured memory_bytes: 41920
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
//    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

long long  factorial(long long n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}

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

int distance(int a, int b) {
  return abs(a-b)*abs(a-b);
}

//int ()



int main()
{
  int a ,b, c, d, e, X, Y;
//  long long  a, b, c, d, e, X, Y;
  //  double  c;
//  int  A[200003]={};
  long long  A[100003]={};
  long long  B[100003]={};
  int  C[100003][11]={};

  int  flg=0;

//  long long  a, b, c, d, X, Y;
  char s[101][101]={};
  char t[101]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
  long long p,q;
//  int flag=0;
//  int tmp=0;
//  char tmp[101]={};
//  long long min=10000000000;
//  long long min=100000001;
  int len=0;
  int l=0;
  int r=1000001;
  int cnt=0;
  int num=0;
  int num1=0;
  int num2=0;
  int ans=0;
  int max=0;
  int sum=0;
  int addr=0;
  int ptn=0;
  long long  tmp=0;
//  bool on_off[100]={};
  
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
//  scanf("%lld %lld", &a, &b);
  scanf("%d", &a);
  scanf("%s", &t);
/*
  scanf("%lld", &A[0]);
  A[0]=A[0]-1;
  for(i=1;i<a;i++){
    scanf("%lld", &A[i]);
    if(A[i-1]<A[i]) A[i]=A[i]-1;
    else if(A[i-1]>A[i]){
      printf("No\n");
      return 0;
    }
  }
*/
  
  if(a<3200)  printf("red\n");
  else   printf("%s\n",t);
//  printf("Yes\n");
 

return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];


int main(){
  ll n;cin>>n;
  vll b(100001);
  ll ans=0;
  rep(i,0,n){
    ll a;cin>>a;
    if(a>100000){
      ans++;
    }
    else{
      b[a]++;
    }
  }
  rep(i,0,100001){
    if(b[i]>i){
      ans+=b[i]-i;
    }
    if(b[i]<i){
      ans+=b[i];
    }
  }
  cout<<ans<<endl;
}







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

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

using ll = long long;

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

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

int dp[150][150];
bool seen[150][150];
vector<string> fi;
int H,W;
int f(int x, int y){
  if(seen[x][y]) return dp[x][y];
  seen[x][y]=true;
  int a=0,b=0;
  if(x==H-1){
    if(fi[x][y]!=fi[x][y+1]) dp[x][y]=f(x,y+1)+1;
    else dp[x][y]=f(x,y+1);
  }
  else if(y==W-1){
    if(fi[x][y]!=fi[x+1][y])  dp[x][y]=f(x+1,y)+1;
    else dp[x][y]=f(x+1,y);
  }
  else {
    if(fi[x][y]!=fi[x][y+1]) a=f(x,y+1)+1;
    else a=f(x,y+1);
    if(fi[x][y]!=fi[x+1][y])  b=f(x+1,y)+1;
    else b=f(x+1,y);
    dp[x][y]=min(a,b);
  }
  return dp[x][y];
}
    

int main() {
  cin>>H>>W;
  fi.resize(H);
  rep(i,H) cin>>fi[i];
  dp[H-1][W-1]=0;
  seen[H-1][W-1]=true;
  int ans=f(0,0);
  if(ans%2==1) ans=(ans+1)/2;
  else {
    if(fi[0][0]=='#') ans = (ans+1)/2+1;
    else ans = (ans+1)/2;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;


int main(void){
	int a, b;

	cin >> a >> b;

	int root[13] = {0, 1, 2, 1, 4, 1, 4, 1, 1, 4, 1, 4, 1};

	if (root[a] == root[b])
		cout << "Yes";
	else
		cout << "No";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

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

		String outStrings;

		if((a*b)%2 == 0)
			outStrings = "Even";
		else outStrings = "Odd";

		System.out.println(outStrings);

	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
#include <bitset>

using ll = long long int;
using ul = unsigned long long int;

// ABS
template<class T>
inline T abs(const T &a){ return (a>0) ? a : -a; }
// GCD: a > b
ul gcd(ul a,ul b) { return (!b) ? a : gcd(b,a%b); }

int main(int argc,char *argv[])
{
	ll n,k;
	std::cin >> n >> k;
	
	ll tmp = abs<ll>(n%k);
	if (tmp > abs<ll>(tmp-k)) { tmp = abs<ll>(tmp-k); }
	
	std::cout << tmp << std::endl;

	return 0;
}


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

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

void solve(void)
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    cout << accumulate(a.begin(), a.end(), -n) << endl;
}
int main(void) { solve(); }

Measured memory_bytes: 3596
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<unordered_set>
#include<unordered_map>
#include<set>
#include<map>
#include<list>

using namespace std;

#define in(s) cin >> s
#define out(s) cout << s << endl
#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    int N, M;
    in(N); in(M);
    vector<int> A(M);
    int sum=0;
    rep(i, M) {
        in(A[i]);
        sum += A[i];
    }
    cout << max(N - sum, -1) << endl;


	return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

ll n, m, ans = 0;
vv(ll) G(51, vector<ll>(51, 0));
vector<bool> seen(51);

void	dfs(int now)
{
	seen[now] = 1;
	for (int i = 1; i <= n; ++i)
	{
		if (G[i][now] && seen[i] == 0)
			dfs(i);
	}
}

int		main(void)
{
	cin >> n >> m;

	vector<pair<ll, ll>> P;
	for (ll i = 0; i < m; ++i)
	{
		ll a, b;
		cin >> a >> b;
		P.push_back({a, b});
		G[a][b] = true;
		G[b][a] = true;
	}
	for (int i = 0; i < m; ++i)
	{
		ll p1 = P[i].first;
		ll p2 = P[i].second;
		G[p1][p2] = false;
		G[p2][p1] = false;
		seen.assign(51, false);
		dfs(1);
		int j;
		for (j = 1; seen[j] && j <= n; ++j)
			;
		if (j == n+1)
			++ans;
		G[p1][p2] = true;
		G[p2][p1] = true;
	}
	cout << m - ans << endl;
}



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


def solve(N: int, K: int, h: "List[int]"):
    print( len(list(filter(lambda x:x>=K, h))) )
    return


# Generated by 1.1.4 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
    K = int(next(tokens))  # type: int
    h = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, K, h)

if __name__ == '__main__':
    main()


Measured memory_bytes: 12516