akhauriyash/Code-Regression huggingface dataset:
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception{
		new Main(new Scanner(System.in), System.out, System.err).exec();
	}
	public final Scanner sc;
	public final PrintStream out, err;
	public Main(final Scanner sc, final PrintStream out, final PrintStream err) {
		this.sc = sc;this.out = out;this.err = err;
	}
	static public final long pair(int a, int b) {return (((long)a) << 32) + b;}
	static public final int getPair1(long v) {return (int)(v >> 32);}
	static public final int getPari2(long v) {return (int)(v & 0xFFFFFFFF);}

	static public final long quad(long a, long b, long c, long d) {
		return ((a&0xFFFF)<< 48) + ((b&0xFFFF)<< 32) + ((c&0xFFFF)<< 16) +(d&0xFFFF);}
	static public final int getQuad1(long v) {return (int)( v >> 48          );}
	static public final int getQuad2(long v) {return (int)((v >> 32) & 0xFFFF);}
	static public final int getQuad3(long v) {return (int)((v >> 16) & 0xFFFF);}
	static public final int getQuad4(long v) {return (int)( v        & 0xFFFF);}

	static public final long record(int e, int m, int i) {
		return quad(-1, e, m, i);
	}
	static public final int re(long record) {
		return getQuad2(record);
	}
	static public final int rm(long record) {
		return getQuad3(record);
	}
	static public final int ri(long record) {
		return getQuad4(record);
	}

	//------------------------------------------

	private int p;
	private int[] inv;
	private int[] fact;
	private int[] finv;
	public final int mod(long v) {
		v %= p;
		return (int)(v < 0 ? v+p : v);
	}
	public final int mul(long a, long b) {
		return mod(a*b);
	}
	public final void initFact(double limit, double p) {
		initFact((int)limit, (int)p);
	}
	public final void initFact(int limit, int p) {
		this.p = p;
		this.inv = new int[limit+1];
		this.fact = new int[limit+1];
		this.finv = new int[limit+1];
		fact[1] = finv[1] = inv[0] = inv[1] = 1;
		for(int i=2;i<=limit;i++) {
			int a = p / i;
			int b = p % i;
			inv[i]  = mul(-a, inv[b]);
			fact[i] = mul(fact[i-1], i);
			finv[i] = mul(finv[i-1], inv[i]);
		}
	}
	public final int comb(int m, int n) {
		return mul(mul(fact[m], finv[n]), finv[m-n]);
	}
	//------------------------------------------
	static long lcm (long a, long b) {
		long temp;
		long c = a;
		c *= b;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return (long)(c/b);
	}

	//------------------------------------------



	public void exec() throws Exception{
		final String S = sc.next();
		final String T = sc.next();
		final int A = sc.nextInt();
		final int B = sc.nextInt();
		final String U = sc.next();
		if(S.equals(U)) {
			out.println((A-1)+" "+B);
		}else {
			out.println(A+" "+(B-1));
		}

	}
}


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 2e5+23;
long long a[N], b[N];

void solve() {
  long long n, m, k; scanf("%lld%lld%lld", &n, &m, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%lld", a+i);
    if (i) a[i] += a[i-1];
  }
  for (int i = 0; i < m; ++i) {
    scanf("%lld", b+i);
    if(i) b[i] += b[i-1];
  }
  int ans = upper_bound(b, b+m, k)-b;
  for (int i = 0; i < n; ++i) {
    if (a[i] > k) break;
    int bbooks = upper_bound(b, b+m, k-a[i])-b;
    ans = max(ans, (i+1) + bbooks);
  }
  printf("%d", ans);
}

int main() {
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 6944
import math
from collections import deque
n,m=[int(_) for _ in input().split()]
A=[[int(_) for _ in input().split()] for l in range(m)]
R=deque([] for _ in range(n))
for a in A:
    R[a[0]-1].append(a[1]-1)
    R[a[1]-1].append(a[0]-1)
print("Yes")
Dis=deque([100000000]*n)
Dis[0]=0
PP=deque([0]*n)
l=deque()
l.append(0)
while l:
    x=l.popleft()
    for a in R[x]:
        if Dis[a]>Dis[x]+1:
            Dis[a]=Dis[x]+1
            l.append(a)
            PP[a]=x
for t in range(1,n):
    print(PP[t]+1)


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

int main() {
  long N, ans = 0;
  cin >> N;
  
  for (int i = 0; i <= N; i++) {
    if (i%3 != 0 && i%5 != 0) ans += i;
  }

  cout << ans << endl;
}

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

/*
<四則演算の式> ::= <乗算除算の式> (+ or -) <乗算除算の式> (+ or -) ...
<乗算除算の式> ::= <括弧か数> (* or /) <括弧か数> (* or /) ...
<括弧か数>     ::= '(' <四則演算の式> ')' or <数>
<数>           ::= ...
*/

string ss;
const int mod = 1e9 + 7;

// 構文解析
using State = string::const_iterator;
class ParseError{};

int number(State &begin);
int term(State &begin);
int factor(State &begin);
int expression(State &begin);

// 数字の列をパースして，その数を返す
int number(State &begin) {
    int ret = 0;

    while (isdigit(*begin)) {
        ret *= 10;
        ret += *begin - '0';
        begin++;
    }

    return ret;
}

// 乗算除算の式をパースして，その評価結果を返す
int term(State &begin) {
    if (*begin == 'S') {
        begin++; begin++;
        ll ret = expression(begin);
        begin++;
        return ret * ret % mod;
    }
    else {
        return number(begin);
    }
}

// 四則演算の式をパースして，その評価結果を返す
int expression(State &begin) {
    int ret = term(begin);

    while (ss.end() - begin >= 2) {
        if (*begin == '>' and *(begin + 1) == '>' and *(begin + 2) != '>') {
            begin++; begin++;
            ret = ret >> min(term(begin), 31);
        }
        else {
            break;
        }
    }

    return ret;
}

int main() {
    string s;
    while (getline(cin, s) and s != "#") {
        ss = "";
        for (auto tmp : s) if (tmp != ' ') ss += tmp;
        State begin = ss.begin();
        cout << expression(begin) << endl;
    }
    return 0;
}



Measured memory_bytes: 4776
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int[] nums = new int[4];
    for(int i = 0; i < 4; i++){
      nums[i] = a % 10;
      a /= 10;
    }	
    int sum;
    for(int i = 0; i < 8; i++){
      sum = nums[3];
      for(int j = 0; j < 3;j++){
        if((i >> j & 1) == 1){
          sum += nums[3 - j - 1];
        }else{
          sum -= nums[3 - j - 1];
        }
      }
      if(sum == 7){
        a = i;
      }
    }
    char[] ops = new char[3];
    for(int i = 0; i < 3; i++){
      if((a >> i & 1) == 1){
        ops[i] = '+';
      }else{
        ops[i] = '-';
      }
    }
    System.out.println("" + nums[3] + ops[0] + nums[2] + ops[1] + nums[1] + ops[2] + nums[0] + "=7");
	}
}

Measured memory_bytes: 21972
#include <iostream>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <vector>
    using namespace std;
    const int N=2e6;
    int n,rt1,rt2,dx=0,px;
    int d[N+10],deep[N+10];
    vector <int> edge[N+10];
    void Add(int u,int v) {
        edge[u].push_back(v);
        edge[v].push_back(u);
    }
    void Dfs1(int x,int fat) {
        deep[x]=dx;
        int cnt=0;
        for (int i=0;i<(int)edge[x].size();i++) {
            int kx=edge[x][i];
            if (kx==fat) continue;
            ++cnt;
            ++dx;
            Dfs1(kx,x);
            --dx;
        }
        if (cnt>=2&&deep[x]>=deep[px]) px=x;
    }
    void Dfs2(int x,int fat,bool vis) {
        if (x==px) vis=1;
        for (int i=0;i<(int)edge[x].size();i++) {
            int kx=edge[x][i];
            if (kx==fat) continue;
            Dfs2(kx,x,vis);
        }
        if (vis&&d[x]==1) {
            if (rt1) rt2=x;
            else rt1=x;
        }
    }
    int Solve(int x,int fat) {
        int sum=0;
        int zero=0;
        for (int i=0;i<(int)edge[x].size();i++) {
            int kx=edge[x][i];
            if (kx==fat) continue;
            int nowx=Solve(kx,x);
            sum+=nowx;
            if (nowx==0) zero++;
        }
        if (zero>1) sum+=zero-1;
        return sum;
    }
    int main() {
        scanf("%d",&n);
        if (n==1) {
            printf("0\n");
            return 0;
        }
        if (n==2) {
            printf("1\n");
            return 0;
        }
        for (int i=1;i<n;i++) {
            int u,v;
            scanf("%d%d",&u,&v);
            u++;
            v++;
            Add(u,v);
            d[u]++;
            d[v]++;
        }
        int rt=1;
        for (int i=2;i<=n;i++)
            if (d[i]>=2) rt=i;
        Dfs1(rt,-1);
        Dfs2(rt,-1,0);
        int ans=Solve(rt1,-1)+1;
        printf("%d\n",ans);
        return 0;
    }

Measured memory_bytes: 60800
h, w = map(int, input().split())
da = {}
for _ in range(h):
  a = input().strip()
  for _a in a:
    if _a in da:
      da[_a] += 1
    else:
      da[_a] = 1

if h%2==1 and w%2==1:
  oddc = 1
  div2 = w-1 + h-1
  div4 = h*w-1-div2
elif h%2==0 and w%2==0:
  oddc = 0
  div2 = 0
  div4 = h*w
elif h%2==1:
  oddc = 0
  div2 = w
  div4 = w*h-div2
else:
  oddc = 0
  div2 = h
  div4 = w*h - div2

for _, v in da.items():
  while v > 0:
    if v % 2 == 1:
      oddc -= 1
      v -= 1
    elif v % 4 == 0:
      div4 -= v
      v = 0
    else:
      div2 -= 2
      v -= 2

if h%2==1 and w%2==1 and div2>0 and div2%4==0:
  print('Yes')
elif h%2==1 and w%2==0 and div2>0 and div2%4==0:
  print('Yes')
elif h%2==0 and w%2==1 and div2>0 and div2%4==0:
  print('Yes')
elif oddc == 0 and div2 == 0 and div4 == 0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#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 int 	     	  long long   // [9,223,372,036,854,775,807 to -9.....808] 19 digits
#define pb                push_back 
#define all(x)            (x).begin(),(x).end()
#define mp                make_pair
#define vi                vector<int> 
#define vpi               vector<pair<int,int>>
#define mii               map<int,int>
#define x                 first
#define y                 second 
#define mem(a,x)          memset(a,x,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define sz(x)             (int)((x).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order()  // order_of_key

//const int32_t mod=163577857; const int32_t hellhsh = 444440583533; const double pi=2*acos(0.0); const int32_t mod=998244353; 
const int32_t mod = 1e9+7;
const int32_t maxn=2e5+5;

void solve(){
    int n;cin>>n;int a[n];
    int k;cin>>k;int ans=0;
    rep(i,0,n) cin>>a[i];
    sort(a,a+n);
    rep(i,0,k) ans+=a[i];
    cout<<ans;
}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int tc=1,k=1;                                                                                                                  
    //cin>>tc;
    while(tc--){
        //cout<<"Case #"<<k++<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
int factorial(int n){
  	if (n == 1 || n == 0) return 1;
	return n * (n - 1);
}

int main(){
  	int N; 
  	std::cin >> N;
  	vector<vector<int> > coords;
  	vector<int> temp;
  	for (int i = 0; i < N; i++){
		int t;
     	std::cin >> t;
      	temp.push_back(t);
      	std::cin >> t;
      	temp.push_back(t);
      	coords.push_back(temp);
      	temp.clear();
    }
  	double sum = 0.0;
  	int size = coords.size();
  	for (int i = 0; i < size; i++){
    	for (int j = i + 1; j < size; j++){        	
          	sum += sqrt(pow(coords[i][0] - coords[j][0], 2) + pow(coords[i][1] - coords[j][1], 2));
        }
    }
  	sum *= (N - 1) * 2;
  	std::cout << std::setprecision(10) << sum / (double)factorial(N);
	return 0;
}

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


int max(int a, int b) {
	return (a > b) ? a : b;
}

int main() {
	int N, W, v[100], w[100];
	int dp[100][10001];

	scanf("%d%d", &N, &W);
	for (int i = 0;i < N;i++) {
		scanf("%d%d", v + i, w + i);
	}

	for (int j = 0;j <= W;j++) {
		dp[0][j] = (j >= w[0]) ? v[0] : 0;
	}
	for (int i = 1;i < N;i++) {
		for (int j = 0;j <= W;j++) {
			if (j < w[i]) {
				dp[i][j] = dp[i - 1][j];
			}
			else {
				dp[i][j] = max(dp[i - 1][j - w[i]] + v[i], dp[i - 1][j]);
			}
		}
	}

	printf("%d\n", dp[N - 1][W]);

	return 0;
}

Measured memory_bytes: 6648
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        int r = inp.nextInt();
        System.out.println(
                r < 1200 ? "ABC" :
                r < 2800 ? "ARC" :
                "AGC"
            );
        inp.close();
    }
}


Measured memory_bytes: 23636
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST
{
    static void Main()
    {
        new Sol();//.Solve();
    }
}

class Sol
{
    
    public Sol()
    {
        int N = Convert.ToInt32(Console.ReadLine());
        List<int> ai = new List<int>();

        for (int i = 0; i < N; i++) {
            ai.Add(Convert.ToInt32(Console.ReadLine()));
        }
        ai.Sort();

        int cnt = 0;
        for (int i = 0; i < ai.Count; i = i+2) {

            if (i + 1 < ai.Count)
            {
                if (ai[i] != ai[i + 1]) {
                    cnt++;
                    i--;
                }
            }
            else {
                cnt++;
            }

        }

        Console.WriteLine(cnt);
    }
}

Measured memory_bytes: 17324
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#define rep(i,x) for(int i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}


int main(){
    ll N, M;
    cin >> N >> M;
    graph G(N);
    vector<ll> dist(N,-1);
    queue<ll> que;
    ll a, b;
    rep(i, M) {
        cin >> a >> b;
        G[a - 1].push_back(b - 1);
        G[b - 1].push_back(a - 1);
    }
    que.push(0);
    dist[0] = 0;
    while (que.size()) {
        ll num = que.front();
        que.pop();
        for (auto x : G[num]) {
            if (dist[x] == -1) {
                dist[x] = dist[num] + 1;
                que.push(x);
            }
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i < N; i++) {
        for (auto x : G[i]) {
            if (dist[i] == dist[x] + 1) {
                cout << x + 1 << endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 12860
#include <bits/stdc++.h>
#include <atcoder/all> 

#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)

// policy-based
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;	


using namespace std;
using namespace atcoder;

typedef long long ll; // int or long long
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;

/*
typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
*/
 
const ll MAX = 5e6 + 100;
const ll inf = 1e9;

int main(){
	fastio;	
	ll n,q,t,u,v;
	cin >> n >> q;
	fenwick_tree<ll> bit(n);
	f(i,0,n){
		cin >> u;
		bit.add(i,u);
	}
	while(q--){
		cin >> t >> u >> v;
		if(t == 0) bit.add(u,v);
		else cout << bit.sum(u,v)<< endl;
	}
}

Measured memory_bytes: 8252
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;

namespace AOJ
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Trim().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        //18.4 素因数分解
        static List<long> primefactorize(long n)
        {
            var primes = new List<long>();
            for (var i = 2; i * i <= n; ++i)
            {
                if (n % i == 0)
                {
                    while (n % i == 0)
                    {
                        primes.Add(i);
                        n /= i;
                    }
                }
            }
            if (n != 1) primes.Add(n);
            return primes;
        }
        static void Main(string[] args)
        {
            var n = Sarray()[0];
            var ans = primefactorize(n);
            ans.Sort();
            WriteLine($"{n}: {string.Join(" ", ans).Trim()}");
        }
    }
}


Measured memory_bytes: 18564
#ifdef _DEBUG
#define _CRT_SECURE_NO_WARNINGS
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define MGN 8
#define LINF (LONG_MAX/2)
using namespace std;
typedef long long ll; typedef unsigned long long ull;
typedef vector<int> vi; typedef vector<vi> vvi; 
typedef vector<ll> vl; typedef vector<vl> vvl;
typedef vector<double> vd; typedef vector<string> vs;
typedef pair<int, int> pii; typedef pair<ll, ll> pll;
typedef vector<bool> vb; typedef vector<vb> vvb;
template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
    return left.second > right.second;}
vs split(string str, char sep) {
    vs v; stringstream ss(str); string t;
    while (getline(ss, t, sep)) v.push_back(t);
    return v;}
vs re_search_g(string s, regex re) {
    vs ret; smatch mc; auto it = s.cbegin();
    while (regex_search(it, s.cend(), mc, re)) {
        ret.push_back(mc[0]);
        it += mc.position(0) + mc.length();}
    return ret;}
#endif

void init_global_B() {}


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N; cin >> N;
    vi a(N);

    int lo = INF, hi = 0;
    REP(i,N){
        cin >> a[i];
        lo = min(lo, a[i]);
        hi = max(hi, a[i]);
    }
    
    int ans = hi - lo;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
def compute_portfolio(passports, n)
	max = (1 << n) - 1	
	table = (0..1).map{ Array.new(max+1, Float::INFINITY) }
	table[0][0] = 0
	table[1][0] = 0
	for i in 0..passports.size-1
		c, bits = passports[i]
		for j in 0..max
			table[1][j] = table[0][j] if table[0][j] < table[1][j] 
			x = table[0][j] + c
			table[1][j | bits] = x if x < table[1][j | bits]
		end
		table << table.shift
	end
	table[0]
end

loop.with_index {|_, itr|
	n, m, available_time, k = gets.split.map &:to_i
	break if n == 0
	
	len = (0..n).map{|i| {} }
	time = (0..n).map{|i| {} }
	company = (0..n).map{|i| {} }

	m.times{
		a, b, l, t, c = gets.split.map &:to_i
		len[a][b] = len[b][a] = l
		time[a][b] = time[b][a] = t
		company[a][b] = company[b][a] = c-1
	}
	
	start, goal = gets.split.map &:to_i

	p_num = gets.to_i
	passports = []
	p_num.times {
		_, price, *companies = gets.split.map &:to_i
		bits = 0
		companies.each{|i| bits |= (1 << i-1)}
		passports << [price, bits]
	}

	portfolio = compute_portfolio(passports, k)

	min_cost = Float::INFINITY
	(0..(1<<k)-1).to_a.sort_by{|x| portfolio[x]}.each{|x|
		passport_cost = portfolio[x]
		break if passport_cost >= min_cost

		dist = (0..available_time).map{ (0..n).map{ Float::INFINITY } }
		dist[available_time][start] = 0

		available_time.downto(1).each{|h|
			(1..n).each{|i|
				d0 = dist[h][i]
				next if d0 >= min_cost
				len[i].each{|j, l|
					t = time[i][j]
					next if h < t
					c = company[i][j]
					d = (x[c] == 1 ? d0 : d0 + l)
					dist[h-t][j] = d if d < dist[h-t][j]
				}
			}
		}

		road_cost = (0..available_time).map{|h| dist[h][goal]}.min
		total_cost = passport_cost + road_cost
		min_cost = total_cost if total_cost < min_cost
	}

	p min_cost == Float::INFINITY ? -1 : min_cost
}

Measured memory_bytes: 14296
#include<iostream>
using namespace std;
int main(){
int a,b,c,d[30],e,f=0,g=0;
cin >>a>>b>>c;
for(int n=0;n<b;n++){
cin >>d[n];
}
for(int n=0;n<a;n++){
f=0;
for(int m=0;m<b;m++){
cin >>e;
f+=e*d[m];
}
if(f+c>0) g++;
}
cout <<g<<'\n';
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

ll euclidean_gcd(ll a, ll b) {
    if(a < b) euclidean_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    int x, y;
    cin >> x >> y;
    cout << euclidean_gcd(x, y) << endl;
}


Measured memory_bytes: 3180
N,Q = gets.split.map(&:to_i)
s = gets.chomp
ac = Array.new(N,0)

(N-1).times do |i|
    ac[i+1] = (s[i] == "A" && s[i+1] == "C") ? ac[i] + 1 : ac[i]
end

Q.times do
  l,r = gets.split.map(&:to_i)
  puts ac[r-1]-ac[l-1]
end


Measured memory_bytes: 3324
#!/usr/bin/python

import sys

def parse():
  A = []
  n = raw_input()
  for line in sys.stdin:
    values = line.split()
    values = [ int(x) for x in values ]
    A.append(values)

  return A 

def prim(cost):
  res = 0
  V = len(cost)
  mincost = [float("inf")] * V
  used    = [False]        * V
  mincost[0] = 0
  while True:
    v = -1
    for u in range(V):
      if not used[u] and \
        (v == -1 or mincost[u] < mincost[v]):
        v = u
    if v == -1:
      break
    used[v] = True
    res += mincost[v]
    for u in range(V):
      if cost[v][u] == -1:
        continue
      mincost[u] = min(mincost[u], cost[v][u])
  return res

if __name__ == "__main__":
  A = parse()
  print prim(A)

Measured memory_bytes: 6592
#include<bits/stdc++.h>
using namespace std;
int dp[100009];

int main(){
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    int s=6,t=9;
    dp[i]=dp[i-1]+1;
    
    while(i-s>=0){
      dp[i]=min(dp[i],dp[i-s]+1);
      s*=6;
    }
    while(i-t>=0){
      dp[i]=min(dp[i],dp[i-t]+1);
      t*=9;
    }
  }
  cout<<dp[n]<<endl;
  return(0);
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x) memset(x , 0 , sizeof x);
#define sz(x) (int)x.size()
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
const int xx = 2e5;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;
int a[10][10];
signed main(){
  ios::sync_with_stdio(false);cin.tie(0);

  int N;
  cin >> N;
  for(int i = 1; i <= N; i++) {
    string s = to_string(i);
    a[s[0] - '0'][i % 10]++;
  }
  int ans = 0;
  for(int i = 1; i <= N; i++) {
    string s = to_string(i);
    ans += a[i % 10][s[0] - '0'];
  }
  cout << ans << '\n';
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	int N;
	cin >> N;
	map<int, int> K;
	vec(A);
	fx(N) {
		int a;
		cin >> a;
		K[a + x + 1]++;
		pb(A, a);
	}
	ll ans = 0;
	fx(N) {
		ans += K[x + 1 - A[x]];
	}
	ce(ans)
    return 0;
}



Measured memory_bytes: 20976
#include <math.h>
#include <stdio.h>

int
main()
{
	int i;
	int n;
	double s[1000];
	double avg, variance, standard_deviation;
	for (;;)
	{
		scanf("%d", &n);

		if (n == 0)
			break;

		for (i = 0; i < n; i++)
		{
			scanf("%lf", &s[i]);
		}

		avg = 0.0;
		for (i = 0; i < n; i++)
		{
			avg += s[i];
		}
		avg /= n;

		variance = 0;
		for (i = 0; i < n; i++)
		{
			variance += pow(s[i]-avg, 2);
		}
		variance /= n;

		standard_deviation = sqrt(variance);
		printf("%f\n", standard_deviation);
	}

	return 0;
}

Measured memory_bytes: 664
MAX = 1_000_000

is_prime = [false, false] + [true] * (MAX - 2)

sqrt_n = Math.sqrt(MAX).ceil
(2..sqrt_n).each do |i|
  next unless is_prime[i]
  (i*i).step(by: i, to: MAX) do |j|
    is_prime[j] = false
  end
end

prime_count_list = [0, 0]
count = 0
2.upto(MAX) do |i|
  count += 1 if is_prime[i]
  prime_count_list[i] = count
end

while num = gets.to_i
  break if num == 0
  puts prime_count_list[num]
end

Measured memory_bytes: 30184
#include<iostream>
#include<float.h>
#include<cfloat>
#include<string>
#include<ctype.h>
#include<algorithm>
#include<errno.h>
#include<cerrno>
#include<assert.h>
#include<cassert> 
#include<map>
#include<memory.h>
#include<cctype>
#include<ctype.h>
#include<math.h>
#include<vector> 
#include<cstdio> 
#include<set>
#include<string.h>
#include<stdio.h>
#include<new>
#include<memory>
#include<cmath>
#include<queue>
#include<cstring>
#define ll long long
#define fo(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define br break
#define ct continue
#define pb push_back
#define pi 3.141592653589793238462643383279502884197169
#define F first
#define S second
#define em empty()
#define vei vector<int>
#define ves vector<string>
#define qui queue<int> 
#define qu queue
using namespace std;
int main()
{int a,b;
 cin>>a>>b;
 if(a+b>=10)
{cout<<"error"<<endl;
}
 else
 {cout<<a+b<<endl;
 }
 return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
data = list(map(int,read().split()))
A = data[:N+N-2:2]
B = data[1:N+N-2:2]
INF = 10 ** 18 + 100
S = [INF] + data[-N:]

graph = [[] for _ in range(N+1)]
for a,b in zip(A,B):
    graph[a].append(b)
    graph[b].append(a)

root = S.index(min(S))
parent = [0] * (N+1)
order = []
stack = [root]
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)

subtree_size = [1] * (N+1)
for v in reversed(order):
    subtree_size[parent[v]] += subtree_size[v]

length = [0] * (N+1)
for v,p in zip(A,B):
    if parent[p] == v:
        v,p = p,v
    s = subtree_size[v]
    d = N - s - s
    length[v] = 0 if d == 0 else(S[v] - S[p]) // d

# 重心間以外は決まった。いったん、重心間を 0 として計算

dist = [0] * (N+1)
for v in order[1:]:
    p = parent[v]
    dist[v] = dist[p] + length[v]

d_root = sum(dist)
x = (S[root] - d_root) * 2 // N
answer = []
for v,p in zip(A,B):
    if parent[p] == v:
        v,p = p,v
    if length[v] == 0:
        length[v] = x
    answer.append(length[v])

print('\n'.join(map(str,answer)))

Measured memory_bytes: 50296
from _collections import deque
from _ast import Num


def parser():
    while 1:
        data = list(input().split(' '))
        for number in data:
            if len(number) > 0:
                yield (number)


input_parser = parser()


def gw():
    global input_parser
    return next(input_parser)


def gi():
    data = gw()
    return int(data)


MOD = int(1e9 + 7)

import numpy
from collections import deque
from math import sqrt
from math import floor
# https://atcoder.jp/contests/arc081/tasks/arc081_b
# D - Coloring Dominoes
"""
need to consider the case that ticket is not enough to lower everything
"""

N = gi()
M = gi()
A = [0] * N
ops = []

for i in range(N):
    A[i] = gi()
for _ in range(M):
    b = gi()
    c = gi()
    ops.append((-c, b))

A.sort()
ops.sort()

i = 0
for op in ops:
    nv = -op[0]
    for _ in range(op[1]):
        if i >= N:
            break
        if nv < A[i]:
            break
        A[i] = nv
        i += 1

print(sum(A))


Measured memory_bytes: 30116
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations
    #from itertools import accumulate, product, permutations
    from math import floor, ceil

    #mod = 1000000007

    s = input()
    k = int(input())
    n = 0
    while n<=k-1:
        if not s[n]=='1':
            print(s[n])
            exit()
        else:
            n += 1
    print('1')


if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include<iostream>
using namespace std;
int main(){
int a,b,emp;
for(int i=1;;i++){
cin>>a>>b;
if(a==0&&b==0)break;
if(a>b){
emp=a;
a=b;
b=emp;
cout<<a<<" "<<b<<endl;}
else cout<<a<<" "<<b<<endl;
}
return 0;
}

Measured memory_bytes: 3044
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

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

  vector<int> vs;
  while (abs(N) > 0) {
    int r = abs(N) % 2;
    if (r == 1) N--;
    vs.push_back(r);
    N /= -2;
  }
  for (auto it = vs.rbegin(); it != vs.rend(); ++it) {
    cout << *it;
  }
  cout << endl;
}


Measured memory_bytes: 3644
def main():
    x,n =map(int, input().split()) 
    p = list(map(int, input().split()))

    x_up = x
    x_down = x

    while True:
        if x_down not in p:
            print(x_down)
            break
        elif x_up not in p:
            print(x_up)
            break

        x_up += 1
        x_down -= 1

if __name__ == "__main__":
    main()

Measured memory_bytes: 9184
N = list(map(int,input().split()))
A = N[0]
B = N[1]
K = N[2]

amaList = []

for i in range(100):
	if(A%(i+1)==0 and B%(i+1)==0):
		amaList.append(i+1)

amaList.reverse()
print(amaList[K-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int n;
int main(void){
	cin >> n;
	vector<int> a(3 * n);
	rep(i, 3 * n) cin >> a[i];
	sort(all(a));
	ll sum = 0;
	int idx = 3 * n - 2;
	while(n){
		sum += a[idx]; idx -= 2	;
		n--;
	}
	cout <<sum << endl;
	return 0;
}

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

int main()
{
string str ;
cin>>str ;
int maxi =0 ;
int counter =0 ;
for (int i= 0; i<str.size() ;i++)
{
    if(str[i]=='R')
    {
        counter++ ;
    }
    else
    {
        counter=0 ;
    }
    maxi=max(counter,maxi) ;
}
cout<< maxi<<endl;
}


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

int main() {
    string S;
    cin >> S;
    int N = S.length();
    for (int i = 0; i < N; i++)
    {
        S[i] = 'x';
        cout << S[i];
    }
    cout << endl;
    
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;

int main(void){
    int N,M,ans=0;
    
    cin >> N >> M;
    vector<int> L(M);
    vector<int> R(M);
    int p[N];
    REP(i,N) p[i]=0;

    REP(i,M){
       cin >> L[i] >> R[i];
    }

    int Lmax = *std::max_element(L.begin(), L.end());
    int Rmin = *std::min_element(R.begin(), R.end());
    
    if(Lmax <= Rmin) ans = Rmin - Lmax + 1;
    else ans = 0;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 100000000;
const ll LINF = 8000000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
int N, K;
ll x[50], y[50];
P px[50], py[50];

void solve(){
	sort(px, px + N);
	sort(py, py + N);
	ll ans = LINF;
	rep(i, N){
		ll lx = px[i].first;
		int n;
		rep(j, N){
			if(py[j].first == px[i].second){
				n = j;
				break;
			}
		}
		for(int top = n; top >= 0; top--){
			if(py[top].second < lx) continue;
			for(int under = n; under < N; under++){
				if(py[under].second < lx) continue;
				ll ty = py[top].first;
				ll uy = py[under].first;
				ll rx = max(py[top].second, py[under].second);
				int c = 0;
				rep(j, N){
					if(px[j].first < lx or px[j].second < ty or px[j].second > uy) continue;
					c++;
					if(c == K){
						chmax(rx, px[j].first);
						chmin(ans, (rx - lx) * (uy - ty));
					}
				}
			}
		}
	}
	cout << ans << endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N >> K;
	rep(i, N) {
		cin >> x[i] >> y[i];
		px[i] = P(x[i], y[i]);
		py[i] = P(y[i], x[i]);
	}
		solve();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
typedef long long ll;
const int N=3010;
const int mod=998244353;
ll f[N][N];
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    f[a][b]=1;
    for(int i=a;i<=c;i++){
        for(int j=b;j<=d;j++){
            if(i==a&&j==b)continue;
            f[i][j]=(f[i-1][j]*j+f[i][j-1]*i%mod-f[i-1][j-1]*(i-1)%mod*(j-1)%mod)%mod;
            if(f[i][j]<0)f[i][j]+=mod;
        }
    }
    // cout<<f[2][1]<<endl;
    cout<<f[c][d]<<endl;
}

Measured memory_bytes: 73884
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>

using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define pb(x) push_back(x)
#define int long long

int N, K;

signed main(void) {
	cin >> N >> K;
	string ans = "NO";
	if (K*2 - 1 <= N) {
		ans = "YES";
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
lis = []
res = 0


def solve():

    N, M, Q = map(int, input().split())
    e = [list(map(int, input().split())) for i in range(Q)]
    global lis
    lis = [0]*N

    def dfs(x, y):
        global lis, res
        if x == N:
            tmp = 0
            for a, b, c, d in e:
                if lis[b-1]-lis[a-1] == c:
                    tmp += d
            res = max(res, tmp)
            return

        for i in range(y, M+1):
            lis[x] = i
            dfs(x+1, i)

    dfs(0, 1)
    print(res)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 73304
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 2e3 + 5, inf = 1e9;
int read() {
	int x = 0, f = 1; char ch;
	while(! isdigit(ch = getchar())) (ch == '-') && (f = -f);
	for(x = ch ^ 48; isdigit(ch = getchar()); x = (x << 3) + (x << 1) + (ch ^ 48));
	return x * f;
}
template <class T> T Max(T a, T b) { return a > b ? a : b; }
template <class T> T Min(T a, T b) { return a < b ? a : b; }
struct Edge {
	int to;
	Edge *nxt;
	Edge(int to, Edge *nxt) : to(to), nxt(nxt) {}
} *head[N];
void add(int x, int y) {head[x] = new Edge(y, head[x]);}
char s[N];
int n, ans = inf, a[N], f[N], siz[N], dis[N];
void dfs(int x, int fa) {
	int son = 0; siz[x] = a[x];
	for(Edge *i = head[x]; i; i = i->nxt) {
		if(i->to == fa) continue;
		dfs(i->to, x); siz[x] += siz[i->to]; dis[i->to] += siz[i->to];
		dis[x] += dis[i->to]; if(dis[i->to] > dis[son]) son = i->to; 
	}
	if(son == 0) f[x] = 0;
	else if(dis[x] >= 2 * dis[son]) f[x] = dis[x] / 2;
	else f[x] = dis[x] - dis[son] + min(f[son], (2 * dis[son] - dis[x]) / 2);
}
int main() {
	n = read(); scanf("%s", s + 1);
	for(int i = 1; i <= n; ++ i) a[i] = (s[i] ^ 48);
	for(int i = 1, x, y; i < n; ++ i) x = read(), y = read(), add(x, y), add(y, x);
	for(int i = 1; i <= n; ++ i) {
		for(int j = 1; j <= n; ++ j) f[j] = dis[j] = siz[j] = 0;
		dfs(i, 0); if(dis[i] & 1) continue;
		if(f[i] * 2 == dis[i]) ans = min(ans, dis[i] / 2);
	}
	printf("%d\n", (ans == inf) ? -1 : ans);
	return 0;
}


Measured memory_bytes: 512
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))


INF = float("inf")
MOD = 10**9 + 7


def main():
    S = input()
    T = input()
    print(sum(s != t for s, t in zip(S, T)))

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9412
/*
  AOJ #3026
  title:ai1333
  @kankichi57301
 */
#include <stdio.h>

char ans[104]="ai1333";
int main()
{
  int i,n;
  scanf("%d",&n);
  n /= 100;

  
  for(i=0;i<n;i++)
    ans[6+i]='3';
  ans[6+n]='\0';
  printf("%s\n",ans);
 
  return(0);
}



Measured memory_bytes: 2116
package main

import "fmt"

func main() {
	var a, b, c, x int
	fmt.Scan(&a, &b, &c, &x)
	var count = 0

	for i := 0; i <= a; i++ {
		var ra int
		ra = 500 * i
		for j := 0; j <= b; j++ {
			var rb int
			rb = 100 * j
			for k := 0; k <= c; k++ {
				var rc int
				rc = 50 * k
				if ra+rb+rc == x {
					count++
				}
			}
		}
	}

	fmt.Println(count)
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int>a(N*3);
  for(int i=0; i<N*3; i++)cin >> a.at(i);
  
  int64_t ans=0;
  sort(a.begin(), a.end());
  
  for(int i=2; i<=2*N; i+=2){
    ans += a.at(3*N-i);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 4180
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
        {
            var result = "";
            var s = Console.ReadLine().Trim();
            var number = "";
            for (int j = 0; j < s.Length; j++)
            {
                if (s[j] != '0') number += s[j];
                else
                {
                    if (number != "")
                    {
                        result += Kakutei(int.Parse(number[0].ToString()) , number.Length);
                        number = "";
                    }
                }
            }
            Console.WriteLine(result);
        }
    }
    public static char Kakutei(int button, int times)
    {
        var btn = new string[] { ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz" };
        var p = times % btn[button - 1].Length - 1;
        if (p < 0) p += btn[button - 1].Length;
        return btn[button - 1][p];
    }
}

Measured memory_bytes: 9352
#include <iostream>
#define MAX_H 8
#define MAX_W 8
using namespace std;

int H, W;
char A[MAX_H][MAX_W];

void bfs(int i, int j){
    A[i][j] = '.';
    if(i == W - 1 && j == H - 1) return;

    int rx = i + 1, ry = j, dx = i, dy = j + 1;
    if(rx < W && A[rx][ry] == '#') bfs(rx, ry);
    else if(dy < H && A[dx][dy] == '#') bfs(dx, dy);
}


int main(){
    cin >> H >> W;
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j){
            cin >> A[j][i];
        }
    }
    bfs(0, 0);
    
    bool flg = true;
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j) {
            if(A[j][i] != '.') flg = false;
        }
    }

    cout << (flg ? "Possible" : "Impossible") << endl;
    return 0;
}



Measured memory_bytes: 256
def gcd(a, b):
    return a if b == 0 else gcd(b, a % b)

import math

a, b, c, d = list(map(int,input().split()))

mul_c = b // c - (a - 1) // c
mul_d = b // d - (a - 1) // d

gcd_c_d = gcd(c, d)
lcm_c_d = gcd_c_d * (c // gcd_c_d) * (d // gcd_c_d)
mul_c_d = b // lcm_c_d - (a - 1) // lcm_c_d

print(b - a + 1 - (mul_c + mul_d - mul_c_d))


Measured memory_bytes: 38256
N, Q = map(int, input().split())
S = input()

cumulatives = [0] * (N + 1)

for i in range(N):
  if i == 0:
    cumulatives[1] = 0
  elif S[i - 1] == 'A' and S[i] == 'C':
    cumulatives[i + 1] = cumulatives[i] + 1
  else:
    cumulatives[i + 1] = cumulatives[i]
        
for _ in range(Q):
  l, r = map(lambda x: int(x) - 1, input().split())
  if l > 0 and S[l - 1] == 'A' and S[l] == 'C':
    # 右も閉区間なので+1
    print(cumulatives[r + 1] - cumulatives[l] - 1)
  else:
    print(cumulatives[r + 1] - cumulatives[l])

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

int main() 
{
	string s;
	cin>>s;
	bool can=true;
	for(int i=0;i<s.length();i++)
	{
		if(i&1)
		{
			if(s[i]=='R')
			{
				can=false; break;
			}
		}
		if(i%2==0){if(s[i]=='L'){can=false; break;}}
		
	}
	cout<<(can?"Yes":"No");
}

Measured memory_bytes: 256
N = int(input())
C0, C1, C2, C3 = 0, 0, 0, 0
for i in range(N):
    Si = input()
    if Si == 'AC':
        C0 = C0+1
 
    elif Si == 'WA':
        C1  =C1+1
 
    elif Si == 'TLE':
        C2  =C2+1
 
    else:
        C3  =C3+1
 
print('AC x ' + str(C0))
print('WA x ' + str(C1))
print('TLE x ' + str(C2))
print('RE x ' + str(C3))

Measured memory_bytes: 9200
A, B, K = map(int, input().split())
    
if B - (A-1) < 2*K:
    l = []
    for i in range(A, B+1):
        l.append(i)
    for j1 in l:
        print(j1)
else:
    for j2 in range(A, A+K):
        print(j2)
    for j3 in range(B-K+1, B+1):
        print(j3)

Measured memory_bytes: 3060
N, M, L = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]
B = [list(map(int, input().split())) for _ in range(M)]

C = [[0] * L for _ in range(N)]
for i in range(N):
    for j in range(L):
        for k in range(M):
            C[i][j] += B[k][j] * A[i][k]
[print(*c) for c in C]


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

static const int N = 101;

int main(){
    //配列mにはn以下の行列連鎖積の最小回数が格納される
    int n,p[N],m[N][N];
    cin >> n;
    for(int i=1;i<=n;i++)
        cin >> p[i-1] >> p[i];
    //初期化
    for(int i=1;i<=n;i++) m[i][i] = 0;
    for(int l=2;l<=n;l++){
        for(int i=1;i<=n-l+1;i++){
            //i,j,kは行列の範囲を表す
            //i<=k<j
            int j = i+l-1;
            m[i][j] = (1 << 21);
            for(int k=i;k<=j-1;k++)
            m[i][j] = min(
                m[i][j],
                m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]
            );
        }
    }
    cout << m[1][n] << endl;
}



Measured memory_bytes: 3120
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<ll>
#define vvint vector<vint>
#define P pair<int,int>
#define INT_MAX 2147483647
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(void) {
	int n, m; cin >> n >> m;
	vint x(n, -1);

	rep(i, m) {
		int s, c;
		cin >> s >> c;
		s--;
		if (x[s] == -1 || x[s] == c) {
			x[s] = c;
		}
		else {
			cout << -1 << endl;
			return 0;
		}
	}
	if (n != 1 && x[0] == 0) {
		cout << -1 << endl;
		return 0;
	}


	rep(i, n) {

		if (x[i] == -1) {
			if (i == 0&&n!=1) {
				x[i] = 1;
			}
			else {
				x[i] = 0;
			}
		}
	}

	rep(i, n) {
		cout << x[i];
	}
	cout << endl;
	return 0;
}



Measured memory_bytes: 256