akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<queue>
#include<memory>
#include<map>
#include<set>
#include<unordered_map>
#include<array>
#include<vector>
#include<algorithm>
#include<list>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<string>
#include<thread>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;

const ll MOD = 1000000007;

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

	int ans = max(A + B, A - B);
	cout << max(ans, A*B) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;

const string YES = "Yes";
const string NO = "No";

void solve(long long H, long long N, std::vector<long long> A){
	for(auto v:A){
		H-=v;
	}
	if(H<=0){
		cout << YES << endl;
	}
	else{
		cout << NO << endl;
	}

}

int main(){
    long long H;
    scanf("%lld",&H);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(H, N, std::move(A));
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) for(int sz=0;sz<int(vec.size());sz++) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t; cin >> s >> t;
    int ns = s.size(), nt = t.size();
    int ans = INF;
    for (int i = 0; i < ns - nt + 1; i++) {
        int tmp = 0;
        for (int j = 0; j < nt; j++) {
            tmp += (s[i + j] != t[j] ? 1 : 0);
        }
        chmin(ans, tmp);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e13+5;
const int maxn=1e6+8;
const double PI=acos(-1);
const ll mod=1e9+7;
ll n,m;
int main()
{
    scanf("%lld%lld",&n,&m);
    ll x=m-n+1;
    ll y=m+n-1;
    if(x<-1000000) x=-1000000;
    if(y>1000000) y=1000000;
    for(int i=x;i<=y;i++)
        printf("%d ",i);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}


void solve(long long L){
    double e=L/3.0;
    sp(e*e*e);
}

int main(){
    long long L;
    scanf("%lld",&L);
    solve(L);
    return 0;
}


Measured memory_bytes: 256
X, K, D = map(int, input().split())
INF = 1000000000000001
ans = INF

r_div = abs(X) // D
r_mod = abs(X) % D

if K <= r_div:
    ans = min(abs(X - (K * D)), abs(X + (K * D)))
elif K > r_div:
    if (K - r_div) % 2 == 0:
        ans = r_mod
    else:
        ans = abs(r_mod - D)

print(ans)
# print(X, K, D, r_div, r_mod)

Measured memory_bytes: 9184
#include <iostream>
#include <string>
using namespace std;
 
int main() {
   int N, A, B, c, d;
  cin >> N >> A >> B;
   if (A > B) {
    c = B;
    }else {
        c = A; 
    }
 
    if (N > A+B) {
		d = 0;
    }else {
        d = A+B-N; 
    }
 
    
  
    cout << c << " " << d << endl;
}


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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(), a.rend()
#define ll long long
#define endl "\n"

typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;

#define for0(i, a, b) for(int i = a; i < b; ++i)
#define for1(i, b, a) for(int i = b; i >= a; --i)
#define test_case(t) int t; cin >> t; while (t--)

#define prec(n) fixed<<setprecision(n)
#define inf (int)(1e18)
#define MAX 1000002
#define MOD 1e9 + 7

void solve() {
    int n;
    cin>>n;

    int cnt = 0, ma = 0;

    while(n--)
    {
        int x, y;
        cin>>x>>y;

        if(x == y)
        {
            cnt++;
            ma = max(ma, cnt);
        }

        else
        {
            cnt = 0;
        }
    }

    if(ma >= 3)
        cout<<"Yes\n";

    else
        cout<<"No\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t = 1;

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

    return 0;
}

Measured memory_bytes: 3648
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)1e5 + 5;

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

Measured memory_bytes: 256
// I make this just for fun because i'm done
// Aimi Haraguni >> Konomi Suzuki >> Yui >>  Ikimono Gakari >> Garnidelia >> Kalafina >> Eir Aoi.   .. dude? 
// problems that involves any kind of persistent data structures are the best of the best, are not them?
 
// #pragma GCC optimize ("Ofast,unroll-loops")
// #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
 
#define pb push_back
#define ff  first
#define ss second
#define tm1 first
#define tm2 second.first
#define tm3 second.second
#define sz(x) ll(x.size())
#define fill(x, v) memset(x, v, sizeof(x))
#define all(v) (v).begin(), (v).end()
#define FER(i,a,b) for(ll i=ll(a); i< ll(b); ++i)
#define IFR(i,a,b) for(ll i=ll(a); i>=ll(b); --i )
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
 
#define N 2010
// #define M 19
 
#define mod 998244353
#define mod1 1000000007
#define mod2 1000000009
#define bas 987625403
#define sqr(x) (x)*(x)  
#define INF 2000000000000000000
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii > tri;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> set_t;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
 
#define trace(...) fff(#__VA_ARGS__, __VA_ARGS__)
 
template<typename t> void fff(const char* x, t&& val1){
    cout<<x<< " : "<<val1<<endl;
}
template<typename t1, typename... t2> void fff(const char* x, t1&& val1, t2&&... val2){
    const char* xd=strchr(x+1, ',');
    cout.write(x, xd-x)<<" : "<<val1<<" | ";
    fff(xd+1, val2...);
}

int main(){
	fastio;
	ll s, w; cin>>s>>w;
	w>=s? cout<<"unsafe\n": cout<<"safe\n";
	return 0;
}

Measured memory_bytes: 3652
# coding: utf-8

def main():
    S = list(input())
    N = len(S)
    A = [0] * (N + 1)
    ans = 0

    for i in range(N):
        if S[i] == '<':
            A[i + 1] = A[i] + 1
    for i in range(N - 1, -1, -1):
        if S[i] == '>':
            if A[i] <= A[i + 1]:
                A[i] = A[i + 1] + 1

    ans = sum(A)

    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 32340
#include <iostream>
#include <algorithm>
#include<vector>

using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	if (r <= x&&r <= w - x&&r <= y&&r <= h - y) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

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

int main ()
{
  string N;
  cin >> N;
  
  if (N[0] == N[1] && N[0] == N[2] )
  {
    cout << "Yes" << endl;
  }
  else if(N[1] == N[2] && N[1] == N[3])
  {
    cout << "Yes" << endl;
  }
  else if(N[0] == N[1] && N[0] == N[2] && N[0] == N[3])
  {
    cout << "Yes" << endl;
  }
  else
  {
     cout << "No" << endl;
  }
}

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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

signed main(){
	int N=read();
	int a[N];
	REP(i,N){
		a[i]=read();
	}
	
	sort(a,a+N);
	
	cout << a[N-1]-a[0];
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	ss := make([]string, n)
	for i := range ss {
		fmt.Scan(&ss[i])
	}
	counter := make(map[string]int)
	for _, s := range ss {
		counter[s]++
	}

	if len(counter) == 3 {
		fmt.Println("Three")
	} else {
		fmt.Println("Four")
	}
}


Measured memory_bytes: 512
//AnkitCode99 (DP)....
//every ups and downs matter!

#include<bits/stdc++.h>

#define fast ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr)
typedef long long int ll;

using namespace std;

const ll sz=1e5+5;
const ll MOD=1e9+7;

ll n,m,cache[1005][1005];
char ch[1005][1005];

ll dp(ll r,ll c)
{
    if(r>n or c>m)
        return 0;

    if(ch[r][c]=='#')
        return 0;

    if(r==n and c==m)
        return 1;

    ll &ans=cache[r][c];
    if(ans!=-1)
        return ans;

    ans=dp(r+1,c)+dp(r,c+1);
    ans%=MOD;
    return ans;
}

int main()
{
    fast;
    
    memset(cache,-1,sizeof cache);
    cin>>n>>m;
    for (int i = 1;i<=n; ++i)
    {
        for (int j= 1; j <= m; ++j)
        {
            cin>>ch[i][j];
        }
    }

    cout<<dp(1,1);
}//Goodbye...

Measured memory_bytes: 9216
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split(" ");
	//文字列から10進数に変換するときはparseIntを使う
	var a = parseInt(tmp[0], 10);
	var b = parseInt(tmp[1], 10);
	var c = parseInt(tmp[2], 10);
	var answer = "Yes";
  	if( a + b < c ){
      answer = "No";
    }
	//出力
	console.log(answer);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 18892
#include <iostream>
#include <vector>
#include <algorithm>
#include<math.h>



int main(void){

  long long n;
  unsigned long long a = pow(10,9);
  std::cin>> n;
  unsigned long long ans = 1;
  for(long long i=1; i< n+1; i++){
    ans = ans*i;
    if(ans > a + 7){
      ans %=  (a + 7);
    }
  }
  std::cout<< ans % (a + 7) << "\n";
  return 0;
}


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

class Node {
public:
	int id_;
	int dist_;
	list<Node*> f_;
	void dik(int d) {
		if (d < dist_) {
			dist_ = d;
//			cout << id_ << "," << dist_ << endl;
			for (auto it = f_.begin(); it != f_.end(); it++) {
				(*it)->dik(dist_ + 1);
			}
		}
	};
//	void printLink() {
//		for (auto it = f_.begin(); it != f_.end(); it++) {
//			cout << "Link " << id_ << " to " << (*it)->id_ << endl;
//		}
//	}
};


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

	int N, X, Y;
	cin >> N >> X >> Y;
	vector<int> k(N + 1, 0);

	Node* nodes = new Node[N];
	for (int i = 0; i < N; i++) {
		nodes[i].id_ = i + 1;
	}
	for (int i = 0; i < N - 1; i++) {
		nodes[i  ].f_.push_back(nodes + i + 1);
		nodes[i+1].f_.push_back(nodes + i);
	}
	nodes[X - 1].f_.push_back(&(nodes[Y - 1]));
	nodes[Y - 1].f_.push_back(&(nodes[X - 1]));

//	for (int i = 0; i < N; i++) {
//		nodes[i].printLink();
//	}

	for (int j = 0; j < N; j++) {
		nodes[j].dist_ = N;
	}
	for (int i = 0; i < N; i++) {
//		cout << "start" << endl;
		nodes[i].dik(0);
//		cout << "stop" << endl;
		for (int j = 0; j < N; j++) {
			k.at(nodes[j].dist_)++;
			nodes[j].dist_ = N;
		}
	}

	for (int i = 1; i < N; i++) {
		cout << k.at(i) / 2 << endl;
	}
}






Measured memory_bytes: 512
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
 
    using namespace std;
    using namespace __gnu_pbds;
 
    #define endl "\n"
    #define fi first
    #define se second
    #define pb push_back
    #define int long long
    #define ll long long
    #define ld long double
    #define pii pair<ll,ll>
 
    #define read(t) ll t;cin>>t;
    #define all(value) value.begin(),value.end()
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define For(i,n) for(ll i=0;i<n;i++)
 
    #define what(value) cerr << #value << " is " << value << endl;
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;
 
    typedef tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> omultiset;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> oset;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> oset1;
 
/*.....................................................................................................................*/
 
   
    //a.erase(unique(a.begin(),a.end()),a.end());
    double pi=3.141592653589793238462641;
    ll dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
    const ll  man =(int)2e6+2 ,inf =1e18;
    const int mod=1e9+7;

    long long binpow(int a,int b,int m)
    {   
        a %= m;int res = 1;
        while (b > 0)
        { 
            if (b & 1)res=(res*a)%m;
            a=(a*a)%m  ;    b/=2; 
        }
        return res;
    }
    int modinv(int n,int m)
    {
        return binpow(n,mod-2,m);
    }

/*......................................................................................................................*/


signed main()
{
    fast;
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<3;i++)if(s[i]=='R')ans++;
    if(ans==2)
    {
        if(s[1]!='R')ans=1;
    }
    cout<<ans<<endl;
}   



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

ll A[105][100005];
ll solve(int* W, int* V, int n, int ind, int w){
    if(w == 0 || ind >= n){
        return 0;
    } else if(A[ind][w] != -1)  return A[ind][w];

    if(W[ind] <= w)
        return A[ind][w] = max(solve(W, V, n, ind+1, w-W[ind])+V[ind], solve(W, V, n, ind+1, w));
    else    return A[ind][w] = solve(W, V, n, ind+1, w);
}

int main(){
    int n, w;
    cin >> n >> w;
    int W[n], V[n];
    ll val = 0;
    for(int i = 0; i < n; i++){
        cin >> W[i] >> V[i];
    }
    memset(A, -1, sizeof(A));
    cout << solve(W, V, n, 0, w);
}

/*
Left Questions :
D. Knapsack 1
E. Knapsack 2
G. Longest Path
I. Coins

*/



Measured memory_bytes: 85496
o = input()
e = input()

ans = []
if len(o) == len(e):
    for i in range(len(e)):
        ans.append(o[i])
        ans.append(e[i])
else:
    ans.append(o[0])
    for i in range(len(e)):
        ans.append(e[i])
        ans.append(o[i+1])

print(''.join(ans))


Measured memory_bytes: 3060
//author: Harsh Nema
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 922337203685477;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main()
{
    fastio;
    ll a=0,b=0;
    cin>>a>>b;
    cout<<max(a+b,max(a-b,a*b));
    return 0;
}


Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include<string>
#include<cmath>
#include<stack>
#include <vector>
#include<queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
using namespace std;

int main() {
	long long a, b;
	cin >> a >> b;
	if (a*b <= 0) cout << "Zero" << endl;
	else if (a + b < 0 && (abs(a - b) % 2 == 0))cout << "Negative" << endl;
	else cout << "Positive" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>

namespace IO{
    const int insiz = 1 << 12, outsiz = 1 << 18;
    char in[insiz], *A(in), *B(in); char out[outsiz], *ptr(out);
    inline char getc(){
    	#ifndef LOCAL
        return (A == B) && (B = (A = in) + fread(in, 1, insiz, stdin), A == B) ? EOF : *A++;
        #endif
        return getchar();
    }
    template <typename T> inline T read(){
        T ret(0), p(1); char ch(getc());
        while(ch < '0' || ch > '9'){
            if(ch == '-') p = -1; ch = getc();
        }
        while(ch >= '0' && ch <= '9') ret = ret * 10 + ch - '0', ch = getc();
        return ret*p;
    }
    inline void flush(){ fwrite(out, 1, ptr - out, stdout); ptr = out; }
    template <typename T> inline void write(T x, char cmd = '\n'){
        if(x < 0) *ptr++ = '-', x = -x;
        if(x == 0) *ptr++ = '0';
        static char s[123]; int cnt = 0;
        for(; x; x /= 10) s[++cnt] = x % 10 + '0';
        for(; cnt; --cnt) *ptr++ = s[cnt];
        *ptr++ = cmd;
        if((outsiz >> 1) > ptr - out) flush();
    }
} using IO::getc; using IO::read; using IO::write; using IO::flush;

int v[112], c[112];

int main(){
	int n = read<int>();
	for(int i(1); i <= n; ++i){
		v[i] = read<int>();
	}
	for(int i(1); i <= n; ++i){
		c[i] = read<int>();
	}
	int ans(0);
	for(int i(1); i <= n; ++i){
		if(v[i] > c[i]) ans += v[i] - c[i];
	}
	write(ans);
	flush(); return 0;
}




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

typedef pair<int, int> Pii;

void readint(int N, vector<int> &a);
void readdouble(int N, vector<double> &a);
void readindex(int N, vector<int> &a);


int a2b(int a, int b){
    if(a >= b){
        return a - b;
    }else{
        return a2b(a + 2, b) + 1;
    }
}

signed main(){

    int A, B, C;
    cin >> A >> B >> C;

    int minv = min(min(A, B), C);
    int maxv = max(max(A, B), C);

    int ans = 100000;

    FOR(i, minv, maxv + 1){
        int v = a2b(A, i) + a2b(B, i) + a2b(C, i);
        if(v < ans) ans = v;
    }

    cout << ans;
    
    return 0;
}








void readint(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str());
}
void readdouble(int N, vector<double> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atof(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atof(s.c_str());
}
void readindex(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str()) - 1;
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str()) - 1;
}

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

#define each(i, c) for (auto& i : c)

typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

int main() {
  ll h, n;
  cin >> h >> n;

  vector<ll> a(n);
  for (ll i = 0; i < n; ++i) {
    cin >> a[i];
  }

  ll i = 0;
  for (i = 0; i < n; ++i) {
    h -= a[i];
    if (h <= 0) break;
  }

  if (i < n) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

//getintとかいうのそんなに速いのかなテスト

int getint()
{
	char ch;
	while (!isdigit(ch = getchar()));
	int x = ch - 48;
	while (isdigit(ch = getchar())) x = x * 10 + ch - 48;
	return x;
}


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


	int N = getint();
	ll D = getint();
	ll kotae = (N - 1) * D;
	int A[200001];
	ll C[200001];
	C[0] = 1e18;
	rep1(i, N) {
		A[i] = getint();
		kotae += A[i];
		C[i] = min(C[i - 1] + D, (ll)A[i]);
	}
	ll mae = 1e18;
	for (int i = N - 1; i > 1; i--) {
		mae = min(mae + D, (ll)A[i + 1]);
		ll kari = min(mae, C[i - 1]) + D;
		kotae += min((ll)A[i], kari);
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;

signed main() {
    int P, Q, R;
    cin >> P >> Q >> R;
    cout << min(P + Q, min(Q + R, P + R)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());
    cout << (a[0] == a[1] && a[0] == 5 && a[2] == 7 ? "YES\n" : "NO\n");
}


Measured memory_bytes: 256
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;

class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader  br = new BufferedReader(is);
		while (true) {
			String[] strAry = br.readLine().split(" ");
			int a = Integer.parseInt(strAry[0]);
			int b = Integer.parseInt(strAry[1]);
			if (a == 0 && b == 0) {
				break;
			} else if (a < b) {
				System.out.println(a + " " + b);
			} else if (b < a) {
				System.out.println(b + " " + a);
			} else if (a == b) {
				System.out.println(a + " " + b);
			}
		}
	}
}

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

int main(){
    int x, y;
    for(int i = 0; true; i++){
    cin >> x >> y;
    if ( x == 0 && y == 0 )
    break;  
    if (x < y ){
   cout << x << " " << y << endl;
} else {
    cout << y << " " << x << endl;
}
}

}



Measured memory_bytes: 3048
#include <iostream>
using namespace std;
int main(void){
    int a, b, c, d, l;
    cin >> l;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    
    cout << l - max((a - 1) / c + 1, (b - 1) / d + 1) << endl;
    
}



Measured memory_bytes: 3100
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;

int main(){
	int N , pt = 0 , px = 0 , py = 0;
	for(cin >> N ; N ; --N){
		int t , x , y; cin >> t >> x >> y;
		int len = abs(x - px) + abs(y - py);
		if(t - pt < len || ((pt - t + len) & 1)){
			puts("No"); return 0;
		}
	}
	puts("Yes"); return 0;
}

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


int main()
{
    int N;
    cin >> N;
    vector<long long> A(N);
    for( int i = 0; i < N; ++i ) cin >> A[i];


    // 二分探索
    vector<int> B(N);
    int B_l = 0, B_r = A[0];
    while(B_l <= B_r){
        B[0] = (B_l+B_r)/2; 
        for(int i = 1; i < N; ++i){
            B[i] = A[i-1]-B[i-1];
        }
        if(A[N-1] == B[0]+B[N-1]) break;
        if(A[N-1] > B[0]+B[N-1]) B_l = B[0]+1;
        else B_r = B[0]-1;
        //cout << B_l << " " << B_r << " " << B[0] << endl;
    }

    for(auto v: B) cout << 2*v << " ";
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 2432
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<string>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

using namespace std;

typedef long long int ll;

const ll INF=(ll)1e18;
const int MAXV=100000;

int N,W;

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

    ll dp[N+1][MAXV+1];
    REP(i,N+1)REP(j,MAXV+1)dp[i][j] = INF;

    dp[0][0] = 0;

    FOR(i,1,N+1){
      ll w,v;
      cin >> w >> v;
      REP(j,MAXV+1){
        if(dp[i-1][j] == INF)continue;

        // i個目を選ばない
        if(dp[i][j] > dp[i-1][j])dp[i][j] = dp[i-1][j];

        // i個目を選ぶ
        if(dp[i-1][j] + w <= W){
          if(dp[i][j+v] > dp[i-1][j] + w)dp[i][j+v] = dp[i-1][j] + w;
        }
      }

    }
    ll ans = 0;
    for(int i = MAXV; i >= 0; i--){
      if(dp[N][i] != INF){
        ans = i;
        break;
      }
    }
    cout << ans << endl;
}


Measured memory_bytes: 79104
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)
 
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;
}
const ll INF = 10010001010;
const int inf = 1000034000;
 
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
 
int main() {
  string S,T;
  cin >>S>>T;
  int ans = 0;
  for(int i = 0;i < S.size();i++){
    if(S[i] != T[i]){
      ans++;
    }
  }
  cout << ans << endl;
} 

Measured memory_bytes: 3844
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cout << #x << ": " << x << '\n';
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif

    int n;
    cin >> n;

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

    vector <int> ans(n);
    int ptr = 0;
    for (int i = n - 1; i >= 0; i -= 2) {
        ans[ptr++] = a[i];
    }   
    ptr = n - 1;
    for (int i = n - 2; i >= 0; i -= 2) {
        ans[ptr--] = a[i];
    }   
    for (auto e : ans)
        cout << e << ' ';
    cout << endl;
}

Measured memory_bytes: 6368
readlines.each do |line|
  h, w = line.split.map(&:to_i)
  break if h == 0 && w == 0

  (1..h).each do |i|
    if i.odd?
      puts (1..w).map { |j| j.odd? ? '#' : '.' }.join
    else
      puts (1..w).map { |j| j.odd? ? '.' : '#' }.join
    end
  end

  puts
end

Measured memory_bytes: 6108
#include <iostream>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <math.h>

using namespace std;


#define lli long long int

void swap1(lli *a, lli *b){
	lli tmp = *a;
	*a = *b;
	*b = tmp;
}

#define DEBUG 1
#define NUM 1000000007

int main(){

	lli n,m;
	lli ans=0;

	cin>>n>>m;

	if(n-m>=2 || m-n>=2){
		ans=0;
	}else{
		if(m>n){
			swap1(&n,&m);
		}
		ans=1;
		if(n-m==1){
			for(int i=1;i<=m;i++){
				ans = (ans*i)%NUM;
			}
			for(int j=1;j<=n;j++){
				ans = (ans*j)%NUM;
			}
		}
		else{
			for(int j=0;j<2;j++){
				for(int i=1;i<=m;i++){
					ans = (ans*i)%NUM;
				}
			}
			ans = (ans*2)%NUM;
		}	
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>

using namespace std;
typedef long long ll;

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

int main() {

    ll N,M;
    string S,T;
    cin >> N >> M >> S >> T;
    ll L = N*M/__gcd(N,M);
    map<ll,char> X;
    ll out = L;
    rep(i,N) X.emplace(i*L/N,S[i]);
    rep(i,M){
        if(X.count(i*L/M)){
            char s = X.at(i*L/M);
            if(s!=T[i]){
                out = -1;
                break;
            }
        }
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll, ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define pdd pair<double, double>
#define f first
#define s second
#define MOD 1000000007
#define mkp make_pair
#define M_PI 3.14159265358979323846
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define LOR(i,l,r) for (ll i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)
#define LORD(i,r,l) for (ll i=r;i>=l;i--)
#define INF 1000000000
#define CL(x) memset(x,0,sizeof(x))
#define DEB(x) cout << #x << " : " << x << '\n'
#define ALL(x) x.begin(), x.end()
#define SZ(x) x.size()
#define UI(x) (int)(x-'A')
#define LI(x) (int)(x-'a')
typedef long long ll;

#define MXN 30
int N,A[MXN],B[MXN],C[MXN];

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

    cin>>N;
    FOR(i,1,N)cin>>A[i];
    int S=0;
    FOR(i,1,N)
    {
        cin>>B[i];
        S+=B[i];
    }
    FOR(i,1,N-1)cin>>C[i];

    FOR(i,2,N)
    {
        if( A[i-1]==A[i]-1 )S+=C[ A[i-1] ];
    }

    cout<<S<<'\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e6+100;
int a[N];

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    for(int i=1;i<=100;i++)
        for(int j=1;j<=100;j++)
    for(int r=1;r<=100;r++){
         int k=i*i+j*j+r*r+i*j+i*r+j*r;
         a[k]++;
    }
    int n;cin>>n;
    for(int i=1;i<=n;i++)
        cout<<a[i]<<endl;
    return 0;
}


Measured memory_bytes: 3840
# coding: utf-8
n,m = map(int,input().split())
right = n
left = 0

for i in range(m):
    l,r = map(int,input().split())
    left = max(left,l)
    right = min(right,r)
if right< left:
    print(0)
else:
    print(right-left+1)

Measured memory_bytes: 3060
IDENTIFICATION DIVISION.
      PROGRAM-ID. 121A.
      DATA DIVISION.
      WORKING-STORAGE SECTION.
      01 INP PIC X(100).
      01 BH PIC 9(2).
      01 BW PIC 9(2).
      01 LH PIC 9(2).
      01 LW PIC 9(2).
      01 ANS PIC 9(5).
      01 ANSS PIC ZZZZ9.
      
      PROCEDURE DIVISION.
 
      ACCEPT INP.
      UNSTRING INP DELIMITED BY " "
	  INTO BH BW.

      ACCEPT INP.
      UNSTRING INP DELIMITED BY " "
	  INTO LH LW.

      COMPUTE ANS = ( BH - LH ) * ( BW - LW ).
	  MOVE ANS TO ANSS.   
      DISPLAY ANSS.
      STOP RUN.


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;
struct P{
  double cost;
  int pos,pre,num;
  P(double cost,int pos,int pre,int num):cost(cost),pos(pos),pre(pre),num(num){}
  bool operator < (const P &a) const{return cost>a.cost;} 
};
typedef complex<double> point;
point z[21];
int n;
double r,x;
vector <P> e[21][21];
bool check(point a,point b){
  a*=conj(b);
    return 180.0*(abs(arg(a))/M_PI)<=x;
}

double D[10001][21][21];
int dijkstra(){
  int res=0;
  for(int i=0;i<10001;i++)for(int j=0;j<n;j++)for(int k=0;k<n;k++) D[i][j][k]=INF;
  priority_queue<P> Q; 
  Q.push(P(0,0,0,0));
  D[0][0][0]=0;

  while(!Q.empty()){
    P t=Q.top();Q.pop();
    double cost=t.cost;
    int pos=t.pos,pre=t.pre,num=t.num;
    if(cost>r) continue;
    if(D[num][pos][pre]<cost) continue;
    res=max(res,num);
    for(int i=0;i<e[pos][pre].size();i++){
      int nx=e[pos][pre][i].pos;
      double ncost=cost+e[pos][pre][i].cost;
      double &a=D[num+1][nx][pos];
      if(a>ncost){
	Q.push(P(ncost,nx,pos,num+1));
	a=ncost;
      }
    }
  }
  return res;
}

int main(){
  cin>>n>>r>>x;
  for(int i=0;i<n;i++){
    double a,b;
    cin>>a>>b;
    z[i]=point(a,b);
  }

  for(int i=0;i<n;i++) //pos
    for(int j=0;j<n;j++)//pre
      for(int k=0;k<n;k++){ // to
	double cost=abs(z[i]-z[k]);
	if(i!=k&&i!=j&&check(z[i]-z[j],z[k]-z[i]))e[i][j].push_back(P(cost,k,0,0));
      }

  for(int i=1;i<n;i++)e[0][0].push_back(P(abs(z[0]-z[i]),i,0,0));
  cout <<dijkstra()<<endl;
  return 0;
}

Measured memory_bytes: 36160
import java.util.Scanner;

public class Main {
// D
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		long n=scn.nextInt();
		long x=(long)((n-1)*n);
		//System.out.println(x);
		System.out.println(x/2);
	}

}


Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#define mod 1000000007
#define ten5 100005
#define PI 3.1415926
using namespace std;

int num[26];

int main()
{
    //int m,n,o=0,i,j,k;
    long long int sum=0,sum2=0,n1=0,n2=0,n3;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=1,now=1;
    long long int a,a1,a2,a3,a4;
    //float f,g,h;
    //char now,pre;
    string s,s1;
    cin>>s;
    a=s.size();
    for(i=0;i<a;i+=2)
    {
        cout<<s[i];
    }
    return 0;
}



Measured memory_bytes: 512
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
using namespace std;
#define in read()
#define fur(i,a,b) for(int i=a;i<=b;i++)
#define fdr(i,a,b) for(int i=a;i>=b;i--)
#define int long long
#define xx 1100
inline int read()
{
    int x=0,f=1;char ch=getchar();
    for(;!isalnum(ch);ch=getchar()) if(ch=='-') f=-1;
    for(;isalnum(ch);ch=getchar()) x=x*10+ch-'0';
    return x*f;
}
int sum[xx],w[xx],f[xx<<3];
vector<int>e[xx];
inline void dfs(int g)
{
	fur(i,0,(int)e[g].size()-1) dfs(e[g][i]);
	memset(f,0x3f,sizeof(f));f[0]=0;
	fur(i,0,(int)e[g].size()-1)
	{
		int k=e[g][i];
		fdr(j,w[g],0)
		{
			int tmp=0x3f3f3f3f;
			if(j>=sum[k]) tmp=min(tmp,f[j-sum[k]]+w[k]);
			if(j>=w[k]) tmp=min(tmp,f[j-w[k]]+sum[k]);
			f[j]=tmp;
		}
	}
	fdr(i,w[g],0) sum[g]=min(sum[g],f[i]);
}
signed main()
{
	memset(sum,0x3f,sizeof(sum));
    int n=in;
    fur(i,2,n)
    {
        int x=in;
        e[x].push_back(i);
    }
    fur(i,1,n) w[i]=in;
    dfs(1);
    if(sum[1]<0x3f3f3f3f) printf("POSSIBLE\n");
    else printf("IMPOSSIBLE\n");
    return 0;
}


Measured memory_bytes: 384
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

const M: i64 = 1_000_000_000;
fn main() {
    let n: usize = read();

    let mut xl = Vec::new();
    for _ in 0..n {
      let t = read_touple::<i64>();
      xl.push(t);
    }
    xl.sort_by(|a, b| a.cmp(&b));

    let mut v = Vec::new();
    for i in 0..n {
      let (x, l) = xl[i];
      v.push((x-l, x+l));
    }

    v.sort_by(|a, b| a.1.cmp(&b.1));

    let mut ans: usize = n;
    let (mut a, mut b) = v[0];
    for i in 1..n {
      let (l, r) = v[i];

      if l < b {
         ans -= 1;
      } else {
        a = v[i].0;
        b = v[i].1;
      }
    }
    //println!("{:?}", v);
    println!("{}", ans);
}


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

int main()
{
	string s;
	cin >> s;
	
	if (s == "SUN")
	{
		cout << 7 << endl;
	}
	else if (s == "SAT")
	{
		cout << 1 << endl;
	}
	else if (s == "FRI")
	{
		cout << 2 << endl;
	}
	else if (s == "THU")
	{
		cout << 3 << endl;
	}
	else if (s == "WED")
	{
		cout << 4 << endl;
	}
	else if (s == "TUE")
	{
		cout << 5 << endl;
	}
	else if (s == "MON")
	{
		cout << 6 << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
N,M=map(int,input().split())
L = []
R = []
for i in range(M):
    x1,y1=[int(i) for i in input().split()]
    L.append(x1)
    R.append(y1)

L2=max(L)
R2=min(R)

if L2<=R2:
    print(R2-L2+1)
else:
    print(0)

Measured memory_bytes: 11036
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(),a.end()
#define forn(i,n) for(int i=0;i<int(n);i++)
#define forr(i,n) for(int i=int(n-1);i>=0;i--)
#define fora(i,a,b) for(int i=int(a);i<=int(b);i++)
#define forb(i,a,b) for(int i=int(a);i>=int(b);i--)
#define mod 1000000007
using namespace std;
using ll=long long int;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vii;
typedef pair<ll ,ll> pii;
template<typename T>
string ts(T v)
{
	string res="{";
	bool r=true;
	for(const auto &x:v)
	{
		if(!r)res+=",";
		r=false;
		res+=to_string(x);
	}
	res+="}";
	return res;
}
void solve()
{
	string a,b;
	cin>>a>>b;
	int n=a.size();
	int ans=0;
	forn(i,n)
	{
		if(a[i]!=b[i])ans++;
	}
	cout<<ans<<endl;
	
	
}
int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
	solve();
    return 0;
}


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

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

    vector<int> A(N);
    rep(i,0,N-1) {
        int tmp; cin >> tmp;
        A[tmp - 1]++;
    }

    rep(i,0,N) cout << A[i] << endl;
}


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

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

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


    int cnt = 0;
    while(true) {
        bool flag = true;
        for(int i=0; i<N; ++i) {
            if(a[i]%2 != 0) flag = false;
            a[i] /= 2;
        }
        if(!flag) break;
        ++cnt;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ok cout << "ok" << endl;
#define sp << " " <<
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


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

    string s;
    cin >> s;

    int res;
    if(s == "SAT"){
        res = 1;
    }
    if(s == "SUN"){
        res = 7;
    }
    if(s == "MON"){
        res = 6;
    }
    if(s == "TUE"){
        res = 5;
    }
    if(s == "WED"){
        res = 4;
    }
    if(s == "THU"){
        res = 3;
    }
    if(s == "FRI"){
        res = 2;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String args[] ) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int T = 0;
        int X = 0;
        int Y = 0;
        int X_point = 0;
        int Y_point = 0;
        int T_now = 0;
        for (int i = 0; i < N; i++) {
            int dis = 0;
            int X_len = 0;
            int Y_len = 0;
            
            T = sc.nextInt();
            if(i == 0){
                T_now = T;
            }else{
                T_now = T -T_now;
            }

            X = sc.nextInt();
            Y = sc.nextInt();
            X_point = X - X_point;
            Y_point = Y - Y_point;
            

            if(X_point < 0){
                X_len = -1 * X_point;
            }else{
                X_len = X_point;
            }
            if(Y_point < 0){
                Y_len = -1 * Y_point;
            }else{
                Y_len = Y_point;
            }
            dis = X_len + Y_len;
            if(dis > T_now){
                System.out.println("No");
                System.exit(0);
            }else if((T_now - dis) % 2 == 1){
                System.out.println("No");
                System.exit(0);
            }
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 87260
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

/* see https://github.com/pllk/cphb/ */
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
    tree_order_statistics_node_update> indexed_set;

typedef unsigned int uint;
typedef long long ll;
//typedef __int128 lll;

#define fori(n) for(ll i=0; i<(n); i++)

typedef pair<int, int> pii;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main() {
cin.tie(nullptr);
std::ios::sync_with_stdio(false);
    int n, k;
    cin>>n>>k;
    vvi tree(n+1);
    fori(n-1) {
        int u, v;
        cin>>u>>v;
        tree[u].push_back(v);
        tree[v].push_back(u);
    }

    const int MOD=1e9+7;
    const int ROOT=1;

    ll ans=1;
    // d=number of used colors in parent and sisters
    function<void(int, int, int)> dfs=[&](int node, int p, int d) {
 // note: id d>=k then no way to color the tree with only k colors
        ans=ans*(k-d);
        ans%=MOD;
        int i=1;
        if(node!=ROOT)
            i++;
        for(int c : tree[node])
            if(c!=p)
                dfs(c, node, i++);
    };

    dfs(ROOT, 0, 0);

/*
    for(int i=k-1; i>=2; i--) {
        ans*=i;
        ans%=MOD;
    }
*/

    cout<<ans<<endl;
}



Measured memory_bytes: 11648
#include<bits/stdc++.h>
#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 ALL(x) x.begin(),x.end()
#define REVERSE(x) reverse(x.begin(),x.end())
#define SORT(x,n) sort(x,x)
#define P pair<int,int>
typedef long long LL;
const int INF=1000000007;
using namespace std;
int main(){
    string S;
    cin>>S;
    if(S=="Sunny"){
        cout<<"Cloudy";
    }
    if(S=="Cloudy"){
        cout<<"Rainy";
    }
    if(S=="Rainy"){
        cout<<"Sunny";
    }
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n];
	for(int i=0 ;i<n ;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	int res = a[n-1] - a[0];
	cout<<res;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<iomanip>
#define LL long long
using namespace std;
int dp[55][5];
int dfs(int n, int m){
    int&r = dp[n][m];
    if(r!=-1)return r;
    if(m==0){
        return r=n==0;
    }
    r=0;
    for(int i=0;i<=9;i++){
        if(n>=i){
            r+=dfs(n-i,m-1);
        }
    }
    return r;
}

int main(){
    memset(dp, -1, sizeof(dp));
    int n;
    while(cin>>n){
        cout<<dfs(n,4)<<endl;
    }
    return 0;
}



Measured memory_bytes: 2992
n = int(input())
a = [int(_) for _ in input().split()]
neighbor = True
change_count = 0
while neighbor:
    neighbor = False
    for i in range(n-1, 0, -1):
        if a[i] < a[i-1]:
            change_count += 1
            a_tmp = a[i]
            a[i] = a[i-1]
            a[i-1] = a_tmp
            neighbor = True
for i in range(n-1):
    print(a[i], end=" ")
print(a[n-1])
print(change_count)



Measured memory_bytes: 5608