akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

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

var n, m int
var g [][]bool
var visited []bool

func dfs(v int) {
	visited[v] = true

	for v2 := 0; v2 < n; v2++ {
		if !g[v][v2] {
			continue
		}
		if visited[v2] {
			continue
		}
		dfs(v2)
	}
}

func main() {
	sc.Split(bufio.ScanWords)

	n, m = nextInt(), nextInt()
	g = make([][]bool, n)
	visited = make([]bool, n)
	for i := 0; i < n; i++ {
		g[i] = make([]bool, n)
	}
	a, b := make([]int, m), make([]int, m)
	for i := 0; i < m; i++ {
		at, bt := nextInt()-1, nextInt()-1
		a[i] = at
		b[i] = bt
		g[at][bt] = true
		g[bt][at] = true
	}

	c := 0
	for i := 0; i < m; i++ {
		g[a[i]][b[i]] = false
		g[b[i]][a[i]] = false

		for j := 0; j < n; j++ {
			visited[j] = false
		}
		dfs(0)

		for _, v := range visited {
			if !v {
				c++
				break
			}
		}
		g[a[i]][b[i]] = true
		g[b[i]][a[i]] = true
	}

	fmt.Println(c)
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int X = (A + D - 1) / D;
    int Y = (C + B - 1) / B;
    cout << (X >= Y ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 3620
import java.io.IOException;
import java.io.PrintStream;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	static PrintStream o = System.out;

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		HashSet<String> get = new HashSet<String>(n);
		int res = 0;
		sc.nextLine();
		String one;
		for (int i = 0; i < n; i++) {
			one = sc.nextLine();
			if (!get.contains(one)) {
				get.add(one);
				res++;
			}
		}
		o.println(res);
	}
}

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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<llll> vllll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair
#define clamp(v,lo,hi) min(max(v,lo),hi)


template<typename T1, typename T2> inline void amin(T1 & a, T2 const & b) { if (a>b) a=b; }
template<typename T1, typename T2> inline void amax(T1 & a, T2 const & b) { if (a<b) a=b; }
template<typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template<typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }


string s;
int L;

map<ii,int> mm;


int solve(int lasl, int ix) {
    ii k(lasl, ix);
    if (found(mm,k)) return mm[k];

    if (ix == L) return 0;
    int best = INT_MIN;

    if (ix+1 <= L) {
        if (lasl==1) {
            if (s[ix-1] == s[ix]) goto skip1;
        }
        amax(best, 1 + solve(1, ix+1));
    }
    skip1:;

    if (ix+2 <= L) {
        if (lasl==2) {
            if (s[ix-2]==s[ix] && s[ix-1]==s[ix+1]) goto skip2;
        }
        amax(best, 1 + solve(2, ix+2));
    }
    skip2:;

    mm[k] = best;
    return best;
}

int main() {
    cin >> s; L=s.size();
    cout << solve(0, 0) << endl;
    return 0;
}


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

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb(x) push_back(x)
#define SORT(ls) sort(ls.begin(), ls.end())
#define DESC(ls) sort(ls.rbegin(), ls.rend()) 
#define mp(x, y) make_pair(x, y)
#define INF 1000000000
#define MOD 1000000007
#define F(i, a, n) for(i=a;i<n;i++)
#define B(i, a, n) for(i=n-1;i>=0;i--)
#define SI(x) cin>>x
#define DI(x, y) cin>>x>>y
#define TI(x, y, z) cin>>x>>y>>z
#define FI(w, x, y, z) cin>>w>>x>>y>>z
#define SO(x) cout<<x<<endl
#define DO(x, y) cout<<x<<" "<<y<<endl
#define TO(x, y, z) cout<<x<<" "<<y<<" "<<z<<endl
#define FO(w, x, y, z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<endl
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)



int main(void)
{
    int i;
    int n, m;
    DI(n, m);
    int x = -INF;
    int y = INF;
    while(m--)
    {
        int left, right;
        DI(left, right);
        x = max(left, x);
        y = min(right, y);
    }
    if(y - x + 1 < 0)
        SO(0);
    else
        SO(y - x + 1);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a+b>c+d) cout<<"Left"<<endl;
  else if(a+b<c+d) cout<<"Right"<<endl;
  else cout<<"Balanced"<<endl;

  return 0;
}



Measured memory_bytes: 256
n = int(input())

total = []

for i in range(1, n + 1):
    if i % 15 == 0:
        "FizzBuzz"
    elif i % 5 == 0:
        "Buzz"
    elif i % 3 == 0:
        "Fizz"
    else:
        total.append(i)

print(sum(total))

Measured memory_bytes: 29920
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include <set>
#define ll long long
using namespace std;
int main()
{
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    if(k<a)
    {
        cout<<k<<endl;
    }
    else if(k<a+b)
    {
        cout<<a<<endl;
    }
    else if(k<a+b+c)
    {
        cout<<a-(k-a-b)<<endl;
    }
    else
    {
        cout<<a-c<<endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

long double a, b, x; 


int main(){
    cin >> a >> b >> x;

    long double tan = (2*(a*a*b - x)) / (a*a*a);
    long double thita = 0.0;

    if(a*a*b/2.0 <= x){
        thita = PI/2 - atan(1.0/tan);
    }else{
        thita = PI/2 - atan(2*x / (a*b*b));
    }
    thita = thita*360/(2*PI);
    cout << fixed << setprecision(10) <<  thita << endl;
    return 0;
}

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

using namespace std;

#define loop(i,n) for(ll i = 0; i < n; i++)
#define loopr(i,x,y) for(ll i = x; i < y; i++)
#define push_back pb ;
#define mp make_pair;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<string> VS;
typedef vector<P> VP;
typedef vector<V> VV;
typedef map<ll,ll> MP;
typedef set<ll> SET;
typedef multiset<ll> MSET;

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll n;
    
    cin>>n;
    
    char arr[27];
    
    for (int i = 0; i < 26; i++) {
    	arr[i] = i + 'a';
	}
	
	vector<char> ch;
	
	while (n > 0) {
		n--;
		ch.insert(ch.begin(), arr[(n % 26)]);
		
		n /= 26;
	}
	for (auto c : ch) {
		cout<<c;
	}
}

Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int ngo[100005];
int main(){
	int N,M;
	cin >> N >> M;

	for(int i=1;i<=N;i++) ngo[i] = N;
	for(int i=0;i<M;i++) {
		int a,b;
		cin >> a >> b;
		ngo[a]=min(ngo[a],b-a);
	}
	int ans=0;
	int p=N;
	for(int i=1;i<=N;i++){
		if(p==0){
			ans++;
			p=N;
		}
		p=min(p,ngo[i]);
		p--;
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  string S;
  cin >> S;
  LL K;
  cin >> K;
  REP(i, 0, min((LL)S.length(), K)) {
    cerr<<S[i]<<endl;
    if (S[i] != '1') {
      cout << S[i] << endl;
      return 0;
    }
  }
  cout << 1 << endl;

  return 0;
}


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

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

    int ans = 1;
    char tmp = s[0];
    for (int karen = 1; karen < n; karen++){
        if(s[karen] != tmp){
            ans++;
            tmp = s[karen];
            // cout << "Done1" << endl;
            // cout << s[karen] << endl;
        }
        else{
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define inf int(1e9)
#define half_inf int(1e5)
#define ll_inf ll(1e9)*ll(1e9)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const int mod = 1000000007;


map<ll, ll> mp;
ll n, p;

void prime_factor(ll n) {
    for (ll i = 2; i * i <= n; ++i) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }
    if (n != 1) mp[n]++;
}

void solve() {
    prime_factor(p);
    ll ans = 1;
    each(m, mp) {
        if (m.second >= n) {
            ans *= ll(pow(m.first, (m.second / n)));
        }
    }
    cout << ans << endl;
}

int main() {
    cin >> n >> p;
    solve();
    return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn._

object Main {
    def main(args: Array[String]): Unit = { 
        val N: Int = readInt()
        for(i <- 0 until N) {
            val num: Seq[Int] = readLine().split(" ").map(_.toInt).sorted
            val ans: String = if(
                Math.pow(num(2), 2) == Math.pow(num(1), 2) + Math.pow(num(0), 2)
            ) "YES" else "NO"
            println(ans)
        }
    }   
}

Measured memory_bytes: 45356
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
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(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	debug("debug test\n");
   	int n,m;cin>>n>>m;
	vector<string> a(n), b(m);
	rep(i, n){
		cin>>a[i];
	}
	rep(i, m){
		cin>>b[i];
	}
	rep(i, n-m+1){
		rep(j, n-m+1){
			bool flag = true;
			rep(k, m){
				rep(l, m){
					if(b[k][l]!=a[i+k][j+l])flag = false;
				}
			}
			if(flag){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <functional>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<vector<int>> tree(n);
    REP(i, 0, n - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    ll ans = 0;
    vector<ll> c(n);
    REP(i, 0, n) {
        cin >> c[i];
    }
    sort(c.rbegin(), c.rend());
    REP(i, 1, n) {
        ans += c[i];
    }
    int leaf = -1;
    REP(i, 0, n) {
        if (tree[i].size() == 1) {
            leaf = i;
        }
    }

    vector<ll> score(n, -1);
    int ind = 0;
    function<void(int)> dfs = [&](int cur) {
        if (score[cur] != -1) return;
        score[cur] = c[ind++];
        for (auto &e : tree[cur]) {
            dfs(e);
        }
    };
    dfs(leaf);
    cout << ans << endl;
    REP(i, 0, n) {
        cout << score[i] << " \n"[i + 1 == n];
    }

    return 0;
}


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

int main(){
    int K,X;
    cin >> K >> X;
    int i;
    for(i=X-K+1; i<=X+K-1; i++){
        cout << i << " ";
    }
    
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author SimplyDivine
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            boolean check = false;
            int m = in.nextInt();
            int a[] = new int[m];
            int b[] = new int[m];
            boolean vis[] = new boolean[n];
            for (int i = 0; i < m; i++) {
                int x = in.nextInt();
                int y = in.nextInt();
                if (x == 1) {
                    if (vis[y]) {
                        check = true;
                    }
                    vis[y] = true;
                }
                if (y == n) {
                    if (vis[x]) {
                        check = true;
                    }
                    vis[x] = true;
                }
            }
            if (check)
                out.println("POSSIBLE");
            else
                out.println("IMPOSSIBLE");
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream i) {
            br = new BufferedReader(new
                    InputStreamReader(i));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 45332
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public string[] S;
        public void Run()
        {
            N = Input.ReadInt();

            S = new string[N];
            for (int i = 0; i < N; i++)
            {
                string s = Console.ReadLine();
                S[i] = s;
            }

            var dic = new HashSet<string>();
            for (int i = 0; i < N; i++)
            {
                if (i != 0)
                {
                    if (S[i][0] != S[i - 1][S[i - 1].Length - 1])
                    {
                        Console.WriteLine("No");
                        return;
                    }

                }


                if (dic.Contains(S[i]))
                {
                    Console.WriteLine("No");
                    return;
                }

                dic.Add(S[i]);

            }

            Console.WriteLine("Yes");
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 11348
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String b = sc.next();
		sc.close();
		String ans[] = {"A", "G", "T", "C"};
		int a = 0;
		for(int i = 0;i < ans.length; ++i) 
			if(b.equals(ans[i]))a = i;
		a += 2;
		if(a > 3)a %= 2;
		System.out.println(ans[a]);
	}

}


Measured memory_bytes: 20820
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  //vector< int > x1(200000);
  //vector< int > x2(200000);
  vector< int > x1;
  vector< int > x2;
  cin >> n;
  for(int i=0; i<n; i++){
    int tmp;
    cin >> tmp;
    x1.push_back(tmp);
    x2.push_back(tmp);
    //x2[i] = x1[i];
  }
  //sort(x2.begin(), x2.end());
  sort(x2.begin(), x2.end());
  int border1=x2[(n/2)-1], border2=x2[(n/2)];
  for(int i=0; i<n; i++){
    if( x1[i] <= border1 ) printf("%d\n", border2);
    else printf("%d\n", border1);
  }
  
  return 0;
  
}


Measured memory_bytes: 3948
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		 Scanner sc = new Scanner(System.in);
		 String N = sc.next();
		 String S = sc.next();
		 int count =0;
		 for (int i = 0; i < N.length(); i++) {
			 if (N.charAt(i) == S.charAt(i)) { 
			 } else {
				 count++;
			 }
		 }
		 System.out.print(count);
	}
}



Measured memory_bytes: 40980
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using vi=vector<int>;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll x,k,d;
    cin >> x >> k >> d;
    x=abs(x);
    if(x/d>=k){
        cout << x-k*d << "\n";
        return 0;
    }else{
        ll cnt=x/d;
        if((k-cnt)%2==0){
            cout << abs(x-(cnt*d)) << "\n";
            return 0;
        }else{
            cout << abs((x-(cnt*d)-d)) << "\n";
            return 0;
        }
    }
}   

Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

const int maxN = 1e5 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll sq(ll x) {return (x * x) % MOD;}
ll modP(ll a, ll b) {return (!b ? 1 : (sq(modP(a, b / 2)) * (b % 2 ? a : 1)) % MOD);}

ll a[maxN], l[maxN], r[maxN];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	l[0] = 0;
	for (int i = 0; i < n; i++){
		l[i + 1] = gcd(l[i], a[i]);
	}
	r[n] = 0;
	for (int i = n; i > 0; i--){
		r[i - 1] = gcd(r[i], a[i - 1]);
	}
	ll mx = r[1];
	for (int i = 1; i < n; i++){
		mx = max(mx, gcd(l[i], r[i + 1]));
	}
	cout << mx << endl;
	return 0;
}



Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main(){
    int n;
    int a[201000];
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    int t = 0;
    for(int i = 0; i < n; i++){
        if(a[i] == t + 1){
            t++;
        }
    }
    cout << (t != 0 ? n - t : -1) << "\n";
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long 
#define mod 1000000007
using namespace std;
int n;
int dp[100001][2];
vector<int>adj[100001];
int solve(int u ,int par ,int c)
{
     if(dp[u][c]!= -1)
      return dp[u][c];
     int ans  = 0;
     
     bool leaf = true;
      
      int w1 = 1;int w2 =1;
     for(auto child : adj[u])
     {
         if(child!= par)
         {
            leaf = false;

            w1 = (w1*solve(child,u,0))%mod;

            if(!c)
              {
                  w2 = (w2*solve(child,u,1))%mod;
              }
         }
     }

       ans = w1;
       if(!c)
        ans = (ans+w2)%mod;

      return dp[u][c] = ans;

}
signed main(void)
{
    memset(dp , -1 ,sizeof dp);
    cin>>n;
    int a,b;
    for(int  i = 0;i<(n-1);i++)
    {
      cin>>a>>b;
      adj[a].push_back(b);
      adj[b].push_back(a);
    }

    cout<<solve(1,-1,0)<<endl;
}

Measured memory_bytes: 14208
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H == 0 && W == 0) break;
            for(int i=0;i<H;i++){
                for(int j=0;j<W;j++){
                    System.out.printf("#");
                }
                System.out.println();
            }
            System.out.println();
        }
        sc.close();
    }
}


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

#ifdef _DEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A;
    for (int i = 0; i < N; ++i) {
        int ai;
        cin >> ai;
        A.push_back(ai);
    }

    vector<int64_t> ns(N + 1, 0);
    for (int i = 0; i < N; ++i) {
        ns[A[i]]++;
    }
    int64_t res = 0;
    for (int i = 0; i < ns.size(); ++i) {
        res += ns[i] * (ns[i] - 1) / 2;
    }
    for (int i = 0; i < N; ++i) {
        cout << res - (ns[A[i]] - 1) << endl;
    }
}

Measured memory_bytes: 5108
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        Map<String, Integer> weeks = new HashMap<>();

        weeks.put("SUN", 7);
        weeks.put("MON", 6);
        weeks.put("TUE", 5);
        weeks.put("WED", 4);
        weeks.put("THU", 3);
        weeks.put("FRI", 2);
        weeks.put("SAT", 1);

        System.out.println(weeks.get(S));
    }
}


Measured memory_bytes: 22228
#include <cstdio>
#include <algorithm>

int K, T;

int main() {
    scanf("%d%d", &K, &T);
    int mx = 0;
    for (int i = 0; i < T; i++) {
        int ai;
        scanf("%d", &ai);
        //printf("%d %d %d\n", K, ai, mx);
        mx = std::max(mx, ai - 1 - (K - ai));
    }
    printf("%d\n", mx);
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<vector<int>> t(4, vector<int>(13));
  vector<char> a={'S', 'H', 'C', 'D'};
  rep(i, n){
    char c;
    int k;
    cin >> c >> k;
    if(c=='S') t[0][k-1]++;
    if(c=='H') t[1][k-1]++;
    if(c=='C') t[2][k-1]++;
    if(c=='D') t[3][k-1]++;
  }

  rep(i, 4){
    rep(j, 13){
      if(t[i][j]==0) cout << a[i] << " " << j+1 << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3092
import java.util.*;
import java.math.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();

    int ans = 1;

    for (int i = 1; i <= n; i++) {
      ans = Math.min(ans*2,ans+k);
    }

    System.out.println(ans);

  }

}


Measured memory_bytes: 23636
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int INF=pow(10,9);
vec dat,dat1;
//要素数
int n;

void init(int n_){
    n=1;
    while(n<n_)n*=2;

    for(int i=0;i<2*n-1;i++){
        dat[i]=INF;
        dat1[i]=-1;
    }
}

void update(int k,int a){
    k+=n-1;
    dat[k]=a;
    dat1[k]=a;
    while(k>0){
        k=(k-1)/2;
        dat[k]=min(dat[2*k+1],dat[2*k+2]);
        dat1[k]=max(dat1[2*k+1],dat1[2*k+2]);
    }
}

//[a,b)の最小値を求める
//kは節点の番号、[l,r)はその区間
int query(int a,int b,int k,int l,int r){
    if(r<=a || b<=l)return INF;
    if(a<=l && r<=b)return dat[k];
    else{
        int vl=query(a,b,2*k+1,l,(l+r)/2);
        int vr=query(a,b,2*k+2,(l+r)/2,r);
        return min(vl,vr);
    }
}
int query1(int a,int b,int k,int l,int r){
    if(r<=a || b<=l)return -1;
    if(a<=l && r<=b)return dat1[k];
    else{
        int vl=query1(a,b,2*k+1,l,(l+r)/2);
        int vr=query1(a,b,2*k+2,(l+r)/2,r);
        return max(vl,vr);
    }
}

int main(){
    dat.resize(1000000);
    dat1.resize(1000000);    
    int N,K;cin>>N>>K;
    init(N);
    vec P(200010);
    for(int i=0;i<N;i++){
        cin>>P[i];
        update(i,P[i]);
    }
    //per[i]:P[i]から始まる単調増加列の最大の長さ
    vec per(200010);
    vec v;
    //部分順列が存在するかどうか
    bool b=false;
    int i=0,j=0; 
    while(i<N){
        while(P[j]<P[j+1] && j<N-1)j++;
        per[i]=j-i+1;
        if(per[i]<K && i<=N-K)v.push_back(i);
        else if(per[i]>=K)b=true;
        i++;
        if(i>j)j=i;
    }
    int ans=0;
    if(b)ans++;
    if(!v.empty()){
        ans++;
        for(int i=1;i<v.size();i++){
            if(v[i-1]+K-1<v[i])ans++;
            else{
                int m,M;
                m=query(v[i],v[i-1]+K,0,0,n);
                M=query1(v[i],v[i-1]+K,0,0,n);
                if(!(P[v[i]-1]<m && M<P[v[i-1]+K] && per[v[i-1]]>=v[i]-v[i-1] && per[v[i-1]+K]>=v[i]-v[i-1]))
                    ans++;
            }
        }
    }
    
    cout<<ans<<endl;    
    return 0;
}

Measured memory_bytes: 12024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+5;
vector<ll> V,r,g,C;
ll sum[maxn],sumC[maxn];
int main() {
    int x,y,a,b,c;cin>>x>>y>>a>>b>>c;
    for(int i=1;i<=a;i++){
        int tem;cin>>tem;
        r.push_back(tem);
    }
    for(int i=1;i<=b;i++){
        int tem;cin>>tem;
        g.push_back(tem);
    }
    for(int i=1;i<=c;i++){
        int tem;cin>>tem;
        C.push_back(tem);
    }
    sort(C.begin(),C.end(),greater<ll>());
    sort(r.begin(),r.end());
    sort(g.begin(),g.end());
    for(int i=1;i<=x;i++) V.push_back(r[r.size()-i]);
    for(int i=1;i<=y;i++) V.push_back(g[g.size()-i]);
    ll s=0;
    for(auto x:V) s+=x;
    sort(V.begin(),V.end());
    for(int i=1;i<=C.size();i++){
        sumC[i]=sumC[i-1]+C[i-1];
    }
    for(int i=1;i<=V.size();i++){
        sum[i]=sum[i-1]+V[i-1];
    }
    ll ans=s;
    for(int i=1;i<=min(c,x+y);i++){
        ans=max(ans,s+sumC[i]-sum[i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6384
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    N =I()
    if N % 2 == 0:
        print(N // 2)
    else:
        print(N // 2 + 1)




if __name__ == "__main__":
    main()

Measured memory_bytes: 74504
N = int(input())

cnt = [0] * (10 ** 4 + 1)

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            f = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if f <= 10 ** 4:
                cnt[f] += 1

for i in range(1, N + 1):
    print(cnt[i])

Measured memory_bytes: 74512
import sys
input = sys.stdin.readline

n = int(input())
s = input()

x = [0]*n
temp = 0
for i in range(n):
    if s[i] == 'W':
        temp += 1
    x[i] = temp

ans = n - 1 - (x[-1] - x[0])
ans = min(ans, x[-2])

for j in range(1, n-1):
    temp = x[j-1] + n - 1 - j - (x[-1] - x[j])
    ans = min(ans, temp)

print(ans)

Measured memory_bytes: 15304
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

struct UnionFind
{
  vector<int> par;

  UnionFind(int n) : par(n, -1) {}

  int root(int x)
  {
    if (par[x] < 0)
      return x;
    else
      return par[x] = root(par[x]);
  }

  bool isSame(int x, int y)
  {
    return root(x) == root(y);
  }

  bool merge(int x, int y)
  {
    x = root(x);
    y = root(y);
    if (x == y)
      return false;
    if (par[x] > par[y])
      swap(x, y);
    par[x] += par[y];
    par[y] = x;
    return true;
  }

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, M;
  cin >> N >> M;
  vector<int> A(M), B(M);
  for (int i = 0; i < M; i++)
  {
    cin >> A[i] >> B[i];
    A[i]--, B[i]--;
  }
  UnionFind uf(N);
  ll cur = N * (N - 1) / 2;
  vector<ll> res;
  for (int i = 0; i < M; i++)
  {
    res.push_back(cur);

    int a = A[M - i - 1], b = B[M - i - 1];

    if (uf.isSame(a, b))
      continue;

    ll sa = uf.size(a), sb = uf.size(b);
    cur -= sa * sb;
    uf.merge(a, b);
  }
  reverse(res.begin(), res.end());
  for (auto &it : res)
    cout << it << endl;
  return 0;
}

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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define fr(i,k) for(i=0;i<k;i++)
#define deb(x) cerr<<#x<<"  = "<<x<<endl;
#define deb2(x,y) cerr<<#x<<" ="<<x<<endl<<#y<<" ="<<y<<endl;
#define SZ(x) (x).size();
#define ll long long
#define mod 1000000007
#define ff first
#define ss second
#define pb push_back
#define em emplace_back
#define ulli unsigned long long int
#define inf 1e18
#define endl "\n"
typedef vector<vector<ll>> vvll;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
void solve();

int main() {
	fastio;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll t;
	t = 1;

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


inline void solve()
{
	ll n, i, j, ans;
	cin >> n;

	ll h[n], a[n];
	map<ll, ll> m;

	for (i = 0; i < n; i++)
		cin >> h[i];

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

	vll dp(n);
	dp[0] = a[0];
	m[h[0]] = dp[0];
	ans = dp[0];

	for (i = 1; i < n; i++)
	{
		dp[i] = a[i];

		auto it = m.lower_bound(h[i] + 1);
		if (it != m.begin())
		{
			it--;
			dp[i] += it->second;
		}

		m[h[i]] = dp[i];

		it = m.upper_bound(h[i]);

		while (it != m.end() && it->second <= dp[i])
		{
			auto temp = it;
			temp++;
			m.erase(it);
			it = temp;
		}
		ans = max(ans, dp[i]);
	}

	cout << ans << endl;
}


Measured memory_bytes: 20316
n, m = map(int, input().split())
s = []
c = []
a, b = 0, 0
for i in range(m):
    a, b =  map(int, input().split())
    s.append(a)
    c.append(b)

def isException(n, m, s, c):
    # -1処理
    for i in range(m):
        for j in range(m):
            if i != j and s[i] == s[j] and c[i] != c[j]:
                return True
        if n >= 2 and s[i] == 1 and c[i] == 0:
                return True
        else:
            return False

if isException(n, m, s, c):
    print('-1')
else:
    cnt = [-1]*n
    ans = 0
    for i in range(m):
            cnt[s[i]-1] = c[i]
    for i in range(n):
        if cnt[i] == -1:
            if i == 0 and n >= 2:
                cnt[i] = 1
            else:
                cnt[i] = 0
        ans += cnt[i]*10**(n-(i+1))
    print(ans)

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

int main() {
	int a,b,c;
	cin >> a >> b >> c;
	if(a>=b){
		if(a>=c){
			cout << a*10 + b + c << endl;
		}
		else cout << c*10 + a + b << endl;
	}
	
	else if(b>=c){
		cout << b * 10 + a + c << endl;
	}
	else cout << c * 10 + a + b << endl;

	return 0;
}

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

using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define all(v) v.begin(),v.end()
#define v vector
#define vi vector<int>
#define vi2 vector<vi>
#define vl vector<long long>
#define vl2 vector<vl>

template <class T> T maxAny(T a, T b){
    if(a > b) return a;
    else return b;
}

template <class T> T minAny(T a, T b){
    if(a > b) return b;
    else return a;
}

int main(){
    unsigned long long n, ans = 1, sum;
    bool zero=false;
    cin >> n;
    unsigned long long a[n];
    rep(i,n) {
        cin >> a[i];
        if(a[i] == 0) {
            zero=true;
            break;
        }
    }
    if(zero) {
        cout << 0 << endl;
        return 0;
    }
    rep(i,n) {
        for(int j = 0; a[i]/(unsigned long long)pow(10,j)!=0; j++){
            if(ans * (a[i]/(unsigned long long)pow(10,j)) > (unsigned long long)1e18){
                cout << -1 << endl;
                return 0;
            }
        }
        ans *= a[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4592
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int a;
  cin>>a;
  string arr[a];
  for(int i=0;i<a;i++)
    cin>>arr[i];
  map<string ,int> m;
  for(auto i:arr)
    m[i]++;
   if(m.find("AC")!=m.end())
	{
    auto f1=m.find("AC");
    cout<<"AC  x "<<f1->second<<endl;
	}
	else
	 cout<<"AC  x "<<0<<endl;
  	if(m.find("WA")!=m.end())
	{
   auto f1=m.find("WA");
   cout<<"WA  x "<<f1->second<<endl;
	}
	else
	 cout<<"WA  x "<<0<<endl;
   	if(m.find("TLE")!=m.end())
	{
   auto f1=m.find("TLE");
   cout<<"TLE  x "<<f1->second<<endl;
	}
	else
	 cout<<"TLE  x "<<0<<endl;
  	if(m.find("RE")!=m.end())
	{
   auto f1=m.find("RE");
   cout<<"RE  x "<<f1->second<<endl;
	}
	else
	 cout<<"RE  x "<<0<<endl;
}

Measured memory_bytes: 6772
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,am,an;
  int k=0;
  cin>>a>>b;
  am = max(a,b);
  an = min(a,b);
  for(int i=0;i<am;i++){
    k = k*10 + an;
  }
  cout<<k<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <iomanip>
#include <limits>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007
//static const long double pi = 3.1415926535897932;

using namespace std;
using ll = long long int;
using ull = unsigned long long;

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

ll combination(ll n, ll r) {
	if (n < 0 || r < 0 || r > n) return -1;

	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> num(r);
	vector<ll> den(r);

	for (ll i = 0; i < r; i++) {
		num[i] = n - r + i + 1;
		den[i] = i + 1;
	}

	for (ll p = 2; p <= r; p++) {
		ll pivot = den[p - 1];
		if (pivot > 1) {
			ll offset = (n - r) % p;
			for (ll k = p - 1; k < r; k += p) {
				num[k - offset] /= pivot;
				den[k] /= pivot;
			}
		}
	}
	ll result = 1;
	for (ll k = 0; k < r; k++) {
		if (num[k] > 1) result *= num[k];
	}
	return result;
}

vector<string> split(const string& src, const char* delim = ",") {
	vector<string> vec;
	string::size_type len = src.length();

	for (string::size_type i = 0, n; i < len; i = n + 1) {
		n = src.find_first_of(delim, i);
		if (n == string::npos) {
			n = len;
		}
		vec.push_back(src.substr(i, n - i));
	}

	return vec;
}

bool check_int(string str)
{
	if (all_of(str.cbegin(), str.cend(), [](char ch) { return isdigit(ch);}))
	{
		return true;
	}
	return false;
}

int main() {
	int n;
	string s;
	cin >> n >> s;
	int count = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'A') {
			if (i+1 < n && s[i+1] == 'B') {
				if (i+2 < n && s[i+2] == 'C') {
					count++;
				}
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
typedef vector <ll> vi;                 // Vector of long long
typedef vector <vi> vvi;                // Vector of vi
typedef vector <pair<ll,ll>> ii;        // Vector of pairs
#define ff first                        // For pairs
#define ss second                       // For pairs
#define sz(a) int((a).size())           // Function to determine size of any container
#define pb push_back                    // Pushback to vector
#define mp make_pair                    // Makes pairs to be stored as pair
#define all(c) (c).begin(), (c).end()   // Mainly used by me in sorting
// ordered_set adds two new functions to set - (set).find_by_order([kth element based on zero indexing]) and order_of_key()
// order_of_key returns number of elements less that parameter. If element exists, that order is its index
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >

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

    ll n, w;
    cin >> n >> w;

    ll mg[n], v[n];
    for (int i = 0; i < n; i++)
        cin >> mg[i] >> v[i];
    
    ll dp[w + 5];
    memset(dp, 0, sizeof(dp));

    for (int i = 0; i < n; i++)
        for (int j = w; j >= mg[i]; j--)
            dp[j] = max(dp[j], dp[j - mg[i]] + v[i]);
    
    ll ans = 0;
    for (auto it: dp)
        ans = max(ans, it);
    
    cout << ans << "\n";
}

Measured memory_bytes: 1024
import java.util.Scanner;

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

    int a = in.nextInt();
    int b = in.nextInt();
    int d = a / b;
    int r = a % b;
    double f = (double) a / b;
    System.out.printf("%d %d %.5f", d, r, f);
  }
}

Measured memory_bytes: 26416
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <unordered_map> //C++11
using namespace std;

typedef long long ll;
ll a[3], original[3];
int res;
bool flag, flag2;

int main() {
	cin >> a[0] >> a[1] >> a[2];
	for (int i = 0; i < 3; i++) original[i] = a[i];
	res = 0;
	flag = flag2 = false;
	while (true) {
		for (int i = 0; i < 3; i++)
			if (a[i] % 2 == 1) flag = true;
		if (flag) break;
		res += 1;
		for (int i = 0; i < 3; i++) a[i] /= 2;
		ll sum = 0;
		for (int i = 0; i < 3; i++) sum += a[i];
		flag2 = true;
		for (int i = 0; i < 3; i++) {
			a[i] = sum - a[i];
			if (a[i] != original[i]) flag2 = false;
		}
		if (flag2) break;
	}
	if (flag2) cout << -1 << endl;
	else cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
    int n, m;
    cin >> n >> m;
    cout << (n-1)*(m-1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int k,q;
long d[5000];
main()
{
	cin>>k>>q;
	for(int i=0;i<k;i++)cin>>d[i];
	for(;q--;)
	{
		long n,x,m;cin>>n>>x>>m;
		long ans=0;
		long a=x,b=x;
		for(int i=0;i<n-1&&i<k;i++)
		{
			long L=(n-i-2)/k+1;
			if(d[i]%m==0)ans+=L;
			b+=d[i]%m*L;
		}
		cout<<n-1-(ans+b/m-a/m)<<endl;
	}
}

Measured memory_bytes: 384
n, q = list(map(int, input().split()))
s = input()
t = [0] * (n + 1)
for i in range(n):
    t[i + 1] = t[i] + (1 if s[i : i + 2] == "AC" else 0)

for i in range(q):
    l, r = list(map(int, input().split()))
    print(t[r - 1] - t[l - 1])



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

int main(){
    ll x,y;
    cin >> x >> y;
    ll p = y/x;
    ll i = 0;
    ll tmp = 1;
    while(tmp<=p){
        tmp *= 2;
        i++;
    }
    printf("%lld\n",i);
    return 0;
}


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

int main(){
	int N,K;
	cin>>N>>K;
	vector<int>stones(N);
	vector<int>dp(K+1,0);
	
	for(int i = 0; i < N; i++){
		int v;
		cin>>v;
		stones[i] = v;
	}
 
	for(int i = 1; i <= K; i++){
		for(int j = 0; j < stones.size(); j++){
			if(stones[j] <= i){
				if(dp[i- stones[j]] == 0){
					dp[i] = 1;
				}
			}
		}
	}
	cout<<endl;
 
	if(dp[K] == 1){
		cout<<"First"<<endl;
	}
	else cout<<"Second"<<endl;
}

Measured memory_bytes: 3788
#include<cstdio>
#include<algorithm>

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

using namespace std;

const int INF=1<<29;

int n,d[10][10];

int pos[10],ans;
bool used[10];
void dfs(int right){
	if(right>=ans) return;

	int na=0,a[10],nb=0,b[10];
	rep(i,n){
		if(!used[i]) a[na++]=i;
		else         b[nb++]=i;
	}

	if(na==0){ ans=right; return; }

	int lb=right;
	rep(i,na) rep(j,nb) {
		int u=a[i],v=b[j];
		lb=max(lb,pos[v]+d[v][u]);
	}
	if(lb>=ans) return;

	rep(i,na){
		int u=a[i],v;
		rep(j,nb) v=b[j], pos[u]=max(pos[u],pos[v]+d[v][u]);
		used[u]=true;

		dfs(pos[u]);

		pos[u]=0;
		used[u]=false;
	}
}

int main(){
	for(;scanf("%d",&n),n;){
		rep(i,n) rep(j,n) scanf("%d",d[i]+j);
		rep(i,n) rep(j,n) d[i][j]=max(d[i][j],d[j][i]);

		ans=INF;
		dfs(0);

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

Measured memory_bytes: 764
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
using mpint = mp::cpp_int; // 多倍長整数（任意精度）

int main() {
  ll N;

  cin >> N;

  vector<ll> A(N);
  map<ll, ll> L;

  for(ll i = 0; i < N; ++i){
    cin >> A[i];

    if(L.find(A[i]+i) != L.end()) {
      ++L[A[i]+i];
      continue;
    }
    L[A[i]+i] = 1;
  }

  ll ans = 0;

  for(ll i = 0; i < N; ++i){
    if(L.find(i-A[i]) != L.end()) ans += L[i-A[i]];
  }

  cout << ans << endl;

  return 0;
}


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

signed main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int h, n; cin >> h >> n;
    int p; int sum = 0;
    rep(i,n) {
        cin >> p;
        sum += p;
    }
    if (sum >= h) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;

}

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

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

	vector<int32_t> a(N);
	for (int32_t i = 0; i < N; i++) {
		cin >> a[i];
		a[i]--;
	}

	int32_t res = 0, pos = 0;
	vector<bool> used(N, false);
	bool found = false;
	while (true) {
		if (used[pos])
			break;
		if (pos == 1) {
			found = true;
			break;
		}
		used[pos] = true;
		pos = a[pos];
		res++;
	}

	cout << (found ? res : -1) << endl;

	return 0;
}


Measured memory_bytes: 640