akhauriyash/Code-Regression huggingface dataset:
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: ident) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    let mut it = s.split_whitespace();
    let n: usize = parse!(it);
    println!("{}", n / 2 + if n % 2 == 1 { 1 } else { 0 });
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
using namespace std;
int main(){
  string A;
  cin>>A;
  int f=0;
  for(int i=0;i<A.size();i++){
    if(A[i]=='7'){
      f=1;
     break; 
    }
  }
  if(f==1){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
 return 0; 
}

Measured memory_bytes: 3628
S = list(set(list(input())))
S.sort()
ans = "No"
if S[0] == 'E':
  if S[-1] == 'W':
    if len(S)==2 or len(S)==4:
      ans = "Yes"
if S[0] == 'N':
  if S[-1] == 'S':
    ans = "Yes"
print(ans)

Measured memory_bytes: 61472
#include<iostream>
#include<string>

int main(){
    
    std::string s, out;

    std::cin >> s;

    for(const auto& e : s){
        if(e == '0' || e == '1'){
            out.push_back(e);
        }else if(out.size() != 0){
            out.erase(out.size() - 1);
        }
    }

    std::cout << out << std::endl;
    
    return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, now=0;
  cin>>n;
  vector<pii> p(n);
  int a, b;
  rep(i, n){
    cin>>a>>b;
    p.at(i) = make_pair(b, a);
  }
  sort(p.begin(), p.end());
  
  bool ans = true;
  rep(i, n){
    now+=p.at(i).second;
    if(p.at(i).first<now){
      ans = false;
      break;
    }
  }
  if(ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 4788
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
///////////////////////////

#define N 150005
vector<ll>v[N];
ll chi[N];
dd pro[N];
dd dfs(ll id,ll par){
    pro[id]=0.0;
    for(auto x:v[id]){
        if(x==par)continue;
        pro[id]+=dfs(x,id)+1.0;
        chi[id]++;
    }
    if(chi[id]!=0)pro[id]=pro[id]/chi[id];
    return pro[id];
}
bool dfs2(ll id,ll par,dd d_par){
    if(par==-1){
        //pro[id]=(pro[id]*chi[id]+d_par)/(chi[id]);
        dd sum=pro[id]*chi[id];
        for(auto x:v[id]){
            dd res=0;
            if(chi[id]-1>0)res=(sum-(pro[x]+1))/(chi[id]-1);
            dfs2(x,id,res+1.0);
        }
        return 0;
    }
    dd sum=(pro[id]*chi[id]+d_par);
    pro[id]=sum/(chi[id]+1);
    for(auto x:v[id]){
        if(x==par){
            continue;
        }else{
            dd res=0;
            if(chi[id]>0)res=(sum-(pro[x]+1))/(chi[id]);
            dfs2(x,id,res+1.0);
        }
    }
    return 0;
}

int main(){fastio
    ll n;cin>>n;
    rep(i,1,n-1){
        ll a,b;cin>>a>>b;
        v[a].pb(b);v[b].pb(a);
    }
    dfs(1,-1);
    //rep(i,1,n)cout<<pro[i]<<endl;
    dfs2(1,-1,0.0);
    rep(i,1,n)cout<<setprecision(20)<<pro[i]<<endl;
    
    return 0;
}


Measured memory_bytes: 21888
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

using T=tuple<int,int,int,int>;

int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int h,w;
    cin>>h>>w;
    vector<vector<int>> f(h,vector<int>(w,0));
    rep(i,h)rep(j,w) cin>>f[i][j];
    queue<T> ans;
    bool fl=0;
    int x,y,z,zz;
    rep(i,h)rep(j,w-1){
        fl=(f[i][j]%2==1);
        if(!fl) continue;
        ans.emplace(i+1,j+1,i+1,j+2);
        f[i][j+1] ++;
        f[i][j] --;
    }
    rep(i,h-1){
        fl=(f[i][w-1]%2==1);
        if(!fl) continue;
        ans.emplace(i+1,w,i+2,w);
        f[i+1][w-1] ++;
        f[i][w-1] --;
    }
    cout<<ans.size()<<'\n';
    while(!ans.empty()){
        tie(x,y,z,zz)=ans.front();
        ans.pop();
        cout<<x<<" "<<y<<" "<<z<<" "<<zz<<'\n';
    }
    // tie(x,y,z,zz)=ans.front();
    // cout<<x<<" "<<y<<" "<<z<<" "<<zz<<'\n';
    
}

Measured memory_bytes: 5120
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

from itertools import permutations
N = ii()
xy = li2(N)
ans = float('inf')
tmp = 0.0
for l in permutations([i for i in range(N)]):
    for i in range(N-1):
        tmp += pow(pow(xy[l[i+1]][0]-xy[l[i]][0], 2) + pow(xy[l[i+1]][1]-xy[l[i]][1], 2), 0.5)

bunshi = 1
for i in range(1, N+1):
    bunshi *= i
print(tmp / bunshi)

Measured memory_bytes: 40684
import sys
input = sys.stdin.readline
n,h = map(int,input().split())
ab = []
cnt = 0
max_a = 0

for i in range(n):
  a,b = map(int,input().split())
  ab += [[a,b]]
ab.sort(reverse=True)
max_a = ab[0][0]
ab.sort(key=lambda x: x[1],reverse=True)

for i in range(n):
  if ab[i][1] > max_a:
    h -= ab[i][1]
    cnt += 1
  else:
    break
  if h <= 0:
    print(cnt)
    exit()
cnt += -(-h // max_a)
print(cnt)

Measured memory_bytes: 21432
#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>;

int main(void){
    int a,b;
    int ans[3] = {1,2,3};
    cin >> a >> b;
    rep(i,3) if(ans[i]!=a && ans[i]!=b) cout << ans[i] << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i = 1; i <= 9; i++) if (n % i == 0 && n / i <= 9) {
        cout << "Yes";
        return 0;
    }
    cout << "No";
}


Measured memory_bytes: 3620
n = gets.chomp.to_i
ms = Array.new(n){Array.new(n, 0)}
n.times do
  num, degree, *adjacents = gets.chomp.split(' ').map(&:to_i)
  adjacents.each do |a|
    ms[num - 1][a - 1] = 1
  end
end
ms.each do |m|
  puts m.join(' ')
end


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

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

  vector<long long> a(3 * N);
  for(auto& x: a){
    cin >> x;
  }
  sort(a.begin(), a.end());

  long long ans = 0;
  for(int i = N; i < 3 * N; i += 2){
    ans += a[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 2560
if __name__ == '__main__':

    ans = ""
    while True:
        try:
            tmp = ""
            ans = ""
            line = input()
            for x in line:
                if x == "@":
                    tmp += "@"
                else:
                    if len(tmp) == 0:
                        ans += x
                    else:
                        tmp += x
                        if len(tmp) == 3:
                            ans += tmp[2]*int(tmp[1])
                            tmp = ""
            print(ans)
        except EOFError:
            break



Measured memory_bytes: 5600
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
  string S, T;
  cin >> S >> T;
  int len = S.size();
  bool ok = false;
  for (int j=0; j < len; ++j) {
    bool f = true;
    for (int k=0; k < len; ++k) {
      if (k >= len-j) {
        if (S[k] != T[k-(len-j)]) {
          f = false;
        }
      } else if (S[k] != T[k+j]) {
        f = false;
      }
    }
    if (f) {
      ok = true;
      break;
    }
  }
  cout << (ok?"Yes":"No") << endl;
}

Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
use std::collections::HashMap;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn count_num_char(s: String) -> Vec<u32>{
    let mut res: Vec<u32> = vec![0;26];
    for ch in s.bytes(){
        res[(ch-97) as usize]+= 1;
    }

    return res;
}

fn main(){
    let mut count_hash: HashMap<Vec<u32>, u64> = HashMap::new();
    let n = read_as_vec::<usize>()[0];

    for _ in 0..n{
        let count_vec = count_num_char(read_as_string());
        *count_hash.entry(count_vec).or_insert(0) += 1;
    }

    let mut ans: u64 = 0;
    for h in count_hash.iter(){
        //println!("{}", h.1);
        ans += h.1*(h.1-1)/2;
    }
    println!("{}", ans);

}


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

int main() {
  int N;
  cin >> N;
  map<pair<char, char>, int> MA;
  for (int i = 1; i <= N; i++) {
    char a = to_string(i).front();
    char b = to_string(i).back();
    MA[{a, b}]++;
  }
  long ans = 0;
  for (int i = 1; i <= N; i++) {
    char a = to_string(i).front();
    char b = to_string(i).back();
    ans += MA[{b, a}];
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;
//|\_
//g++ -std=c++1z temp.cpp
//./a.out





int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    int i,n;
    string s;
    int haiku[]={5,7,5,7,7};
    int sum;
    vector<int> ans;
    while(1){
        haiku[0]=5;
        haiku[1]=7;
        haiku[2]=5;
        haiku[3]=7;
        haiku[4]=7;
        cin>>n;
        if(n==0)break;
        vector<int> v(n,0);
        rep(i,n){
            cin>>s;
            v[i]=s.length();
        }
        int phase=0;
        bool ch=false;
        // cout<<"-------------------------------"<<endl;
        rep(i,n-4){
            phase=0;
            int j=0;
            while(1){
                // cout<<j<<" "<<phase<<" "<<v[i+j]<<" "<<haiku[phase]<<endl;
                haiku[phase]-=v[i+j];
                if(haiku[phase]==0)phase++;
                else if(haiku[phase]<0)break;
                if(phase>=5){
                    ch=true;
                    break;
                }
                j++;
            }
            
            if(ch){
                ans.push_back(i+1);
                break;
            }
            haiku[0]=5;
            haiku[1]=7;
            haiku[2]=5;
            haiku[3]=7;
            haiku[4]=7;
        }
        
    }
    rep(i,ans.size())cout<<ans[i]<<endl;
//////////////////////////////////////////////////////
return 0;}



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

using namespace std;

int main(){
  string t;
  cin >> t;
  if(t.at(0)=='R'&&t.at(1)=='R'&&t.at(2)=='R'){
    cout << 3 << endl;
  }
  else if(t.at(1)=='R'){
    if(t.at(0)=='R'||t.at(2)=='R'){
      cout << 2 << endl;
    }
    else{
      cout << 1 << endl;
    }
  }
  else{
    if(t.at(0)=='R'||t.at(2)=='R'){
      cout << 1 << endl;
    }
    else{
      cout << 0 << endl;
    }
  }
  
  return 0;
}
    

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

void solve(long long R) { printf("%.20lf\n", 2 * M_PI * R); }

// 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)
int main() {
    long long R;
    scanf("%lld", &R);
    solve(R);
    return 0;
}


Measured memory_bytes: 3828
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <fstream>
#include <set>
#include <cmath>
#include <array>
#include <iomanip>


using namespace std;
constexpr int kMaxN = 30000;
int main(void) {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    std::vector<int> perm(n), answer(n);
    for (auto& el : perm) {
        cin >> el;

        el--;
    }
    for (int i = 0; i < n; i++) {
        cout << (i + 1) * kMaxN << " ";
    }
    cout << endl;
    for (int i = 0; i < n; i++) {
        answer[perm[i]] = (n - perm[i]) * kMaxN + i + 1;
    }
    for (auto& el : answer) {
        cout << el << " ";
    }
    cout << endl;
}


Measured memory_bytes: 768
/* 4-Adjacent */
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int multiples = 0;
    int evens = 0;
    for (int i=0; i<n; i++){
        int x;
        cin >> x;
        if (x%4 == 0){
            multiples += 2;
        }else if (x%2 == 0){
            evens++;
        }
    }
    evens -= evens%2;
    multiples += evens;
    if ((n-multiples <= 1) && multiples > 0){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
import sys

input = sys.stdin.readline
P = 10 ** 9 + 7


def main():
    N = int(input())
    C = [None] * N
    for i in range(N):
        C[i] = int(input())

    MAX_C = 2 * 10 ** 5
    C = [-1] + C
    D = [-1] * (MAX_C + 1)
    dp = [0] * (N + 1)
    dp[0] = 1
    for i in range(N):
        if C[i + 1] == C[i]:
            dp[i + 1] = dp[i]
        else:
            j = D[C[i + 1]]
            if j != -1:
                dp[i + 1] = dp[i] + dp[j]
            else:
                dp[i + 1] = dp[i]
        dp[i + 1] %= P
        D[C[i + 1]] = i + 1

    ans = dp[N]
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 30184
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i<N; i++)
#define RVROOP(i, N) for(int i=N; i>=0; i--)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  int A,B; cin>>A>>B;
  int ans;
  for(int i=1; i<=3; i++){
    if(i!=A && i!=B){
      ans=i;
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a[3];

    int i;
    cin >> a;

        if(a[0] == '7' || a[1]=='7'|| a[2]=='7')
        {
        cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
        return 0;


}


Measured memory_bytes: 3624
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(readline().rstrip().decode())
b = list(readline().rstrip().decode())
c = list(readline().rstrip().decode())
cnt = 0
for aa, bb, cc in zip(a, b, c):
    if aa == bb == cc:
        continue
    elif aa == bb or bb == cc or aa == cc:
        cnt += 1
    else:
        cnt += 2
print(cnt)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

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

	vector<int> panel;
	int a, b, c;
	cin >> a >> b >> c;
	panel.push_back(a);
	panel.push_back(b);
	panel.push_back(c);
	sort(panel.begin(), panel.end());

	int money = panel.at(2) * 10 + panel.at(1) + panel.at(0);
	cout << money << "\n";

	return 0;
}

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

const int N = 3;
string str;

char solve() {
  for(int j = 0; j < 2; ++j) {
    for(int k = 0; k <= N; ++k) {
      char c = '#';
      for(int l = 0; l < N; ++l) {
	int p;
	if(k == N) p = (N+(j*2-1))*l + (1-j)*(N-1);
	else p = (j*k+(1-j)*l)+((1-j)*k+(j*l))*N;
	if(str[p] == 's') break;
	if(c == '#') c = str[p];
	else if(str[p] != c) break;
	if(l+1 == N) return c;
      }
    }
  }
  return 'd';
}

int main() {
  while(cin >> str) cout << solve() << endl;
  return 0;
}

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

int main() {
    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);

    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;

    cout << (m1 != m2) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
//const long long MOD = ;
const long long INF_LL = 1e18+3; const int INF_int = 1e9+3;
#define ll long long
#define rep(i,n) for(int i = 0;i<n;i++)
#define lrep(i,n) for(long long i = 0;i<n;i++)
#define All(a) a.begin(),a.end()
#define Debug_Output_ALL(a) for(auto itr = a.begin();itr!=a.end();itr++) cout << *itr << " ";cout << endl;
int main(){
    int a,b,c,d,k;
    cin >> a >> b >> c >> d >> k;
    int ans = (c-a)*60;
    ans+=(d-b);
    ans-=k;
    cout << ans << endl;
}

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

int main()
{
  string s;
  cin >> s;
  string hitachi = "";
  for (int i = 1; i <= 5; i++)
  {
    hitachi += "hi";
    if (hitachi ==s)
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}
    

Measured memory_bytes: 256
/**
 *    Author:  "Robin Singh" !!!!    
**/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define ifr(a, value) insert(a.begin(), value)
#define pf push_front
#define eb emplace_back
#define ef emplace_front
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define szz(v) ((int)(v).size())  
#define vi vector<int>
#define vll vector<ll>
#define str string
#define fr(i, j, k) for(i = j; i < k; i++)
#define bk(i, j, k) for(i = j; i >= k; i--)
#define frit(a, it) for(__typeof((a).begin()) it = a.begin(); it != a.end(); ++it)
#define mem(ptr)  memset(ptr, 0, sizeof ptr)        // use fill() for value other than 0 //
#define rtn return 
#define clk fprintf(stderr, "\nTIME = %lf\n", 1.0 * clock()/CLOCKS_PER_SEC)
#define nl "\n"
#define inf 1LL<<61
#define dbg(x) (cerr << #x << ": " << x << "\n")
const long long mod = 1e9+7;

ll gcd(ll a,ll b) { return b==0 ? a : gcd(b, a%b); }   // no need to swap a, b, it auto. happens after first call //
ll expo(ll x, ll y){ ll res = 1; x = x % mod;  while (y > 0) { if (y & 1)res = (res*x) % mod; y = y>>1;x = (x*x) % mod;}return res;}
void matmul(ll a[][2], ll b[][2]) { ll tmp[2][2]; for(int i=0; i<2; i++) { for(int j=0; j<2; j++) { tmp[i][j] = 0; for(int k=0; k<2; k++) tmp[i][j] = (tmp[i][j] + a[i][k]*b[k][j]) % mod; }} for(int i=0; i<2; i++) for(int j=0; j<2; j++) a[i][j] = tmp[i][j]; }
ll fibo(int n)    // returns nth fibonacci number, also S(n) = f(n+2)-1
{ if(n == 0) return 0; else if(n == 1) return 1; ll T[2][2] = { {0, 1} , {1, 1} }; ll res[2][2] = { {1, 0}, {0,1} }; n--; while(n) { if(n & 1) matmul(res, T); n >>= 1; matmul(T, T); } return res[1][1]; }

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, x;
    cin >> n;
    vector <int> last (20, -1);               // last set bit at jth position
    int omit = 0;                             // start at -1 as 0 based indexing is done
    ll ans = 0;
    
    for(int i=0; i<n; i++)
    {
        cin >> x;
        for(int j = 0; j < 20; j++)            // max 2 power 20
        {
            if(x & (1<<j))                    // check jth bit
            {
                omit = max(omit, last[j]+1);
                last[j] = i;
            }
        }
        ans += i - omit + 1;                // succesive consecutive subset 1 + 2 + 3...
    }
    cout << ans;
    return 0;
}

// editorial :
// no two position has same bit set.
// as in xor, 1 ^ 1 -> 0,  i.e. there should be no carry.
// rest same as +.
// 0+0 = 0 ^ 0, 0^1 = 1 = 0+1
// prev logic : 1 ^ 2 ^ 5 ^ 1 = 2 ^ 5 ... 

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

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(t, c) for (auto&& t : c)
#define ALL(c) begin(c), end(c)
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define fk first
#define sv second

const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1}, dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string n;
  cin >> n;
  if (n[0] == n[2]) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
  int col, row, i, j, *data, total;

  total = 0;

  scanf("%d %d", &row, &col);

  data = (int *)malloc(sizeof(int) * col * (row + 1));
  memset(data, 0x0, sizeof(int) * col * (row + 1));

  for (i = 0; i < row; i++)
    for (j = 0; j < col; j++)
      scanf("%d", data + i * col + j);


  for (i = 0; i < row; i++) {
    int k = 0;
    for (j = 0; j < col; j++) {
      printf("%d ", data[i * col + j]);
      k += data[i * col + j];
      data[row * col + j] += data[i * col + j];
    }

    printf("%d\n", k);
  }

  for (j = 0; j < col; j++) {
    printf("%d ", data[row * col + j]);
    total += data[row * col + j];
  }
  printf("%d\n", total);


  free(data);

  return 0;
}

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

int main(void){
    int ans = 0;
    string s;
    cin >> s;
    int i = 0, j = s.size() - 1;
    while(i <= j){
        if(s[i] != s[j]){
            ans++;
        }
        i++; j--;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 1; i <= (n); i ++)
#define re0(i, n) for (int i = 0; i < (int) n; i ++)
#define travel(i, u) for (int i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

template<typename tp> inline void read(tp &x) {
  x = 0; char c = getchar(); int f = 0;
  for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
  for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if (f) x = -x;
}
#define pb push_back
typedef long long lo;

const int N = 233;
int q;
lo F[N];
vector < pair <lo, lo> > vec[N];
inline void init(void) {
  int up = -1;
  F[0] = F[1] = 1;
  for (int i = 2; i <= 100; i ++) {
    F[i] = F[i - 1] + F[i - 2];
    if (F[i] > 1e18) {
      up = i;
      break;
    }
  }
  vec[1].pb({1, 2}); vec[1].pb({1, 3});
  rep (i, up) {
    for (auto o : vec[i]) {
      lo x = o.first;
      lo y = o.second;
      while ((x += y) <= F[i + 3] + F[i - 1])
        vec[i + 1].pb({y, x});
    }
  }
}

inline void doit(lo n, lo m) {
  const int mo = 1e9 + 7;
  auto Div = [] (lo n, lo m) {
    return n / m;
  };
  if (n > m) swap(n, m);
  int p = 0;
  while (F[p] <= n && F[p + 1] <= m) ++ p; -- p;
  if (p == 0) {
    cout << "1 1\n";
    return ;
  }
  if (p == 1) {
    cout << p << " ";
    if (n == 2 && m == 2) {
      cout << "4\n";
      return ;
    }
    lo ans = (min(n, m) + max(n, m) - 1) % mo;
    cout << ans << "\n";
    return ;
  }
  lo ans = 0;
  for (auto o : vec[p - 1]) {
    lo x = o.first;
    lo y = o.second;
    if (y <= n && x <= m)
      ans += Div(n - x, y);
    if (x <= m && y <= n)
      ans += Div(m - x, y);
    ans %= mo;
  }
  cout << p << " " << ans << "\n";
}

int main(void) {
  init();
  read(q);
  rep (i, q) {
    lo x, y; read(x); read(y);
    doit(x, y);
  }
}


Measured memory_bytes: 4096
#include <stdio.h>
 
int main(void) {
    int cars[10];
    int carsnum=0;
    int sousa;
    while(!feof(stdin)) {
        scanf("%d",&sousa);
        if(feof(stdin))break;
        if(sousa==0) {
            carsnum--;
            printf("%d\n",cars[carsnum]);
        } else {
            cars[carsnum]=sousa;
            carsnum++;
        }
    }
    return 0;

}

Measured memory_bytes: 604
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

double f(double a, double b) {
    if (a < b) {
        return b - a;
    }
    else {
        return a - b;
    }
}

int main() {
    int N;
    double T, A;
    cin >> N >> T >> A;
    vector<double> data(N);
    for (int i = 0; i < N; i++) {
        cin >> data[i];
    }
    int ans = 0;
    double tans = 1000;
    for (int i = 0; i < N; i++) {
        double th = f(T - data[i] * 0.006, A);
        if (th < tans) {
            ans = i + 1;
            tans = th;
        }
    }
    cout << ans << endl;
}


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

using namespace std;

int main()
{
    int arr[3] ;
    for(int i = 0 ; i < 3 ; ++i)
        cin>>arr[i] ;
    sort(arr , arr + 3) ;
    int ans = 0 ;
    for(int i =1 ; i < 3 ; ++i)
        ans += arr[i] - arr[i-1] ;
    cout<<ans;
    return 0 ;
}


Measured memory_bytes: 256
n = int(input())
a = [int(_) for _ in input().split()]

b = [0]*n
c = [0]*n

b[0] = a[0]
c[0] = a[0]

for i in range(1,n):
    b[i] = a[i] + b[i-1]
    c[i] = a[i] ^ c[i-1]

b.insert(0,0)
c.insert(0,0)

res = 0
right = 1

for left in range(1,n+1):
    while right < n+1 and b[right]-b[left-1] == c[right] ^ c[left-1]:
        right += 1
    res += right - left
    if left == right:
        right += 1
        
print(res)


Measured memory_bytes: 30744
#include <bits/stdc++.h>
#include <math.h>
#define ll long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(0);
#define rep(i, init, n) for (int i = init; i < n; i++)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define gcd __gcd
# define M_PI 3.14159265358979323846
using namespace std;
const ll mod = 1e9 + 7;
const int N = 1e5 + 4;
const ll MOD = 998244353;
bool visited[N];
vector<int> edge[N];
vector<int> conc[N];
int c = 0;

ll POW(ll base, ll exponent){
    ll result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base) % mod;
        exponent = exponent >> 1;
        base = (base * base) % mod;
    }
    return result;
}

ll Inv(ll x){
    return POW(x, MOD - 2);
}

void DFS(int src){
    visited[src] = 1;
    conc[c].pb(src);
    for(auto i : edge[src]){
        if(!visited[i]) DFS(i);
    }
}

void BFS(int s, vector<int> &d){
    d[s] = 0;
    queue<int> q;
    q.push(s);
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (auto to : edge[v]) {
            if (d[to] == N){
                d[to] = d[v] + 1;
                q.push(to);
            }
        }
    }
}

int main(){
    IOS
    int k;
    string s;
    cin>>k>>s;
    int si = s.size();
    if(si <= k) cout<<s;
    else cout<<s.substr(0, k)<<"...";
    return 0;
}

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

int main()
{
    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if(m1!=m2){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const array<pair<int,int>,4> fd{make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 
//ll

int main(){
  int n;cin>>n;
  int a = n/1000, b, c, d;
  n %= 1000;b = n/100;n %= 100;c = n/10;d = n %= 10;
  rep(i,(1<<3)){
    int value =  a;
    value += b * ((i&1)?1:-1);
    value += c * ((i&(1<<1))?1:-1);
    value += d * ((i&(1<<2))?1:-1);
    if(value == 7){
      cout << a << ((i&1)?'+':'-') << b << ((i&(1<<1))?'+':'-') << c << ((i&(1<<2))?'+':'-') << d << "=7" << endl;
      break;
    }
  }
}


Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

n,m,c=map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int,input().split())) for i in range(n)]

ans = 0
for i in range(n):
    score = c
    for j in range(m):
        score += a[i][j]*b[j]
    if (score > 0):
        ans += 1
print(ans)






Measured memory_bytes: 9140
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <string>
#include <cmath>
#include <set>
#include <cmath>
using namespace std;




bool isprime(long long n)
{
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			return false;
		}
	}

	return true;
}

void solve()
{
	long long x;
	cin >> x;


	while (!isprime(x))
	{
		x++;
	}

	cout << x;
}




int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("file.in", "r", stdin);//freopen("file.out", "w", stdout);

	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;

#define Endl endl

/*--------------------template--------------------*/

int main() {
    cin >> s;
    REP(i, s.size()) {
        if (s[i] == '+') {
            ans++;
        } else {
            ans--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip	;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n;
	cin>>n;
	vi in(n);
	rep(i,n)cin>>in[i];
	int out=inf;
	loop(i,-100,101){
		int sum=0;
		rep(j,n)sum+=(in[j]-i)*(in[j]-i);
		out=min(out,sum);
	}
	cout<<out<<endl;
}








Measured memory_bytes: 256
n = gets.strip.to_i
a = gets.strip.split.map(&:to_i)

vmin = Array.new(n+2,0)
vmax = Array.new(n+2,0)
n.downto(0) do |i|
    vmin[i] = a[i]+(vmin[i+1]+1)/2
    vmax[i] = a[i]+vmax[i+1]
end
if vmin[0] > 1
    p -1
    exit
end
vmax[0] = 1
1.upto(n) do |i|
    vmax[i] = [vmax[i], (vmax[i-1]-a[i-1])*2].min
end
ans = 0
(n+1).times {|i| ans+= vmax[i]}
p ans


Measured memory_bytes: 23036
import itertools
import bisect

def D():
    n = input()
    l = map(int,input().split(" "))
    temp = itertools.combinations(l,3)
    count = 0
    #print(temp)
    #res = [i for i in temp if i[0] < i[1]+i[2] and i[1] < i[0]+i[2] and i[2] < i[0]+i[1]]
    for i in temp:
        i = sorted(list(i),reverse=True)
        if i[0] < i[1]+i[2]:
            count += 1
    print(count)

def D_sort():
    N = int(input())
    L = sorted([int(_) for _ in input().split()])
    #L[a] + L[b] > L[c]
    ans = 0
    for a in range(N - 2):
        for b in range(a + 1, N - 1):
            ans += bisect.bisect(L, L[a] + L[b] - 1) - b - 1
            #右挿入二分探索で得たインデックス-2つ目に長い辺のインデックス=その2辺で作れる三角形の個数
            #(この間に入っている辺を使う分には三角形成立条件が必ず満たされている)
    print(ans)
if __name__ == '__main__':
    D_sort()

Measured memory_bytes: 42332
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int x=sc.nextInt();
    int a=sc.nextInt();
    if (a>x) {
      System.out.println(0);
    }else{
      System.out.println(10);
    }
  }
}


Measured memory_bytes: 23764
using static System.Math;
using System;

public class Hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);
            var c = int.Parse(line[2]);
            var d = int.Parse(line[3]);
            var e = int.Parse(line[4]);
            if (a == 0 && b == 0 && c == 0 && d == 0 && e == 0) break;
            line = Console.ReadLine().Trim().Split(' ');
            var na = int.Parse(line[0]);
            var nb = int.Parse(line[1]);
            var nc = int.Parse(line[2]);
            var ans = getAns(a, b, c, d, e, na, nb, nc);
            Console.WriteLine(ans);
        }
    }
    static int getAns (int a, int b, int c, int d , int e , int na, int nb, int nc)
    {
        var ncset = 0;
        if (nc >= d) { ncset = nc * e; nc = 0; }
        var pr1 = getPr1(a, b, c, d, e, na, nb, nc);
        var pr2 = getPr2(a, b, c, d, e, na, nb, nc);
        var pr3 = na * a + nb * b + nc * c;
        return Min(pr1, Min(pr2, pr3)) + ncset;
    }
    static int getPr1(int a, int b, int c, int d, int e, int na, int nb, int nc)
    {
        if (na + nb + nc < d) return int.MaxValue;
        var need = d - nc;
        if (nb >= need) return d * e + (nb - need) * b + na * a;
        else
        {
            var need2 = d - nc - nb;
            return d * e + (na - need2) * a;
        }
    }
    static int getPr2(int a, int b, int c, int d, int e, int na, int nb, int nc)
    {
        if (na + nb + nc < d) return d * e;
        var need = d - 1 - nc;
        if (nb >= need) return d * e + (nb - need) * b + na * a;
        else
        {
            var need2 = d  -1 - nc - nb;
            return d * e + (na - need2) * a;
        }
    }
}



Measured memory_bytes: 17952
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n1 = scanner.nextInt();
			int n2 = scanner.nextInt();
			int n3 = scanner.nextInt();
			if ((n1 | n2 | n3) == 0)
				break;
			int n = scanner.nextInt();
			int[] ans = new int[n1 + n2 + n3];
			Arrays.fill(ans, 2);
			List<int[]> list = new ArrayList<int[]>();
			for (int i = 0; i < n; i++) {
				int a = scanner.nextInt() - 1;
				int b = scanner.nextInt() - 1;
				int c = scanner.nextInt() - 1;
				int d = scanner.nextInt();
				if (d == 1)
					ans[a] = ans[b] = ans[c] = 1;
				else
					list.add(new int[] { a, b, c });
			}
			for (int[] abc : list) {
				int count = 0;
				for (int a : abc)
					count += ans[a] == 1 ? 1 : 0;
				if (count != 2)
					continue;
				for (int a : abc)
					if (ans[a] == 2)
						ans[a] = 0;
			}
			for (int a : ans)
				System.out.println(a);
		}
	}

}

Measured memory_bytes: 28188
class Solver
  attr_reader :nodes

  def initialize(n)
    @nodes = (0..n-1).map { |i| Node.new(i) }
  end

  def exec
    puts_result
  end

  def add_node(input)
    input[2..-1].each do |child|
      nodes[child].parent = input[0]
      nodes[input[0]].children << child
    end
  end

  def depth(node)
    return 0 if node.parent == -1

    node2 = nodes[node.parent]
    cnt = 1
    while node2.parent != -1
      node2 = nodes[node2.parent]
      cnt += 1
    end

    cnt
  end

  def puts_result
    nodes.each do |node|
      puts "node #{node.id}: parent = #{node.parent}, depth = #{depth(node)}, #{node.type}, [#{node.children.join(', ')}]"
    end
  end
end

class Node
  attr_accessor :id, :parent, :children

  def initialize(id)
    @id = id
    @children = []
    @parent = -1
  end

  def type
    return 'root' if parent == -1
    return 'leaf' if children == []
    'internal node'
  end
end

n = gets.to_i
solver = Solver.new(n)
n.times do |i|
  input = gets.split(' ').map(&:to_i)
  solver.add_node(input)
end

solver.exec


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

int main(){
  int N; cin>>N;
  vector<int> T(N+2);
  T[0]=0;
  T[N+1]=0;
  int alc=0;
  for(int i=0;i<N;i++){
    cin>>T[i+1];
    alc+=abs(T[i]-T[i+1]);
  }
  alc+=abs(T[N]);
  int a,b;
  for(int i=1;i<N+1;i++){
    a=T[i]-T[i-1];
    b=T[i]-T[i+1];
    if(a>0&&b>0){
      cout<<alc-2*min(a,b)<<endl;
    }else if(a<0&&b<0){
      cout<<alc+2*max(a,b)<<endl;
    }
    else{
      cout<<alc<<endl;
    }
  }
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    string s,t; cin >> s >> t;
    ll ans = 0;
    rep(i,s.size()) {
        if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3848
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		
		int [][]es = new int [m][2];
		
		for(int i = 0  ;i < m ;i++) {
			int a = Integer.parseInt(sc.next())-1;
			int b = Integer.parseInt(sc.next())-1;
			
			es[i][0] = a;
			es[i][1] = b;
		}
		
		long now = (long)n*(n-1)/2;
		long []ans = new long [m];
		Unionfind uf = new Unionfind(n);
		
		for(int i = m-1 ;i >= 0; i--) {
			ans[i] = now;					
			
			int a = uf.root(es[i][0]);		
			int b = uf.root(es[i][1]);
			
			if(a != b) {									//親が同じかどうか
				now -= (long)uf.size(a)*uf.size(b);			//異なるならそれぞれの集合の大きさの積を引く
			}
			uf.union(es[i][0], es[i][1]);					//同じ集合に統一する
		}
		
		for(int i = 0 ;i < m;i++) {
			System.out.println(ans[i]);
		}
		
		


	}

}

class Unionfind {

	private int[] data;
	
	public Unionfind(int size) {
		this.data = new int [size];
		clear();
	}
	
	public void clear() {
		Arrays.fill(data, -1);
	}
	
	public void union(int x , int y ) {
		if((x = root(x)) != (y = root(y))) {
			if(data[y] < data[x]) {
				final int t = x;
				x = y;
				y = t;
			}
			data[x] += data[y];
			data[y] = x;
		}
	}
	
	public int root(int x) {
		if(data[x] < 0) {
			return x;
		}
		else {
			return data[x] = root(data[x]);
		}
	}
	
	public boolean same(int x, int y) {
		return root(x) == root(y);
	}
	
	public int size(int x) {
		return data[root(x)];
	}
	

}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

int main(){
    ll S, W;
    cin >> S >> W;
    if(W >= S)
        cout << "unsafe" << endl;
    else
        cout << "safe" << endl;
    return 0;
}


Measured memory_bytes: 3624
from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math


def get_int():
    return int(stdin.readline().strip())


def get_tuple():
    return map(int, stdin.readline().split())


def get_list():
    return list(map(int, stdin.readline().split()))


def solve():
    return

def main():
    n = get_int()
    ls = get_list()
    q = int(input())
    total = sum(ls)
    freq_dic = Counter(ls)
    for i in range(q):
        a,b = get_tuple()
        x = freq_dic[a]
        freq_dic[a] -= x
        freq_dic[b] += x
        total -= a*x
        total += b*x
        print(total)

TestCases = False

if TestCases:
    for i in range(get_int()):
        main()
else:
    main()


Measured memory_bytes: 24128
N,K=map(int,input().split())
p=str(input())

def ans171(N:int, K:int, p:str):
    p_list=sorted(map(int,p.split()))
    price=0
    for i in range(0,K):
        price=price+p_list[i]
    return(price)

print(ans171(N,K,p))

Measured memory_bytes: 8892
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

N=int(input())
H=nl()
c=0
max_val=0
inds=0
while(inds<N-1):
    while(inds+c<=(N-2)):
        if(H[inds+c] < H[inds+c+1]):
      	    break
        c=c+1
    if(max_val<c):
        max_val=c
    inds+=c+1
    c=0

print(max_val)

Measured memory_bytes: 14172
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT{
    __INIT(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout<<fixed<<setprecision(15);
    }
}__init;
/*
int main(void){
    ll n,m,q;
    cin>>n>>m>>q;
    vvl quer(q,vl(4));
    rep(i,q){
        cin>>quer[i][0]>>quer[i][1]>>quer[i][2]>>quer[i][3];
    }
    rep(i,(1<<n)){
        vl pitsu(n,-);
        rep(j,n){
            if(i&(1<<j) == 1){
                ll now = pitsu[quer[j][1]-1]-pitsu[quer[j][0]-1];
                if(now == pitsu[quer[j][2]]) continue;
                else if(now < pitsu[quer[j][2]])
            }
        }
    }
}
*/

int main(void){
    ll a,b,n;
    cin>>a>>b>>n;
    if(b == 1){
        cout<<0<<endl;
    }
    else{
        if(n >= b){
            cout<<(a*(b-1))/b-a*((b-1)/b)<<endl;
        }
        else{
            cout<<(a*n)/b-a*(n/b)<<endl;
        }
    }
}

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

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

  ll m = 1000;
  rep(i,n){
    if(i+1 > n-1) continue;
    if(a[i+1]>a[i]){
      ll s = m/a[i];
      m -= s*a[i];
      m += s*a[i+1];
    }
  }
  cout << m << endl;
}


Measured memory_bytes: 3600
main = do
    [a_, b_] <- return . map read . words =<< getLine
    let
	point 1 = 13
	point 2 = 1
	point 3 = 2
	point 4 = 3
	point 5 = 4
	point 6 = 5
	point 7 = 6
	point 8 = 7
	point 9 = 8
	point 10 = 9
	point 11 = 10
	point 12 = 11
	point 13 = 12
    putStr $ if point a_ > point b_
	then "Alice"
	else if point a_ == point b_
	    then "Draw"
	    else "Bob"


Measured memory_bytes: 508