akhauriyash/Code-Regression huggingface dataset:
//#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

#define PI = 3.1415

int main() {
	int r; cin >> r;
	cout << 2 * r * 3.141592 << endl;
	return 0;
}

Measured memory_bytes: 3764
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    c=0
    for i in range(1,n-1):
        for j in range(i+1,n):
            for k in range(j+1,n+1):
                if i!=j and j!=k and k!=i and i+j+k==x:
                    c+=1
    print(c)    


Measured memory_bytes: 5596
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long ans = n * (n+1) / 2;
        long num3, num5, num15;
        num3 =  n / 3;
        num5 = n / 5;
        num15 = n / 15;
        long sub = 3*(num3+1)*num3/2 + 5 * (num5+1)*num5/2 - 15*(num15+1)*num15/2;
        ans -= sub;
        System.out.println(ans);
    }
}

Measured memory_bytes: 35540
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

string s;

void input(){
    cin >> s;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    int cnt = 0;
    for(int i=0;i<s.size();i++){
        if(s[i] == 'o') cnt++;
    }
    cout << 700 + 100 * cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.card0500", "r", stdin );
	string str = "";
	int n;

	while (getline (cin, str ) ){
		stringstream ssn(str);
		ssn >> n;
		if (n == 0 ){
			break;
		} // end if
		int sumA = 0, sumB = 0;
		int i;

		for (i = 0; i < n; ++i){
			int cardA = 0, cardB = 0;
			getline (cin, str );
			stringstream ss(str);
			
			ss >> cardA >> cardB;
			if (cardA > cardB ){
				sumA += (cardA + cardB);
			}else if (cardA < cardB){
				sumB += (cardA + cardB);
			}else{
				sumA += cardA;
				sumB += cardB;
			} // end if
		} // end for
		cout << sumA << ' ' << sumB << endl;

	} // end loop
	
	return 0;
}

Measured memory_bytes: 0
sums = {}
(0..9).each do |a|
  (0..9).each do |b|
    sums[a+b] = sums[a+b] ? sums[a+b] + 1 : 1
  end
end

while line = gets
  n = line.to_i
  count = 0

  sums.each do |sum, c|
    remain = n - sum
    count += (c * sums[remain]) if sums.key?(remain)
  end

  puts count
end

Measured memory_bytes: 8644
#include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<queue>
#include<deque>
#include<stack>
#include<bitset>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;

int main(){
	int n;
	scanf("%d ",&n);
	for(int x=0;x<n;++x){
		string line;
		getline(cin,line);
		while (line.find("Hoshino") != string::npos) {
            		line.replace(line.find("Hoshino"), 7, "Hoshina");
       		}	
		cout<<line<<endl;	
	}
	return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <string>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int n;

void dfs(string normal, char max_char) {
	if (normal.size() == n) {
		cout << normal << "\n";
	} else {
		char c;
		for (c = 'a'; c < max_char; ++c) {
			dfs(normal + c, max_char);
		}

		dfs(normal + c, (char) (c + 1));
	}
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	cin >> n;

	dfs("", 'a');

	return 0;

}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.first,", ",x.second,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;
// vertex, cost
using vertex = pair<ll, ll>;
using edge = tuple<ll, ll, ll>;
vector<vector<edge>> graph;

int main() {
    // ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll N, M, S; cin >> N >> M >> S;
	S = min(S, 50 * 100LL);
	graph.resize(N);
	F0R(i, M) {
		ll U, V, A, B; cin >> U >> V >> A >> B;
		--U; --V;
		graph[U].push_back(make_tuple(V, A, B));
		graph[V].push_back(make_tuple(U, A, B));
	}
	vll CS(N);
	vll DS(N);
	F0R(i, N) {
		cin >> CS[i];
		cin >> DS[i];
	}
	map<vertex, ll> dist;
	using info = pair<ll, vertex>;
	priority_queue<info, vector<info>, greater<info>> q;
	q.push({0, {0, S}});
	while (!q.empty()) {
		vertex v = q.top().second;
		ll d = q.top().first;
		q.pop();
		if (d != dist[v]) continue;
		// print("SEARCHING", v);
		ll pos = v.first;
		ll sum = v.second;
		// top up
		if (sum + CS[pos] <= 50 * 100) {
			vertex nv = {pos, sum + CS[pos]};
			if ((dist.find(nv) == dist.end()) || (d + DS[pos] < dist[nv])) {
				dist[nv] = d + DS[pos];
				q.push({dist[nv], nv});
			}
		}
		for (edge e : graph[pos]) {
			ll nnv, a, b;
			nnv = get<0>(e);
			a = get<1>(e);
			b = get<2>(e);
			if (sum >= a) {
				vertex nv = {nnv, sum-a};
				if ((dist.find(nv) == dist.end()) || (d + b < dist[nv])) {
					dist[nv] = d + b;
					q.push({dist[nv], nv});
				}
			}
		}
	}

	vll best (N, INF);
	for (pair<vertex, ll> i : dist) {
		best[i.first.first] = min(best[i.first.first], i.second); 
	}

	FOR(i,1, N) print(best[i]);
}

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

using namespace std ; 

#define N 500
#define ll long long
const ll mod = 1e9+7 ; 

ll n , m ;
ll a[ N ] , b[ N ] ;
ll sum[ N ][ N ] , l[ N ][ N ] ;
ll f[ N ][ N ] ;
//f[ i ][ j ]前i个人一共分了j个糖果 
//l[ i ][ j ]储存i的j次方
//sum[ i ][ j ]对l维护前缀和 

int main() {
    scanf( "%lld%lld" , &n ,&m ) ;
    for( int i = 1 ; i <= n ; i ++ ) {
        scanf( "%lld" , &a[ i ] ) ;
    }
    for( int i = 1 ; i <= n ; i ++ ) {
        scanf( "%lld" , &b[ i ] ) ;
    }
    for( int i = 1 ; i < N ; i ++ ) {
        l[ i ][ 0 ] = 1 ;
        for( int j = 1 ; j < N ; j ++ ) {
            l[ i ][ j ] = l[ i ][ j - 1 ] * i  ;
            l[ i ][ j ] %= mod ;
        }
    }
    for( int i = 1 ; i < N ; i ++ ){
        for( int j = 0 ; j < N ; j ++ ) {
            sum[ i ][ j ] += sum[ i - 1 ][ j ] + l[ i ][ j ] ;
            sum[ i ][ j ] %= mod ;
        }
    } 
    f[ 0 ][ 0 ] = 1 ;
    for( int i = 1 ; i <= n ; i ++ ) {
        for( int j = 0 ; j <= m ; j ++ ) {
            for( int k = 0 ; k <= j ; k ++ ) {
                f[ i ][ j ] = ( f[ i ][ j ] % mod + ( 1ll * f[ i - 1 ][ j - k ] *( ( sum[ b[ i ] ][ k ] - sum[ a[ i ] - 1 ][ k ] ) % mod )  + mod ) % mod + mod ) % mod  ;
            }
        } 
    } 
    printf( "%lld\n" , f[ n ][ m ] ) ;
    return 0 ;
} 

Measured memory_bytes: 5760
import java.util.Scanner;;

public class Main {
static int []iw;
static int[]iv;
static int n;
static int w;
static long[][]memo;

public static long val(int in,int rw) {
	if(in==n||rw<=0)
		return 0;
	if(iw[in]>rw)
		return memo[in][rw]=val(in+1,rw);
	if(memo[in][rw]!=-1)
		return memo[in][rw];
	return memo[in][rw]=Math.max(val(in+1,rw),iv[in]+val(in+1,rw-iw[in]));
}

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		w=sc.nextInt();
		iw=new int[n];
		iv=new int[n];
		for(int i=0;i<n;i++) {
			iw[i]=sc.nextInt();
			iv[i]=sc.nextInt();
		}
		memo=new long[n][w+1];
		for(int i=0;i<n;i++)
			for(int j=0;j<w+1;j++)
				memo[i][j]=-1;
		System.out.println(val(0,w));
		
		
		sc.close();
	}

}


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

#define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define ALL(v) begin(v), end(v)

/* REPmacro */
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (s); i >= (n); i--)
#define rep(i, n) FOR(i, 0, n)
#define repi(i, n) FOR(i, 1, n + 1)
#define rrep(i, n) RFOR(i, n - 1, 0)
#define rrepi(i, n) RFOR(i, n, 1)

/* debug */
#define pp(v) cerr << #v "=" << (v) << endl;

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using vs = vector<string>;
using Graph = vvi;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* iostream */
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
#define UNIQUE(v) v.erase( unique(ALL(v)), v.end() );
#define TIME system("date +%M:%S.%N")
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }
template<class T> T div_ceil(const T &a, const T &b) { return (a + b - 1) / b; }

signed main() {
  int n,k;cin>>n>>k;
  vector<pii> c(n);
  rep(i,n) {
    int a,b;cin>>a>>b;
    c[i] = mp(a,b);
  }
  sort(ALL(c));
  int ans = -1;
  rep(i,n) {
    int a,b;tie(a,b)=c[i];
    k-=b;
    if (k > 0) continue;
    ans = a;
    break;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int n;
    cin >> n;
    map<ll,ll> m;
    ll sum = 0;
    rep(i,n){
        int a;
        cin >> a;
        sum += a;
        m[sum]++;
    }
    ll ans = 0;
    for(auto t : m){
        if(t.first==0){
            ans += (t.second+1)*t.second/2;
        }else if(t.second>=2){
            ans += (t.second-1) * t.second /2;
        }
    }
    cout << ans << endl;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

const int M = 200000;
int n, a[M], b[M], aa[M], bb[M];

int main() {
	cin >> n;
	inc(i, n) { cin >> a[i]; }
	inc(i, n) { cin >> b[i]; }
	
	int ans = 0;
	inc(k, 28 + 1) {
		inc(i, n) {
			aa[i] = a[i] % (1 << (k + 1));
			bb[i] = b[i] % (1 << (k + 1));
		}
		sort(aa, aa + n);
		sort(bb, bb + n, greater<>());
		
		int c = 0, p1 = 0, p2 = 0, p3 = 0;
		inc(i, n) {
			while(p1 < n && aa[i] + bb[p1] >= (1 << k)) { p1++; }
			while(p2 < n && aa[i] + bb[p2] >= (2 << k)) { p2++; }
			while(p3 < n && aa[i] + bb[p3] >= (3 << k)) { p3++; }
			c ^= (p1 - p2 + p3) & 1;
		}
		ans |= c << k;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3328
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""078-a"""

import sys
import pprint
import re

import itertools
pp = pprint.PrettyPrinter(indent=2)

def main():
    """Main function."""
    x, y = list(map(ord, input().split(' ')))

    if x > y:
        print('>')
    elif x < y:
        print('<')
    else:
        print('=')


if __name__ == '__main__':
    sys.exit(main())

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

dp = [0] * (N+1)
for i in range(1, N+1):
    dp[i] = dp[i-1]
    if i > 1:
        dp[i] += 1 if S[i-1] == 'C' and S[i-2] == 'A' else 0

for _ in range(Q):
    l, r = map(int, input().split())
    ans = dp[r] - dp[l]
    print(ans)


Measured memory_bytes: 7668
#include <string>
#include <iostream>
#include <math.h>
#include <vector>
#include <cstdio>
#include <algorithm>
using namespace std;
void out(int *,int);
int main(){
    int n,a[101],count=1;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    out(a,n);
    while(true){
        if(count==n)break;
        for(int j=count;j>0;j--){
            if(a[j]<a[j-1])swap(a[j],a[j-1]);
        }
        for(int k=0;k<n;){
            cout<<a[k];
            k++;
            if(k!=n)cout<<" ";
        }
        cout<<endl;
        count++;
    }
    return 0;
}

void out(int *line,int n){
    for(int i=0;i<n;++i){
        cout<<line[i];
        if(i+1==n){
            cout<<endl;
        }else{
            cout<<" ";
        }
    }
}


Measured memory_bytes: 3104
import java.util.Scanner;

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

		int ai = Integer.parseInt(a);
		int bi = Integer.parseInt(b);
		int ci = Integer.parseInt(c);

		if (ai > bi) {
			int z = ai;
			ai = bi;
			bi = z;
		}

		if (bi > ci){
			int z = bi;
			bi = ci;
			ci = z;
		}

		if (ai > bi) {
			int z = ai;
			ai = bi;
			bi = z;
		}
		
		System.out.println(ai + " " + bi + " " + ci);
	}
}

Measured memory_bytes: 25996
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<Pll> a(n);
    rep(i,n){
        ll t; cin >> t;
        a[i] = {t, i};
    }
    sort(all(a));
    set<ll> st;
    ll ans = 0;
    rep(i,n){
        auto p = st.insert(a[i].second);
        ll l, r;
        if(p.first == st.begin()){
            l = 0;
        }
        else{
            l = *(--p.first) + 1;
            p.first++;
        }
        if(p.first == --st.end())r = n-1;
        else r = *(++p.first) - 1;
        ans += a[i].first * (a[i].second - l + 1) * (r - a[i].second + 1);
        // debug(l);debug(r);debug(ans);
    }

    cout << ans << endl;
}

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

int main ()
{
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	string str1;
	string str2;
	int c = 0;
	cin >> str1 >> str2;
	for (int i = 0; i < str1.size(); i++)
		if (str1[i] != str2[i])
		{
			c++;
		}
	cout << c << "\n";
	return 0;
}

Measured memory_bytes: 3804
#!/usr/bin/env python3
# TLE解
from collections import deque

n, x, y = map(int, input().split())
to = [[] for _ in range(n)]
for i in range(n):
    if i == 0:
        to[i].append(i+1)
    elif i == n-1:
        to[i].append(i-1)
    else:
        to[i].append(i+1) 
        to[n-i-1].append(n-i-2)
to[x-1].append(y-1)
to[y-1].append(x-1)

ans = [0 for _ in range(n)]

# 頂点'start'からBFS
def bfs(start):
    inf = 1001001001
    dist = [inf for _ in range(n)]
    q = deque()
    q.append(start)
    dist[start] = 0 

    while q:
        v = q.popleft()
        for u in to[v]:
            if dist[u] == inf:
                dist[u] = dist[v]+1
                q.append(u)
    # print('start = ', start, ': dist = ', dist)

    # for k in range(1, n):
    #     for i in range(n):
    #         if dist[i]-dist[start] == k:
    #             ans[k-1] += 1

    for i in range(n):
        ans[dist[i]] += 1
    
for i in range(n):
    bfs(i)
for i in range(1, n): 
    print(ans[i]//2)


Measured memory_bytes: 4204
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N, M;
    scanf("%d%d", &N, &M);
    priority_queue<int, vector<int>, greater<int>> que;
    REP(i, N) {
        int tmp;
        scanf("%d", &tmp);
        que.push(tmp);
    }
    vector<int> B(M), C(M);
    vector<pair<int, int>> D(M);
    for(int i = 0; i < M; ++i) {
        scanf("%d%d", &B[i], &C[i]);
        D[i] = make_pair(C[i], B[i]);
    }
    sort(D.begin(), D.end(), greater<pair<int, int>>());
    int small = que.top();
    REP(i, M) {
        int cnt = 0;
        while(small < D[i].first) {
            if(cnt < D[i].second) {
                cnt++;
                que.pop();
                que.push(D[i].first);
                small = que.top();
            } else {
                break;
            }
        }
    }
    long long ans = 0;
    REP(i, N) {
        ans += que.top();
        que.pop();
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 2296
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input!{
        n: usize,
        a: usize,
        b: usize,
        c: usize,
        d: usize
    }
    let m = 1000000007;
    let mut stairs = vec![1; n + 1];
    for i in 1..n + 1 {
        stairs[i] = stairs[i-1] * i % m;
    }
    let stairs_i: Vec<usize> = stairs.iter().map(|&x| inv_m(x, m)).collect();
    let mut v: Vec<Vec<usize>> = vec![vec![0; n + 1]; b + 1];
    for i in 0..a {
        v[i][0] = 1;
    }
    for i in a..b + 1 {
        v[i][0] = 1;
        for j in 1..n + 1 {
            v[i][j] = v[i - 1][j];
            for k in c..std::cmp::min(d, j / i) + 1 {
                v[i][j] += v[i - 1][j - k * i] * stairs[n + i * k - j] % m * stairs_i[n - j] % m * stairs_i[k] % m * pow_m(stairs_i[i], k, m) % m;
            }
            v[i][j] %= m;
        }
    }
    println!("{}", v[b][n]);
}

fn pow_m(n: usize, mut p: usize, d: usize) -> usize {
    let mut r = n;
    let mut ret = 1;
    while p > 0 {
        if p % 2 == 0 {
            r = r * r % d;
            p /= 2;
        } else {
            ret = ret * r % d;
            p -= 1;
        }
    }
    ret
}

fn inv_m(n: usize, d: usize) -> usize {
    pow_m(n, d - 2, d)
}


Measured memory_bytes: 12540
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for (int i = (s); i < (int)(n); i++)
#define INF 100000000

using namespace std;

int main() {
   int n;
   cin >> n;
   int ans = INF;
   rep(i,n){
     int a;
     cin >> a;
     int c = 0;
     while(a%2==0){
       a/=2;
       c++;
     }
      ans = min(ans,c);
   }
   cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;
public class Main {
    public static void main (String args[]) throws IOException {
    	Scanner sc = new Scanner(System.in);
    	StringBuilder sb = new StringBuilder();
    	double b = sc.nextDouble();
    	double x=Math.PI;
    	double a = b*2*x;
    	double c = b*b*x;
    	sb.append(String.format("%6.6f",c)).append(" ").append(String.format("%6.6f",a));
    	System.out.print(sb);
    }
}

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
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...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    int cnt = 0;
    REP(i, 0, n) {
        int a;
        cin >> a;
        cnt += (a >= k);
    }
    cout << cnt << endl;
    return 0;
}


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

using namespace std;

int main(){
    int x,y,z,t;
    cin>>x>>y>>z;
    
    t=x;
    x=y;
    y=t;
    
    t=x;
    x=z;
    z=t;
    
    cout<<x<<' '<<y<<' '<<z<<endl;
}

Measured memory_bytes: 3576
#include<iostream>
#include<cctype>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
    char s[100];
    char p[100];
    char s2[200];
    cin >> s >> p;
   
    
    strcpy(s2,s);
    strcat(s2,s);
    
    if(strstr(s2,p)){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int n,m,l[105],now,ans,cnt,d[105];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>l[i];
	d[1]=0;
	for(int i=2;i<=n+1;i++)
		d[i]=d[i-1]+l[i-1];
	for(int i=1;i<=n+1;i++)
		if(d[i]<=m) ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <numeric>


int main()
{
	int a, b, c;

	std::cin >> a >> b >> c;

	if (a == b) {
		std::cout << c << std::endl;
	}
	else if (b == c) {
		std::cout << a << std::endl;
	}
	else {
		std::cout << b << std::endl;
	}
	return 0;

}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
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);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

void expr() {
    int N, K; cin >> N >> K;

    vector<int> A(N+1);
    for(int i=1; i<=N; i++) {
        int f = i / K;
        vector<int> a;
        for(int j=1; j<=min(i, f); j++) {
            a.emplace_back(A[i-j]);
        }
        sort(a.begin(), a.end());
        
        int ptr = 0, n;
        for(n=0; ; n++) {
            int c = 0;
            while(ptr < a.size() and a[ptr] == n) c++, ptr++;
            if(c == 0) break;
        }
        A[i] = n;
    }

    /*
    vector< vector<int> > lis(N+1);
    for(int i=0; i<=N; i++) {
        lis[ A[i] ].emplace_back(i);
    }
    for(int i=0; i<=N; i++) {
        printf("%2d:", i);
        for(auto e : lis[i]) cerr << " " << e;
        cerr << endl;
    }
    */

    
    for(int i=0; i<=N; i++) {
        cerr << A[i] << " ";
        if((i+1) % K == 0) cerr << endl;
    }
    cerr << endl;
}

int solve(ll A, ll K) {
    if(A % K == 0) return A / K;
    if(A >= K*K) return solve(A - A/K - 1, K);

    ll lim = A/K*K, sub = A - lim;
    ll div = (sub + A/K) / (A/K + 1);
    return solve(A - div * (A/K + 1), K);
}

int main() {
    // expr();
    // return 0;
    
    int N; cin >> N;
    vector<int> A(N), K(N);
    for(int i=0; i<N; i++) cin >> A[i] >> K[i];

    int grundy = 0;
    for(int i=0; i<N; i++) {
        int g = solve(A[i], K[i]);
        grundy ^= g;
        // fprintf(stderr, "%d: %d\n", i, g);
    }
    cout << (grundy ? "Takahashi" : "Aoki") << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
void solve()
{
    cin>>s;
    int ans=0,cnt=1;
    for(int i=0;i<3;++i)
	{
        if(s[i]!= 'R')
            continue;
        for(int j=i+1;j<3&&s[j]=='R';++j)
            cnt++;
        ans=max(ans,cnt);
        cnt=1;
    }
    cout<<ans<<endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    int t=1;
    while(t--)
        solve();
    return  0;
}


Measured memory_bytes: 3640
#include<stdio.h>
#include<ctype.h>
int main(void){
   char w[11];
   char t[1001];
   char s[12];
   int n;
   int i,tl;
 
   scanf("%s",w);
   scanf("%s",t);
   sprintf(s,"END_OF_TEXT");
 
   n=0;
 
   while(strcmp(t,s)){
      tl = strlen(t);
      for(i=0;i<tl;i++){
         t[i]=tolower(t[i]);
      }
      if(!strcmp(t,w))n++;
      scanf("%s",t); 
   }
   printf("%d\n",n);
 
   return 0;
}


Measured memory_bytes: 2044
/*author : Yashvardhan
Saturday, January 12, 2019
*/
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int dp[101][100005];
int wi[101];
int vs[101];

int pow(int a, int b, int m)
{
	int ans = 1;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int solve(int n,int w){
	if(dp[n][w] != -1) return dp[n][w];
	if(n == 0) return dp[n][w] = 0;
	if(wi[n] > w) return dp[n][w] = solve(n-1,w);
	else return dp[n][w] = max(solve(n-1,w),vs[n]+solve(n-1,w-wi[n]));
}

signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	int n,w1;
	cin>>n>>w1;

	for(int i = 1; i <= n ; i++){
		int w,v;
		cin>>w>>v;
		wi[i] = w; vs[i] = v;
	}
	
	for(int i = 0; i < 101 ; i++){
		for(int j = 0;j<=100000;j++){
			dp[i][j] = -1;
		}
	}

	cout<<solve(n,w1)<<endl;
	t2 = clock();
	cerr<<endl<<t2-t1<<endl;
	
	return 0;
}



Measured memory_bytes: 79232
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int range = 0;
		int time = 0;
		while (x > range) {
			time++;
			range += time;
		}
		System.out.println(time);
	}

}

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

const int INF = 1001001001;
const vector<int> di = {-1,0,1,0};
const vector<int> dj = {0,-1,0,1};

int main(){
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i,h) cin >> s.at(i);
  int ans = 0;
  rep(si,h)rep(sj,w){
  if (s.at(si).at(sj) == '#') continue;
    vector<vector<int>> dist(h, vector<int>(w,INF));
    queue<P> q;
    auto update = [&](int i, int j, int x){
      if (dist.at(i).at(j) != INF) return;
      dist.at(i).at(j) = x;
      q.push(P(i,j));
    };
    update(si,sj,0);
    while (!q.empty()){
      int i = q.front().first;
      int j = q.front().second; q.pop();
      rep(dir,4){
      int ni = i+di.at(dir), nj = j + dj.at(dir);
        if(ni<0||ni>=h||nj<0||nj>=w) continue;
        if(s.at(ni).at(nj) == '#') continue;
        update(ni,nj,dist.at(i).at(j)+1);
      }
    }
    rep(i,h)rep(j,w){
    if(dist.at(i).at(j) == INF) continue;
      ans = max(ans,dist.at(i).at(j));
    }
  }
  cout << ans << endl;
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char S[15], T[15];
int p, q, flag;
int main(){
	cin>> S>> T;
	p= strlen(S);
	q= strlen(T);
	for(int i=0; i<=p-1; i++){
		if(S[i]==T[i] && q==p+1){
			flag= 0;
		}else{
			flag= 1;
			break;
		}
	}
	if(flag==1) cout<< "No";
	else cout<< "Yes";
	return 0;
}

Measured memory_bytes: 3588
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<bitset>
using namespace std;
typedef long long ll;
#define mp make_pair
inline int ri()
{
	register int x=0;
	bool f=0;
	register char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')	f=1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		x=(x<<3)+(x<<1)+ch-'0';
		ch=getchar();
	}
	if(f)	return -x;
	else	return x;
}
void wi(int x)
{
	if(x<0)	putchar('-'),x=-x;
	if(x>9)	wi(x/10);
	putchar(x%10+'0');
}
const int N=2020,K=10005;
string str[N];
bitset<K> can[N];
pair<int,int> t,pos[2][1000005];
char ans[K];
int main()
{
//	freopen("test.in","r",stdin); 
	int n=ri(),k=ri(),i,cnt0=0,cnt1=0,cur=0,mn,ch,len,time=0;
	for(i=1;i<=n;i++) cin>>str[i];
	can[n+1][0]=1;
	for(i=n;i>=1;i--) can[i]=can[i+1]|(can[i+1]<<(str[i].length()));
//	for(i=1;i<=n;i++) if(can[i+1][k-str[i].length()]) pos[cur][++cnt0]=mp(i,0),printf("push i=%d\n",i);
	for(i=1;i<=n;i++) if(can[i+1][k-str[i].length()]) pos[cur][++cnt0]=mp(i,0);
	for(len=1;len<=k;len++)
	{
		ch='z';cnt0=min(cnt0,k+2);
		for(i=1;i<=cnt0;i++)
		{
			time++;
			t=pos[cur][i];
			ch=min(ch,(int)str[t.first][t.second]);
		}
		ans[len]=ch;cnt1=0;mn=1e9;
		for(i=1;i<=cnt0;i++)
		{
			time++;
			t=pos[cur][i];
			if(str[t.first][t.second]!=ch) continue;
			if(t.second==str[t.first].length()-1)	mn=min(mn,t.first+1);
			else	pos[cur^1][++cnt1]=mp(t.first,t.second+1);
		}
		for(i=mn;i<=n;i++,time++)
			if(len+str[i].length()<=k&&can[i+1][k-len-str[i].length()])	pos[cur^1][++cnt1]=mp(i,0);
		cur^=1;cnt0=cnt1;
	}
	cout<<ans+1;
//	cout<<ans+1<<endl<<time;
	return 0;
}

Measured memory_bytes: 7424
NM = input().split() #N 個の展望台 M本の道
N = int(NM[0])
M = int(NM[1])

H = [] #展望台の高さ
H = input().split()

R =[True]*(N+1)
R[0]=False


for i in range(M):
  tmp = input().split()
  tmp_int = [0,0]
  tmp_int[0] = int(tmp[0])
  tmp_int[1] = int(tmp[1])
  if  int(H[tmp_int[0]-1]) >= int(H[tmp_int[1]-1]):
    R[tmp_int[1]]=False
  if int(H[tmp_int[0]-1]) <= int(H[tmp_int[1]-1]):
    R[tmp_int[0]]=False
    
print(R.count(True))

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

using namespace std;

#define int long long

int N;
int A[200010];
int ans;
multiset<int> ms;

signed main() {
	
	scanf("%d", &N);
	for (int i = 1; i <= N; i++)
		scanf("%d", &A[i]);
	
	sort(A + 1, A + N + 1);
	
	for (int i = 1; i <= N; i++)
		ms.insert(A[i]);
	
	while (! ms.empty()) {
		int tmp = *ms.rbegin();
		int cnt = 1;
		ms.erase(ms.find(tmp));
		while (cnt <= tmp)
			cnt *= 2;
		int x = cnt - tmp;
		multiset<int>::iterator it = ms.find(x);
		if (it == ms.end()) continue;
		ms.erase(it);
		ans++;
	}
	
	printf("%d\n", ans);
	
	return 0;
	
}

Measured memory_bytes: 11136
import math
while True:
    w,l,h = map(int, raw_input().split())
    if w == 0:
        break
    d = [math.sqrt(w**2+l**2), math.sqrt(l**2+h**2), math.sqrt(h**2+w**2)]
    m = min(d)
    n = int(raw_input())
    for i in range(n):
        r = int(raw_input())
        if 2*r > m:
            print "OK"
        else:
            print "NA"

Measured memory_bytes: 4356
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int main() {
    ll N, C;
    cin >> N >> C;
    vector<ll> x(N), v(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> v[i];
    }
    vector<ll> left(N), right(N);
    left[0] = v[0];
    right[N - 1] = v[N - 1];
    for (int i = 1; i < N; i++) {
        left[i] = left[i - 1] + v[i];
    }
    for (int i = N - 2; i >= 0; i--) {
        right[i] = right[i + 1] + v[i];
    }
    vector<ll> a(N, 0), b(N, 0);
    a[0] = max(0LL, left[0] - x[0]);
    for (int i = 1; i < N; i++) {
        a[i] = max(a[i - 1], left[i] - x[i]);
    }
    b[N - 1] = max(0LL, right[N - 1] - (C - x[N - 1]));
    for (int i = N - 2; i >= 0; i--) {
        b[i] = max(b[i + 1], right[i] - (C - x[i]));
    }
    ll ans = 0LL;
    for (int i = 0; i < N; i++) {
        ans = max(ans, left[i] - x[i]);
        if (i != N - 1) {
            ans = max(ans, left[i] - x[i] * 2 + b[i + 1]);
        }
    }
    for (int i = N - 1; i >= 0; i--) {
        ans = max(ans, right[i] - (C - x[i]));

        if (i != 0) {
            ans = max(ans, right[i] - (C - x[i]) * 2 + a[i - 1]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992
while True:
    try:
        a = [a for a in input().split()]
        b = [b for b in input().split()]
    except:
        break
    
    hit = 0
    blow = 0
    
    for i in range(4):
        if b[i] in a :
            blow += 1
            if b[i]==a[i]:
                hit += 1
    
    blow = blow-hit
    print(hit,blow)


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

int gcd(int x,int y){
    return (x % y)? gcd(y, x % y) : y;
}
int main() {
    int n, a, sum; cin >> n;
    sum = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            for(int o = 1; o <= n; o++){
                a = gcd(gcd(i , j) , o);

                sum = sum + a;
            }
        }
    }
    cout << sum << endl;
    

}

Measured memory_bytes: 3584
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std; 
int main(){
    int a;
    cin>>a;
    if (a<4) {cout<<"No"<<endl;
    return 0;}
    while (a!=0)
    {
       if (a%7==0) {cout<<"Yes"<<endl;return 0;}
       a-=4;
       if (a<4 && a>0) {cout<<"No"<<endl;return 0;}
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	int n,m,x,y;
	cin >> n >> m >> x >> y;
	int a[n];
	int b[m];

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

	for(int i=0 ; i<m ; i++)
		cin >> b[i];
	
	int ans = max(*max_element(a , a+n),x) - min(*min_element(b,b+m) , y);

	if(ans <= -1)
		cout << "No War";
	else
		cout << "War";

	return 0;
}

Measured memory_bytes: 256
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/
auto cmx=[](auto&x,auto y){if(x<y){x=y;return true;}return false;};
int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    usize n, k;
    std::cin >> n >> k;
    k--;
    vec<i64> pos, neg;
    usize zero = 0;
    for (usize i=0; i<n; i++) {
        i64 x;
        std::cin >> x;
        if (0<x) pos.push_back(x);
        if (x<0) neg.push_back(-x);
        if (x==0) zero++;
    }
    std::sort(ALL(pos));
    std::sort(ALL(neg));

    auto ans = [&]() -> i64 {
        usize base0 = pos.size() * neg.size();
        if (k < base0) {
            auto count_ge = [&](i64 X) {
                i64 ans = 0;
                for (i64 x: pos) {
                    // ceil(X/x) <= y
                    ans += neg.end() - std::lower_bound(ALL(neg), (X+x-1)/x);
                }
                return ans;
            };
            i64 l = 0, r = pos.back()*neg.back()+1;
            while (1<r-l) {
                i64 c = (l + r) / 2;
                (k+1 <= count_ge(c) ? l : r) = c;
            }
            return -l;
        }
        k -= base0;

        usize base1 = (zero*(zero-1)/2 + zero*(pos.size()+neg.size()));
        if (k<base1) return 0;
        k -= base1;

        auto count_le = [&](i64 X) {
            i64 ans = 0;
            for (auto&& v: {pos, neg}) {
                for (i64 x: v) {
                    // y <= floor(X/x);
                    ans += std::upper_bound(ALL(v), X/x) - v.begin();
                }
                for (i64 x: v) {
                    ans -= x*x <= X;
                }
            }
            assert(ans%2==0);
            ans /= 2;
            return ans;
        };
        i64 l = 0, r = std::max(
            pos.empty() ? 0ll : pos.back()*pos.back(),
            neg.empty() ? 0ll :  neg.back()*neg.back()) + 1;
        while (1<r-l) {
            i64 c = (l + r) / 2;
            (k+1 <= count_le(c) ? r : l) = c;
        }
        return r;
    }();

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


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


int main() {
  int N, M;
  cin >> N;
  vector<string> b(N);
  for(int i = 0; i < N; ++i) {
    cin >> b[i];
  }

  cin >> M;
  vector<string> r(M);
  for(int i = 0; i < M; ++i) {
    cin >> r[i];
  }

  map<string, int> score;
  
  for(int i = 0; i < N; ++i) {
    ++score[b[i]];
  }
    for(int i = 0; i < M; ++i) {
    --score[r[i]];
  }
  int res = 0;

  for(auto x = score.begin(); x != score.end(); ++x) {
    if(x->second > res) {
      res = x->second;
    } 
  }
  cout << res << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;                                                            
#define pb push_back                                                            
#define mp make_pair                                                                                                                                
#define sqr(a) ((a) * (a))                                                      
#define io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);   
#define co() cout.precision(10);                                                
#define F for(li i=0;i<n;i++)
#define fo(i,a,n) for(i=a;i<n;i++)
#define ne cout<<"\n"; 
#define test int t;cin>>t;while(t--)
//#define oj #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif

typedef long long li;
typedef long double ld;

const li mod = 1000000007;

int main() 
{
    io();
    string s,t;
    cin>>s>>t;
    li c=0;
    for(li i=0;i<s.length();i++)
    {
    	if(s[i]!=t[i])c++;
	}
	cout<<c;
}


Measured memory_bytes: 3804
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
 
#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define ps(x) printf("%s\n", x)
 
#define INF 100000000000
#define MOD 1000000007
 
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
 
long path[401][401];
 
void init() {
	long i, j;
	
	for(i=1;i<=400;i++) {
		for(j=1;j<=400;j++) {
			if(i == j) {
				path[i][j] = 0;
			} else {
				path[i][j] = INF;
			}
		}
	}
}
 
int main() {
	long N, M;
	long a[1001], b[1001], c[1001];
	long i, j, k;
	long tmp;
	long ans;
	
	init();
	
	sl(N); sl(M);
	ans = M;
	for(i=1;i<=M;i++) {
		sl(a[i]); sl(b[i]); sl(c[i]);
		path[a[i]][b[i]] = c[i];
		path[b[i]][a[i]] = c[i];
	}
	
	for(i=1;i<=N;i++)
		for(j=1;j<=N;j++)
			for(k=1;k<=N;k++)
				path[j][k] = MIN(path[j][k], path[j][i] + path[i][k]);
	
	for(k=1;k<=M;k++) {
		/*
		for(i=1;i<=N;i++) {
			if(path[i][a[k]] + c[k] == path[i][b[k]]) {
				ans--;
				break;
			}
		}
		*/
		for(i=1;i<N;i++) {
			for(j=i+1;j<=N;j++) {
				if(path[i][j] == path[i][a[k]] + path[b[k]][j] + c[k] || path[j][i] == path[j][a[k]] + path[b[k]][i] + c[k]) {
					ans--;
					goto NEXT;
				}
			}
		}
	  NEXT:;
	}
	
	pl(ans);
	
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int ar[100010], N, K, dp[100010], ans;
int solve(int ind)
{
    if(ind==N-1)
        return 0;
    if(dp[ind]!=-1)
        return dp[ind];
    int ans = solve(ind+1)+abs(ar[ind+1]-ar[ind]);
    if(K>1)
    {
        for(int i=1;i<=K;i++)
            if(ind+i<N)
                ans = min(ans,solve(ind+i)+abs(ar[ind+i]-ar[ind]));
    }
    return dp[ind] = ans;
}
int main()
{
    cin >> N >> K;
    memset(dp, -1, sizeof(dp));
    for(int i=0;i<N;i++)
        cin >> ar[i];
    cout << solve(0) << endl;
    return 0;
}



Measured memory_bytes: 10520