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

using namespace std;

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

template<typename T>
using pq_gt = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using pq_lt = priority_queue<T, vector<T>, less<T>>;

#define se second
#define fi first
#define pb push_back

int main() {
    ios::sync_with_stdio(false);
    ll N;
    cin>>N;
    ll div = N/4;
    for(ll i = max(1LL,div); i <=3500; ++i) {
    	for(ll j = max(1LL,div); j<=3500; ++j) {
    		ll top = N*j*i;
    		ll btm = 4*i*j-i*N-j*N;
    		if(btm<=0) {
    			continue;
    		}
    		if(top%btm==0) {
    			cout<<i<<" "<<j<<" "<<top/btm<<endl;
    			return 0;
    		}
    	}
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int N;
  	cin >> N;
  	vector<int> L(N);
  	for(int i = 0; i < N; i++){
    	cin >> L[i];
    }
	sort(L.begin(),L.end());
  	int sum;
  	for(int i = 0; i < N-1; i++){
      sum += L[i];
    }
  	bool ans = L[N-1] < sum;
  	if(ans == 1)
    	cout << "Yes" << endl;
  	else
      	cout << "No" << endl;
	
}

Measured memory_bytes: 256
N = int(input())
S = [input()[0] for i in range(N)]
M = S.count("M")
A = S.count("A")
R = S.count("R")
C = S.count("C")
H = S.count("H")
print(M * (A * (R + C + H) + R * (C + H) + C * H) + A * (R * (C + H) + C * H) + R * C * H)


Measured memory_bytes: 3864
from heapq import*
(N,M),*t=[map(int,s.split())for s in open(0)]
z,*q=[0]*50*M
v=[[]for _ in q]
for a,b in t:v[a-1]+=b,
for i in v[:M]:
 for j in i:heappush(q,-j)
 z-=heappop(q)
print(z)

Measured memory_bytes: 375300
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second


void solve(){
    int n;cin>>n;
    int a[n];REP(i,n)cin>>a[i];
    ll ans=0;
    REP(i,n){
        ans+=a[i]/2;
        a[i]%=2;
        if(a[i]==1&&(i+1)<n&&a[i+1]>0){a[i]--;a[i+1]--;ans++;}
    }
    cout<<ans<<endl;
}
int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}


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

int main() {
int N;
  cin >> N;
   int sum;
  for (int i = 0; i < N; i++) {
    int L, R;
    cin >> L >> R;
    sum += R - L + 1;
  }
  cout << sum << endl;
}
    

Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;

typedef long long ll;

const ll INF = 1e18;
const int BIG = 1e9;
const int maxN = 200 * 1000 + 9;
const string FILENAME = "sample";

int n;
int x[maxN], y[maxN];
vector<int> vvX[maxN], vvY[maxN];

void read(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> x[i] >> y[i];
		vvX[x[i]].push_back(i);
		vvY[y[i]].push_back(i);
	}
}

bool visited[maxN];
set<int> distinX, distinY;
vector<int> g[maxN];

void dfs(int u){
	visited[u] = true;
	distinX.insert(x[u]);
	distinY.insert(y[u]);

	for(int i = 0, L = g[u].size(); i < L; i++){
		int v = g[u][i];
		if(visited[v]){
			continue;
		}

		dfs(v);
	}
}

void solv(){
	for(int i = 1; i < maxN; i++){
		for(int j = 0, L = vvX[i].size(); j + 1 < L; j++){
			int u = vvX[i][j], v = vvX[i][j + 1];
			g[u].push_back(v);
			g[v].push_back(u);
		}
	
		for(int j = 0, L = vvY[i].size(); j + 1 < L; j++){
			int u = vvY[i][j], v = vvY[i][j + 1];
			g[u].push_back(v);
			g[v].push_back(u);
		}
	}
	
	ll ans = -n;
	for(int i = 0; i < n; i++){
		if(!visited[i]){
			distinX.clear();
			distinY.clear();
			dfs(i);
			ans += (ll)(distinX.size()) * (ll)(distinY.size());
			//cerr << " * " << (ll)(distinX.size()) * (ll)(distinY.size()) << '\n';
		}
	}

	cout << ans << '\n';
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
#ifdef h4h4
	freopen((FILENAME + ".inp").c_str(), "r", stdin);
	freopen((FILENAME + ".out").c_str(), "w", stdout);
#endif

	read();
	solv();

	return 0;
}

Measured memory_bytes: 29312
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from itertools import permutations

    N = int(readline())
    P = tuple(map(int, readline().split()))
    Q = tuple(map(int, readline().split()))

    d = {x: i for i, x in enumerate(permutations(range(1, N + 1)))}

    print(abs(d[Q] - d[P]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 82216
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

print(input().replace('?','D'))

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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000001
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<int, int>

int main() {
  int n;
  cin >> n;
  if(n == 10 || n == 100 || n == 1000 || n == 10000 || n == 100000) cout << 10 << endl;
  else{
    int ans = 0;
    while(n != 0){
      ans += n%10;
      n /= 10;
    }
    cout << ans << endl;
  }
  return 0;
}


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

int main() {
  int A, B, C, r;
  cin >> A >> B >> C;

  if ((A <= B && B <= C) || (B <= A && A <= C))
    r = A + B;
  if ((C <= B && B <= A) || (B <= C && C <= A))
    r = B + C;
  if ((A <= C && C <= B) || (C <= A && A <= B))
    r = A + C;

  cout << r << endl;
}

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

int main() {
  int x,y;
  cin >> x >> y;
  int g1[]{1,3,5,7,8,10,12},g2[]{4,6,9,11},g3[]{2};
  int X=0,Y=0;
  for(int i=0; i<7; i++){
    if(g1[i]==x){
      X=1;
    }
    else if(g1[i]==y){
      Y=1;
    }
  }
  for(int i=0; i<4; i++){
    if(g2[i]==x){
      X=2;
    }
    else if(g2[i]==y){
      Y=2;
    } 
  }
    if(x==2){
      X=3;
    }
    else if(y==2){
      Y=3;
    }
    if(X==Y){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }



Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(ll i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 100000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };

int seen[200001] = { false };
int a[200001] = { 0 };
int ans[200001] = { 0 };
void dfs(int v, int sum,whei(int)&G) {
	seen[v] = true;
	ans[v] = sum;
	for (auto x : G[v]) {
		if (seen[x])continue;
		dfs(x, sum + a[x], G);
	}
}

int main() {
	ll n, q;
	cin >> n >> q;
	whei(int) G(n);
	rep(i, 0, n-1) {
		int a, b;
		cin >> a >> b;
		a--;
		--b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	rep(i, 0, q) {
		int x,p;
		cin >> x >> p;
		x--;
		a[x] += p;
	}
	dfs(0, a[0], G);
	rep(i, 0, n)cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 24832
N, K = map(int, input().split())
A = list(map(int, input().split()))
bits = [0]*41
for i in range(N):
    for j in range(41):
        if A[i] & (1 << j):
            bits[40-j] += 1


bin_K = '0' * (43 - len(bin(K))) + bin(K)[2:]
x = 0
flag = 0  # 0ならX > Kが保証されていない、1なら保証されている
threshold = N // 2 + 1
for i in range(41):
    if flag == 1:
        if bits[i] < threshold:
            x += 1 << (40-i)
    elif flag == 0:
        if bits[i] < threshold and bin_K[i] == '1':
            x += 1 << (40-i)
        elif bits[i] >= threshold and bin_K[i] == '1':
            flag = 1


ans = 0
for i in range(N):
    ans += x ^ A[i]

print(ans)


Measured memory_bytes: 69136
#include<bits/stdc++.h>
using namespace std;
struct edge
{
	int v;
	edge *next;
}*h[233333],pool[233333];
int top;
inline void addedge(int u,int v)
{
	edge *tmp=&pool[top++];tmp->v=v;tmp->next=h[u];h[u]=tmp;
	edge *pmt=&pool[top++];pmt->v=u;pmt->next=h[v];h[v]=pmt;
}
int n,k,ans;
int a[233333],dep[233333],ok[233333];
void dfs1(int u)
{
	for(edge *tmp=h[u];tmp;tmp=tmp->next)
	{
		if(!dep[tmp->v])
		{
			dep[tmp->v]=dep[u]+1;
			dfs1(tmp->v);
		}
	}
}
void dfs2(int u)
{
	if(ok[u])return;
	ok[u]=1;
	for(edge *tmp=h[u];tmp;tmp=tmp->next)
	{
		if(dep[tmp->v]>dep[u])dfs2(tmp->v);
	}
}
pair<int,int> orz[233333];
int main()
{
	ios_base::sync_with_stdio(false);
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(i>1)addedge(a[i],i);
	}
	ans=(a[1]!=1);dep[1]=1;
	dfs1(1);
	for(int i=1;i<=n;i++)orz[i]=make_pair(dep[i],i);
	sort(orz+1,orz+n+1,greater<pair<int,int> >());
	for(int i=1;i<=n;i++)
	{
		int u=orz[i].second;
		if(!ok[u]&&dep[u]>k+1)
		{
			int qwq=u;
			for(int j=1;j<k;j++)qwq=a[qwq];
			ans++;
//			cerr<<"gao "<<qwq<<endl;
			dfs2(qwq);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 11264
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;
    cin>>n;
    string s;cin>>s;
    if(n%2!=0)
    {
        cout<<"No";return 0;
    }
    for(i=0;i<n/2;i++)
    {
        if(s[i]!=s[i+n/2])
        {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

signed main(){
	string s;cin>>s;
	if(len(s)!=26){
		set<char>st;for(auto i:s)st.insert(i);
		for(char i='a';i<='z';i++){
			if(st.find(i)==st.end()){
				cout<<s<<i<<endl;return 0;
			}
		}
	}
	set<char>st;st.insert(s.back());
	for(int i=24;i>=0;i--){
		if(s[i]<s[i+1]){
			cout<<s.substr(0,i)<<*st.lower_bound(s[i])<<endl;
			return 0;
		}
		st.insert(s[i]);
	}
	cout<<-1<<endl;
}


Measured memory_bytes: 3592
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];
    sort(a.rbegin(), a.rend());

    int ans = 0;
    for(int i=0; i<n; i+=2)
        ans += a[i];
    for(int i=1; i<n; i+=2)
        ans -= a[i];
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
using namespace std;
#include <bits/stdc++.h>
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb(X) push_back(X)
#define x first
#define y second
#define all(x) (x).begin(), (x).end()
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
typedef long long ll;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef pair<int, int> pii;
//ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


const int INF = 1e9 + 7;
int _;

int main() {
	INIT
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
	return 0;
}
/*
rep (i, 0, n) {
		if (i) cout << ' ';
		cout << A[i];
	}
*/

Measured memory_bytes: 256
/* h-ex7_3
   Ohshima */

#include <stdio.h>
#include <stdlib.h>

int main(void){
  int height, width, i, j, k, cnt = 0;
  char **array;
  scanf("%d %d", &height, &width);
  //各行の配列へのポインタ分のメモリ領域を確保
  array = (char**)malloc(sizeof(char*) * height);
  if(array == NULL) exit(1);
  //各行の要素分のメモリ領域を確保
  for(i = 0; i < height; i++){
    array[i] = (char*)malloc(sizeof(char) * (width + 1));
    if(array[i] == NULL) exit(1);
  }
  //
  for(i = 0; i < height; i++){
    //for(j = 0; j < width; j++){
      scanf("%s", &array[i][0]);
    //}
  }
  //行について
  for(i = 0; i < height; i++){
    for(j = 0; j < width; j++){
      if(array[i][j] == '#'){
        break;
      }
      if(j == width - 1){
        for(k = 0; k < width; k++){
          array[i][k] = ' ';
        }
      }
    }
  }
  //列について
  for(j = 0; j < width; j++){
    for(i = 0; i < height; i++){
      if(array[i][j] == '#'){
        break;
      }
      if(i == height - 1){
        for(k = 0; k < height; k++){
          array[k][j] = ' ';
        }
      }
    }
  }
  //
  for(i = 0; i < height; i++){
    cnt = 0;
    for(j = 0; j < width; j++){
      if(array[i][j] != ' '){
        putchar(array[i][j]);
        cnt++;
      }
    }
    if(cnt == 0){
      continue;
    }
    printf("\n");
  }
  //
  for(i = 0; i < height; i++){
    free(array[i]);
  }
  free(array);
  return 0;
}


Measured memory_bytes: 1624
using System;
using System.Linq;

namespace _0021
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            for (int i = 0; i < n; i++)
            {
                decimal[] x = Console.ReadLine().Split().Select(decimal.Parse).ToArray();
                decimal ABx = x[2] - x[0];
                decimal ABy = x[3] - x[1];
                decimal CDx = x[6] - x[4];
                decimal CDy = x[7] - x[5];
                if (ABx * CDy == CDx * ABy)
                {
                    Console.WriteLine("YES");
                }
                else
                {
                    Console.WriteLine("NO");
                }
            }
        }
    }
}

Measured memory_bytes: 9708
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string o,e;
	cin >> o >> e;
	for(int i = 0; i < o.size(); i++) {
		cout << o[i];
		if (i < e.size()){
			cout << e[i];
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
  char S[1000010];
  int s;
  int i;
  int a=0;
  scanf("%s",S);
  s=strlen(S);
  for(i=0;i<s;i++){
    if(S[i]==S[i+1]){
      if(S[i+1]=='1'){
        S[i+1]='0';
      }
      else{
        S[i+1]='1';
      }
      a=a+1;
    }
  }
  printf("%d",a);
  return 0;
}

Measured memory_bytes: 1820
inputs = input().split(' ')

class Stack:
    def __init__(self, N):
        self.stack_size = N
        self.stack = []
    def push(self, x):
        if x in ['+', '-', '*']:
            term2 = '{}({})'.format(x, self.pop())
            calc_str = '({}){}'.format(self.pop(), term2)
            self.stack.append(str(eval(calc_str)))
        else:
            self.stack.append(x)
    def pop(self):
        return self.stack.pop(-1)
    def isEmpty(self):
        return len(self.stack) == 0
    def isFull(self):
        return len(self.stack) == self.stack_size

stack = Stack(200)
for A in inputs:
    stack.push(A)
print(stack.pop())



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

int main() {

	int A, B, H, M;
	cin >> A >> B >> H >> M;
	const double PI = 3.14159265358979323846;

	const double sec = 60 * H + M;
	const double ang_sec = 2.0 * PI*(double(M) / 60.0);
	const double ang_min = 2.0*PI*(sec / 720);

	double x1 = A * cos(ang_min);
	double x2 = B * cos(ang_sec);
	double y1 = A * sin(ang_min);
	double y2 = B * sin(ang_sec);
	
	cout << fixed << setprecision(15) << sqrt(pow(x1-x2,2)+pow(y1-y2,2));

	return 0;
}

Measured memory_bytes: 4128
import sys
from string import digits
from itertools import product
from bisect import bisect_left as bi_l

n, k, *dislikes = sys.stdin.read().split()

def main():
    likes = sorted(set(digits) - set(dislikes))
    cand = product(likes, repeat=len(n))
    *cand, = map(lambda x: int(''.join(x)), cand)
    cand.sort()
    res = bi_l(cand, int(n))
    if res < len(likes) ** len(n):
        return cand[res]
    
    if likes[0] == '0':
        ans = likes[1] + '0' * len(n)
    else:
        ans = likes[0] * (len(n)+1)
    return int(ans)

if __name__ == '__main__':
    ans = main()
    print(ans)

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

int main(void){
	string s;
	cin>>s;
	bool c=false;
	rep(i,s.size()){
		c|=s[i]=='C';
		if(c && s[i]=='F'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
static const int dx[4] = { 0, 1, 0, -1 };
static const int dy[4] = { 1, 0, -1, 0 };
static const char dir[4] = { 'u', 'r', 'd', 'l' };
static const ll INF = 1 << 21;
static const ll MOD = 1e9 + 7;

double sum = 0;
int x[10], y[10];

double dist(int i, int j)
{
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx * dx + dy * dy, 0.5);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    vector<int> v(N);
    double sum = 0.0;
    rep(i, N)
    {
        cin >> x[i] >> y[i];
        v[i] = i;
    }
    cout.precision(10);

    do {
        rep(i, N - 1)
        {
            sum += dist(v[i], v[i + 1]);
        }
    } while (next_permutation(v.begin(), v.end()));
    int fact = 1;
    for (int i = 2; i <= N; i++) {
        fact *= i;
    }
    cout << sum / fact << endl;
    return 0;
}

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

int main(){
  int a, b, k;
  
  cin >> a >> b;
  
  if((a+b) % 2 != 0){
    cout << "IMPOSSIBLE" << endl;
  }
  else{
  
    k = (a+b) / 2;
  
    cout << k << endl;
  }
  return 0;
}

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

// # DEFINES # //
#define ll long long
#define M (ll)1e9+7
#define EPS 1e-9

using namespace std;

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

int gcdArray(vector<int> arr) {
    int result = arr[0];
    size_t n = arr.size();

    for(int i = 1; i < n; i++) {
        result = gcd(result, arr[i]);
        if(result == 1)
            return 1;
        
    }
    return result;
}

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

    int n;

    cin >> n;

    bool flag = false;
    while(n) {
        int var = n % 10;
        if(var == 7)
            flag = true;
        n /= 10;
    }
    if(flag)
        cout << "Yes" << endl;
    else 
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
template<typename T>
void print(T x) {
    cout << x << endl;
}
int main(void) {
    int a, b, c;
    cin >> a >> b >> c;
    cout << min(b/a, c);
}


Measured memory_bytes: 256
package main

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

func main() {

	nextReader = newScanner()

	n, m := nextInt(), nextInt()

	scores := make(map[int]int, n)

	count, pena := 0, 0

	for i := 0; i < m; i++ {

		num := nextInt()
		res := nextString()

		if scores[num] == -1 {
			continue
		}

		if res == "AC" {
			count++
			pena += scores[num]
			scores[num] = -1
			continue
		}

		if res == "WA" {
			scores[num]++
		}

	}

	fmt.Println(count, pena)
}

/* --------------------------------------------------------------------------
 *  std.io
 * ------------------------------------------------------------------------- */
var nextReader func() string

func newScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}


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

int main() {
  int N;
  cin >> N;
  
  long long count = 0;
  set<string> v;
  map<string, int> map;
  for (int i = 0; i < N; i++) {
    string str;
    cin >> str;
    
    sort(str.begin(), str.end());
    v.insert(str);
    map[str]++;
  }
  
  for (auto x : v) {
    long long y = map[x];
    count += (y * (y - 1)) / 2;
  }

  cout << count << endl;
  return 0;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define show(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define show(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<62;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

template<class T> class segtree{
public:
    int n,size_;
    vector<T> dat;
    function<T(T,T)> fun_;
    T id_;
    segtree()=default;
    segtree(int size,function<T(T,T)> fun,T id,T initial_value){ init(size,fun,id,initial_value); }
    void init(int size,function<T(T,T)> fun,T id,T initial_value){
        size_=size;
        fun_=fun;
        id_=id;
        n=1;
        while(n<size) n*=2;
        dat.assign(2*n-1,0);
        for(int i=0; i<size; ++i) update(i,initial_value);
    }
    int size()const{ return size_; }
    void update(int k, T a) {
        k+=n-1; // leaf
        dat[k]=a;
        while(k>0) {
            k=(k-1)/2;
            dat[k]=fun_(dat[k*2+1],dat[k*2+2]);
        }
    }
    T at(int index){ return dat[index+n-1]; }
    void add(int k,T a){ update(k,at(k)+a); }
    T query(int a,int b) { return query(a,b,0,0,n); }
    T query(int a,int b,int k,int l,int r) {
        if(r<=a or b<=l) return id_;
        if(a<=l and r<=b) return dat[k];
        int m=(l+r)/2;
        return fun_(query(a,b,k*2+1,l,m),query(a,b,k*2+2,m,r));
    }
};

void solve(){
    int n,q;
    cin >> n >> q;
    segtree<int> seg(n,[](int x,int y){ return x+y; },0,0);
    rep(i,0,q){
        int com,x,y;
        cin >> com >> x >> y;
        if(com==0) seg.add(x-1,y);
        else cout << seg.query(x-1,y) << endl;
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}

Measured memory_bytes: 3912
import java.util.*;

public class Main{
  
  	    
	
	    public static long knapsack(int target,int wt[],int val[]){
	
	 long dp[][]=new long[wt.length+1][target+1];
	 
	 
	 for(int i=1;i<=wt.length;i++) {
		 for(int j=1;j<=target;j++) {
			 
			 if(j-wt[i-1]>=0) {
				 
				 dp[i][j]=Math.max(val[i-1]+dp[i-1][j-wt[i-1]],dp[i-1][j]);
				 
				 
			 }
			 
			 else {
				 dp[i][j]=dp[i-1][j];
			 }
			 
			 
		 }
	 }
	 
	 
	 
	 
	 
	 
	 
	
	    	return dp[wt.length][target];
	    }
	    
	    
	    
		  
		    
	    
	    
	    
	    
	    
	    
	   
public static void main(String[]args) {
	Scanner s=new Scanner(System.in);
	
	int n=s.nextInt();
	int w=s.nextInt();
	int weight[]=new int[n];
	int val[]=new int[n];
	for(int i=0;i<n;i++) {
	
		
		weight[i]=s.nextInt();
	val[i]=s.nextInt();		
		}
	
	
	
	

System.out.println(knapsack(w,weight,val));
}
	   

}


Measured memory_bytes: 140276
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto s = readln.split;
    auto N = s[0].to!int;
    auto K = s[1].to!long;
    auto A = N.iota.map!(_ => readln.chomp.to!long - K).array;

    
    auto B = new long[](N+1);
    B[0] = 0;
    foreach (i; 0..N) B[i+1] = B[i] + A[i];
    auto C = B.dup.sort().uniq;

    
    int[long] comp;
    foreach (i, c; C.enumerate) comp[c] = i.to!int;

    
    auto st = new SegmentTree(N+1);
    long ans = 0;

    foreach (i; 0..N+1) {
        ans += st.sum(0, comp[B[i]]);
        st.add(comp[B[i]], 1);
    }


    ans.writeln;
}


class SegmentTree {
    int[] table;
    int size;

    this(int n) {
        assert(bsr(n) < 29);
        size = 1 << (bsr(n) + 2);
        table = new int[](size);
    }

    void add(int pos, int num) {
        return add(pos, num, 0, 0, size/2-1);
    }

    void add(int pos, int num, int i, int left, int right) {
        table[i] += num;
        if (left == right)
            return;
        auto mid = (left + right) / 2;
        if (pos <= mid)
            add(pos, num, i*2+1, left, mid);
        else
            add(pos, num, i*2+2, mid+1, right);
    }

    int sum(int pl, int pr) {
        return sum(pl, pr, 0, 0, size/2-1);
    }

    int sum(int pl, int pr, int i, int left, int right) {
        if (pl > right || pr < left)
            return 0;
        else if (pl <= left && right <= pr)
            return table[i];
        else
            return
                sum(pl, pr, i*2+1, left, (left+right)/2) +
                sum(pl, pr, i*2+2, (left+right)/2+1, right);
    }
}


Measured memory_bytes: 25596
#include<stdio.h>
#include<stdlib.h>
#define MAX 500001
#define NIL NULL
struct N{
  int key;
  struct N *parent;
  struct N *left;
  struct N *right;
};
typedef struct N * node;

void insert(int);
void ino(node);
void pr(node);

node r;

int main(){
  int i,n,x;
  char c[20];
  scanf("%d", &n);
  
  for(i = 0; i < n; i++){
    scanf("%s", c);
  
    if(c[0] == 'i'){
      scanf("%d", &x);
      insert(x);
    }
    else if(c[0] == 'f'){
      scanf ("%d" , &x);
    }
    else if(c[0] == 'p'){
      ino(r);
      printf("\n");
      pr(r);
       printf("\n");
    }
  }
  return 0;
}

void insert(int n){
  node x = NIL;
  node y = r;
  node z;
  z = malloc(sizeof(struct N));
  z->key = n;
  z->left = NIL;
  z->right = NIL;
  while(y!=NIL){
    x = y;
    if(z->key < y->key) y = y->left;
    else y = y->right;
  }
  z->parent = x;
  if(x == NIL)r = z;
  else if( z->key < x->key) x->left = z;
  else x->right = z;
}

void ino(node a){
  if(a!=NIL){
    ino(a->left);
    printf(" %d", a->key);
    ino(a->right);
}
}

void pr(node a){
  if(a!=NIL){
    printf(" %d" , a->key);
    pr(a->left);
    pr(a->right);
  }
}

Measured memory_bytes: 24040
N = int(input())
Xs = []
Ys = []
for i in range(N):
    x, y = map(int, input().split())
    Xs.append((x, i))
    Ys.append((y, i))
Xs.sort()
Ys.sort()
Edges = []
for i in range(1, N):
    (x1, v1), (x2, v2) = Xs[i-1], Xs[i]
    Edges.append((abs(x1-x2), v1, v2))
    (y1, v1), (y2, v2) = Ys[i-1], Ys[i]
    Edges.append((abs(y1-y2), v1, v2))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

import heapq
heapq.heapify(Edges)
uf = UnionFind(N)
ans = 0
while Edges:
    d, a, b = heapq.heappop(Edges)
    if not uf.same(a, b):
        ans += d
        uf.union(a, b)
print(ans)

Measured memory_bytes: 52164
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cassert>
#include<ctime>
using namespace std;

#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define absd(x) (x<0?-(x):x)
#define pow2(x) ((x)*(x))
#define rep(i,n) for(int i=0; i<n; ++i)
#define repr(i,n) for(int i=n-1; i>=0; --i)
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define replr(i,s,n) for(int i=n; i>=s; --i)
#define repf(i,s,n,j) for(int i=s; i<=n; i+=j)
#define repe(e,obj) for(auto e : obj)

#define SP << " " <<
#define COL << " : " <<
#define COM << ", " <<
#define ARR << " -> " <<
#define PNT(STR) cout << STR << endl
#define POS(X,Y) "(" << X << ", " << Y << ")"
#define DEB(A) " (" << #A << ") " << A
#define DEBREP(i,n,val) for(int i=0; i<n; ++i) cout << val << " "; cout << endl
#define ALL(V) (V).begin(), (V).end()
#define INF 1000000007
#define INFLL 1000000000000000007LL
#define EPS 1e-9

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define P_TYPE int
typedef pair<P_TYPE, P_TYPE> P;
typedef pair<P, P_TYPE> PI;
typedef pair<P_TYPE, P> IP;
typedef pair<P, P> PP;
typedef priority_queue<P, vector<P>, greater<P> > pvqueue;

#define N 100003

ll n, m;
ll s;

int main() {
  cin >> n >> m;
  map<ll, ll> card;
  s = 0;
  rep(i, n) {
    ll a;
    cin >> a;
    ++card[a];
    s += a;
  }
  rep(i, m) {
    ll b, c;
    cin >> b >> c;
    auto it = card.begin();
    ll rest = b;
    ll cnt = 0;
    while(rest > 0) {
      if(c < (*it).first) {
        break;
      }
      ll r = min(rest, (*it).second);
      (*it).second -= r;
      rest -= r;
      s -= (*it).first * r;
      cnt += r;
      ++it;
    }
    while(!card.empty() && (*card.begin()).second == 0) {
      card.erase(card.begin());
    }
    if(cnt > 0) {
      card[c] += cnt;
      s += c * cnt;
    }
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 8576
import math
import numpy as np

a, b, h, m = map(int, input().split())

x = ((h * 60 + m) * 360 /(720))
y = (m * 6)
num = abs(x - y)

print(math.sqrt(a * a + b * b - 2 * a * b * np.cos(np.radians(min(num, 360 - num)))))


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

int n, m;
vector<int> x, y;
long long ans;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n >> m;
	x.resize(m);
	for(int i=0; i<m; ++i) cin >> x[i];
	sort(x.begin(), x.end());
	for(int i=1; i<m; ++i)
		y.push_back(x[i] - x[i-1]);
	sort(y.begin(), y.end());
	for(int i=0; i<min(m-n, m); ++i)
		ans += y[i];
	cout << ans << "\n";
}

Measured memory_bytes: 1276
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <bitset>
#include <complex>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;

int main(){
    ll N,X,M;
    cin >> N>>X>>M;
    
    if(X==0){
        cout<<0<<endl;
        return 0;
    }
    
    if(N<=M){
        ll ans = 0;
        ll x=X;
        for(int i=0; i<N; i++){
            ans += x;
            x = (x*x)%M;
        }
        cout<<ans<<endl;
        return 0;
    }
    
    ll exist[100000]={};    // 何番めで出たか
    for(int i=0; i<100000; i++){
        exist[i]=-1;
    }
    ll temp[100001]={}; // i版めばでのわ
    ll x=X;
    
    exist[x]=0;
    temp[0]=x;
    
    for(int i=1; i<=M; i++){
        x = (x*x)%M;
        
        if(x==0){
            cout<<temp[i-1]<<endl;
            return 0;
        }
        
        if(exist[x]!=-1){
            // かぶったとき
            ll ans = 0;
            if(exist[x]==0){
                // 周期i
                ans += temp[i-1]*(N/i);
                if(N%i != 0){
                    ans += temp[N%i-1];
                }
            }else{
                temp[i]=temp[i-1]+x;
                
                
                ans += temp[exist[x]-1];
                ll num = i - exist[x];
                ll t = temp[i-1] - temp[exist[x]-1];
 
                N -= exist[x];
                ans += t*(N/num);
                if(N%num>0){
                    ans +=  temp[exist[x]+(N%num)-1] - temp[exist[x]-1];
                }
            }
            
            cout<<ans<<endl;
            return 0;
        }
        
        
        exist[x]=i;
        temp[i]=temp[i-1]+x;

    }
    
    cout<<temp[M-1]<<endl;
    return 0;
}


Measured memory_bytes: 5200
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
int main() {
	int n, T;
	scanf("%d%d", &n, &T);
	vector<int> a0;
	vector<pair<int, int>> P;
	for (int i = 0; i < n; ++i) {
		int a, b;
		scanf("%d%d", &a, &b);
		if (!a) {
			a0.push_back(b + 1);
		} else {
			P.push_back({a + 1, a + b + 1});
		}
	}
	sort(P.begin(), P.end(), [&](pair<int, int> x, pair<int, int> y) {
		return (y.first - 1LL) * x.second < (x.first - 1LL) * y.second;
	});
	const ll INF = T + 1;
	vector<ll> dp(32, INF);
	dp[0] = 0;
	for (auto& p : P) {
		auto ndp = dp;
		for (int i = 0; i < 31; ++i) {
			ndp[i + 1] = min(ndp[i + 1], dp[i] * p.first + p.second);
		}
		swap(dp, ndp);
	}
	sort(a0.begin(), a0.end());
	vector<ll> sum(a0.size() + 1);
	for (int i = 0; i < a0.size(); ++i) {
		sum[i + 1] = sum[i] + a0[i];
	}
	int ans = 0;
	for (int i = 0; i <= 31; ++i) {
		if (dp[i] > T) continue;
		int t = upper_bound(sum.begin(), sum.end(), T - dp[i]) - sum.begin() - 1;
		ans = max(ans, i + t);
	}  
	printf("%d\n", ans);
}


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

bool is753(string s)
{
    int n = s.length();
    bool b[3] = {false,false,false};
    for (int i = 0; i < n; ++i) {
        b[(int)(s[i] - 48) / 2 - 1] = true;
    }
    return b[0] && b[1] && b[2];
}

int counter(string prefix,int n,int nlen)
{
    if (nlen <= prefix.length()) return 0;
    int count = 0;
    count += counter(prefix + "3", n, nlen);
    count += counter(prefix + "5", n, nlen);
    count += counter(prefix + "7", n, nlen);
    string prefix3 = prefix + "3";
    string prefix5 = prefix + "5";
    string prefix7 = prefix + "7";
    if (atoi(prefix3.c_str()) <= n && is753(prefix3)) count++;
    if (atoi(prefix5.c_str()) <= n && is753(prefix5)) count++;
    if (atoi(prefix7.c_str()) <= n && is753(prefix7)) count++;
    return count;
}
int main ()
{
    string s;
    cin >> s;
    int s_size = s.length();
    int s_int = atoi(s.c_str());
    int count = 0 + counter("3", s_int, s_size) + counter("5", s_int, s_size) + counter("7", s_int, s_size);
    cout << count;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <queue>
#include <iomanip>
#include <algorithm>
using namespace std;

int n;

int main()
{
	int tim = 0, curx = 0, cury = 0;
	scanf("%d", &n);
	while (n--) {
		int t, x, y; scanf("%d %d %d", &t, &x, &y);
		int nd = abs(curx - x) + abs(cury - y);
		if (tim + nd > t || nd % 2 != (t - tim) % 2) {
			printf("No\n"); return 0;
		}
		tim = t; curx = x; cury = y;
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpll vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
#define modA(cccc,bbbb ,p) (((cccc+bbbb)%p+p)%p)
#define modS(cccc,bbbb ,p) (((cccc-bbbb)%p+p)%p)
#define modM(cccc,bbbb ,p) ((((cccc%p)*(bbbb%p))%p+p)%p)

long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

// lld fac[2000005]; 

// void getfac(lld p)
// {
//     fac[0] = 1; 
//     for (lld i=1 ; i<=2000005; i++) 
//         fac[i] = fac[i-1]*i%p; 
// }    

// long long int nCrmodp(lld n, lld r,lld p) 
// { 
//    // Base case 
//    if (r==0) 
//       return 1; 
     
//     return (fac[n]* modInverse(fac[r], p) % p * 
//             modInverse(fac[n-r], p) % p) % p; 
// }



// lld maxSumSub(vector<lld>& v , lld l)
// {
//     lld x = 0;
//     lld y =0 ;
//     for(i=0;i<l;i++)
//     {
//         y += v[i];
//         if(x<y)
//         {
//             x=y;

//         }
//         if(y<0)
//             y=0;
//     }
//     return x;
// }


lld p1=1e9 + 7,p2=998244353;
lld l,r,mid,ans;
lld n,i,j,k,g,m;
lld x,y,n1,n2,h,z,c;
lld aa=1;

// bool sorter(lld a, lld b)
// {
//     vector<lld> v2;
//     vector<lld> w;
//     // cout<<"A == " <<a<<"  B== "<<b;
//     while(a>=1)
//     {
//         v2.pb(a%10);
//         a/=10;
//     }
//     while(b>=1)
//     {
//         w.pb(b%10);
//         b/=10;
//     }   
       
//     reverse(all(v2));
//     reverse(all(w));
//     lld l1 = v2.size();
//     lld l2 = w.size();
//     lld  l = (l1*l2)/__gcd(l1,l2);
//     // cout<<l1<< " "<<l2<< " "<<l<< " ";
//     for(int i=0;i<l;i++)
//     {
//         if(v2[i%l1]!=w[i%l2])
//         {
//             // cout<< "   "<< (v2[i%l1] > w[i%l2])<<"\n";
//             return v2[i%l1] > w[i%l2];
//         }
//     }
//     // printf("false\n");
//     return false;
// }


void solve()
{
    string s,t;
    cin>>s>>t;;
    ans= 0;
    n= s.size();
    for(i=0;i<n;i++)
    {
        if(s[i]!=t[i]) ans+=1;
    }
    cout<<ans;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
   // cin>>t;
    //cout<<t;
    // getfac(p1);
    //check the value by which modulo is to be taken
    lld ans=0;
    for(int i=0;i<t;i++)
    {
   //     cout<<"Case #"<<i+1<<": ";
                  solve();
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3820
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_DAY_SEC		86400									// １日の秒
#define D_3H_SEC		10800									// ３時間の秒

// 内部変数
static FILE *szpFpI;											// 入力
static int si1Cnt[D_DAY_SEC * 2];								// 起床回数[秒]

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 起床回数 - 取得
	int liCnt;
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &liCnt);

	// 秒 - 取得
	int liTime = 0;
	for (i = 0; i < liCnt; i++) {
		int liTime1, liTime2;
		fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
		sscanf(lc1Buf, "%d%d", &liTime1, &liTime2);

		// 起床秒
		liTime = (liTime + liTime1) % D_DAY_SEC;

		// 起床回数 - 加算
		si1Cnt[liTime]++;

		// 時間経過
		liTime += liTime2;
	}

	// 起床回数 - 拡張
	memcpy(&si1Cnt[D_DAY_SEC], si1Cnt, sizeof(int) * D_DAY_SEC);

	// 起床回数 - 累積和
	for (i = 1; i < D_DAY_SEC * 2; i++) {
		si1Cnt[i] += si1Cnt[i - 1];
	}

	// 最大値 - 取得
	int liMax = si1Cnt[D_3H_SEC];
	for (i = 1; i < D_DAY_SEC; i++) {
		liCnt = si1Cnt[i + D_3H_SEC] - si1Cnt[i - 1];
		if (liMax < liCnt) {
			liMax = liCnt;
		}
	}

	return liMax;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// データ - 初期化
	memset(si1Cnt, 0, sizeof(si1Cnt));							// 起床回数

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 出力
	if (liRet == 0) {
		sprintf(lc1Buf, "Yes\n");
	}
	else {
		sprintf(lc1Buf, "No\n");
	}
	sprintf(lc1Buf, "%d\n", liRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 896
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <deque>
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000

const ll MOD=998244353;

main(){
    int n=in();
    vec p;
    rep(i,n)p.pb(in());
    vector<ll> a(n+1),b(n+1);
    ll now=1;
    rep2(i,1,n-1){
        a[p[i]]+=i;
        b[p[i]]+=i;
    }
    rep2(i,2,n)a[i]+=a[i-1];
    rep3(i,n-1,1)b[i]+=b[i+1];
    vector<ll> A,B;
    rep2(i,1,n)A.pb(i+a[i]);
    rep3(i,n,1)B.pb(i+b[n-i+1]);
    ll minA=LLINF,minB=LLINF;
    rep(i,n)minA=min(minA,A[i]);
    rep(i,n)minB=min(minB,B[i]);
    minA--;minB--;
    rep(i,n)cout<<A[i]-minA<<" ";
    cout<<endl;
    rep(i,n)cout<<B[i]-minB<<" ";
}

Measured memory_bytes: 1404
#include<cstdio>
    #include<cstdlib>
    #include<cstring>
    #include<cmath>
    #include<ctime>
    #include<cctype>
    #include<climits>
    #include<iostream>
    #include<string>
    #include<vector>
    #include<map>
    #include<list>
    #include<queue>
    #include<deque>
    #include<algorithm>
    #include<numeric>
    #include<utility>
    #include<complex>
    #include<memory>
    #include<functional>
     
    using namespace std;
     
    #define ALL(g) (g).begin(),(g).end()
    #define REP(i, x, n) for(int i = x; i < n; i++)
    #define rep(i,n) REP(i,0,n)
    #define F(i,j,k) fill(i[0],i[0]+j*j,k)
    #define P(p) cout<<(p)<<endl;
    #define EXIST(s,e) ((s).find(e)!=(s).end())
    #define INF 1<<25
    #define pb push_back
     
    typedef vector<int> vi;
    typedef vector<long long> vl;
    typedef vector<double> vd;
    typedef pair<int,int> pii;
    typedef pair<long,long> pll;
    typedef long long ll;
    ll t[101];
     
    ll gcd(ll x, ll y)
    {
        ll r;
        if(x == 0 || y == 0)  // 引数チェック
        {
            return 0;
        }
        while((r = x % y) != 0) // yで割り切れるまでループ
        {
            x = y;
            y = r;
        }
        return y;
    }
    ll lcm(ll x, ll y)
    {
        if(x == 0 || y == 0)  // 引数チェック
        {
    		        return 0;
    		    }
     
        return (x/gcd(x, y)*y);
    }
    int main(){
    	int n;
    	ll ans=1;
    	cin>>n;
    	rep(i,n){
    		cin>>t[i];
    		
    		ans=lcm(t[i],ans);
    	}
     
    	cout<<ans<<endl;
    	return 0;
    }

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        Long N = scanner.nextLong();

        long sum = 0;
        for(long i=1; i <= N; i++){
            if(1%15!=0 && i%3 != 0 && i%5 != 0){
                sum += i;
            }
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 35800
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long  ull;
int main()
{
	ull x,y; ~scanf("%llu%llu",&x,&y);
	ull cnt = 0;
	while(x<=y) {
		x *= 2;
		cnt += 1;
	}
	printf("%llu\n",cnt);
	return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc055/tasks/abc055_a

#include <iostream>
using namespace std;

int main()
{
  /* Magic word */
  cin.tie(0);
  ios::sync_with_stdio(false);
  /* ---------- */

  int n, r;

  cin >> n;

  r = n * 800 - (int)(n / 15) * 200;

  cout << r << "\n";

  return 0;
}


Measured memory_bytes: 256